@choice-ui/react 1.8.8 → 1.9.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/dist/components/button/dist/index.js +0 -7
- package/dist/components/checkbox/src/checkbox-icon.d.ts +8 -0
- package/dist/components/checkbox/src/checkbox-icon.js +41 -0
- package/dist/components/checkbox/src/checkbox.d.ts +2 -0
- package/dist/components/checkbox/src/checkbox.js +18 -5
- package/dist/components/checkbox/src/index.d.ts +2 -0
- package/dist/components/colors/src/color-image-paint/color-image-paint.js +2 -2
- package/dist/components/dropdown/dist/index.d.ts +0 -6
- package/dist/components/dropdown/dist/index.js +8 -12
- package/dist/components/dropdown/src/dropdown.js +8 -2
- package/dist/components/emoji-picker/dist/index.d.ts +1 -29
- package/dist/components/emoji-picker/dist/index.js +42 -144
- package/dist/components/form/src/adapters/range-adapter.js +2 -2
- package/dist/components/icon-button/dist/index.d.ts +1 -1
- package/dist/components/icon-button/dist/index.js +0 -39
- package/dist/components/menus/dist/index.d.ts +0 -5
- package/dist/components/menus/dist/index.js +1 -18
- package/dist/components/menus/src/context/menu-context-sub-trigger.js +6 -1
- package/dist/components/menus/src/hooks/use-menu-tree.js +8 -1
- package/dist/components/radio/src/context.d.ts +2 -0
- package/dist/components/radio/src/index.d.ts +2 -0
- package/dist/components/radio/src/radio-icon.d.ts +7 -0
- package/dist/components/radio/src/radio-icon.js +41 -0
- package/dist/components/radio/src/radio.d.ts +2 -0
- package/dist/components/radio/src/radio.js +19 -6
- package/dist/components/range/dist/index.d.ts +20 -276
- package/dist/components/range/dist/index.js +616 -1044
- package/dist/components/textarea/dist/index.js +1 -3
- package/dist/components/tooltip/dist/index.d.ts +0 -2
- package/dist/components/tooltip/dist/index.js +5 -23
- package/package.json +32 -20
- package/dist/components/virtual-select/dist/index.d.ts +0 -48
|
@@ -28,12 +28,6 @@ var iconButtonTv = tcv({
|
|
|
28
28
|
highlight: {},
|
|
29
29
|
ghost: {},
|
|
30
30
|
dark: { button: "text-white" },
|
|
31
|
-
submit: {
|
|
32
|
-
button: [
|
|
33
|
-
"bg-[var(--theme-submit-btn-bg)] text-[var(--theme-submit-btn-text)]",
|
|
34
|
-
"focus-visible:border-transparent"
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
31
|
reset: {}
|
|
38
32
|
},
|
|
39
33
|
active: {
|
|
@@ -147,39 +141,6 @@ var iconButtonTv = tcv({
|
|
|
147
141
|
variant: "dark",
|
|
148
142
|
disabled: true,
|
|
149
143
|
class: { button: "text-gray-500" }
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
variant: "submit",
|
|
153
|
-
active: false,
|
|
154
|
-
disabled: false,
|
|
155
|
-
class: {
|
|
156
|
-
button: ["focus-visible:shadow-focus", "hover:opacity-70", "active:opacity-70"]
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
variant: "submit",
|
|
161
|
-
active: true,
|
|
162
|
-
disabled: false,
|
|
163
|
-
class: {
|
|
164
|
-
button: "opacity-70"
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
variant: "submit",
|
|
169
|
-
focused: true,
|
|
170
|
-
class: {
|
|
171
|
-
button: ["shadow-focus", "border-transparent"]
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
variant: "submit",
|
|
176
|
-
loading: true,
|
|
177
|
-
class: { button: "opacity-70" }
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
variant: "submit",
|
|
181
|
-
disabled: true,
|
|
182
|
-
class: { button: "opacity-50" }
|
|
183
144
|
}
|
|
184
145
|
],
|
|
185
146
|
defaultVariants: {
|
|
@@ -458,11 +458,6 @@ declare const MenuContext: react.Context<MenuContextType | null>;
|
|
|
458
458
|
interface MenuContextItemProps extends MenuItemProps {
|
|
459
459
|
customActive?: boolean;
|
|
460
460
|
exclusiveIndex?: number;
|
|
461
|
-
/**
|
|
462
|
-
* Whether this item is a link item. When true, a link icon will be displayed on the right.
|
|
463
|
-
* The actual link navigation should be handled by the onClick handler.
|
|
464
|
-
*/
|
|
465
|
-
asLink?: boolean;
|
|
466
461
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
467
462
|
onKeyDown?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
468
463
|
onMouseUp?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button } from "../../button/dist/index.js";
|
|
2
2
|
import React__default, { memo, forwardRef, useMemo, useContext, createContext, startTransition, useCallback, useRef, useState, useEffect, Children, isValidElement, Fragment as Fragment$1 } from "react";
|
|
3
3
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
4
|
-
import { ChevronDownSmall, Check,
|
|
4
|
+
import { ChevronDownSmall, Check, ChevronRightSmall, ChevronUpSmall } from "@choiceform/icons-react";
|
|
5
5
|
import { Kbd } from "../../kbd/dist/index.js";
|
|
6
6
|
import { flushSync } from "react-dom";
|
|
7
7
|
import { SearchInput } from "../../search-input/dist/index.js";
|
|
@@ -418,13 +418,9 @@ var MenuLabel = memo(function MenuLabel2({
|
|
|
418
418
|
});
|
|
419
419
|
MenuLabel.displayName = "MenuLabel";
|
|
420
420
|
var SCROLL_ARROW_PADDING = 16;
|
|
421
|
-
var MIN_HEIGHT_FOR_ARROWS = 48;
|
|
422
421
|
var shouldShowArrow = (scrollRef, dir) => {
|
|
423
422
|
if (scrollRef.current) {
|
|
424
423
|
const { scrollTop, scrollHeight, clientHeight } = scrollRef.current;
|
|
425
|
-
if (clientHeight < MIN_HEIGHT_FOR_ARROWS) {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
424
|
if (dir === "up") {
|
|
429
425
|
return scrollTop >= SCROLL_ARROW_PADDING;
|
|
430
426
|
}
|
|
@@ -908,9 +904,7 @@ var MenuContextItem = memo(
|
|
|
908
904
|
size: size2,
|
|
909
905
|
shortcut,
|
|
910
906
|
prefixElement,
|
|
911
|
-
suffixElement,
|
|
912
907
|
variant,
|
|
913
|
-
asLink,
|
|
914
908
|
onClick,
|
|
915
909
|
onMouseUp,
|
|
916
910
|
onTouchStart,
|
|
@@ -975,16 +969,6 @@ var MenuContextItem = memo(
|
|
|
975
969
|
}),
|
|
976
970
|
[shortcut == null ? void 0 : shortcut.modifier, shortcut == null ? void 0 : shortcut.keys]
|
|
977
971
|
);
|
|
978
|
-
const suffixConfig = useMemo(() => {
|
|
979
|
-
if (suffixElement !== void 0) return suffixElement;
|
|
980
|
-
if (prefixElement !== void 0 && menu.selection && !customActive && selected) {
|
|
981
|
-
return /* @__PURE__ */ jsx(Check, {});
|
|
982
|
-
}
|
|
983
|
-
if (asLink) {
|
|
984
|
-
return /* @__PURE__ */ jsx(Launch, { className: "h-3 w-3 text-current" });
|
|
985
|
-
}
|
|
986
|
-
return void 0;
|
|
987
|
-
}, [suffixElement, prefixElement, menu.selection, selected, customActive, asLink]);
|
|
988
972
|
const combinedRef = useCallback(
|
|
989
973
|
(node) => {
|
|
990
974
|
item.ref(node);
|
|
@@ -1007,7 +991,6 @@ var MenuContextItem = memo(
|
|
|
1007
991
|
disabled,
|
|
1008
992
|
selected,
|
|
1009
993
|
prefixElement: prefixConfig,
|
|
1010
|
-
suffixElement: suffixConfig,
|
|
1011
994
|
shortcut: shortcutConfig,
|
|
1012
995
|
variant,
|
|
1013
996
|
size: size2,
|
|
@@ -26,7 +26,12 @@ const MenuContextSubTrigger = memo(
|
|
|
26
26
|
throw new Error("MenuContextSubTrigger must be used within a MenuContext component");
|
|
27
27
|
}
|
|
28
28
|
const isActive = useMemo(
|
|
29
|
-
() =>
|
|
29
|
+
() => {
|
|
30
|
+
if (menu.activeIndex !== null && menu.activeIndex !== void 0) {
|
|
31
|
+
return item.index === menu.activeIndex;
|
|
32
|
+
}
|
|
33
|
+
return !!active;
|
|
34
|
+
},
|
|
30
35
|
[item.index, menu.activeIndex, active]
|
|
31
36
|
);
|
|
32
37
|
const handleFocus = useEventCallback((event) => {
|
|
@@ -16,18 +16,25 @@ function useMenuTree(config) {
|
|
|
16
16
|
handleOpenChange(false);
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
const handleParentNavigate = useEventCallback((event) => {
|
|
20
|
+
if (event.nodeId === parentId && event.index !== item.index && isControlledOpen) {
|
|
21
|
+
handleOpenChange(false);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
19
24
|
const cleanupTreeEvents = useEventCallback(() => {
|
|
20
25
|
if (tree) {
|
|
21
26
|
tree.events.off("click", handleTreeClick);
|
|
22
27
|
tree.events.off("menuopen", handleSubMenuOpen);
|
|
28
|
+
tree.events.off("navigate", handleParentNavigate);
|
|
23
29
|
}
|
|
24
30
|
});
|
|
25
31
|
useEffect(() => {
|
|
26
32
|
if (!tree) return;
|
|
27
33
|
tree.events.on("click", handleTreeClick);
|
|
28
34
|
tree.events.on("menuopen", handleSubMenuOpen);
|
|
35
|
+
tree.events.on("navigate", handleParentNavigate);
|
|
29
36
|
return cleanupTreeEvents;
|
|
30
|
-
}, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, cleanupTreeEvents]);
|
|
37
|
+
}, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, handleParentNavigate, cleanupTreeEvents]);
|
|
31
38
|
useEffect(() => {
|
|
32
39
|
if (isControlledOpen && tree) {
|
|
33
40
|
tree.events.emit("menuopen", { parentId, nodeId });
|
|
@@ -2,6 +2,8 @@ export interface RadioContextType {
|
|
|
2
2
|
descriptionId: string;
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
id: string;
|
|
5
|
+
value?: boolean;
|
|
6
|
+
variant?: "default" | "accent" | "outline";
|
|
5
7
|
}
|
|
6
8
|
export declare const RadioContext: import('react').Context<RadioContextType | null>;
|
|
7
9
|
export declare function useRadioContext(): RadioContextType;
|
|
@@ -2,3 +2,5 @@ export { Radio } from './radio';
|
|
|
2
2
|
export { RadioGroup } from './radio-group';
|
|
3
3
|
export type { RadioProps } from './radio';
|
|
4
4
|
export type { RadioGroupProps } from './radio-group';
|
|
5
|
+
export type { RadioIconProps } from './radio-icon';
|
|
6
|
+
export type { RadioLabelProps } from './radio-label';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
+
export interface RadioIconProps extends Omit<HTMLProps<HTMLDivElement>, "children"> {
|
|
3
|
+
children?: ReactNode | ((props: {
|
|
4
|
+
value?: boolean;
|
|
5
|
+
}) => ReactNode);
|
|
6
|
+
}
|
|
7
|
+
export declare const RadioIcon: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<RadioIconProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dot } from "@choiceform/icons-react";
|
|
3
|
+
import { memo, forwardRef } from "react";
|
|
4
|
+
import { useRadioContext } from "./context.js";
|
|
5
|
+
import { radioTv } from "./tv.js";
|
|
6
|
+
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
7
|
+
const RadioIcon = memo(
|
|
8
|
+
forwardRef(function RadioIcon2(props, ref) {
|
|
9
|
+
const { className, children, ...rest } = props;
|
|
10
|
+
const { value, disabled, variant } = useRadioContext();
|
|
11
|
+
const tv = radioTv({
|
|
12
|
+
type: "radio",
|
|
13
|
+
variant,
|
|
14
|
+
disabled,
|
|
15
|
+
checked: value
|
|
16
|
+
});
|
|
17
|
+
const renderIcon = () => {
|
|
18
|
+
if (typeof children === "function") {
|
|
19
|
+
return children({ value });
|
|
20
|
+
}
|
|
21
|
+
if (children !== void 0) {
|
|
22
|
+
return children;
|
|
23
|
+
}
|
|
24
|
+
return value ? /* @__PURE__ */ jsx(Dot, {}) : null;
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
className: tcx(tv.box(), className),
|
|
31
|
+
"data-active": value,
|
|
32
|
+
...rest,
|
|
33
|
+
children: renderIcon()
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
RadioIcon.displayName = "Radio.Icon";
|
|
39
|
+
export {
|
|
40
|
+
RadioIcon
|
|
41
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
+
import { RadioIcon } from './radio-icon';
|
|
2
3
|
import { RadioLabel } from './radio-label';
|
|
3
4
|
export interface RadioProps extends Omit<HTMLProps<HTMLInputElement>, "value" | "onChange"> {
|
|
4
5
|
children?: ReactNode;
|
|
@@ -13,6 +14,7 @@ interface RadioType {
|
|
|
13
14
|
(props: RadioProps & {
|
|
14
15
|
ref?: React.Ref<HTMLInputElement>;
|
|
15
16
|
}): JSX.Element;
|
|
17
|
+
Icon: typeof RadioIcon;
|
|
16
18
|
Label: typeof RadioLabel;
|
|
17
19
|
displayName?: string;
|
|
18
20
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Dot } from "@choiceform/icons-react";
|
|
3
|
-
import { memo, forwardRef, useId } from "react";
|
|
3
|
+
import { memo, forwardRef, useId, Children, isValidElement } from "react";
|
|
4
4
|
import { useEventCallback } from "usehooks-ts";
|
|
5
5
|
import { RadioContext } from "./context.js";
|
|
6
|
+
import { RadioIcon } from "./radio-icon.js";
|
|
6
7
|
import { RadioLabel } from "./radio-label.js";
|
|
7
8
|
import { radioTv } from "./tv.js";
|
|
8
9
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
@@ -43,13 +44,24 @@ const RadioBase = forwardRef(function Radio2(props, ref) {
|
|
|
43
44
|
}
|
|
44
45
|
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
45
46
|
});
|
|
47
|
+
const isIconElement = (child) => {
|
|
48
|
+
var _a;
|
|
49
|
+
return isValidElement(child) && (child.type === RadioIcon || ((_a = child.type) == null ? void 0 : _a.displayName) === "Radio.Icon");
|
|
50
|
+
};
|
|
51
|
+
const childArray = Children.toArray(children);
|
|
52
|
+
const iconChild = childArray.find(isIconElement);
|
|
53
|
+
const otherChildren = childArray.filter((child) => !isIconElement(child));
|
|
46
54
|
const renderChildren = () => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
55
|
+
if (otherChildren.length === 1) {
|
|
56
|
+
const child = otherChildren[0];
|
|
57
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
58
|
+
return /* @__PURE__ */ jsx(RadioLabel, { children: child });
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
|
-
return
|
|
61
|
+
return otherChildren;
|
|
51
62
|
};
|
|
52
|
-
|
|
63
|
+
const renderDefaultIcon = () => /* @__PURE__ */ jsx("div", { className: tv.box(), children: value && /* @__PURE__ */ jsx(Dot, {}) });
|
|
64
|
+
return /* @__PURE__ */ jsx(RadioContext.Provider, { value: { id, descriptionId, disabled, value, variant }, children: /* @__PURE__ */ jsxs("div", { className: tcx(tv.root(), className), children: [
|
|
53
65
|
/* @__PURE__ */ jsxs("div", { className: "pointer-events-none relative", children: [
|
|
54
66
|
/* @__PURE__ */ jsx(
|
|
55
67
|
"input",
|
|
@@ -71,13 +83,14 @@ const RadioBase = forwardRef(function Radio2(props, ref) {
|
|
|
71
83
|
...rest
|
|
72
84
|
}
|
|
73
85
|
),
|
|
74
|
-
|
|
86
|
+
iconChild ?? renderDefaultIcon()
|
|
75
87
|
] }),
|
|
76
88
|
renderChildren()
|
|
77
89
|
] }) });
|
|
78
90
|
});
|
|
79
91
|
const MemoizedRadio = memo(RadioBase);
|
|
80
92
|
const Radio = MemoizedRadio;
|
|
93
|
+
Radio.Icon = RadioIcon;
|
|
81
94
|
Radio.Label = RadioLabel;
|
|
82
95
|
Radio.displayName = "Radio";
|
|
83
96
|
export {
|
|
@@ -1,60 +1,10 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import * as React$1 from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import * as tailwind_variants from 'tailwind-variants';
|
|
5
|
-
|
|
6
|
-
interface RangeConnectsProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const RangeConnects: React$1.ForwardRefExoticComponent<RangeConnectsProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
interface RangeContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
className?: string;
|
|
13
|
-
height?: number;
|
|
14
|
-
}
|
|
15
|
-
declare function RangeContainer(props: RangeContainerProps): react_jsx_runtime.JSX.Element;
|
|
16
|
-
declare namespace RangeContainer {
|
|
17
|
-
var displayName: string;
|
|
18
|
-
}
|
|
19
|
-
interface RangeTupleConnectsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
-
className?: string;
|
|
21
|
-
}
|
|
22
|
-
declare const RangeTupleConnects: React$1.ForwardRefExoticComponent<RangeTupleConnectsProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
23
|
-
interface RangeTupleContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
-
children?: React.ReactNode;
|
|
25
|
-
className?: string;
|
|
26
|
-
height?: number;
|
|
27
|
-
}
|
|
28
|
-
declare function RangeTupleContainer(props: RangeTupleContainerProps): react_jsx_runtime.JSX.Element;
|
|
29
|
-
declare namespace RangeTupleContainer {
|
|
30
|
-
var displayName: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface RangeThumbProps {
|
|
34
|
-
className?: string;
|
|
35
|
-
size?: number;
|
|
36
|
-
}
|
|
37
|
-
declare const RangeThumb: React__default.ForwardRefExoticComponent<RangeThumbProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
38
|
-
type ThumbIndex$1 = 0 | 1;
|
|
39
|
-
interface RangeTupleThumbProps {
|
|
40
|
-
className?: string;
|
|
41
|
-
size?: number;
|
|
42
|
-
index: ThumbIndex$1;
|
|
43
|
-
}
|
|
44
|
-
declare const RangeTupleThumb: React__default.ForwardRefExoticComponent<RangeTupleThumbProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
45
|
-
|
|
46
|
-
interface RangeDotProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
47
|
-
className?: string;
|
|
48
|
-
}
|
|
49
|
-
interface RangeTupleDotProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
50
|
-
className?: string;
|
|
51
|
-
}
|
|
52
|
-
declare const RangeDot: React$1.ForwardRefExoticComponent<RangeDotProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
53
|
-
declare const RangeTupleDot: React$1.ForwardRefExoticComponent<RangeTupleDotProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
54
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
55
2
|
interface RangeProps {
|
|
56
|
-
children?: React__default.ReactNode;
|
|
57
3
|
className?: string;
|
|
4
|
+
connectsClassName?: {
|
|
5
|
+
negative?: string;
|
|
6
|
+
positive?: string;
|
|
7
|
+
};
|
|
58
8
|
defaultValue?: number;
|
|
59
9
|
disabled?: boolean;
|
|
60
10
|
max?: number;
|
|
@@ -65,24 +15,20 @@ interface RangeProps {
|
|
|
65
15
|
readOnly?: boolean;
|
|
66
16
|
step?: number;
|
|
67
17
|
thumbSize?: number;
|
|
18
|
+
trackSize?: {
|
|
19
|
+
height?: number;
|
|
20
|
+
width?: number | "auto";
|
|
21
|
+
};
|
|
68
22
|
value?: number;
|
|
69
|
-
/**
|
|
70
|
-
* Width of the range track in pixels.
|
|
71
|
-
* If not provided (undefined), the width will be auto-calculated from the container.
|
|
72
|
-
*/
|
|
73
|
-
width?: number | boolean;
|
|
74
|
-
}
|
|
75
|
-
interface RangeComponent extends React__default.ForwardRefExoticComponent<RangeProps & React__default.RefAttributes<HTMLDivElement>> {
|
|
76
|
-
Container: typeof RangeContainer;
|
|
77
|
-
Connects: typeof RangeConnects;
|
|
78
|
-
Thumb: typeof RangeThumb;
|
|
79
|
-
Dot: typeof RangeDot;
|
|
80
23
|
}
|
|
81
|
-
declare const Range:
|
|
24
|
+
declare const Range: React.ForwardRefExoticComponent<RangeProps & React.RefAttributes<HTMLDivElement>>;
|
|
82
25
|
|
|
83
26
|
interface RangeTupleProps {
|
|
84
|
-
children?: React__default.ReactNode;
|
|
85
27
|
className?: string;
|
|
28
|
+
connectsClassName?: {
|
|
29
|
+
negative?: string;
|
|
30
|
+
positive?: string;
|
|
31
|
+
};
|
|
86
32
|
defaultValue?: [number, number];
|
|
87
33
|
disabled?: boolean;
|
|
88
34
|
max?: number;
|
|
@@ -93,214 +39,12 @@ interface RangeTupleProps {
|
|
|
93
39
|
readOnly?: boolean;
|
|
94
40
|
step?: number;
|
|
95
41
|
thumbSize?: number;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* If not provided (undefined) or set to false, the width will be auto-calculated from the container.
|
|
100
|
-
*/
|
|
101
|
-
width?: number | boolean;
|
|
102
|
-
}
|
|
103
|
-
interface RangeTupleComponent extends React__default.ForwardRefExoticComponent<RangeTupleProps & React__default.RefAttributes<HTMLDivElement>> {
|
|
104
|
-
Container: typeof RangeTupleContainer;
|
|
105
|
-
Connects: typeof RangeTupleConnects;
|
|
106
|
-
Thumb: typeof RangeTupleThumb;
|
|
107
|
-
Dot: typeof RangeTupleDot;
|
|
108
|
-
}
|
|
109
|
-
declare const RangeTuple: RangeTupleComponent;
|
|
110
|
-
|
|
111
|
-
declare const rangeTv: tailwind_variants.TVReturnType<{
|
|
112
|
-
overStepValue: {
|
|
113
|
-
true: {
|
|
114
|
-
dot: string;
|
|
115
|
-
};
|
|
116
|
-
false: {
|
|
117
|
-
dot: string;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
defaultStepValue: {
|
|
121
|
-
true: {
|
|
122
|
-
dot: string;
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
hasStepOrDefault: {
|
|
126
|
-
true: {};
|
|
127
|
-
false: {};
|
|
128
|
-
};
|
|
129
|
-
currentDefaultValue: {
|
|
130
|
-
true: {};
|
|
131
|
-
false: {};
|
|
132
|
-
};
|
|
133
|
-
disabled: {
|
|
134
|
-
true: {
|
|
135
|
-
connect: string;
|
|
136
|
-
thumb: string;
|
|
137
|
-
};
|
|
138
|
-
false: {
|
|
139
|
-
connect: string;
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
}, {
|
|
143
|
-
container: string[];
|
|
144
|
-
connect: string[];
|
|
145
|
-
thumbWrapper: string[];
|
|
146
|
-
thumb: string[];
|
|
147
|
-
dotContainer: string;
|
|
148
|
-
dot: string[];
|
|
149
|
-
input: string;
|
|
150
|
-
}, undefined, {
|
|
151
|
-
overStepValue: {
|
|
152
|
-
true: {
|
|
153
|
-
dot: string;
|
|
154
|
-
};
|
|
155
|
-
false: {
|
|
156
|
-
dot: string;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
defaultStepValue: {
|
|
160
|
-
true: {
|
|
161
|
-
dot: string;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
hasStepOrDefault: {
|
|
165
|
-
true: {};
|
|
166
|
-
false: {};
|
|
167
|
-
};
|
|
168
|
-
currentDefaultValue: {
|
|
169
|
-
true: {};
|
|
170
|
-
false: {};
|
|
171
|
-
};
|
|
172
|
-
disabled: {
|
|
173
|
-
true: {
|
|
174
|
-
connect: string;
|
|
175
|
-
thumb: string;
|
|
176
|
-
};
|
|
177
|
-
false: {
|
|
178
|
-
connect: string;
|
|
179
|
-
};
|
|
42
|
+
trackSize?: {
|
|
43
|
+
height?: number;
|
|
44
|
+
width?: number | "auto";
|
|
180
45
|
};
|
|
181
|
-
|
|
182
|
-
container: string[];
|
|
183
|
-
connect: string[];
|
|
184
|
-
thumbWrapper: string[];
|
|
185
|
-
thumb: string[];
|
|
186
|
-
dotContainer: string;
|
|
187
|
-
dot: string[];
|
|
188
|
-
input: string;
|
|
189
|
-
}, tailwind_variants.TVReturnType<{
|
|
190
|
-
overStepValue: {
|
|
191
|
-
true: {
|
|
192
|
-
dot: string;
|
|
193
|
-
};
|
|
194
|
-
false: {
|
|
195
|
-
dot: string;
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
defaultStepValue: {
|
|
199
|
-
true: {
|
|
200
|
-
dot: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
hasStepOrDefault: {
|
|
204
|
-
true: {};
|
|
205
|
-
false: {};
|
|
206
|
-
};
|
|
207
|
-
currentDefaultValue: {
|
|
208
|
-
true: {};
|
|
209
|
-
false: {};
|
|
210
|
-
};
|
|
211
|
-
disabled: {
|
|
212
|
-
true: {
|
|
213
|
-
connect: string;
|
|
214
|
-
thumb: string;
|
|
215
|
-
};
|
|
216
|
-
false: {
|
|
217
|
-
connect: string;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
}, {
|
|
221
|
-
container: string[];
|
|
222
|
-
connect: string[];
|
|
223
|
-
thumbWrapper: string[];
|
|
224
|
-
thumb: string[];
|
|
225
|
-
dotContainer: string;
|
|
226
|
-
dot: string[];
|
|
227
|
-
input: string;
|
|
228
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
229
|
-
|
|
230
|
-
interface RangeContextValue {
|
|
231
|
-
currentValue: number;
|
|
232
|
-
disabled: boolean;
|
|
233
|
-
readOnly: boolean;
|
|
234
|
-
min: number;
|
|
235
|
-
max: number;
|
|
236
|
-
step: number;
|
|
237
|
-
thumbSize: number;
|
|
238
|
-
trackHeight: number;
|
|
239
|
-
transforms: {
|
|
240
|
-
minTransform: number;
|
|
241
|
-
maxTransform: number;
|
|
242
|
-
transformX: number;
|
|
243
|
-
};
|
|
244
|
-
defaultStepValue: number | null;
|
|
245
|
-
currentStepValue: number;
|
|
246
|
-
dotsData: Array<{
|
|
247
|
-
value: number;
|
|
248
|
-
position: number;
|
|
249
|
-
}> | null;
|
|
250
|
-
defaultDotPosition: number | null;
|
|
251
|
-
thumbRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
252
|
-
inputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
253
|
-
isDragging: React.MutableRefObject<boolean>;
|
|
254
|
-
handlePointerDown: (e: React.PointerEvent) => void;
|
|
255
|
-
handleKeyDown: (e: React.KeyboardEvent) => void;
|
|
256
|
-
tv: ReturnType<typeof rangeTv>;
|
|
257
|
-
defaultValue?: number;
|
|
258
|
-
hasCustomDot: boolean;
|
|
259
|
-
hasCustomConnects: boolean;
|
|
260
|
-
isDefaultValue?: boolean;
|
|
261
|
-
}
|
|
262
|
-
declare const RangeContext: React$1.Context<RangeContextValue | null>;
|
|
263
|
-
declare function useRangeContext(): RangeContextValue;
|
|
264
|
-
|
|
265
|
-
type ThumbIndex = 0 | 1;
|
|
266
|
-
interface RangeTupleContextValue {
|
|
267
|
-
currentValue: [number, number];
|
|
268
|
-
disabled: boolean;
|
|
269
|
-
readOnly: boolean;
|
|
270
|
-
min: number;
|
|
271
|
-
max: number;
|
|
272
|
-
step: number;
|
|
273
|
-
thumbSize: number;
|
|
274
|
-
trackHeight: number;
|
|
275
|
-
transforms: {
|
|
276
|
-
minTransform: number;
|
|
277
|
-
maxTransform: number;
|
|
278
|
-
transformX0: number;
|
|
279
|
-
transformX1: number;
|
|
280
|
-
};
|
|
281
|
-
defaultStepValue: [number, number] | null;
|
|
282
|
-
currentStepValue: [number, number];
|
|
283
|
-
dotsData: Array<{
|
|
284
|
-
value: number;
|
|
285
|
-
position: number;
|
|
286
|
-
}> | null;
|
|
287
|
-
defaultDotPositions: [number, number] | null;
|
|
288
|
-
normalizedDefaultValue: [number, number] | undefined;
|
|
289
|
-
thumb0Ref: React.RefObject<HTMLDivElement | null>;
|
|
290
|
-
thumb1Ref: React.RefObject<HTMLDivElement | null>;
|
|
291
|
-
input0Ref: React.RefObject<HTMLInputElement | null>;
|
|
292
|
-
input1Ref: React.RefObject<HTMLInputElement | null>;
|
|
293
|
-
isDragging: React.MutableRefObject<ThumbIndex | null>;
|
|
294
|
-
handlePointerDown: (e: React.PointerEvent, thumbIndex: ThumbIndex) => void;
|
|
295
|
-
handleKeyDown: (e: React.KeyboardEvent, thumbIndex: ThumbIndex) => void;
|
|
296
|
-
tv: ReturnType<typeof rangeTv>;
|
|
297
|
-
thumbTv0: ReturnType<typeof rangeTv>;
|
|
298
|
-
thumbTv1: ReturnType<typeof rangeTv>;
|
|
299
|
-
hasCustomDot: boolean;
|
|
300
|
-
hasCustomConnects: boolean;
|
|
301
|
-
isDefaultValue?: boolean;
|
|
46
|
+
value?: [number, number];
|
|
302
47
|
}
|
|
303
|
-
declare const
|
|
304
|
-
declare function useRangeTupleContext(): RangeTupleContextValue;
|
|
48
|
+
declare const RangeTuple: React.ForwardRefExoticComponent<RangeTupleProps & React.RefAttributes<HTMLDivElement>>;
|
|
305
49
|
|
|
306
|
-
export { Range, type
|
|
50
|
+
export { Range, type RangeProps, RangeTuple, type RangeTupleProps };
|