@choice-ui/react 1.9.0 → 1.9.1
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 +7 -0
- package/dist/components/checkbox/dist/index.d.ts +10 -1
- package/dist/components/checkbox/dist/index.js +49 -5
- package/dist/components/colors/dist/index.d.ts +39 -6
- package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.js +1 -4
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.d.ts +4 -4
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.js +9 -8
- package/dist/components/colors/src/color-image-paint/color-image-paint.js +2 -2
- package/dist/components/colors/src/color-slider/color-slider.d.ts +14 -6
- package/dist/components/colors/src/color-slider/color-slider.js +124 -46
- package/dist/components/colors/src/color-slider/components/index.d.ts +2 -0
- package/dist/components/colors/src/color-slider/components/thumb.d.ts +8 -0
- package/dist/components/colors/src/color-slider/components/thumb.js +49 -0
- package/dist/components/colors/src/color-slider/components/track.d.ts +18 -0
- package/dist/components/colors/src/color-slider/components/track.js +19 -0
- package/dist/components/colors/src/color-slider/context.d.ts +23 -0
- package/dist/components/colors/src/color-slider/context.js +13 -0
- package/dist/components/colors/src/color-slider/index.d.ts +2 -0
- package/dist/components/colors/src/color-slider/tv.d.ts +3 -0
- package/dist/components/colors/src/color-slider/tv.js +2 -1
- package/dist/components/colors/src/color-solid-paint/color-solid-paint.js +4 -7
- package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.js +2 -2
- package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.js +2 -2
- package/dist/components/colors/src/simple-color-picker/simple-color-picker.js +4 -7
- package/dist/components/dropdown/dist/index.d.ts +6 -0
- package/dist/components/dropdown/dist/index.js +20 -10
- package/dist/components/emoji-picker/dist/index.d.ts +29 -1
- package/dist/components/emoji-picker/dist/index.js +144 -42
- 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 +39 -0
- package/dist/components/menus/dist/index.d.ts +5 -0
- package/dist/components/menus/dist/index.js +32 -3
- package/dist/components/radio/dist/index.d.ts +9 -1
- package/dist/components/radio/dist/index.js +50 -6
- package/dist/components/range/dist/index.d.ts +276 -20
- package/dist/components/range/dist/index.js +1030 -602
- package/dist/components/textarea/dist/index.js +3 -1
- package/dist/components/tooltip/dist/index.d.ts +2 -0
- package/dist/components/tooltip/dist/index.js +23 -5
- package/dist/components/virtual-select/dist/index.d.ts +48 -0
- package/package.json +20 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Range } from "../../../range/dist/index.js";
|
|
2
|
+
import { Range as Range2 } from "../../../range/dist/index.js";
|
|
3
3
|
import { filterFormProps, BaseAdapter } from "./base-adapter.js";
|
|
4
4
|
function RangeAdapter({
|
|
5
5
|
className,
|
|
@@ -23,7 +23,7 @@ function RangeAdapter({
|
|
|
23
23
|
legendMode: true,
|
|
24
24
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
25
25
|
/* @__PURE__ */ jsx(
|
|
26
|
-
|
|
26
|
+
Range2,
|
|
27
27
|
{
|
|
28
28
|
value,
|
|
29
29
|
onChange: (inputValue) => onChange(inputValue),
|
|
@@ -14,7 +14,7 @@ interface IconButtonProps extends Omit<HTMLProps<HTMLElement>, "size" | "as"> {
|
|
|
14
14
|
readOnly?: boolean;
|
|
15
15
|
size?: "default" | "large" | "reset";
|
|
16
16
|
tooltip?: TooltipProps;
|
|
17
|
-
variant?: "default" | "secondary" | "solid" | "highlight" | "ghost" | "dark" | "reset";
|
|
17
|
+
variant?: "default" | "secondary" | "solid" | "highlight" | "ghost" | "dark" | "submit" | "reset";
|
|
18
18
|
}
|
|
19
19
|
declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & react.RefAttributes<HTMLElement>>;
|
|
20
20
|
|
|
@@ -28,6 +28,12 @@ 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
|
+
},
|
|
31
37
|
reset: {}
|
|
32
38
|
},
|
|
33
39
|
active: {
|
|
@@ -141,6 +147,39 @@ var iconButtonTv = tcv({
|
|
|
141
147
|
variant: "dark",
|
|
142
148
|
disabled: true,
|
|
143
149
|
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" }
|
|
144
183
|
}
|
|
145
184
|
],
|
|
146
185
|
defaultVariants: {
|
|
@@ -458,6 +458,11 @@ 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;
|
|
461
466
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
462
467
|
onKeyDown?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
463
468
|
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, ChevronRightSmall, ChevronUpSmall } from "@choiceform/icons-react";
|
|
4
|
+
import { ChevronDownSmall, Check, Launch, 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,9 +418,13 @@ 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;
|
|
421
422
|
var shouldShowArrow = (scrollRef, dir) => {
|
|
422
423
|
if (scrollRef.current) {
|
|
423
424
|
const { scrollTop, scrollHeight, clientHeight } = scrollRef.current;
|
|
425
|
+
if (clientHeight < MIN_HEIGHT_FOR_ARROWS) {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
424
428
|
if (dir === "up") {
|
|
425
429
|
return scrollTop >= SCROLL_ARROW_PADDING;
|
|
426
430
|
}
|
|
@@ -839,18 +843,25 @@ function useMenuTree(config) {
|
|
|
839
843
|
handleOpenChange(false);
|
|
840
844
|
}
|
|
841
845
|
});
|
|
846
|
+
const handleParentNavigate = useEventCallback((event) => {
|
|
847
|
+
if (event.nodeId === parentId && event.index !== item.index && isControlledOpen) {
|
|
848
|
+
handleOpenChange(false);
|
|
849
|
+
}
|
|
850
|
+
});
|
|
842
851
|
const cleanupTreeEvents = useEventCallback(() => {
|
|
843
852
|
if (tree) {
|
|
844
853
|
tree.events.off("click", handleTreeClick);
|
|
845
854
|
tree.events.off("menuopen", handleSubMenuOpen);
|
|
855
|
+
tree.events.off("navigate", handleParentNavigate);
|
|
846
856
|
}
|
|
847
857
|
});
|
|
848
858
|
useEffect(() => {
|
|
849
859
|
if (!tree) return;
|
|
850
860
|
tree.events.on("click", handleTreeClick);
|
|
851
861
|
tree.events.on("menuopen", handleSubMenuOpen);
|
|
862
|
+
tree.events.on("navigate", handleParentNavigate);
|
|
852
863
|
return cleanupTreeEvents;
|
|
853
|
-
}, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, cleanupTreeEvents]);
|
|
864
|
+
}, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, handleParentNavigate, cleanupTreeEvents]);
|
|
854
865
|
useEffect(() => {
|
|
855
866
|
if (isControlledOpen && tree) {
|
|
856
867
|
tree.events.emit("menuopen", { parentId, nodeId });
|
|
@@ -904,7 +915,9 @@ var MenuContextItem = memo(
|
|
|
904
915
|
size: size2,
|
|
905
916
|
shortcut,
|
|
906
917
|
prefixElement,
|
|
918
|
+
suffixElement,
|
|
907
919
|
variant,
|
|
920
|
+
asLink,
|
|
908
921
|
onClick,
|
|
909
922
|
onMouseUp,
|
|
910
923
|
onTouchStart,
|
|
@@ -969,6 +982,16 @@ var MenuContextItem = memo(
|
|
|
969
982
|
}),
|
|
970
983
|
[shortcut == null ? void 0 : shortcut.modifier, shortcut == null ? void 0 : shortcut.keys]
|
|
971
984
|
);
|
|
985
|
+
const suffixConfig = useMemo(() => {
|
|
986
|
+
if (suffixElement !== void 0) return suffixElement;
|
|
987
|
+
if (prefixElement !== void 0 && menu.selection && !customActive && selected) {
|
|
988
|
+
return /* @__PURE__ */ jsx(Check, {});
|
|
989
|
+
}
|
|
990
|
+
if (asLink) {
|
|
991
|
+
return /* @__PURE__ */ jsx(Launch, { className: "h-3 w-3 text-current" });
|
|
992
|
+
}
|
|
993
|
+
return void 0;
|
|
994
|
+
}, [suffixElement, prefixElement, menu.selection, selected, customActive, asLink]);
|
|
972
995
|
const combinedRef = useCallback(
|
|
973
996
|
(node) => {
|
|
974
997
|
item.ref(node);
|
|
@@ -991,6 +1014,7 @@ var MenuContextItem = memo(
|
|
|
991
1014
|
disabled,
|
|
992
1015
|
selected,
|
|
993
1016
|
prefixElement: prefixConfig,
|
|
1017
|
+
suffixElement: suffixConfig,
|
|
994
1018
|
shortcut: shortcutConfig,
|
|
995
1019
|
variant,
|
|
996
1020
|
size: size2,
|
|
@@ -1058,7 +1082,12 @@ var MenuContextSubTrigger = memo(
|
|
|
1058
1082
|
throw new Error("MenuContextSubTrigger must be used within a MenuContext component");
|
|
1059
1083
|
}
|
|
1060
1084
|
const isActive = useMemo(
|
|
1061
|
-
() =>
|
|
1085
|
+
() => {
|
|
1086
|
+
if (menu.activeIndex !== null && menu.activeIndex !== void 0) {
|
|
1087
|
+
return item.index === menu.activeIndex;
|
|
1088
|
+
}
|
|
1089
|
+
return !!active;
|
|
1090
|
+
},
|
|
1062
1091
|
[item.index, menu.activeIndex, active]
|
|
1063
1092
|
);
|
|
1064
1093
|
const handleFocus = useEventCallback((event) => {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
|
|
4
|
+
interface RadioIconProps extends Omit<HTMLProps<HTMLDivElement>, "children"> {
|
|
5
|
+
children?: ReactNode | ((props: {
|
|
6
|
+
value?: boolean;
|
|
7
|
+
}) => ReactNode);
|
|
8
|
+
}
|
|
9
|
+
declare const RadioIcon: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<RadioIconProps, "ref"> & react.RefAttributes<HTMLDivElement>>>;
|
|
10
|
+
|
|
4
11
|
interface RadioLabelProps extends Omit<HTMLProps<HTMLLabelElement>, "htmlFor" | "id" | "disabled"> {
|
|
5
12
|
children: ReactNode;
|
|
6
13
|
}
|
|
@@ -19,6 +26,7 @@ interface RadioType {
|
|
|
19
26
|
(props: RadioProps & {
|
|
20
27
|
ref?: React.Ref<HTMLInputElement>;
|
|
21
28
|
}): JSX.Element;
|
|
29
|
+
Icon: typeof RadioIcon;
|
|
22
30
|
Label: typeof RadioLabel;
|
|
23
31
|
displayName?: string;
|
|
24
32
|
}
|
|
@@ -50,4 +58,4 @@ interface RadioGroupType {
|
|
|
50
58
|
}
|
|
51
59
|
declare const RadioGroup: RadioGroupType;
|
|
52
60
|
|
|
53
|
-
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|
|
61
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioIconProps, type RadioLabelProps, type RadioProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dot } from "@choiceform/icons-react";
|
|
2
|
-
import { memo, forwardRef, useId, useMemo, createContext, useContext } from "react";
|
|
2
|
+
import { memo, forwardRef, useId, useMemo, createContext, useContext, Children, isValidElement } from "react";
|
|
3
3
|
import { useEventCallback } from "usehooks-ts";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { tcx, tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
@@ -145,6 +145,38 @@ var radioTv = tcv({
|
|
|
145
145
|
focused: false
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
+
var RadioIcon = memo(
|
|
149
|
+
forwardRef(function RadioIcon2(props, ref) {
|
|
150
|
+
const { className, children, ...rest } = props;
|
|
151
|
+
const { value, disabled, variant } = useRadioContext();
|
|
152
|
+
const tv = radioTv({
|
|
153
|
+
type: "radio",
|
|
154
|
+
variant,
|
|
155
|
+
disabled,
|
|
156
|
+
checked: value
|
|
157
|
+
});
|
|
158
|
+
const renderIcon = () => {
|
|
159
|
+
if (typeof children === "function") {
|
|
160
|
+
return children({ value });
|
|
161
|
+
}
|
|
162
|
+
if (children !== void 0) {
|
|
163
|
+
return children;
|
|
164
|
+
}
|
|
165
|
+
return value ? /* @__PURE__ */ jsx(Dot, {}) : null;
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ jsx(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
ref,
|
|
171
|
+
className: tcx(tv.box(), className),
|
|
172
|
+
"data-active": value,
|
|
173
|
+
...rest,
|
|
174
|
+
children: renderIcon()
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
RadioIcon.displayName = "Radio.Icon";
|
|
148
180
|
var RadioLabel = memo(
|
|
149
181
|
forwardRef(function RadioLabel2(props, ref) {
|
|
150
182
|
const { children, className, ...rest } = props;
|
|
@@ -201,13 +233,24 @@ var RadioBase = forwardRef(function Radio(props, ref) {
|
|
|
201
233
|
}
|
|
202
234
|
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
203
235
|
});
|
|
236
|
+
const isIconElement = (child) => {
|
|
237
|
+
var _a;
|
|
238
|
+
return isValidElement(child) && (child.type === RadioIcon || ((_a = child.type) == null ? void 0 : _a.displayName) === "Radio.Icon");
|
|
239
|
+
};
|
|
240
|
+
const childArray = Children.toArray(children);
|
|
241
|
+
const iconChild = childArray.find(isIconElement);
|
|
242
|
+
const otherChildren = childArray.filter((child) => !isIconElement(child));
|
|
204
243
|
const renderChildren = () => {
|
|
205
|
-
if (
|
|
206
|
-
|
|
244
|
+
if (otherChildren.length === 1) {
|
|
245
|
+
const child = otherChildren[0];
|
|
246
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
247
|
+
return /* @__PURE__ */ jsx(RadioLabel, { children: child });
|
|
248
|
+
}
|
|
207
249
|
}
|
|
208
|
-
return
|
|
250
|
+
return otherChildren;
|
|
209
251
|
};
|
|
210
|
-
|
|
252
|
+
const renderDefaultIcon = () => /* @__PURE__ */ jsx("div", { className: tv.box(), children: value && /* @__PURE__ */ jsx(Dot, {}) });
|
|
253
|
+
return /* @__PURE__ */ jsx(RadioContext.Provider, { value: { id, descriptionId, disabled, value, variant }, children: /* @__PURE__ */ jsxs("div", { className: tcx(tv.root(), className), children: [
|
|
211
254
|
/* @__PURE__ */ jsxs("div", { className: "pointer-events-none relative", children: [
|
|
212
255
|
/* @__PURE__ */ jsx(
|
|
213
256
|
"input",
|
|
@@ -229,13 +272,14 @@ var RadioBase = forwardRef(function Radio(props, ref) {
|
|
|
229
272
|
...rest
|
|
230
273
|
}
|
|
231
274
|
),
|
|
232
|
-
|
|
275
|
+
iconChild ?? renderDefaultIcon()
|
|
233
276
|
] }),
|
|
234
277
|
renderChildren()
|
|
235
278
|
] }) });
|
|
236
279
|
});
|
|
237
280
|
var MemoizedRadio = memo(RadioBase);
|
|
238
281
|
var Radio2 = MemoizedRadio;
|
|
282
|
+
Radio2.Icon = RadioIcon;
|
|
239
283
|
Radio2.Label = RadioLabel;
|
|
240
284
|
Radio2.displayName = "Radio";
|
|
241
285
|
var RadioGroupItem = memo(
|
|
@@ -1,10 +1,60 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as React__default } from 'react';
|
|
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
|
+
|
|
2
55
|
interface RangeProps {
|
|
56
|
+
children?: React__default.ReactNode;
|
|
3
57
|
className?: string;
|
|
4
|
-
connectsClassName?: {
|
|
5
|
-
negative?: string;
|
|
6
|
-
positive?: string;
|
|
7
|
-
};
|
|
8
58
|
defaultValue?: number;
|
|
9
59
|
disabled?: boolean;
|
|
10
60
|
max?: number;
|
|
@@ -15,20 +65,24 @@ interface RangeProps {
|
|
|
15
65
|
readOnly?: boolean;
|
|
16
66
|
step?: number;
|
|
17
67
|
thumbSize?: number;
|
|
18
|
-
trackSize?: {
|
|
19
|
-
height?: number;
|
|
20
|
-
width?: number | "auto";
|
|
21
|
-
};
|
|
22
68
|
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;
|
|
23
80
|
}
|
|
24
|
-
declare const Range:
|
|
81
|
+
declare const Range: RangeComponent;
|
|
25
82
|
|
|
26
83
|
interface RangeTupleProps {
|
|
84
|
+
children?: React__default.ReactNode;
|
|
27
85
|
className?: string;
|
|
28
|
-
connectsClassName?: {
|
|
29
|
-
negative?: string;
|
|
30
|
-
positive?: string;
|
|
31
|
-
};
|
|
32
86
|
defaultValue?: [number, number];
|
|
33
87
|
disabled?: boolean;
|
|
34
88
|
max?: number;
|
|
@@ -39,12 +93,214 @@ interface RangeTupleProps {
|
|
|
39
93
|
readOnly?: boolean;
|
|
40
94
|
step?: number;
|
|
41
95
|
thumbSize?: number;
|
|
42
|
-
trackSize?: {
|
|
43
|
-
height?: number;
|
|
44
|
-
width?: number | "auto";
|
|
45
|
-
};
|
|
46
96
|
value?: [number, number];
|
|
97
|
+
/**
|
|
98
|
+
* Width of the range track in pixels.
|
|
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
|
+
};
|
|
180
|
+
};
|
|
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;
|
|
47
302
|
}
|
|
48
|
-
declare const
|
|
303
|
+
declare const RangeTupleContext: React$1.Context<RangeTupleContextValue | null>;
|
|
304
|
+
declare function useRangeTupleContext(): RangeTupleContextValue;
|
|
49
305
|
|
|
50
|
-
export { Range, type RangeProps, RangeTuple, type RangeTupleProps };
|
|
306
|
+
export { Range, type RangeConnectsProps, type RangeContainerProps, RangeContext, type RangeContextValue, type RangeDotProps, type RangeProps, type RangeThumbProps, RangeTuple, type RangeTupleConnectsProps, type RangeTupleContainerProps, RangeTupleContext, type RangeTupleContextValue, type RangeTupleDotProps, type RangeTupleProps, type RangeTupleThumbProps, useRangeContext, useRangeTupleContext };
|