@envive-ai/react-toolkit-v3 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimatedText/AnimatedText.cjs +1 -0
- package/dist/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/AnimatedText/AnimatedText.js +1 -0
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +1 -1
- package/dist/Carousel/Carousel.d.cts +2 -2
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/Carousel.js +1 -1
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/ChatHeader.d.ts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +2 -2
- package/dist/ChatHeader/components/Handle.js +2 -2
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +1 -1
- package/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +1 -1
- package/dist/ChatPreview/ChatPreview.cjs +14 -4
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +14 -4
- package/dist/ChatPreview/types/types.d.cts +5 -4
- package/dist/ChatPreview/types/types.d.ts +5 -4
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +14 -4
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +14 -4
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Message.js +2 -2
- package/dist/ChatPreviewComparison/types/types.d.cts +4 -4
- package/dist/ChatPreviewComparison/types/types.d.ts +4 -4
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/Container/Container.d.cts +5 -5
- package/dist/Container/Container.d.ts +176 -176
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +3 -2
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +3 -2
- package/dist/FloatingChat/components/AgentMessage.cjs +9 -5
- package/dist/FloatingChat/components/AgentMessage.js +9 -5
- package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
- package/dist/FloatingChat/components/ChatMessages.js +1 -1
- package/dist/FloatingChat/components/Layout.cjs +13 -13
- package/dist/FloatingChat/components/Layout.js +13 -13
- package/dist/FloatingChat/components/ModalSheet.cjs +5 -6
- package/dist/FloatingChat/components/ModalSheet.js +5 -6
- package/dist/FloatingChat/components/ReviewCardsCarousel.cjs +2 -1
- package/dist/FloatingChat/components/ReviewCardsCarousel.js +2 -1
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +0 -3
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +0 -3
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +10 -6
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +5 -2
- package/dist/ProductCard/components/Header.cjs +2 -2
- package/dist/ProductCard/components/Header.js +2 -2
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.cjs +3 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.js +3 -2
- package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +7 -2
- package/dist/PromptButtonCarouselWithImage/components/Layout.js +8 -3
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +53 -3
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +53 -3
- package/dist/PromptCarousel/PromptCarousel.cjs +71 -33
- package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +73 -35
- package/dist/PromptCarousel/hooks/index.cjs +2 -4
- package/dist/PromptCarousel/hooks/index.js +2 -4
- package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.cjs +91 -0
- package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.js +90 -0
- package/dist/PromptCarousel/hooks/useScrollSync.cjs +65 -0
- package/dist/PromptCarousel/hooks/useScrollSync.js +64 -0
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +4 -4
- package/dist/ReviewCard/components/index.d.ts +6 -6
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
- package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
- package/dist/SocialProof/SocialProof.cjs +1 -1
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +1 -1
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/Stack/Stack.d.cts +2 -2
- package/dist/TextField/utils/getIconColor.cjs +1 -1
- package/dist/TextField/utils/getIconColor.js +1 -1
- package/dist/TextField/utils/getSendIconElement.cjs +1 -1
- package/dist/TextField/utils/getSendIconElement.js +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +11 -6
- package/dist/WidgetTextField/WidgetTextField.d.cts +3 -2
- package/dist/WidgetTextField/WidgetTextField.d.ts +3 -2
- package/dist/WidgetTextField/WidgetTextField.js +7 -2
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/FakeTextInput.cjs +2 -2
- package/dist/WidgetTextField/components/FakeTextInput.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +11 -9
- package/dist/WidgetTextField/components/Icon.js +11 -9
- package/dist/WidgetTextField/types/types.d.cts +3 -0
- package/dist/WidgetTextField/types/types.d.ts +3 -0
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/utils/CustomIcon.cjs +1 -1
- package/dist/utils/CustomIcon.js +1 -1
- package/dist/utils/useDragToScroll.cjs +68 -0
- package/dist/utils/useDragToScroll.js +67 -0
- package/package.json +1 -1
- package/src/components/AnimatedText/AnimatedText.tsx +2 -0
- package/src/components/ChatHeader/hooks/useGetCloseButtonProperties.ts +1 -1
- package/src/components/ChatPreview/ChatPreview.tsx +20 -3
- package/src/components/ChatPreview/types/types.ts +5 -4
- package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +20 -3
- package/src/components/ChatPreviewComparison/types/types.ts +4 -4
- package/src/components/FloatingChat/FloatingChat.tsx +3 -2
- package/src/components/FloatingChat/components/AgentMessage.tsx +1 -0
- package/src/components/FloatingChat/components/Layout.tsx +7 -2
- package/src/components/FloatingChat/components/ModalSheet.tsx +5 -7
- package/src/components/FloatingChat/components/ReviewCardsCarousel.tsx +3 -0
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +0 -3
- package/src/components/ProductCard/ProductCard.tsx +12 -1
- package/src/components/ProductCard/components/Header.tsx +10 -8
- package/src/components/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.tsx +6 -3
- package/src/components/PromptButtonCarouselWithImage/components/Layout.tsx +13 -4
- package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +63 -20
- package/src/components/PromptCarousel/PromptCarousel.tsx +89 -51
- package/src/components/PromptCarousel/hooks/index.ts +2 -4
- package/src/components/PromptCarousel/hooks/useCoordinatedScrollAnimation.ts +115 -0
- package/src/components/PromptCarousel/hooks/useHorizontalScrollAnimation.ts +71 -78
- package/src/components/PromptCarousel/hooks/useScrollSync.ts +83 -0
- package/src/components/TextField/utils/getIconColor.ts +1 -1
- package/src/components/TextField/utils/getSendIconElement.tsx +3 -1
- package/src/components/WidgetTextField/WidgetTextField.tsx +9 -1
- package/src/components/WidgetTextField/components/FakeTextInput.tsx +6 -2
- package/src/components/WidgetTextField/components/Icon.tsx +44 -9
- package/src/components/WidgetTextField/types/types.ts +3 -0
- package/src/components/utils/CustomIcon.tsx +1 -1
- package/src/components/utils/useDragToScroll.ts +83 -0
- package/dist/PromptCarousel/components/BlockScrollContainer.cjs +0 -23
- package/dist/PromptCarousel/components/BlockScrollContainer.js +0 -21
- package/dist/PromptCarousel/components/ButtonContainerRow.cjs +0 -34
- package/dist/PromptCarousel/components/ButtonContainerRow.js +0 -32
- package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.cjs +0 -45
- package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.js +0 -44
- package/dist/PromptCarousel/components/CarouselContentWithRowScroll.cjs +0 -33
- package/dist/PromptCarousel/components/CarouselContentWithRowScroll.js +0 -32
- package/dist/PromptCarousel/components/index.cjs +0 -13
- package/dist/PromptCarousel/components/index.js +0 -13
- package/dist/PromptCarousel/hooks/useButtonScrollPosition.cjs +0 -79
- package/dist/PromptCarousel/hooks/useButtonScrollPosition.js +0 -78
- package/dist/PromptCarousel/hooks/useCarouselAnimation.cjs +0 -23
- package/dist/PromptCarousel/hooks/useCarouselAnimation.js +0 -22
- package/dist/PromptCarousel/hooks/useCarouselRefs.cjs +0 -20
- package/dist/PromptCarousel/hooks/useCarouselRefs.js +0 -19
- package/dist/PromptCarousel/hooks/useGetScrollProperties.cjs +0 -18
- package/dist/PromptCarousel/hooks/useGetScrollProperties.js +0 -17
- package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.cjs +0 -78
- package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.js +0 -77
- package/src/components/PromptCarousel/components/BlockScrollContainer.tsx +0 -34
- package/src/components/PromptCarousel/components/ButtonContainerRow.tsx +0 -46
- package/src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx +0 -83
- package/src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx +0 -71
- package/src/components/PromptCarousel/components/index.ts +0 -9
- package/src/components/PromptCarousel/hooks/useButtonScrollPosition.ts +0 -128
- package/src/components/PromptCarousel/hooks/useCarouselAnimation.ts +0 -47
- package/src/components/PromptCarousel/hooks/useCarouselRefs.ts +0 -27
|
@@ -6,20 +6,26 @@ import SendStandard from '@envive-ai/react-icons/SendStandard';
|
|
|
6
6
|
import { Theme } from '../../../../tokens/theme/theme';
|
|
7
7
|
import { CustomIcon } from '../../utils/CustomIcon';
|
|
8
8
|
import { IconVariant } from '../types/types';
|
|
9
|
+
import { TypographyColor } from '../../Typography/types';
|
|
9
10
|
|
|
10
11
|
type IconProps = {
|
|
11
12
|
theme: Theme;
|
|
12
13
|
variant: IconVariant;
|
|
14
|
+
textColor: TypographyColor;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
|
-
export const Icon = ({ variant, theme }: IconProps) => {
|
|
17
|
+
export const Icon = ({ variant, theme, textColor }: IconProps) => {
|
|
16
18
|
if (theme === Theme.STANDARD) {
|
|
17
19
|
if (variant === IconVariant.DEFAULT) {
|
|
18
20
|
return (
|
|
19
21
|
<CustomIcon
|
|
20
22
|
IconComponent={<SendStandard />}
|
|
21
23
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
22
|
-
fill=
|
|
24
|
+
fill={
|
|
25
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
26
|
+
? `var(--envive-colors-${textColor})`
|
|
27
|
+
: 'var(--envive-colors-border-medium)'
|
|
28
|
+
}
|
|
23
29
|
/>
|
|
24
30
|
);
|
|
25
31
|
}
|
|
@@ -27,7 +33,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
27
33
|
<CustomIcon
|
|
28
34
|
IconComponent={<SvgSendStandard />}
|
|
29
35
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
30
|
-
fill=
|
|
36
|
+
fill={
|
|
37
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
38
|
+
? `var(--envive-colors-${textColor})`
|
|
39
|
+
: 'var(--envive-colors-border-medium)'
|
|
40
|
+
}
|
|
31
41
|
/>
|
|
32
42
|
);
|
|
33
43
|
}
|
|
@@ -38,7 +48,12 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
38
48
|
<CustomIcon
|
|
39
49
|
IconComponent={<SendModern />}
|
|
40
50
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
41
|
-
fill=
|
|
51
|
+
fill={
|
|
52
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
53
|
+
? `var(--envive-colors-${textColor})`
|
|
54
|
+
: 'var(--envive-colors-border-medium)'
|
|
55
|
+
}
|
|
56
|
+
stroke="var(--envive-colors-border-dark)"
|
|
42
57
|
/>
|
|
43
58
|
);
|
|
44
59
|
}
|
|
@@ -46,7 +61,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
46
61
|
<CustomIcon
|
|
47
62
|
IconComponent={<SvgSendModern />}
|
|
48
63
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
49
|
-
stroke=
|
|
64
|
+
stroke={
|
|
65
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
66
|
+
? `var(--envive-colors-${textColor})`
|
|
67
|
+
: 'var(--envive-colors-border-medium)'
|
|
68
|
+
}
|
|
50
69
|
/>
|
|
51
70
|
);
|
|
52
71
|
}
|
|
@@ -57,7 +76,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
57
76
|
<CustomIcon
|
|
58
77
|
IconComponent={<SendMinimalist />}
|
|
59
78
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
60
|
-
stroke=
|
|
79
|
+
stroke={
|
|
80
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
81
|
+
? `var(--envive-colors-${textColor})`
|
|
82
|
+
: 'var(--envive-colors-text-secondary)'
|
|
83
|
+
}
|
|
61
84
|
/>
|
|
62
85
|
);
|
|
63
86
|
}
|
|
@@ -65,7 +88,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
65
88
|
<CustomIcon
|
|
66
89
|
IconComponent={<SendMinimalist />}
|
|
67
90
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
68
|
-
stroke=
|
|
91
|
+
stroke={
|
|
92
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
93
|
+
? `var(--envive-colors-${textColor})`
|
|
94
|
+
: 'var(--envive-colors-text-light)'
|
|
95
|
+
}
|
|
69
96
|
/>
|
|
70
97
|
);
|
|
71
98
|
}
|
|
@@ -75,7 +102,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
75
102
|
<CustomIcon
|
|
76
103
|
IconComponent={<SendStandard />}
|
|
77
104
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
78
|
-
fill=
|
|
105
|
+
fill={
|
|
106
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
107
|
+
? `var(--envive-colors-${textColor})`
|
|
108
|
+
: 'var(--envive-colors-border-medium)'
|
|
109
|
+
}
|
|
79
110
|
/>
|
|
80
111
|
);
|
|
81
112
|
}
|
|
@@ -84,7 +115,11 @@ export const Icon = ({ variant, theme }: IconProps) => {
|
|
|
84
115
|
<CustomIcon
|
|
85
116
|
IconComponent={<SvgSendStandard />}
|
|
86
117
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
87
|
-
fill=
|
|
118
|
+
fill={
|
|
119
|
+
textColor !== TypographyColor.TEXT_SECONDARY
|
|
120
|
+
? `var(--envive-colors-${textColor})`
|
|
121
|
+
: 'var(--envive-colors-border-medium)'
|
|
122
|
+
}
|
|
88
123
|
/>
|
|
89
124
|
);
|
|
90
125
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Theme } from '../../../../tokens/theme/theme';
|
|
2
|
+
import { TypographyColor } from '../../Typography/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Props for the WidgetTextField component.
|
|
@@ -33,6 +34,8 @@ export type WidgetTextFieldProps = {
|
|
|
33
34
|
placeholder?: string;
|
|
34
35
|
/** Accessible label for screen readers. If not provided, the placeholder will be used. */
|
|
35
36
|
ariaLabel?: string;
|
|
37
|
+
/** Text color for the text field. */
|
|
38
|
+
textColor?: TypographyColor;
|
|
36
39
|
/** Whether the text field is disabled. */
|
|
37
40
|
disabled?: boolean;
|
|
38
41
|
/**
|
|
@@ -19,7 +19,7 @@ export const CustomIcon = ({
|
|
|
19
19
|
|
|
20
20
|
const cssRules: string[] = [];
|
|
21
21
|
if (fill) {
|
|
22
|
-
cssRules.push(`#${iconId} path { fill: ${fill} !important; }`);
|
|
22
|
+
cssRules.push(`#${iconId} path, #${iconId} rect { fill: ${fill} !important; }`);
|
|
23
23
|
}
|
|
24
24
|
if (stroke) {
|
|
25
25
|
cssRules.push(`#${iconId} path { stroke: ${stroke} !important; }`);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
type DragDirection = 'x' | 'y';
|
|
4
|
+
|
|
5
|
+
type UseDragToScrollOptions = {
|
|
6
|
+
direction: DragDirection;
|
|
7
|
+
isEnabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hook to enable drag-to-scroll on a container (mouse or touch).
|
|
12
|
+
* Uses the same ref as the scroll container so it can be composed with useHorizontalWheelScroll.
|
|
13
|
+
*/
|
|
14
|
+
export const useDragToScroll = (
|
|
15
|
+
scrollContainerRef: React.RefObject<HTMLDivElement | null>,
|
|
16
|
+
options: UseDragToScrollOptions,
|
|
17
|
+
) => {
|
|
18
|
+
const { direction, isEnabled = true } = options;
|
|
19
|
+
const dragRef = useRef({
|
|
20
|
+
isDragging: false,
|
|
21
|
+
startX: 0,
|
|
22
|
+
startY: 0,
|
|
23
|
+
startScrollLeft: 0,
|
|
24
|
+
startScrollTop: 0,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!isEnabled || !scrollContainerRef.current) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const container = scrollContainerRef.current;
|
|
33
|
+
|
|
34
|
+
const handlePointerDown = (e: PointerEvent) => {
|
|
35
|
+
if (e.button !== 0) return;
|
|
36
|
+
dragRef.current = {
|
|
37
|
+
isDragging: true,
|
|
38
|
+
startX: e.clientX,
|
|
39
|
+
startY: e.clientY,
|
|
40
|
+
startScrollLeft: container.scrollLeft,
|
|
41
|
+
startScrollTop: container.scrollTop,
|
|
42
|
+
};
|
|
43
|
+
container.setPointerCapture(e.pointerId);
|
|
44
|
+
container.style.cursor = 'grabbing';
|
|
45
|
+
container.style.userSelect = 'none';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handlePointerMove = (e: PointerEvent) => {
|
|
49
|
+
const { isDragging, startX, startY, startScrollLeft, startScrollTop } = dragRef.current;
|
|
50
|
+
if (!isDragging) return;
|
|
51
|
+
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (direction === 'x') {
|
|
54
|
+
container.scrollLeft = startScrollLeft + (startX - e.clientX);
|
|
55
|
+
} else {
|
|
56
|
+
container.scrollTop = startScrollTop + (startY - e.clientY);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handlePointerUp = (e: PointerEvent) => {
|
|
61
|
+
if (e.button !== 0) return;
|
|
62
|
+
dragRef.current.isDragging = false;
|
|
63
|
+
container.releasePointerCapture(e.pointerId);
|
|
64
|
+
container.style.cursor = 'grab';
|
|
65
|
+
container.style.userSelect = '';
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
container.style.cursor = 'grab';
|
|
69
|
+
|
|
70
|
+
container.addEventListener('pointerdown', handlePointerDown);
|
|
71
|
+
container.addEventListener('pointermove', handlePointerMove, { passive: false });
|
|
72
|
+
container.addEventListener('pointerup', handlePointerUp);
|
|
73
|
+
container.addEventListener('pointercancel', handlePointerUp);
|
|
74
|
+
|
|
75
|
+
return () => {
|
|
76
|
+
container.removeEventListener('pointerdown', handlePointerDown);
|
|
77
|
+
container.removeEventListener('pointermove', handlePointerMove);
|
|
78
|
+
container.removeEventListener('pointerup', handlePointerUp);
|
|
79
|
+
container.removeEventListener('pointercancel', handlePointerUp);
|
|
80
|
+
container.style.cursor = '';
|
|
81
|
+
};
|
|
82
|
+
}, [isEnabled, direction, scrollContainerRef]);
|
|
83
|
+
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_useGetScrollProperties = require('../hooks/useGetScrollProperties.cjs');
|
|
3
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
-
let classnames = require("classnames");
|
|
5
|
-
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
6
|
-
|
|
7
|
-
//#region src/components/PromptCarousel/components/BlockScrollContainer.tsx
|
|
8
|
-
const BlockScrollContainer = ({ children, scrollRef, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }) => {
|
|
9
|
-
const { scrollStyle, scrollClasses } = require_useGetScrollProperties.useGetScrollProperties();
|
|
10
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11
|
-
ref: scrollRef,
|
|
12
|
-
className: (0, classnames.default)(...scrollClasses, className),
|
|
13
|
-
style: scrollStyle,
|
|
14
|
-
role: "group",
|
|
15
|
-
"aria-label": ariaLabel,
|
|
16
|
-
"aria-labelledby": ariaLabelledBy,
|
|
17
|
-
tabIndex: 0,
|
|
18
|
-
children
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
exports.BlockScrollContainer = BlockScrollContainer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useGetScrollProperties } from "../hooks/useGetScrollProperties.js";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
|
|
5
|
-
//#region src/components/PromptCarousel/components/BlockScrollContainer.tsx
|
|
6
|
-
const BlockScrollContainer = ({ children, scrollRef, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }) => {
|
|
7
|
-
const { scrollStyle, scrollClasses } = useGetScrollProperties();
|
|
8
|
-
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
ref: scrollRef,
|
|
10
|
-
className: classNames(...scrollClasses, className),
|
|
11
|
-
style: scrollStyle,
|
|
12
|
-
role: "group",
|
|
13
|
-
"aria-label": ariaLabel,
|
|
14
|
-
"aria-labelledby": ariaLabelledBy,
|
|
15
|
-
tabIndex: 0,
|
|
16
|
-
children
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { BlockScrollContainer };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
-
require('../../Stack/index.cjs');
|
|
4
|
-
const require_useGetScrollProperties = require('../hooks/useGetScrollProperties.cjs');
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
let classnames = require("classnames");
|
|
7
|
-
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
8
|
-
|
|
9
|
-
//#region src/components/PromptCarousel/components/ButtonContainerRow.tsx
|
|
10
|
-
const ButtonContainerRow = ({ children, scrollRef, stackRef, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }) => {
|
|
11
|
-
const { scrollStyle, scrollClasses } = require_useGetScrollProperties.useGetScrollProperties();
|
|
12
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
13
|
-
ref: scrollRef,
|
|
14
|
-
className: (0, classnames.default)(...scrollClasses, className),
|
|
15
|
-
style: scrollStyle,
|
|
16
|
-
role: "group",
|
|
17
|
-
"aria-label": ariaLabel,
|
|
18
|
-
"aria-labelledby": ariaLabelledBy,
|
|
19
|
-
tabIndex: 0,
|
|
20
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21
|
-
ref: stackRef,
|
|
22
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Stack.Stack, {
|
|
23
|
-
direction: "row",
|
|
24
|
-
align: "center",
|
|
25
|
-
gap: "2",
|
|
26
|
-
className: "envive-tw-h-full envive-tw-w-max envive-tw-whitespace-nowrap",
|
|
27
|
-
children
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.ButtonContainerRow = ButtonContainerRow;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
-
import "../../Stack/index.js";
|
|
3
|
-
import { useGetScrollProperties } from "../hooks/useGetScrollProperties.js";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import classNames from "classnames";
|
|
6
|
-
|
|
7
|
-
//#region src/components/PromptCarousel/components/ButtonContainerRow.tsx
|
|
8
|
-
const ButtonContainerRow = ({ children, scrollRef, stackRef, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }) => {
|
|
9
|
-
const { scrollStyle, scrollClasses } = useGetScrollProperties();
|
|
10
|
-
return /* @__PURE__ */ jsx("div", {
|
|
11
|
-
ref: scrollRef,
|
|
12
|
-
className: classNames(...scrollClasses, className),
|
|
13
|
-
style: scrollStyle,
|
|
14
|
-
role: "group",
|
|
15
|
-
"aria-label": ariaLabel,
|
|
16
|
-
"aria-labelledby": ariaLabelledBy,
|
|
17
|
-
tabIndex: 0,
|
|
18
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
19
|
-
ref: stackRef,
|
|
20
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
21
|
-
direction: "row",
|
|
22
|
-
align: "center",
|
|
23
|
-
gap: "2",
|
|
24
|
-
className: "envive-tw-h-full envive-tw-w-max envive-tw-whitespace-nowrap",
|
|
25
|
-
children
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { ButtonContainerRow };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
-
require('../../Stack/index.cjs');
|
|
4
|
-
const require_PromptCarousel_types_types = require('../types/types.cjs');
|
|
5
|
-
const require_BlockScrollContainer = require('./BlockScrollContainer.cjs');
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
|
|
8
|
-
//#region src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx
|
|
9
|
-
const CarouselContentWithBlockScroll = ({ visibleButtonsFirstRow, visibleButtonsSecondRow, shouldShowTwoRows, renderButton, isAnimated, isAnimationStopped, blockScrollRef, blockFirstRowStackRef }) => {
|
|
10
|
-
const showRepetitions = isAnimated && isAnimationStopped;
|
|
11
|
-
const renderRowButtons = (buttons, startIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12
|
-
buttons.map((text, index) => renderButton(text, startIndex + index)),
|
|
13
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, require_PromptCarousel_types_types.RepetitionNumberSuffix.TWO)),
|
|
14
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, require_PromptCarousel_types_types.RepetitionNumberSuffix.THREE))
|
|
15
|
-
] });
|
|
16
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BlockScrollContainer.BlockScrollContainer, {
|
|
17
|
-
scrollRef: blockScrollRef,
|
|
18
|
-
"aria-label": "Scrollable prompt buttons",
|
|
19
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
20
|
-
direction: "column",
|
|
21
|
-
gap: "2",
|
|
22
|
-
className: "envive-tw-w-max",
|
|
23
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24
|
-
ref: blockFirstRowStackRef,
|
|
25
|
-
role: shouldShowTwoRows ? "group" : void 0,
|
|
26
|
-
"aria-label": shouldShowTwoRows ? "First row of prompt buttons" : void 0,
|
|
27
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Stack.Stack, {
|
|
28
|
-
direction: "row",
|
|
29
|
-
gap: "2",
|
|
30
|
-
className: "envive-tw-whitespace-nowrap",
|
|
31
|
-
children: renderRowButtons(visibleButtonsFirstRow, 0)
|
|
32
|
-
})
|
|
33
|
-
}), shouldShowTwoRows && visibleButtonsSecondRow.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Stack.Stack, {
|
|
34
|
-
direction: "row",
|
|
35
|
-
gap: "2",
|
|
36
|
-
className: "envive-tw-whitespace-nowrap",
|
|
37
|
-
"aria-label": "Second row of prompt buttons",
|
|
38
|
-
children: renderRowButtons(visibleButtonsSecondRow, visibleButtonsFirstRow.length)
|
|
39
|
-
})]
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.CarouselContentWithBlockScroll = CarouselContentWithBlockScroll;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
-
import "../../Stack/index.js";
|
|
3
|
-
import { RepetitionNumberSuffix } from "../types/types.js";
|
|
4
|
-
import { BlockScrollContainer } from "./BlockScrollContainer.js";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx
|
|
8
|
-
const CarouselContentWithBlockScroll = ({ visibleButtonsFirstRow, visibleButtonsSecondRow, shouldShowTwoRows, renderButton, isAnimated, isAnimationStopped, blockScrollRef, blockFirstRowStackRef }) => {
|
|
9
|
-
const showRepetitions = isAnimated && isAnimationStopped;
|
|
10
|
-
const renderRowButtons = (buttons, startIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
-
buttons.map((text, index) => renderButton(text, startIndex + index)),
|
|
12
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, RepetitionNumberSuffix.TWO)),
|
|
13
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, RepetitionNumberSuffix.THREE))
|
|
14
|
-
] });
|
|
15
|
-
return /* @__PURE__ */ jsx(BlockScrollContainer, {
|
|
16
|
-
scrollRef: blockScrollRef,
|
|
17
|
-
"aria-label": "Scrollable prompt buttons",
|
|
18
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
19
|
-
direction: "column",
|
|
20
|
-
gap: "2",
|
|
21
|
-
className: "envive-tw-w-max",
|
|
22
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
23
|
-
ref: blockFirstRowStackRef,
|
|
24
|
-
role: shouldShowTwoRows ? "group" : void 0,
|
|
25
|
-
"aria-label": shouldShowTwoRows ? "First row of prompt buttons" : void 0,
|
|
26
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
27
|
-
direction: "row",
|
|
28
|
-
gap: "2",
|
|
29
|
-
className: "envive-tw-whitespace-nowrap",
|
|
30
|
-
children: renderRowButtons(visibleButtonsFirstRow, 0)
|
|
31
|
-
})
|
|
32
|
-
}), shouldShowTwoRows && visibleButtonsSecondRow.length > 0 && /* @__PURE__ */ jsx(Stack, {
|
|
33
|
-
direction: "row",
|
|
34
|
-
gap: "2",
|
|
35
|
-
className: "envive-tw-whitespace-nowrap",
|
|
36
|
-
"aria-label": "Second row of prompt buttons",
|
|
37
|
-
children: renderRowButtons(visibleButtonsSecondRow, visibleButtonsFirstRow.length)
|
|
38
|
-
})]
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { CarouselContentWithBlockScroll };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
-
require('../../Stack/index.cjs');
|
|
4
|
-
const require_PromptCarousel_types_types = require('../types/types.cjs');
|
|
5
|
-
const require_ButtonContainerRow = require('./ButtonContainerRow.cjs');
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
|
|
8
|
-
//#region src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx
|
|
9
|
-
const CarouselContentWithRowScroll = ({ visibleButtonsFirstRow, visibleButtonsSecondRow, shouldShowTwoRows, isAnimated, isAnimationStopped, renderButton, firstRowScrollRef, firstRowStackRef, secondRowScrollRef }) => {
|
|
10
|
-
const showRepetitions = isAnimated && !isAnimationStopped;
|
|
11
|
-
const renderRowButtons = (buttons, startIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12
|
-
buttons.map((text, index) => renderButton(text, startIndex + index)),
|
|
13
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, require_PromptCarousel_types_types.RepetitionNumberSuffix.TWO)),
|
|
14
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, require_PromptCarousel_types_types.RepetitionNumberSuffix.THREE))
|
|
15
|
-
] });
|
|
16
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
17
|
-
direction: "column",
|
|
18
|
-
gap: "2",
|
|
19
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ButtonContainerRow.ButtonContainerRow, {
|
|
20
|
-
scrollRef: firstRowScrollRef,
|
|
21
|
-
stackRef: firstRowStackRef,
|
|
22
|
-
"aria-label": shouldShowTwoRows ? "First row of prompt buttons" : void 0,
|
|
23
|
-
children: renderRowButtons(visibleButtonsFirstRow, 0)
|
|
24
|
-
}), shouldShowTwoRows && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ButtonContainerRow.ButtonContainerRow, {
|
|
25
|
-
scrollRef: secondRowScrollRef,
|
|
26
|
-
"aria-label": "Second row of prompt buttons",
|
|
27
|
-
children: renderRowButtons(visibleButtonsSecondRow, visibleButtonsFirstRow.length)
|
|
28
|
-
})]
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.CarouselContentWithRowScroll = CarouselContentWithRowScroll;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
-
import "../../Stack/index.js";
|
|
3
|
-
import { RepetitionNumberSuffix } from "../types/types.js";
|
|
4
|
-
import { ButtonContainerRow } from "./ButtonContainerRow.js";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx
|
|
8
|
-
const CarouselContentWithRowScroll = ({ visibleButtonsFirstRow, visibleButtonsSecondRow, shouldShowTwoRows, isAnimated, isAnimationStopped, renderButton, firstRowScrollRef, firstRowStackRef, secondRowScrollRef }) => {
|
|
9
|
-
const showRepetitions = isAnimated && !isAnimationStopped;
|
|
10
|
-
const renderRowButtons = (buttons, startIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
-
buttons.map((text, index) => renderButton(text, startIndex + index)),
|
|
12
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, RepetitionNumberSuffix.TWO)),
|
|
13
|
-
showRepetitions && buttons.map((text, index) => renderButton(text, startIndex + index, RepetitionNumberSuffix.THREE))
|
|
14
|
-
] });
|
|
15
|
-
return /* @__PURE__ */ jsxs(Stack, {
|
|
16
|
-
direction: "column",
|
|
17
|
-
gap: "2",
|
|
18
|
-
children: [/* @__PURE__ */ jsx(ButtonContainerRow, {
|
|
19
|
-
scrollRef: firstRowScrollRef,
|
|
20
|
-
stackRef: firstRowStackRef,
|
|
21
|
-
"aria-label": shouldShowTwoRows ? "First row of prompt buttons" : void 0,
|
|
22
|
-
children: renderRowButtons(visibleButtonsFirstRow, 0)
|
|
23
|
-
}), shouldShowTwoRows && /* @__PURE__ */ jsx(ButtonContainerRow, {
|
|
24
|
-
scrollRef: secondRowScrollRef,
|
|
25
|
-
"aria-label": "Second row of prompt buttons",
|
|
26
|
-
children: renderRowButtons(visibleButtonsSecondRow, visibleButtonsFirstRow.length)
|
|
27
|
-
})]
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { CarouselContentWithRowScroll };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const require_ButtonContainerRow = require('./ButtonContainerRow.cjs');
|
|
2
|
-
const require_CarouselContentWithRowScroll = require('./CarouselContentWithRowScroll.cjs');
|
|
3
|
-
const require_CarouselContentWithBlockScroll = require('./CarouselContentWithBlockScroll.cjs');
|
|
4
|
-
|
|
5
|
-
//#region src/components/PromptCarousel/components/index.ts
|
|
6
|
-
const PromptCarouselComponents = {
|
|
7
|
-
CarouselContentWithRowScroll: require_CarouselContentWithRowScroll.CarouselContentWithRowScroll,
|
|
8
|
-
CarouselContentWithBlockScroll: require_CarouselContentWithBlockScroll.CarouselContentWithBlockScroll,
|
|
9
|
-
ButtonContainerRow: require_ButtonContainerRow.ButtonContainerRow
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.PromptCarouselComponents = PromptCarouselComponents;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ButtonContainerRow } from "./ButtonContainerRow.js";
|
|
2
|
-
import { CarouselContentWithRowScroll } from "./CarouselContentWithRowScroll.js";
|
|
3
|
-
import { CarouselContentWithBlockScroll } from "./CarouselContentWithBlockScroll.js";
|
|
4
|
-
|
|
5
|
-
//#region src/components/PromptCarousel/components/index.ts
|
|
6
|
-
const PromptCarouselComponents = {
|
|
7
|
-
CarouselContentWithRowScroll,
|
|
8
|
-
CarouselContentWithBlockScroll,
|
|
9
|
-
ButtonContainerRow
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { PromptCarouselComponents };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_PromptCarousel_types_types = require('../types/types.cjs');
|
|
3
|
-
let react = require("react");
|
|
4
|
-
|
|
5
|
-
//#region src/components/PromptCarousel/hooks/useButtonScrollPosition.ts
|
|
6
|
-
const getElementId = (element) => {
|
|
7
|
-
if (!element) return null;
|
|
8
|
-
return element.id?.trim() || null;
|
|
9
|
-
};
|
|
10
|
-
function useButtonScrollPosition(firstRowScrollRef, blockScrollRef, shouldUseRowScroll) {
|
|
11
|
-
const savedButtonIdRef = (0, react.useRef)(null);
|
|
12
|
-
const savedButtonPositionRef = (0, react.useRef)(null);
|
|
13
|
-
const captureButtonUnderMouse = (0, react.useCallback)((mouseX, mouseY) => {
|
|
14
|
-
const container = firstRowScrollRef.current;
|
|
15
|
-
if (!container) return;
|
|
16
|
-
const containerRect = container.getBoundingClientRect();
|
|
17
|
-
const elementUnderMouse = document.elementFromPoint(mouseX, mouseY);
|
|
18
|
-
const targetButtonId = getElementId(elementUnderMouse);
|
|
19
|
-
let closestButton = null;
|
|
20
|
-
if (targetButtonId) {
|
|
21
|
-
const buttonById = document.querySelector(`#${CSS.escape(targetButtonId)}`);
|
|
22
|
-
if (buttonById && (elementUnderMouse === buttonById || buttonById.contains(elementUnderMouse))) closestButton = buttonById;
|
|
23
|
-
}
|
|
24
|
-
if (!closestButton) {
|
|
25
|
-
const buttons = Array.from(container.querySelectorAll("button"));
|
|
26
|
-
let closestDistance = Infinity;
|
|
27
|
-
for (const button of buttons) {
|
|
28
|
-
const buttonRect = button.getBoundingClientRect();
|
|
29
|
-
if (mouseX >= buttonRect.left && mouseX <= buttonRect.right && mouseY >= buttonRect.top && mouseY <= buttonRect.bottom) {
|
|
30
|
-
closestButton = button;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
const buttonCenterX = buttonRect.left + buttonRect.width / 2;
|
|
34
|
-
const buttonCenterY = buttonRect.top + buttonRect.height / 2;
|
|
35
|
-
const distance = Math.sqrt((mouseX - buttonCenterX) ** 2 + (mouseY - buttonCenterY) ** 2);
|
|
36
|
-
if (distance < closestDistance) {
|
|
37
|
-
closestDistance = distance;
|
|
38
|
-
closestButton = button;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (closestButton) {
|
|
43
|
-
const id = getElementId(closestButton);
|
|
44
|
-
if (id) {
|
|
45
|
-
savedButtonIdRef.current = id;
|
|
46
|
-
savedButtonPositionRef.current = closestButton.getBoundingClientRect().left - containerRect.left;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, [firstRowScrollRef]);
|
|
50
|
-
(0, react.useEffect)(() => {
|
|
51
|
-
if (shouldUseRowScroll || !blockScrollRef.current || !savedButtonIdRef.current || savedButtonPositionRef.current === null) return;
|
|
52
|
-
const container = blockScrollRef.current;
|
|
53
|
-
const targetId = savedButtonIdRef.current.trim();
|
|
54
|
-
const targetPosition = savedButtonPositionRef.current;
|
|
55
|
-
const getScrollId = (id) => {
|
|
56
|
-
if (id.endsWith(require_PromptCarousel_types_types.RepetitionNumberSuffix.TWO)) return id;
|
|
57
|
-
if (id.endsWith(require_PromptCarousel_types_types.RepetitionNumberSuffix.THREE)) return `${id.slice(0, -2)}${require_PromptCarousel_types_types.RepetitionNumberSuffix.TWO}`;
|
|
58
|
-
return `${id}${require_PromptCarousel_types_types.RepetitionNumberSuffix.TWO}`;
|
|
59
|
-
};
|
|
60
|
-
const applyScroll = () => {
|
|
61
|
-
const finalId = getScrollId(targetId);
|
|
62
|
-
const targetButton = container.querySelector(`#${CSS.escape(`${finalId}`)}`);
|
|
63
|
-
const scrollableContent = container.firstElementChild;
|
|
64
|
-
if (!targetButton || !scrollableContent) return;
|
|
65
|
-
const contentRect = scrollableContent.getBoundingClientRect();
|
|
66
|
-
const newScrollLeft = targetButton.getBoundingClientRect().left - contentRect.left + container.scrollLeft - targetPosition;
|
|
67
|
-
container.scrollLeft = Math.max(0, newScrollLeft);
|
|
68
|
-
};
|
|
69
|
-
requestAnimationFrame(() => {
|
|
70
|
-
requestAnimationFrame(() => {
|
|
71
|
-
requestAnimationFrame(applyScroll);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}, [shouldUseRowScroll, blockScrollRef]);
|
|
75
|
-
return { captureButtonUnderMouse };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
exports.useButtonScrollPosition = useButtonScrollPosition;
|