@theguild/components 8.2.0-alpha-20241217063907-238e21741010747e101b0097d2ea6aab424e94be → 8.2.0-alpha-20250103134229-59b7cae7900a3bc5e262bfbf14f9433af6cf3e73
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/components/dropdown.d.mts +2 -1
- package/dist/components/dropdown.js +16 -14
- package/dist/components/index.d.mts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/version-dropdown.d.mts +2 -1
- package/dist/components/version-dropdown.js +5 -5
- package/dist/index.d.mts +1 -0
- package/package.json +1 -1
|
@@ -2,8 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
|
|
3
3
|
interface DropdownProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
type: 'hover' | 'click';
|
|
5
6
|
}
|
|
6
|
-
declare function Dropdown({ children, className, ...props }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
declare function Dropdown({ children, className, type, ...props }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
7
8
|
interface DropdownTriggerProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
8
9
|
children: React.ReactNode;
|
|
9
10
|
}
|
|
@@ -9,7 +9,7 @@ function useDropdownContext() {
|
|
|
9
9
|
}
|
|
10
10
|
return context;
|
|
11
11
|
}
|
|
12
|
-
function Dropdown({ children, className, ...props }) {
|
|
12
|
+
function Dropdown({ children, className, type, ...props }) {
|
|
13
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
14
14
|
const [isHovering, setIsHovering] = useState(false);
|
|
15
15
|
const buttonId = useId();
|
|
@@ -55,18 +55,20 @@ function Dropdown({ children, className, ...props }) {
|
|
|
55
55
|
"div",
|
|
56
56
|
{
|
|
57
57
|
className: cn("relative", className),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
...type === "hover" && {
|
|
59
|
+
onPointerEnter: () => {
|
|
60
|
+
setIsOpen(true);
|
|
61
|
+
setIsHovering(true);
|
|
62
|
+
},
|
|
63
|
+
onPointerLeave: () => {
|
|
64
|
+
if (isHovering) {
|
|
65
|
+
setIsHovering(false);
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
if (!isHoveringRef.current) {
|
|
68
|
+
setIsOpen(false);
|
|
69
|
+
}
|
|
70
|
+
}, dismissDelayMs);
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
},
|
|
72
74
|
...props,
|
|
@@ -90,7 +92,7 @@ function DropdownTrigger({ children, className, ...props }) {
|
|
|
90
92
|
setIsOpen(true);
|
|
91
93
|
setIsHovering(false);
|
|
92
94
|
},
|
|
93
|
-
className: cn(className),
|
|
95
|
+
className: cn("cursor-pointer", className),
|
|
94
96
|
...props,
|
|
95
97
|
children
|
|
96
98
|
}
|
|
@@ -30,6 +30,7 @@ export { TextLink, TextLinkProps } from './text-link.mjs';
|
|
|
30
30
|
export { ContactButton, ContactButtonProps, ContactTextLink, ContactTextLinkProps } from './contact-us.mjs';
|
|
31
31
|
export { Giscus } from './giscus.mjs';
|
|
32
32
|
export { VersionDropdown, VersionDropdownProps } from './version-dropdown.mjs';
|
|
33
|
+
export { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from './dropdown.mjs';
|
|
33
34
|
export { GraphQLConfCard, GraphQLConfCardProps } from './hive-navigation/graphql-conf-card.mjs';
|
|
34
35
|
import 'react';
|
|
35
36
|
import 'url';
|
package/dist/components/index.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from "./dropdown";
|
|
4
4
|
function VersionDropdown({ currentVersion, versions }) {
|
|
5
|
-
return /* @__PURE__ */ jsxs(Dropdown, { className: "relative", children: [
|
|
5
|
+
return /* @__PURE__ */ jsxs(Dropdown, { type: "hover", className: "relative", children: [
|
|
6
6
|
/* @__PURE__ */ jsx(DropdownTrigger, { className: "hive-focus cursor-default rounded p-3 font-medium leading-normal text-green-800 aria-expanded:text-green-1000 dark:text-neutral-300 dark:aria-expanded:text-neutral-100", children: currentVersion }),
|
|
7
|
-
/* @__PURE__ */ jsx(DropdownContent, { className: "absolute
|
|
7
|
+
/* @__PURE__ */ jsx(DropdownContent, { className: "absolute left-full min-w-16 -translate-x-full translate-y-2 rounded-xl border border-beige-200 bg-white p-1 shadow-[0px_16px_32px_-12px_rgba(14,18,27,0.10)] transition ease-in-out data-[state=closed]:translate-y-0 data-[state=closed]:scale-95 data-[state=closed]:opacity-0 data-[state=open]:fade-in-90 dark:border-neutral-800 dark:bg-neutral-900", children: versions.map((version) => /* @__PURE__ */ jsx(
|
|
8
8
|
DropdownItem,
|
|
9
9
|
{
|
|
10
10
|
href: version.href,
|
|
11
11
|
onClick: version.onClick,
|
|
12
|
-
className: "block rounded p-2 text-
|
|
13
|
-
children: version.label
|
|
12
|
+
className: "block whitespace-nowrap rounded p-2 text-green-800 transition-colors hover:bg-beige-100 hover:text-green-1000 dark:text-neutral-300 dark:hover:bg-neutral-800/50 dark:hover:text-neutral-100",
|
|
13
|
+
children: version.label ?? version.value
|
|
14
14
|
},
|
|
15
|
-
version.
|
|
15
|
+
version.value
|
|
16
16
|
)) })
|
|
17
17
|
] });
|
|
18
18
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -33,6 +33,7 @@ export { TextLink, TextLinkProps } from './components/text-link.mjs';
|
|
|
33
33
|
export { ContactButton, ContactButtonProps, ContactTextLink, ContactTextLinkProps } from './components/contact-us.mjs';
|
|
34
34
|
export { Giscus } from './components/giscus.mjs';
|
|
35
35
|
export { VersionDropdown, VersionDropdownProps } from './components/version-dropdown.mjs';
|
|
36
|
+
export { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from './components/dropdown.mjs';
|
|
36
37
|
export { PRODUCTS } from './products.mjs';
|
|
37
38
|
export { IEditorProps, IFeatureListProps, IHeroGradientProps, IHeroIllustrationProps, IHeroMarketplaceProps, IHeroVideoProps, IInfoListProps, ILink, IMarketplaceItemProps, IMarketplaceItemsProps, IMarketplaceListProps, IMarketplaceSearchProps, ISchemaPageProps } from './types/components.mjs';
|
|
38
39
|
export { AngularLettermark, ConductorLettermark, ConfigLettermark, EnvelopLettermark, FetsLettermark, GraphQLESlintLettermark, HeltinLettermark, InspectorLettermark, KitQLLettermark, ModulesLettermark, SSELettermark, ScalarsLettermark, SofaLettermark, StitchingLettermark, ToolsLettermark, WSLettermark, WhatsAppLettermark } from './logos/index.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theguild/components",
|
|
3
|
-
"version": "8.2.0-alpha-
|
|
3
|
+
"version": "8.2.0-alpha-20250103134229-59b7cae7900a3bc5e262bfbf14f9433af6cf3e73",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/the-guild-org/docs",
|
|
6
6
|
"directory": "packages/components"
|