@fluentui-copilot/react-send-button 0.0.0-nightly-20250416-0405-24e1479b.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.json +20 -0
  2. package/CHANGELOG.md +13 -0
  3. package/LICENSE +23 -0
  4. package/README.md +5 -0
  5. package/dist/index.d.ts +68 -0
  6. package/lib/SendButton.js +2 -0
  7. package/lib/SendButton.js.map +1 -0
  8. package/lib/components/SendButton/SendButton.js +12 -0
  9. package/lib/components/SendButton/SendButton.js.map +1 -0
  10. package/lib/components/SendButton/SendButton.types.js +4 -0
  11. package/lib/components/SendButton/SendButton.types.js.map +1 -0
  12. package/lib/components/SendButton/buttonMotion.js +151 -0
  13. package/lib/components/SendButton/buttonMotion.js.map +1 -0
  14. package/lib/components/SendButton/index.js +5 -0
  15. package/lib/components/SendButton/index.js.map +1 -0
  16. package/lib/components/SendButton/renderSendButton.js +38 -0
  17. package/lib/components/SendButton/renderSendButton.js.map +1 -0
  18. package/lib/components/SendButton/useSendButton.js +117 -0
  19. package/lib/components/SendButton/useSendButton.js.map +1 -0
  20. package/lib/components/SendButton/useSendButtonStyles.styles.js +212 -0
  21. package/lib/components/SendButton/useSendButtonStyles.styles.js.map +1 -0
  22. package/lib/index.js +2 -0
  23. package/lib/index.js.map +1 -0
  24. package/lib-commonjs/SendButton.js +29 -0
  25. package/lib-commonjs/SendButton.js.map +1 -0
  26. package/lib-commonjs/components/SendButton/SendButton.js +21 -0
  27. package/lib-commonjs/components/SendButton/SendButton.js.map +1 -0
  28. package/lib-commonjs/components/SendButton/SendButton.types.js +7 -0
  29. package/lib-commonjs/components/SendButton/SendButton.types.js.map +1 -0
  30. package/lib-commonjs/components/SendButton/buttonMotion.js +233 -0
  31. package/lib-commonjs/components/SendButton/buttonMotion.js.map +1 -0
  32. package/lib-commonjs/components/SendButton/index.js +32 -0
  33. package/lib-commonjs/components/SendButton/index.js.map +1 -0
  34. package/lib-commonjs/components/SendButton/renderSendButton.js +54 -0
  35. package/lib-commonjs/components/SendButton/renderSendButton.js.map +1 -0
  36. package/lib-commonjs/components/SendButton/useSendButton.js +118 -0
  37. package/lib-commonjs/components/SendButton/useSendButton.js.map +1 -0
  38. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.js +299 -0
  39. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.js.map +1 -0
  40. package/lib-commonjs/index.js +29 -0
  41. package/lib-commonjs/index.js.map +1 -0
  42. package/package.json +41 -0
