@choice-ui/react 1.8.7 → 1.8.8

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.
Files changed (37) hide show
  1. package/dist/components/button/dist/index.js +7 -0
  2. package/dist/components/colors/src/color-image-paint/color-image-paint.js +3 -3
  3. package/dist/components/dropdown/dist/index.d.ts +6 -0
  4. package/dist/components/dropdown/dist/index.js +12 -8
  5. package/dist/components/emoji-picker/dist/index.d.ts +29 -1
  6. package/dist/components/emoji-picker/dist/index.js +144 -42
  7. package/dist/components/form/src/adapters/range-adapter.js +2 -2
  8. package/dist/components/icon-button/dist/index.d.ts +1 -1
  9. package/dist/components/icon-button/dist/index.js +39 -0
  10. package/dist/components/menus/dist/index.d.ts +5 -0
  11. package/dist/components/menus/dist/index.js +18 -1
  12. package/dist/components/range/dist/index.d.ts +276 -20
  13. package/dist/components/range/dist/index.js +1030 -602
  14. package/dist/components/range/src/components/connects.d.ts +26 -0
  15. package/dist/components/range/src/components/connects.js +192 -0
  16. package/dist/components/range/src/components/dot.d.ts +8 -0
  17. package/dist/components/range/src/components/dot.js +148 -0
  18. package/dist/components/range/src/components/thumb.d.ts +14 -0
  19. package/dist/components/range/src/components/thumb.js +159 -0
  20. package/dist/components/range/src/context/index.d.ts +4 -0
  21. package/dist/components/range/src/context/range-context.d.ts +35 -0
  22. package/dist/components/range/src/context/range-context.js +13 -0
  23. package/dist/components/range/src/context/range-tuple-context.d.ts +42 -0
  24. package/dist/components/range/src/context/range-tuple-context.js +15 -0
  25. package/dist/components/range/src/index.d.ts +4 -2
  26. package/dist/components/range/src/range-tuple.d.ts +17 -9
  27. package/dist/components/range/src/range-tuple.js +375 -441
  28. package/dist/components/range/src/range.d.ts +17 -9
  29. package/dist/components/range/src/range.js +164 -154
  30. package/dist/components/range/src/tv.d.ts +15 -3
  31. package/dist/components/range/src/tv.js +10 -7
  32. package/dist/components/textarea/dist/index.js +3 -1
  33. package/dist/components/tooltip/dist/index.d.ts +2 -0
  34. package/dist/components/tooltip/dist/index.js +23 -5
  35. package/dist/components/virtual-select/dist/index.d.ts +48 -0
  36. package/dist/index.js +6 -0
  37. package/package.json +20 -32
@@ -1,10 +1,10 @@
1
1
  import { default as React } from 'react';
