@intlayer/design-system 6.1.5 → 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 +13 -9
- 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/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 +0 -1
- package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.d.ts +147 -0
- package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.mjs +0 -1
- package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- 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/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 -18
- 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
|
@@ -49,7 +49,14 @@ const useNavActions = () => {
|
|
|
49
49
|
onClick?.();
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
/** Currently active section ID, null if no section is active */
|
|
54
|
+
activeSection,
|
|
55
|
+
/** Handler for logo click interactions */
|
|
56
|
+
onClickLogo,
|
|
57
|
+
/** Handler for section navigation clicks */
|
|
58
|
+
onClickSection
|
|
59
|
+
};
|
|
53
60
|
};
|
|
54
61
|
export {
|
|
55
62
|
useNavActions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.mjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\ninterface SectionData {\n id: string;\n offsetTop: number;\n offsetHeight: number;\n}\n\nexport const useNavActions = () => {\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n onClick?.();\n }\n };\n\n return {
|
|
1
|
+
{"version":3,"file":"useNavigation.mjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Interface describing section data used for scroll detection\n */\ninterface SectionData {\n /** Unique identifier of the section element */\n id: string;\n /** Distance from top of document to section start */\n offsetTop: number;\n /** Height of the section element */\n offsetHeight: number;\n}\n\n/**\n * Navigation Actions Hook\n *\n * A comprehensive hook for managing navigation interactions and scroll-based section detection.\n * Provides automatic active section detection based on scroll position and handles smooth\n * scrolling navigation behaviors.\n *\n * Features:\n * - Automatic active section detection based on scroll position\n * - Smooth scrolling to sections within the same page\n * - Logo click handling with home navigation\n * - Section click handling with conditional scrolling vs navigation\n * - Passive scroll event listeners for optimal performance\n * - Viewport-aware active section calculation (using screen height / 4 offset)\n *\n * Active Section Detection:\n * - Monitors all `<section>` elements on the page\n * - Calculates which section is currently in the \"active\" zone\n * - Active zone is defined as the top 25% of the viewport\n * - Updates activeSection state as user scrolls\n *\n * Navigation Behaviors:\n * - Logo click: Scrolls to top if on home page, navigates to home if on other pages\n * - Section click: Smooth scrolls if on same page, executes callback if different page\n * - All scrolling uses smooth behavior for better UX\n *\n * @example\n * Basic usage in navigation component:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n *\n * // In navigation items\n * const navItems = sections.map(section => (\n * <TabSelectorItem\n * key={section.id}\n * isActive={activeSection === section.id}\n * onClick={() => onClickSection(section.id, section.url, section.onClick)}\n * >\n * {section.label}\n * </TabSelectorItem>\n * ));\n *\n * // In logo\n * <Logo onClick={() => onClickLogo(navigate)} />\n * ```\n *\n * @example\n * Advanced usage with routing:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n * const navigate = useNavigate();\n *\n * const handleLogoClick = () => {\n * onClickLogo((url) => {\n * navigate(url);\n * // Additional logic like analytics\n * trackEvent('logo_click');\n * });\n * };\n *\n * const handleSectionClick = (sectionId: string) => {\n * onClickSection(\n * sectionId,\n * `/page#${sectionId}`,\n * () => {\n * navigate(`/page#${sectionId}`);\n * trackEvent('section_navigation', { sectionId });\n * }\n * );\n * };\n * ```\n *\n * Performance Considerations:\n * - Uses passive scroll event listeners to prevent blocking\n * - Automatically cleans up event listeners on unmount\n * - Efficiently queries DOM elements using native selectors\n * - Calculates section positions dynamically for accuracy\n *\n * @returns Object containing navigation state and action handlers\n */\nexport const useNavActions = () => {\n /** Currently active section ID based on scroll position */\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n /**\n * Detects which section is currently active based on scroll position\n * Uses viewport-aware calculation to determine active section\n */\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n // Collect position data for all sections\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n // Find section that intersects with the active zone (top 25% of viewport)\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n // Set up scroll listener for active section detection\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n /**\n * Handles logo click behavior\n * Scrolls to top if on home page, navigates to home if on other pages\n *\n * @param onClick - Callback function to handle navigation (e.g., router.push)\n */\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n /**\n * Handles section navigation click behavior\n * Smooth scrolls if on same page, executes callback if different page\n *\n * @param sectionId - ID of the target section element\n * @param url - URL of the page containing the section (optional)\n * @param onClick - Callback function to handle navigation (optional)\n */\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n // If on the same page, scroll to section\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n // If on different page, execute callback (typically navigation)\n onClick?.();\n }\n };\n\n return {\n /** Currently active section ID, null if no section is active */\n activeSection,\n /** Handler for logo click interactions */\n onClickLogo,\n /** Handler for section navigation clicks */\n onClickSection,\n };\n};\n"],"names":[],"mappings":";;AAgGO,MAAM,gBAAgB,MAAM;AAEjC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,IAAI;AAMtE,QAAM,sBAAsB,MAAM;AAChC,UAAM,UAAU,OAAO;AACvB,UAAM,WAAW,SAAS,iBAAiB,SAAS;AACpD,UAAM,eAA8B,CAAA;AAGpC,aAAS;AAAA,MAAQ,CAAC,YAChB,aAAa,KAAK;AAAA,QAChB,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,cAAc,QAAQ;AAAA,MAAA,CACvB;AAAA,IAAA;AAIH,UAAM,iBAAiB,aAAa;AAAA,MAClC,CAAC,YACC,QAAQ,aAAa,UAAU,OAAO,OAAO,SAAS,KACtD,QAAQ,YAAY,QAAQ,eAC1B,UAAU,OAAO,OAAO,SAAS;AAAA,IAAA;AAGvC,QAAI,gBAAgB;AAClB,uBAAiB,eAAe,EAAE;AAAA,IACpC;AAAA,EACF;AAGA,YAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,qBAAqB,EAAE,SAAS,MAAM;AAExE,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,mBAAmB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAA,CAAE;AAQL,QAAM,cAAc,CAAC,YAAmC;AACtD,qBAAiB,IAAI;AAErB,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,aAAO,SAAS,EAAE,KAAK,GAAG,UAAU,UAAU;AAAA,IAChD,OAAO;AACL,cAAQ,GAAG;AAAA,IACb;AAAA,EACF;AAUA,QAAM,iBAAiB,CACrB,WACA,KACA,YACG;AACH,qBAAiB,SAAS;AAG1B,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,YAAM,YAAY,SAAS,eAAe,SAAS;AAEnD,UAAI,WAAW;AACb,kBAAU,eAAe;AAAA,UACvB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH;AAAA,IACF,OAAO;AAEL,gBAAA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA;AAAA,IAEL;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPattern.cjs","sources":["../../../src/components/Pattern/DotPattern.tsx"],"sourcesContent":["import { type FC, type SVGProps, useId } from 'react';\n\nimport { cn } from '../../utils/cn';\n\ntype DotPatternProps = {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n cx?: number;\n cy?: number;\n cr?: number;\n} & SVGProps<SVGSVGElement>;\n\nexport const DotPattern: FC<DotPatternProps> = ({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}) => {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/30 pointer-events-none absolute inset-0 h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n};\n"],"names":["useId","jsxs","cn","jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"DotPattern.cjs","sources":["../../../src/components/Pattern/DotPattern.tsx"],"sourcesContent":["import { type FC, type SVGProps, useId } from 'react';\n\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the DotPattern component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype DotPatternProps = {\n /** Width of the pattern tile in pixels */\n width?: number;\n /** Height of the pattern tile in pixels */\n height?: number;\n /** Horizontal offset of the pattern */\n x?: number;\n /** Vertical offset of the pattern */\n y?: number;\n /** X coordinate of the dot center within the pattern tile */\n cx?: number;\n /** Y coordinate of the dot center within the pattern tile */\n cy?: number;\n /** Radius of each dot in the pattern */\n cr?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Dot Pattern Component\n *\n * A decorative SVG component that generates a repeating dot pattern background.\n * Perfect for adding subtle texture and visual interest to sections, cards, or hero areas\n * without interfering with content readability.\n *\n * Features:\n * - Scalable vector-based pattern that looks crisp at any size\n * - Customizable dot spacing, size, and positioning\n * - Semi-transparent fill for subtle visual effect\n * - Accessibility-friendly with aria-hidden attribute\n * - Pointer events disabled to avoid interaction interference\n * - Unique pattern ID generation to prevent conflicts\n * - Full coverage with absolute positioning\n *\n * Technical Implementation:\n * - Uses SVG `<pattern>` element for efficient rendering\n * - Pattern repeats using userSpaceOnUse coordinate system\n * - Generates unique IDs using React's useId hook\n * - Fills entire container with 100% width and height\n * - Pattern tile coordinates defined in userSpaceOnUse units\n *\n * Visual Characteristics:\n * - Default: 16x16px tile with 1px radius dots\n * - Semi-transparent neutral fill (30% opacity)\n * - Dots positioned at (1,1) within each tile by default\n * - Absolute positioning covers entire parent container\n *\n * @example\n * Basic usage as background pattern:\n * ```tsx\n * <div className=\"relative min-h-screen\">\n * <DotPattern />\n * <div className=\"relative z-10\">\n * <h1>Content over dot pattern</h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom dot spacing and size:\n * ```tsx\n * <DotPattern\n * width={24}\n * height={24}\n * cr={1.5}\n * className=\"fill-primary/20\"\n * />\n * ```\n *\n * @example\n * Offset pattern positioning:\n * ```tsx\n * <DotPattern\n * x={8}\n * y={8}\n * cx={2}\n * cy={2}\n * className=\"fill-accent/25\"\n * />\n * ```\n *\n * @example\n * Large sparse dots:\n * ```tsx\n * <DotPattern\n * width={32}\n * height={32}\n * cr={2}\n * cx={16}\n * cy={16}\n * className=\"fill-neutral/10\"\n * />\n * ```\n *\n * Styling Notes:\n * - Use `fill-*` classes to customize dot color and opacity\n * - Pattern automatically fills parent container\n * - Consider contrast with overlaid content\n * - Semi-transparent fills work best for backgrounds\n *\n * Accessibility:\n * - Marked as `aria-hidden=\"true\"` since it's decorative\n * - Pointer events disabled to maintain interactivity of overlaid content\n * - Does not interfere with screen readers or keyboard navigation\n *\n * @param props - DotPattern component props\n * @returns SVG element with repeating dot pattern\n */\nexport const DotPattern: FC<DotPatternProps> = ({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}) => {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/30 pointer-events-none absolute inset-0 h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n};\n"],"names":["useId","jsxs","cn","jsx"],"mappings":";;;;;AAmHO,MAAM,aAAkC,CAAC;AAAA,EAC9C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,KAAKA,aAAAA,MAAA;AAEX,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,+BAAC,QAAA,EACC,UAAAA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAa;AAAA,YACb,qBAAoB;AAAA,YACpB;AAAA,YACA;AAAA,YAEA,yCAAC,UAAA,EAAO,IAAG,kBAAiB,IAAQ,IAAQ,GAAG,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA,GAEvD;AAAA,QACAA,2BAAAA,IAAC,QAAA,EAAK,OAAM,QAAO,QAAO,QAAO,aAAa,GAAG,MAAM,QAAQ,EAAE,IAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG5E;;"}
|
|
@@ -1,13 +1,114 @@
|
|
|
1
1
|
import { FC, SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DotPattern component
|
|
4
|
+
* Extends SVGProps to inherit all standard SVG attributes
|
|
5
|
+
*/
|
|
2
6
|
type DotPatternProps = {
|
|
7
|
+
/** Width of the pattern tile in pixels */
|
|
3
8
|
width?: number;
|
|
9
|
+
/** Height of the pattern tile in pixels */
|
|
4
10
|
height?: number;
|
|
11
|
+
/** Horizontal offset of the pattern */
|
|
5
12
|
x?: number;
|
|
13
|
+
/** Vertical offset of the pattern */
|
|
6
14
|
y?: number;
|
|
15
|
+
/** X coordinate of the dot center within the pattern tile */
|
|
7
16
|
cx?: number;
|
|
17
|
+
/** Y coordinate of the dot center within the pattern tile */
|
|
8
18
|
cy?: number;
|
|
19
|
+
/** Radius of each dot in the pattern */
|
|
9
20
|
cr?: number;
|
|
10
21
|
} & SVGProps<SVGSVGElement>;
|
|
22
|
+
/**
|
|
23
|
+
* Dot Pattern Component
|
|
24
|
+
*
|
|
25
|
+
* A decorative SVG component that generates a repeating dot pattern background.
|
|
26
|
+
* Perfect for adding subtle texture and visual interest to sections, cards, or hero areas
|
|
27
|
+
* without interfering with content readability.
|
|
28
|
+
*
|
|
29
|
+
* Features:
|
|
30
|
+
* - Scalable vector-based pattern that looks crisp at any size
|
|
31
|
+
* - Customizable dot spacing, size, and positioning
|
|
32
|
+
* - Semi-transparent fill for subtle visual effect
|
|
33
|
+
* - Accessibility-friendly with aria-hidden attribute
|
|
34
|
+
* - Pointer events disabled to avoid interaction interference
|
|
35
|
+
* - Unique pattern ID generation to prevent conflicts
|
|
36
|
+
* - Full coverage with absolute positioning
|
|
37
|
+
*
|
|
38
|
+
* Technical Implementation:
|
|
39
|
+
* - Uses SVG `<pattern>` element for efficient rendering
|
|
40
|
+
* - Pattern repeats using userSpaceOnUse coordinate system
|
|
41
|
+
* - Generates unique IDs using React's useId hook
|
|
42
|
+
* - Fills entire container with 100% width and height
|
|
43
|
+
* - Pattern tile coordinates defined in userSpaceOnUse units
|
|
44
|
+
*
|
|
45
|
+
* Visual Characteristics:
|
|
46
|
+
* - Default: 16x16px tile with 1px radius dots
|
|
47
|
+
* - Semi-transparent neutral fill (30% opacity)
|
|
48
|
+
* - Dots positioned at (1,1) within each tile by default
|
|
49
|
+
* - Absolute positioning covers entire parent container
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* Basic usage as background pattern:
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <div className="relative min-h-screen">
|
|
55
|
+
* <DotPattern />
|
|
56
|
+
* <div className="relative z-10">
|
|
57
|
+
* <h1>Content over dot pattern</h1>
|
|
58
|
+
* </div>
|
|
59
|
+
* </div>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* Custom dot spacing and size:
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <DotPattern
|
|
66
|
+
* width={24}
|
|
67
|
+
* height={24}
|
|
68
|
+
* cr={1.5}
|
|
69
|
+
* className="fill-primary/20"
|
|
70
|
+
* />
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* Offset pattern positioning:
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <DotPattern
|
|
77
|
+
* x={8}
|
|
78
|
+
* y={8}
|
|
79
|
+
* cx={2}
|
|
80
|
+
* cy={2}
|
|
81
|
+
* className="fill-accent/25"
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* Large sparse dots:
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <DotPattern
|
|
89
|
+
* width={32}
|
|
90
|
+
* height={32}
|
|
91
|
+
* cr={2}
|
|
92
|
+
* cx={16}
|
|
93
|
+
* cy={16}
|
|
94
|
+
* className="fill-neutral/10"
|
|
95
|
+
* />
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Styling Notes:
|
|
99
|
+
* - Use `fill-*` classes to customize dot color and opacity
|
|
100
|
+
* - Pattern automatically fills parent container
|
|
101
|
+
* - Consider contrast with overlaid content
|
|
102
|
+
* - Semi-transparent fills work best for backgrounds
|
|
103
|
+
*
|
|
104
|
+
* Accessibility:
|
|
105
|
+
* - Marked as `aria-hidden="true"` since it's decorative
|
|
106
|
+
* - Pointer events disabled to maintain interactivity of overlaid content
|
|
107
|
+
* - Does not interfere with screen readers or keyboard navigation
|
|
108
|
+
*
|
|
109
|
+
* @param props - DotPattern component props
|
|
110
|
+
* @returns SVG element with repeating dot pattern
|
|
111
|
+
*/
|
|
11
112
|
export declare const DotPattern: FC<DotPatternProps>;
|
|
12
113
|
export {};
|
|
13
114
|
//# sourceMappingURL=DotPattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPattern.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/DotPattern.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,QAAQ,EAAS,MAAM,OAAO,CAAC;AAItD,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE5B,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAsC1C,CAAC"}
|
|
1
|
+
{"version":3,"file":"DotPattern.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/DotPattern.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,QAAQ,EAAS,MAAM,OAAO,CAAC;AAItD;;;GAGG;AACH,KAAK,eAAe,GAAG;IACrB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAsC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPattern.mjs","sources":["../../../src/components/Pattern/DotPattern.tsx"],"sourcesContent":["import { type FC, type SVGProps, useId } from 'react';\n\nimport { cn } from '../../utils/cn';\n\ntype DotPatternProps = {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n cx?: number;\n cy?: number;\n cr?: number;\n} & SVGProps<SVGSVGElement>;\n\nexport const DotPattern: FC<DotPatternProps> = ({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}) => {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/30 pointer-events-none absolute inset-0 h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DotPattern.mjs","sources":["../../../src/components/Pattern/DotPattern.tsx"],"sourcesContent":["import { type FC, type SVGProps, useId } from 'react';\n\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the DotPattern component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype DotPatternProps = {\n /** Width of the pattern tile in pixels */\n width?: number;\n /** Height of the pattern tile in pixels */\n height?: number;\n /** Horizontal offset of the pattern */\n x?: number;\n /** Vertical offset of the pattern */\n y?: number;\n /** X coordinate of the dot center within the pattern tile */\n cx?: number;\n /** Y coordinate of the dot center within the pattern tile */\n cy?: number;\n /** Radius of each dot in the pattern */\n cr?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Dot Pattern Component\n *\n * A decorative SVG component that generates a repeating dot pattern background.\n * Perfect for adding subtle texture and visual interest to sections, cards, or hero areas\n * without interfering with content readability.\n *\n * Features:\n * - Scalable vector-based pattern that looks crisp at any size\n * - Customizable dot spacing, size, and positioning\n * - Semi-transparent fill for subtle visual effect\n * - Accessibility-friendly with aria-hidden attribute\n * - Pointer events disabled to avoid interaction interference\n * - Unique pattern ID generation to prevent conflicts\n * - Full coverage with absolute positioning\n *\n * Technical Implementation:\n * - Uses SVG `<pattern>` element for efficient rendering\n * - Pattern repeats using userSpaceOnUse coordinate system\n * - Generates unique IDs using React's useId hook\n * - Fills entire container with 100% width and height\n * - Pattern tile coordinates defined in userSpaceOnUse units\n *\n * Visual Characteristics:\n * - Default: 16x16px tile with 1px radius dots\n * - Semi-transparent neutral fill (30% opacity)\n * - Dots positioned at (1,1) within each tile by default\n * - Absolute positioning covers entire parent container\n *\n * @example\n * Basic usage as background pattern:\n * ```tsx\n * <div className=\"relative min-h-screen\">\n * <DotPattern />\n * <div className=\"relative z-10\">\n * <h1>Content over dot pattern</h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom dot spacing and size:\n * ```tsx\n * <DotPattern\n * width={24}\n * height={24}\n * cr={1.5}\n * className=\"fill-primary/20\"\n * />\n * ```\n *\n * @example\n * Offset pattern positioning:\n * ```tsx\n * <DotPattern\n * x={8}\n * y={8}\n * cx={2}\n * cy={2}\n * className=\"fill-accent/25\"\n * />\n * ```\n *\n * @example\n * Large sparse dots:\n * ```tsx\n * <DotPattern\n * width={32}\n * height={32}\n * cr={2}\n * cx={16}\n * cy={16}\n * className=\"fill-neutral/10\"\n * />\n * ```\n *\n * Styling Notes:\n * - Use `fill-*` classes to customize dot color and opacity\n * - Pattern automatically fills parent container\n * - Consider contrast with overlaid content\n * - Semi-transparent fills work best for backgrounds\n *\n * Accessibility:\n * - Marked as `aria-hidden=\"true\"` since it's decorative\n * - Pointer events disabled to maintain interactivity of overlaid content\n * - Does not interfere with screen readers or keyboard navigation\n *\n * @param props - DotPattern component props\n * @returns SVG element with repeating dot pattern\n */\nexport const DotPattern: FC<DotPatternProps> = ({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}) => {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/30 pointer-events-none absolute inset-0 h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;AAmHO,MAAM,aAAkC,CAAC;AAAA,EAC9C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,KAAK,MAAA;AAEX,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,oBAAC,QAAA,EACC,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAa;AAAA,YACb,qBAAoB;AAAA,YACpB;AAAA,YACA;AAAA,YAEA,8BAAC,UAAA,EAAO,IAAG,kBAAiB,IAAQ,IAAQ,GAAG,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA,GAEvD;AAAA,QACA,oBAAC,QAAA,EAAK,OAAM,QAAO,QAAO,QAAO,aAAa,GAAG,MAAM,QAAQ,EAAE,IAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG5E;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridPattern.cjs","sources":["../../../src/components/Pattern/GridPattern.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype GridPatternProps = {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n squares?: [x: number, y: number][];\n strokeDasharray?: number;\n} & SVGProps<SVGSVGElement>;\n\nconst id = 'grid-pattern';\n\nexport const GridPattern: FC<GridPatternProps> = ({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n squares,\n className,\n ...props\n}) => (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/10 stroke-neutral/15 dark:stroke-neutral/30 pointer-events-none absolute inset-0 h-full max-h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n);\n"],"names":["jsxs","cn","jsx","x","y"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"GridPattern.cjs","sources":["../../../src/components/Pattern/GridPattern.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the GridPattern component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype GridPatternProps = {\n /** Width of each grid cell in pixels */\n width?: number;\n /** Height of each grid cell in pixels */\n height?: number;\n /** Horizontal offset of the pattern */\n x?: number;\n /** Vertical offset of the pattern */\n y?: number;\n /** Array of grid coordinates to highlight as filled squares */\n squares?: [x: number, y: number][];\n /** Dash pattern for grid lines (0 = solid, positive = dashed) */\n strokeDasharray?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Unique identifier for the grid pattern definition\n * Static to ensure consistent referencing across instances\n */\nconst id = 'grid-pattern';\n\n/**\n * Grid Pattern Component\n *\n * A versatile SVG component that generates a repeating grid pattern background with\n * optional highlighted squares. Ideal for technical layouts, dashboards, design mockups,\n * and any interface requiring structured visual organization.\n *\n * Features:\n * - Scalable vector-based grid that renders crisp at any zoom level\n * - Customizable cell dimensions and spacing\n * - Optional square highlighting for emphasis or data visualization\n * - Configurable stroke patterns (solid or dashed lines)\n * - Theme-aware styling with automatic dark mode support\n * - Accessibility-friendly with screen reader exclusion\n * - Performance optimized with pointer events disabled\n * - Full container coverage with responsive sizing\n *\n * Technical Architecture:\n * - Uses SVG `<pattern>` for memory-efficient repetition\n * - Grid lines drawn with path elements for precision\n * - Highlighted squares rendered as separate rect elements\n * - Pattern coordinates use userSpaceOnUse for consistency\n * - Static pattern ID prevents conflicts between instances\n *\n * Visual Design:\n * - Default: 40x40px grid cells with subtle neutral strokes\n * - Light mode: 10% fill opacity, 15% stroke opacity\n * - Dark mode: Enhanced 30% stroke opacity for visibility\n * - Slight offset (-1px) for optimal line rendering\n * - Optional dashed lines for more subtle appearance\n *\n * Highlighted Squares:\n * - Defined by coordinate arrays [x, y] where x,y are grid positions\n * - Automatically sized to fit within grid cells (width-1, height-1)\n * - Positioned with 1px offset for visual separation from grid lines\n * - Inherit theme-based fill colors for consistency\n *\n * @example\n * Basic grid background:\n * ```tsx\n * <div className=\"relative min-h-screen\">\n * <GridPattern />\n * <div className=\"relative z-10\">\n * <h1>Content over grid</h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom grid size with dashed lines:\n * ```tsx\n * <GridPattern\n * width={60}\n * height={60}\n * strokeDasharray={2}\n * className=\"stroke-primary/20\"\n * />\n * ```\n *\n * @example\n * Data visualization with highlighted squares:\n * ```tsx\n * <GridPattern\n * width={30}\n * height={30}\n * squares={[\n * [0, 1], [1, 1], [2, 1],\n * [1, 2], [3, 0], [4, 2]\n * ]}\n * className=\"fill-accent/20 stroke-accent/30\"\n * />\n * ```\n *\n * @example\n * Fine grid for technical layouts:\n * ```tsx\n * <GridPattern\n * width={20}\n * height={20}\n * strokeDasharray={1}\n * className=\"stroke-neutral/8 fill-neutral/5\"\n * />\n * ```\n *\n * Styling Guidelines:\n * - Use low opacity values (5-30%) for background subtlety\n * - Consider theme contrast when customizing colors\n * - Dashed patterns work well for secondary grids\n * - Match grid colors with overall design system\n *\n * Performance Notes:\n * - Pattern definition reused efficiently across large areas\n * - Highlighted squares rendered individually for flexibility\n * - Pointer events disabled to prevent interaction blocking\n * - SVG optimized for browser rendering performance\n *\n * Accessibility:\n * - Hidden from screen readers with aria-hidden=\"true\"\n * - Purely decorative - doesn't convey essential information\n * - Maintains sufficient contrast with overlaid content\n *\n * @param props - GridPattern component props\n * @returns SVG element with repeating grid pattern and optional highlights\n */\nexport const GridPattern: FC<GridPatternProps> = ({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n squares,\n className,\n ...props\n}) => (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/10 stroke-neutral/15 dark:stroke-neutral/30 pointer-events-none absolute inset-0 h-full max-h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n);\n"],"names":["jsxs","cn","jsx","x","y"],"mappings":";;;;AA0BA,MAAM,KAAK;AA0GJ,MAAM,cAAoC,CAAC;AAAA,EAChD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAY;AAAA,IACZ,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,+BAAC,QAAA,EACC,UAAAA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAa;AAAA,UACb;AAAA,UACA;AAAA,UAEA,UAAAA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAG,OAAO,MAAM,OAAO,KAAK;AAAA,cAC5B,MAAK;AAAA,cACL;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA,GAEJ;AAAA,MACAA,2BAAAA,IAAC,QAAA,EAAK,OAAM,QAAO,QAAO,QAAO,aAAa,GAAG,MAAM,QAAQ,EAAE,IAAA,CAAK;AAAA,MACrE,WACCA,2BAAAA,IAAC,OAAA,EAAI,GAAM,GAAM,WAAU,oBACxB,UAAA,QAAQ,IAAI,CAAC,CAACC,IAAGC,EAAC,MACjBF,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,aAAY;AAAA,UAEZ,OAAO,QAAQ;AAAA,UACf,QAAQ,SAAS;AAAA,UACjB,GAAGC,KAAI,QAAQ;AAAA,UACf,GAAGC,KAAI,SAAS;AAAA,QAAA;AAAA,QAJX,GAAGD,EAAC,IAAIC,EAAC;AAAA,MAAA,CAMjB,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1,12 +1,126 @@
|
|
|
1
1
|
import { FC, SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the GridPattern component
|
|
4
|
+
* Extends SVGProps to inherit all standard SVG attributes
|
|
5
|
+
*/
|
|
2
6
|
type GridPatternProps = {
|
|
7
|
+
/** Width of each grid cell in pixels */
|
|
3
8
|
width?: number;
|
|
9
|
+
/** Height of each grid cell in pixels */
|
|
4
10
|
height?: number;
|
|
11
|
+
/** Horizontal offset of the pattern */
|
|
5
12
|
x?: number;
|
|
13
|
+
/** Vertical offset of the pattern */
|
|
6
14
|
y?: number;
|
|
15
|
+
/** Array of grid coordinates to highlight as filled squares */
|
|
7
16
|
squares?: [x: number, y: number][];
|
|
17
|
+
/** Dash pattern for grid lines (0 = solid, positive = dashed) */
|
|
8
18
|
strokeDasharray?: number;
|
|
9
19
|
} & SVGProps<SVGSVGElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Grid Pattern Component
|
|
22
|
+
*
|
|
23
|
+
* A versatile SVG component that generates a repeating grid pattern background with
|
|
24
|
+
* optional highlighted squares. Ideal for technical layouts, dashboards, design mockups,
|
|
25
|
+
* and any interface requiring structured visual organization.
|
|
26
|
+
*
|
|
27
|
+
* Features:
|
|
28
|
+
* - Scalable vector-based grid that renders crisp at any zoom level
|
|
29
|
+
* - Customizable cell dimensions and spacing
|
|
30
|
+
* - Optional square highlighting for emphasis or data visualization
|
|
31
|
+
* - Configurable stroke patterns (solid or dashed lines)
|
|
32
|
+
* - Theme-aware styling with automatic dark mode support
|
|
33
|
+
* - Accessibility-friendly with screen reader exclusion
|
|
34
|
+
* - Performance optimized with pointer events disabled
|
|
35
|
+
* - Full container coverage with responsive sizing
|
|
36
|
+
*
|
|
37
|
+
* Technical Architecture:
|
|
38
|
+
* - Uses SVG `<pattern>` for memory-efficient repetition
|
|
39
|
+
* - Grid lines drawn with path elements for precision
|
|
40
|
+
* - Highlighted squares rendered as separate rect elements
|
|
41
|
+
* - Pattern coordinates use userSpaceOnUse for consistency
|
|
42
|
+
* - Static pattern ID prevents conflicts between instances
|
|
43
|
+
*
|
|
44
|
+
* Visual Design:
|
|
45
|
+
* - Default: 40x40px grid cells with subtle neutral strokes
|
|
46
|
+
* - Light mode: 10% fill opacity, 15% stroke opacity
|
|
47
|
+
* - Dark mode: Enhanced 30% stroke opacity for visibility
|
|
48
|
+
* - Slight offset (-1px) for optimal line rendering
|
|
49
|
+
* - Optional dashed lines for more subtle appearance
|
|
50
|
+
*
|
|
51
|
+
* Highlighted Squares:
|
|
52
|
+
* - Defined by coordinate arrays [x, y] where x,y are grid positions
|
|
53
|
+
* - Automatically sized to fit within grid cells (width-1, height-1)
|
|
54
|
+
* - Positioned with 1px offset for visual separation from grid lines
|
|
55
|
+
* - Inherit theme-based fill colors for consistency
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* Basic grid background:
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <div className="relative min-h-screen">
|
|
61
|
+
* <GridPattern />
|
|
62
|
+
* <div className="relative z-10">
|
|
63
|
+
* <h1>Content over grid</h1>
|
|
64
|
+
* </div>
|
|
65
|
+
* </div>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* Custom grid size with dashed lines:
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <GridPattern
|
|
72
|
+
* width={60}
|
|
73
|
+
* height={60}
|
|
74
|
+
* strokeDasharray={2}
|
|
75
|
+
* className="stroke-primary/20"
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* Data visualization with highlighted squares:
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <GridPattern
|
|
83
|
+
* width={30}
|
|
84
|
+
* height={30}
|
|
85
|
+
* squares={[
|
|
86
|
+
* [0, 1], [1, 1], [2, 1],
|
|
87
|
+
* [1, 2], [3, 0], [4, 2]
|
|
88
|
+
* ]}
|
|
89
|
+
* className="fill-accent/20 stroke-accent/30"
|
|
90
|
+
* />
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* Fine grid for technical layouts:
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <GridPattern
|
|
97
|
+
* width={20}
|
|
98
|
+
* height={20}
|
|
99
|
+
* strokeDasharray={1}
|
|
100
|
+
* className="stroke-neutral/8 fill-neutral/5"
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* Styling Guidelines:
|
|
105
|
+
* - Use low opacity values (5-30%) for background subtlety
|
|
106
|
+
* - Consider theme contrast when customizing colors
|
|
107
|
+
* - Dashed patterns work well for secondary grids
|
|
108
|
+
* - Match grid colors with overall design system
|
|
109
|
+
*
|
|
110
|
+
* Performance Notes:
|
|
111
|
+
* - Pattern definition reused efficiently across large areas
|
|
112
|
+
* - Highlighted squares rendered individually for flexibility
|
|
113
|
+
* - Pointer events disabled to prevent interaction blocking
|
|
114
|
+
* - SVG optimized for browser rendering performance
|
|
115
|
+
*
|
|
116
|
+
* Accessibility:
|
|
117
|
+
* - Hidden from screen readers with aria-hidden="true"
|
|
118
|
+
* - Purely decorative - doesn't convey essential information
|
|
119
|
+
* - Maintains sufficient contrast with overlaid content
|
|
120
|
+
*
|
|
121
|
+
* @param props - GridPattern component props
|
|
122
|
+
* @returns SVG element with repeating grid pattern and optional highlights
|
|
123
|
+
*/
|
|
10
124
|
export declare const GridPattern: FC<GridPatternProps>;
|
|
11
125
|
export {};
|
|
12
126
|
//# sourceMappingURL=GridPattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridPattern.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/GridPattern.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1C,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GridPattern.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/GridPattern.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1C;;;GAGG;AACH,KAAK,gBAAgB,GAAG;IACtB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IACnC,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuGG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAkD5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridPattern.mjs","sources":["../../../src/components/Pattern/GridPattern.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype GridPatternProps = {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n squares?: [x: number, y: number][];\n strokeDasharray?: number;\n} & SVGProps<SVGSVGElement>;\n\nconst id = 'grid-pattern';\n\nexport const GridPattern: FC<GridPatternProps> = ({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n squares,\n className,\n ...props\n}) => (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/10 stroke-neutral/15 dark:stroke-neutral/30 pointer-events-none absolute inset-0 h-full max-h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n);\n"],"names":["x","y"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"GridPattern.mjs","sources":["../../../src/components/Pattern/GridPattern.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the GridPattern component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype GridPatternProps = {\n /** Width of each grid cell in pixels */\n width?: number;\n /** Height of each grid cell in pixels */\n height?: number;\n /** Horizontal offset of the pattern */\n x?: number;\n /** Vertical offset of the pattern */\n y?: number;\n /** Array of grid coordinates to highlight as filled squares */\n squares?: [x: number, y: number][];\n /** Dash pattern for grid lines (0 = solid, positive = dashed) */\n strokeDasharray?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Unique identifier for the grid pattern definition\n * Static to ensure consistent referencing across instances\n */\nconst id = 'grid-pattern';\n\n/**\n * Grid Pattern Component\n *\n * A versatile SVG component that generates a repeating grid pattern background with\n * optional highlighted squares. Ideal for technical layouts, dashboards, design mockups,\n * and any interface requiring structured visual organization.\n *\n * Features:\n * - Scalable vector-based grid that renders crisp at any zoom level\n * - Customizable cell dimensions and spacing\n * - Optional square highlighting for emphasis or data visualization\n * - Configurable stroke patterns (solid or dashed lines)\n * - Theme-aware styling with automatic dark mode support\n * - Accessibility-friendly with screen reader exclusion\n * - Performance optimized with pointer events disabled\n * - Full container coverage with responsive sizing\n *\n * Technical Architecture:\n * - Uses SVG `<pattern>` for memory-efficient repetition\n * - Grid lines drawn with path elements for precision\n * - Highlighted squares rendered as separate rect elements\n * - Pattern coordinates use userSpaceOnUse for consistency\n * - Static pattern ID prevents conflicts between instances\n *\n * Visual Design:\n * - Default: 40x40px grid cells with subtle neutral strokes\n * - Light mode: 10% fill opacity, 15% stroke opacity\n * - Dark mode: Enhanced 30% stroke opacity for visibility\n * - Slight offset (-1px) for optimal line rendering\n * - Optional dashed lines for more subtle appearance\n *\n * Highlighted Squares:\n * - Defined by coordinate arrays [x, y] where x,y are grid positions\n * - Automatically sized to fit within grid cells (width-1, height-1)\n * - Positioned with 1px offset for visual separation from grid lines\n * - Inherit theme-based fill colors for consistency\n *\n * @example\n * Basic grid background:\n * ```tsx\n * <div className=\"relative min-h-screen\">\n * <GridPattern />\n * <div className=\"relative z-10\">\n * <h1>Content over grid</h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom grid size with dashed lines:\n * ```tsx\n * <GridPattern\n * width={60}\n * height={60}\n * strokeDasharray={2}\n * className=\"stroke-primary/20\"\n * />\n * ```\n *\n * @example\n * Data visualization with highlighted squares:\n * ```tsx\n * <GridPattern\n * width={30}\n * height={30}\n * squares={[\n * [0, 1], [1, 1], [2, 1],\n * [1, 2], [3, 0], [4, 2]\n * ]}\n * className=\"fill-accent/20 stroke-accent/30\"\n * />\n * ```\n *\n * @example\n * Fine grid for technical layouts:\n * ```tsx\n * <GridPattern\n * width={20}\n * height={20}\n * strokeDasharray={1}\n * className=\"stroke-neutral/8 fill-neutral/5\"\n * />\n * ```\n *\n * Styling Guidelines:\n * - Use low opacity values (5-30%) for background subtlety\n * - Consider theme contrast when customizing colors\n * - Dashed patterns work well for secondary grids\n * - Match grid colors with overall design system\n *\n * Performance Notes:\n * - Pattern definition reused efficiently across large areas\n * - Highlighted squares rendered individually for flexibility\n * - Pointer events disabled to prevent interaction blocking\n * - SVG optimized for browser rendering performance\n *\n * Accessibility:\n * - Hidden from screen readers with aria-hidden=\"true\"\n * - Purely decorative - doesn't convey essential information\n * - Maintains sufficient contrast with overlaid content\n *\n * @param props - GridPattern component props\n * @returns SVG element with repeating grid pattern and optional highlights\n */\nexport const GridPattern: FC<GridPatternProps> = ({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n squares,\n className,\n ...props\n}) => (\n <svg\n aria-hidden=\"true\"\n className={cn(\n 'fill-neutral/10 stroke-neutral/15 dark:stroke-neutral/30 pointer-events-none absolute inset-0 h-full max-h-full w-full',\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n);\n"],"names":["x","y"],"mappings":";;AA0BA,MAAM,KAAK;AA0GJ,MAAM,cAAoC,CAAC;AAAA,EAChD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAY;AAAA,IACZ,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA,oBAAC,QAAA,EACC,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAa;AAAA,UACb;AAAA,UACA;AAAA,UAEA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAG,OAAO,MAAM,OAAO,KAAK;AAAA,cAC5B,MAAK;AAAA,cACL;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA,GAEJ;AAAA,MACA,oBAAC,QAAA,EAAK,OAAM,QAAO,QAAO,QAAO,aAAa,GAAG,MAAM,QAAQ,EAAE,IAAA,CAAK;AAAA,MACrE,WACC,oBAAC,OAAA,EAAI,GAAM,GAAM,WAAU,oBACxB,UAAA,QAAQ,IAAI,CAAC,CAACA,IAAGC,EAAC,MACjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,aAAY;AAAA,UAEZ,OAAO,QAAQ;AAAA,UACf,QAAQ,SAAS;AAAA,UACjB,GAAGD,KAAI,QAAQ;AAAA,UACf,GAAGC,KAAI,SAAS;AAAA,QAAA;AAAA,QAJX,GAAGD,EAAC,IAAIC,EAAC;AAAA,MAAA,CAMjB,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotLight.cjs","sources":["../../../src/components/Pattern/SpotLight.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype SpotlightProps = {\n fill?: string;\n cx?: number;\n cy?: number;\n rx?: number;\n ry?: number;\n opacity?: number;\n} & SVGProps<SVGSVGElement>;\n\nexport const Spotlight: FC<SpotlightProps> = ({\n fill = 'currentColor',\n cy = 273.501,\n rx = 1924.71,\n ry = 273.501,\n cx = 1924.71,\n opacity = 0.21,\n className,\n ...props\n}) => (\n <svg\n className={cn(\n 'animate-spotlight size-screen pointer-events-none absolute opacity-0',\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 3787 2842\"\n fill=\"none\"\n {...props}\n >\n <g filter=\"url(#filter)\" transform=\"scale (-1, 1)\">\n <ellipse\n cx={cx}\n cy={cy}\n rx={rx}\n ry={ry}\n fill={fill}\n fillOpacity={opacity}\n transform=\"matrix(-0.822377 -0.568943 -0.568943 0.822377 3631.88 2291.09)\"\n ></ellipse>\n </g>\n <defs>\n <filter\n id=\"filter\"\n x=\"0.860352\"\n y=\"0.838989\"\n width=\"3785.16\"\n height=\"2840.26\"\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity=\"0\" result=\"BackgroundImageFix\"></feFlood>\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"BackgroundImageFix\"\n result=\"shape\"\n ></feBlend>\n <feGaussianBlur\n stdDeviation=\"151\"\n result=\"effect1_foregroundBlur_1065_8\"\n ></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n);\n"],"names":["jsxs","cn","jsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"SpotLight.cjs","sources":["../../../src/components/Pattern/SpotLight.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Spotlight component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype SpotlightProps = {\n /** Fill color for the spotlight effect (supports CSS color values) */\n fill?: string;\n /** X coordinate of the ellipse center */\n cx?: number;\n /** Y coordinate of the ellipse center */\n cy?: number;\n /** Horizontal radius of the ellipse */\n rx?: number;\n /** Vertical radius of the ellipse */\n ry?: number;\n /** Opacity of the spotlight effect (0-1) */\n opacity?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Spotlight Component\n *\n * A dramatic animated SVG spotlight effect that creates a soft, glowing light beam\n * perfect for hero sections, landing pages, and attention-grabbing areas. Features\n * a sophisticated blur filter and smooth animation entrance.\n *\n * Features:\n * - Animated entrance with opacity fade-in effect\n * - Gaussian blur filter for realistic light diffusion\n * - Customizable positioning, size, and color\n * - Full-screen coverage with responsive scaling\n * - Performance optimized with CSS animations\n * - Pointer events disabled to preserve interactivity\n * - Theme-aware with currentColor support\n *\n * Technical Implementation:\n * - Uses SVG ellipse with advanced filter effects\n * - Gaussian blur with 151px standard deviation for soft edges\n * - Matrix transformation for realistic light angle (-0.822377, -0.568943)\n * - ViewBox coordinates optimized for screen coverage (3787x2842)\n * - Animation class `animate-spotlight` handles entrance effect\n * - Filter definition with unique ID prevents conflicts\n *\n * Visual Characteristics:\n * - Default: Large elliptical light beam (1924.71px radius)\n * - Positioned at (1924.71, 273.501) with soft vertical spread\n * - 21% opacity for subtle but noticeable effect\n * - Rotated and scaled for natural spotlight angle\n * - Soft gaussian blur creates realistic light falloff\n *\n * Animation Behavior:\n * - Starts with opacity: 0 (invisible)\n * - Animates to full visibility with smooth transition\n * - Animation timing and easing handled by CSS class\n * - Can be triggered on scroll or interaction events\n *\n * @example\n * Basic hero section spotlight:\n * ```tsx\n * <div className=\"relative min-h-screen bg-dark\">\n * <Spotlight className=\"top-0 left-0\" />\n * <div className=\"relative z-10 flex items-center justify-center h-screen\">\n * <h1 className=\"text-6xl font-bold text-white\">\n * Welcome to the Future\n * </h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom colored spotlight:\n * ```tsx\n * <Spotlight\n * fill=\"#3b82f6\"\n * opacity={0.3}\n * className=\"top-10 -left-20\"\n * />\n * ```\n *\n * @example\n * Multiple spotlights for complex lighting:\n * ```tsx\n * <div className=\"relative\">\n * <Spotlight\n * cx={1000}\n * cy={300}\n * fill=\"rgb(59, 130, 246)\"\n * opacity={0.15}\n * />\n * <Spotlight\n * cx={2500}\n * cy={800}\n * fill=\"rgb(236, 72, 153)\"\n * opacity={0.15}\n * className=\"scale-75\"\n * />\n * </div>\n * ```\n *\n * @example\n * Responsive positioning:\n * ```tsx\n * <Spotlight\n * className=\"top-0 left-1/2 transform -translate-x-1/2 lg:left-0 lg:transform-none\"\n * opacity={0.25}\n * />\n * ```\n *\n * Styling Guidelines:\n * - Use low opacity (0.1-0.3) for subtle background effects\n * - Higher opacity (0.3-0.5) for dramatic focal points\n * - Consider theme colors when using custom fill values\n * - Position absolute with z-index management for layering\n *\n * Performance Considerations:\n * - SVG filter effects are GPU accelerated when possible\n * - Animation handled by CSS transforms for optimal performance\n * - Large viewBox size cached by browser for efficiency\n * - Pointer events disabled prevents layout recalculation\n *\n * Accessibility:\n * - Purely decorative - doesn't interfere with screen readers\n * - High contrast maintained with overlaid content\n * - Animation respects user's reduced motion preferences\n * - No semantic meaning - safe to hide from assistive tech\n *\n * CSS Requirements:\n * - Requires `animate-spotlight` animation class in Tailwind config\n * - Should define entrance animation timing and easing\n * - Consider defining custom animations for different effects\n *\n * @param props - Spotlight component props\n * @returns Animated SVG spotlight effect with blur filters\n */\nexport const Spotlight: FC<SpotlightProps> = ({\n fill = 'currentColor',\n cy = 273.501,\n rx = 1924.71,\n ry = 273.501,\n cx = 1924.71,\n opacity = 0.21,\n className,\n ...props\n}) => (\n <svg\n className={cn(\n 'animate-spotlight size-screen pointer-events-none absolute opacity-0',\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 3787 2842\"\n fill=\"none\"\n {...props}\n >\n <g filter=\"url(#filter)\" transform=\"scale (-1, 1)\">\n <ellipse\n cx={cx}\n cy={cy}\n rx={rx}\n ry={ry}\n fill={fill}\n fillOpacity={opacity}\n transform=\"matrix(-0.822377 -0.568943 -0.568943 0.822377 3631.88 2291.09)\"\n ></ellipse>\n </g>\n <defs>\n <filter\n id=\"filter\"\n x=\"0.860352\"\n y=\"0.838989\"\n width=\"3785.16\"\n height=\"2840.26\"\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity=\"0\" result=\"BackgroundImageFix\"></feFlood>\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"BackgroundImageFix\"\n result=\"shape\"\n ></feBlend>\n <feGaussianBlur\n stdDeviation=\"151\"\n result=\"effect1_foregroundBlur_1065_8\"\n ></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n);\n"],"names":["jsxs","cn","jsx"],"mappings":";;;;AAyIO,MAAM,YAAgC,CAAC;AAAA,EAC5C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MAAK;AAAA,IACJ,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAAA,IAAC,KAAA,EAAE,QAAO,gBAAe,WAAU,iBACjC,UAAAA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,aAAa;AAAA,UACb,WAAU;AAAA,QAAA;AAAA,MAAA,GAEd;AAAA,qCACC,QAAA,EACC,UAAAF,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAG;AAAA,UACH,GAAE;AAAA,UACF,GAAE;AAAA,UACF,OAAM;AAAA,UACN,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,2BAA0B;AAAA,UAE1B,UAAA;AAAA,YAAAE,2BAAAA,IAAC,WAAA,EAAQ,cAAa,KAAI,QAAO,sBAAqB;AAAA,YACtDA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,IAAG;AAAA,gBACH,KAAI;AAAA,gBACJ,QAAO;AAAA,cAAA;AAAA,YAAA;AAAA,YAETA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,cAAa;AAAA,gBACb,QAAO;AAAA,cAAA;AAAA,YAAA;AAAA,UACR;AAAA,QAAA;AAAA,MAAA,EACH,CACF;AAAA,IAAA;AAAA,EAAA;AACF;;"}
|
|
@@ -1,12 +1,137 @@
|
|
|
1
1
|
import { FC, SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Spotlight component
|
|
4
|
+
* Extends SVGProps to inherit all standard SVG attributes
|
|
5
|
+
*/
|
|
2
6
|
type SpotlightProps = {
|
|
7
|
+
/** Fill color for the spotlight effect (supports CSS color values) */
|
|
3
8
|
fill?: string;
|
|
9
|
+
/** X coordinate of the ellipse center */
|
|
4
10
|
cx?: number;
|
|
11
|
+
/** Y coordinate of the ellipse center */
|
|
5
12
|
cy?: number;
|
|
13
|
+
/** Horizontal radius of the ellipse */
|
|
6
14
|
rx?: number;
|
|
15
|
+
/** Vertical radius of the ellipse */
|
|
7
16
|
ry?: number;
|
|
17
|
+
/** Opacity of the spotlight effect (0-1) */
|
|
8
18
|
opacity?: number;
|
|
9
19
|
} & SVGProps<SVGSVGElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Spotlight Component
|
|
22
|
+
*
|
|
23
|
+
* A dramatic animated SVG spotlight effect that creates a soft, glowing light beam
|
|
24
|
+
* perfect for hero sections, landing pages, and attention-grabbing areas. Features
|
|
25
|
+
* a sophisticated blur filter and smooth animation entrance.
|
|
26
|
+
*
|
|
27
|
+
* Features:
|
|
28
|
+
* - Animated entrance with opacity fade-in effect
|
|
29
|
+
* - Gaussian blur filter for realistic light diffusion
|
|
30
|
+
* - Customizable positioning, size, and color
|
|
31
|
+
* - Full-screen coverage with responsive scaling
|
|
32
|
+
* - Performance optimized with CSS animations
|
|
33
|
+
* - Pointer events disabled to preserve interactivity
|
|
34
|
+
* - Theme-aware with currentColor support
|
|
35
|
+
*
|
|
36
|
+
* Technical Implementation:
|
|
37
|
+
* - Uses SVG ellipse with advanced filter effects
|
|
38
|
+
* - Gaussian blur with 151px standard deviation for soft edges
|
|
39
|
+
* - Matrix transformation for realistic light angle (-0.822377, -0.568943)
|
|
40
|
+
* - ViewBox coordinates optimized for screen coverage (3787x2842)
|
|
41
|
+
* - Animation class `animate-spotlight` handles entrance effect
|
|
42
|
+
* - Filter definition with unique ID prevents conflicts
|
|
43
|
+
*
|
|
44
|
+
* Visual Characteristics:
|
|
45
|
+
* - Default: Large elliptical light beam (1924.71px radius)
|
|
46
|
+
* - Positioned at (1924.71, 273.501) with soft vertical spread
|
|
47
|
+
* - 21% opacity for subtle but noticeable effect
|
|
48
|
+
* - Rotated and scaled for natural spotlight angle
|
|
49
|
+
* - Soft gaussian blur creates realistic light falloff
|
|
50
|
+
*
|
|
51
|
+
* Animation Behavior:
|
|
52
|
+
* - Starts with opacity: 0 (invisible)
|
|
53
|
+
* - Animates to full visibility with smooth transition
|
|
54
|
+
* - Animation timing and easing handled by CSS class
|
|
55
|
+
* - Can be triggered on scroll or interaction events
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* Basic hero section spotlight:
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <div className="relative min-h-screen bg-dark">
|
|
61
|
+
* <Spotlight className="top-0 left-0" />
|
|
62
|
+
* <div className="relative z-10 flex items-center justify-center h-screen">
|
|
63
|
+
* <h1 className="text-6xl font-bold text-white">
|
|
64
|
+
* Welcome to the Future
|
|
65
|
+
* </h1>
|
|
66
|
+
* </div>
|
|
67
|
+
* </div>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* Custom colored spotlight:
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Spotlight
|
|
74
|
+
* fill="#3b82f6"
|
|
75
|
+
* opacity={0.3}
|
|
76
|
+
* className="top-10 -left-20"
|
|
77
|
+
* />
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* Multiple spotlights for complex lighting:
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <div className="relative">
|
|
84
|
+
* <Spotlight
|
|
85
|
+
* cx={1000}
|
|
86
|
+
* cy={300}
|
|
87
|
+
* fill="rgb(59, 130, 246)"
|
|
88
|
+
* opacity={0.15}
|
|
89
|
+
* />
|
|
90
|
+
* <Spotlight
|
|
91
|
+
* cx={2500}
|
|
92
|
+
* cy={800}
|
|
93
|
+
* fill="rgb(236, 72, 153)"
|
|
94
|
+
* opacity={0.15}
|
|
95
|
+
* className="scale-75"
|
|
96
|
+
* />
|
|
97
|
+
* </div>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* Responsive positioning:
|
|
102
|
+
* ```tsx
|
|
103
|
+
* <Spotlight
|
|
104
|
+
* className="top-0 left-1/2 transform -translate-x-1/2 lg:left-0 lg:transform-none"
|
|
105
|
+
* opacity={0.25}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* Styling Guidelines:
|
|
110
|
+
* - Use low opacity (0.1-0.3) for subtle background effects
|
|
111
|
+
* - Higher opacity (0.3-0.5) for dramatic focal points
|
|
112
|
+
* - Consider theme colors when using custom fill values
|
|
113
|
+
* - Position absolute with z-index management for layering
|
|
114
|
+
*
|
|
115
|
+
* Performance Considerations:
|
|
116
|
+
* - SVG filter effects are GPU accelerated when possible
|
|
117
|
+
* - Animation handled by CSS transforms for optimal performance
|
|
118
|
+
* - Large viewBox size cached by browser for efficiency
|
|
119
|
+
* - Pointer events disabled prevents layout recalculation
|
|
120
|
+
*
|
|
121
|
+
* Accessibility:
|
|
122
|
+
* - Purely decorative - doesn't interfere with screen readers
|
|
123
|
+
* - High contrast maintained with overlaid content
|
|
124
|
+
* - Animation respects user's reduced motion preferences
|
|
125
|
+
* - No semantic meaning - safe to hide from assistive tech
|
|
126
|
+
*
|
|
127
|
+
* CSS Requirements:
|
|
128
|
+
* - Requires `animate-spotlight` animation class in Tailwind config
|
|
129
|
+
* - Should define entrance animation timing and easing
|
|
130
|
+
* - Consider defining custom animations for different effects
|
|
131
|
+
*
|
|
132
|
+
* @param props - Spotlight component props
|
|
133
|
+
* @returns Animated SVG spotlight effect with blur filters
|
|
134
|
+
*/
|
|
10
135
|
export declare const Spotlight: FC<SpotlightProps>;
|
|
11
136
|
export {};
|
|
12
137
|
//# sourceMappingURL=SpotLight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/SpotLight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1C,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE5B,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAuDxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../src/components/Pattern/SpotLight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1C;;;GAGG;AACH,KAAK,cAAc,GAAG;IACpB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkHG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAuDxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotLight.mjs","sources":["../../../src/components/Pattern/SpotLight.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\ntype SpotlightProps = {\n fill?: string;\n cx?: number;\n cy?: number;\n rx?: number;\n ry?: number;\n opacity?: number;\n} & SVGProps<SVGSVGElement>;\n\nexport const Spotlight: FC<SpotlightProps> = ({\n fill = 'currentColor',\n cy = 273.501,\n rx = 1924.71,\n ry = 273.501,\n cx = 1924.71,\n opacity = 0.21,\n className,\n ...props\n}) => (\n <svg\n className={cn(\n 'animate-spotlight size-screen pointer-events-none absolute opacity-0',\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 3787 2842\"\n fill=\"none\"\n {...props}\n >\n <g filter=\"url(#filter)\" transform=\"scale (-1, 1)\">\n <ellipse\n cx={cx}\n cy={cy}\n rx={rx}\n ry={ry}\n fill={fill}\n fillOpacity={opacity}\n transform=\"matrix(-0.822377 -0.568943 -0.568943 0.822377 3631.88 2291.09)\"\n ></ellipse>\n </g>\n <defs>\n <filter\n id=\"filter\"\n x=\"0.860352\"\n y=\"0.838989\"\n width=\"3785.16\"\n height=\"2840.26\"\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity=\"0\" result=\"BackgroundImageFix\"></feFlood>\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"BackgroundImageFix\"\n result=\"shape\"\n ></feBlend>\n <feGaussianBlur\n stdDeviation=\"151\"\n result=\"effect1_foregroundBlur_1065_8\"\n ></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n);\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"SpotLight.mjs","sources":["../../../src/components/Pattern/SpotLight.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Spotlight component\n * Extends SVGProps to inherit all standard SVG attributes\n */\ntype SpotlightProps = {\n /** Fill color for the spotlight effect (supports CSS color values) */\n fill?: string;\n /** X coordinate of the ellipse center */\n cx?: number;\n /** Y coordinate of the ellipse center */\n cy?: number;\n /** Horizontal radius of the ellipse */\n rx?: number;\n /** Vertical radius of the ellipse */\n ry?: number;\n /** Opacity of the spotlight effect (0-1) */\n opacity?: number;\n} & SVGProps<SVGSVGElement>;\n\n/**\n * Spotlight Component\n *\n * A dramatic animated SVG spotlight effect that creates a soft, glowing light beam\n * perfect for hero sections, landing pages, and attention-grabbing areas. Features\n * a sophisticated blur filter and smooth animation entrance.\n *\n * Features:\n * - Animated entrance with opacity fade-in effect\n * - Gaussian blur filter for realistic light diffusion\n * - Customizable positioning, size, and color\n * - Full-screen coverage with responsive scaling\n * - Performance optimized with CSS animations\n * - Pointer events disabled to preserve interactivity\n * - Theme-aware with currentColor support\n *\n * Technical Implementation:\n * - Uses SVG ellipse with advanced filter effects\n * - Gaussian blur with 151px standard deviation for soft edges\n * - Matrix transformation for realistic light angle (-0.822377, -0.568943)\n * - ViewBox coordinates optimized for screen coverage (3787x2842)\n * - Animation class `animate-spotlight` handles entrance effect\n * - Filter definition with unique ID prevents conflicts\n *\n * Visual Characteristics:\n * - Default: Large elliptical light beam (1924.71px radius)\n * - Positioned at (1924.71, 273.501) with soft vertical spread\n * - 21% opacity for subtle but noticeable effect\n * - Rotated and scaled for natural spotlight angle\n * - Soft gaussian blur creates realistic light falloff\n *\n * Animation Behavior:\n * - Starts with opacity: 0 (invisible)\n * - Animates to full visibility with smooth transition\n * - Animation timing and easing handled by CSS class\n * - Can be triggered on scroll or interaction events\n *\n * @example\n * Basic hero section spotlight:\n * ```tsx\n * <div className=\"relative min-h-screen bg-dark\">\n * <Spotlight className=\"top-0 left-0\" />\n * <div className=\"relative z-10 flex items-center justify-center h-screen\">\n * <h1 className=\"text-6xl font-bold text-white\">\n * Welcome to the Future\n * </h1>\n * </div>\n * </div>\n * ```\n *\n * @example\n * Custom colored spotlight:\n * ```tsx\n * <Spotlight\n * fill=\"#3b82f6\"\n * opacity={0.3}\n * className=\"top-10 -left-20\"\n * />\n * ```\n *\n * @example\n * Multiple spotlights for complex lighting:\n * ```tsx\n * <div className=\"relative\">\n * <Spotlight\n * cx={1000}\n * cy={300}\n * fill=\"rgb(59, 130, 246)\"\n * opacity={0.15}\n * />\n * <Spotlight\n * cx={2500}\n * cy={800}\n * fill=\"rgb(236, 72, 153)\"\n * opacity={0.15}\n * className=\"scale-75\"\n * />\n * </div>\n * ```\n *\n * @example\n * Responsive positioning:\n * ```tsx\n * <Spotlight\n * className=\"top-0 left-1/2 transform -translate-x-1/2 lg:left-0 lg:transform-none\"\n * opacity={0.25}\n * />\n * ```\n *\n * Styling Guidelines:\n * - Use low opacity (0.1-0.3) for subtle background effects\n * - Higher opacity (0.3-0.5) for dramatic focal points\n * - Consider theme colors when using custom fill values\n * - Position absolute with z-index management for layering\n *\n * Performance Considerations:\n * - SVG filter effects are GPU accelerated when possible\n * - Animation handled by CSS transforms for optimal performance\n * - Large viewBox size cached by browser for efficiency\n * - Pointer events disabled prevents layout recalculation\n *\n * Accessibility:\n * - Purely decorative - doesn't interfere with screen readers\n * - High contrast maintained with overlaid content\n * - Animation respects user's reduced motion preferences\n * - No semantic meaning - safe to hide from assistive tech\n *\n * CSS Requirements:\n * - Requires `animate-spotlight` animation class in Tailwind config\n * - Should define entrance animation timing and easing\n * - Consider defining custom animations for different effects\n *\n * @param props - Spotlight component props\n * @returns Animated SVG spotlight effect with blur filters\n */\nexport const Spotlight: FC<SpotlightProps> = ({\n fill = 'currentColor',\n cy = 273.501,\n rx = 1924.71,\n ry = 273.501,\n cx = 1924.71,\n opacity = 0.21,\n className,\n ...props\n}) => (\n <svg\n className={cn(\n 'animate-spotlight size-screen pointer-events-none absolute opacity-0',\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 3787 2842\"\n fill=\"none\"\n {...props}\n >\n <g filter=\"url(#filter)\" transform=\"scale (-1, 1)\">\n <ellipse\n cx={cx}\n cy={cy}\n rx={rx}\n ry={ry}\n fill={fill}\n fillOpacity={opacity}\n transform=\"matrix(-0.822377 -0.568943 -0.568943 0.822377 3631.88 2291.09)\"\n ></ellipse>\n </g>\n <defs>\n <filter\n id=\"filter\"\n x=\"0.860352\"\n y=\"0.838989\"\n width=\"3785.16\"\n height=\"2840.26\"\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity=\"0\" result=\"BackgroundImageFix\"></feFlood>\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"BackgroundImageFix\"\n result=\"shape\"\n ></feBlend>\n <feGaussianBlur\n stdDeviation=\"151\"\n result=\"effect1_foregroundBlur_1065_8\"\n ></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n);\n"],"names":[],"mappings":";;AAyIO,MAAM,YAAgC,CAAC;AAAA,EAC5C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MAAK;AAAA,IACJ,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA,oBAAC,KAAA,EAAE,QAAO,gBAAe,WAAU,iBACjC,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,aAAa;AAAA,UACb,WAAU;AAAA,QAAA;AAAA,MAAA,GAEd;AAAA,0BACC,QAAA,EACC,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAG;AAAA,UACH,GAAE;AAAA,UACF,GAAE;AAAA,UACF,OAAM;AAAA,UACN,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,2BAA0B;AAAA,UAE1B,UAAA;AAAA,YAAA,oBAAC,WAAA,EAAQ,cAAa,KAAI,QAAO,sBAAqB;AAAA,YACtD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,IAAG;AAAA,gBACH,KAAI;AAAA,gBACJ,QAAO;AAAA,cAAA;AAAA,YAAA;AAAA,YAET;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,cAAa;AAAA,gBACb,QAAO;AAAA,cAAA;AAAA,YAAA;AAAA,UACR;AAAA,QAAA;AAAA,MAAA,EACH,CACF;AAAA,IAAA;AAAA,EAAA;AACF;"}
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const utils_cn = require("../../utils/cn.cjs");
|
|
5
5
|
const components_Container_index = require("../Container/index.cjs");
|
|
6
|
+
var PopoverXAlign = /* @__PURE__ */ ((PopoverXAlign2) => {
|
|
7
|
+
PopoverXAlign2["START"] = "start";
|
|
8
|
+
PopoverXAlign2["END"] = "end";
|
|
9
|
+
return PopoverXAlign2;
|
|
10
|
+
})(PopoverXAlign || {});
|
|
11
|
+
var PopoverYAlign = /* @__PURE__ */ ((PopoverYAlign2) => {
|
|
12
|
+
PopoverYAlign2["BELOW"] = "bellow";
|
|
13
|
+
PopoverYAlign2["ABOVE"] = "above";
|
|
14
|
+
return PopoverYAlign2;
|
|
15
|
+
})(PopoverYAlign || {});
|
|
6
16
|
const Popover = ({
|
|
7
17
|
children,
|
|
8
18
|
className,
|
|
@@ -19,16 +29,6 @@ const Popover = ({
|
|
|
19
29
|
children
|
|
20
30
|
}
|
|
21
31
|
);
|
|
22
|
-
var PopoverXAlign = /* @__PURE__ */ ((PopoverXAlign2) => {
|
|
23
|
-
PopoverXAlign2["START"] = "start";
|
|
24
|
-
PopoverXAlign2["END"] = "end";
|
|
25
|
-
return PopoverXAlign2;
|
|
26
|
-
})(PopoverXAlign || {});
|
|
27
|
-
var PopoverYAlign = /* @__PURE__ */ ((PopoverYAlign2) => {
|
|
28
|
-
PopoverYAlign2["BELOW"] = "bellow";
|
|
29
|
-
PopoverYAlign2["ABOVE"] = "above";
|
|
30
|
-
return PopoverYAlign2;
|
|
31
|
-
})(PopoverYAlign || {});
|
|
32
32
|
const Detail = ({
|
|
33
33
|
children,
|
|
34
34
|
isHidden = void 0,
|