package/CHANGELOG.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@fluentui-copilot/react-send-button",
3
+ "entries": [
4
+ {
5
+ "date": "Wed, 16 Apr 2025 04:13:14 GMT",
6
+ "tag": "@fluentui-copilot/react-send-button_v0.0.0-nightly-20250416-0405-24e1479b.1",
7
+ "version": "0.0.0-nightly-20250416-0405-24e1479b.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "fluentui-internal@service.microsoft.com",
12
+ "package": "@fluentui-copilot/react-send-button",
13
+ "commit": "not available",
14
+ "comment": "Release nightly"
15
+ }
16
+ ]
17
+ }
18
+ }
19
+ ]
20
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Change Log - @fluentui-copilot/react-send-button
2
+
3
+ This log was last generated on Wed, 16 Apr 2025 04:13:14 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## [0.0.0-nightly-20250416-0405-24e1479b.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-send-button_v0.0.0-nightly-20250416-0405-24e1479b.1)
8
+
9
+ Wed, 16 Apr 2025 04:13:14 GMT
10
+
11
+ ### Changes
12
+
13
+ - Release nightly ([commit](https://github.com/microsoft/fluentai/commit/not available) by fluentui-internal@service.microsoft.com)
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ @fluentui-copilot/react-send-button
2
+
3
+ MIT License
4
+
5
+ Copyright (c) Microsoft Corporation.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @fluentui-copilot/react-send-button
2
+
3
+ **For internal use only. External use is not supported at this time.**
4
+
5
+ **React Send Button components for [Fluent AI React](https://ai.fluentui.dev/)**
@@ -0,0 +1,68 @@
1
+ import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
2
+ import type { ButtonProps } from '@fluentui/react-components';
3
+ import type { ButtonState } from '@fluentui/react-components';
4
+ import type { ComponentProps } from '@fluentui/react-components';
5
+ import type { ComponentState } from '@fluentui/react-components';
6
+ import type { CopilotMode } from '@fluentui-copilot/react-provider';
7
+ import type { DesignVersion } from '@fluentui-copilot/react-provider';
8
+ import type { ForwardRefComponent } from '@fluentui/react-components';
9
+ import type { PresenceMotionSlotProps } from '@fluentui/react-motion';
10
+ import * as React_2 from 'react';
11
+ import type { Slot } from '@fluentui/react-components';
12
+ import type { SlotClassNames } from '@fluentui/react-components';
13
+
14
+ /**
15
+ * Render the final JSX of SendButton
16
+ */
17
+ export declare const renderSendButton_unstable: (state: SendButtonState) => JSX.Element;
18
+
19
+ export declare const SendButton: ForwardRefComponent<SendButtonProps>;
20
+
21
+ export declare const sendButtonClassNames: SlotClassNames<SendButtonSlots>;
22
+
23
+ /**
24
+ * SendButton Props
25
+ */
26
+ export declare type SendButtonProps = ComponentProps<Partial<SendButtonSlots>> & Pick<ButtonProps, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> & DesignVersion & CopilotMode & {
27
+ /**
28
+ * Checks whether query is sending.
29
+ */
30
+ isSending?: boolean;
31
+ isSendIconFilled?: boolean;
32
+ };
33
+
34
+ export declare type SendButtonSlots = {
35
+ root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;
36
+ sendIcon: NonNullable<Slot<'span'>>;
37
+ stopIcon?: Slot<'span'>;
38
+ /** Stop button's circle background */
39
+ stopBackground: NonNullable<Slot<'div'>>;
40
+ sendButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
41
+ stopButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
42
+ stopBackgroundMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
43
+ };
44
+
45
+ /**
46
+ * State used in rendering SendButton
47
+ */
48
+ export declare type SendButtonState = ComponentState<SendButtonSlots> & Pick<ButtonState, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> & Pick<SendButtonProps, 'isSendIconFilled' | 'isSending'> & Pick<Required<SendButtonProps>, 'designVersion' | 'mode'> & {
49
+ isButtonMotionRunning?: boolean;
50
+ };
51
+
52
+ /**
53
+ * Create the state required to render SendButton.
54
+ *
55
+ * The returned state can be modified with hooks such as useSendButtonStyles_unstable,
56
+ * before being passed to renderSendButton_unstable.
57
+ *
58
+ * @param props - props from this instance of SendButton
59
+ * @param ref - reference to root HTMLElement of SendButton
60
+ */
61
+ export declare const useSendButton_unstable: (props: SendButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SendButtonState;
62
+
63
+ /**
64
+ * Apply styling to the SendButton slots based on the state
65
+ */
66
+ export declare const useSendButtonStyles_unstable: (state: SendButtonState) => SendButtonState;
67
+
68
+ export { }
@@ -0,0 +1,2 @@
1
+ export { SendButton, renderSendButton_unstable, useSendButton_unstable, sendButtonClassNames, useSendButtonStyles_unstable } from './components/SendButton';
2
+ //# sourceMappingURL=SendButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SendButton.ts"],"sourcesContent":["export {\n SendButton,\n renderSendButton_unstable,\n useSendButton_unstable,\n sendButtonClassNames,\n useSendButtonStyles_unstable,\n} from './components/SendButton';\nexport type { SendButtonProps, SendButtonSlots, SendButtonState } from './components/SendButton';\n"],"names":["SendButton","renderSendButton_unstable","useSendButton_unstable","sendButtonClassNames","useSendButtonStyles_unstable"],"rangeMappings":"","mappings":"AAAA,SACEA,UAAU,EACVC,yBAAyB,EACzBC,sBAAsB,EACtBC,oBAAoB,EACpBC,4BAA4B,QACvB,0BAA0B"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { useSendButton_unstable } from './useSendButton';
3
+ import { renderSendButton_unstable } from './renderSendButton';
4
+ import { useSendButtonStyles_unstable } from './useSendButtonStyles.styles';
5
+ // SendButton component - TODO: add more docs
6
+ export const SendButton = /*#__PURE__*/React.forwardRef((props, ref) => {
7
+ const state = useSendButton_unstable(props, ref);
8
+ useSendButtonStyles_unstable(state);
9
+ return renderSendButton_unstable(state);
10
+ });
11
+ SendButton.displayName = 'SendButton';
12
+ //# sourceMappingURL=SendButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SendButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSendButton_unstable } from './useSendButton';\nimport { renderSendButton_unstable } from './renderSendButton';\nimport { useSendButtonStyles_unstable } from './useSendButtonStyles.styles';\nimport type { SendButtonProps } from './SendButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// SendButton component - TODO: add more docs\nexport const SendButton: ForwardRefComponent<SendButtonProps> = React.forwardRef((props, ref) => {\n const state = useSendButton_unstable(props, ref);\n\n useSendButtonStyles_unstable(state);\n return renderSendButton_unstable(state);\n});\n\nSendButton.displayName = 'SendButton';\n"],"names":["React","useSendButton_unstable","renderSendButton_unstable","useSendButtonStyles_unstable","SendButton","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,+BAA+B;AAI5E,6CAA6C;AAC7C,OAAO,MAAMC,2BAAmDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQP,uBAAuBK,OAAOC;IAE5CJ,6BAA6BK;IAC7B,OAAON,0BAA0BM;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * State used in rendering SendButton
3
+ */export {};
4
+ //# sourceMappingURL=SendButton.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SendButton.types.ts"],"sourcesContent":["import type { CopilotMode, DesignVersion } from '@fluentui-copilot/react-provider';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ButtonProps, ButtonState, ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nexport type SendButtonSlots = {\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n sendIcon: NonNullable<Slot<'span'>>;\n stopIcon?: Slot<'span'>;\n /** Stop button's circle background */\n stopBackground: NonNullable<Slot<'div'>>;\n sendButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;\n stopButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;\n stopBackgroundMotion: NonNullable<Slot<PresenceMotionSlotProps>>;\n};\n\n/**\n * SendButton Props\n */\nexport type SendButtonProps = ComponentProps<Partial<SendButtonSlots>> &\n Pick<ButtonProps, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> &\n DesignVersion &\n CopilotMode & {\n /**\n * Checks whether query is sending.\n */\n isSending?: boolean;\n isSendIconFilled?: boolean;\n };\n\n/**\n * State used in rendering SendButton\n */\nexport type SendButtonState = ComponentState<SendButtonSlots> &\n Pick<ButtonState, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> &\n Pick<SendButtonProps, 'isSendIconFilled' | 'isSending'> &\n Pick<Required<SendButtonProps>, 'designVersion' | 'mode'> & {\n isButtonMotionRunning?: boolean;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AA6BA;;CAEC,GACD,WAKI"}
@@ -0,0 +1,151 @@
1
+ import { createPresenceComponent, motionTokens } from '@fluentui/react-components';
2
+ const scaleSend = 1.2;
3
+ const startScaleStop = 0.5;
4
+ const scaleStop = 1.2;
5
+ const startScaleCircle = 0.1;
6
+ const scaleCircle = 1.1;
7
+ const motionSpeedMultiplier = 1;
8
+ const sendMotion = () => {
9
+ const enterKeyframes = [{
10
+ keyframes: [{
11
+ transform: `scale(0)`
12
+ }],
13
+ duration: 0
14
+ }, {
15
+ keyframes: [{
16
+ transform: `scale(0)`
17
+ }, {
18
+ transform: `scale(${scaleSend})`
19
+ }],
20
+ duration: motionTokens.durationNormal * motionSpeedMultiplier,
21
+ easing: motionTokens.curveDecelerateMax,
22
+ delay: motionTokens.durationSlow * motionSpeedMultiplier
23
+ }, {
24
+ keyframes: [{
25
+ transform: `scale(${scaleSend})`
26
+ }, {
27
+ transform: 'scale(1)'
28
+ }],
29
+ duration: motionTokens.durationSlow * motionSpeedMultiplier,
30
+ easing: motionTokens.curveDecelerateMid,
31
+ delay: (motionTokens.durationSlow + motionTokens.durationNormal) * motionSpeedMultiplier
32
+ }];
33
+ const exitKeyframes = [{
34
+ keyframes: [{
35
+ transform: `scale(1)`
36
+ }, {
37
+ transform: `scale(0)`
38
+ }],
39
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
40
+ easing: motionTokens.curveDecelerateMid
41
+ }];
42
+ return {
43
+ enter: enterKeyframes,
44
+ exit: exitKeyframes
45
+ };
46
+ };
47
+ const stopMotion = () => {
48
+ const enterKeyframes = [{
49
+ keyframes: [{
50
+ opacity: 0
51
+ }],
52
+ duration: 0
53
+ }, {
54
+ keyframes: [{
55
+ opacity: 1
56
+ }],
57
+ duration: 0,
58
+ delay: 30 * motionSpeedMultiplier
59
+ }, {
60
+ keyframes: [{
61
+ transform: `scale(${startScaleStop})`
62
+ }, {
63
+ transform: `scale(1)`
64
+ }],
65
+ duration: motionTokens.durationSlower * motionSpeedMultiplier,
66
+ easing: motionTokens.curveDecelerateMid
67
+ }];
68
+ const exitKeyframes = [{
69
+ keyframes: [{
70
+ transform: `scale(1)`
71
+ }, {
72
+ transform: `scale(${scaleStop})`
73
+ }],
74
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
75
+ easing: motionTokens.curveDecelerateMax,
76
+ delay: motionTokens.durationUltraFast * motionSpeedMultiplier
77
+ }, {
78
+ keyframes: [{
79
+ transform: `scale(${scaleStop})`
80
+ }, {
81
+ transform: 'scale(0)'
82
+ }],
83
+ duration: motionTokens.durationFaster,
84
+ easing: motionTokens.curveDecelerateMin,
85
+ delay: (motionTokens.durationUltraFast + motionTokens.durationFast) * motionSpeedMultiplier
86
+ }];
87
+ return {
88
+ enter: enterKeyframes,
89
+ exit: exitKeyframes
90
+ };
91
+ };
92
+ const circleMotion = () => {
93
+ const enterKeyframes = [{
94
+ keyframes: [{
95
+ opacity: 0
96
+ }],
97
+ duration: 0
98
+ }, {
99
+ keyframes: [{
100
+ opacity: 0
101
+ }, {
102
+ opacity: 1
103
+ }],
104
+ duration: 0,
105
+ delay: motionTokens.durationFaster * motionSpeedMultiplier
106
+ }, {
107
+ keyframes: [{
108
+ transform: `scale(${startScaleCircle})`
109
+ }, {
110
+ transform: `scale(${scaleCircle})`
111
+ }],
112
+ duration: motionTokens.durationSlow * motionSpeedMultiplier,
113
+ easing: motionTokens.curveDecelerateMax,
114
+ delay: motionTokens.durationFaster * motionSpeedMultiplier
115
+ }, {
116
+ keyframes: [{
117
+ transform: `scale(${scaleCircle})`
118
+ }, {
119
+ transform: `scale(1)`
120
+ }],
121
+ duration: motionTokens.durationNormal * motionSpeedMultiplier,
122
+ easing: motionTokens.curveDecelerateMin,
123
+ delay: (motionTokens.durationSlow + motionTokens.durationFaster) * motionSpeedMultiplier
124
+ }];
125
+ const exitKeyframes = [{
126
+ keyframes: [{
127
+ transform: `scale(1)`
128
+ }, {
129
+ transform: `scale(${scaleCircle})`
130
+ }],
131
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
132
+ easing: motionTokens.curveDecelerateMax
133
+ }, {
134
+ keyframes: [{
135
+ transform: `scale(${scaleCircle})`
136
+ }, {
137
+ transform: 'scale(0)'
138
+ }],
139
+ duration: motionTokens.durationFaster * motionSpeedMultiplier,
140
+ easing: motionTokens.curveDecelerateMin,
141
+ delay: motionTokens.durationFast * motionSpeedMultiplier
142
+ }];
143
+ return {
144
+ enter: enterKeyframes,
145
+ exit: exitKeyframes
146
+ };
147
+ };
148
+ export const SendButtonMotion = createPresenceComponent(sendMotion);
149
+ export const StopButtonMotion = createPresenceComponent(stopMotion);
150
+ export const CircleButtonMotion = createPresenceComponent(circleMotion);
151
+ //# sourceMappingURL=buttonMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["buttonMotion.ts"],"sourcesContent":["import type { PresenceMotionFn } from '@fluentui/react-components';\nimport { createPresenceComponent, motionTokens } from '@fluentui/react-components';\n\nconst scaleSend = 1.2;\nconst startScaleStop = 0.5;\nconst scaleStop = 1.2;\nconst startScaleCircle = 0.1;\nconst scaleCircle = 1.1;\n\nconst motionSpeedMultiplier = 1;\n\nconst sendMotion: PresenceMotionFn = () => {\n const enterKeyframes = [\n {\n keyframes: [{ transform: `scale(0)` }],\n duration: 0,\n },\n {\n keyframes: [{ transform: `scale(0)` }, { transform: `scale(${scaleSend})` }],\n duration: motionTokens.durationNormal * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMax,\n delay: motionTokens.durationSlow * motionSpeedMultiplier,\n },\n {\n keyframes: [{ transform: `scale(${scaleSend})` }, { transform: 'scale(1)' }],\n duration: motionTokens.durationSlow * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMid,\n delay: (motionTokens.durationSlow + motionTokens.durationNormal) * motionSpeedMultiplier,\n },\n ];\n\n const exitKeyframes = [\n {\n keyframes: [{ transform: `scale(1)` }, { transform: `scale(0)` }],\n duration: motionTokens.durationFast * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMid,\n },\n ];\n\n return {\n enter: enterKeyframes,\n exit: exitKeyframes,\n };\n};\n\nconst stopMotion: PresenceMotionFn = () => {\n const enterKeyframes = [\n {\n keyframes: [{ opacity: 0 }],\n duration: 0,\n },\n {\n keyframes: [{ opacity: 1 }],\n duration: 0,\n delay: 30 * motionSpeedMultiplier, // non-standard motion duration\n },\n {\n keyframes: [{ transform: `scale(${startScaleStop})` }, { transform: `scale(1)` }],\n duration: motionTokens.durationSlower * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMid,\n },\n ];\n\n const exitKeyframes = [\n {\n keyframes: [{ transform: `scale(1)` }, { transform: `scale(${scaleStop})` }],\n duration: motionTokens.durationFast * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMax,\n delay: motionTokens.durationUltraFast * motionSpeedMultiplier,\n },\n {\n keyframes: [{ transform: `scale(${scaleStop})` }, { transform: 'scale(0)' }],\n duration: motionTokens.durationFaster,\n easing: motionTokens.curveDecelerateMin,\n delay: (motionTokens.durationUltraFast + motionTokens.durationFast) * motionSpeedMultiplier,\n },\n ];\n\n return {\n enter: enterKeyframes,\n exit: exitKeyframes,\n };\n};\n\nconst circleMotion: PresenceMotionFn = () => {\n const enterKeyframes = [\n {\n keyframes: [{ opacity: 0 }],\n duration: 0,\n },\n {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n duration: 0,\n delay: motionTokens.durationFaster * motionSpeedMultiplier,\n },\n {\n keyframes: [{ transform: `scale(${startScaleCircle})` }, { transform: `scale(${scaleCircle})` }],\n duration: motionTokens.durationSlow * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMax,\n delay: motionTokens.durationFaster * motionSpeedMultiplier,\n },\n {\n keyframes: [{ transform: `scale(${scaleCircle})` }, { transform: `scale(1)` }],\n duration: motionTokens.durationNormal * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMin,\n delay: (motionTokens.durationSlow + motionTokens.durationFaster) * motionSpeedMultiplier,\n },\n ];\n\n const exitKeyframes = [\n {\n keyframes: [{ transform: `scale(1)` }, { transform: `scale(${scaleCircle})` }],\n duration: motionTokens.durationFast * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMax,\n },\n {\n keyframes: [{ transform: `scale(${scaleCircle})` }, { transform: 'scale(0)' }],\n duration: motionTokens.durationFaster * motionSpeedMultiplier,\n easing: motionTokens.curveDecelerateMin,\n delay: motionTokens.durationFast * motionSpeedMultiplier,\n },\n ];\n\n return {\n enter: enterKeyframes,\n exit: exitKeyframes,\n };\n};\nexport const SendButtonMotion = createPresenceComponent(sendMotion);\nexport const StopButtonMotion = createPresenceComponent(stopMotion);\nexport const CircleButtonMotion = createPresenceComponent(circleMotion);\n"],"names":["createPresenceComponent","motionTokens","scaleSend","startScaleStop","scaleStop","startScaleCircle","scaleCircle","motionSpeedMultiplier","sendMotion","enterKeyframes","keyframes","transform","duration","durationNormal","easing","curveDecelerateMax","delay","durationSlow","curveDecelerateMid","exitKeyframes","durationFast","enter","exit","stopMotion","opacity","durationSlower","durationUltraFast","durationFaster","curveDecelerateMin","circleMotion","SendButtonMotion","StopButtonMotion","CircleButtonMotion"],"rangeMappings":";;;;;;;;;;;;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AAwBQ,YAAY;AACpE,OAAO,MAAMuB,mBAAmB/B,wBAAwBuB,YAAY;AACpE,OAAO,MAAMS,qBAAqBhC,wBAAwB6B,cAAc"}
@@ -0,0 +1,5 @@
1
+ export { SendButton } from './SendButton';
2
+ export { renderSendButton_unstable } from './renderSendButton';
3
+ export { useSendButton_unstable } from './useSendButton';
4
+ export { sendButtonClassNames, useSendButtonStyles_unstable } from './useSendButtonStyles.styles';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { SendButton } from './SendButton';\nexport type { SendButtonProps, SendButtonSlots, SendButtonState } from './SendButton.types';\nexport { renderSendButton_unstable } from './renderSendButton';\nexport { useSendButton_unstable } from './useSendButton';\nexport { sendButtonClassNames, useSendButtonStyles_unstable } from './useSendButtonStyles.styles';\n"],"names":["SendButton","renderSendButton_unstable","useSendButton_unstable","sendButtonClassNames","useSendButtonStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAE1C,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,+BAA+B"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
+ import { assertSlots } from '@fluentui/react-components';
3
+ /**
4
+ * Render the final JSX of SendButton
5
+ */
6
+ export const renderSendButton_unstable = state => {
7
+ if (state.designVersion === 'next') {
8
+ return renderSendButtonNext(state);
9
+ }
10
+ return renderSendButtonCurrent(state);
11
+ };
12
+ function renderSendButtonCurrent(state) {
13
+ assertSlots(state);
14
+ return /*#__PURE__*/_jsxs(state.root, {
15
+ children: [state.stopIcon && /*#__PURE__*/_jsxs(_Fragment, {
16
+ children: [/*#__PURE__*/_jsx(state.stopBackgroundMotion, {
17
+ children: /*#__PURE__*/_jsx(state.stopBackground, {})
18
+ }), /*#__PURE__*/_jsx(state.stopButtonMotion, {
19
+ children: /*#__PURE__*/_jsx(state.stopIcon, {})
20
+ })]
21
+ }), /*#__PURE__*/_jsx(state.sendButtonMotion, {
22
+ children: /*#__PURE__*/_jsx(state.sendIcon, {})
23
+ })]
24
+ });
25
+ }
26
+ function renderSendButtonNext(state) {
27
+ assertSlots(state);
28
+ return /*#__PURE__*/_jsxs(state.root, {
29
+ children: [/*#__PURE__*/_jsx(state.stopBackgroundMotion, {
30
+ children: /*#__PURE__*/_jsx(state.stopBackground, {})
31
+ }), state.stopIcon && /*#__PURE__*/_jsx(state.stopButtonMotion, {
32
+ children: /*#__PURE__*/_jsx(state.stopIcon, {})
33
+ }), /*#__PURE__*/_jsx(state.sendButtonMotion, {
34
+ children: /*#__PURE__*/_jsx(state.sendIcon, {})
35
+ })]
36
+ });
37
+ }
38
+ //# sourceMappingURL=renderSendButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderSendButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { SendButtonState, SendButtonSlots } from './SendButton.types';\n\n/**\n * Render the final JSX of SendButton\n */\nexport const renderSendButton_unstable = (state: SendButtonState) => {\n if (state.designVersion === 'next') {\n return renderSendButtonNext(state);\n }\n\n return renderSendButtonCurrent(state);\n};\n\nfunction renderSendButtonCurrent(state: SendButtonState) {\n assertSlots<SendButtonSlots>(state);\n\n return (\n <state.root>\n {state.stopIcon && (\n <>\n <state.stopBackgroundMotion>\n <state.stopBackground />\n </state.stopBackgroundMotion>\n <state.stopButtonMotion>\n <state.stopIcon />\n </state.stopButtonMotion>\n </>\n )}\n <state.sendButtonMotion>\n <state.sendIcon />\n </state.sendButtonMotion>\n </state.root>\n );\n}\n\nfunction renderSendButtonNext(state: SendButtonState) {\n assertSlots<SendButtonSlots>(state);\n\n return (\n <state.root>\n <state.stopBackgroundMotion>\n <state.stopBackground />\n </state.stopBackgroundMotion>\n {state.stopIcon && (\n <state.stopButtonMotion>\n <state.stopIcon />\n </state.stopButtonMotion>\n )}\n <state.sendButtonMotion>\n <state.sendIcon />\n </state.sendButtonMotion>\n </state.root>\n );\n}\n"],"names":["assertSlots","renderSendButton_unstable","state","designVersion","renderSendButtonNext","renderSendButtonCurrent","root","stopIcon","stopBackgroundMotion","stopBackground","stopButtonMotion","sendButtonMotion","sendIcon"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAGzD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxC,IAAIA,MAAMC,aAAa,KAAK,QAAQ;QAClC,OAAOC,qBAAqBF;IAC9B;IAEA,OAAOG,wBAAwBH;AACjC,EAAE;AAEF,SAASG,wBAAwBH,KAAsB;IACrDF,YAA6BE;IAE7B,qBACE,MAACA,MAAMI,IAAI;;YACRJ,MAAMK,QAAQ,kBACb;;kCACE,KAACL,MAAMM,oBAAoB;kCACzB,cAAA,KAACN,MAAMO,cAAc;;kCAEvB,KAACP,MAAMQ,gBAAgB;kCACrB,cAAA,KAACR,MAAMK,QAAQ;;;;0BAIrB,KAACL,MAAMS,gBAAgB;0BACrB,cAAA,KAACT,MAAMU,QAAQ;;;;AAIvB;AAEA,SAASR,qBAAqBF,KAAsB;IAClDF,YAA6BE;IAE7B,qBACE,MAACA,MAAMI,IAAI;;0BACT,KAACJ,MAAMM,oBAAoB;0BACzB,cAAA,KAACN,MAAMO,cAAc;;YAEtBP,MAAMK,QAAQ,kBACb,KAACL,MAAMQ,gBAAgB;0BACrB,cAAA,KAACR,MAAMK,QAAQ;;0BAGnB,KAACL,MAAMS,gBAAgB;0BACrB,cAAA,KAACT,MAAMU,QAAQ;;;;AAIvB"}
@@ -0,0 +1,117 @@
1
+ import * as React from 'react';
2
+ import { slot, useButton_unstable, useMergedRefs } from '@fluentui/react-components';
3
+ import { CircleButtonMotion, SendButtonMotion, StopButtonMotion } from './buttonMotion';
4
+ import { bundleIcon, SendFilled, SendRegular, Stop16Filled, Stop24Filled, ArrowRight24Filled, ArrowRight24Regular, Stop20Filled, ArrowRight20Regular, ArrowRight20Filled } from '@fluentui/react-icons';
5
+ import { presenceMotionSlot } from '@fluentui/react-motion';
6
+ import { useCopilotMode, useDesignVersion } from '@fluentui-copilot/react-provider';
7
+ const SendIcon = bundleIcon(SendFilled, SendRegular);
8
+ const SendIconV2Canvas = bundleIcon(ArrowRight24Filled, ArrowRight24Regular);
9
+ const SendIconV2Sidecar = bundleIcon(ArrowRight20Filled, ArrowRight20Regular);
10
+ /**
11
+ * Create the state required to render SendButton.
12
+ *
13
+ * The returned state can be modified with hooks such as useSendButtonStyles_unstable,
14
+ * before being passed to renderSendButton_unstable.
15
+ *
16
+ * @param props - props from this instance of SendButton
17
+ * @param ref - reference to root HTMLElement of SendButton
18
+ */
19
+ export const useSendButton_unstable = (props, ref) => {
20
+ /** Used to apply/remove styles when button is animating */const [isSendMotionRunning, setIsSendMotionRunning] = React.useState(false);
21
+ const [isStopMotionRunning, setIsStopMotionRunning] = React.useState(false);
22
+ const isButtonMotionRunning = isSendMotionRunning || isStopMotionRunning;
23
+ const designVersion = useDesignVersion(props.designVersion);
24
+ const mode = useCopilotMode(props.mode);
25
+ const [visible, setVisible] = React.useState(false);
26
+ const mountRef = React.useCallback(elem => {
27
+ if (elem) {
28
+ setVisible(true);
29
+ } else {
30
+ setVisible(false);
31
+ }
32
+ }, []);
33
+ const finalRef = useMergedRefs(ref, mountRef);
34
+ const buttonState = useButton_unstable({
35
+ shape: designVersion === 'next' ? 'circular' : undefined,
36
+ ...props,
37
+ appearance: 'transparent',
38
+ 'aria-disabled': props.disabled ? true : undefined,
39
+ type: 'submit'
40
+ }, finalRef);
41
+ const icon = (() => {
42
+ if (designVersion === 'next') {
43
+ if (props.isSendIconFilled || isButtonMotionRunning) {
44
+ return mode === 'canvas' ? /*#__PURE__*/React.createElement(ArrowRight24Filled, null) : /*#__PURE__*/React.createElement(ArrowRight20Regular, null);
45
+ } else {
46
+ return mode === 'canvas' ? /*#__PURE__*/React.createElement(SendIconV2Canvas, null) : /*#__PURE__*/React.createElement(SendIconV2Sidecar, null);
47
+ }
48
+ } else {
49
+ if (props.isSendIconFilled || isButtonMotionRunning) {
50
+ return /*#__PURE__*/React.createElement(SendFilled, null);
51
+ } else {
52
+ return /*#__PURE__*/React.createElement(SendIcon, null);
53
+ }
54
+ }
55
+ })();
56
+ const state = {
57
+ ...buttonState,
58
+ components: {
59
+ root: 'button',
60
+ sendIcon: 'span',
61
+ stopIcon: 'span',
62
+ stopBackground: 'div',
63
+ sendButtonMotion: SendButtonMotion,
64
+ stopButtonMotion: StopButtonMotion,
65
+ stopBackgroundMotion: CircleButtonMotion
66
+ },
67
+ root: buttonState.root,
68
+ sendIcon: slot.always(props.sendIcon, {
69
+ elementType: 'span',
70
+ defaultProps: {
71
+ children: icon
72
+ }
73
+ }),
74
+ stopIcon: slot.optional(props.stopIcon, {
75
+ elementType: 'span',
76
+ defaultProps: {
77
+ children: designVersion === 'next' ? mode === 'canvas' ? /*#__PURE__*/React.createElement(Stop24Filled, null) : /*#__PURE__*/React.createElement(Stop20Filled, null) : /*#__PURE__*/React.createElement(Stop16Filled, null)
78
+ },
79
+ renderByDefault: true
80
+ }),
81
+ stopBackground: slot.always(props.stopBackground, {
82
+ elementType: 'div'
83
+ }),
84
+ sendButtonMotion: presenceMotionSlot(props.sendButtonMotion, {
85
+ elementType: SendButtonMotion,
86
+ defaultProps: {
87
+ visible: !props.isSending,
88
+ unmountOnExit: true,
89
+ onMotionFinish: () => setIsSendMotionRunning(false),
90
+ onMotionStart: () => setIsSendMotionRunning(true)
91
+ }
92
+ }),
93
+ stopButtonMotion: presenceMotionSlot(props.stopButtonMotion, {
94
+ elementType: StopButtonMotion,
95
+ defaultProps: {
96
+ visible: props.isSending,
97
+ unmountOnExit: true,
98
+ onMotionFinish: () => setIsStopMotionRunning(false),
99
+ onMotionStart: () => setIsStopMotionRunning(true)
100
+ }
101
+ }),
102
+ stopBackgroundMotion: presenceMotionSlot(props.stopBackgroundMotion, {
103
+ elementType: CircleButtonMotion,
104
+ defaultProps: {
105
+ visible: designVersion === 'next' ? visible : props.isSending,
106
+ unmountOnExit: true
107
+ }
108
+ }),
109
+ isButtonMotionRunning,
110
+ isSendIconFilled: props.isSendIconFilled,
111
+ isSending: props.isSending,
112
+ designVersion,
113
+ mode
114
+ };
115
+ return state;
116
+ };
117
+ //# sourceMappingURL=useSendButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSendButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ButtonProps } from '@fluentui/react-components';\nimport { slot, useButton_unstable, useMergedRefs } from '@fluentui/react-components';\nimport type { SendButtonProps, SendButtonState } from './SendButton.types';\n\nimport { CircleButtonMotion, SendButtonMotion, StopButtonMotion } from './buttonMotion';\nimport {\n bundleIcon,\n SendFilled,\n SendRegular,\n Stop16Filled,\n Stop24Filled,\n ArrowRight24Filled,\n ArrowRight24Regular,\n Stop20Filled,\n ArrowRight20Regular,\n ArrowRight20Filled,\n} from '@fluentui/react-icons';\nimport { presenceMotionSlot } from '@fluentui/react-motion';\nimport { useCopilotMode, useDesignVersion } from '@fluentui-copilot/react-provider';\n\nconst SendIcon = bundleIcon(SendFilled, SendRegular);\nconst SendIconV2Canvas = bundleIcon(ArrowRight24Filled, ArrowRight24Regular);\nconst SendIconV2Sidecar = bundleIcon(ArrowRight20Filled, ArrowRight20Regular);\n\n/**\n * Create the state required to render SendButton.\n *\n * The returned state can be modified with hooks such as useSendButtonStyles_unstable,\n * before being passed to renderSendButton_unstable.\n *\n * @param props - props from this instance of SendButton\n * @param ref - reference to root HTMLElement of SendButton\n */\nexport const useSendButton_unstable = (\n props: SendButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): SendButtonState => {\n /** Used to apply/remove styles when button is animating */\n const [isSendMotionRunning, setIsSendMotionRunning] = React.useState(false);\n const [isStopMotionRunning, setIsStopMotionRunning] = React.useState(false);\n const isButtonMotionRunning = isSendMotionRunning || isStopMotionRunning;\n\n const designVersion = useDesignVersion(props.designVersion);\n const mode = useCopilotMode(props.mode);\n\n const [visible, setVisible] = React.useState(false);\n const mountRef = React.useCallback((elem: HTMLElement | null) => {\n if (elem) {\n setVisible(true);\n } else {\n setVisible(false);\n }\n }, []);\n const finalRef = useMergedRefs(ref, mountRef);\n const buttonState = useButton_unstable(\n {\n shape: designVersion === 'next' ? 'circular' : undefined,\n ...(props as ButtonProps),\n appearance: 'transparent',\n 'aria-disabled': props.disabled ? true : undefined,\n type: 'submit',\n },\n finalRef,\n );\n\n const icon = (() => {\n if (designVersion === 'next') {\n if (props.isSendIconFilled || isButtonMotionRunning) {\n return mode === 'canvas' ? <ArrowRight24Filled /> : <ArrowRight20Regular />;\n } else {\n return mode === 'canvas' ? <SendIconV2Canvas /> : <SendIconV2Sidecar />;\n }\n } else {\n if (props.isSendIconFilled || isButtonMotionRunning) {\n return <SendFilled />;\n } else {\n return <SendIcon />;\n }\n }\n })();\n\n const state: SendButtonState = {\n ...buttonState,\n components: {\n root: 'button',\n sendIcon: 'span',\n stopIcon: 'span',\n stopBackground: 'div',\n sendButtonMotion: SendButtonMotion as React.ComponentType,\n stopButtonMotion: StopButtonMotion as React.ComponentType,\n stopBackgroundMotion: CircleButtonMotion as React.ComponentType,\n },\n root: buttonState.root,\n sendIcon: slot.always(props.sendIcon, {\n elementType: 'span',\n defaultProps: {\n children: icon,\n },\n }),\n stopIcon: slot.optional(props.stopIcon, {\n elementType: 'span',\n defaultProps: {\n children: designVersion === 'next' ? mode === 'canvas' ? <Stop24Filled /> : <Stop20Filled /> : <Stop16Filled />,\n },\n renderByDefault: true,\n }),\n stopBackground: slot.always(props.stopBackground, { elementType: 'div' }),\n sendButtonMotion: presenceMotionSlot<{}>(props.sendButtonMotion, {\n elementType: SendButtonMotion,\n defaultProps: {\n visible: !props.isSending,\n unmountOnExit: true,\n onMotionFinish: () => setIsSendMotionRunning(false),\n onMotionStart: () => setIsSendMotionRunning(true),\n },\n }),\n stopButtonMotion: presenceMotionSlot<{}>(props.stopButtonMotion, {\n elementType: StopButtonMotion,\n defaultProps: {\n visible: props.isSending,\n unmountOnExit: true,\n onMotionFinish: () => setIsStopMotionRunning(false),\n onMotionStart: () => setIsStopMotionRunning(true),\n },\n }),\n stopBackgroundMotion: presenceMotionSlot<{}>(props.stopBackgroundMotion, {\n elementType: CircleButtonMotion,\n defaultProps: {\n visible: designVersion === 'next' ? visible : props.isSending,\n unmountOnExit: true,\n },\n }),\n isButtonMotionRunning,\n isSendIconFilled: props.isSendIconFilled,\n isSending: props.isSending,\n designVersion,\n mode,\n };\n\n return state;\n};\n"],"names":["React","slot","useButton_unstable","useMergedRefs","CircleButtonMotion","SendButtonMotion","StopButtonMotion","bundleIcon","SendFilled","SendRegular","Stop16Filled","Stop24Filled","ArrowRight24Filled","ArrowRight24Regular","Stop20Filled","ArrowRight20Regular","ArrowRight20Filled","presenceMotionSlot","useCopilotMode","useDesignVersion","SendIcon","SendIconV2Canvas","SendIconV2Sidecar","useSendButton_unstable","props","ref","isSendMotionRunning","setIsSendMotionRunning","useState","isStopMotionRunning","setIsStopMotionRunning","isButtonMotionRunning","designVersion","mode","visible","setVisible","mountRef","useCallback","elem","finalRef","buttonState","shape","undefined","appearance","disabled","type","icon","isSendIconFilled","state","components","root","sendIcon","stopIcon","stopBackground","sendButtonMotion","stopButtonMotion","stopBackgroundMotion","always","elementType","defaultProps","children","optional","renderByDefault","isSending","unmountOnExit","onMotionFinish","onMotionStart"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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