@cognitap/radiant 0.0.34 → 0.0.36
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/CHANGELOG.md +22 -8
- package/dist/library/ContextMenu.d.ts +38 -0
- package/dist/library/ContextMenu.d.ts.map +1 -0
- package/dist/library/ContextMenu.js +169 -0
- package/dist/library/ContextMenu.js.map +1 -0
- package/dist/library/HoverCard.d.ts +26 -0
- package/dist/library/HoverCard.d.ts.map +1 -0
- package/dist/library/HoverCard.js +89 -0
- package/dist/library/HoverCard.js.map +1 -0
- package/dist/library/Menu.d.ts +83 -3
- package/dist/library/Menu.d.ts.map +1 -1
- package/dist/library/Menu.js +209 -25
- package/dist/library/Menu.js.map +1 -1
- package/dist/library/Popover.d.ts +32 -3
- package/dist/library/Popover.d.ts.map +1 -1
- package/dist/library/Popover.js +34 -9
- package/dist/library/Popover.js.map +1 -1
- package/dist/library/Tooltip.d.ts.map +1 -1
- package/dist/library/Tooltip.js +10 -88
- package/dist/library/Tooltip.js.map +1 -1
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +2 -0
- package/dist/library/cn.js.map +1 -1
- package/dist/library/index.d.ts +6 -0
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +3 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/react/useHoverSurface.d.ts +18 -0
- package/dist/library/react/useHoverSurface.d.ts.map +1 -0
- package/dist/library/react/useHoverSurface.js +109 -0
- package/dist/library/react/useHoverSurface.js.map +1 -0
- package/dist/library/react/usePopoverSurface.d.ts +6 -1
- package/dist/library/react/usePopoverSurface.d.ts.map +1 -1
- package/dist/library/react/usePopoverSurface.js +27 -6
- package/dist/library/react/usePopoverSurface.js.map +1 -1
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/components.d.ts +6 -0
- package/dist/library/themes/components.d.ts.map +1 -1
- package/dist/library/themes/components.js +2 -0
- package/dist/library/themes/components.js.map +1 -1
- package/docs/architecture.md +35 -30
- package/package.json +1 -1
- package/src/ContextMenu.tsx +354 -0
- package/src/HoverCard.tsx +179 -0
- package/src/Menu.tsx +496 -40
- package/src/Popover.tsx +69 -14
- package/src/Tooltip.tsx +9 -80
- package/src/cn.ts +2 -0
- package/src/index.ts +72 -0
- package/src/react/useHoverSurface.ts +119 -0
- package/src/react/usePopoverSurface.ts +33 -6
- package/src/themes/components.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.0.36
|
|
8
|
+
|
|
9
|
+
- Add ContextMenu.
|
|
10
|
+
- Add Menu groups, labels and separators.
|
|
11
|
+
- Add checkable Menu items.
|
|
12
|
+
- Add Menu submenus.
|
|
13
|
+
- Add MenuItem.closeOnSelect.
|
|
14
|
+
|
|
15
|
+
## 0.0.35
|
|
16
|
+
|
|
17
|
+
- Add HoverCard.
|
|
18
|
+
- Track inline anchor text changes in popup placement.
|
|
19
|
+
- Keep popup portals outside phrasing-only hosts.
|
|
20
|
+
|
|
7
21
|
## 0.0.34
|
|
8
22
|
|
|
9
23
|
- Add Toolbar.
|
|
10
24
|
|
|
11
25
|
## 0.0.33
|
|
12
26
|
|
|
13
|
-
- Breaking: ButtonProps is
|
|
27
|
+
- Breaking: ButtonProps is a union. Before: `interface` extension. After: type intersection and distributive omission.
|
|
14
28
|
- Add ToggleGroup.
|
|
15
29
|
- Add Button pressed state, defaults and change requests.
|
|
16
30
|
|
|
@@ -105,23 +119,23 @@
|
|
|
105
119
|
|
|
106
120
|
## 0.0.10
|
|
107
121
|
|
|
108
|
-
- Add draggable Switch
|
|
122
|
+
- Add draggable Switch: Field, forms, sizing, themes.
|
|
109
123
|
|
|
110
124
|
## 0.0.9
|
|
111
125
|
|
|
112
|
-
- Add Textarea
|
|
126
|
+
- Add Textarea: Field, forms, themes, resizing.
|
|
113
127
|
|
|
114
128
|
## 0.0.8
|
|
115
129
|
|
|
116
|
-
- Add Select
|
|
130
|
+
- Add Select: item focus, Field/forms, themes, springs, stable trigger-width alignment.
|
|
117
131
|
|
|
118
132
|
## 0.0.7
|
|
119
133
|
|
|
120
|
-
- Breaking:
|
|
134
|
+
- Breaking: example themes moved from core. Before: `import { jelly, themes } from '@cognitap/radiant'`. After: `import { jelly, themes } from '@cognitap/radiant/examples'`. `defaultTheme` stays in core; `themeDefinitions` exposes example definitions.
|
|
121
135
|
|
|
122
|
-
- Reconcile pre-hydration disclosures: Collapsible adopts local changes once; controlled Collapsible
|
|
136
|
+
- Reconcile pre-hydration disclosures: Collapsible adopts local changes once; controlled Collapsible/Accordion restore ownership without requests.
|
|
123
137
|
|
|
124
|
-
- Align Card
|
|
138
|
+
- Align Card/compound-part minimum widths.
|
|
125
139
|
|
|
126
140
|
- Let Accordion shrink in narrow grid/flex layouts like Collapsible.
|
|
127
141
|
|
|
@@ -129,7 +143,7 @@
|
|
|
129
143
|
|
|
130
144
|
- Bound Dialog exits to two seconds/500 descendants; skip nested dialogs and customized built-ins.
|
|
131
145
|
|
|
132
|
-
- Wrap Radio/Checkbox labels
|
|
146
|
+
- Wrap Radio/Checkbox labels; retain indicator size.
|
|
133
147
|
|
|
134
148
|
- Release MotionLink springs on lost capture/removed destinations; preserve native navigation.
|
|
135
149
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { type MenuProps, type MenuState, type MenuPortalProps, type MenuContentProps, type MenuItemProps, type MenuGroupProps, type MenuLabelProps, type MenuSeparatorProps, type MenuCheckboxItemProps, type MenuRadioGroupProps, type MenuRadioItemProps, type MenuSubProps, type MenuSubTriggerProps, type MenuSubContentProps } from './Menu.js';
|
|
3
|
+
import { type AccessibleName } from './internal/accessibleName.js';
|
|
4
|
+
import type { ThemeStyle } from './themes/defineTheme.js';
|
|
5
|
+
export type ContextMenuProps = MenuProps;
|
|
6
|
+
export type ContextMenuState = MenuState;
|
|
7
|
+
export type ContextMenuTriggerProps = Omit<ComponentProps<'div'>, 'id' | 'role' | 'aria-haspopup' | 'aria-expanded' | 'aria-controls' | 'style'> & AccessibleName & {
|
|
8
|
+
style?: ThemeStyle;
|
|
9
|
+
'data-slot'?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ContextMenuPortalProps = MenuPortalProps;
|
|
12
|
+
export type ContextMenuContentProps = MenuContentProps;
|
|
13
|
+
export type ContextMenuItemProps = MenuItemProps;
|
|
14
|
+
export type ContextMenuGroupProps = MenuGroupProps;
|
|
15
|
+
export type ContextMenuLabelProps = MenuLabelProps;
|
|
16
|
+
export type ContextMenuSeparatorProps = MenuSeparatorProps;
|
|
17
|
+
export type ContextMenuCheckboxItemProps = MenuCheckboxItemProps;
|
|
18
|
+
export type ContextMenuRadioGroupProps = MenuRadioGroupProps;
|
|
19
|
+
export type ContextMenuRadioItemProps = MenuRadioItemProps;
|
|
20
|
+
export type ContextMenuSubProps = MenuSubProps;
|
|
21
|
+
export type ContextMenuSubTriggerProps = MenuSubTriggerProps;
|
|
22
|
+
export type ContextMenuSubContentProps = MenuSubContentProps;
|
|
23
|
+
export declare function useContextMenu(): ContextMenuState | null;
|
|
24
|
+
export declare function ContextMenu({ children, ...props }: ContextMenuProps): import("react").JSX.Element;
|
|
25
|
+
export declare function ContextMenuTrigger({ ref, className, tabIndex, onContextMenu, onKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onClickCapture, ...props }: ContextMenuTriggerProps): import("react").JSX.Element;
|
|
26
|
+
export declare function ContextMenuPortal(props: ContextMenuPortalProps): import("react").JSX.Element;
|
|
27
|
+
export declare function ContextMenuContent({ className, ...props }: ContextMenuContentProps): import("react").JSX.Element;
|
|
28
|
+
export declare function ContextMenuItem(props: ContextMenuItemProps): import("react").JSX.Element;
|
|
29
|
+
export declare function ContextMenuGroup(props: ContextMenuGroupProps): import("react").JSX.Element;
|
|
30
|
+
export declare function ContextMenuLabel(props: ContextMenuLabelProps): import("react").JSX.Element;
|
|
31
|
+
export declare function ContextMenuSeparator(props: ContextMenuSeparatorProps): import("react").JSX.Element;
|
|
32
|
+
export declare function ContextMenuCheckboxItem(props: ContextMenuCheckboxItemProps): import("react").JSX.Element;
|
|
33
|
+
export declare function ContextMenuRadioGroup(props: ContextMenuRadioGroupProps): import("react").JSX.Element;
|
|
34
|
+
export declare function ContextMenuRadioItem(props: ContextMenuRadioItemProps): import("react").JSX.Element;
|
|
35
|
+
export declare function ContextMenuSub(props: ContextMenuSubProps): import("react").JSX.Element;
|
|
36
|
+
export declare function ContextMenuSubTrigger(props: ContextMenuSubTriggerProps): import("react").JSX.Element;
|
|
37
|
+
export declare function ContextMenuSubContent({ className, ...props }: ContextMenuSubContentProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=ContextMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,OAAO,CAAA;AACd,OAAO,EAiBL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAIzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGzD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAA;AACxC,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAA;AACxC,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,cAAc,CAAC,K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AAe,CAAC,KAAK,EAAE,oBAAoB,+BAQ1D;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,+BAQ5D;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,+BAQ5D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,+BAQpE;AACD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,+BAQ1E;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,+BAQtE;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,+BAQpE;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAGxD;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,+BAQtE;AACD,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,0BAA0B,+BASxF"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { MenuRoot, useMenu, useMenuContext, useMenuFamily, MenuPortal, MenuContent, MenuItem, MenuGroup, MenuLabel, MenuSeparator, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSub, MenuSubTrigger, MenuSubContent } from './Menu.js';
|
|
5
|
+
import { usePopoverContext } from './Popover.js';
|
|
6
|
+
import { requireAccessibleName } from './internal/accessibleName.js';
|
|
7
|
+
import { joinIds } from './internal/ids.js';
|
|
8
|
+
import { cn } from './cn.js';
|
|
9
|
+
import { useComposedRefs } from './react/useComposedRefs.js';
|
|
10
|
+
const TargetContext = createContext(null);
|
|
11
|
+
export function useContextMenu() {
|
|
12
|
+
const menu = useMenu(), family = useMenuFamily();
|
|
13
|
+
return family === 'context-menu' ? menu : null;
|
|
14
|
+
}
|
|
15
|
+
function useTargetContext() {
|
|
16
|
+
const setPoint = useContext(TargetContext), family = useMenuFamily();
|
|
17
|
+
if (!setPoint || family !== 'context-menu')
|
|
18
|
+
throw new Error('ContextMenu parts must render inside ContextMenu.');
|
|
19
|
+
return setPoint;
|
|
20
|
+
}
|
|
21
|
+
export function ContextMenu({ children, ...props }) {
|
|
22
|
+
const [point, setPoint] = useState();
|
|
23
|
+
return (_jsx(MenuRoot, { ...props, family: "context-menu", parent: undefined, focusIntent: undefined, anchorPoint: point, children: _jsx(TargetContext.Provider, { value: setPoint, children: children }) }));
|
|
24
|
+
}
|
|
25
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role, jsx-a11y/no-noninteractive-element-interactions -- A named content group offers native context-menu invocation and a keyboard equivalent, not button activation. */
|
|
26
|
+
export function ContextMenuTrigger({ ref, className, tabIndex = 0, onContextMenu, onKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onClickCapture, ...props }) {
|
|
27
|
+
requireAccessibleName('ContextMenuTrigger', props);
|
|
28
|
+
const setPoint = useTargetContext(), menu = useMenuContext(), popover = usePopoverContext();
|
|
29
|
+
const host = useRef(null), own = useComposedRefs(popover.setTrigger, host), registered = useComposedRefs(menu.setTrigger, own), composed = useComposedRefs(registered, ref);
|
|
30
|
+
const pending = useRef(null), suppressClick = useRef(false);
|
|
31
|
+
const latest = useRef({ setPoint, menu });
|
|
32
|
+
useLayoutEffect(() => {
|
|
33
|
+
latest.current = { setPoint, menu };
|
|
34
|
+
});
|
|
35
|
+
const clear = () => {
|
|
36
|
+
if (pending.current)
|
|
37
|
+
pending.current.win.clearTimeout(pending.current.timer);
|
|
38
|
+
pending.current = null;
|
|
39
|
+
};
|
|
40
|
+
useLayoutEffect(() => () => {
|
|
41
|
+
if (pending.current)
|
|
42
|
+
pending.current.win.clearTimeout(pending.current.timer);
|
|
43
|
+
}, []);
|
|
44
|
+
const insideSurface = (target) => target instanceof host.current.ownerDocument.defaultView.Element &&
|
|
45
|
+
!!target.closest('[role="menu"]');
|
|
46
|
+
const openAt = (point) => {
|
|
47
|
+
latest.current.setPoint(point);
|
|
48
|
+
latest.current.menu.setIntent('first');
|
|
49
|
+
latest.current.menu.setOpen(true);
|
|
50
|
+
};
|
|
51
|
+
return (_jsx("div", { ...props, ref: composed, id: menu.triggerId, role: "group", tabIndex: tabIndex, "aria-haspopup": undefined, "aria-expanded": undefined, "data-state": menu.open ? 'open' : 'closed', "aria-controls": menu.contentId, "data-slot": joinIds('context-menu-trigger', props['data-slot']), className: cn('focus-visible:outline-solid focus-visible:[outline-color:var(--rad-color-focus,oklch(0.55_0.13_255))] focus-visible:[outline-width:var(--rad-focus-width,2px)] focus-visible:[outline-offset:var(--rad-focus-offset,2px)] forced-colors:focus-visible:outline-[Highlight]', className), onContextMenu: event => {
|
|
52
|
+
onContextMenu?.(event);
|
|
53
|
+
if (event.defaultPrevented)
|
|
54
|
+
return;
|
|
55
|
+
if (insideSurface(event.target))
|
|
56
|
+
return;
|
|
57
|
+
clear();
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
openAt({ x: event.clientX, y: event.clientY });
|
|
60
|
+
}, onKeyDown: event => {
|
|
61
|
+
onKeyDown?.(event);
|
|
62
|
+
if (event.defaultPrevented)
|
|
63
|
+
return;
|
|
64
|
+
if (insideSurface(event.target) ||
|
|
65
|
+
event.nativeEvent.isComposing ||
|
|
66
|
+
event.altKey ||
|
|
67
|
+
event.ctrlKey ||
|
|
68
|
+
event.metaKey ||
|
|
69
|
+
!(event.key === 'ContextMenu' || (event.key === 'F10' && event.shiftKey)))
|
|
70
|
+
return;
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
clear();
|
|
73
|
+
const doc = event.currentTarget.ownerDocument, focused = doc.activeElement, target = focused instanceof doc.defaultView.HTMLElement && event.currentTarget.contains(focused)
|
|
74
|
+
? focused
|
|
75
|
+
: event.currentTarget, rect = target.getBoundingClientRect(), rtl = doc.defaultView.getComputedStyle(target).direction === 'rtl';
|
|
76
|
+
openAt({ x: rtl ? rect.right : rect.left, y: rect.bottom });
|
|
77
|
+
}, onPointerDown: event => {
|
|
78
|
+
suppressClick.current = false;
|
|
79
|
+
clear();
|
|
80
|
+
onPointerDown?.(event);
|
|
81
|
+
if (event.defaultPrevented ||
|
|
82
|
+
event.pointerType !== 'touch' ||
|
|
83
|
+
!event.isPrimary ||
|
|
84
|
+
insideSurface(event.target))
|
|
85
|
+
return;
|
|
86
|
+
const win = event.currentTarget.ownerDocument.defaultView, x = event.clientX, y = event.clientY, pointer = event.pointerId;
|
|
87
|
+
pending.current = {
|
|
88
|
+
win,
|
|
89
|
+
x,
|
|
90
|
+
y,
|
|
91
|
+
pointer,
|
|
92
|
+
timer: win.setTimeout(() => {
|
|
93
|
+
pending.current = null;
|
|
94
|
+
suppressClick.current = true;
|
|
95
|
+
openAt({ x, y });
|
|
96
|
+
}, 500)
|
|
97
|
+
};
|
|
98
|
+
}, onPointerMove: event => {
|
|
99
|
+
onPointerMove?.(event);
|
|
100
|
+
const press = pending.current;
|
|
101
|
+
if (press &&
|
|
102
|
+
event.pointerId === press.pointer &&
|
|
103
|
+
Math.hypot(event.clientX - press.x, event.clientY - press.y) > 10)
|
|
104
|
+
clear();
|
|
105
|
+
}, onPointerUp: event => {
|
|
106
|
+
onPointerUp?.(event);
|
|
107
|
+
clear();
|
|
108
|
+
}, onPointerCancel: event => {
|
|
109
|
+
onPointerCancel?.(event);
|
|
110
|
+
clear();
|
|
111
|
+
}, onClickCapture: event => {
|
|
112
|
+
onClickCapture?.(event);
|
|
113
|
+
if (suppressClick.current) {
|
|
114
|
+
suppressClick.current = false;
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
}
|
|
118
|
+
} }));
|
|
119
|
+
}
|
|
120
|
+
/* oxlint-enable jsx-a11y/prefer-tag-over-role, jsx-a11y/no-noninteractive-element-interactions */
|
|
121
|
+
export function ContextMenuPortal(props) {
|
|
122
|
+
useTargetContext();
|
|
123
|
+
return _jsx(MenuPortal, { ...props });
|
|
124
|
+
}
|
|
125
|
+
export function ContextMenuContent({ className, ...props }) {
|
|
126
|
+
useTargetContext();
|
|
127
|
+
return (_jsx(MenuContent, { ...props, sideOffset: props.sideOffset ?? 0, "data-slot": joinIds('context-menu-content', props['data-slot']), className: cn('w-[var(--rad-context-menu-width,var(--rad-menu-width,16rem))]', className) }));
|
|
128
|
+
}
|
|
129
|
+
export function ContextMenuItem(props) {
|
|
130
|
+
useTargetContext();
|
|
131
|
+
return (_jsx(MenuItem, { ...props, "data-slot": joinIds('context-menu-item', props['data-slot']) }));
|
|
132
|
+
}
|
|
133
|
+
export function ContextMenuGroup(props) {
|
|
134
|
+
useTargetContext();
|
|
135
|
+
return (_jsx(MenuGroup, { ...props, "data-slot": joinIds('context-menu-group', props['data-slot']) }));
|
|
136
|
+
}
|
|
137
|
+
export function ContextMenuLabel(props) {
|
|
138
|
+
useTargetContext();
|
|
139
|
+
return (_jsx(MenuLabel, { ...props, "data-slot": joinIds('context-menu-label', props['data-slot']) }));
|
|
140
|
+
}
|
|
141
|
+
export function ContextMenuSeparator(props) {
|
|
142
|
+
useTargetContext();
|
|
143
|
+
return (_jsx(MenuSeparator, { ...props, "data-slot": joinIds('context-menu-separator', props['data-slot']) }));
|
|
144
|
+
}
|
|
145
|
+
export function ContextMenuCheckboxItem(props) {
|
|
146
|
+
useTargetContext();
|
|
147
|
+
return (_jsx(MenuCheckboxItem, { ...props, "data-slot": joinIds('context-menu-checkbox-item', props['data-slot']) }));
|
|
148
|
+
}
|
|
149
|
+
export function ContextMenuRadioGroup(props) {
|
|
150
|
+
useTargetContext();
|
|
151
|
+
return (_jsx(MenuRadioGroup, { ...props, "data-slot": joinIds('context-menu-radio-group', props['data-slot']) }));
|
|
152
|
+
}
|
|
153
|
+
export function ContextMenuRadioItem(props) {
|
|
154
|
+
useTargetContext();
|
|
155
|
+
return (_jsx(MenuRadioItem, { ...props, "data-slot": joinIds('context-menu-radio-item', props['data-slot']) }));
|
|
156
|
+
}
|
|
157
|
+
export function ContextMenuSub(props) {
|
|
158
|
+
useTargetContext();
|
|
159
|
+
return _jsx(MenuSub, { ...props });
|
|
160
|
+
}
|
|
161
|
+
export function ContextMenuSubTrigger(props) {
|
|
162
|
+
useTargetContext();
|
|
163
|
+
return (_jsx(MenuSubTrigger, { ...props, "data-slot": joinIds('context-menu-sub-trigger', props['data-slot']) }));
|
|
164
|
+
}
|
|
165
|
+
export function ContextMenuSubContent({ className, ...props }) {
|
|
166
|
+
useTargetContext();
|
|
167
|
+
return (_jsx(MenuSubContent, { ...props, "data-slot": joinIds('context-menu-sub-content', props['data-slot']), className: cn('w-[var(--rad-context-menu-width,var(--rad-menu-width,16rem))]', className) }));
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../src/ContextMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACL,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,QAAQ,EAET,MAAM,OAAO,CAAA;AACd,OAAO,EACL,QAAQ,EACR,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,OAAO,EACP,cAAc,EACd,cAAc,EAef,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAuB,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAuB5D,MAAM,aAAa,GAAG,aAAa,CAAkC,IAAI,CAAC,CAAA;AA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|
+
import { type LinkProps, type LinkRenderProps } from './Link.js';
|
|
3
|
+
import { type PopoverProps, type PopoverState, type PopoverContentProps } from './Popover.js';
|
|
4
|
+
export type HoverCardProps = PopoverProps & {
|
|
5
|
+
openDelay?: number;
|
|
6
|
+
closeDelay?: number;
|
|
7
|
+
};
|
|
8
|
+
export type HoverCardState = PopoverState;
|
|
9
|
+
export type HoverCardRenderProps = Omit<LinkRenderProps, 'data-slot'> & {
|
|
10
|
+
'data-slot': string;
|
|
11
|
+
};
|
|
12
|
+
export type HoverCardTriggerProps = Omit<LinkProps, 'href' | 'render' | 'aria-controls' | 'aria-expanded'> & {
|
|
13
|
+
href: string;
|
|
14
|
+
render?: (props: HoverCardRenderProps) => ReturnType<NonNullable<LinkProps['render']>>;
|
|
15
|
+
'data-slot'?: string;
|
|
16
|
+
};
|
|
17
|
+
export type HoverCardContentProps = Omit<PopoverContentProps, 'initialFocusRef'>;
|
|
18
|
+
export type HoverCardPortalProps = {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare function useHoverCard(): HoverCardState | null;
|
|
22
|
+
export declare function HoverCard({ openDelay, closeDelay, children, ...props }: HoverCardProps): import("react").JSX.Element;
|
|
23
|
+
export declare function HoverCardTrigger({ ref, render, onFocus, onBlur, onPointerEnter, onPointerLeave, onPointerDown, onClick, ...props }: HoverCardTriggerProps): import("react").JSX.Element;
|
|
24
|
+
export declare function HoverCardPortal(props: HoverCardPortalProps): import("react").JSX.Element;
|
|
25
|
+
export declare function HoverCardContent({ className, onPointerEnter, onPointerLeave, onFocus, onBlur, ...props }: HoverCardContentProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=HoverCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO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CvB;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAG1D;AACD,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,qBAAqB,+BA6BvB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { Link } from './Link.js';
|
|
5
|
+
import { Popover, PopoverPortal, PopoverContentRoot, usePopoverContext } from './Popover.js';
|
|
6
|
+
import { useComposedRefs } from './react/useComposedRefs.js';
|
|
7
|
+
import { useHoverSurface } from './react/useHoverSurface.js';
|
|
8
|
+
import { composeAction } from './internal/events.js';
|
|
9
|
+
import { joinIds } from './internal/ids.js';
|
|
10
|
+
import { cn } from './cn.js';
|
|
11
|
+
const HoverCardContext = createContext(null);
|
|
12
|
+
export function useHoverCard() {
|
|
13
|
+
return useContext(HoverCardContext);
|
|
14
|
+
}
|
|
15
|
+
function useHoverCardContext() {
|
|
16
|
+
const card = useContext(HoverCardContext);
|
|
17
|
+
if (!card)
|
|
18
|
+
throw new Error('HoverCard parts must render inside HoverCard.');
|
|
19
|
+
return card;
|
|
20
|
+
}
|
|
21
|
+
export function HoverCard({ openDelay = 500, closeDelay = 150, children, ...props }) {
|
|
22
|
+
if (![openDelay, closeDelay].every(n => Number.isFinite(n) && n >= 0))
|
|
23
|
+
throw new TypeError('HoverCard delays must be finite, nonnegative numbers.');
|
|
24
|
+
return (_jsx(Popover, { ...props, children: _jsx(HoverCardOwner, { openDelay: openDelay, closeDelay: closeDelay, children: children }) }));
|
|
25
|
+
}
|
|
26
|
+
function HoverCardOwner({ children, openDelay, closeDelay }) {
|
|
27
|
+
const card = usePopoverContext();
|
|
28
|
+
const hover = useHoverSurface({
|
|
29
|
+
trigger: card.trigger,
|
|
30
|
+
content: card.content,
|
|
31
|
+
open: card.open,
|
|
32
|
+
request: card.setOpen,
|
|
33
|
+
openDelay,
|
|
34
|
+
focusDelay: openDelay,
|
|
35
|
+
closeDelay
|
|
36
|
+
});
|
|
37
|
+
return (_jsx(HoverCardContext.Provider, { value: { ...card, ...hover }, children: children }));
|
|
38
|
+
}
|
|
39
|
+
export function HoverCardTrigger({ ref, render, onFocus, onBlur, onPointerEnter, onPointerLeave, onPointerDown, onClick, ...props }) {
|
|
40
|
+
if (typeof props.href !== 'string')
|
|
41
|
+
throw new TypeError('HoverCardTrigger requires a navigation href.');
|
|
42
|
+
const card = useHoverCardContext(), host = useComposedRefs(card.setTrigger, ref);
|
|
43
|
+
return (_jsx(Link, { ...props, ref: host, "aria-controls": card.contentId, "aria-expanded": card.open, render: resolved => {
|
|
44
|
+
const scoped = {
|
|
45
|
+
...resolved,
|
|
46
|
+
'data-slot': joinIds('link', 'hover-card-trigger', props['data-slot']) ?? 'link hover-card-trigger'
|
|
47
|
+
};
|
|
48
|
+
return render ? render(scoped) : _jsx("a", { ...scoped, children: scoped.children });
|
|
49
|
+
}, onFocus: composeAction(onFocus, () => card.enter(true)), onBlur: event => {
|
|
50
|
+
onBlur?.(event);
|
|
51
|
+
const next = event.relatedTarget;
|
|
52
|
+
if (next instanceof event.currentTarget.ownerDocument.defaultView.Node &&
|
|
53
|
+
card.content.current?.contains(next))
|
|
54
|
+
return;
|
|
55
|
+
card.leave(true);
|
|
56
|
+
}, onPointerEnter: composeAction(onPointerEnter, event => {
|
|
57
|
+
if (event.pointerType !== 'touch')
|
|
58
|
+
card.enter();
|
|
59
|
+
}), onPointerLeave: composeAction(onPointerLeave, event => {
|
|
60
|
+
if (event.pointerType !== 'touch')
|
|
61
|
+
card.leave();
|
|
62
|
+
}), onPointerDown: event => {
|
|
63
|
+
onPointerDown?.(event);
|
|
64
|
+
if (event.pointerType === 'touch')
|
|
65
|
+
card.touch();
|
|
66
|
+
}, onClick: composeAction(onClick, card.dismiss) }));
|
|
67
|
+
}
|
|
68
|
+
export function HoverCardPortal(props) {
|
|
69
|
+
useHoverCardContext();
|
|
70
|
+
return _jsx(PopoverPortal, { ...props });
|
|
71
|
+
}
|
|
72
|
+
export function HoverCardContent({ className, onPointerEnter, onPointerLeave, onFocus, onBlur, ...props }) {
|
|
73
|
+
const card = useHoverCardContext();
|
|
74
|
+
return (_jsx(PopoverContentRoot, { onFocusOutside: () => card.leave(true), ...props, initialFocusRef: undefined, "data-slot": joinIds('hover-card-content', props['data-slot']), className: cn('w-[var(--rad-hover-card-width,var(--rad-popover-width,20rem))]', className), onPointerEnter: composeAction(onPointerEnter, event => {
|
|
75
|
+
if (event.pointerType !== 'touch')
|
|
76
|
+
card.enter();
|
|
77
|
+
}), onPointerLeave: composeAction(onPointerLeave, event => {
|
|
78
|
+
if (event.pointerType !== 'touch')
|
|
79
|
+
card.leave();
|
|
80
|
+
}), onFocus: composeAction(onFocus, () => card.enter(true)), onBlur: event => {
|
|
81
|
+
onBlur?.(event);
|
|
82
|
+
const next = event.relatedTarget, node = event.currentTarget;
|
|
83
|
+
if (next instanceof node.ownerDocument.defaultView.Node &&
|
|
84
|
+
(node.contains(next) || card.trigger?.contains(next)))
|
|
85
|
+
return;
|
|
86
|
+
card.leave(true);
|
|
87
|
+
} }));
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=HoverCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverCard.js","sourceRoot":"","sources":["../../src/HoverCard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,IAAI,EAAwC,MAAM,WAAW,CAAA;AACtE,OAAO,EACL,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE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,eAAe,EAAE,SAAS,eACf,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,EAC5D,SAAS,EAAE,EAAE,CAAC,gEAAgE,EAAE,SAAS,CAAC,EAC1F,cAAc,EAAE,aAAa,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAA;QACjD,CAAC,CAAC,EACF,cAAc,EAAE,aAAa,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAA;QACjD,CAAC,CAAC,EACF,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EACvD,MAAM,EAAE,KAAK,CAAC,EAAE;YACd,MAAM,EAAE,CAAC,KAAK,CAAC,CAAA;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,EAC9B,IAAI,GAAG,KAAK,CAAC,aAAa,CAAA;YAC5B,IACE,IAAI,YAAY,IAAI,CAAC,aAAa,CAAC,WAAY,CAAC,IAAI;gBACpD,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAErD,OAAM;YACR,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAClB,CAAC,GACD,CACH,CAAA;AACH,CAAC"}
|
package/dist/library/Menu.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { type MouseEvent, type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentProps, type MouseEvent, type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import { type PopoverProps, type PopoverState, type PopoverContentProps } from './Popover.js';
|
|
3
3
|
import type { ButtonProps, ButtonRenderProps } from './Button.js';
|
|
4
4
|
import type { DistributiveOmit } from './internal/types.js';
|
|
5
|
+
import { type SeparatorProps } from './Separator.js';
|
|
6
|
+
import type { ValueOwner } from './react/useNativeOwner.js';
|
|
7
|
+
import type { ThemeStyle } from './themes/defineTheme.js';
|
|
8
|
+
import type { PartStyle } from './presentation.js';
|
|
5
9
|
export type MenuProps = PopoverProps;
|
|
6
10
|
export type MenuState = PopoverState;
|
|
7
11
|
export type MenuRenderProps = ButtonRenderProps;
|
|
@@ -12,12 +16,88 @@ export type MenuTriggerProps = DistributiveOmit<ButtonProps, 'id' | 'aria-haspop
|
|
|
12
16
|
export type MenuContentProps = Omit<PopoverContentProps, 'role' | 'aria-labelledby' | 'aria-orientation' | 'tabIndex' | 'initialFocusRef'>;
|
|
13
17
|
export type MenuItemProps = DistributiveOmit<ButtonProps, 'role' | 'tabIndex' | 'aria-disabled' | 'onSelect'> & {
|
|
14
18
|
textValue?: string;
|
|
19
|
+
closeOnSelect?: boolean;
|
|
15
20
|
onSelect?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
16
21
|
};
|
|
22
|
+
type Intent = 'first' | 'last' | 'none';
|
|
23
|
+
type MenuFamily = 'menu' | 'context-menu' | 'menubar';
|
|
24
|
+
type Context = MenuState & {
|
|
25
|
+
parent?: Context;
|
|
26
|
+
family: MenuFamily;
|
|
27
|
+
focusIntent?: Intent;
|
|
28
|
+
closeTree(): void;
|
|
29
|
+
triggerId: string;
|
|
30
|
+
trigger: RefObject<HTMLElement | null>;
|
|
31
|
+
setTrigger: (node: HTMLElement | null) => void;
|
|
32
|
+
content: RefObject<HTMLDivElement | null>;
|
|
33
|
+
intent: RefObject<Intent>;
|
|
34
|
+
setIntent: (edge: Intent) => void;
|
|
35
|
+
};
|
|
17
36
|
export declare function useMenu(): MenuState | null;
|
|
18
|
-
|
|
37
|
+
/** Private family guard for composed menus. */
|
|
38
|
+
export declare function useMenuFamily(): MenuFamily | undefined;
|
|
39
|
+
/** Private composition seam; not exported from the package. */
|
|
40
|
+
export declare function useMenuContext(): Context;
|
|
41
|
+
export declare function Menu(props: MenuProps): import("react").JSX.Element;
|
|
42
|
+
/** Composed families share one owner and native surface tree. */
|
|
43
|
+
export declare function MenuRoot({ children, parent, family, anchorPoint, focusIntent, ...props }: MenuProps & {
|
|
44
|
+
parent?: Context;
|
|
45
|
+
family?: MenuFamily;
|
|
46
|
+
focusIntent?: Intent;
|
|
47
|
+
anchorPoint?: {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
}): import("react").JSX.Element;
|
|
19
52
|
export declare function MenuTrigger({ ref, onKeyDown, onClick, ...props }: MenuTriggerProps): import("react").JSX.Element;
|
|
20
53
|
export declare function MenuPortal(props: MenuPortalProps): import("react").JSX.Element;
|
|
21
54
|
export declare function MenuContent({ ref, className, onKeyDown, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
22
|
-
export declare function MenuItem(
|
|
55
|
+
export declare function MenuItem(props: MenuItemProps): import("react").JSX.Element;
|
|
56
|
+
export type MenuGroupProps = Omit<ComponentProps<'div'>, 'style' | 'role'> & {
|
|
57
|
+
style?: ThemeStyle;
|
|
58
|
+
'data-slot'?: string;
|
|
59
|
+
};
|
|
60
|
+
export type MenuLabelProps = Omit<ComponentProps<'div'>, 'style' | 'role' | 'tabIndex'> & {
|
|
61
|
+
style?: ThemeStyle;
|
|
62
|
+
'data-slot'?: string;
|
|
63
|
+
};
|
|
64
|
+
export type MenuSeparatorProps = SeparatorProps;
|
|
65
|
+
export declare function MenuGroup({ className, ...props }: MenuGroupProps): import("react").JSX.Element;
|
|
66
|
+
export declare function MenuLabel({ className, ...props }: MenuLabelProps): import("react").JSX.Element;
|
|
67
|
+
export declare function MenuSeparator(props: MenuSeparatorProps): import("react").JSX.Element;
|
|
68
|
+
type CheckableProps = DistributiveOmit<MenuItemProps, 'pressed' | 'defaultPressed' | 'onPressedChange' | 'aria-pressed' | 'aria-checked' | 'type'> & {
|
|
69
|
+
parts?: {
|
|
70
|
+
indicator?: PartStyle;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type MenuCheckboxItemProps = CheckableProps & ({
|
|
74
|
+
checked: boolean;
|
|
75
|
+
defaultChecked?: never;
|
|
76
|
+
} | {
|
|
77
|
+
checked?: undefined;
|
|
78
|
+
defaultChecked?: boolean;
|
|
79
|
+
}) & {
|
|
80
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
81
|
+
indeterminate?: boolean;
|
|
82
|
+
};
|
|
83
|
+
export declare function MenuCheckboxItem({ checked, defaultChecked, onCheckedChange, indeterminate, parts, children, textValue, onSelect, closeOnSelect, ...props }: MenuCheckboxItemProps): import("react").JSX.Element;
|
|
84
|
+
export type MenuRadioGroupProps = Omit<MenuGroupProps, 'defaultValue'> & ValueOwner<string | null> & {
|
|
85
|
+
onValueChange?: (value: string | null) => void;
|
|
86
|
+
};
|
|
87
|
+
export declare function MenuRadioGroup({ value, defaultValue, onValueChange, ...props }: MenuRadioGroupProps): import("react").JSX.Element;
|
|
88
|
+
export type MenuRadioItemProps = DistributiveOmit<CheckableProps, 'value'> & {
|
|
89
|
+
value: string;
|
|
90
|
+
};
|
|
91
|
+
export declare function MenuRadioItem({ value, children, textValue, parts, onSelect, closeOnSelect, ...props }: MenuRadioItemProps): import("react").JSX.Element;
|
|
92
|
+
export type MenuSubProps = MenuProps;
|
|
93
|
+
export type MenuSubTriggerProps = DistributiveOmit<MenuItemProps, 'closeOnSelect' | 'id' | 'aria-haspopup' | 'aria-expanded' | 'aria-controls' | 'type'> & {
|
|
94
|
+
parts?: {
|
|
95
|
+
indicator?: PartStyle;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type MenuSubContentProps = MenuContentProps;
|
|
99
|
+
export declare function MenuSub(props: MenuSubProps): import("react").JSX.Element;
|
|
100
|
+
export declare function MenuSubTrigger({ ref, children, textValue, parts, className, onSelect, onKeyDown, onPointerMove, disabled, pending, ...props }: MenuSubTriggerProps): import("react").JSX.Element;
|
|
101
|
+
export declare function MenuSubContent({ side, onKeyDown, ...props }: MenuSubContentProps): import("react").JSX.Element;
|
|
102
|
+
export {};
|
|
23
103
|
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/Menu.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/Menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAOlD,MAAM,MAAM,SAAS,GAAG,YAAY,CAAA;AACpC,MAAM,MAAM,SAAS,GAAG,YAAY,CAAA;AACpC,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAC/C,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AACtD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,WAAW,EAAE,IAAI,GAAG,eAAe,CAAC,CAAA;AACpF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAC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