@huin-core/react-select 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,145 @@
1
+ import * as React$1 from 'react';
2
+ import React__default from 'react';
3
+ import { Primitive } from '@huin-core/react-primitive';
4
+ import { Portal } from '@huin-core/react-portal';
5
+ import { DismissableLayer } from '@huin-core/react-dismissable-layer';
6
+ import { FocusScope } from '@huin-core/react-focus-scope';
7
+ import * as PopperPrimitive from '@huin-core/react-popper';
8
+
9
+ type Scope<C = any> = {
10
+ [scopeName: string]: React$1.Context<C>[];
11
+ } | undefined;
12
+ type ScopeHook = (scope: Scope) => {
13
+ [__scopeProp: string]: Scope;
14
+ };
15
+ interface CreateScope {
16
+ scopeName: string;
17
+ (): ScopeHook;
18
+ }
19
+
20
+ type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
21
+ interface SelectTriggerProps extends PrimitiveButtonProps {
22
+ }
23
+ declare const SelectTrigger: React__default.ForwardRefExoticComponent<SelectTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
24
+
25
+ type PrimitiveSpanProps = React__default.ComponentPropsWithoutRef<typeof Primitive.span>;
26
+ interface SelectValueProps extends Omit<PrimitiveSpanProps, "placeholder"> {
27
+ placeholder?: React__default.ReactNode;
28
+ }
29
+ declare const SelectValue: React__default.ForwardRefExoticComponent<SelectValueProps & React__default.RefAttributes<HTMLSpanElement>>;
30
+
31
+ type Direction = "ltr" | "rtl";
32
+ declare const createSelectScope: CreateScope;
33
+ interface SelectProps {
34
+ children?: React$1.ReactNode;
35
+ value?: string;
36
+ defaultValue?: string;
37
+ onValueChange?(value: string): void;
38
+ open?: boolean;
39
+ defaultOpen?: boolean;
40
+ onOpenChange?(open: boolean): void;
41
+ dir?: Direction;
42
+ name?: string;
43
+ autoComplete?: string;
44
+ disabled?: boolean;
45
+ required?: boolean;
46
+ }
47
+ declare const Select: React$1.FC<SelectProps>;
48
+ declare const Root: React$1.FC<SelectProps>;
49
+
50
+ interface SelectIconProps extends PrimitiveSpanProps {
51
+ }
52
+ declare const SelectIcon: React__default.ForwardRefExoticComponent<SelectIconProps & React__default.RefAttributes<HTMLSpanElement>>;
53
+
54
+ type PortalProps = React.ComponentPropsWithoutRef<typeof Portal>;
55
+ interface SelectPortalProps {
56
+ children?: React.ReactNode;
57
+ /**
58
+ * Specify a container element to portal the content into.
59
+ */
60
+ container?: PortalProps["container"];
61
+ }
62
+ declare const SelectPortal: React.FC<SelectPortalProps>;
63
+
64
+ interface SelectScrollDownButtonProps extends Omit<SelectScrollButtonImplProps, "onAutoScroll"> {
65
+ }
66
+ declare const SelectScrollDownButton: React__default.ForwardRefExoticComponent<SelectScrollDownButtonProps & React__default.RefAttributes<HTMLDivElement>>;
67
+ interface SelectScrollButtonImplProps extends PrimitiveDivProps {
68
+ onAutoScroll(): void;
69
+ }
70
+
71
+ type PrimitiveDivProps = React__default.ComponentPropsWithoutRef<typeof Primitive.div>;
72
+ interface SelectViewportProps extends PrimitiveDivProps {
73
+ nonce?: string;
74
+ }
75
+ declare const SelectViewport: React__default.ForwardRefExoticComponent<SelectViewportProps & React__default.RefAttributes<HTMLDivElement>>;
76
+
77
+ interface SelectItemTextProps extends PrimitiveSpanProps {
78
+ }
79
+ declare const SelectItemText: React__default.ForwardRefExoticComponent<SelectItemTextProps & React__default.RefAttributes<HTMLSpanElement>>;
80
+
81
+ interface SelectItemProps extends PrimitiveDivProps {
82
+ value: string;
83
+ disabled?: boolean;
84
+ textValue?: string;
85
+ }
86
+ declare const SelectItem: React__default.ForwardRefExoticComponent<SelectItemProps & React__default.RefAttributes<HTMLDivElement>>;
87
+
88
+ interface SelectContentProps extends SelectContentImplProps {
89
+ }
90
+ declare const SelectContent: React__default.ForwardRefExoticComponent<SelectContentProps & React__default.RefAttributes<HTMLDivElement>>;
91
+ type DismissableLayerProps = React__default.ComponentPropsWithoutRef<typeof DismissableLayer>;
92
+ type FocusScopeProps = React__default.ComponentPropsWithoutRef<typeof FocusScope>;
93
+ type SelectPopperPrivateProps = {
94
+ onPlaced?: PopperContentProps["onPlaced"];
95
+ };
96
+ interface SelectContentImplProps extends Omit<SelectPopperPositionProps, keyof SelectPopperPrivateProps>, Omit<SelectItemAlignedPositionProps, keyof SelectPopperPrivateProps> {
97
+ /**
98
+ * Event handler called when auto-focusing on close.
99
+ * Can be prevented.
100
+ */
101
+ onCloseAutoFocus?: FocusScopeProps["onUnmountAutoFocus"];
102
+ /**
103
+ * Event handler called when the escape key is down.
104
+ * Can be prevented.
105
+ */
106
+ onEscapeKeyDown?: DismissableLayerProps["onEscapeKeyDown"];
107
+ /**
108
+ * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
109
+ * Can be prevented.
110
+ */
111
+ onPointerDownOutside?: DismissableLayerProps["onPointerDownOutside"];
112
+ position?: "item-aligned" | "popper";
113
+ }
114
+ interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {
115
+ }
116
+ type PopperContentProps = React__default.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
117
+ interface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {
118
+ }
119
+
120
+ interface SelectGroupProps extends PrimitiveDivProps {
121
+ }
122
+ declare const SelectGroup: React__default.ForwardRefExoticComponent<SelectGroupProps & React__default.RefAttributes<HTMLDivElement>>;
123
+
124
+ interface SelectLabelProps extends PrimitiveDivProps {
125
+ }
126
+ declare const SelectLabel: React__default.ForwardRefExoticComponent<SelectLabelProps & React__default.RefAttributes<HTMLDivElement>>;
127
+
128
+ interface SelectItemIndicatorProps extends PrimitiveSpanProps {
129
+ }
130
+ declare const SelectItemIndicator: React__default.ForwardRefExoticComponent<SelectItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
131
+
132
+ interface SelectScrollUpButtonProps extends Omit<SelectScrollButtonImplProps, "onAutoScroll"> {
133
+ }
134
+ declare const SelectScrollUpButton: React__default.ForwardRefExoticComponent<SelectScrollUpButtonProps & React__default.RefAttributes<HTMLDivElement>>;
135
+
136
+ interface SelectSeparatorProps extends PrimitiveDivProps {
137
+ }
138
+ declare const SelectSeparator: React__default.ForwardRefExoticComponent<SelectSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
139
+
140
+ type PopperArrowProps = React__default.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
141
+ interface SelectArrowProps extends PopperArrowProps {
142
+ }
143
+ declare const SelectArrow: React__default.ForwardRefExoticComponent<SelectArrowProps & React__default.RefAttributes<SVGSVGElement>>;
144
+
145
+ export { Root, Select, SelectArrow, type SelectArrowProps, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectIcon, type SelectIconProps, SelectItem, SelectItemIndicator, type SelectItemIndicatorProps, type SelectItemProps, SelectItemText, type SelectItemTextProps, SelectLabel, type SelectLabelProps, SelectPortal, type SelectPortalProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, SelectViewport, type SelectViewportProps, createSelectScope };
@@ -0,0 +1,145 @@
1
+ import * as React$1 from 'react';
2
+ import React__default from 'react';
3
+ import { Primitive } from '@huin-core/react-primitive';
4
+ import { Portal } from '@huin-core/react-portal';
5
+ import { DismissableLayer } from '@huin-core/react-dismissable-layer';
6
+ import { FocusScope } from '@huin-core/react-focus-scope';
7
+ import * as PopperPrimitive from '@huin-core/react-popper';
8
+
9
+ type Scope<C = any> = {
10
+ [scopeName: string]: React$1.Context<C>[];
11
+ } | undefined;
12
+ type ScopeHook = (scope: Scope) => {
13
+ [__scopeProp: string]: Scope;
14
+ };
15
+ interface CreateScope {
16
+ scopeName: string;
17
+ (): ScopeHook;
18
+ }
19
+
20
+ type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
21
+ interface SelectTriggerProps extends PrimitiveButtonProps {
22
+ }
23
+ declare const SelectTrigger: React__default.ForwardRefExoticComponent<SelectTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
24
+
25
+ type PrimitiveSpanProps = React__default.ComponentPropsWithoutRef<typeof Primitive.span>;
26
+ interface SelectValueProps extends Omit<PrimitiveSpanProps, "placeholder"> {
27
+ placeholder?: React__default.ReactNode;
28
+ }
29
+ declare const SelectValue: React__default.ForwardRefExoticComponent<SelectValueProps & React__default.RefAttributes<HTMLSpanElement>>;
30
+
31
+ type Direction = "ltr" | "rtl";
32
+ declare const createSelectScope: CreateScope;
33
+ interface SelectProps {
34
+ children?: React$1.ReactNode;
35
+ value?: string;
36
+ defaultValue?: string;
37
+ onValueChange?(value: string): void;
38
+ open?: boolean;
39
+ defaultOpen?: boolean;
40
+ onOpenChange?(open: boolean): void;
41
+ dir?: Direction;
42
+ name?: string;
43
+ autoComplete?: string;
44
+ disabled?: boolean;
45
+ required?: boolean;
46
+ }
47
+ declare const Select: React$1.FC<SelectProps>;
48
+ declare const Root: React$1.FC<SelectProps>;
49
+
50
+ interface SelectIconProps extends PrimitiveSpanProps {
51
+ }
52
+ declare const SelectIcon: React__default.ForwardRefExoticComponent<SelectIconProps & React__default.RefAttributes<HTMLSpanElement>>;
53
+
54
+ type PortalProps = React.ComponentPropsWithoutRef<typeof Portal>;
55
+ interface SelectPortalProps {
56
+ children?: React.ReactNode;
57
+ /**
58
+ * Specify a container element to portal the content into.
59
+ */
60
+ container?: PortalProps["container"];
61
+ }
62
+ declare const SelectPortal: React.FC<SelectPortalProps>;
63
+
64
+ interface SelectScrollDownButtonProps extends Omit<SelectScrollButtonImplProps, "onAutoScroll"> {
65
+ }
66
+ declare const SelectScrollDownButton: React__default.ForwardRefExoticComponent<SelectScrollDownButtonProps & React__default.RefAttributes<HTMLDivElement>>;
67
+ interface SelectScrollButtonImplProps extends PrimitiveDivProps {
68
+ onAutoScroll(): void;
69
+ }
70
+
71
+ type PrimitiveDivProps = React__default.ComponentPropsWithoutRef<typeof Primitive.div>;
72
+ interface SelectViewportProps extends PrimitiveDivProps {
73
+ nonce?: string;
74
+ }
75
+ declare const SelectViewport: React__default.ForwardRefExoticComponent<SelectViewportProps & React__default.RefAttributes<HTMLDivElement>>;
76
+
77
+ interface SelectItemTextProps extends PrimitiveSpanProps {
78
+ }
79
+ declare const SelectItemText: React__default.ForwardRefExoticComponent<SelectItemTextProps & React__default.RefAttributes<HTMLSpanElement>>;
80
+
81
+ interface SelectItemProps extends PrimitiveDivProps {
82
+ value: string;
83
+ disabled?: boolean;
84
+ textValue?: string;
85
+ }
86
+ declare const SelectItem: React__default.ForwardRefExoticComponent<SelectItemProps & React__default.RefAttributes<HTMLDivElement>>;
87
+
88
+ interface SelectContentProps extends SelectContentImplProps {
89
+ }
90
+ declare const SelectContent: React__default.ForwardRefExoticComponent<SelectContentProps & React__default.RefAttributes<HTMLDivElement>>;
91
+ type DismissableLayerProps = React__default.ComponentPropsWithoutRef<typeof DismissableLayer>;
92
+ type FocusScopeProps = React__default.ComponentPropsWithoutRef<typeof FocusScope>;
93
+ type SelectPopperPrivateProps = {
94
+ onPlaced?: PopperContentProps["onPlaced"];
95
+ };
96
+ interface SelectContentImplProps extends Omit<SelectPopperPositionProps, keyof SelectPopperPrivateProps>, Omit<SelectItemAlignedPositionProps, keyof SelectPopperPrivateProps> {
97
+ /**
98
+ * Event handler called when auto-focusing on close.
99
+ * Can be prevented.
100
+ */
101
+ onCloseAutoFocus?: FocusScopeProps["onUnmountAutoFocus"];
102
+ /**
103
+ * Event handler called when the escape key is down.
104
+ * Can be prevented.
105
+ */
106
+ onEscapeKeyDown?: DismissableLayerProps["onEscapeKeyDown"];
107
+ /**
108
+ * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
109
+ * Can be prevented.
110
+ */
111
+ onPointerDownOutside?: DismissableLayerProps["onPointerDownOutside"];
112
+ position?: "item-aligned" | "popper";
113
+ }
114
+ interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {
115
+ }
116
+ type PopperContentProps = React__default.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
117
+ interface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {
118
+ }
119
+
120
+ interface SelectGroupProps extends PrimitiveDivProps {
121
+ }
122
+ declare const SelectGroup: React__default.ForwardRefExoticComponent<SelectGroupProps & React__default.RefAttributes<HTMLDivElement>>;
123
+
124
+ interface SelectLabelProps extends PrimitiveDivProps {
125
+ }
126
+ declare const SelectLabel: React__default.ForwardRefExoticComponent<SelectLabelProps & React__default.RefAttributes<HTMLDivElement>>;
127
+
128
+ interface SelectItemIndicatorProps extends PrimitiveSpanProps {
129
+ }
130
+ declare const SelectItemIndicator: React__default.ForwardRefExoticComponent<SelectItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
131
+
132
+ interface SelectScrollUpButtonProps extends Omit<SelectScrollButtonImplProps, "onAutoScroll"> {
133
+ }
134
+ declare const SelectScrollUpButton: React__default.ForwardRefExoticComponent<SelectScrollUpButtonProps & React__default.RefAttributes<HTMLDivElement>>;
135
+
136
+ interface SelectSeparatorProps extends PrimitiveDivProps {
137
+ }
138
+ declare const SelectSeparator: React__default.ForwardRefExoticComponent<SelectSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
139
+
140
+ type PopperArrowProps = React__default.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
141
+ interface SelectArrowProps extends PopperArrowProps {
142
+ }
143
+ declare const SelectArrow: React__default.ForwardRefExoticComponent<SelectArrowProps & React__default.RefAttributes<SVGSVGElement>>;
144
+
145
+ export { Root, Select, SelectArrow, type SelectArrowProps, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectIcon, type SelectIconProps, SelectItem, SelectItemIndicator, type SelectItemIndicatorProps, type SelectItemProps, SelectItemText, type SelectItemTextProps, SelectLabel, type SelectLabelProps, SelectPortal, type SelectPortalProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, SelectViewport, type SelectViewportProps, createSelectScope };