@choice-ui/react 1.6.1 → 1.6.3
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/dialog/dist/index.d.ts +2 -1
- package/dist/components/dialog/dist/index.js +5 -1
- package/dist/components/dialog/src/dialog.d.ts +2 -1
- package/dist/components/dialog/src/dialog.js +5 -1
- package/dist/components/list/dist/index.d.ts +8 -3
- package/dist/components/list/src/components/list-content.d.ts +3 -2
- package/dist/components/list/src/components/list-content.js +2 -2
- package/dist/components/list/src/components/list-item.d.ts +3 -0
- package/dist/components/list/src/list.d.ts +2 -1
- package/dist/components/list/src/list.js +4 -2
- package/dist/components/md-render/dist/index.js +1 -1
- package/dist/components/md-render/src/tv.js +1 -1
- package/dist/components/modal/dist/index.d.ts +2 -1
- package/dist/components/modal/dist/index.js +2 -2
- package/dist/components/modal/src/modal.d.ts +2 -1
- package/dist/components/modal/src/modal.js +2 -2
- package/dist/components/popover/dist/index.d.ts +11 -10
- package/dist/components/popover/dist/index.js +5 -1
- package/dist/components/popover/src/popover.d.ts +2 -1
- package/dist/components/popover/src/popover.js +5 -1
- package/dist/components/scroll-area/dist/index.d.ts +6 -1
- package/dist/components/scroll-area/dist/index.js +2 -2
- package/dist/components/scroll-area/src/components/scroll-area-content.d.ts +4 -1
- package/dist/components/scroll-area/src/components/scroll-area-content.js +2 -2
- package/dist/components/scroll-area/src/scroll-area.d.ts +1 -1
- package/dist/components/virtual-select/dist/index.d.ts +48 -0
- package/dist/styles/components.css +220 -193
- package/dist/styles/markdown.css +362 -360
- package/package.json +1 -1
- package/dist/styles/preflight.css +0 -97
- package/dist/styles/stories.css +0 -5
- package/dist/styles/theme.css +0 -597
|
@@ -13,8 +13,9 @@ declare const DialogTrigger: react.MemoExoticComponent<react.ForwardRefExoticCom
|
|
|
13
13
|
|
|
14
14
|
type DialogPosition = "left-top" | "center-top" | "right-top" | "left-center" | "center" | "right-center" | "left-bottom" | "center-bottom" | "right-bottom";
|
|
15
15
|
|
|
16
|
-
interface DialogProps {
|
|
16
|
+
interface DialogProps extends Omit<react__default.HTMLAttributes<HTMLElement>, "title"> {
|
|
17
17
|
afterOpenChange?: (isOpen: boolean) => void;
|
|
18
|
+
as?: react__default.ElementType;
|
|
18
19
|
children?: react__default.ReactNode;
|
|
19
20
|
className?: string;
|
|
20
21
|
closeOnEscape?: boolean;
|
|
@@ -645,6 +645,7 @@ var dragDialogTv = tcv({
|
|
|
645
645
|
});
|
|
646
646
|
var PORTAL_ROOT_ID = "floating-modal-root";
|
|
647
647
|
var DialogComponent = memo(function DialogComponent2({
|
|
648
|
+
as,
|
|
648
649
|
className,
|
|
649
650
|
children,
|
|
650
651
|
closeOnEscape = true,
|
|
@@ -667,7 +668,8 @@ var DialogComponent = memo(function DialogComponent2({
|
|
|
667
668
|
rememberSize = false,
|
|
668
669
|
focusManagerProps = { initialFocus: 1 },
|
|
669
670
|
transitionStylesProps,
|
|
670
|
-
root
|
|
671
|
+
root,
|
|
672
|
+
...restProps
|
|
671
673
|
}) {
|
|
672
674
|
const dialogRef = useRef(null);
|
|
673
675
|
const contentRef = useRef(null);
|
|
@@ -829,9 +831,11 @@ var DialogComponent = memo(function DialogComponent2({
|
|
|
829
831
|
floating.refs.setFloating(node);
|
|
830
832
|
}
|
|
831
833
|
},
|
|
834
|
+
as,
|
|
832
835
|
style: getStyleWithDefaults,
|
|
833
836
|
className: tcx(style.dialog(), className),
|
|
834
837
|
...floating.getFloatingProps(),
|
|
838
|
+
...restProps,
|
|
835
839
|
"aria-labelledby": titleId,
|
|
836
840
|
"aria-describedby": descriptionId,
|
|
837
841
|
role: "dialog",
|
|
@@ -3,8 +3,9 @@ import { FloatingFocusManagerProps, UseTransitionStylesProps } from '@floating-u
|
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
import { DialogHeader, DialogTrigger } from './components';
|
|
5
5
|
import { DialogPosition } from './types';
|
|
6
|
-
export interface DialogProps {
|
|
6
|
+
export interface DialogProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
7
7
|
afterOpenChange?: (isOpen: boolean) => void;
|
|
8
|
+
as?: React.ElementType;
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
className?: string;
|
|
10
11
|
closeOnEscape?: boolean;
|
|
@@ -14,6 +14,7 @@ import { findChildByType } from "../../../shared/utils/assertion.js";
|
|
|
14
14
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
15
15
|
const PORTAL_ROOT_ID = "floating-modal-root";
|
|
16
16
|
const DialogComponent = memo(function DialogComponent2({
|
|
17
|
+
as,
|
|
17
18
|
className,
|
|
18
19
|
children,
|
|
19
20
|
closeOnEscape = true,
|
|
@@ -36,7 +37,8 @@ const DialogComponent = memo(function DialogComponent2({
|
|
|
36
37
|
rememberSize = false,
|
|
37
38
|
focusManagerProps = { initialFocus: 1 },
|
|
38
39
|
transitionStylesProps,
|
|
39
|
-
root
|
|
40
|
+
root,
|
|
41
|
+
...restProps
|
|
40
42
|
}) {
|
|
41
43
|
const dialogRef = useRef(null);
|
|
42
44
|
const contentRef = useRef(null);
|
|
@@ -198,9 +200,11 @@ const DialogComponent = memo(function DialogComponent2({
|
|
|
198
200
|
floating.refs.setFloating(node);
|
|
199
201
|
}
|
|
200
202
|
},
|
|
203
|
+
as,
|
|
201
204
|
style: getStyleWithDefaults,
|
|
202
205
|
className: tcx(style.dialog(), className),
|
|
203
206
|
...floating.getFloatingProps(),
|
|
207
|
+
...restProps,
|
|
204
208
|
"aria-labelledby": titleId,
|
|
205
209
|
"aria-describedby": descriptionId,
|
|
206
210
|
role: "dialog",
|
|
@@ -3,11 +3,12 @@ import { MenuValue } from '../../menus/src';
|
|
|
3
3
|
import { KbdKey } from '../../kbd/src';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
|
|
6
|
-
interface ListContentProps extends React.
|
|
6
|
+
interface ListContentProps extends Omit<React.HTMLAttributes<HTMLElement>, "as"> {
|
|
7
|
+
as?: React.ElementType;
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
parentId?: string;
|
|
9
10
|
}
|
|
10
|
-
declare const ListContent: react.ForwardRefExoticComponent<
|
|
11
|
+
declare const ListContent: react.ForwardRefExoticComponent<ListContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
11
12
|
|
|
12
13
|
declare const ListDivider: react.ForwardRefExoticComponent<Omit<react.HTMLProps<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
13
14
|
|
|
@@ -21,6 +22,7 @@ interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
21
22
|
shortcut?: string;
|
|
22
23
|
};
|
|
23
24
|
disabled?: boolean;
|
|
25
|
+
href?: string;
|
|
24
26
|
id?: string;
|
|
25
27
|
parentId?: string;
|
|
26
28
|
prefixElement?: ReactNode;
|
|
@@ -30,6 +32,8 @@ interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
30
32
|
modifier?: KbdKey | KbdKey[] | undefined;
|
|
31
33
|
};
|
|
32
34
|
suffixElement?: ReactNode;
|
|
35
|
+
target?: string;
|
|
36
|
+
rel?: string;
|
|
33
37
|
}
|
|
34
38
|
declare const ListItem: react.MemoExoticComponent<react.ForwardRefExoticComponent<ListItemProps & react.RefAttributes<HTMLElement>>>;
|
|
35
39
|
|
|
@@ -56,7 +60,8 @@ interface ListSubTriggerProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
56
60
|
}
|
|
57
61
|
declare const ListSubTrigger: react.MemoExoticComponent<react.ForwardRefExoticComponent<ListSubTriggerProps & react.RefAttributes<HTMLButtonElement>>>;
|
|
58
62
|
|
|
59
|
-
interface ListProps extends Omit<HTMLProps<HTMLDivElement>, "size"> {
|
|
63
|
+
interface ListProps extends Omit<HTMLProps<HTMLDivElement>, "size" | "as"> {
|
|
64
|
+
as?: React.ElementType;
|
|
60
65
|
children: React.ReactNode;
|
|
61
66
|
interactive?: boolean;
|
|
62
67
|
selection?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export interface ListContentProps extends React.
|
|
1
|
+
export interface ListContentProps extends Omit<React.HTMLAttributes<HTMLElement>, "as"> {
|
|
2
|
+
as?: React.ElementType;
|
|
2
3
|
children: React.ReactNode;
|
|
3
4
|
parentId?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const ListContent: import('react').ForwardRefExoticComponent<
|
|
6
|
+
export declare const ListContent: import('react').ForwardRefExoticComponent<ListContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -4,7 +4,7 @@ import { ListContentTv } from "../tv.js";
|
|
|
4
4
|
import { useExpandContext, useStructureContext, LevelContext } from "../context/list-context.js";
|
|
5
5
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
6
6
|
const ListContent = forwardRef((props, ref) => {
|
|
7
|
-
const { children, className, parentId, ...rest } = props;
|
|
7
|
+
const { as: As = "div", children, className, parentId, ...rest } = props;
|
|
8
8
|
const { isSubListExpanded } = useExpandContext();
|
|
9
9
|
const { itemsMap, shouldShowReferenceLine, size } = useStructureContext();
|
|
10
10
|
const level = useMemo(() => {
|
|
@@ -35,7 +35,7 @@ const ListContent = forwardRef((props, ref) => {
|
|
|
35
35
|
size
|
|
36
36
|
});
|
|
37
37
|
return /* @__PURE__ */ jsx(LevelContext.Provider, { value: { level: safeLevel }, children: /* @__PURE__ */ jsx(
|
|
38
|
-
|
|
38
|
+
As,
|
|
39
39
|
{
|
|
40
40
|
ref,
|
|
41
41
|
role: "group",
|
|
@@ -10,6 +10,7 @@ export interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
10
10
|
shortcut?: string;
|
|
11
11
|
};
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
href?: string;
|
|
13
14
|
id?: string;
|
|
14
15
|
parentId?: string;
|
|
15
16
|
prefixElement?: ReactNode;
|
|
@@ -19,5 +20,7 @@ export interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
19
20
|
modifier?: KbdKey | KbdKey[] | undefined;
|
|
20
21
|
};
|
|
21
22
|
suffixElement?: ReactNode;
|
|
23
|
+
target?: string;
|
|
24
|
+
rel?: string;
|
|
22
25
|
}
|
|
23
26
|
export declare const ListItem: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<ListItemProps & import('react').RefAttributes<HTMLElement>>>;
|
|
@@ -5,7 +5,8 @@ import { ListDivider } from './components/list-divider';
|
|
|
5
5
|
import { ListItem } from './components/list-item';
|
|
6
6
|
import { ListLabel } from './components/list-label';
|
|
7
7
|
import { ListSubTrigger } from './components/list-sub-trigger';
|
|
8
|
-
export interface ListProps extends Omit<HTMLProps<HTMLDivElement>, "size"> {
|
|
8
|
+
export interface ListProps extends Omit<HTMLProps<HTMLDivElement>, "size" | "as"> {
|
|
9
|
+
as?: React.ElementType;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
interactive?: boolean;
|
|
11
12
|
selection?: boolean;
|
|
@@ -13,6 +13,7 @@ import { useActiveItemContext } from "./context/list-context.js";
|
|
|
13
13
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
14
14
|
const ListBase = forwardRef((props, ref) => {
|
|
15
15
|
const {
|
|
16
|
+
as,
|
|
16
17
|
children,
|
|
17
18
|
className,
|
|
18
19
|
interactive = true,
|
|
@@ -34,6 +35,7 @@ const ListBase = forwardRef((props, ref) => {
|
|
|
34
35
|
ListRoot,
|
|
35
36
|
{
|
|
36
37
|
ref,
|
|
38
|
+
as,
|
|
37
39
|
className,
|
|
38
40
|
...rest,
|
|
39
41
|
children
|
|
@@ -43,12 +45,12 @@ const ListBase = forwardRef((props, ref) => {
|
|
|
43
45
|
);
|
|
44
46
|
});
|
|
45
47
|
const ListRoot = forwardRef((props, ref) => {
|
|
46
|
-
const { children, className, ...rest } = props;
|
|
48
|
+
const { as: As = "div", children, className, ...rest } = props;
|
|
47
49
|
const handleKeyDown = useListKeyboard();
|
|
48
50
|
const { setActiveItem } = useActiveItemContext();
|
|
49
51
|
const tv = ListTv();
|
|
50
52
|
return /* @__PURE__ */ jsx(
|
|
51
|
-
|
|
53
|
+
As,
|
|
52
54
|
{
|
|
53
55
|
ref,
|
|
54
56
|
role: "list",
|
|
@@ -45,7 +45,8 @@ interface ModalTextareaProps extends Omit<TextareaProps, "children" | "label"> {
|
|
|
45
45
|
}
|
|
46
46
|
declare const ModalTextarea: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<ModalTextareaProps, "ref"> & react.RefAttributes<HTMLTextAreaElement>>>;
|
|
47
47
|
|
|
48
|
-
interface ModalProps extends Omit<HTMLProps<HTMLDivElement>, "title"> {
|
|
48
|
+
interface ModalProps extends Omit<HTMLProps<HTMLDivElement>, "title" | "as"> {
|
|
49
|
+
as?: React.ElementType;
|
|
49
50
|
className?: string;
|
|
50
51
|
onClose?: () => void;
|
|
51
52
|
title?: ReactNode;
|
|
@@ -186,10 +186,10 @@ var ModalTextarea = memo(
|
|
|
186
186
|
);
|
|
187
187
|
ModalTextarea.displayName = "ModalTextarea";
|
|
188
188
|
var ModalBase = forwardRef((props, ref) => {
|
|
189
|
-
const { className, title, onClose, ...rest } = props;
|
|
189
|
+
const { as: As = "div", className, title, onClose, ...rest } = props;
|
|
190
190
|
const tv = ModalTv();
|
|
191
191
|
return /* @__PURE__ */ jsx(
|
|
192
|
-
|
|
192
|
+
As,
|
|
193
193
|
{
|
|
194
194
|
ref,
|
|
195
195
|
className: tcx(tv.root(), className),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { ModalBackdrop, ModalContent, ModalFooter, ModalHeader, ModalInput, ModalSelect, ModalTextarea } from './components';
|
|
3
|
-
interface ModalProps extends Omit<HTMLProps<HTMLDivElement>, "title"> {
|
|
3
|
+
interface ModalProps extends Omit<HTMLProps<HTMLDivElement>, "title" | "as"> {
|
|
4
|
+
as?: React.ElementType;
|
|
4
5
|
className?: string;
|
|
5
6
|
onClose?: () => void;
|
|
6
7
|
title?: ReactNode;
|
|
@@ -10,10 +10,10 @@ import { ModalTextarea } from "./components/modal-textarea.js";
|
|
|
10
10
|
import { ModalBackdrop } from "./components/modal-backdrop.js";
|
|
11
11
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
12
12
|
const ModalBase = forwardRef((props, ref) => {
|
|
13
|
-
const { className, title, onClose, ...rest } = props;
|
|
13
|
+
const { as: As = "div", className, title, onClose, ...rest } = props;
|
|
14
14
|
const tv = ModalTv();
|
|
15
15
|
return /* @__PURE__ */ jsx(
|
|
16
|
-
|
|
16
|
+
As,
|
|
17
17
|
{
|
|
18
18
|
ref,
|
|
19
19
|
className: tcx(tv.root(), className),
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { ModalHeaderProps, ModalContent, ModalFooter } from '../../modal/src';
|
|
2
2
|
import { FloatingFocusManagerProps, OffsetOptions, Placement } from '@floating-ui/react';
|
|
3
|
-
import { default as
|
|
4
|
-
import * as
|
|
3
|
+
import { default as React__default } from 'react';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
5
|
|
|
6
|
-
declare const PopoverHeader:
|
|
6
|
+
declare const PopoverHeader: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<Omit<ModalHeaderProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>>;
|
|
7
7
|
|
|
8
|
-
declare const PopoverTrigger:
|
|
8
|
+
declare const PopoverTrigger: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<{
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
-
} &
|
|
10
|
+
} & React$1.RefAttributes<HTMLElement>>>;
|
|
11
11
|
|
|
12
|
-
interface PopoverProps {
|
|
12
|
+
interface PopoverProps extends Omit<React__default.HTMLAttributes<HTMLElement>, "title"> {
|
|
13
|
+
as?: React__default.ElementType;
|
|
13
14
|
autoSize?: boolean;
|
|
14
15
|
autoUpdate?: boolean;
|
|
15
|
-
children?:
|
|
16
|
+
children?: React__default.ReactNode;
|
|
16
17
|
className?: string;
|
|
17
18
|
closeOnEscape?: boolean;
|
|
18
|
-
contentRef?:
|
|
19
|
+
contentRef?: React__default.RefObject<HTMLDivElement>;
|
|
19
20
|
defaultOpen?: boolean;
|
|
20
21
|
delay?: {
|
|
21
22
|
close?: number;
|
|
@@ -39,9 +40,9 @@ interface PopoverProps {
|
|
|
39
40
|
* If not specified, will auto-detect from triggerRef's ownerDocument.
|
|
40
41
|
*/
|
|
41
42
|
root?: HTMLElement | null;
|
|
42
|
-
triggerRef?:
|
|
43
|
+
triggerRef?: React__default.RefObject<HTMLElement>;
|
|
43
44
|
}
|
|
44
|
-
interface PopoverComponent extends
|
|
45
|
+
interface PopoverComponent extends React__default.FC<PopoverProps> {
|
|
45
46
|
Content: typeof ModalContent;
|
|
46
47
|
Footer: typeof ModalFooter;
|
|
47
48
|
Header: typeof PopoverHeader;
|
|
@@ -405,6 +405,7 @@ function useFloatingPopover({
|
|
|
405
405
|
var PORTAL_ROOT_ID = "floating-popover-root";
|
|
406
406
|
var DEFAULT_OFFSET = { mainAxis: 8, crossAxis: 0 };
|
|
407
407
|
var DragPopover = memo(function DragPopover2({
|
|
408
|
+
as,
|
|
408
409
|
className,
|
|
409
410
|
children,
|
|
410
411
|
triggerRef: externalTriggerRef,
|
|
@@ -430,7 +431,8 @@ var DragPopover = memo(function DragPopover2({
|
|
|
430
431
|
autoSize = true,
|
|
431
432
|
rememberPosition = false,
|
|
432
433
|
maxWidth,
|
|
433
|
-
matchTriggerWidth = false
|
|
434
|
+
matchTriggerWidth = false,
|
|
435
|
+
...restProps
|
|
434
436
|
}) {
|
|
435
437
|
const titleId = useId();
|
|
436
438
|
const descriptionId = useId();
|
|
@@ -564,6 +566,7 @@ var DragPopover = memo(function DragPopover2({
|
|
|
564
566
|
Modal,
|
|
565
567
|
{
|
|
566
568
|
ref: handleFloatingRef,
|
|
569
|
+
as,
|
|
567
570
|
style: combinedStyles,
|
|
568
571
|
className: tcx(matchTriggerWidth && "max-w-none", className),
|
|
569
572
|
"data-state": floating.positionReady ? "open" : "opening",
|
|
@@ -571,6 +574,7 @@ var DragPopover = memo(function DragPopover2({
|
|
|
571
574
|
"data-draggable": draggable ? "true" : void 0,
|
|
572
575
|
"data-closing": floating.isClosing ? "true" : void 0,
|
|
573
576
|
...floating.getFloatingProps(),
|
|
577
|
+
...restProps,
|
|
574
578
|
role: "dialog",
|
|
575
579
|
"aria-modal": "true",
|
|
576
580
|
"aria-labelledby": titleId,
|
|
@@ -2,7 +2,8 @@ import { ModalContent, ModalFooter } from '../../modal/src';
|
|
|
2
2
|
import { FloatingFocusManagerProps, Placement, OffsetOptions } from '@floating-ui/react';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
import { PopoverHeader, PopoverTrigger } from './components';
|
|
5
|
-
export interface PopoverProps {
|
|
5
|
+
export interface PopoverProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
6
|
+
as?: React.ElementType;
|
|
6
7
|
autoSize?: boolean;
|
|
7
8
|
autoUpdate?: boolean;
|
|
8
9
|
children?: React.ReactNode;
|
|
@@ -14,6 +14,7 @@ import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
|
14
14
|
const PORTAL_ROOT_ID = "floating-popover-root";
|
|
15
15
|
const DEFAULT_OFFSET = { mainAxis: 8, crossAxis: 0 };
|
|
16
16
|
const DragPopover = memo(function DragPopover2({
|
|
17
|
+
as,
|
|
17
18
|
className,
|
|
18
19
|
children,
|
|
19
20
|
triggerRef: externalTriggerRef,
|
|
@@ -39,7 +40,8 @@ const DragPopover = memo(function DragPopover2({
|
|
|
39
40
|
autoSize = true,
|
|
40
41
|
rememberPosition = false,
|
|
41
42
|
maxWidth,
|
|
42
|
-
matchTriggerWidth = false
|
|
43
|
+
matchTriggerWidth = false,
|
|
44
|
+
...restProps
|
|
43
45
|
}) {
|
|
44
46
|
const titleId = useId();
|
|
45
47
|
const descriptionId = useId();
|
|
@@ -173,6 +175,7 @@ const DragPopover = memo(function DragPopover2({
|
|
|
173
175
|
Modal,
|
|
174
176
|
{
|
|
175
177
|
ref: handleFloatingRef,
|
|
178
|
+
as,
|
|
176
179
|
style: combinedStyles,
|
|
177
180
|
className: tcx(matchTriggerWidth && "max-w-none", className),
|
|
178
181
|
"data-state": floating.positionReady ? "open" : "opening",
|
|
@@ -180,6 +183,7 @@ const DragPopover = memo(function DragPopover2({
|
|
|
180
183
|
"data-draggable": draggable ? "true" : void 0,
|
|
181
184
|
"data-closing": floating.isClosing ? "true" : void 0,
|
|
182
185
|
...floating.getFloatingProps(),
|
|
186
|
+
...restProps,
|
|
183
187
|
role: "dialog",
|
|
184
188
|
"aria-modal": "true",
|
|
185
189
|
"aria-labelledby": titleId,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { default as react__default } from 'react';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
|
|
4
|
+
interface ScrollAreaContentProps extends Omit<react__default.HTMLAttributes<HTMLElement>, "as"> {
|
|
5
|
+
as?: react__default.ElementType;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
type ScrollbarVisibilityType = "auto" | "always" | "scroll" | "hover";
|
|
4
9
|
type ScrollbarMode = "default" | "padding-y" | "padding-x" | "padding-b" | "padding-t" | "padding-l" | "padding-r";
|
|
5
10
|
type ScrollAreaVariant = "default" | "light" | "dark";
|
|
@@ -49,7 +54,7 @@ interface ThumbProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
|
49
54
|
declare const ScrollArea: react.ForwardRefExoticComponent<ScrollAreaProps & react.RefAttributes<HTMLDivElement>> & {
|
|
50
55
|
Root: react.ForwardRefExoticComponent<ScrollAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
51
56
|
Viewport: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
52
|
-
Content: react.ForwardRefExoticComponent<
|
|
57
|
+
Content: react.ForwardRefExoticComponent<ScrollAreaContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
53
58
|
Scrollbar: react.ForwardRefExoticComponent<ScrollbarProps & react.RefAttributes<HTMLDivElement>>;
|
|
54
59
|
Thumb: react.ForwardRefExoticComponent<ThumbProps & react.RefAttributes<HTMLDivElement>>;
|
|
55
60
|
Corner: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -917,7 +917,7 @@ var ScrollAreaViewport = forwardRef(
|
|
|
917
917
|
);
|
|
918
918
|
ScrollAreaViewport.displayName = "ScrollArea.Viewport";
|
|
919
919
|
var ScrollAreaContent = forwardRef(
|
|
920
|
-
({ className, children, ...props }, ref) => {
|
|
920
|
+
({ as: As = "div", className, children, ...props }, ref) => {
|
|
921
921
|
const { setContent, orientation } = useScrollAreaContext();
|
|
922
922
|
const setRef = useCallback(
|
|
923
923
|
(node) => {
|
|
@@ -943,7 +943,7 @@ var ScrollAreaContent = forwardRef(
|
|
|
943
943
|
}
|
|
944
944
|
}, [orientation]);
|
|
945
945
|
return /* @__PURE__ */ jsx(
|
|
946
|
-
|
|
946
|
+
As,
|
|
947
947
|
{
|
|
948
948
|
ref: setRef,
|
|
949
949
|
className: tcx(sizeClasses, className),
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface ScrollAreaContentProps extends Omit<React.HTMLAttributes<HTMLElement>, "as"> {
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}
|
|
5
|
+
export declare const ScrollAreaContent: React.ForwardRefExoticComponent<ScrollAreaContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useCallback, useMemo } from "react";
|
|
|
3
3
|
import { useScrollAreaContext } from "../context/scroll-area-context.js";
|
|
4
4
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
5
5
|
const ScrollAreaContent = forwardRef(
|
|
6
|
-
({ className, children, ...props }, ref) => {
|
|
6
|
+
({ as: As = "div", className, children, ...props }, ref) => {
|
|
7
7
|
const { setContent, orientation } = useScrollAreaContext();
|
|
8
8
|
const setRef = useCallback(
|
|
9
9
|
(node) => {
|
|
@@ -29,7 +29,7 @@ const ScrollAreaContent = forwardRef(
|
|
|
29
29
|
}
|
|
30
30
|
}, [orientation]);
|
|
31
31
|
return /* @__PURE__ */ jsx(
|
|
32
|
-
|
|
32
|
+
As,
|
|
33
33
|
{
|
|
34
34
|
ref: setRef,
|
|
35
35
|
className: tcx(sizeClasses, className),
|
|
@@ -2,7 +2,7 @@ import { ScrollAreaProps, ScrollbarProps, ThumbProps } from './types';
|
|
|
2
2
|
export declare const ScrollArea: import('react').ForwardRefExoticComponent<ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
3
3
|
Root: import('react').ForwardRefExoticComponent<ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
4
|
Viewport: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
5
|
-
Content: import('react').ForwardRefExoticComponent<
|
|
5
|
+
Content: import('react').ForwardRefExoticComponent<import('./components/scroll-area-content').ScrollAreaContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Scrollbar: import('react').ForwardRefExoticComponent<ScrollbarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
7
|
Thumb: import('react').ForwardRefExoticComponent<ThumbProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
8
|
Corner: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MenuContextContent, MenuDivider, MenuEmpty, MenuContextItem, MenuSearch, MenuTrigger, MenuValue } from '../../menus/src';
|
|
2
|
+
import { FloatingFocusManagerProps } from '@floating-ui/react';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
interface VirtualSelectOption<T = unknown> {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
data?: T;
|
|
9
|
+
}
|
|
10
|
+
interface VirtualSelectProps<T = unknown> {
|
|
11
|
+
className?: string;
|
|
12
|
+
closeOnEscape?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
emptyText?: string;
|
|
15
|
+
focusManagerProps?: Partial<FloatingFocusManagerProps>;
|
|
16
|
+
matchTriggerWidth?: boolean;
|
|
17
|
+
maxHeight?: number;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
options: VirtualSelectOption<T>[];
|
|
22
|
+
overscan?: number;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
placement?: "bottom-start" | "bottom-end";
|
|
25
|
+
portalId?: string;
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
renderOption?: (option: VirtualSelectOption<T>, isSelected: boolean) => React.ReactNode;
|
|
28
|
+
renderValue?: (option: VirtualSelectOption<T> | null) => React.ReactNode;
|
|
29
|
+
root?: HTMLElement | null;
|
|
30
|
+
searchPlaceholder?: string;
|
|
31
|
+
size?: "default" | "large";
|
|
32
|
+
value?: string | null;
|
|
33
|
+
variant?: "default" | "light" | "reset";
|
|
34
|
+
}
|
|
35
|
+
interface VirtualSelectComponentType {
|
|
36
|
+
<T = unknown>(props: VirtualSelectProps<T>): React.ReactElement | null;
|
|
37
|
+
displayName?: string;
|
|
38
|
+
Content: typeof MenuContextContent;
|
|
39
|
+
Divider: typeof MenuDivider;
|
|
40
|
+
Empty: typeof MenuEmpty;
|
|
41
|
+
Item: typeof MenuContextItem;
|
|
42
|
+
Search: typeof MenuSearch;
|
|
43
|
+
Trigger: typeof MenuTrigger;
|
|
44
|
+
Value: typeof MenuValue;
|
|
45
|
+
}
|
|
46
|
+
declare const VirtualSelect: VirtualSelectComponentType;
|
|
47
|
+
|
|
48
|
+
export { VirtualSelect, type VirtualSelectOption, type VirtualSelectProps };
|