@gridui/dropdown-menu 0.0.0-stage → 1.0.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/README.md +23 -2
- package/dist/context-menu/context-menu.d.ts +17 -0
- package/dist/dropdown-menu/dropdown-menu.d.ts +10 -0
- package/dist/dropdown-menu-content/dropdown-menu-content.d.ts +10 -0
- package/dist/dropdown-menu-content/style.d.ts +7 -0
- package/dist/dropdown-menu-item/dropdown-menu-item.d.ts +10 -0
- package/dist/dropdown-menu-label/dropdown-menu-label.d.ts +10 -0
- package/dist/dropdown-menu-label/style.d.ts +7 -0
- package/dist/dropdown-menu-radio-group/dropdown-menu-radio-group.d.ts +8 -0
- package/dist/dropdown-menu-radio-item/dropdown-menu-radio-item.d.ts +10 -0
- package/dist/dropdown-menu-radio-item/style.d.ts +7 -0
- package/dist/dropdown-menu-trigger/dropdown-menu-trigger.d.ts +8 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +277 -0
- package/dist/index.js.map +7 -0
- package/dist/shared/style.d.ts +7 -0
- package/dist/styles.css +232 -0
- package/package.json +51 -3
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/dropdown-menu
|
|
2
|
+
|
|
3
|
+
Core family. Public API: `ContextMenu`, `ContextMenuProps`, `DropdownMenu`, `DropdownMenuContent`, `DropdownMenuContentProps`, `DropdownMenuItem`, `DropdownMenuItemProps`, `DropdownMenuLabel`, `DropdownMenuLabelProps`, `DropdownMenuProps`, `DropdownMenuRadioGroup`, `DropdownMenuRadioItem`, `DropdownMenuRadioItemProps`, `DropdownMenuTrigger`, `dropdownContentStyles`, `dropdownIndicatorStyles`, `dropdownItemStyles`, `dropdownLabelStyles`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/dropdown-menu` and load `@gridui/dropdown-menu/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
|
9
|
+
|
|
10
|
+
## Buttons and dropdown menus
|
|
11
|
+
|
|
12
|
+
Import `Button`, `ButtonLink`, `buttonClass`, `useAsyncAction`, and `downloadBlob`
|
|
13
|
+
from [`@gridui/button`](../button/README.md). Load that package's `styles.css`
|
|
14
|
+
for standalone buttons and actions composed by Controls. The Button package owns
|
|
15
|
+
native semantics, variants, sizes, icons, loading, and action lifecycle behavior.
|
|
16
|
+
Controls no longer contains or forwards those implementations.
|
|
17
|
+
|
|
18
|
+
`@gridui/dropdown-menu` wraps Radix Dropdown Menu.
|
|
19
|
+
It exports the root, trigger, portalled content, items, label, radio
|
|
20
|
+
group, and radio item. Native primitive props and refs remain available. Load
|
|
21
|
+
its separate `styles.css` export. Radix owns keyboard navigation, focus return,
|
|
22
|
+
Escape dismissal, and viewport collisions. The portal avoids clipped grid
|
|
23
|
+
boundaries.
|
|
2
24
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace ContextMenu
|
|
5
|
+
* @description Context Menu
|
|
6
|
+
*/
|
|
7
|
+
import { type DropdownMenuContentProps } from "../dropdown-menu-content/dropdown-menu-content";
|
|
8
|
+
import { type FC, type ReactNode } from "react";
|
|
9
|
+
export type ContextMenuProps = Omit<DropdownMenuContentProps, "children"> & {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly children: ReactNode;
|
|
14
|
+
readonly onClose: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** Uses the same menu semantics and presentation as trigger-based dropdowns. */
|
|
17
|
+
export declare const ContextMenu: FC<ContextMenuProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenu
|
|
5
|
+
* @description Dropdown Menu
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type DropdownMenuProps = ComponentPropsWithRef<typeof Primitive.Root>;
|
|
10
|
+
export declare const DropdownMenu: FC<DropdownMenuProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuContent
|
|
5
|
+
* @description Dropdown Menu Content
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type DropdownMenuContentProps = ComponentPropsWithRef<typeof Primitive.Content>;
|
|
10
|
+
export declare const DropdownMenuContent: FC<DropdownMenuContentProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuItem
|
|
5
|
+
* @description Dropdown Menu Item
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type DropdownMenuItemProps = ComponentPropsWithRef<typeof Primitive.Item>;
|
|
10
|
+
export declare const DropdownMenuItem: FC<DropdownMenuItemProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuLabel
|
|
5
|
+
* @description Dropdown Menu Label
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type DropdownMenuLabelProps = ComponentPropsWithRef<typeof Primitive.Label>;
|
|
10
|
+
export declare const DropdownMenuLabel: FC<DropdownMenuLabelProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuRadioGroup
|
|
5
|
+
* @description Dropdown Menu Radio Group
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
export declare const DropdownMenuRadioGroup: import("react").ForwardRefExoticComponent<Primitive.DropdownMenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuRadioItem
|
|
5
|
+
* @description Dropdown Menu Radio Item
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type DropdownMenuRadioItemProps = ComponentPropsWithRef<typeof Primitive.RadioItem>;
|
|
10
|
+
export declare const DropdownMenuRadioItem: FC<DropdownMenuRadioItemProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace DropdownMenuTrigger
|
|
5
|
+
* @description Dropdown Menu Trigger
|
|
6
|
+
*/
|
|
7
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
export declare const DropdownMenuTrigger: import("react").ForwardRefExoticComponent<Primitive.DropdownMenuTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Dropdown Menu
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { ContextMenuProps } from "./context-menu/context-menu";
|
|
8
|
+
export { ContextMenu } from "./context-menu/context-menu";
|
|
9
|
+
export type { DropdownMenuProps } from "./dropdown-menu/dropdown-menu";
|
|
10
|
+
export { DropdownMenu } from "./dropdown-menu/dropdown-menu";
|
|
11
|
+
export type { DropdownMenuContentProps } from "./dropdown-menu-content/dropdown-menu-content";
|
|
12
|
+
export { DropdownMenuContent } from "./dropdown-menu-content/dropdown-menu-content";
|
|
13
|
+
export { dropdownContentStyles } from "./dropdown-menu-content/style";
|
|
14
|
+
export type { DropdownMenuItemProps } from "./dropdown-menu-item/dropdown-menu-item";
|
|
15
|
+
export { DropdownMenuItem } from "./dropdown-menu-item/dropdown-menu-item";
|
|
16
|
+
export type { DropdownMenuLabelProps } from "./dropdown-menu-label/dropdown-menu-label";
|
|
17
|
+
export { DropdownMenuLabel } from "./dropdown-menu-label/dropdown-menu-label";
|
|
18
|
+
export { dropdownLabelStyles } from "./dropdown-menu-label/style";
|
|
19
|
+
export { DropdownMenuRadioGroup } from "./dropdown-menu-radio-group/dropdown-menu-radio-group";
|
|
20
|
+
export type { DropdownMenuRadioItemProps } from "./dropdown-menu-radio-item/dropdown-menu-radio-item";
|
|
21
|
+
export { DropdownMenuRadioItem } from "./dropdown-menu-radio-item/dropdown-menu-radio-item";
|
|
22
|
+
export { dropdownIndicatorStyles } from "./dropdown-menu-radio-item/style";
|
|
23
|
+
export { DropdownMenuTrigger } from "./dropdown-menu-trigger/dropdown-menu-trigger";
|
|
24
|
+
export { dropdownItemStyles } from "./shared/style";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// src/dropdown-menu/dropdown-menu.tsx
|
|
2
|
+
import { OverlayOpen, useOverlayState } from "@gridui/overlay";
|
|
3
|
+
import * as Primitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var DropdownMenu = (props) => {
|
|
6
|
+
const state = useOverlayState(props);
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
OverlayOpen.Provider,
|
|
9
|
+
{
|
|
10
|
+
value: state.open,
|
|
11
|
+
children: /* @__PURE__ */ jsx(
|
|
12
|
+
Primitive.Root,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
...state
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/dropdown-menu-content/style.ts
|
|
23
|
+
import { cn } from "@gridui/style-utils";
|
|
24
|
+
import { cva } from "class-variance-authority";
|
|
25
|
+
var dropdownContentStyles = cva(cn(
|
|
26
|
+
"gridui-dropdown-content",
|
|
27
|
+
"z-(--gridui-z-popover) min-w-44 max-w-[calc(100vw-2*var(--gridui-page-gutter))] max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-gridui-4 border border-solid border-border rounded-control text-foreground bg-background type-data",
|
|
28
|
+
"data-[state='closed']:pointer-events-none"
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
// src/dropdown-menu-content/dropdown-menu-content.tsx
|
|
32
|
+
import { RetainedLayer } from "@gridui/overlay";
|
|
33
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
34
|
+
import * as Primitive2 from "@radix-ui/react-dropdown-menu";
|
|
35
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
36
|
+
var DropdownMenuContent = (props) => {
|
|
37
|
+
const {
|
|
38
|
+
className,
|
|
39
|
+
forceMount,
|
|
40
|
+
sideOffset = 8,
|
|
41
|
+
align = "end",
|
|
42
|
+
...restProps
|
|
43
|
+
} = props;
|
|
44
|
+
const content = /* @__PURE__ */ jsx2(
|
|
45
|
+
Primitive2.Content,
|
|
46
|
+
{
|
|
47
|
+
...restProps,
|
|
48
|
+
forceMount,
|
|
49
|
+
align,
|
|
50
|
+
sideOffset,
|
|
51
|
+
className: cn2(dropdownContentStyles(), className)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ jsx2(
|
|
55
|
+
Primitive2.Portal,
|
|
56
|
+
{
|
|
57
|
+
forceMount,
|
|
58
|
+
children: forceMount ? /* @__PURE__ */ jsx2(RetainedLayer, { children: content }) : content
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/dropdown-menu-trigger/dropdown-menu-trigger.tsx
|
|
64
|
+
import * as Primitive3 from "@radix-ui/react-dropdown-menu";
|
|
65
|
+
var DropdownMenuTrigger = Primitive3.Trigger;
|
|
66
|
+
|
|
67
|
+
// src/context-menu/context-menu.tsx
|
|
68
|
+
import { useEffect, useState } from "react";
|
|
69
|
+
import { createPortal } from "react-dom";
|
|
70
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
71
|
+
var ContextMenu = (props) => {
|
|
72
|
+
const { x, y, label, children, onClose, onCloseAutoFocus, onKeyDown, ...contentProps } = props;
|
|
73
|
+
const [returnFocus] = useState(() => {
|
|
74
|
+
return typeof document === "undefined" ? null : document.activeElement;
|
|
75
|
+
});
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const dismissWhenInactive = () => {
|
|
78
|
+
if (!document.hasFocus()) {
|
|
79
|
+
onClose();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
window.addEventListener("blur", dismissWhenInactive);
|
|
83
|
+
return () => {
|
|
84
|
+
window.removeEventListener("blur", dismissWhenInactive);
|
|
85
|
+
};
|
|
86
|
+
}, [onClose]);
|
|
87
|
+
if (typeof document === "undefined") {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return createPortal(/* @__PURE__ */ jsxs(
|
|
91
|
+
DropdownMenu,
|
|
92
|
+
{
|
|
93
|
+
open: true,
|
|
94
|
+
modal: false,
|
|
95
|
+
onOpenChange: (open) => {
|
|
96
|
+
if (!open) {
|
|
97
|
+
onClose();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx3(
|
|
102
|
+
DropdownMenuTrigger,
|
|
103
|
+
{
|
|
104
|
+
asChild: true,
|
|
105
|
+
children: /* @__PURE__ */ jsx3(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
type: "button",
|
|
109
|
+
tabIndex: -1,
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
style: {
|
|
112
|
+
position: "fixed",
|
|
113
|
+
left: x,
|
|
114
|
+
top: y,
|
|
115
|
+
width: 0,
|
|
116
|
+
height: 0,
|
|
117
|
+
padding: 0,
|
|
118
|
+
border: 0,
|
|
119
|
+
opacity: 0,
|
|
120
|
+
pointerEvents: "none"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx3(
|
|
127
|
+
DropdownMenuContent,
|
|
128
|
+
{
|
|
129
|
+
"aria-label": label,
|
|
130
|
+
side: "bottom",
|
|
131
|
+
align: "start",
|
|
132
|
+
sideOffset: 0,
|
|
133
|
+
collisionPadding: 8,
|
|
134
|
+
...contentProps,
|
|
135
|
+
onCloseAutoFocus: (event) => {
|
|
136
|
+
onCloseAutoFocus?.(event);
|
|
137
|
+
if (event.defaultPrevented) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
if (document.activeElement === document.body && returnFocus instanceof HTMLElement && returnFocus.isConnected) {
|
|
142
|
+
returnFocus.focus();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
onKeyDown: (event) => {
|
|
146
|
+
onKeyDown?.(event);
|
|
147
|
+
if (!event.defaultPrevented && event.key === "Tab") {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
onClose();
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
children
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
`${x}:${y}`
|
|
158
|
+
), document.body);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/shared/style.ts
|
|
162
|
+
import { cn as cn3 } from "@gridui/style-utils";
|
|
163
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
164
|
+
var dropdownItemStyles = cva2(cn3(
|
|
165
|
+
"gridui-dropdown-item",
|
|
166
|
+
"flex min-h-10 items-center gap-gridui-8 px-gridui-8 py-gridui-8 rounded-xs text-inherit no-underline outline-none cursor-pointer",
|
|
167
|
+
"data-highlighted:bg-surface data-highlighted:[box-shadow:inset_0_0_0_1px_var(--gridui-border)]",
|
|
168
|
+
"data-disabled:opacity-50 data-disabled:pointer-events-none"
|
|
169
|
+
));
|
|
170
|
+
|
|
171
|
+
// src/dropdown-menu-item/dropdown-menu-item.tsx
|
|
172
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
173
|
+
import * as Primitive4 from "@radix-ui/react-dropdown-menu";
|
|
174
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
175
|
+
var DropdownMenuItem = (props) => {
|
|
176
|
+
const {
|
|
177
|
+
className,
|
|
178
|
+
...restProps
|
|
179
|
+
} = props;
|
|
180
|
+
return /* @__PURE__ */ jsx4(
|
|
181
|
+
Primitive4.Item,
|
|
182
|
+
{
|
|
183
|
+
...restProps,
|
|
184
|
+
className: cn4(dropdownItemStyles(), className)
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// src/dropdown-menu-label/style.ts
|
|
190
|
+
import { cn as cn5 } from "@gridui/style-utils";
|
|
191
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
192
|
+
var dropdownLabelStyles = cva3(cn5(
|
|
193
|
+
"gridui-dropdown-label",
|
|
194
|
+
"p-gridui-8 text-muted type-caption"
|
|
195
|
+
));
|
|
196
|
+
|
|
197
|
+
// src/dropdown-menu-label/dropdown-menu-label.tsx
|
|
198
|
+
import { cn as cn6 } from "@gridui/style-utils";
|
|
199
|
+
import * as Primitive5 from "@radix-ui/react-dropdown-menu";
|
|
200
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
201
|
+
var DropdownMenuLabel = (props) => {
|
|
202
|
+
const {
|
|
203
|
+
className,
|
|
204
|
+
...restProps
|
|
205
|
+
} = props;
|
|
206
|
+
return /* @__PURE__ */ jsx5(
|
|
207
|
+
Primitive5.Label,
|
|
208
|
+
{
|
|
209
|
+
...restProps,
|
|
210
|
+
className: cn6(dropdownLabelStyles(), className)
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/dropdown-menu-radio-group/dropdown-menu-radio-group.tsx
|
|
216
|
+
import * as Primitive6 from "@radix-ui/react-dropdown-menu";
|
|
217
|
+
var DropdownMenuRadioGroup = Primitive6.RadioGroup;
|
|
218
|
+
|
|
219
|
+
// src/dropdown-menu-radio-item/style.ts
|
|
220
|
+
import { cn as cn7 } from "@gridui/style-utils";
|
|
221
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
222
|
+
var dropdownIndicatorStyles = cva4(cn7(
|
|
223
|
+
"gridui-dropdown-indicator",
|
|
224
|
+
"w-gridui-16 shrink-0 text-foreground"
|
|
225
|
+
));
|
|
226
|
+
|
|
227
|
+
// src/dropdown-menu-radio-item/dropdown-menu-radio-item.tsx
|
|
228
|
+
import { cn as cn8 } from "@gridui/style-utils";
|
|
229
|
+
import * as Primitive7 from "@radix-ui/react-dropdown-menu";
|
|
230
|
+
import { Check } from "lucide-react";
|
|
231
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
232
|
+
var DropdownMenuRadioItem = (props) => {
|
|
233
|
+
const {
|
|
234
|
+
className,
|
|
235
|
+
children,
|
|
236
|
+
...restProps
|
|
237
|
+
} = props;
|
|
238
|
+
return /* @__PURE__ */ jsxs2(
|
|
239
|
+
Primitive7.RadioItem,
|
|
240
|
+
{
|
|
241
|
+
...restProps,
|
|
242
|
+
className: cn8(dropdownItemStyles(), className),
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ jsx6(
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
className: cn8(dropdownIndicatorStyles()),
|
|
248
|
+
"aria-hidden": "true",
|
|
249
|
+
children: /* @__PURE__ */ jsx6(Primitive7.ItemIndicator, { children: /* @__PURE__ */ jsx6(
|
|
250
|
+
Check,
|
|
251
|
+
{
|
|
252
|
+
size: 16,
|
|
253
|
+
"aria-hidden": "true"
|
|
254
|
+
}
|
|
255
|
+
) })
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
children
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
};
|
|
263
|
+
export {
|
|
264
|
+
ContextMenu,
|
|
265
|
+
DropdownMenu,
|
|
266
|
+
DropdownMenuContent,
|
|
267
|
+
DropdownMenuItem,
|
|
268
|
+
DropdownMenuLabel,
|
|
269
|
+
DropdownMenuRadioGroup,
|
|
270
|
+
DropdownMenuRadioItem,
|
|
271
|
+
DropdownMenuTrigger,
|
|
272
|
+
dropdownContentStyles,
|
|
273
|
+
dropdownIndicatorStyles,
|
|
274
|
+
dropdownItemStyles,
|
|
275
|
+
dropdownLabelStyles
|
|
276
|
+
};
|
|
277
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/dropdown-menu/dropdown-menu.tsx", "../src/dropdown-menu-content/style.ts", "../src/dropdown-menu-content/dropdown-menu-content.tsx", "../src/dropdown-menu-trigger/dropdown-menu-trigger.tsx", "../src/context-menu/context-menu.tsx", "../src/shared/style.ts", "../src/dropdown-menu-item/dropdown-menu-item.tsx", "../src/dropdown-menu-label/style.ts", "../src/dropdown-menu-label/dropdown-menu-label.tsx", "../src/dropdown-menu-radio-group/dropdown-menu-radio-group.tsx", "../src/dropdown-menu-radio-item/style.ts", "../src/dropdown-menu-radio-item/dropdown-menu-radio-item.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenu\n * @description Dropdown Menu\n */\n\nimport { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DropdownMenuProps = ComponentPropsWithRef<typeof Primitive.Root>;\n\nexport const DropdownMenu: FC<DropdownMenuProps> = (props: DropdownMenuProps) => {\n const state = useOverlayState(props);\n return (<OverlayOpen.Provider\n value={state.open}\n >\n <Primitive.Root\n {...props}\n {...state}\n />\n </OverlayOpen.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuContent\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dropdownContentStyles = cva(cn(\n \"gridui-dropdown-content\",\n \"z-(--gridui-z-popover) min-w-44 max-w-[calc(100vw-2*var(--gridui-page-gutter))] max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-gridui-4 border border-solid border-border rounded-control text-foreground bg-background type-data\",\n \"data-[state='closed']:pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuContent\n * @description Dropdown Menu Content\n */\n\nimport { dropdownContentStyles } from \"./style\";\nimport { RetainedLayer } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DropdownMenuContentProps = ComponentPropsWithRef<typeof Primitive.Content>;\n\nexport const DropdownMenuContent: FC<DropdownMenuContentProps> = (props: DropdownMenuContentProps) => {\n const {\n className,\n forceMount,\n sideOffset = 8,\n align = \"end\",\n ...restProps\n } = props;\n const content = (<Primitive.Content\n {...restProps}\n forceMount={forceMount}\n align={align}\n sideOffset={sideOffset}\n className={cn(dropdownContentStyles(), className)}\n />);\n return (<Primitive.Portal\n forceMount={forceMount}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuTrigger\n * @description Dropdown Menu Trigger\n */\n\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\n\nexport const DropdownMenuTrigger = Primitive.Trigger;\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace ContextMenu\n * @description Context Menu\n */\n\nimport { DropdownMenu } from \"../dropdown-menu/dropdown-menu\";\nimport { DropdownMenuContent, type DropdownMenuContentProps } from \"../dropdown-menu-content/dropdown-menu-content\";\nimport { DropdownMenuTrigger } from \"../dropdown-menu-trigger/dropdown-menu-trigger\";\nimport { type FC, type ReactNode, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type ContextMenuProps = Omit<DropdownMenuContentProps, \"children\"> & {\n readonly x: number;\n readonly y: number;\n readonly label: string;\n readonly children: ReactNode;\n readonly onClose: () => void;\n};\n\n/** Uses the same menu semantics and presentation as trigger-based dropdowns. */\nexport const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {\n const { x, y, label, children, onClose, onCloseAutoFocus, onKeyDown, ...contentProps } = props;\n\n const [returnFocus] = useState(() => {\n return typeof document === \"undefined\" ? null : document.activeElement;\n });\n useEffect(() => {\n\n const dismissWhenInactive = () => {\n\n if (!document.hasFocus()) {\n onClose();\n }\n };\n window.addEventListener(\"blur\", dismissWhenInactive);\n\n return () => {\n\n window.removeEventListener(\"blur\", dismissWhenInactive);\n };\n }, [onClose]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n return createPortal((<DropdownMenu\n key={`${x}:${y}`}\n open\n modal={false}\n onOpenChange={open => {\n\n if (!open) {\n onClose();\n }\n }}\n >\n <DropdownMenuTrigger\n asChild\n >\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n style={{\n position: \"fixed\",\n left: x,\n top: y,\n width: 0,\n height: 0,\n padding: 0,\n border: 0,\n opacity: 0,\n pointerEvents: \"none\",\n }}\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n aria-label={label}\n side=\"bottom\"\n align=\"start\"\n sideOffset={0}\n collisionPadding={8}\n {...contentProps}\n onCloseAutoFocus={event => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n if (document.activeElement === document.body\n && returnFocus instanceof HTMLElement\n && returnFocus.isConnected) {\n returnFocus.focus();\n }\n }}\n onKeyDown={event => {\n\n onKeyDown?.(event);\n if (!event.defaultPrevented && event.key === \"Tab\") {\n event.preventDefault();\n onClose();\n }\n }}\n >\n {children}\n </DropdownMenuContent>\n </DropdownMenu>), document.body);\n};\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace Shared\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dropdownItemStyles = cva(cn(\n \"gridui-dropdown-item\",\n \"flex min-h-10 items-center gap-gridui-8 px-gridui-8 py-gridui-8 rounded-xs text-inherit no-underline outline-none cursor-pointer\",\n \"data-highlighted:bg-surface data-highlighted:[box-shadow:inset_0_0_0_1px_var(--gridui-border)]\",\n \"data-disabled:opacity-50 data-disabled:pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuItem\n * @description Dropdown Menu Item\n */\n\nimport { dropdownItemStyles } from \"../shared/style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DropdownMenuItemProps = ComponentPropsWithRef<typeof Primitive.Item>;\n\nexport const DropdownMenuItem: FC<DropdownMenuItemProps> = (props: DropdownMenuItemProps) => {\n const {\n className,\n ...restProps\n } = props;\n return (<Primitive.Item\n {...restProps}\n className={cn(dropdownItemStyles(), className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuLabel\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dropdownLabelStyles = cva(cn(\n \"gridui-dropdown-label\",\n \"p-gridui-8 text-muted type-caption\",\n));\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuLabel\n * @description Dropdown Menu Label\n */\n\nimport { dropdownLabelStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DropdownMenuLabelProps = ComponentPropsWithRef<typeof Primitive.Label>;\n\nexport const DropdownMenuLabel: FC<DropdownMenuLabelProps> = (props: DropdownMenuLabelProps) => {\n const {\n className,\n ...restProps\n } = props;\n return (<Primitive.Label\n {...restProps}\n className={cn(dropdownLabelStyles(), className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuRadioGroup\n * @description Dropdown Menu Radio Group\n */\n\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\n\nexport const DropdownMenuRadioGroup = Primitive.RadioGroup;\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuRadioItem\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dropdownIndicatorStyles = cva(cn(\n \"gridui-dropdown-indicator\",\n \"w-gridui-16 shrink-0 text-foreground\",\n));\n", "/**\n * @author WMXPY\n * @package Dropdown Menu\n * @namespace DropdownMenuRadioItem\n * @description Dropdown Menu Radio Item\n */\n\nimport { dropdownItemStyles } from \"../shared/style\";\nimport { dropdownIndicatorStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check } from \"lucide-react\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DropdownMenuRadioItemProps = ComponentPropsWithRef<typeof Primitive.RadioItem>;\n\nexport const DropdownMenuRadioItem: FC<DropdownMenuRadioItemProps> = (props: DropdownMenuRadioItemProps) => {\n const {\n className,\n children,\n ...restProps\n } = props;\n return (<Primitive.RadioItem\n {...restProps}\n className={cn(dropdownItemStyles(), className)}\n >\n <span\n className={cn(dropdownIndicatorStyles())}\n aria-hidden=\"true\"\n >\n <Primitive.ItemIndicator>\n <Check\n size={16}\n aria-hidden=\"true\"\n />\n </Primitive.ItemIndicator>\n </span>\n {children}\n </Primitive.RadioItem>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,eAAe;AAUnB;AALD,IAAM,eAAsC,CAAC,UAA6B;AAC7E,QAAM,QAAQ,gBAAgB,KAAK;AACnC,SAAQ;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACL,OAAO,MAAM;AAAA,MAEb;AAAA,QAAW;AAAA,QAAV;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AAAA;AAAA,MACR;AAAA;AAAA,EACJ;AACJ;;;AChBA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,wBAAwB,IAAI;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACJ,CAAC;;;ACND,SAAS,qBAAqB;AAC9B,SAAS,MAAAA,WAAU;AACnB,YAAYC,gBAAe;AAaN,gBAAAC,YAAA;AARd,IAAM,sBAAoD,CAAC,UAAoC;AAClG,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,GAAG;AAAA,EACP,IAAI;AACJ,QAA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;AAAA;AAAA;AAAA,EACL;AACJ;",
|
|
6
|
+
"names": ["cn", "Primitive", "jsx", "Primitive", "jsx", "cn", "cva", "cn", "Primitive", "jsx", "cn", "cva", "cn", "Primitive", "jsx", "Primitive", "cn", "cva", "cn", "Primitive", "jsx", "jsxs"]
|
|
7
|
+
}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--spacing: 0.25rem;
|
|
7
|
+
--radius-xs: 0.125rem;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@layer utilities {
|
|
11
|
+
.fixed {
|
|
12
|
+
position: fixed;
|
|
13
|
+
}
|
|
14
|
+
.z-\(--gridui-z-popover\) {
|
|
15
|
+
z-index: var(--gridui-z-popover);
|
|
16
|
+
}
|
|
17
|
+
.flex {
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
.max-h-\(--radix-dropdown-menu-content-available-height\) {
|
|
21
|
+
max-height: var(--radix-dropdown-menu-content-available-height);
|
|
22
|
+
}
|
|
23
|
+
.min-h-10 {
|
|
24
|
+
min-height: calc(var(--spacing) * 10);
|
|
25
|
+
}
|
|
26
|
+
.w-gridui-16 {
|
|
27
|
+
width: var(--gridui-space-16);
|
|
28
|
+
}
|
|
29
|
+
.max-w-\[calc\(100vw-2\*var\(--gridui-page-gutter\)\)\] {
|
|
30
|
+
max-width: calc(100vw - 2 * var(--gridui-page-gutter));
|
|
31
|
+
}
|
|
32
|
+
.min-w-44 {
|
|
33
|
+
min-width: calc(var(--spacing) * 44);
|
|
34
|
+
}
|
|
35
|
+
.shrink-0 {
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
}
|
|
38
|
+
.cursor-pointer {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
.items-center {
|
|
42
|
+
align-items: center;
|
|
43
|
+
}
|
|
44
|
+
.gap-gridui-8 {
|
|
45
|
+
gap: var(--gridui-space-8);
|
|
46
|
+
}
|
|
47
|
+
.overflow-y-auto {
|
|
48
|
+
overflow-y: auto;
|
|
49
|
+
}
|
|
50
|
+
.rounded-control {
|
|
51
|
+
border-radius: var(--gridui-control-radius);
|
|
52
|
+
}
|
|
53
|
+
.rounded-xs {
|
|
54
|
+
border-radius: var(--radius-xs);
|
|
55
|
+
}
|
|
56
|
+
.border {
|
|
57
|
+
border-style: var(--tw-border-style);
|
|
58
|
+
border-width: 1px;
|
|
59
|
+
}
|
|
60
|
+
.border-solid {
|
|
61
|
+
--tw-border-style: solid;
|
|
62
|
+
border-style: solid;
|
|
63
|
+
}
|
|
64
|
+
.border-border {
|
|
65
|
+
border-color: var(--gridui-border);
|
|
66
|
+
}
|
|
67
|
+
.bg-background {
|
|
68
|
+
background-color: var(--gridui-background);
|
|
69
|
+
}
|
|
70
|
+
.p-gridui-4 {
|
|
71
|
+
padding: var(--gridui-space-4);
|
|
72
|
+
}
|
|
73
|
+
.p-gridui-8 {
|
|
74
|
+
padding: var(--gridui-space-8);
|
|
75
|
+
}
|
|
76
|
+
.px-gridui-8 {
|
|
77
|
+
padding-inline: var(--gridui-space-8);
|
|
78
|
+
}
|
|
79
|
+
.py-gridui-8 {
|
|
80
|
+
padding-block: var(--gridui-space-8);
|
|
81
|
+
}
|
|
82
|
+
.type-data {
|
|
83
|
+
font: var(--gridui-type-data);
|
|
84
|
+
letter-spacing: normal;
|
|
85
|
+
font-variant-numeric: tabular-nums;
|
|
86
|
+
}
|
|
87
|
+
.type-caption {
|
|
88
|
+
font: var(--gridui-type-caption);
|
|
89
|
+
letter-spacing: normal;
|
|
90
|
+
}
|
|
91
|
+
.text-foreground {
|
|
92
|
+
color: var(--gridui-foreground);
|
|
93
|
+
}
|
|
94
|
+
.text-inherit {
|
|
95
|
+
color: inherit;
|
|
96
|
+
}
|
|
97
|
+
.text-muted {
|
|
98
|
+
color: var(--gridui-muted);
|
|
99
|
+
}
|
|
100
|
+
.no-underline {
|
|
101
|
+
text-decoration-line: none;
|
|
102
|
+
}
|
|
103
|
+
.blur {
|
|
104
|
+
--tw-blur: blur(8px);
|
|
105
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
106
|
+
}
|
|
107
|
+
.outline-none {
|
|
108
|
+
--tw-outline-style: none;
|
|
109
|
+
outline-style: none;
|
|
110
|
+
}
|
|
111
|
+
.data-disabled\:pointer-events-none[data-disabled] {
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
}
|
|
114
|
+
.data-disabled\:opacity-50[data-disabled] {
|
|
115
|
+
opacity: 50%;
|
|
116
|
+
}
|
|
117
|
+
.data-highlighted\:bg-surface[data-highlighted] {
|
|
118
|
+
background-color: var(--gridui-surface);
|
|
119
|
+
}
|
|
120
|
+
.data-highlighted\:\[box-shadow\:inset_0_0_0_1px_var\(--gridui-border\)\][data-highlighted] {
|
|
121
|
+
box-shadow: inset 0 0 0 1px var(--gridui-border);
|
|
122
|
+
}
|
|
123
|
+
.data-\[state\=\'closed\'\]\:pointer-events-none[data-state='closed'] {
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
@layer components {
|
|
128
|
+
.gridui-dropdown-content {
|
|
129
|
+
transform-origin: var(--radix-dropdown-menu-content-transform-origin);
|
|
130
|
+
}
|
|
131
|
+
.gridui-dropdown-content[data-side="bottom"] {
|
|
132
|
+
--gridui-surface-offset-y: calc(-1 * var(--gridui-motion-distance));
|
|
133
|
+
}
|
|
134
|
+
.gridui-dropdown-content[data-side="top"] {
|
|
135
|
+
--gridui-surface-offset-y: var(--gridui-motion-distance);
|
|
136
|
+
}
|
|
137
|
+
.gridui-dropdown-content[data-side="left"] {
|
|
138
|
+
--gridui-surface-offset-x: var(--gridui-motion-distance);
|
|
139
|
+
}
|
|
140
|
+
.gridui-dropdown-content[data-side="right"] {
|
|
141
|
+
--gridui-surface-offset-x: calc(-1 * var(--gridui-motion-distance));
|
|
142
|
+
}
|
|
143
|
+
.gridui-dropdown-content[data-state="open"] {
|
|
144
|
+
animation: gridui-surface-enter var(--gridui-motion-duration-normal) var(--gridui-motion-ease-out) both;
|
|
145
|
+
}
|
|
146
|
+
.gridui-dropdown-content[data-state="closed"] {
|
|
147
|
+
animation: gridui-surface-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in) both;
|
|
148
|
+
}
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
.gridui-dropdown-content[data-state] {
|
|
151
|
+
animation: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
@property --tw-border-style {
|
|
156
|
+
syntax: "*";
|
|
157
|
+
inherits: false;
|
|
158
|
+
initial-value: solid;
|
|
159
|
+
}
|
|
160
|
+
@property --tw-blur {
|
|
161
|
+
syntax: "*";
|
|
162
|
+
inherits: false;
|
|
163
|
+
}
|
|
164
|
+
@property --tw-brightness {
|
|
165
|
+
syntax: "*";
|
|
166
|
+
inherits: false;
|
|
167
|
+
}
|
|
168
|
+
@property --tw-contrast {
|
|
169
|
+
syntax: "*";
|
|
170
|
+
inherits: false;
|
|
171
|
+
}
|
|
172
|
+
@property --tw-grayscale {
|
|
173
|
+
syntax: "*";
|
|
174
|
+
inherits: false;
|
|
175
|
+
}
|
|
176
|
+
@property --tw-hue-rotate {
|
|
177
|
+
syntax: "*";
|
|
178
|
+
inherits: false;
|
|
179
|
+
}
|
|
180
|
+
@property --tw-invert {
|
|
181
|
+
syntax: "*";
|
|
182
|
+
inherits: false;
|
|
183
|
+
}
|
|
184
|
+
@property --tw-opacity {
|
|
185
|
+
syntax: "*";
|
|
186
|
+
inherits: false;
|
|
187
|
+
}
|
|
188
|
+
@property --tw-saturate {
|
|
189
|
+
syntax: "*";
|
|
190
|
+
inherits: false;
|
|
191
|
+
}
|
|
192
|
+
@property --tw-sepia {
|
|
193
|
+
syntax: "*";
|
|
194
|
+
inherits: false;
|
|
195
|
+
}
|
|
196
|
+
@property --tw-drop-shadow {
|
|
197
|
+
syntax: "*";
|
|
198
|
+
inherits: false;
|
|
199
|
+
}
|
|
200
|
+
@property --tw-drop-shadow-color {
|
|
201
|
+
syntax: "*";
|
|
202
|
+
inherits: false;
|
|
203
|
+
}
|
|
204
|
+
@property --tw-drop-shadow-alpha {
|
|
205
|
+
syntax: "<percentage>";
|
|
206
|
+
inherits: false;
|
|
207
|
+
initial-value: 100%;
|
|
208
|
+
}
|
|
209
|
+
@property --tw-drop-shadow-size {
|
|
210
|
+
syntax: "*";
|
|
211
|
+
inherits: false;
|
|
212
|
+
}
|
|
213
|
+
@layer properties {
|
|
214
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
215
|
+
*, ::before, ::after, ::backdrop {
|
|
216
|
+
--tw-border-style: solid;
|
|
217
|
+
--tw-blur: initial;
|
|
218
|
+
--tw-brightness: initial;
|
|
219
|
+
--tw-contrast: initial;
|
|
220
|
+
--tw-grayscale: initial;
|
|
221
|
+
--tw-hue-rotate: initial;
|
|
222
|
+
--tw-invert: initial;
|
|
223
|
+
--tw-opacity: initial;
|
|
224
|
+
--tw-saturate: initial;
|
|
225
|
+
--tw-sepia: initial;
|
|
226
|
+
--tw-drop-shadow: initial;
|
|
227
|
+
--tw-drop-shadow-color: initial;
|
|
228
|
+
--tw-drop-shadow-alpha: 100%;
|
|
229
|
+
--tw-drop-shadow-size: initial;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/dropdown-menu",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridUI React dropdown menu",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/overlay": "^1.0.0",
|
|
30
|
+
"@gridui/style-utils": "^2.1.2",
|
|
31
|
+
"@gridui/theme": "^2.1.2",
|
|
32
|
+
"@radix-ui/react-dropdown-menu": "2.2.1",
|
|
33
|
+
"class-variance-authority": "0.7.1",
|
|
34
|
+
"lucide-react": "1.62.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
38
|
+
"@jest/globals": "30.5.2",
|
|
39
|
+
"@types/jest": "30.0.0",
|
|
40
|
+
"@types/node": "26.6.5",
|
|
41
|
+
"@types/react": "19.3.0",
|
|
42
|
+
"@types/react-dom": "19.3.0",
|
|
43
|
+
"jest": "30.5.2",
|
|
44
|
+
"react": "19.3.1",
|
|
45
|
+
"react-dom": "19.3.1",
|
|
46
|
+
"typescript": "6.0.3"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
50
|
+
"compile": "tsc --project tsconfig.json",
|
|
51
|
+
"test": "jest --passWithNoTests",
|
|
52
|
+
"coverage": "jest --coverage --passWithNoTests"
|
|
53
|
+
}
|
|
6
54
|
}
|