@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,42 +1,211 @@
|
|
|
1
1
|
import { LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { AnchorHTMLAttributes, DetailedHTMLProps, FC } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Visual style variants for Link component
|
|
6
|
+
*
|
|
7
|
+
* @enum {string}
|
|
8
|
+
*/
|
|
4
9
|
export declare enum LinkVariant {
|
|
10
|
+
/** Default underlined link with hover effects */
|
|
5
11
|
DEFAULT = "default",
|
|
12
|
+
/** Link without visible underline or hover effects */
|
|
6
13
|
INVISIBLE_LINK = "invisible-link",
|
|
14
|
+
/** Button-styled link with solid background */
|
|
7
15
|
BUTTON = "button",
|
|
16
|
+
/** Button-styled link with outlined border */
|
|
8
17
|
BUTTON_OUTLINED = "button-outlined",
|
|
18
|
+
/** Link with subtle hover background effect */
|
|
9
19
|
HOVERABLE = "hoverable"
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Color theme variants for Link component
|
|
23
|
+
*
|
|
24
|
+
* @enum {string}
|
|
25
|
+
*/
|
|
11
26
|
export declare enum LinkColor {
|
|
27
|
+
/** Primary brand color */
|
|
12
28
|
PRIMARY = "primary",
|
|
29
|
+
/** Secondary brand color */
|
|
13
30
|
SECONDARY = "secondary",
|
|
31
|
+
/** Destructive/danger color for critical actions */
|
|
14
32
|
DESTRUCTIVE = "destructive",
|
|
33
|
+
/** Neutral/muted color for less prominent links */
|
|
15
34
|
NEUTRAL = "neutral",
|
|
35
|
+
/** Light color for dark backgrounds */
|
|
16
36
|
LIGHT = "light",
|
|
37
|
+
/** Dark color for light backgrounds */
|
|
17
38
|
DARK = "dark",
|
|
39
|
+
/** Default text color */
|
|
18
40
|
TEXT = "text",
|
|
41
|
+
/** Inverse text color for opposite backgrounds */
|
|
19
42
|
TEXT_INVERSE = "text-inverse",
|
|
43
|
+
/** Error/red color for error states */
|
|
20
44
|
ERROR = "error",
|
|
45
|
+
/** Success/green color for positive actions */
|
|
21
46
|
SUCCESS = "success",
|
|
47
|
+
/** Custom color - no default styling applied */
|
|
22
48
|
CUSTOM = "custom"
|
|
23
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Underline style options for Link component
|
|
52
|
+
*
|
|
53
|
+
* @enum {string}
|
|
54
|
+
*/
|
|
24
55
|
export declare enum LinkUnderlined {
|
|
56
|
+
/** Default underline behavior based on variant */
|
|
25
57
|
DEFAULT = "default",
|
|
58
|
+
/** Always show underline */
|
|
26
59
|
TRUE = "true",
|
|
60
|
+
/** Never show underline */
|
|
27
61
|
FALSE = "false"
|
|
28
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Class variance authority configuration for Link component styling
|
|
65
|
+
* Defines the visual appearance based on variant, color, and underline options
|
|
66
|
+
*/
|
|
29
67
|
export declare const linkVariants: (props?: ({
|
|
30
68
|
variant?: "button" | "default" | "invisible-link" | "hoverable" | "button-outlined" | null | undefined;
|
|
31
69
|
color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "error" | "success" | "custom" | null | undefined;
|
|
32
70
|
underlined?: boolean | LinkUnderlined.DEFAULT | null | undefined;
|
|
33
71
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
72
|
+
/**
|
|
73
|
+
* Props interface for the Link component
|
|
74
|
+
*
|
|
75
|
+
* @interface LinkProps
|
|
76
|
+
* @extends {DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>}
|
|
77
|
+
* @extends {VariantProps<typeof linkVariants>}
|
|
78
|
+
*/
|
|
34
79
|
export type LinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & VariantProps<typeof linkVariants> & {
|
|
80
|
+
/**
|
|
81
|
+
* Accessible label for screen readers (required)
|
|
82
|
+
* Provides context about what the link does or where it leads
|
|
83
|
+
* @example "Navigate to home page"
|
|
84
|
+
*/
|
|
35
85
|
label: string;
|
|
86
|
+
/**
|
|
87
|
+
* Whether this link opens in a new tab/window
|
|
88
|
+
* When true, adds target="_blank" and security attributes
|
|
89
|
+
* Auto-detected for URLs starting with http/https when undefined
|
|
90
|
+
* @default undefined (auto-detect based on href)
|
|
91
|
+
*/
|
|
36
92
|
isExternalLink?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Whether this link represents the current page/active state
|
|
95
|
+
* Adds aria-current="page" for accessibility
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
37
98
|
isActive?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Locale for internationalized URLs
|
|
101
|
+
* When provided, URLs are automatically localized using Intlayer
|
|
102
|
+
* @example 'fr', 'es', 'en'
|
|
103
|
+
*/
|
|
38
104
|
locale?: LocalesValues;
|
|
39
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* Utility function to determine if a link should be treated as external
|
|
108
|
+
*
|
|
109
|
+
* @param props - Link component props containing href and isExternalLink
|
|
110
|
+
* @returns {boolean} True if the link should open externally
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* checkIsExternalLink({ href: 'https://example.com' }) // true
|
|
115
|
+
* checkIsExternalLink({ href: '/internal-page' }) // false
|
|
116
|
+
* checkIsExternalLink({ href: '/page', isExternalLink: true }) // true
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
40
119
|
export declare const checkIsExternalLink: ({ href, isExternalLink: isExternalLinkProp, }: LinkProps) => boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Link Component
|
|
122
|
+
*
|
|
123
|
+
* A versatile link component that handles both internal and external navigation
|
|
124
|
+
* with comprehensive internationalization support and multiple visual variants.
|
|
125
|
+
*
|
|
126
|
+
* ## Key Features
|
|
127
|
+
* - **Multiple Variants**: Default, invisible, button, outlined button, and hoverable styles
|
|
128
|
+
* - **Color Themes**: Comprehensive color palette for different contexts and meanings
|
|
129
|
+
* - **External Link Detection**: Automatic detection and handling of external URLs
|
|
130
|
+
* - **Internationalization**: Built-in support for localized URLs via Intlayer
|
|
131
|
+
* - **Security**: Automatic security attributes for external links (noopener, noreferrer)
|
|
132
|
+
* - **Accessibility**: Full ARIA support with proper labels and current page indication
|
|
133
|
+
* - **Visual Feedback**: Hover effects, underline options, and active states
|
|
134
|
+
*
|
|
135
|
+
* ## Use Cases
|
|
136
|
+
* - Navigation within applications (internal links)
|
|
137
|
+
* - External links to other websites with security measures
|
|
138
|
+
* - Button-styled links for call-to-action scenarios
|
|
139
|
+
* - Subtle hoverable links for navigation menus
|
|
140
|
+
* - Multi-language website navigation with automatic URL localization
|
|
141
|
+
*
|
|
142
|
+
* ## Security Features
|
|
143
|
+
* External links automatically receive security attributes:
|
|
144
|
+
* - `rel="noopener noreferrer nofollow"` - Prevents security vulnerabilities
|
|
145
|
+
* - `target="_blank"` - Opens in new tab/window
|
|
146
|
+
* - External link icon indication for user clarity
|
|
147
|
+
*
|
|
148
|
+
* ## Internationalization
|
|
149
|
+
* When used with Intlayer, the component automatically:
|
|
150
|
+
* - Localizes internal URLs based on the current or specified locale
|
|
151
|
+
* - Sets appropriate `hrefLang` attributes for SEO
|
|
152
|
+
* - Maintains proper URL structure for multi-language sites
|
|
153
|
+
*
|
|
154
|
+
* @component
|
|
155
|
+
* @example
|
|
156
|
+
* ```tsx
|
|
157
|
+
* // Basic internal link
|
|
158
|
+
* <Link href="/about" label="Go to about page">
|
|
159
|
+
* About Us
|
|
160
|
+
* </Link>
|
|
161
|
+
*
|
|
162
|
+
* // External link with auto-detection
|
|
163
|
+
* <Link href="https://example.com" label="Visit external site">
|
|
164
|
+
* External Site
|
|
165
|
+
* </Link>
|
|
166
|
+
*
|
|
167
|
+
* // Button-styled link
|
|
168
|
+
* <Link
|
|
169
|
+
* href="/signup"
|
|
170
|
+
* variant={LinkVariant.BUTTON}
|
|
171
|
+
* color={LinkColor.PRIMARY}
|
|
172
|
+
* label="Sign up for account"
|
|
173
|
+
* >
|
|
174
|
+
* Get Started
|
|
175
|
+
* </Link>
|
|
176
|
+
*
|
|
177
|
+
* // Localized link
|
|
178
|
+
* <Link
|
|
179
|
+
* href="/products"
|
|
180
|
+
* locale="fr"
|
|
181
|
+
* label="Voir les produits"
|
|
182
|
+
* >
|
|
183
|
+
* Produits
|
|
184
|
+
* </Link>
|
|
185
|
+
*
|
|
186
|
+
* // Active navigation link
|
|
187
|
+
* <Link
|
|
188
|
+
* href="/dashboard"
|
|
189
|
+
* isActive={true}
|
|
190
|
+
* variant={LinkVariant.HOVERABLE}
|
|
191
|
+
* label="Current page: Dashboard"
|
|
192
|
+
* >
|
|
193
|
+
* Dashboard
|
|
194
|
+
* </Link>
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* @param props - Link component props
|
|
198
|
+
* @param props.children - Content to display inside the link
|
|
199
|
+
* @param props.href - URL or path to navigate to
|
|
200
|
+
* @param props.label - Accessible label describing the link's purpose
|
|
201
|
+
* @param props.variant - Visual style variant
|
|
202
|
+
* @param props.color - Color theme for the link
|
|
203
|
+
* @param props.underlined - Underline visibility option
|
|
204
|
+
* @param props.isExternalLink - Override external link detection
|
|
205
|
+
* @param props.isActive - Whether this link represents the current page
|
|
206
|
+
* @param props.locale - Locale for URL internationalization
|
|
207
|
+
* @param props.className - Additional CSS classes
|
|
208
|
+
* @returns Accessible and internationalized link component
|
|
209
|
+
*/
|
|
41
210
|
export declare const Link: FC<LinkProps>;
|
|
42
211
|
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAGf,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,cAAc,mBAAmB;IACjC,MAAM,WAAW;IACjB,eAAe,oBAAoB;IACnC,SAAS,cAAc;CACxB;AAED,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,YAAY;;;;8EA0CxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,iBAAiB,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,iBAAiB,CAClB,GACC,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAGf;;;;GAIG;AACH,oBAAY,WAAW;IACrB,iDAAiD;IACjD,OAAO,YAAY;IACnB,sDAAsD;IACtD,cAAc,mBAAmB;IACjC,+CAA+C;IAC/C,MAAM,WAAW;IACjB,8CAA8C;IAC9C,eAAe,oBAAoB;IACnC,+CAA+C;IAC/C,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,oBAAY,SAAS;IACnB,0BAA0B;IAC1B,OAAO,YAAY;IACnB,4BAA4B;IAC5B,SAAS,cAAc;IACvB,oDAAoD;IACpD,WAAW,gBAAgB;IAC3B,mDAAmD;IACnD,OAAO,YAAY;IACnB,uCAAuC;IACvC,KAAK,UAAU;IACf,uCAAuC;IACvC,IAAI,SAAS;IACb,yBAAyB;IACzB,IAAI,SAAS;IACb,kDAAkD;IAClD,YAAY,iBAAiB;IAC7B,uCAAuC;IACvC,KAAK,UAAU;IACf,+CAA+C;IAC/C,OAAO,YAAY;IACnB,gDAAgD;IAChD,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,oBAAY,cAAc;IACxB,kDAAkD;IAClD,OAAO,YAAY;IACnB,4BAA4B;IAC5B,IAAI,SAAS;IACb,2BAA2B;IAC3B,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;8EA0CxB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,iBAAiB,CAClB,GACC,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,+CAGjC,SAAS,KAAG,OASd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA0D9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { getLocalizedUrl } from '@intlayer/core';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ExternalLink } from 'lucide-react';\nimport {\n type AnchorHTMLAttributes,\n type DetailedHTMLProps,\n type FC,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nexport enum LinkVariant {\n DEFAULT = 'default',\n INVISIBLE_LINK = 'invisible-link',\n BUTTON = 'button',\n BUTTON_OUTLINED = 'button-outlined',\n HOVERABLE = 'hoverable',\n}\n\nexport enum LinkColor {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n DESTRUCTIVE = 'destructive',\n NEUTRAL = 'neutral',\n LIGHT = 'light',\n DARK = 'dark',\n TEXT = 'text',\n TEXT_INVERSE = 'text-inverse',\n ERROR = 'error',\n SUCCESS = 'success',\n CUSTOM = 'custom',\n}\n\nexport enum LinkUnderlined {\n DEFAULT = 'default',\n TRUE = 'true',\n FALSE = 'false',\n}\n\nexport const linkVariants = cva(\n 'gap-3 transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n [`${LinkVariant.DEFAULT}`]:\n 'h-auto justify-start border-inherit bg-current/0 px-1 underline-offset-4 hover:bg-current/0 hover:underline',\n [`${LinkVariant.INVISIBLE_LINK}`]:\n 'h-auto justify-start border-inherit bg-current/0 px-1 underline-offset-4 hover:bg-current/0',\n [`${LinkVariant.BUTTON}`]:\n 'rounded-lg bg-current *:text-text-opposite min-h-8 px-6 max-md:py-2 text-sm flex items-center justify-center gap-2 whitespace-nowrap font-medium transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n [`${LinkVariant.BUTTON_OUTLINED}`]:\n 'rounded-lg border-[1.5px] hover:bg-current/30 min-h-8 px-6 max-md:py-2 text-sm flex items-center justify-center gap-2 whitespace-nowrap font-medium transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n [`${LinkVariant.HOVERABLE}`]:\n 'block rounded-lg border-none bg-current/0 transition hover:bg-current/20 aria-[current]:bg-current/5',\n },\n color: {\n [`${LinkColor.PRIMARY}`]: 'text-primary',\n [`${LinkColor.SECONDARY}`]: 'text-secondary',\n [`${LinkColor.DESTRUCTIVE}`]: 'text-destructive',\n [`${LinkColor.NEUTRAL}`]: 'text-neutral',\n [`${LinkColor.LIGHT}`]: 'text-white',\n [`${LinkColor.DARK}`]: 'text-neutral-800',\n [`${LinkColor.TEXT}`]: 'text-text',\n [`${LinkColor.TEXT_INVERSE}`]: 'text-text-opposite',\n [`${LinkColor.ERROR}`]: 'text-error',\n [`${LinkColor.SUCCESS}`]: 'text-success',\n [`${LinkColor.CUSTOM}`]: '',\n },\n underlined: {\n [LinkUnderlined.DEFAULT]: '',\n [LinkUnderlined.TRUE]: 'underline',\n [LinkUnderlined.FALSE]: 'no-underline',\n },\n },\n\n defaultVariants: {\n variant: LinkVariant.DEFAULT,\n color: LinkColor.PRIMARY,\n underlined: LinkUnderlined.DEFAULT,\n },\n }\n);\n\nexport type LinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> &\n VariantProps<typeof linkVariants> & {\n label: string;\n isExternalLink?: boolean;\n isActive?: boolean;\n locale?: LocalesValues;\n };\n\nexport const checkIsExternalLink = ({\n href,\n isExternalLink: isExternalLinkProp,\n}: LinkProps): boolean => {\n const isValidHref = typeof href === 'string' && href.trim() !== '';\n const isExternalLink =\n isExternalLinkProp === true ||\n (typeof isExternalLinkProp === 'undefined' &&\n isValidHref &&\n /^https?:\\/\\//.test(href));\n\n return isExternalLink;\n};\n\nexport const Link: FC<LinkProps> = (props) => {\n const {\n variant = LinkVariant.DEFAULT,\n color = LinkColor.PRIMARY,\n children,\n label,\n className,\n isActive,\n underlined,\n locale,\n isExternalLink: isExternalLinkProp,\n href: hrefProp,\n ...otherProps\n } = props;\n const { internationalization } = configuration;\n\n const isExternalLink = checkIsExternalLink(props);\n const isChildrenString = typeof children === 'string';\n\n const rel = isExternalLink ? 'noopener noreferrer nofollow' : undefined;\n\n const target = isExternalLink ? '_blank' : '_self';\n\n const hrefLang = locale\n ? locale === internationalization.defaultLocale\n ? 'x-default'\n : locale\n : undefined;\n\n const href =\n locale && hrefProp && !isExternalLink\n ? getLocalizedUrl(hrefProp, locale)\n : hrefProp;\n\n return (\n <a\n href={href}\n hrefLang={hrefLang}\n aria-label={label}\n rel={rel}\n target={target}\n aria-current={isActive ? 'page' : undefined}\n className={cn(\n linkVariants({\n variant,\n color,\n underlined,\n className,\n })\n )}\n {...otherProps}\n >\n {variant === 'button' ? <span>{children}</span> : children}\n {isExternalLink && isChildrenString && (\n <ExternalLink className=\"ml-2 inline-block size-4\" />\n )}\n </a>\n );\n};\n"],"names":["LinkVariant","LinkColor","LinkUnderlined"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Link.mjs","sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { getLocalizedUrl } from '@intlayer/core';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ExternalLink } from 'lucide-react';\nimport {\n type AnchorHTMLAttributes,\n type DetailedHTMLProps,\n type FC,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Visual style variants for Link component\n *\n * @enum {string}\n */\nexport enum LinkVariant {\n /** Default underlined link with hover effects */\n DEFAULT = 'default',\n /** Link without visible underline or hover effects */\n INVISIBLE_LINK = 'invisible-link',\n /** Button-styled link with solid background */\n BUTTON = 'button',\n /** Button-styled link with outlined border */\n BUTTON_OUTLINED = 'button-outlined',\n /** Link with subtle hover background effect */\n HOVERABLE = 'hoverable',\n}\n\n/**\n * Color theme variants for Link component\n *\n * @enum {string}\n */\nexport enum LinkColor {\n /** Primary brand color */\n PRIMARY = 'primary',\n /** Secondary brand color */\n SECONDARY = 'secondary',\n /** Destructive/danger color for critical actions */\n DESTRUCTIVE = 'destructive',\n /** Neutral/muted color for less prominent links */\n NEUTRAL = 'neutral',\n /** Light color for dark backgrounds */\n LIGHT = 'light',\n /** Dark color for light backgrounds */\n DARK = 'dark',\n /** Default text color */\n TEXT = 'text',\n /** Inverse text color for opposite backgrounds */\n TEXT_INVERSE = 'text-inverse',\n /** Error/red color for error states */\n ERROR = 'error',\n /** Success/green color for positive actions */\n SUCCESS = 'success',\n /** Custom color - no default styling applied */\n CUSTOM = 'custom',\n}\n\n/**\n * Underline style options for Link component\n *\n * @enum {string}\n */\nexport enum LinkUnderlined {\n /** Default underline behavior based on variant */\n DEFAULT = 'default',\n /** Always show underline */\n TRUE = 'true',\n /** Never show underline */\n FALSE = 'false',\n}\n\n/**\n * Class variance authority configuration for Link component styling\n * Defines the visual appearance based on variant, color, and underline options\n */\nexport const linkVariants = cva(\n 'gap-3 transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n [`${LinkVariant.DEFAULT}`]:\n 'h-auto justify-start border-inherit bg-current/0 px-1 underline-offset-4 hover:bg-current/0 hover:underline',\n [`${LinkVariant.INVISIBLE_LINK}`]:\n 'h-auto justify-start border-inherit bg-current/0 px-1 underline-offset-4 hover:bg-current/0',\n [`${LinkVariant.BUTTON}`]:\n 'rounded-lg bg-current *:text-text-opposite min-h-8 px-6 max-md:py-2 text-sm flex items-center justify-center gap-2 whitespace-nowrap font-medium transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n [`${LinkVariant.BUTTON_OUTLINED}`]:\n 'rounded-lg border-[1.5px] hover:bg-current/30 min-h-8 px-6 max-md:py-2 text-sm flex items-center justify-center gap-2 whitespace-nowrap font-medium transition focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50',\n [`${LinkVariant.HOVERABLE}`]:\n 'block rounded-lg border-none bg-current/0 transition hover:bg-current/20 aria-[current]:bg-current/5',\n },\n color: {\n [`${LinkColor.PRIMARY}`]: 'text-primary',\n [`${LinkColor.SECONDARY}`]: 'text-secondary',\n [`${LinkColor.DESTRUCTIVE}`]: 'text-destructive',\n [`${LinkColor.NEUTRAL}`]: 'text-neutral',\n [`${LinkColor.LIGHT}`]: 'text-white',\n [`${LinkColor.DARK}`]: 'text-neutral-800',\n [`${LinkColor.TEXT}`]: 'text-text',\n [`${LinkColor.TEXT_INVERSE}`]: 'text-text-opposite',\n [`${LinkColor.ERROR}`]: 'text-error',\n [`${LinkColor.SUCCESS}`]: 'text-success',\n [`${LinkColor.CUSTOM}`]: '',\n },\n underlined: {\n [LinkUnderlined.DEFAULT]: '',\n [LinkUnderlined.TRUE]: 'underline',\n [LinkUnderlined.FALSE]: 'no-underline',\n },\n },\n\n defaultVariants: {\n variant: LinkVariant.DEFAULT,\n color: LinkColor.PRIMARY,\n underlined: LinkUnderlined.DEFAULT,\n },\n }\n);\n\n/**\n * Props interface for the Link component\n *\n * @interface LinkProps\n * @extends {DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>}\n * @extends {VariantProps<typeof linkVariants>}\n */\nexport type LinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> &\n VariantProps<typeof linkVariants> & {\n /**\n * Accessible label for screen readers (required)\n * Provides context about what the link does or where it leads\n * @example \"Navigate to home page\"\n */\n label: string;\n\n /**\n * Whether this link opens in a new tab/window\n * When true, adds target=\"_blank\" and security attributes\n * Auto-detected for URLs starting with http/https when undefined\n * @default undefined (auto-detect based on href)\n */\n isExternalLink?: boolean;\n\n /**\n * Whether this link represents the current page/active state\n * Adds aria-current=\"page\" for accessibility\n * @default false\n */\n isActive?: boolean;\n\n /**\n * Locale for internationalized URLs\n * When provided, URLs are automatically localized using Intlayer\n * @example 'fr', 'es', 'en'\n */\n locale?: LocalesValues;\n };\n\n/**\n * Utility function to determine if a link should be treated as external\n *\n * @param props - Link component props containing href and isExternalLink\n * @returns {boolean} True if the link should open externally\n *\n * @example\n * ```tsx\n * checkIsExternalLink({ href: 'https://example.com' }) // true\n * checkIsExternalLink({ href: '/internal-page' }) // false\n * checkIsExternalLink({ href: '/page', isExternalLink: true }) // true\n * ```\n */\nexport const checkIsExternalLink = ({\n href,\n isExternalLink: isExternalLinkProp,\n}: LinkProps): boolean => {\n const isValidHref = typeof href === 'string' && href.trim() !== '';\n const isExternalLink =\n isExternalLinkProp === true ||\n (typeof isExternalLinkProp === 'undefined' &&\n isValidHref &&\n /^https?:\\/\\//.test(href));\n\n return isExternalLink;\n};\n\n/**\n * Link Component\n *\n * A versatile link component that handles both internal and external navigation\n * with comprehensive internationalization support and multiple visual variants.\n *\n * ## Key Features\n * - **Multiple Variants**: Default, invisible, button, outlined button, and hoverable styles\n * - **Color Themes**: Comprehensive color palette for different contexts and meanings\n * - **External Link Detection**: Automatic detection and handling of external URLs\n * - **Internationalization**: Built-in support for localized URLs via Intlayer\n * - **Security**: Automatic security attributes for external links (noopener, noreferrer)\n * - **Accessibility**: Full ARIA support with proper labels and current page indication\n * - **Visual Feedback**: Hover effects, underline options, and active states\n *\n * ## Use Cases\n * - Navigation within applications (internal links)\n * - External links to other websites with security measures\n * - Button-styled links for call-to-action scenarios\n * - Subtle hoverable links for navigation menus\n * - Multi-language website navigation with automatic URL localization\n *\n * ## Security Features\n * External links automatically receive security attributes:\n * - `rel=\"noopener noreferrer nofollow\"` - Prevents security vulnerabilities\n * - `target=\"_blank\"` - Opens in new tab/window\n * - External link icon indication for user clarity\n *\n * ## Internationalization\n * When used with Intlayer, the component automatically:\n * - Localizes internal URLs based on the current or specified locale\n * - Sets appropriate `hrefLang` attributes for SEO\n * - Maintains proper URL structure for multi-language sites\n *\n * @component\n * @example\n * ```tsx\n * // Basic internal link\n * <Link href=\"/about\" label=\"Go to about page\">\n * About Us\n * </Link>\n *\n * // External link with auto-detection\n * <Link href=\"https://example.com\" label=\"Visit external site\">\n * External Site\n * </Link>\n *\n * // Button-styled link\n * <Link\n * href=\"/signup\"\n * variant={LinkVariant.BUTTON}\n * color={LinkColor.PRIMARY}\n * label=\"Sign up for account\"\n * >\n * Get Started\n * </Link>\n *\n * // Localized link\n * <Link\n * href=\"/products\"\n * locale=\"fr\"\n * label=\"Voir les produits\"\n * >\n * Produits\n * </Link>\n *\n * // Active navigation link\n * <Link\n * href=\"/dashboard\"\n * isActive={true}\n * variant={LinkVariant.HOVERABLE}\n * label=\"Current page: Dashboard\"\n * >\n * Dashboard\n * </Link>\n * ```\n *\n * @param props - Link component props\n * @param props.children - Content to display inside the link\n * @param props.href - URL or path to navigate to\n * @param props.label - Accessible label describing the link's purpose\n * @param props.variant - Visual style variant\n * @param props.color - Color theme for the link\n * @param props.underlined - Underline visibility option\n * @param props.isExternalLink - Override external link detection\n * @param props.isActive - Whether this link represents the current page\n * @param props.locale - Locale for URL internationalization\n * @param props.className - Additional CSS classes\n * @returns Accessible and internationalized link component\n */\nexport const Link: FC<LinkProps> = (props) => {\n const {\n variant = LinkVariant.DEFAULT,\n color = LinkColor.PRIMARY,\n children,\n label,\n className,\n isActive,\n underlined,\n locale,\n isExternalLink: isExternalLinkProp,\n href: hrefProp,\n ...otherProps\n } = props;\n const { internationalization } = configuration;\n\n const isExternalLink = checkIsExternalLink(props);\n const isChildrenString = typeof children === 'string';\n\n const rel = isExternalLink ? 'noopener noreferrer nofollow' : undefined;\n\n const target = isExternalLink ? '_blank' : '_self';\n\n const hrefLang = locale\n ? locale === internationalization.defaultLocale\n ? 'x-default'\n : locale\n : undefined;\n\n const href =\n locale && hrefProp && !isExternalLink\n ? getLocalizedUrl(hrefProp, locale)\n : hrefProp;\n\n return (\n <a\n href={href}\n hrefLang={hrefLang}\n aria-label={label}\n rel={rel}\n target={target}\n aria-current={isActive ? 'page' : undefined}\n className={cn(\n linkVariants({\n variant,\n color,\n underlined,\n className,\n })\n )}\n {...otherProps}\n >\n {variant === 'button' ? <span>{children}</span> : children}\n {isExternalLink && isChildrenString && (\n <ExternalLink className=\"ml-2 inline-block size-4\" />\n )}\n </a>\n );\n};\n"],"names":["LinkVariant","LinkColor","LinkUnderlined"],"mappings":";;;;;;AAiBO,IAAK,gCAAAA,iBAAL;AAELA,eAAA,SAAA,IAAU;AAEVA,eAAA,gBAAA,IAAiB;AAEjBA,eAAA,QAAA,IAAS;AAETA,eAAA,iBAAA,IAAkB;AAElBA,eAAA,WAAA,IAAY;AAVF,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAkBL,IAAK,8BAAAC,eAAL;AAELA,aAAA,SAAA,IAAU;AAEVA,aAAA,WAAA,IAAY;AAEZA,aAAA,aAAA,IAAc;AAEdA,aAAA,SAAA,IAAU;AAEVA,aAAA,OAAA,IAAQ;AAERA,aAAA,MAAA,IAAO;AAEPA,aAAA,MAAA,IAAO;AAEPA,aAAA,cAAA,IAAe;AAEfA,aAAA,OAAA,IAAQ;AAERA,aAAA,SAAA,IAAU;AAEVA,aAAA,QAAA,IAAS;AAtBC,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AA8BL,IAAK,mCAAAC,oBAAL;AAELA,kBAAA,SAAA,IAAU;AAEVA,kBAAA,MAAA,IAAO;AAEPA,kBAAA,OAAA,IAAQ;AANE,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAaL,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,CAAC,GAAG,SAAA,EAAqB,GACvB;AAAA,QACF,CAAC,GAAG,gBAAA,EAA4B,GAC9B;AAAA,QACF,CAAC,GAAG,QAAA,EAAoB,GACtB;AAAA,QACF,CAAC,GAAG,iBAAA,EAA6B,GAC/B;AAAA,QACF,CAAC,GAAG,WAAA,EAAuB,GACzB;AAAA,MAAA;AAAA,MAEJ,OAAO;AAAA,QACL,CAAC,GAAG,SAAA,EAAmB,GAAG;AAAA,QAC1B,CAAC,GAAG,WAAA,EAAqB,GAAG;AAAA,QAC5B,CAAC,GAAG,aAAA,EAAuB,GAAG;AAAA,QAC9B,CAAC,GAAG,SAAA,EAAmB,GAAG;AAAA,QAC1B,CAAC,GAAG,OAAA,EAAiB,GAAG;AAAA,QACxB,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,QACvB,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,QACvB,CAAC,GAAG,cAAA,EAAwB,GAAG;AAAA,QAC/B,CAAC,GAAG,OAAA,EAAiB,GAAG;AAAA,QACxB,CAAC,GAAG,SAAA,EAAmB,GAAG;AAAA,QAC1B,CAAC,GAAG,QAAA,EAAkB,GAAG;AAAA,MAAA;AAAA,MAE3B,YAAY;AAAA,QACV;AAAA,UAAC;AAAA;AAAA,WAAyB;AAAA,QAC1B;AAAA,UAAC;AAAA;AAAA,WAAsB;AAAA,QACvB;AAAA,UAAC;AAAA;AAAA,WAAuB;AAAA,MAAA;AAAA,IAC1B;AAAA,IAGF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,OAAO;AAAA,MACP,YAAY;AAAA;AAAA,IAAA;AAAA,EACd;AAEJ;AAyDO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA,gBAAgB;AAClB,MAA0B;AACxB,QAAM,cAAc,OAAO,SAAS,YAAY,KAAK,WAAW;AAChE,QAAM,iBACJ,uBAAuB,QACtB,OAAO,uBAAuB,eAC7B,eACA,eAAe,KAAK,IAAI;AAE5B,SAAO;AACT;AA4FO,MAAM,OAAsB,CAAC,UAAU;AAC5C,QAAM;AAAA,IACJ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,MAAM;AAAA,IACN,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,EAAE,yBAAyB;AAEjC,QAAM,iBAAiB,oBAAoB,KAAK;AAChD,QAAM,mBAAmB,OAAO,aAAa;AAE7C,QAAM,MAAM,iBAAiB,iCAAiC;AAE9D,QAAM,SAAS,iBAAiB,WAAW;AAE3C,QAAM,WAAW,SACb,WAAW,qBAAqB,gBAC9B,cACA,SACF;AAEJ,QAAM,OACJ,UAAU,YAAY,CAAC,iBACnB,gBAAgB,UAAU,MAAM,IAChC;AAEN,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,gBAAc,WAAW,SAAS;AAAA,MAClC,WAAW;AAAA,QACT,aAAa;AAAA,UACX;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,MAAA;AAAA,MAEF,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA,YAAY,WAAW,oBAAC,QAAA,EAAM,SAAA,CAAS,IAAU;AAAA,QACjD,kBAAkB,oBACjB,oBAAC,cAAA,EAAa,WAAU,2BAAA,CAA2B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAI3D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Loader/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from './spinner';\n\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n isLoading?: boolean;\n};\n\n/**\n *\n *
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Loader/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from './spinner';\n\n/**\n * Props for the Loader component\n */\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n /** Controls whether the loading spinner is displayed. Defaults to true when undefined */\n isLoading?: boolean;\n};\n\n/**\n * Loader Component\n *\n * A versatile loading component that can function as both a standalone loader\n * and a wrapper for content. When loading is true, displays an animated spinner.\n * When loading is false, renders the wrapped content.\n *\n * @component\n * @example\n * Standalone usage:\n * ```tsx\n * <Loader isLoading={true} />\n * ```\n *\n * @example\n * As a content wrapper:\n * ```tsx\n * <Loader isLoading={isDataLoading}>\n * <div>Your content here</div>\n * </Loader>\n * ```\n *\n * @example\n * Default behavior (loading = true):\n * ```tsx\n * <Loader />\n * ```\n *\n * @example\n * With custom styling:\n * ```tsx\n * <Loader\n * isLoading={true}\n * className=\"min-h-[200px] bg-gray-50\"\n * aria-label=\"Loading user data\"\n * />\n * ```\n *\n * @example\n * Conditional content loading:\n * ```tsx\n * <Loader isLoading={!data}>\n * {data && (\n * <div>\n * <h2>{data.title}</h2>\n * <p>{data.content}</p>\n * </div>\n * )}\n * </Loader>\n * ```\n *\n * Features:\n * - Dual-mode operation: standalone spinner or content wrapper\n * - Responsive design with flexible sizing\n * - Accessible with proper ARIA attributes and role\n * - Smooth animated spinner using SVG\n * - Customizable styling through className prop\n * - Supports all standard HTML div attributes\n * - Screen constraints (max-height/width) to prevent overflow\n * - Internationalization ready with aria-label support\n *\n * Accessibility:\n * - Uses role=\"status\" for screen reader announcements\n * - Includes descriptive aria-label for the loading state\n * - Maintains focus management when transitioning between states\n * - Supports custom aria-label through props for specific contexts\n * - Compatible with keyboard navigation patterns\n *\n * Performance:\n * - Lightweight SVG spinner with CSS animations\n * - Conditional rendering prevents unnecessary DOM updates\n * - Optimized for frequent loading state changes\n * - No external dependencies beyond internal utilities\n *\n * @param props - Component props extending HTML div attributes\n * @param props.children - Content to display when not loading\n * @param props.isLoading - Loading state control (defaults to true)\n * @param props.className - Additional CSS classes for the loader container\n * @param props.role - ARIA role (defaults to \"status\")\n * @param props.aria-label - Custom accessibility label\n * @param props.id - Unique identifier for the loader\n * @param props.style - Inline styles object\n * @param props.data-* - Data attributes for testing or tracking\n * @param props...rest - All other standard HTML div attributes\n *\n * @returns A loading spinner when isLoading is true, otherwise renders children\n */\nexport const Loader: FC<LoaderProps> = ({\n children,\n isLoading = true,\n className,\n ...props\n}) => (\n <>\n {isLoading ? (\n <div\n className={cn(\n 'flex size-full max-h-screen max-w-[100vw] flex-1 items-center justify-center',\n className\n )}\n role=\"status\"\n aria-label=\"Animated icon, meaning that the website is processing\"\n {...props}\n >\n <Spinner className=\"size-10 max-h-full max-w-full\" />\n </div>\n ) : (\n (children ?? <></>)\n )}\n </>\n);\n"],"names":["jsx","cn","Spinner"],"mappings":";;;;;AAmGO,MAAM,SAA0B,CAAC;AAAA,EACtC;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,4DAEK,UAAA,YACCA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACL,cAAW;AAAA,IACV,GAAG;AAAA,IAEJ,UAAAD,2BAAAA,IAACE,0BAAAA,SAAA,EAAQ,WAAU,gCAAA,CAAgC;AAAA,EAAA;AACrD,IAEC,kEAAc,EAAA,CAEnB;;"}
|
|
@@ -1,26 +1,97 @@
|
|
|
1
1
|
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Loader component
|
|
4
|
+
*/
|
|
2
5
|
export type LoaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
/** Controls whether the loading spinner is displayed. Defaults to true when undefined */
|
|
3
7
|
isLoading?: boolean;
|
|
4
8
|
};
|
|
5
9
|
/**
|
|
10
|
+
* Loader Component
|
|
6
11
|
*
|
|
7
|
-
*
|
|
12
|
+
* A versatile loading component that can function as both a standalone loader
|
|
13
|
+
* and a wrapper for content. When loading is true, displays an animated spinner.
|
|
14
|
+
* When loading is false, renders the wrapped content.
|
|
8
15
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
16
|
+
* @component
|
|
17
|
+
* @example
|
|
18
|
+
* Standalone usage:
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Loader isLoading={true} />
|
|
14
21
|
* ```
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* As a content wrapper:
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Loader isLoading={isDataLoading}>
|
|
27
|
+
* <div>Your content here</div>
|
|
28
|
+
* </Loader>
|
|
18
29
|
* ```
|
|
19
30
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
31
|
+
* @example
|
|
32
|
+
* Default behavior (loading = true):
|
|
33
|
+
* ```tsx
|
|
22
34
|
* <Loader />
|
|
23
35
|
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* With custom styling:
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Loader
|
|
41
|
+
* isLoading={true}
|
|
42
|
+
* className="min-h-[200px] bg-gray-50"
|
|
43
|
+
* aria-label="Loading user data"
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* Conditional content loading:
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Loader isLoading={!data}>
|
|
51
|
+
* {data && (
|
|
52
|
+
* <div>
|
|
53
|
+
* <h2>{data.title}</h2>
|
|
54
|
+
* <p>{data.content}</p>
|
|
55
|
+
* </div>
|
|
56
|
+
* )}
|
|
57
|
+
* </Loader>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Features:
|
|
61
|
+
* - Dual-mode operation: standalone spinner or content wrapper
|
|
62
|
+
* - Responsive design with flexible sizing
|
|
63
|
+
* - Accessible with proper ARIA attributes and role
|
|
64
|
+
* - Smooth animated spinner using SVG
|
|
65
|
+
* - Customizable styling through className prop
|
|
66
|
+
* - Supports all standard HTML div attributes
|
|
67
|
+
* - Screen constraints (max-height/width) to prevent overflow
|
|
68
|
+
* - Internationalization ready with aria-label support
|
|
69
|
+
*
|
|
70
|
+
* Accessibility:
|
|
71
|
+
* - Uses role="status" for screen reader announcements
|
|
72
|
+
* - Includes descriptive aria-label for the loading state
|
|
73
|
+
* - Maintains focus management when transitioning between states
|
|
74
|
+
* - Supports custom aria-label through props for specific contexts
|
|
75
|
+
* - Compatible with keyboard navigation patterns
|
|
76
|
+
*
|
|
77
|
+
* Performance:
|
|
78
|
+
* - Lightweight SVG spinner with CSS animations
|
|
79
|
+
* - Conditional rendering prevents unnecessary DOM updates
|
|
80
|
+
* - Optimized for frequent loading state changes
|
|
81
|
+
* - No external dependencies beyond internal utilities
|
|
82
|
+
*
|
|
83
|
+
* @param props - Component props extending HTML div attributes
|
|
84
|
+
* @param props.children - Content to display when not loading
|
|
85
|
+
* @param props.isLoading - Loading state control (defaults to true)
|
|
86
|
+
* @param props.className - Additional CSS classes for the loader container
|
|
87
|
+
* @param props.role - ARIA role (defaults to "status")
|
|
88
|
+
* @param props.aria-label - Custom accessibility label
|
|
89
|
+
* @param props.id - Unique identifier for the loader
|
|
90
|
+
* @param props.style - Inline styles object
|
|
91
|
+
* @param props.data-* - Data attributes for testing or tracking
|
|
92
|
+
* @param props...rest - All other standard HTML div attributes
|
|
93
|
+
*
|
|
94
|
+
* @returns A loading spinner when isLoading is true, otherwise renders children
|
|
24
95
|
*/
|
|
25
96
|
export declare const Loader: FC<LoaderProps>;
|
|
26
97
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIhD,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIhD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACzD,yFAAyF;IACzF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAuBlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Loader/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from './spinner';\n\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n isLoading?: boolean;\n};\n\n/**\n *\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Loader/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from './spinner';\n\n/**\n * Props for the Loader component\n */\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n /** Controls whether the loading spinner is displayed. Defaults to true when undefined */\n isLoading?: boolean;\n};\n\n/**\n * Loader Component\n *\n * A versatile loading component that can function as both a standalone loader\n * and a wrapper for content. When loading is true, displays an animated spinner.\n * When loading is false, renders the wrapped content.\n *\n * @component\n * @example\n * Standalone usage:\n * ```tsx\n * <Loader isLoading={true} />\n * ```\n *\n * @example\n * As a content wrapper:\n * ```tsx\n * <Loader isLoading={isDataLoading}>\n * <div>Your content here</div>\n * </Loader>\n * ```\n *\n * @example\n * Default behavior (loading = true):\n * ```tsx\n * <Loader />\n * ```\n *\n * @example\n * With custom styling:\n * ```tsx\n * <Loader\n * isLoading={true}\n * className=\"min-h-[200px] bg-gray-50\"\n * aria-label=\"Loading user data\"\n * />\n * ```\n *\n * @example\n * Conditional content loading:\n * ```tsx\n * <Loader isLoading={!data}>\n * {data && (\n * <div>\n * <h2>{data.title}</h2>\n * <p>{data.content}</p>\n * </div>\n * )}\n * </Loader>\n * ```\n *\n * Features:\n * - Dual-mode operation: standalone spinner or content wrapper\n * - Responsive design with flexible sizing\n * - Accessible with proper ARIA attributes and role\n * - Smooth animated spinner using SVG\n * - Customizable styling through className prop\n * - Supports all standard HTML div attributes\n * - Screen constraints (max-height/width) to prevent overflow\n * - Internationalization ready with aria-label support\n *\n * Accessibility:\n * - Uses role=\"status\" for screen reader announcements\n * - Includes descriptive aria-label for the loading state\n * - Maintains focus management when transitioning between states\n * - Supports custom aria-label through props for specific contexts\n * - Compatible with keyboard navigation patterns\n *\n * Performance:\n * - Lightweight SVG spinner with CSS animations\n * - Conditional rendering prevents unnecessary DOM updates\n * - Optimized for frequent loading state changes\n * - No external dependencies beyond internal utilities\n *\n * @param props - Component props extending HTML div attributes\n * @param props.children - Content to display when not loading\n * @param props.isLoading - Loading state control (defaults to true)\n * @param props.className - Additional CSS classes for the loader container\n * @param props.role - ARIA role (defaults to \"status\")\n * @param props.aria-label - Custom accessibility label\n * @param props.id - Unique identifier for the loader\n * @param props.style - Inline styles object\n * @param props.data-* - Data attributes for testing or tracking\n * @param props...rest - All other standard HTML div attributes\n *\n * @returns A loading spinner when isLoading is true, otherwise renders children\n */\nexport const Loader: FC<LoaderProps> = ({\n children,\n isLoading = true,\n className,\n ...props\n}) => (\n <>\n {isLoading ? (\n <div\n className={cn(\n 'flex size-full max-h-screen max-w-[100vw] flex-1 items-center justify-center',\n className\n )}\n role=\"status\"\n aria-label=\"Animated icon, meaning that the website is processing\"\n {...props}\n >\n <Spinner className=\"size-10 max-h-full max-w-full\" />\n </div>\n ) : (\n (children ?? <></>)\n )}\n </>\n);\n"],"names":[],"mappings":";;;AAmGO,MAAM,SAA0B,CAAC;AAAA,EACtC;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,sCAEK,UAAA,YACC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACL,cAAW;AAAA,IACV,GAAG;AAAA,IAEJ,UAAA,oBAAC,SAAA,EAAQ,WAAU,gCAAA,CAAgC;AAAA,EAAA;AACrD,IAEC,4CAAc,EAAA,CAEnB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.cjs","sources":["../../../src/components/Loader/spinner.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype SpinnerProps = SVGProps<SVGSVGElement> & {\n strokeWidth?: number;\n};\n\nexport const Spinner = ({ className, strokeWidth = 4 }: SpinnerProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"44\"\n height=\"44\"\n viewBox=\"0 0 44 44\"\n stroke=\"currentColor\"\n className={cn('size-full', className)}\n >\n <g fill=\"none\" fillRule=\"evenodd\" strokeWidth={strokeWidth}>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n </g>\n </svg>\n);\n"],"names":["jsx","cn","jsxs"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"spinner.cjs","sources":["../../../src/components/Loader/spinner.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Spinner component\n */\ntype SpinnerProps = SVGProps<SVGSVGElement> & {\n /** Stroke width for the spinner animation circles. Defaults to 4 */\n strokeWidth?: number;\n};\n\n/**\n * Spinner Component\n *\n * An animated SVG spinner that displays two expanding and fading circles\n * to indicate loading or processing states. Uses smooth CSS animations\n * with spline curves for natural motion.\n *\n * @component\n * @example\n * Basic usage:\n * ```tsx\n * <Spinner />\n * ```\n *\n * @example\n * Custom stroke width:\n * ```tsx\n * <Spinner strokeWidth={6} className=\"text-blue-500\" />\n * ```\n *\n * @example\n * Custom size:\n * ```tsx\n * <Spinner className=\"size-8 text-red-500\" strokeWidth={2} />\n * ```\n *\n * Features:\n * - Smooth expanding circle animation\n * - Customizable stroke width\n * - Inherits text color from parent (currentColor)\n * - Responsive sizing through className\n * - Infinite loop animation\n * - Two-phase animation with offset timing\n * - Optimized SVG with minimal DOM impact\n *\n * Animation Details:\n * - Duration: 1.8 seconds per cycle\n * - Two circles with 0.9s offset\n * - Radius expands from 1 to 20\n * - Opacity fades from 1 to 0\n * - Spline easing for natural motion\n *\n * @param props - SVG props with custom spinner options\n * @param props.className - CSS classes for styling and sizing\n * @param props.strokeWidth - Line thickness for the animated circles\n * @param props.color - SVG color (use className with text-color for easier styling)\n * @param props.width - SVG width (defaults to 44, use className for responsive sizing)\n * @param props.height - SVG height (defaults to 44, use className for responsive sizing)\n * @param props...rest - All other standard SVG element attributes\n *\n * @returns An animated SVG spinner element\n */\nexport const Spinner = ({ className, strokeWidth = 4 }: SpinnerProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"44\"\n height=\"44\"\n viewBox=\"0 0 44 44\"\n stroke=\"currentColor\"\n className={cn('size-full', className)}\n >\n <g fill=\"none\" fillRule=\"evenodd\" strokeWidth={strokeWidth}>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n </g>\n </svg>\n);\n"],"names":["jsx","cn","jsxs"],"mappings":";;;;AA+DO,MAAM,UAAU,CAAC,EAAE,WAAW,cAAc,QACjDA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,WAAWC,SAAAA,GAAG,aAAa,SAAS;AAAA,IAEpC,0CAAC,KAAA,EAAE,MAAK,QAAO,UAAS,WAAU,aAChC,UAAA;AAAA,MAAAC,gCAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KACxB,UAAA;AAAA,QAAAF,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEdA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACd,GACF;AAAA,sCACC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KACxB,UAAA;AAAA,QAAAA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEdA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AACF;;"}
|
|
@@ -1,7 +1,63 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Spinner component
|
|
4
|
+
*/
|
|
2
5
|
type SpinnerProps = SVGProps<SVGSVGElement> & {
|
|
6
|
+
/** Stroke width for the spinner animation circles. Defaults to 4 */
|
|
3
7
|
strokeWidth?: number;
|
|
4
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Spinner Component
|
|
11
|
+
*
|
|
12
|
+
* An animated SVG spinner that displays two expanding and fading circles
|
|
13
|
+
* to indicate loading or processing states. Uses smooth CSS animations
|
|
14
|
+
* with spline curves for natural motion.
|
|
15
|
+
*
|
|
16
|
+
* @component
|
|
17
|
+
* @example
|
|
18
|
+
* Basic usage:
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Spinner />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* Custom stroke width:
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Spinner strokeWidth={6} className="text-blue-500" />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* Custom size:
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Spinner className="size-8 text-red-500" strokeWidth={2} />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Features:
|
|
36
|
+
* - Smooth expanding circle animation
|
|
37
|
+
* - Customizable stroke width
|
|
38
|
+
* - Inherits text color from parent (currentColor)
|
|
39
|
+
* - Responsive sizing through className
|
|
40
|
+
* - Infinite loop animation
|
|
41
|
+
* - Two-phase animation with offset timing
|
|
42
|
+
* - Optimized SVG with minimal DOM impact
|
|
43
|
+
*
|
|
44
|
+
* Animation Details:
|
|
45
|
+
* - Duration: 1.8 seconds per cycle
|
|
46
|
+
* - Two circles with 0.9s offset
|
|
47
|
+
* - Radius expands from 1 to 20
|
|
48
|
+
* - Opacity fades from 1 to 0
|
|
49
|
+
* - Spline easing for natural motion
|
|
50
|
+
*
|
|
51
|
+
* @param props - SVG props with custom spinner options
|
|
52
|
+
* @param props.className - CSS classes for styling and sizing
|
|
53
|
+
* @param props.strokeWidth - Line thickness for the animated circles
|
|
54
|
+
* @param props.color - SVG color (use className with text-color for easier styling)
|
|
55
|
+
* @param props.width - SVG width (defaults to 44, use className for responsive sizing)
|
|
56
|
+
* @param props.height - SVG height (defaults to 44, use className for responsive sizing)
|
|
57
|
+
* @param props...rest - All other standard SVG element attributes
|
|
58
|
+
*
|
|
59
|
+
* @returns An animated SVG spinner element
|
|
60
|
+
*/
|
|
5
61
|
export declare const Spinner: ({ className, strokeWidth }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
62
|
export {};
|
|
7
63
|
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,KAAK,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,4BAAgC,YAAY,4CAwDnE,CAAC"}
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC;;GAEG;AACH,KAAK,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IAC5C,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,OAAO,GAAI,4BAAgC,YAAY,4CAwDnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.mjs","sources":["../../../src/components/Loader/spinner.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype SpinnerProps = SVGProps<SVGSVGElement> & {\n strokeWidth?: number;\n};\n\nexport const Spinner = ({ className, strokeWidth = 4 }: SpinnerProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"44\"\n height=\"44\"\n viewBox=\"0 0 44 44\"\n stroke=\"currentColor\"\n className={cn('size-full', className)}\n >\n <g fill=\"none\" fillRule=\"evenodd\" strokeWidth={strokeWidth}>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n </g>\n </svg>\n);\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"spinner.mjs","sources":["../../../src/components/Loader/spinner.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Spinner component\n */\ntype SpinnerProps = SVGProps<SVGSVGElement> & {\n /** Stroke width for the spinner animation circles. Defaults to 4 */\n strokeWidth?: number;\n};\n\n/**\n * Spinner Component\n *\n * An animated SVG spinner that displays two expanding and fading circles\n * to indicate loading or processing states. Uses smooth CSS animations\n * with spline curves for natural motion.\n *\n * @component\n * @example\n * Basic usage:\n * ```tsx\n * <Spinner />\n * ```\n *\n * @example\n * Custom stroke width:\n * ```tsx\n * <Spinner strokeWidth={6} className=\"text-blue-500\" />\n * ```\n *\n * @example\n * Custom size:\n * ```tsx\n * <Spinner className=\"size-8 text-red-500\" strokeWidth={2} />\n * ```\n *\n * Features:\n * - Smooth expanding circle animation\n * - Customizable stroke width\n * - Inherits text color from parent (currentColor)\n * - Responsive sizing through className\n * - Infinite loop animation\n * - Two-phase animation with offset timing\n * - Optimized SVG with minimal DOM impact\n *\n * Animation Details:\n * - Duration: 1.8 seconds per cycle\n * - Two circles with 0.9s offset\n * - Radius expands from 1 to 20\n * - Opacity fades from 1 to 0\n * - Spline easing for natural motion\n *\n * @param props - SVG props with custom spinner options\n * @param props.className - CSS classes for styling and sizing\n * @param props.strokeWidth - Line thickness for the animated circles\n * @param props.color - SVG color (use className with text-color for easier styling)\n * @param props.width - SVG width (defaults to 44, use className for responsive sizing)\n * @param props.height - SVG height (defaults to 44, use className for responsive sizing)\n * @param props...rest - All other standard SVG element attributes\n *\n * @returns An animated SVG spinner element\n */\nexport const Spinner = ({ className, strokeWidth = 4 }: SpinnerProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"44\"\n height=\"44\"\n viewBox=\"0 0 44 44\"\n stroke=\"currentColor\"\n className={cn('size-full', className)}\n >\n <g fill=\"none\" fillRule=\"evenodd\" strokeWidth={strokeWidth}>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"0s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"1\">\n <animate\n attributeName=\"r\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 20\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.165, 0.84, 0.44, 1\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"stroke-opacity\"\n begin=\"-0.9s\"\n dur=\"1.8s\"\n values=\"1; 0\"\n calcMode=\"spline\"\n keyTimes=\"0; 1\"\n keySplines=\"0.3, 0.61, 0.355, 1\"\n repeatCount=\"indefinite\"\n />\n </circle>\n </g>\n </svg>\n);\n"],"names":[],"mappings":";;AA+DO,MAAM,UAAU,CAAC,EAAE,WAAW,cAAc,QACjD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,WAAW,GAAG,aAAa,SAAS;AAAA,IAEpC,+BAAC,KAAA,EAAE,MAAK,QAAO,UAAS,WAAU,aAChC,UAAA;AAAA,MAAA,qBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KACxB,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEd;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACd,GACF;AAAA,2BACC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KACxB,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEd;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAc;AAAA,YACd,OAAM;AAAA,YACN,KAAI;AAAA,YACJ,QAAO;AAAA,YACP,UAAS;AAAA,YACT,UAAS;AAAA,YACT,YAAW;AAAA,YACX,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AACF;"}
|
|
@@ -9,7 +9,7 @@ const components_Link_Link = require("../Link/Link.cjs");
|
|
|
9
9
|
const components_Tab_Tab = require("../Tab/Tab.cjs");
|
|
10
10
|
const components_Tab_TabContext = require("../Tab/TabContext.cjs");
|
|
11
11
|
const components_Table_Table = require("../Table/Table.cjs");
|
|
12
|
-
const
|
|
12
|
+
const components_MarkDownRender_processor = require("./processor.cjs");
|
|
13
13
|
const stripFrontmatter = (markdown) => {
|
|
14
14
|
const lines = markdown.split(/\r?\n/);
|
|
15
15
|
const firstNonEmptyLine = lines.find((line) => line.trim() !== "");
|
|
@@ -44,7 +44,7 @@ const MarkdownRenderer = ({
|
|
|
44
44
|
const { overrides, ...restOptions } = options ?? {};
|
|
45
45
|
const cleanMarkdown = stripFrontmatter(children);
|
|
46
46
|
return /* @__PURE__ */ jsxRuntime.jsx(components_IDE_CodeContext.CodeProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(components_Tab_TabContext.TabProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
-
|
|
47
|
+
components_MarkDownRender_processor.MarkdownProcessor,
|
|
48
48
|
{
|
|
49
49
|
options: {
|
|
50
50
|
overrides: {
|
|
@@ -168,7 +168,7 @@ const MarkdownRenderer = ({
|
|
|
168
168
|
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
169
169
|
"div",
|
|
170
170
|
{
|
|
171
|
-
className: utils_cn.cn("flex md:flex-col gap-4", className),
|
|
171
|
+
className: utils_cn.cn("flex max-md:flex-col gap-4", className),
|
|
172
172
|
...props
|
|
173
173
|
}
|
|
174
174
|
),
|