2
+ import { RangeConnects, RangeConnectsProps, RangeContainer, RangeContainerProps } from './components/connects';
3
+ import { RangeThumb, RangeThumbProps } from './components/thumb';
4
+ import { RangeDot, RangeDotProps } from './components/dot';
2
5
  export interface RangeProps {
6
+ children?: React.ReactNode;
3
7
  className?: string;
4
- connectsClassName?: {
5
- negative?: string;
6
- positive?: string;
7
- };
8
8
  defaultValue?: number;
9
9
  disabled?: boolean;
10
10
  max?: number;
@@ -15,10 +15,18 @@ export interface RangeProps {
15
15
  readOnly?: boolean;
16
16
  step?: number;
17
17
  thumbSize?: number;
18
- trackSize?: {
19
- height?: number;
20
- width?: number | "auto";
21
- };
22
18
  value?: number;
19
+ /**
20
+ * Width of the range track in pixels.
21
+ * If not provided (undefined), the width will be auto-calculated from the container.
22
+ */
23
+ width?: number | boolean;
23
24
  }
24
- export declare const Range: React.ForwardRefExoticComponent<RangeProps & React.RefAttributes<HTMLDivElement>>;
25
+ interface RangeComponent extends React.ForwardRefExoticComponent<RangeProps & React.RefAttributes<HTMLDivElement>> {
26
+ Container: typeof RangeContainer;
27
+ Connects: typeof RangeConnects;
28
+ Thumb: typeof RangeThumb;
29
+ Dot: typeof RangeDot;
30
+ }
31
+ export declare const Range: RangeComponent;
32
+ export type { RangeContainerProps, RangeConnectsProps, RangeThumbProps, RangeDotProps };
@@ -1,13 +1,18 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { clamp } from "es-toolkit";
3
- import { forwardRef, useState, useCallback, useMemo, useRef, useEffect } from "react";
3
+ import { forwardRef, useMemo, Children, isValidElement, useState, useCallback, useRef, useEffect } from "react";
4
4
  import { useEventCallback } from "usehooks-ts";
5
+ import { RangeConnects, RangeContainer } from "./components/connects.js";
6
+ import { RangeThumb } from "./components/thumb.js";
7
+ import { RangeDot } from "./components/dot.js";
5
8
  import { rangeTv } from "./tv.js";
9
+ import { RangeContext } from "./context/range-context.js";
6
10
  import { useIsomorphicLayoutEffect } from "../../../shared/hooks/use-isomorphic-layout-effect/use-isomorphic-layout-effect.js";
7
11
  import { tcx } from "../../../shared/utils/tcx/tcx.js";
8
12
  import { mergeRefs } from "../../../shared/utils/merge-refs/merge-refs.js";
9
- const Range = forwardRef(function Range2(props, ref) {
13
+ const RangeRoot = forwardRef(function Range2(props, ref) {
10
14
  const {
15
+ children,
11
16
  defaultValue,
12
17
  value,
13
18
  onChange,
@@ -19,52 +24,82 @@ const Range = forwardRef(function Range2(props, ref) {
19
24
  disabled = false,
20
25
  readOnly = false,
21
26
  className,
22
- connectsClassName = {
23
- positive: "bg-accent-background",
24
- negative: "bg-accent-background"
25
- },
26
- trackSize = {
27
- width: 256,
28
- height: 16
29
- },
30
- thumbSize = 14
27
+ width: propsWidth = 256,
28
+ thumbSize: propsThumbSize = 14
31
29
  } = props;
30
+ const {
31
+ hasCustomChildren,
32
+ hasCustomDot,
33
+ hasCustomConnects,
34
+ extractedThumbSize,
35
+ extractedTrackHeight
36
+ } = useMemo(() => {
37
+ const childArray = Children.toArray(children);
38
+ let hasCustom = false;
39
+ let hasDot = false;
40
+ let hasConnects = false;
41
+ let thumbSizeFromChild;
42
+ let trackHeightFromChild;
43
+ for (const child of childArray) {
44
+ if (isValidElement(child)) {
45
+ const type = child.type;
46
+ if (child.type === RangeThumb || (type == null ? void 0 : type.displayName) === "RangeThumb") {
47
+ hasCustom = true;
48
+ const childProps = child.props;
49
+ if (childProps.size !== void 0) {
50
+ thumbSizeFromChild = childProps.size;
51
+ }
52
+ } else if (child.type === RangeContainer || (type == null ? void 0 : type.displayName) === "RangeContainer") {
53
+ hasCustom = true;
54
+ const childProps = child.props;
55
+ if (childProps.height !== void 0) {
56
+ trackHeightFromChild = childProps.height;
57
+ }
58
+ } else if (child.type === RangeConnects || (type == null ? void 0 : type.displayName) === "RangeConnects") {
59
+ hasCustom = true;
60
+ hasConnects = true;
61
+ } else if (child.type === RangeDot || (type == null ? void 0 : type.displayName) === "RangeDot") {
62
+ hasCustom = true;
63
+ hasDot = true;
64
+ }
65
+ }
66
+ }
67
+ return {
68
+ hasCustomChildren: hasCustom,
69
+ hasCustomDot: hasDot,
70
+ hasCustomConnects: hasConnects,
71
+ extractedThumbSize: thumbSizeFromChild,
72
+ extractedTrackHeight: trackHeightFromChild
73
+ };
74
+ }, [children]);
75
+ const thumbSize = extractedThumbSize ?? propsThumbSize;
76
+ const trackHeight = extractedTrackHeight ?? 16;
77
+ const safeStep = step > 0 ? step : 1;
78
+ const range = max - min || 1;
32
79
  const [actualTrackWidth, setActualTrackWidth] = useState();
33
- const valueToPosition = useCallback((val) => (val - min) / (max - min), [min, max]);
34
- const positionToValue = useCallback(
35
- (position) => min + position * (max - min),
36
- [min, max]
37
- );
80
+ const valueToPosition = useCallback((val) => (val - min) / range, [min, range]);
81
+ const positionToValue = useCallback((position) => min + position * range, [min, range]);
38
82
  const defaultStepValue = useMemo(() => {
39
83
  if (defaultValue === void 0 || defaultValue === null) return null;
40
- if (step > 1) {
41
- return Math.round((defaultValue - min) / step) * step + min;
84
+ if (safeStep > 1) {
85
+ return Math.round((defaultValue - min) / safeStep) * safeStep + min;
42
86
  }
43
87
  return defaultValue;
44
- }, [defaultValue, step, min]);
88
+ }, [defaultValue, safeStep, min]);
45
89
  const sliderRef = useRef(null);
46
90
  const thumbRef = useRef(null);
47
91
  const inputRef = useRef(null);
48
92
  const isDragging = useRef(false);
93
+ const cleanupRef = useRef(null);
49
94
  const [internalValue, setInternalValue] = useState(value ?? min);
50
95
  const currentValue = value ?? internalValue;
51
96
  const currentStepValue = useMemo(
52
- () => step > 1 ? Math.round(currentValue / step) * step : currentValue,
53
- [currentValue, step]
97
+ () => safeStep > 1 ? Math.round(currentValue / safeStep) * safeStep : currentValue,
98
+ [currentValue, safeStep]
54
99
  );
55
- const [transforms, setTransforms] = useState({
56
- minTransform: 1,
57
- maxTransform: 0,
58
- transformX: 0
59
- });
60
- const trackWidth = useMemo(() => {
61
- if ((trackSize == null ? void 0 : trackSize.width) === "auto") {
62
- return actualTrackWidth;
63
- }
64
- return trackSize == null ? void 0 : trackSize.width;
65
- }, [trackSize == null ? void 0 : trackSize.width, actualTrackWidth]);
100
+ const trackWidth = typeof propsWidth === "number" ? propsWidth : actualTrackWidth;
66
101
  useIsomorphicLayoutEffect(() => {
67
- if ((trackSize == null ? void 0 : trackSize.width) === "auto" && sliderRef.current) {
102
+ if (typeof propsWidth !== "number" && sliderRef.current) {
68
103
  const updateWidth = () => {
69
104
  if (sliderRef.current) {
70
105
  const width = sliderRef.current.getBoundingClientRect().width;
@@ -82,43 +117,39 @@ const Range = forwardRef(function Range2(props, ref) {
82
117
  resizeObserver.disconnect();
83
118
  };
84
119
  }
85
- }, [trackSize == null ? void 0 : trackSize.width]);
86
- useEffect(() => {
120
+ }, [propsWidth]);
121
+ const transforms = useMemo(() => {
87
122
  const position = valueToPosition(currentValue);
88
123
  const minTransform = 1;
89
- const maxTransform = (trackWidth ?? 0) - thumbSize - 1;
124
+ const maxTransform = (typeof trackWidth === "number" ? trackWidth : 0) - thumbSize - 1;
90
125
  const transformX = minTransform + position * (maxTransform - minTransform);
91
- setTransforms({
92
- minTransform,
93
- maxTransform,
94
- transformX
95
- });
126
+ return { minTransform, maxTransform, transformX };
96
127
  }, [currentValue, trackWidth, thumbSize, valueToPosition]);
97
128
  const dotsData = useMemo(() => {
98
- if (!step || step <= 1) return null;
99
- return Array.from({ length: Math.ceil((max - min) / step) + 1 }, (_, i) => {
100
- const dotValue = min + i * step;
129
+ if (safeStep <= 1) return null;
130
+ return Array.from({ length: Math.ceil((max - min) / safeStep) + 1 }, (_, i) => {
131
+ const dotValue = min + i * safeStep;
101
132
  const dotPosition = valueToPosition(dotValue);
102
133
  return {
103
134
  value: dotValue,
104
135
  position: dotPosition
105
136
  };
106
137
  });
107
- }, [step, min, max, valueToPosition]);
138
+ }, [safeStep, min, max, valueToPosition]);
108
139
  const defaultDotPosition = useMemo(() => {
109
- if (defaultValue === void 0 || defaultValue === null || step > 1) return null;
140
+ if (defaultValue === void 0 || defaultValue === null || safeStep > 1) return null;
110
141
  return valueToPosition(defaultValue);
111
- }, [defaultValue, step, valueToPosition]);
142
+ }, [defaultValue, safeStep, valueToPosition]);
112
143
  const updatePosition = useEventCallback((clientX, isEnd) => {
113
144
  var _a;
114
145
  if (readOnly) return;
115
146
  const rect = (_a = sliderRef.current) == null ? void 0 : _a.getBoundingClientRect();
116
147
  if (!rect) return;
117
148
  const newPosition = clamp((clientX - rect.left) / rect.width, 0, 1);
118
- const newValue = Math.round(positionToValue(newPosition) / step) * step;
149
+ const newValue = Math.round(positionToValue(newPosition) / safeStep) * safeStep;
119
150
  let clampedValue = clamp(newValue, min, max);
120
- if (defaultValue !== void 0 && defaultValue !== null && step === 1) {
121
- const snapThreshold = (max - min) * 0.05;
151
+ if (defaultValue !== void 0 && defaultValue !== null && safeStep <= 1) {
152
+ const snapThreshold = range * 0.05;
122
153
  const distanceToDefault = Math.abs(clampedValue - defaultValue);
123
154
  if (distanceToDefault <= snapThreshold) {
124
155
  clampedValue = defaultValue;
@@ -155,6 +186,12 @@ const Range = forwardRef(function Range2(props, ref) {
155
186
  e2.preventDefault();
156
187
  updatePosition(e2.clientX);
157
188
  };
189
+ const cleanup = () => {
190
+ window.removeEventListener("pointermove", handleMove);
191
+ window.removeEventListener("pointerup", handleUp);
192
+ window.removeEventListener("pointercancel", handleUp);
193
+ cleanupRef.current = null;
194
+ };
158
195
  const handleUp = (e2) => {
159
196
  if (!isDragging.current) return;
160
197
  e2.preventDefault();
@@ -164,16 +201,21 @@ const Range = forwardRef(function Range2(props, ref) {
164
201
  updatePosition(e2.clientX, true);
165
202
  isDragging.current = false;
166
203
  onChangeEnd == null ? void 0 : onChangeEnd();
167
- window.removeEventListener("pointermove", handleMove);
168
- window.removeEventListener("pointerup", handleUp);
169
- window.removeEventListener("pointercancel", handleUp);
204
+ cleanup();
170
205
  };
206
+ cleanupRef.current = cleanup;
171
207
  window.addEventListener("pointermove", handleMove);
172
208
  window.addEventListener("pointerup", handleUp);
173
209
  window.addEventListener("pointercancel", handleUp);
174
210
  },
175
211
  [disabled, readOnly, onChangeEnd, onChangeStart, updatePosition]
176
212
  );
213
+ useEffect(() => {
214
+ return () => {
215
+ var _a;
216
+ (_a = cleanupRef.current) == null ? void 0 : _a.call(cleanupRef);
217
+ };
218
+ }, []);
177
219
  const handleSliderPointerDown = useCallback(
178
220
  (e) => {
179
221
  if (disabled || readOnly || e.target === thumbRef.current) return;
@@ -183,7 +225,7 @@ const Range = forwardRef(function Range2(props, ref) {
183
225
  );
184
226
  const handleKeyDown = useEventCallback((e) => {
185
227
  if (disabled || readOnly) return;
186
- const stepValue = e.shiftKey ? step * 10 : step;
228
+ const stepValue = e.shiftKey ? safeStep * 10 : safeStep;
187
229
  let newValue = currentValue;
188
230
  switch (e.key) {
189
231
  case "ArrowLeft":
@@ -209,120 +251,88 @@ const Range = forwardRef(function Range2(props, ref) {
209
251
  (_a = inputRef.current) == null ? void 0 : _a.blur();
210
252
  }
211
253
  }, [disabled]);
254
+ const hasStepOrDefault = safeStep > 1 || defaultValue !== void 0;
212
255
  const tv = useMemo(
213
256
  () => rangeTv({
214
257
  currentDefaultValue: defaultStepValue === currentStepValue,
215
- hasStepOrDefault: step > 1 || defaultValue !== void 0,
258
+ hasStepOrDefault,
216
259
  disabled
217
260
  }),
218
- [defaultStepValue, currentStepValue, step, defaultValue, disabled]
261
+ [defaultStepValue, currentStepValue, hasStepOrDefault, disabled]
219
262
  );
220
- const connectsClass = useMemo(() => {
221
- if (disabled) return "bg-disabled-background";
222
- if (currentValue < 0) return connectsClassName.negative;
223
- return connectsClassName.positive;
224
- }, [disabled, currentValue, connectsClassName]);
225
- const connectStyle = useMemo(() => {
226
- return {
227
- left: min < 0 ? currentValue < 0 ? `${transforms.transformX + thumbSize / 2}px` : "50%" : ((trackSize == null ? void 0 : trackSize.height) ?? 0) / 2 + "px",
228
- right: min < 0 ? currentValue >= 0 ? `calc(100% - ${transforms.transformX + thumbSize / 2}px)` : "50%" : `calc(100% - ${transforms.transformX + thumbSize / 2}px)`,
229
- height: trackSize == null ? void 0 : trackSize.height
230
- };
231
- }, [min, currentValue, transforms.transformX, thumbSize, trackSize == null ? void 0 : trackSize.height]);
232
- const renderDots = useCallback(() => {
233
- if (dotsData) {
234
- return dotsData.map(({ value: dotValue, position: dotPosition }) => {
235
- const { minTransform, maxTransform } = transforms;
236
- const dotTransform = minTransform + dotPosition * (maxTransform - minTransform);
237
- const { dot } = rangeTv({
238
- defaultStepValue: defaultStepValue === dotValue,
239
- overStepValue: dotValue <= currentValue
240
- });
241
- return /* @__PURE__ */ jsx(
242
- "div",
243
- {
244
- className: dot(),
245
- style: {
246
- left: dotTransform + thumbSize / 2
247
- }
248
- },
249
- dotValue
250
- );
251
- });
252
- }
253
- if (defaultDotPosition !== null && defaultDotPosition !== void 0) {
254
- return /* @__PURE__ */ jsx(
255
- "div",
256
- {
257
- className: rangeTv({ defaultStepValue: true }).dot(),
258
- style: {
259
- left: transforms.minTransform + defaultDotPosition * (transforms.maxTransform - transforms.minTransform) + thumbSize / 2
260
- }
261
- }
262
- );
263
- }
264
- return null;
265
- }, [dotsData, defaultDotPosition, transforms, defaultStepValue, currentValue, thumbSize]);
266
- useEffect(() => {
267
- const noop = () => {
268
- };
269
- return () => {
270
- if (typeof window !== "undefined") {
271
- window.removeEventListener("pointermove", noop);
272
- window.removeEventListener("pointerup", noop);
273
- window.removeEventListener("pointercancel", noop);
274
- }
275
- };
276
- }, []);
277
- return /* @__PURE__ */ jsxs(
263
+ const contextValue = useMemo(
264
+ () => ({
265
+ currentValue,
266
+ disabled,
267
+ readOnly,
268
+ min,
269
+ max,
270
+ step: safeStep,
271
+ thumbSize,
272
+ trackHeight,
273
+ transforms,
274
+ defaultStepValue,
275
+ currentStepValue,
276
+ dotsData,
277
+ defaultDotPosition,
278
+ thumbRef,
279
+ inputRef,
280
+ isDragging,
281
+ handlePointerDown,
282
+ handleKeyDown,
283
+ tv,
284
+ defaultValue,
285
+ hasCustomDot,
286
+ hasCustomConnects,
287
+ isDefaultValue: defaultStepValue === currentStepValue && hasStepOrDefault
288
+ }),
289
+ [
290
+ currentValue,
291
+ disabled,
292
+ readOnly,
293
+ min,
294
+ max,
295
+ safeStep,
296
+ thumbSize,
297
+ trackHeight,
298
+ transforms,
299
+ defaultStepValue,
300
+ currentStepValue,
301
+ dotsData,
302
+ defaultDotPosition,
303
+ handlePointerDown,
304
+ handleKeyDown,
305
+ tv,
306
+ defaultValue,
307
+ hasCustomDot,
308
+ hasCustomConnects
309
+ ]
310
+ );
311
+ return /* @__PURE__ */ jsx(RangeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
278
312
  "div",
279
313
  {
280
314
  ref: mergeRefs(sliderRef, ref),
281
315
  onPointerDown: handleSliderPointerDown,
282
316
  className: tcx(tv.container(), className),
283
317
  style: {
284
- "--width": `${trackWidth}px`,
285
- "--height": `${(trackSize == null ? void 0 : trackSize.height) ?? 16}px`
318
+ "--width": `${typeof trackWidth === "number" ? trackWidth : actualTrackWidth}px`,
319
+ "--height": `${trackHeight}px`,
320
+ "--thumb-size": `${thumbSize}px`
286
321
  },
287
- children: [
288
- /* @__PURE__ */ jsx(
289
- "div",
290
- {
291
- className: tcx(tv.connect(), connectsClass),
292
- style: connectStyle
293
- }
294
- ),
295
- step > 1 || defaultValue !== void 0 ? /* @__PURE__ */ jsx("div", { className: tv.dotContainer(), children: renderDots() }) : "",
296
- /* @__PURE__ */ jsx(
297
- "div",
298
- {
299
- ref: thumbRef,
300
- onPointerDown: handlePointerDown,
301
- className: tv.thumb(),
302
- style: {
303
- width: thumbSize,
304
- height: thumbSize,
305
- transform: `translate(${transforms.transformX}px, -50%)`,
306
- willChange: isDragging.current ? "transform" : "auto"
307
- },
308
- children: /* @__PURE__ */ jsx(
309
- "input",
310
- {
311
- ref: inputRef,
312
- type: "text",
313
- onKeyDown: handleKeyDown,
314
- className: tv.input(),
315
- tabIndex: disabled || readOnly ? -1 : 0,
316
- readOnly: true
317
- }
318
- )
319
- }
320
- )
321
- ]
322
+ children: hasCustomChildren ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
323
+ /* @__PURE__ */ jsx(RangeContainer, {}),
324
+ /* @__PURE__ */ jsx(RangeThumb, {})
325
+ ] })
322
326
  }
323
- );
327
+ ) });
328
+ });
329
+ RangeRoot.displayName = "Range";
330
+ const Range = Object.assign(RangeRoot, {
331
+ Container: RangeContainer,
332
+ Connects: RangeConnects,
333
+ Thumb: RangeThumb,
334
+ Dot: RangeDot
324
335
  });
325
- Range.displayName = "Range";
326
336
  export {
327
337
  Range
328
338
  };
@@ -22,13 +22,17 @@ export declare const rangeTv: import('tailwind-variants').TVReturnType<{
22
22
  };
23
23
  disabled: {
24
24
  true: {
25
+ connect: string;
25
26
  thumb: string;
26
27
  };
27
- false: {};
28
+ false: {
29
+ connect: string;
30
+ };
28
31
  };
29
32
  }, {
30
33
  container: string[];
31
34
  connect: string[];
35
+ thumbWrapper: string[];
32
36
  thumb: string[];
33
37
  dotContainer: string;
34
38
  dot: string[];
@@ -57,13 +61,17 @@ export declare const rangeTv: import('tailwind-variants').TVReturnType<{
57
61
  };
58
62
  disabled: {
59
63
  true: {
64
+ connect: string;
60
65
  thumb: string;
61
66
  };
62
- false: {};
67
+ false: {
68
+ connect: string;
69
+ };
63
70
  };
64
71
  }, {
65
72
  container: string[];
66
73
  connect: string[];
74
+ thumbWrapper: string[];
67
75
  thumb: string[];
68
76
  dotContainer: string;
69
77
  dot: string[];
@@ -92,13 +100,17 @@ export declare const rangeTv: import('tailwind-variants').TVReturnType<{
92
100
  };
93
101
  disabled: {
94
102
  true: {
103
+ connect: string;
95
104
  thumb: string;
96
105
  };
97
- false: {};
106
+ false: {
107
+ connect: string;
108
+ };
98
109
  };
99
110
  }, {
100
111
  container: string[];
101
112
  connect: string[];
113
+ thumbWrapper: string[];
102
114
  thumb: string[];
103
115
  dotContainer: string;
104
116
  dot: string[];
@@ -7,19 +7,19 @@ const rangeTv = tcv({
7
7
  "bg-secondary-background shadow-inset-border rounded-full"
8
8
  ],
9
9
  connect: [
10
- "pointer-events-none absolute",
10
+ "pointer-events-none absolute h-(--height)",
11
11
  "after:absolute",
12
12
  "after:content-['']",
13
13
  "after:rounded-full",
14
- "after:bg-inherit",
15
- "after:h-[var(--height)]",
14
+ "after:[background:inherit]",
15
+ "after:h-[inherit]",
16
16
  "after:left-[calc(var(--height)/-2)]",
17
17
  "after:right-[calc(var(--height)/-2)]"
18
18
  ],
19
+ thumbWrapper: ["absolute top-1/2 box-border origin-center z-2"],
19
20
  thumb: [
20
- "absolute top-1/2 box-border origin-center rounded-full",
21
- "shadow-range-thumb border-2 border-white",
22
- "bg-white"
21
+ "shadow-range-thumb border-2 border-white rounded-full size-(--thumb-size)",
22
+ "bg-white absolute -translate-y-1/2 -translate-x-1/2 left-1/2 top-1/2"
23
23
  ],
24
24
  dotContainer: "pointer-events-none absolute inset-0",
25
25
  dot: ["size-1 rounded-full", "absolute top-1/2", "-translate-x-1/2 -translate-y-1/2"],
@@ -49,9 +49,12 @@ const rangeTv = tcv({
49
49
  },
50
50
  disabled: {
51
51
  true: {
52
+ connect: "bg-disabled-background",
52
53
  thumb: "bg-secondary-background"
53
54
  },
54
- false: {}
55
+ false: {
56
+ connect: "bg-accent-background"
57
+ }
55
58
  }
56
59
  },
57
60
  compoundVariants: [
@@ -507,7 +507,9 @@ var TextareaTv = tcv({
507
507
  container: "bg-gray-700",
508
508
  textarea: "text-white placeholder:text-white/40"
509
509
  },
510
- reset: {}
510
+ reset: {
511
+ container: "rounded-none border-0"
512
+ }
511
513
  },
512
514
  resize: {
513
515
  auto: {},
@@ -10,6 +10,7 @@ interface TooltipProps {
10
10
  className?: string;
11
11
  content?: React.ReactNode;
12
12
  disabled?: boolean;
13
+ interactive?: boolean;
13
14
  offset?: number;
14
15
  onOpenChange?: (open: boolean) => void;
15
16
  open?: boolean;
@@ -23,6 +24,7 @@ interface TooltipProps {
23
24
  withArrow?: boolean;
24
25
  }
25
26
  interface TooltipContentProps extends React.HTMLProps<HTMLDivElement> {
27
+ interactive?: boolean;
26
28
  portalId?: string;
27
29
  variant?: "default" | "light";
28
30
  withArrow?: boolean;
@@ -128,7 +128,15 @@ var TooltipArrow = forwardRef(function TooltipArrow2({ className, variant = "def
128
128
  });
129
129
  var TooltipContent = forwardRef(
130
130
  function TooltipContent2(props, propRef) {
131
- const { className, withArrow = true, variant = "default", children, portalId, ...rest } = props;
131
+ const {
132
+ className,
133
+ withArrow = true,
134
+ variant = "default",
135
+ children,
136
+ portalId,
137
+ interactive = true,
138
+ ...rest
139
+ } = props;
132
140
  const state = useTooltipState();
133
141
  const ref = useMergeRefs([state.refs.setFloating, propRef]);
134
142
  const { isInstantPhase, currentId } = useDelayGroup(state.context, {
@@ -157,19 +165,27 @@ var TooltipContent = forwardRef(
157
165
  });
158
166
  const tv = useMemo(() => tooltipContentVariants({ variant }), [variant]);
159
167
  if (state.disabled || !isMounted) return null;
168
+ const floatingProps = state.getFloatingProps(rest);
160
169
  return /* @__PURE__ */ jsx(FloatingPortal, { id: portalId, children: /* @__PURE__ */ jsx(
161
170
  "div",
162
171
  {
163
172
  ref,
164
- style: state.floatingStyles,
165
- ...state.getFloatingProps(rest),
173
+ style: {
174
+ ...state.floatingStyles,
175
+ pointerEvents: interactive ? void 0 : "none"
176
+ },
177
+ ...floatingProps,
166
178
  className: "z-tooltip",
167
179
  children: /* @__PURE__ */ jsxs(
168
180
  "div",
169
181
  {
170
182
  className: tcx(tv.root({ className })),
171
183
  "data-state": state.open ? "open" : "closed",
172
- style: styles,
184
+ style: {
185
+ ...styles,
186
+ pointerEvents: interactive ? void 0 : "none",
187
+ cursor: interactive ? void 0 : "default"
188
+ },
173
189
  children: [
174
190
  children,
175
191
  withArrow && /* @__PURE__ */ jsx(TooltipArrow, { variant })
@@ -272,7 +288,8 @@ function TooltipRoot(props) {
272
288
  withArrow = true,
273
289
  variant = "default",
274
290
  offset: offset2 = 8,
275
- portalId = PORTAL_ROOT_ID
291
+ portalId = PORTAL_ROOT_ID,
292
+ interactive = true
276
293
  } = props;
277
294
  const tooltip = useTooltip({
278
295
  placement,
@@ -291,6 +308,7 @@ function TooltipRoot(props) {
291
308
  variant,
292
309
  portalId,
293
310
  className,
311
+ interactive,
294
312
  children: [
295
313
  content,
296
314
  shortcut && /* @__PURE__ */ jsx(