@fluentui-copilot/react-send-button 0.0.0-nightly-20251010-0406-7df7c6d1.1 → 0.0.0-nightly-20251013-0406-7c7739c8.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 (44) hide show
  1. package/CHANGELOG.json +3 -3
  2. package/CHANGELOG.md +4 -4
  3. package/dist/index.d.ts +70 -0
  4. package/lib/SendButton.js +1 -0
  5. package/lib/SendButton.js.map +1 -0
  6. package/lib/components/SendButton/SendButton.js +11 -0
  7. package/lib/components/SendButton/SendButton.js.map +1 -0
  8. package/lib/components/SendButton/SendButton.types.js +3 -0
  9. package/lib/components/SendButton/SendButton.types.js.map +1 -0
  10. package/lib/components/SendButton/buttonMotion.js +212 -0
  11. package/lib/components/SendButton/buttonMotion.js.map +1 -0
  12. package/lib/components/SendButton/index.js +4 -0
  13. package/lib/components/SendButton/index.js.map +1 -0
  14. package/lib/components/SendButton/renderSendButton.js +46 -0
  15. package/lib/components/SendButton/renderSendButton.js.map +1 -0
  16. package/lib/components/SendButton/useSendButton.js +111 -0
  17. package/lib/components/SendButton/useSendButton.js.map +1 -0
  18. package/lib/components/SendButton/useSendButtonStyles.styles.js +270 -0
  19. package/lib/components/SendButton/useSendButtonStyles.styles.js.map +1 -0
  20. package/lib/components/SendButton/useSendButtonStyles.styles.raw.js +224 -0
  21. package/lib/components/SendButton/useSendButtonStyles.styles.raw.js.map +1 -0
  22. package/lib/index.js +1 -0
  23. package/lib/index.js.map +1 -0
  24. package/lib-commonjs/SendButton.js +28 -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 +6 -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 +31 -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 +114 -0
  37. package/lib-commonjs/components/SendButton/useSendButton.js.map +1 -0
  38. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.js +412 -0
  39. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.js.map +1 -0
  40. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.raw.js +240 -0
  41. package/lib-commonjs/components/SendButton/useSendButtonStyles.styles.raw.js.map +1 -0
  42. package/lib-commonjs/index.js +28 -0
  43. package/lib-commonjs/index.js.map +1 -0
  44. package/package.json +4 -4
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui-copilot/react-send-button",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 10 Oct 2025 04:08:18 GMT",
6
- "tag": "@fluentui-copilot/react-send-button_v0.0.0-nightly-20251010-0406-7df7c6d1.1",
7
- "version": "0.0.0-nightly-20251010-0406-7df7c6d1.1",
5
+ "date": "Mon, 13 Oct 2025 04:14:18 GMT",
6
+ "tag": "@fluentui-copilot/react-send-button_v0.0.0-nightly-20251013-0406-7c7739c8.1",
7
+ "version": "0.0.0-nightly-20251013-0406-7c7739c8.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
package/CHANGELOG.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # Change Log - @fluentui-copilot/react-send-button
2
2
 
3
- This log was last generated on Fri, 10 Oct 2025 04:08:18 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 13 Oct 2025 04:14:18 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20251010-0406-7df7c6d1.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-send-button_v0.0.0-nightly-20251010-0406-7df7c6d1.1)
7
+ ## [0.0.0-nightly-20251013-0406-7c7739c8.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-send-button_v0.0.0-nightly-20251013-0406-7c7739c8.1)
8
8
 
9
- Fri, 10 Oct 2025 04:08:18 GMT
10
- [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-send-button_v0.1.5..@fluentui-copilot/react-send-button_v0.0.0-nightly-20251010-0406-7df7c6d1.1)
9
+ Mon, 13 Oct 2025 04:14:18 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-send-button_v0.1.5..@fluentui-copilot/react-send-button_v0.0.0-nightly-20251013-0406-7c7739c8.1)
11
11
 
12
12
  ### Changes
13
13
 
