@intlayer/design-system 6.1.4 → 6.1.6-canary.0
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/.vite/manifest.json +19 -14
- package/dist/Form-CriPBaZk.js.map +1 -1
- package/dist/Form-DJrUK3mm.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.cjs +51 -15
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.d.ts +44 -5
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.mjs +52 -16
- package/dist/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/components/Avatar/index.cjs +114 -31
- package/dist/components/Avatar/index.cjs.map +1 -1
- package/dist/components/Avatar/index.d.ts +46 -2
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.mjs +115 -32
- package/dist/components/Avatar/index.mjs.map +1 -1
- package/dist/components/Badge/index.cjs +88 -9
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.ts +80 -2
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.mjs +89 -10
- package/dist/components/Badge/index.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs +124 -59
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts +89 -5
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs +124 -59
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/Button/Button.cjs +44 -25
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.ts +95 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.mjs +44 -25
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.cjs +38 -7
- package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.d.ts +13 -0
- package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -1
- package/dist/components/ClickOutsideDiv/index.mjs +39 -8
- package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
- package/dist/components/Container/index.cjs +2 -0
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.d.ts +42 -0
- package/dist/components/Container/index.d.ts.map +1 -1
- package/dist/components/Container/index.mjs +2 -0
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.cjs +80 -33
- package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.d.ts +29 -0
- package/dist/components/ContentEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.mjs +80 -33
- package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.cjs +58 -31
- package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.d.ts +33 -0
- package/dist/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.mjs +58 -31
- package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +58 -30
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +35 -0
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +59 -31
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/ContentEditor/index.cjs +4 -0
- package/dist/components/ContentEditor/index.cjs.map +1 -1
- package/dist/components/ContentEditor/index.d.ts +2 -0
- package/dist/components/ContentEditor/index.d.ts.map +1 -1
- package/dist/components/ContentEditor/index.mjs +5 -1
- package/dist/components/ContentEditor/index.mjs.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.cjs +9 -1
- package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.d.ts +167 -0
- package/dist/components/ContentSelector/ContentSelector.d.ts.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.mjs +9 -1
- package/dist/components/ContentSelector/ContentSelector.mjs.map +1 -1
- package/dist/components/CopyButton/index.cjs +23 -8
- package/dist/components/CopyButton/index.cjs.map +1 -1
- package/dist/components/CopyButton/index.d.ts +78 -0
- package/dist/components/CopyButton/index.d.ts.map +1 -1
- package/dist/components/CopyButton/index.mjs +23 -8
- package/dist/components/CopyButton/index.mjs.map +1 -1
- package/dist/components/CopyToClipboard/index.cjs +58 -22
- package/dist/components/CopyToClipboard/index.cjs.map +1 -1
- package/dist/components/CopyToClipboard/index.d.ts +68 -2
- package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/components/CopyToClipboard/index.mjs +59 -23
- package/dist/components/CopyToClipboard/index.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs +6 -4
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts +92 -15
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +6 -4
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.d.ts +38 -0
- package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.cjs +10 -2
- package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.mjs +10 -2
- package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.d.ts +42 -0
- package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +58 -0
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/components/Footer/index.cjs.map +1 -1
- package/dist/components/Footer/index.d.ts +101 -0
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.mjs.map +1 -1
- package/dist/components/Form/elements/MultiselectElement.d.ts.map +1 -1
- package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
- package/dist/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
- package/dist/components/Headers/index.cjs.map +1 -1
- package/dist/components/Headers/index.d.ts +69 -2
- package/dist/components/Headers/index.d.ts.map +1 -1
- package/dist/components/Headers/index.mjs.map +1 -1
- package/dist/components/HeightResizer/index.cjs +10 -7
- package/dist/components/HeightResizer/index.cjs.map +1 -1
- package/dist/components/HeightResizer/index.d.ts +89 -0
- package/dist/components/HeightResizer/index.d.ts.map +1 -1
- package/dist/components/HeightResizer/index.mjs +10 -7
- package/dist/components/HeightResizer/index.mjs.map +1 -1
- package/dist/components/IDE/MarkDownRender.cjs +2 -2
- package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
- package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
- package/dist/components/IDE/MarkDownRender.mjs +2 -2
- package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/components/InformationTag/index.cjs.map +1 -1
- package/dist/components/InformationTag/index.d.ts +72 -0
- package/dist/components/InformationTag/index.d.ts.map +1 -1
- package/dist/components/InformationTag/index.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/components/Label/index.cjs +25 -3
- package/dist/components/Label/index.cjs.map +1 -1
- package/dist/components/Label/index.d.ts +65 -1
- package/dist/components/Label/index.d.ts.map +1 -1
- package/dist/components/Label/index.mjs +26 -4
- package/dist/components/Label/index.mjs.map +1 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts +169 -0
- package/dist/components/Link/Link.d.ts.map +1 -1
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/Loader/index.cjs.map +1 -1
- package/dist/components/Loader/index.d.ts +82 -11
- package/dist/components/Loader/index.d.ts.map +1 -1
- package/dist/components/Loader/index.mjs.map +1 -1
- package/dist/components/Loader/spinner.cjs.map +1 -1
- package/dist/components/Loader/spinner.d.ts +56 -0
- package/dist/components/Loader/spinner.d.ts.map +1 -1
- package/dist/components/Loader/spinner.mjs.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.cjs +3 -3
- package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.d.ts +148 -1
- package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.mjs +2 -2
- package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/components/MarkDownRender/{processer.cjs → processor.cjs} +307 -107
- package/dist/components/MarkDownRender/processor.cjs.map +1 -0
- package/dist/components/MarkDownRender/{processer.d.ts → processor.d.ts} +1 -1
- package/dist/components/MarkDownRender/processor.d.ts.map +1 -0
- package/dist/components/MarkDownRender/{processer.mjs → processor.mjs} +307 -107
- package/dist/components/MarkDownRender/processor.mjs.map +1 -0
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +5 -0
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +81 -3
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +5 -0
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/Burger.cjs.map +1 -1
- package/dist/components/Navbar/Burger.d.ts +54 -0
- package/dist/components/Navbar/Burger.d.ts.map +1 -1
- package/dist/components/Navbar/Burger.mjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
- package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
- package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.d.ts +69 -0
- package/dist/components/Navbar/index.d.ts.map +1 -1
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/Navbar/useNavigation.cjs +8 -1
- package/dist/components/Navbar/useNavigation.cjs.map +1 -1
- package/dist/components/Navbar/useNavigation.d.ts +83 -0
- package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
- package/dist/components/Navbar/useNavigation.mjs +8 -1
- package/dist/components/Navbar/useNavigation.mjs.map +1 -1
- package/dist/components/Pattern/DotPattern.cjs.map +1 -1
- package/dist/components/Pattern/DotPattern.d.ts +101 -0
- package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
- package/dist/components/Pattern/DotPattern.mjs.map +1 -1
- package/dist/components/Pattern/GridPattern.cjs.map +1 -1
- package/dist/components/Pattern/GridPattern.d.ts +114 -0
- package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
- package/dist/components/Pattern/GridPattern.mjs.map +1 -1
- package/dist/components/Pattern/SpotLight.cjs.map +1 -1
- package/dist/components/Pattern/SpotLight.d.ts +125 -0
- package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
- package/dist/components/Pattern/SpotLight.mjs.map +1 -1
- package/dist/components/Popover/index.cjs +10 -10
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.ts +110 -15
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.mjs +10 -10
- package/dist/components/Popover/index.mjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
- package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
- package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
- package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
- package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts +125 -18
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts +214 -7
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.d.ts +157 -8
- package/dist/components/SwitchSelector/index.d.ts.map +1 -1
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.d.ts +184 -0
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.mjs.map +1 -1
- package/dist/components/Tag/index.cjs.map +1 -1
- package/dist/components/Tag/index.d.ts +223 -0
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.mjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
- package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
- package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +74 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/Toaster/Toast.cjs +4 -0
- package/dist/components/Toaster/Toast.cjs.map +1 -1
- package/dist/components/Toaster/Toast.d.ts +148 -2
- package/dist/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/components/Toaster/Toast.mjs +4 -0
- package/dist/components/Toaster/Toast.mjs.map +1 -1
- package/dist/components/Toaster/Toaster.cjs.map +1 -1
- package/dist/components/Toaster/Toaster.d.ts +42 -0
- package/dist/components/Toaster/Toaster.d.ts.map +1 -1
- package/dist/components/Toaster/Toaster.mjs.map +1 -1
- package/dist/components/Toaster/useToast.cjs.map +1 -1
- package/dist/components/Toaster/useToast.d.ts +199 -2
- package/dist/components/Toaster/useToast.d.ts.map +1 -1
- package/dist/components/Toaster/useToast.mjs.map +1 -1
- package/dist/components/WithResizer/index.cjs.map +1 -1
- package/dist/components/WithResizer/index.d.ts +143 -0
- package/dist/components/WithResizer/index.d.ts.map +1 -1
- package/dist/components/WithResizer/index.mjs.map +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +2 -1
- package/dist/hooks/reactQuery.cjs.map +1 -1
- package/dist/hooks/reactQuery.d.ts +1 -1
- package/dist/hooks/reactQuery.d.ts.map +1 -1
- package/dist/hooks/reactQuery.mjs +2 -1
- package/dist/hooks/reactQuery.mjs.map +1 -1
- package/dist/hooks/useHorizontalSwipe.cjs +4 -4
- package/dist/hooks/useHorizontalSwipe.cjs.map +1 -1
- package/dist/hooks/useHorizontalSwipe.d.ts.map +1 -1
- package/dist/hooks/useHorizontalSwipe.mjs +4 -4
- package/dist/hooks/useHorizontalSwipe.mjs.map +1 -1
- package/dist/utils/image.cjs +30 -0
- package/dist/utils/image.cjs.map +1 -0
- package/dist/utils/image.d.ts +37 -0
- package/dist/utils/image.d.ts.map +1 -0
- package/dist/utils/image.mjs +30 -0
- package/dist/utils/image.mjs.map +1 -0
- package/package.json +20 -19
- package/dist/components/MarkDownRender/processer.cjs.map +0 -1
- package/dist/components/MarkDownRender/processer.d.ts.map +0 -1
- package/dist/components/MarkDownRender/processer.mjs.map +0 -1
- package/dist/utils/capitalize.cjs +0 -10
- package/dist/utils/capitalize.cjs.map +0 -1
- package/dist/utils/capitalize.d.ts +0 -2
- package/dist/utils/capitalize.d.ts.map +0 -1
- package/dist/utils/capitalize.mjs +0 -10
- package/dist/utils/capitalize.mjs.map +0 -1
|
@@ -1,9 +1,154 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { AutoSizedTextAreaProps } from './AutoSizeTextArea';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for debouncing values to prevent excessive API calls.
|
|
5
|
+
*
|
|
6
|
+
* Delays updating the returned value until the input value has stopped changing
|
|
7
|
+
* for the specified delay period.
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to debounce
|
|
10
|
+
* @param delay - Delay in milliseconds before updating the debounced value
|
|
11
|
+
* @returns The debounced value that only updates after the delay period
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const [searchTerm, setSearchTerm] = useState('');
|
|
16
|
+
* const debouncedSearchTerm = useDebounce(searchTerm, 300);
|
|
17
|
+
*
|
|
18
|
+
* useEffect(() => {
|
|
19
|
+
* if (debouncedSearchTerm) {
|
|
20
|
+
* performSearch(debouncedSearchTerm);
|
|
21
|
+
* }
|
|
22
|
+
* }, [debouncedSearchTerm]);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
3
25
|
export declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
26
|
+
/**
|
|
27
|
+
* Props for the AutocompleteTextArea component.
|
|
28
|
+
*
|
|
29
|
+
* Extends AutoSizedTextAreaProps with AI-powered autocomplete functionality.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // AI-powered autocomplete textarea
|
|
34
|
+
* <AutoCompleteTextarea
|
|
35
|
+
* placeholder="Start typing for AI suggestions..."
|
|
36
|
+
* isActive={true}
|
|
37
|
+
* autoSize={true}
|
|
38
|
+
* maxRows={10}
|
|
39
|
+
* />
|
|
40
|
+
*
|
|
41
|
+
* // Manual suggestion mode
|
|
42
|
+
* <AutoCompleteTextarea
|
|
43
|
+
* value={content}
|
|
44
|
+
* onChange={handleChange}
|
|
45
|
+
* suggestion="Consider adding more details about..."
|
|
46
|
+
* isActive={false}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* // Disabled autocomplete for sensitive content
|
|
50
|
+
* <AutoCompleteTextarea
|
|
51
|
+
* placeholder="Private notes (no AI assistance)"
|
|
52
|
+
* isActive={false}
|
|
53
|
+
* autoSize={true}
|
|
54
|
+
* />
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
4
57
|
export type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {
|
|
58
|
+
/** Whether AI autocomplete is active and should fetch suggestions */
|
|
5
59
|
isActive?: boolean;
|
|
60
|
+
/** Manual suggestion text to display (overrides AI suggestions) */
|
|
6
61
|
suggestion?: string;
|
|
7
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* AutoCompleteTextarea Component
|
|
65
|
+
*
|
|
66
|
+
* An intelligent textarea that provides AI-powered autocomplete suggestions as users type,
|
|
67
|
+
* combining auto-sizing functionality with contextual text completion.
|
|
68
|
+
*
|
|
69
|
+
* ## Features
|
|
70
|
+
* - **AI-Powered Suggestions**: Context-aware autocomplete using configured AI models
|
|
71
|
+
* - **Debounced API Calls**: Efficient suggestion fetching with 200ms debounce
|
|
72
|
+
* - **Visual Suggestions**: Inline preview of suggested completions
|
|
73
|
+
* - **Keyboard Navigation**: Tab key to accept suggestions
|
|
74
|
+
* - **Context Analysis**: Uses surrounding text for better suggestions
|
|
75
|
+
* - **Auto-Sizing**: Inherits all AutoSizedTextArea capabilities
|
|
76
|
+
* - **Performance Optimized**: Smart caching and minimal re-renders
|
|
77
|
+
*
|
|
78
|
+
* ## Technical Implementation
|
|
79
|
+
* - **Debounce Strategy**: 200ms delay before fetching suggestions
|
|
80
|
+
* - **Context Window**: 5 lines before/after cursor for context
|
|
81
|
+
* - **Minimum Trigger**: Requires 3+ characters before suggesting
|
|
82
|
+
* - **Position Tracking**: Ghost layer for accurate suggestion positioning
|
|
83
|
+
* - **Cursor Management**: Tracks cursor position during suggestion fetch
|
|
84
|
+
*
|
|
85
|
+
* ## AI Integration
|
|
86
|
+
* - Uses configured AI model (OpenAI, Anthropic, etc.)
|
|
87
|
+
* - Sends context-aware prompts for relevant suggestions
|
|
88
|
+
* - Respects temperature and model settings from configuration
|
|
89
|
+
* - Handles API errors gracefully without interrupting user flow
|
|
90
|
+
*
|
|
91
|
+
* ## Use Cases
|
|
92
|
+
* - **Content Creation**: Blog posts, articles, documentation
|
|
93
|
+
* - **Code Comments**: Intelligent code documentation assistance
|
|
94
|
+
* - **Email Composition**: Professional email writing assistance
|
|
95
|
+
* - **Creative Writing**: Story and narrative completion
|
|
96
|
+
* - **Technical Documentation**: API docs, README files
|
|
97
|
+
* - **Social Media**: Post creation with engagement optimization
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* // Blog writing assistant
|
|
102
|
+
* const [blogPost, setBlogPost] = useState('');
|
|
103
|
+
* const [isAiEnabled, setIsAiEnabled] = useState(true);
|
|
104
|
+
*
|
|
105
|
+
* <div className="space-y-4">
|
|
106
|
+
* <div className="flex items-center gap-2">
|
|
107
|
+
* <Switch
|
|
108
|
+
* checked={isAiEnabled}
|
|
109
|
+
* onChange={setIsAiEnabled}
|
|
110
|
+
* />
|
|
111
|
+
* <label>AI Writing Assistant</label>
|
|
112
|
+
* </div>
|
|
113
|
+
*
|
|
114
|
+
* <AutoCompleteTextarea
|
|
115
|
+
* value={blogPost}
|
|
116
|
+
* onChange={(e) => setBlogPost(e.target.value)}
|
|
117
|
+
* placeholder="Start writing your blog post..."
|
|
118
|
+
* isActive={isAiEnabled}
|
|
119
|
+
* autoSize={true}
|
|
120
|
+
* maxRows={15}
|
|
121
|
+
* className="min-h-[200px] font-serif text-lg leading-relaxed"
|
|
122
|
+
* />
|
|
123
|
+
* </div>
|
|
124
|
+
*
|
|
125
|
+
* // Code documentation assistant
|
|
126
|
+
* <AutoCompleteTextarea
|
|
127
|
+
* value={docComment}
|
|
128
|
+
* onChange={handleDocChange}
|
|
129
|
+
* placeholder="/** Describe this function... *\/"
|
|
130
|
+
* isActive={true}
|
|
131
|
+
* autoSize={true}
|
|
132
|
+
* maxRows={8}
|
|
133
|
+
* className="font-mono text-sm"
|
|
134
|
+
* />
|
|
135
|
+
*
|
|
136
|
+
* // Email composition with templates
|
|
137
|
+
* <AutoCompleteTextarea
|
|
138
|
+
* defaultValue="Dear "
|
|
139
|
+
* placeholder="AI will help complete your email..."
|
|
140
|
+
* isActive={true}
|
|
141
|
+
* autoSize={true}
|
|
142
|
+
* maxRows={12}
|
|
143
|
+
* variant={InputVariant.DEFAULT}
|
|
144
|
+
* />
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* ## Accessibility
|
|
148
|
+
* - Ghost layer is properly hidden from screen readers
|
|
149
|
+
* - Maintains focus management during suggestion acceptance
|
|
150
|
+
* - Preserves keyboard navigation patterns
|
|
151
|
+
* - Respects reduced motion preferences
|
|
152
|
+
*/
|
|
8
153
|
export declare const AutoCompleteTextarea: FC<AutocompleteTextAreaProps>;
|
|
9
154
|
//# sourceMappingURL=AutocompleteTextArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,WAAW,GAAI,CAAC,EAAG,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAazD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA6L9D,CAAC"}
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAG,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAazD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG;IAC/D,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA6L9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.mjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n isActive?: boolean;\n suggestion?: string;\n};\n\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { mutate: autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const placeholderRef = useRef<HTMLSpanElement>(null);\n const ghostLayerRef = useRef<HTMLDivElement>(null);\n const [suggestionPosition, setSuggestionPosition] = useState<{\n left: number;\n top: number;\n } | null>(null);\n const [cursorAtFetch, setCursorAtFetch] = useState(-1);\n\n // Only update this “debouncedText” after the user stops typing for 200ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const cursor =\n textareaRef.current?.selectionStart ?? debouncedText.length;\n const before = debouncedText.slice(0, cursor);\n const after = debouncedText.slice(cursor);\n const numLines = 5;\n const beforeLines = before.split('\\n');\n const contextBeforeLines = beforeLines.slice(\n Math.max(0, beforeLines.length - numLines - 1),\n -1\n );\n const contextBefore = contextBeforeLines.join('\\n');\n const currentLine = beforeLines[beforeLines.length - 1] ?? '';\n const afterLines = after.split('\\n');\n const contextAfter = afterLines.slice(1, numLines + 1).join('\\n');\n\n autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive, autocomplete, configuration]);\n\n useEffect(() => {\n if (\n !suggestion ||\n cursorAtFetch === -1 ||\n !placeholderRef.current ||\n !ghostLayerRef.current\n ) {\n setSuggestionPosition(null);\n return;\n }\n\n const rect = placeholderRef.current.getBoundingClientRect();\n const parentRect = ghostLayerRef.current.getBoundingClientRect();\n setSuggestionPosition({\n left: rect.left - parentRect.left,\n top: rect.top - parentRect.top,\n });\n }, [suggestion, cursorAtFetch, text]);\n\n const acceptSuggestion = () => {\n const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;\n if (currentCursor !== cursorAtFetch) return;\n const newText =\n text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);\n setText(newText);\n setSuggestion('');\n setCursorAtFetch(-1);\n setTimeout(() => {\n textareaRef.current?.focus();\n const newCursorPos = currentCursor + suggestion.length;\n textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);\n }, 0);\n };\n\n return (\n <div className=\"relative w-full\">\n <div\n ref={ghostLayerRef}\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n {suggestion && cursorAtFetch !== -1 ? (\n <>\n <span className=\"align-text-top text-transparent\">\n {text.slice(0, cursorAtFetch)}\n </span>\n <span\n ref={placeholderRef}\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n >\n {suggestion}\n </span>\n <span className=\"align-text-top text-transparent\">\n {text.slice(cursorAtFetch)}\n </span>\n </>\n ) : (\n <span className=\"align-text-top text-transparent\">{text}</span>\n )}\n {suggestionProp && (\n <span className=\"text-neutral align-text-top\">{suggestionProp}</span>\n )}\n </div>\n {suggestion && suggestionPosition && (\n <div\n className=\"pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]\"\n style={{\n position: 'absolute',\n left: suggestionPosition.left,\n top: suggestionPosition.top,\n }}\n >\n {suggestion}\n </div>\n )}\n <AutoSizedTextArea\n {...props}\n ref={textareaRef}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n setSuggestion('');\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n onSelect={(e) => {\n if (\n suggestion &&\n (e.target as HTMLTextAreaElement).selectionStart !== cursorAtFetch\n ) {\n setSuggestion('');\n setCursorAtFetch(-1);\n }\n props.onSelect?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAY,KAAK;AAE7D,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAOO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,QAAM,eAAe,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AACnE,QAAM,EAAE,QAAQ,aAAA,IAAiB,gBAAA;AACjC,QAAM,gBAAgB,iBAAA;AACtB,QAAM,CAAC,SAAS,UAAU,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B,mBAAmB,eACrD;AACA,0BAAc,EAAE;AAChB,6BAAiB,EAAE;AAAA,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.mjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\n/**\n * Custom hook for debouncing values to prevent excessive API calls.\n *\n * Delays updating the returned value until the input value has stopped changing\n * for the specified delay period.\n *\n * @param value - The value to debounce\n * @param delay - Delay in milliseconds before updating the debounced value\n * @returns The debounced value that only updates after the delay period\n *\n * @example\n * ```tsx\n * const [searchTerm, setSearchTerm] = useState('');\n * const debouncedSearchTerm = useDebounce(searchTerm, 300);\n *\n * useEffect(() => {\n * if (debouncedSearchTerm) {\n * performSearch(debouncedSearchTerm);\n * }\n * }, [debouncedSearchTerm]);\n * ```\n */\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\n/**\n * Props for the AutocompleteTextArea component.\n *\n * Extends AutoSizedTextAreaProps with AI-powered autocomplete functionality.\n *\n * @example\n * ```tsx\n * // AI-powered autocomplete textarea\n * <AutoCompleteTextarea\n * placeholder=\"Start typing for AI suggestions...\"\n * isActive={true}\n * autoSize={true}\n * maxRows={10}\n * />\n *\n * // Manual suggestion mode\n * <AutoCompleteTextarea\n * value={content}\n * onChange={handleChange}\n * suggestion=\"Consider adding more details about...\"\n * isActive={false}\n * />\n *\n * // Disabled autocomplete for sensitive content\n * <AutoCompleteTextarea\n * placeholder=\"Private notes (no AI assistance)\"\n * isActive={false}\n * autoSize={true}\n * />\n * ```\n */\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n /** Whether AI autocomplete is active and should fetch suggestions */\n isActive?: boolean;\n /** Manual suggestion text to display (overrides AI suggestions) */\n suggestion?: string;\n};\n\n/**\n * AutoCompleteTextarea Component\n *\n * An intelligent textarea that provides AI-powered autocomplete suggestions as users type,\n * combining auto-sizing functionality with contextual text completion.\n *\n * ## Features\n * - **AI-Powered Suggestions**: Context-aware autocomplete using configured AI models\n * - **Debounced API Calls**: Efficient suggestion fetching with 200ms debounce\n * - **Visual Suggestions**: Inline preview of suggested completions\n * - **Keyboard Navigation**: Tab key to accept suggestions\n * - **Context Analysis**: Uses surrounding text for better suggestions\n * - **Auto-Sizing**: Inherits all AutoSizedTextArea capabilities\n * - **Performance Optimized**: Smart caching and minimal re-renders\n *\n * ## Technical Implementation\n * - **Debounce Strategy**: 200ms delay before fetching suggestions\n * - **Context Window**: 5 lines before/after cursor for context\n * - **Minimum Trigger**: Requires 3+ characters before suggesting\n * - **Position Tracking**: Ghost layer for accurate suggestion positioning\n * - **Cursor Management**: Tracks cursor position during suggestion fetch\n *\n * ## AI Integration\n * - Uses configured AI model (OpenAI, Anthropic, etc.)\n * - Sends context-aware prompts for relevant suggestions\n * - Respects temperature and model settings from configuration\n * - Handles API errors gracefully without interrupting user flow\n *\n * ## Use Cases\n * - **Content Creation**: Blog posts, articles, documentation\n * - **Code Comments**: Intelligent code documentation assistance\n * - **Email Composition**: Professional email writing assistance\n * - **Creative Writing**: Story and narrative completion\n * - **Technical Documentation**: API docs, README files\n * - **Social Media**: Post creation with engagement optimization\n *\n * @example\n * ```tsx\n * // Blog writing assistant\n * const [blogPost, setBlogPost] = useState('');\n * const [isAiEnabled, setIsAiEnabled] = useState(true);\n *\n * <div className=\"space-y-4\">\n * <div className=\"flex items-center gap-2\">\n * <Switch\n * checked={isAiEnabled}\n * onChange={setIsAiEnabled}\n * />\n * <label>AI Writing Assistant</label>\n * </div>\n *\n * <AutoCompleteTextarea\n * value={blogPost}\n * onChange={(e) => setBlogPost(e.target.value)}\n * placeholder=\"Start writing your blog post...\"\n * isActive={isAiEnabled}\n * autoSize={true}\n * maxRows={15}\n * className=\"min-h-[200px] font-serif text-lg leading-relaxed\"\n * />\n * </div>\n *\n * // Code documentation assistant\n * <AutoCompleteTextarea\n * value={docComment}\n * onChange={handleDocChange}\n * placeholder=\"/** Describe this function... *\\/\"\n * isActive={true}\n * autoSize={true}\n * maxRows={8}\n * className=\"font-mono text-sm\"\n * />\n *\n * // Email composition with templates\n * <AutoCompleteTextarea\n * defaultValue=\"Dear \"\n * placeholder=\"AI will help complete your email...\"\n * isActive={true}\n * autoSize={true}\n * maxRows={12}\n * variant={InputVariant.DEFAULT}\n * />\n * ```\n *\n * ## Accessibility\n * - Ghost layer is properly hidden from screen readers\n * - Maintains focus management during suggestion acceptance\n * - Preserves keyboard navigation patterns\n * - Respects reduced motion preferences\n */\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { mutate: autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const placeholderRef = useRef<HTMLSpanElement>(null);\n const ghostLayerRef = useRef<HTMLDivElement>(null);\n const [suggestionPosition, setSuggestionPosition] = useState<{\n left: number;\n top: number;\n } | null>(null);\n const [cursorAtFetch, setCursorAtFetch] = useState(-1);\n\n // Only update this “debouncedText” after the user stops typing for 200ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const cursor =\n textareaRef.current?.selectionStart ?? debouncedText.length;\n const before = debouncedText.slice(0, cursor);\n const after = debouncedText.slice(cursor);\n const numLines = 5;\n const beforeLines = before.split('\\n');\n const contextBeforeLines = beforeLines.slice(\n Math.max(0, beforeLines.length - numLines - 1),\n -1\n );\n const contextBefore = contextBeforeLines.join('\\n');\n const currentLine = beforeLines[beforeLines.length - 1] ?? '';\n const afterLines = after.split('\\n');\n const contextAfter = afterLines.slice(1, numLines + 1).join('\\n');\n\n autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive, autocomplete, configuration]);\n\n useEffect(() => {\n if (\n !suggestion ||\n cursorAtFetch === -1 ||\n !placeholderRef.current ||\n !ghostLayerRef.current\n ) {\n setSuggestionPosition(null);\n return;\n }\n\n const rect = placeholderRef.current.getBoundingClientRect();\n const parentRect = ghostLayerRef.current.getBoundingClientRect();\n setSuggestionPosition({\n left: rect.left - parentRect.left,\n top: rect.top - parentRect.top,\n });\n }, [suggestion, cursorAtFetch, text]);\n\n const acceptSuggestion = () => {\n const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;\n if (currentCursor !== cursorAtFetch) return;\n const newText =\n text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);\n setText(newText);\n setSuggestion('');\n setCursorAtFetch(-1);\n setTimeout(() => {\n textareaRef.current?.focus();\n const newCursorPos = currentCursor + suggestion.length;\n textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);\n }, 0);\n };\n\n return (\n <div className=\"relative w-full\">\n <div\n ref={ghostLayerRef}\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n {suggestion && cursorAtFetch !== -1 ? (\n <>\n <span className=\"align-text-top text-transparent\">\n {text.slice(0, cursorAtFetch)}\n </span>\n <span\n ref={placeholderRef}\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n >\n {suggestion}\n </span>\n <span className=\"align-text-top text-transparent\">\n {text.slice(cursorAtFetch)}\n </span>\n </>\n ) : (\n <span className=\"align-text-top text-transparent\">{text}</span>\n )}\n {suggestionProp && (\n <span className=\"text-neutral align-text-top\">{suggestionProp}</span>\n )}\n </div>\n {suggestion && suggestionPosition && (\n <div\n className=\"pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]\"\n style={{\n position: 'absolute',\n left: suggestionPosition.left,\n top: suggestionPosition.top,\n }}\n >\n {suggestion}\n </div>\n )}\n <AutoSizedTextArea\n {...props}\n ref={textareaRef}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n setSuggestion('');\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n onSelect={(e) => {\n if (\n suggestion &&\n (e.target as HTMLTextAreaElement).selectionStart !== cursorAtFetch\n ) {\n setSuggestion('');\n setCursorAtFetch(-1);\n }\n props.onSelect?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAiCO,MAAM,cAAc,CAAK,OAAU,U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,UACzB,KAAK,mBAAmB;AAAA,QAAA;AAAA,QAGzB,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGL;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,qBAAW,IAAI;AACf,kBAAQ,EAAE,OAAO,KAAK;AACtB,wBAAc,EAAE;AAChB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AAChB,cAAI,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAA;AACF,6BAAA;AAAA,UACF;AACA,gBAAM,YAAY,CAAC;AAAA,QACrB;AAAA,QACA,UAAU,CAAC,MAAM;AACf,cACE,cACC,EAAE,OAA+B,mBAAmB,eACrD;AACA,0BAAc,EAAE;AAChB,6BAAiB,EAAE;AAAA,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n variant?: InputVariant | `${InputVariant}`;\n };\n\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":["jsx","cn","inputVariants"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\n/**\n * Props for the TextArea component.\n *\n * Extends standard HTML textarea attributes with additional design system variants\n * and validation styling options.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <TextArea placeholder=\"Enter your message...\" />\n *\n * // With error validation styling\n * <TextArea\n * value={message}\n * onChange={handleChange}\n * variant={InputVariant.ERROR}\n * validationStyleEnabled={true}\n * placeholder=\"Message is required\"\n * />\n *\n * // Large multiline input\n * <TextArea\n * rows={6}\n * cols={50}\n * variant={InputVariant.DEFAULT}\n * className=\"min-h-[120px]\"\n * placeholder=\"Write a detailed description...\"\n * />\n * ```\n */\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n /** Enable validation styling based on the variant prop */\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n /** Visual variant of the textarea (default, success, error, warning, etc.) */\n variant?: InputVariant | `${InputVariant}`;\n };\n\n/**\n * TextArea Component\n *\n * A flexible textarea component that extends the standard HTML textarea with\n * design system styling variants, validation states, and consistent visual appearance.\n *\n * ## Features\n * - **Variant Support**: Multiple visual states (default, error, success, warning)\n * - **Validation Styling**: Optional validation feedback styling\n * - **Resize Control**: Disabled by default for consistent layout\n * - **Design System Integration**: Uses shared input variants for consistency\n * - **Accessibility**: Maintains all standard textarea accessibility features\n *\n * ## Use Cases\n * - Multi-line text input forms\n * - Comment and message composition\n * - Description and content fields\n * - Feedback and review forms\n * - Code snippet input (when combined with monospace styling)\n *\n * @example\n * ```tsx\n * // Basic textarea\n * <TextArea\n * placeholder=\"Enter your thoughts...\"\n * rows={4}\n * />\n *\n * // Controlled with validation\n * const [content, setContent] = useState('');\n * const hasError = content.length < 10;\n *\n * <TextArea\n * value={content}\n * onChange={(e) => setContent(e.target.value)}\n * variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}\n * validationStyleEnabled={true}\n * placeholder=\"Minimum 10 characters required\"\n * className=\"min-h-[100px]\"\n * />\n * ```\n */\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":["jsx","cn","inputVariants"],"mappings":";;;;;;;;AAkGO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACAC,qCAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;;"}
|
|
@@ -1,10 +1,84 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { DetailedHTMLProps, FC, TextareaHTMLAttributes } from 'react';
|
|
3
3
|
import { InputVariant, inputVariants } from '../Input';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the TextArea component.
|
|
6
|
+
*
|
|
7
|
+
* Extends standard HTML textarea attributes with additional design system variants
|
|
8
|
+
* and validation styling options.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // Basic usage
|
|
13
|
+
* <TextArea placeholder="Enter your message..." />
|
|
14
|
+
*
|
|
15
|
+
* // With error validation styling
|
|
16
|
+
* <TextArea
|
|
17
|
+
* value={message}
|
|
18
|
+
* onChange={handleChange}
|
|
19
|
+
* variant={InputVariant.ERROR}
|
|
20
|
+
* validationStyleEnabled={true}
|
|
21
|
+
* placeholder="Message is required"
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* // Large multiline input
|
|
25
|
+
* <TextArea
|
|
26
|
+
* rows={6}
|
|
27
|
+
* cols={50}
|
|
28
|
+
* variant={InputVariant.DEFAULT}
|
|
29
|
+
* className="min-h-[120px]"
|
|
30
|
+
* placeholder="Write a detailed description..."
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
export type TextAreaProps = DetailedHTMLProps<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, HTMLTextAreaElement> & {
|
|
35
|
+
/** Enable validation styling based on the variant prop */
|
|
5
36
|
validationStyleEnabled?: boolean;
|
|
6
37
|
} & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled' | 'variant'> & {
|
|
38
|
+
/** Visual variant of the textarea (default, success, error, warning, etc.) */
|
|
7
39
|
variant?: InputVariant | `${InputVariant}`;
|
|
8
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* TextArea Component
|
|
43
|
+
*
|
|
44
|
+
* A flexible textarea component that extends the standard HTML textarea with
|
|
45
|
+
* design system styling variants, validation states, and consistent visual appearance.
|
|
46
|
+
*
|
|
47
|
+
* ## Features
|
|
48
|
+
* - **Variant Support**: Multiple visual states (default, error, success, warning)
|
|
49
|
+
* - **Validation Styling**: Optional validation feedback styling
|
|
50
|
+
* - **Resize Control**: Disabled by default for consistent layout
|
|
51
|
+
* - **Design System Integration**: Uses shared input variants for consistency
|
|
52
|
+
* - **Accessibility**: Maintains all standard textarea accessibility features
|
|
53
|
+
*
|
|
54
|
+
* ## Use Cases
|
|
55
|
+
* - Multi-line text input forms
|
|
56
|
+
* - Comment and message composition
|
|
57
|
+
* - Description and content fields
|
|
58
|
+
* - Feedback and review forms
|
|
59
|
+
* - Code snippet input (when combined with monospace styling)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Basic textarea
|
|
64
|
+
* <TextArea
|
|
65
|
+
* placeholder="Enter your thoughts..."
|
|
66
|
+
* rows={4}
|
|
67
|
+
* />
|
|
68
|
+
*
|
|
69
|
+
* // Controlled with validation
|
|
70
|
+
* const [content, setContent] = useState('');
|
|
71
|
+
* const hasError = content.length < 10;
|
|
72
|
+
*
|
|
73
|
+
* <TextArea
|
|
74
|
+
* value={content}
|
|
75
|
+
* onChange={(e) => setContent(e.target.value)}
|
|
76
|
+
* variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}
|
|
77
|
+
* validationStyleEnabled={true}
|
|
78
|
+
* placeholder="Minimum 10 characters required"
|
|
79
|
+
* className="min-h-[100px]"
|
|
80
|
+
* />
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
9
83
|
export declare const TextArea: FC<TextAreaProps>;
|
|
10
84
|
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAC3C,iBAAiB,CACf,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,mBAAmB,CACpB,EACD,mBAAmB,CACpB,GAAG;IACF,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,IAAI,CACJ,YAAY,CAAC,OAAO,aAAa,CAAC,EAClC,wBAAwB,GAAG,SAAS,CACrC,GAAG;IACF,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,YAAY,EAAE,CAAC;CAC5C,CAAC;AAEJ,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiBtC,CAAC"}
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAC3C,iBAAiB,CACf,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,mBAAmB,CACpB,EACD,mBAAmB,CACpB,GAAG;IACF,0DAA0D;IAC1D,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,IAAI,CACJ,YAAY,CAAC,OAAO,aAAa,CAAC,EAClC,wBAAwB,GAAG,SAAS,CACrC,GAAG;IACF,8EAA8E;IAC9E,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,YAAY,EAAE,CAAC;CAC5C,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiBtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n variant?: InputVariant | `${InputVariant}`;\n };\n\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\n/**\n * Props for the TextArea component.\n *\n * Extends standard HTML textarea attributes with additional design system variants\n * and validation styling options.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <TextArea placeholder=\"Enter your message...\" />\n *\n * // With error validation styling\n * <TextArea\n * value={message}\n * onChange={handleChange}\n * variant={InputVariant.ERROR}\n * validationStyleEnabled={true}\n * placeholder=\"Message is required\"\n * />\n *\n * // Large multiline input\n * <TextArea\n * rows={6}\n * cols={50}\n * variant={InputVariant.DEFAULT}\n * className=\"min-h-[120px]\"\n * placeholder=\"Write a detailed description...\"\n * />\n * ```\n */\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n /** Enable validation styling based on the variant prop */\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n /** Visual variant of the textarea (default, success, error, warning, etc.) */\n variant?: InputVariant | `${InputVariant}`;\n };\n\n/**\n * TextArea Component\n *\n * A flexible textarea component that extends the standard HTML textarea with\n * design system styling variants, validation states, and consistent visual appearance.\n *\n * ## Features\n * - **Variant Support**: Multiple visual states (default, error, success, warning)\n * - **Validation Styling**: Optional validation feedback styling\n * - **Resize Control**: Disabled by default for consistent layout\n * - **Design System Integration**: Uses shared input variants for consistency\n * - **Accessibility**: Maintains all standard textarea accessibility features\n *\n * ## Use Cases\n * - Multi-line text input forms\n * - Comment and message composition\n * - Description and content fields\n * - Feedback and review forms\n * - Code snippet input (when combined with monospace styling)\n *\n * @example\n * ```tsx\n * // Basic textarea\n * <TextArea\n * placeholder=\"Enter your thoughts...\"\n * rows={4}\n * />\n *\n * // Controlled with validation\n * const [content, setContent] = useState('');\n * const hasError = content.length < 10;\n *\n * <TextArea\n * value={content}\n * onChange={(e) => setContent(e.target.value)}\n * variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}\n * validationStyleEnabled={true}\n * placeholder=\"Minimum 10 characters required\"\n * className=\"min-h-[100px]\"\n * />\n * ```\n */\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":[],"mappings":";;;;;;AAkGO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA,cAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;"}
|
|
@@ -41,9 +41,13 @@ const toastVariants = classVarianceAuthority.cva(
|
|
|
41
41
|
"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
42
42
|
{
|
|
43
43
|
variants: {
|
|
44
|
+
/** Toast visual variants for different message types */
|
|
44
45
|
variant: {
|
|
46
|
+
/** Error state with red styling for failures and warnings */
|
|
45
47
|
error: "bg-error/40 text-text",
|
|
48
|
+
/** Success state with green styling for confirmations */
|
|
46
49
|
success: "bg-success/30 text-text",
|
|
50
|
+
/** Default neutral styling for general information */
|
|
47
51
|
default: "bg-card/80 text-text"
|
|
48
52
|
}
|
|
49
53
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type FC, type ComponentProps, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n error: 'bg-error/40 text-text',\n success: 'bg-success/30 text-text',\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\ntype ToastProps = ComponentProps<typeof Toast>;\n\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"],"names":["ToastPrimitives","jsx","cn","cva","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgBA;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACEC,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEA,MAAM,QAGF,CAAC,EAAE,WAAW,SAAS,GAAG,YAAY;AACxC,SACEF,2BAAAA;AAAAA,IAACD,2BAAgB;AAAA,IAAhB;AAAA,MACC,WAAWE,SAAAA,GAAG,cAAc,EAAE,QAAA,CAAS,GAAG,SAAS;AAAA,MAClD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAM,cAAiE,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAAD,2BAAAA,IAACG,YAAAA,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,EAAA;AACxB;AAEF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACEH,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,mBAEF,CAAC,EAAE,WAAW,GAAG,YACnBD,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,sBAAsB,SAAS;AAAA,IAC5C,GAAG;AAAA,EAAA;AACN;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type ComponentProps, type FC, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\n/**\n * Toast variant styles using class-variance-authority.\n *\n * Defines visual styles for different toast types with semantic colors,\n * animations, and responsive behavior.\n *\n * @example\n * ```tsx\n * // Error toast with red background\n * <Toast variant=\"error\">Error message</Toast>\n *\n * // Success toast with green background\n * <Toast variant=\"success\">Success message</Toast>\n *\n * // Default toast with neutral styling\n * <Toast variant=\"default\">Info message</Toast>\n * ```\n */\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n /** Toast visual variants for different message types */\n variant: {\n /** Error state with red styling for failures and warnings */\n error: 'bg-error/40 text-text',\n /** Success state with green styling for confirmations */\n success: 'bg-success/30 text-text',\n /** Default neutral styling for general information */\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\n/**\n * Toast Component\n *\n * A notification component that displays temporary messages to users using Radix UI primitives.\n * Supports different visual variants, animations, and user interactions including swipe-to-dismiss.\n *\n * ## Features\n * - **Visual Variants**: Error, success, and default styling themes\n * - **Animations**: Smooth slide-in/slide-out transitions with fade effects\n * - **Swipe Gestures**: Touch-friendly swipe-to-dismiss functionality\n * - **Accessibility**: Full screen reader support and keyboard navigation\n * - **Positioning**: Smart positioning with responsive viewport handling\n * - **Auto-dismiss**: Configurable automatic dismissal timing\n *\n * ## Technical Implementation\n * - Built on Radix UI Toast primitives for accessibility compliance\n * - Uses Framer Motion for smooth animations and gestures\n * - CVA (class-variance-authority) for consistent styling variants\n * - Backdrop blur effects for modern visual appeal\n * - CSS transforms for hardware-accelerated animations\n *\n * @example\n * ```tsx\n * // Basic toast with title and description\n * <Toast variant=\"default\">\n * <ToastTitle>Notification</ToastTitle>\n * <ToastDescription>Your action was completed successfully.</ToastDescription>\n * <ToastClose />\n * </Toast>\n *\n * // Error toast with action button\n * <Toast variant=\"error\">\n * <ToastTitle>Upload Failed</ToastTitle>\n * <ToastDescription>Could not upload file. Please try again.</ToastDescription>\n * <ToastAction altText=\"Retry upload\">Retry</ToastAction>\n * <ToastClose />\n * </Toast>\n * ```\n */\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\n/**\n * ToastAction Component\n *\n * An interactive button component for toast notifications that allows users to take\n * actions related to the notification message.\n *\n * ## Features\n * - **Accessibility**: Requires `altText` prop for screen readers\n * - **Visual States**: Hover, focus, and disabled state styling\n * - **Theme Integration**: Supports destructive and default themes\n * - **Keyboard Navigation**: Full keyboard accessibility support\n *\n * ## Usage Guidelines\n * - Use for actionable notifications (retry, undo, view details)\n * - Keep action text short and descriptive\n * - Provide meaningful `altText` for accessibility\n * - Limit to one primary action per toast\n *\n * @example\n * ```tsx\n * // Retry action for failed operations\n * <ToastAction altText=\"Retry the failed operation\">\n * Retry\n * </ToastAction>\n *\n * // Undo action for reversible operations\n * <ToastAction altText=\"Undo the last action\">\n * Undo\n * </ToastAction>\n *\n * // Navigation action\n * <ToastAction altText=\"View the uploaded file\">\n * View File\n * </ToastAction>\n * ```\n */\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\n/**\n * ToastTitle Component\n *\n * The primary heading text for toast notifications. Provides semantic structure\n * and proper typography hierarchy within the toast.\n *\n * ## Styling Features\n * - Semi-bold font weight for emphasis\n * - Automatic text sizing adjustments for descriptions\n * - Proper spacing relationships with other toast elements\n *\n * @example\n * ```tsx\n * <ToastTitle>File Upload Complete</ToastTitle>\n * <ToastTitle>Error: Connection Failed</ToastTitle>\n * <ToastTitle>Settings Saved</ToastTitle>\n * ```\n */\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\n/**\n * ToastDescription Component\n *\n * Supporting text that provides additional context or details for the toast notification.\n * Complements the ToastTitle with more detailed information.\n *\n * ## Styling Features\n * - Slightly reduced opacity for visual hierarchy\n * - Smaller text size than title\n * - Optimal line height for readability\n *\n * ## Content Guidelines\n * - Keep descriptions concise but informative\n * - Provide actionable information when possible\n * - Use plain language for better accessibility\n *\n * @example\n * ```tsx\n * <ToastDescription>\n * Your document has been uploaded successfully and is now available for sharing.\n * </ToastDescription>\n *\n * <ToastDescription>\n * Please check your internet connection and try again.\n * </ToastDescription>\n * ```\n */\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\n/**\n * Props type for Toast component including all Radix UI Toast.Root props\n * and variant styling options.\n */\ntype ToastProps = ComponentProps<typeof Toast>;\n\n/**\n * Type for ToastAction elements used in toast configurations.\n * Ensures type safety when passing action elements to toast functions.\n */\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n Toast,\n ToastAction,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n type ToastActionElement,\n type ToastProps,\n};\n"],"names":["ToastPrimitives","jsx","cn","cva","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgBA;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACEC,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAqBF,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA,MAER,SAAS;AAAA;AAAA,QAEP,OAAO;AAAA;AAAA,QA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-1,17 +1,163 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentProps, FC, ReactElement } from 'react';
|
|
3
3
|
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
4
4
|
declare const ToastProvider: typeof ToastPrimitives;
|
|
5
5
|
declare const ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>>;
|
|
6
|
+
/**
|
|
7
|
+
* Toast variant styles using class-variance-authority.
|
|
8
|
+
*
|
|
9
|
+
* Defines visual styles for different toast types with semantic colors,
|
|
10
|
+
* animations, and responsive behavior.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Error toast with red background
|
|
15
|
+
* <Toast variant="error">Error message</Toast>
|
|
16
|
+
*
|
|
17
|
+
* // Success toast with green background
|
|
18
|
+
* <Toast variant="success">Success message</Toast>
|
|
19
|
+
*
|
|
20
|
+
* // Default toast with neutral styling
|
|
21
|
+
* <Toast variant="default">Info message</Toast>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
6
24
|
declare const toastVariants: (props?: ({
|
|
7
25
|
variant?: "default" | "error" | "success" | null | undefined;
|
|
8
26
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Toast Component
|
|
29
|
+
*
|
|
30
|
+
* A notification component that displays temporary messages to users using Radix UI primitives.
|
|
31
|
+
* Supports different visual variants, animations, and user interactions including swipe-to-dismiss.
|
|
32
|
+
*
|
|
33
|
+
* ## Features
|
|
34
|
+
* - **Visual Variants**: Error, success, and default styling themes
|
|
35
|
+
* - **Animations**: Smooth slide-in/slide-out transitions with fade effects
|
|
36
|
+
* - **Swipe Gestures**: Touch-friendly swipe-to-dismiss functionality
|
|
37
|
+
* - **Accessibility**: Full screen reader support and keyboard navigation
|
|
38
|
+
* - **Positioning**: Smart positioning with responsive viewport handling
|
|
39
|
+
* - **Auto-dismiss**: Configurable automatic dismissal timing
|
|
40
|
+
*
|
|
41
|
+
* ## Technical Implementation
|
|
42
|
+
* - Built on Radix UI Toast primitives for accessibility compliance
|
|
43
|
+
* - Uses Framer Motion for smooth animations and gestures
|
|
44
|
+
* - CVA (class-variance-authority) for consistent styling variants
|
|
45
|
+
* - Backdrop blur effects for modern visual appeal
|
|
46
|
+
* - CSS transforms for hardware-accelerated animations
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* // Basic toast with title and description
|
|
51
|
+
* <Toast variant="default">
|
|
52
|
+
* <ToastTitle>Notification</ToastTitle>
|
|
53
|
+
* <ToastDescription>Your action was completed successfully.</ToastDescription>
|
|
54
|
+
* <ToastClose />
|
|
55
|
+
* </Toast>
|
|
56
|
+
*
|
|
57
|
+
* // Error toast with action button
|
|
58
|
+
* <Toast variant="error">
|
|
59
|
+
* <ToastTitle>Upload Failed</ToastTitle>
|
|
60
|
+
* <ToastDescription>Could not upload file. Please try again.</ToastDescription>
|
|
61
|
+
* <ToastAction altText="Retry upload">Retry</ToastAction>
|
|
62
|
+
* <ToastClose />
|
|
63
|
+
* </Toast>
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
9
66
|
declare const Toast: FC<ComponentProps<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>>;
|
|
67
|
+
/**
|
|
68
|
+
* ToastAction Component
|
|
69
|
+
*
|
|
70
|
+
* An interactive button component for toast notifications that allows users to take
|
|
71
|
+
* actions related to the notification message.
|
|
72
|
+
*
|
|
73
|
+
* ## Features
|
|
74
|
+
* - **Accessibility**: Requires `altText` prop for screen readers
|
|
75
|
+
* - **Visual States**: Hover, focus, and disabled state styling
|
|
76
|
+
* - **Theme Integration**: Supports destructive and default themes
|
|
77
|
+
* - **Keyboard Navigation**: Full keyboard accessibility support
|
|
78
|
+
*
|
|
79
|
+
* ## Usage Guidelines
|
|
80
|
+
* - Use for actionable notifications (retry, undo, view details)
|
|
81
|
+
* - Keep action text short and descriptive
|
|
82
|
+
* - Provide meaningful `altText` for accessibility
|
|
83
|
+
* - Limit to one primary action per toast
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* // Retry action for failed operations
|
|
88
|
+
* <ToastAction altText="Retry the failed operation">
|
|
89
|
+
* Retry
|
|
90
|
+
* </ToastAction>
|
|
91
|
+
*
|
|
92
|
+
* // Undo action for reversible operations
|
|
93
|
+
* <ToastAction altText="Undo the last action">
|
|
94
|
+
* Undo
|
|
95
|
+
* </ToastAction>
|
|
96
|
+
*
|
|
97
|
+
* // Navigation action
|
|
98
|
+
* <ToastAction altText="View the uploaded file">
|
|
99
|
+
* View File
|
|
100
|
+
* </ToastAction>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
10
103
|
declare const ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>>;
|
|
11
104
|
declare const ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>>;
|
|
105
|
+
/**
|
|
106
|
+
* ToastTitle Component
|
|
107
|
+
*
|
|
108
|
+
* The primary heading text for toast notifications. Provides semantic structure
|
|
109
|
+
* and proper typography hierarchy within the toast.
|
|
110
|
+
*
|
|
111
|
+
* ## Styling Features
|
|
112
|
+
* - Semi-bold font weight for emphasis
|
|
113
|
+
* - Automatic text sizing adjustments for descriptions
|
|
114
|
+
* - Proper spacing relationships with other toast elements
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <ToastTitle>File Upload Complete</ToastTitle>
|
|
119
|
+
* <ToastTitle>Error: Connection Failed</ToastTitle>
|
|
120
|
+
* <ToastTitle>Settings Saved</ToastTitle>
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
12
123
|
declare const ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>>;
|
|
124
|
+
/**
|
|
125
|
+
* ToastDescription Component
|
|
126
|
+
*
|
|
127
|
+
* Supporting text that provides additional context or details for the toast notification.
|
|
128
|
+
* Complements the ToastTitle with more detailed information.
|
|
129
|
+
*
|
|
130
|
+
* ## Styling Features
|
|
131
|
+
* - Slightly reduced opacity for visual hierarchy
|
|
132
|
+
* - Smaller text size than title
|
|
133
|
+
* - Optimal line height for readability
|
|
134
|
+
*
|
|
135
|
+
* ## Content Guidelines
|
|
136
|
+
* - Keep descriptions concise but informative
|
|
137
|
+
* - Provide actionable information when possible
|
|
138
|
+
* - Use plain language for better accessibility
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <ToastDescription>
|
|
143
|
+
* Your document has been uploaded successfully and is now available for sharing.
|
|
144
|
+
* </ToastDescription>
|
|
145
|
+
*
|
|
146
|
+
* <ToastDescription>
|
|
147
|
+
* Please check your internet connection and try again.
|
|
148
|
+
* </ToastDescription>
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
13
151
|
declare const ToastDescription: FC<ComponentProps<typeof ToastPrimitives.Description>>;
|
|
152
|
+
/**
|
|
153
|
+
* Props type for Toast component including all Radix UI Toast.Root props
|
|
154
|
+
* and variant styling options.
|
|
155
|
+
*/
|
|
14
156
|
type ToastProps = ComponentProps<typeof Toast>;
|
|
157
|
+
/**
|
|
158
|
+
* Type for ToastAction elements used in toast configurations.
|
|
159
|
+
* Ensures type safety when passing action elements to toast functions.
|
|
160
|
+
*/
|
|
15
161
|
type ToastActionElement = ReactElement<typeof ToastAction>;
|
|
16
|
-
export {
|
|
162
|
+
export { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, type ToastActionElement, type ToastProps, };
|
|
17
163
|
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA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AACF;;;GAGG;AACH,KAAK,UAAU,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAE/C;;;GAGG;AACH,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,OAAO,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,UAAU,GAChB,CAAC"}
|
|
@@ -22,9 +22,13 @@ const toastVariants = cva(
|
|
|
22
22
|
"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
23
23
|
{
|
|
24
24
|
variants: {
|
|
25
|
+
/** Toast visual variants for different message types */
|
|
25
26
|
variant: {
|
|
27
|
+
/** Error state with red styling for failures and warnings */
|
|
26
28
|
error: "bg-error/40 text-text",
|
|
29
|
+
/** Success state with green styling for confirmations */
|
|
27
30
|
success: "bg-success/30 text-text",
|
|
31
|
+
/** Default neutral styling for general information */
|
|
28
32
|
default: "bg-card/80 text-text"
|
|
29
33
|
}
|
|
30
34
|
},
|