@@ -0,0 +1,70 @@
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 { JSXElement } from '@fluentui/react-components';
10
+ import type { PresenceMotionSlotProps } from '@fluentui/react-motion';
11
+ import * as React_2 from 'react';
12
+ import type { Slot } from '@fluentui/react-components';
13
+ import type { SlotClassNames } from '@fluentui/react-components';
14
+
15
+ /**
16
+ * Render the final JSX of SendButton
17
+ */
18
+ export declare const renderSendButton_unstable: (state: SendButtonState) => JSXElement;
19
+
20
+ export declare const SendButton: ForwardRefComponent<SendButtonProps>;
21
+
22
+ export declare const sendButtonClassNames: SlotClassNames<SendButtonSlots>;
23
+
24
+ /**
25
+ * SendButton Props
26
+ */
27
+ export declare type SendButtonProps = ComponentProps<Partial<SendButtonSlots>> & Pick<ButtonProps, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> & DesignVersion & CopilotMode & {
28
+ /**
29
+ * Checks whether query is sending.
30
+ */
31
+ isSending?: boolean;
32
+ isSendIconFilled?: boolean;
33
+ isDictationActive?: boolean;
34
+ };
35
+
36
+ export declare type SendButtonSlots = {
37
+ root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;
38
+ sendIcon: NonNullable<Slot<'span'>>;
39
+ stopIcon?: Slot<'span'>;
40
+ /** Stop button's circle background */
41
+ stopBackground: NonNullable<Slot<'div'>>;
42
+ sendButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
43
+ stopButtonMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
44
+ stopBackgroundMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
45
+ };
46
+
47
+ /**
48
+ * State used in rendering SendButton
49
+ */
50
+ export declare type SendButtonState = ComponentState<SendButtonSlots> & Pick<ButtonState, 'appearance' | 'disabled' | 'disabledFocusable' | 'iconPosition' | 'shape' | 'size'> & Pick<SendButtonProps, 'isSendIconFilled' | 'isSending'> & Pick<Required<SendButtonProps>, 'designVersion' | 'mode' | 'isDictationActive'> & {
51
+ isButtonMotionRunning?: boolean;
52
+ };
53
+
54
+ /**
55
+ * Create the state required to render SendButton.
56
+ *
57
+ * The returned state can be modified with hooks such as useSendButtonStyles_unstable,
58
+ * before being passed to renderSendButton_unstable.
59
+ *
60
+ * @param props - props from this instance of SendButton
61
+ * @param ref - reference to root HTMLElement of SendButton
62
+ */
63
+ export declare const useSendButton_unstable: (props: SendButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SendButtonState;
64
+
65
+ /**
66
+ * Apply styling to the SendButton slots based on the state
67
+ */
68
+ export declare const useSendButtonStyles_unstable: (state: SendButtonState) => SendButtonState;
69
+
70
+ export { }
@@ -0,0 +1 @@
1
+ export { SendButton, renderSendButton_unstable, useSendButton_unstable, sendButtonClassNames, useSendButtonStyles_unstable } from './components/SendButton';
@@ -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,11 @@
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';
@@ -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,3 @@
1
+ /**
2
+ * State used in rendering SendButton
3
+ */ export { };
@@ -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 * Use alternate styles when dictation is active\n */\n isDictationActive?: 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' | 'isDictationActive'> & {\n isButtonMotionRunning?: boolean;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAkCA;;CAEC,GACD,WAKI"}
@@ -0,0 +1,212 @@
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
+ {
11
+ keyframes: [
12
+ {
13
+ transform: `scale(0)`
14
+ }
15
+ ],
16
+ duration: 0
17
+ },
18
+ {
19
+ keyframes: [
20
+ {
21
+ transform: `scale(0)`
22
+ },
23
+ {
24
+ transform: `scale(${scaleSend})`
25
+ }
26
+ ],
27
+ duration: motionTokens.durationNormal * motionSpeedMultiplier,
28
+ easing: motionTokens.curveDecelerateMax,
29
+ delay: motionTokens.durationSlow * motionSpeedMultiplier
30
+ },
31
+ {
32
+ keyframes: [
33
+ {
34
+ transform: `scale(${scaleSend})`
35
+ },
36
+ {
37
+ transform: 'scale(1)'
38
+ }
39
+ ],
40
+ duration: motionTokens.durationSlow * motionSpeedMultiplier,
41
+ easing: motionTokens.curveDecelerateMid,
42
+ delay: (motionTokens.durationSlow + motionTokens.durationNormal) * motionSpeedMultiplier
43
+ }
44
+ ];
45
+ const exitKeyframes = [
46
+ {
47
+ keyframes: [
48
+ {
49
+ transform: `scale(1)`
50
+ },
51
+ {
52
+ transform: `scale(0)`
53
+ }
54
+ ],
55
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
56
+ easing: motionTokens.curveDecelerateMid
57
+ }
58
+ ];
59
+ return {
60
+ enter: enterKeyframes,
61
+ exit: exitKeyframes
62
+ };
63
+ };
64
+ const stopMotion = ()=>{
65
+ const enterKeyframes = [
66
+ {
67
+ keyframes: [
68
+ {
69
+ opacity: 0
70
+ }
71
+ ],
72
+ duration: 0
73
+ },
74
+ {
75
+ keyframes: [
76
+ {
77
+ opacity: 1
78
+ }
79
+ ],
80
+ duration: 0,
81
+ delay: 30 * motionSpeedMultiplier
82
+ },
83
+ {
84
+ keyframes: [
85
+ {
86
+ transform: `scale(${startScaleStop})`
87
+ },
88
+ {
89
+ transform: `scale(1)`
90
+ }
91
+ ],
92
+ duration: motionTokens.durationSlower * motionSpeedMultiplier,
93
+ easing: motionTokens.curveDecelerateMid
94
+ }
95
+ ];
96
+ const exitKeyframes = [
97
+ {
98
+ keyframes: [
99
+ {
100
+ transform: `scale(1)`
101
+ },
102
+ {
103
+ transform: `scale(${scaleStop})`
104
+ }
105
+ ],
106
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
107
+ easing: motionTokens.curveDecelerateMax,
108
+ delay: motionTokens.durationUltraFast * motionSpeedMultiplier
109
+ },
110
+ {
111
+ keyframes: [
112
+ {
113
+ transform: `scale(${scaleStop})`
114
+ },
115
+ {
116
+ transform: 'scale(0)'
117
+ }
118
+ ],
119
+ duration: motionTokens.durationFaster,
120
+ easing: motionTokens.curveDecelerateMin,
121
+ delay: (motionTokens.durationUltraFast + motionTokens.durationFast) * motionSpeedMultiplier
122
+ }
123
+ ];
124
+ return {
125
+ enter: enterKeyframes,
126
+ exit: exitKeyframes
127
+ };
128
+ };
129
+ const circleMotion = ()=>{
130
+ const enterKeyframes = [
131
+ {
132
+ keyframes: [
133
+ {
134
+ opacity: 0
135
+ }
136
+ ],
137
+ duration: 0
138
+ },
139
+ {
140
+ keyframes: [
141
+ {
142
+ opacity: 0
143
+ },
144
+ {
145
+ opacity: 1
146
+ }
147
+ ],
148
+ duration: 0,
149
+ delay: motionTokens.durationFaster * motionSpeedMultiplier
150
+ },
151
+ {
152
+ keyframes: [
153
+ {
154
+ transform: `scale(${startScaleCircle})`
155
+ },
156
+ {
157
+ transform: `scale(${scaleCircle})`
158
+ }
159
+ ],
160
+ duration: motionTokens.durationSlow * motionSpeedMultiplier,
161
+ easing: motionTokens.curveDecelerateMax,
162
+ delay: motionTokens.durationFaster * motionSpeedMultiplier
163
+ },
164
+ {
165
+ keyframes: [
166
+ {
167
+ transform: `scale(${scaleCircle})`
168
+ },
169
+ {
170
+ transform: `scale(1)`
171
+ }
172
+ ],
173
+ duration: motionTokens.durationNormal * motionSpeedMultiplier,
174
+ easing: motionTokens.curveDecelerateMin,
175
+ delay: (motionTokens.durationSlow + motionTokens.durationFaster) * motionSpeedMultiplier
176
+ }
177
+ ];
178
+ const exitKeyframes = [
179
+ {
180
+ keyframes: [
181
+ {
182
+ transform: `scale(1)`
183
+ },
184
+ {
185
+ transform: `scale(${scaleCircle})`
186
+ }
187
+ ],
188
+ duration: motionTokens.durationFast * motionSpeedMultiplier,
189
+ easing: motionTokens.curveDecelerateMax
190
+ },
191
+ {
192
+ keyframes: [
193
+ {
194
+ transform: `scale(${scaleCircle})`
195
+ },
196
+ {
197
+ transform: 'scale(0)'
198
+ }
199
+ ],
200
+ duration: motionTokens.durationFaster * motionSpeedMultiplier,
201
+ easing: motionTokens.curveDecelerateMin,
202
+ delay: motionTokens.durationFast * motionSpeedMultiplier
203
+ }
204
+ ];
205
+ return {
206
+ enter: enterKeyframes,
207
+ exit: exitKeyframes
208
+ };
209
+ };
210
+ export const SendButtonMotion = createPresenceComponent(sendMotion);
211
+ export const StopButtonMotion = createPresenceComponent(stopMotion);
212
+ export const CircleButtonMotion = createPresenceComponent(circleMotion);
@@ -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: ReturnType<typeof createPresenceComponent<{}>> = createPresenceComponent(sendMotion);\nexport const StopButtonMotion: ReturnType<typeof createPresenceComponent<{}>> = createPresenceComponent(stopMotion);\nexport const CircleButtonMotion: ReturnType<typeof createPresenceComponent<{}>> = 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,6BAA6B;AAEnF,MAAMC,YAAY;AAClB,MAAMC,iBAAiB;AACvB,MAAMC,YAAY;AAClB,MAAMC,mBAAmB;AACzB,MAAMC,cAAc;AAEpB,MAAMC,wBAAwB;AAE9B,MAAMC,aAA+B;IACnC,MAAMC,iBAAiB;QACrB;YACEC,WAAW;gBAAC;oBAAEC,WAAW,CAAC,QAAQ,CAAC;gBAAC;aAAE;YACtCC,UAAU;QACZ;QACA;YACEF,WAAW;gBAAC;oBAAEC,WAAW,CAAC,QAAQ,CAAC;gBAAC;gBAAG;oBAAEA,WAAW,CAAC,MAAM,EAAET,UAAU,CAAC,CAAC;gBAAC;aAAE;YAC5EU,UAAUX,aAAaY,cAAc,GAAGN;YACxCO,QAAQb,aAAac,kBAAkB;YACvCC,OAAOf,aAAagB,YAAY,GAAGV;QACrC;QACA;YACEG,WAAW;gBAAC;oBAAEC,WAAW,CAAC,MAAM,EAAET,UAAU,CAAC,CAAC;gBAAC;gBAAG;oBAAES,WAAW;gBAAW;aAAE;YAC5EC,UAAUX,aAAagB,YAAY,GAAGV;YACtCO,QAAQb,aAAaiB,kBAAkB;YACvCF,OAAO,AAACf,CAAAA,aAAagB,YAAY,GAAGhB,aAAaY,cAAc,AAAD,IAAKN;QACrE;KACD;IAED,MAAMY,gBAA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QAAQb,aAAa2B,kBAAkB;YACvCZ,OAAOf,aAAamB,YAAY,GAAGb;QACrC;KACD;IAED,OAAO;QACLc,OAAOZ;QACPa,MAAMH;IACR;AACF;AACA,OAAO,MAAMW,mBAAmE9B,wBAAwBQ,YAAY;AACpH,OAAO,MAAMuB,mBAAmE/B,wBAAwBuB,YAAY;AACpH,OAAO,MAAMS,qBAAqEhC,wBAAwB6B,cAAc"}
@@ -0,0 +1,4 @@
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';
@@ -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,46 @@
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
+ */ export const renderSendButton_unstable = (state)=>{
6
+ if (state.designVersion === 'next') {
7
+ return renderSendButtonNext(state);
8
+ }
9
+ return renderSendButtonCurrent(state);
10
+ };
11
+ function renderSendButtonCurrent(state) {
12
+ assertSlots(state);
13
+ return /*#__PURE__*/ _jsxs(state.root, {
14
+ children: [
15
+ state.stopIcon && /*#__PURE__*/ _jsxs(_Fragment, {
16
+ children: [
17
+ /*#__PURE__*/ _jsx(state.stopBackgroundMotion, {
18
+ children: /*#__PURE__*/ _jsx(state.stopBackground, {})
19
+ }),
20
+ /*#__PURE__*/ _jsx(state.stopButtonMotion, {
21
+ children: /*#__PURE__*/ _jsx(state.stopIcon, {})
22
+ })
23
+ ]
24
+ }),
25
+ /*#__PURE__*/ _jsx(state.sendButtonMotion, {
26
+ children: /*#__PURE__*/ _jsx(state.sendIcon, {})
27
+ })
28
+ ]
29
+ });
30
+ }
31
+ function renderSendButtonNext(state) {
32
+ assertSlots(state);
33
+ return /*#__PURE__*/ _jsxs(state.root, {
34
+ children: [
35
+ /*#__PURE__*/ _jsx(state.stopBackgroundMotion, {
36
+ children: /*#__PURE__*/ _jsx(state.stopBackground, {})
37
+ }),
38
+ state.stopIcon && /*#__PURE__*/ _jsx(state.stopButtonMotion, {
39
+ children: /*#__PURE__*/ _jsx(state.stopIcon, {})
40
+ }),
41
+ /*#__PURE__*/ _jsx(state.sendButtonMotion, {
42
+ children: /*#__PURE__*/ _jsx(state.sendIcon, {})
43
+ })
44
+ ]
45
+ });
46
+ }
@@ -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 { JSXElement } 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): JSXElement => {\n if (state.designVersion === 'next') {\n return renderSendButtonNext(state);\n }\n\n return renderSendButtonCurrent(state);\n};\n\nfunction renderSendButtonCurrent(state: SendButtonState): JSXElement {\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): JSXElement {\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;AAIzD;;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,111 @@
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, ArrowRight20Filled, Stop20Filled, ArrowRight16Filled } 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
+ /**
9
+ * Create the state required to render SendButton.
10
+ *
11
+ * The returned state can be modified with hooks such as useSendButtonStyles_unstable,
12
+ * before being passed to renderSendButton_unstable.
13
+ *
14
+ * @param props - props from this instance of SendButton
15
+ * @param ref - reference to root HTMLElement of SendButton
16
+ */ export const useSendButton_unstable = (props, ref)=>{
17
+ /** Used to apply/remove styles when button is animating */ const [isSendMotionRunning, setIsSendMotionRunning] = React.useState(false);
18
+ const [isStopMotionRunning, setIsStopMotionRunning] = React.useState(false);
19
+ const isButtonMotionRunning = isSendMotionRunning || isStopMotionRunning;
20
+ const designVersion = useDesignVersion(props.designVersion);
21
+ const mode = useCopilotMode(props.mode);
22
+ const [visible, setVisible] = React.useState(false);
23
+ const mountRef = React.useCallback((elem)=>{
24
+ if (elem) {
25
+ setVisible(true);
26
+ } else {
27
+ setVisible(false);
28
+ }
29
+ }, []);
30
+ const finalRef = useMergedRefs(ref, mountRef);
31
+ const buttonState = useButton_unstable({
32
+ shape: designVersion === 'next' ? 'circular' : undefined,
33
+ ...props,
34
+ appearance: 'transparent',
35
+ 'aria-disabled': props.disabled ? true : undefined,
36
+ type: 'submit'
37
+ }, finalRef);
38
+ const icon = (()=>{
39
+ if (designVersion === 'next') {
40
+ return mode === 'canvas' ? /*#__PURE__*/ React.createElement(ArrowRight20Filled, null) : /*#__PURE__*/ React.createElement(ArrowRight16Filled, null);
41
+ } else {
42
+ if (props.isSendIconFilled || isButtonMotionRunning) {
43
+ return /*#__PURE__*/ React.createElement(SendFilled, null);
44
+ } else {
45
+ return /*#__PURE__*/ React.createElement(SendIcon, null);
46
+ }
47
+ }
48
+ })();
49
+ var _props_isDictationActive;
50
+ const state = {
51
+ ...buttonState,
52
+ components: {
53
+ root: 'button',
54
+ sendIcon: 'span',
55
+ stopIcon: 'span',
56
+ stopBackground: 'div',
57
+ sendButtonMotion: SendButtonMotion,
58
+ stopButtonMotion: StopButtonMotion,
59
+ stopBackgroundMotion: CircleButtonMotion
60
+ },
61
+ root: buttonState.root,
62
+ sendIcon: slot.always(props.sendIcon, {
63
+ elementType: 'span',
64
+ defaultProps: {
65
+ children: icon
66
+ }
67
+ }),
68
+ stopIcon: slot.optional(props.stopIcon, {
69
+ elementType: 'span',
70
+ defaultProps: {
71
+ children: designVersion === 'next' ? mode === 'canvas' ? /*#__PURE__*/ React.createElement(Stop20Filled, null) : /*#__PURE__*/ React.createElement(Stop16Filled, null) : /*#__PURE__*/ React.createElement(Stop16Filled, null)
72
+ },
73
+ renderByDefault: true
74
+ }),
75
+ stopBackground: slot.always(props.stopBackground, {
76
+ elementType: 'div'
77
+ }),
78
+ sendButtonMotion: presenceMotionSlot(props.sendButtonMotion, {
79
+ elementType: SendButtonMotion,
80
+ defaultProps: {
81
+ visible: !props.isSending,
82
+ unmountOnExit: true,
83
+ onMotionFinish: ()=>setIsSendMotionRunning(false),
84
+ onMotionStart: ()=>setIsSendMotionRunning(true)
85
+ }
86
+ }),
87
+ stopButtonMotion: presenceMotionSlot(props.stopButtonMotion, {
88
+ elementType: StopButtonMotion,
89
+ defaultProps: {
90
+ visible: props.isSending,
91
+ unmountOnExit: true,
92
+ onMotionFinish: ()=>setIsStopMotionRunning(false),
93
+ onMotionStart: ()=>setIsStopMotionRunning(true)
94
+ }
95
+ }),
96
+ stopBackgroundMotion: presenceMotionSlot(props.stopBackgroundMotion, {
97
+ elementType: CircleButtonMotion,
98
+ defaultProps: {
99
+ visible: designVersion === 'next' ? visible : props.isSending,
100
+ unmountOnExit: true
101
+ }
102
+ }),
103
+ isButtonMotionRunning,
104
+ isDictationActive: (_props_isDictationActive = props.isDictationActive) !== null && _props_isDictationActive !== void 0 ? _props_isDictationActive : false,
105
+ isSendIconFilled: props.isSendIconFilled,
106
+ isSending: props.isSending,
107
+ designVersion,
108
+ mode
109
+ };
110
+ return state;
111
+ };
@@ -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 ArrowRight20Filled,\n Stop20Filled,\n ArrowRight16Filled,\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);\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 return mode === 'canvas' ? <ArrowRight20Filled /> : <ArrowRight16Filled />;\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,\n stopButtonMotion: StopButtonMotion,\n stopBackgroundMotion: CircleButtonMotion,\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' ? <Stop20Filled /> : <Stop16Filled /> : <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 isDictationActive: props.isDictationActive ?? false,\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","ArrowRight20Filled","Stop20Filled","ArrowRight16Filled","presenceMotionSlot","useCopilotMode","useDesignVersion","SendIcon","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","isDictationActive"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,IAAI,EAAEC,kBAAkB,EAAEC,aAAa,QAAQ,6BAA6B;AAGrF,SAASC,kBAAkB,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,iBAAiB;AACxF,SACEC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,QACb,wBAAwB;AAC/B,SAASC,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