@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.
Files changed (32) hide show
  1. package/dist/components/button/dist/index.js +0 -7
  2. package/dist/components/checkbox/src/checkbox-icon.d.ts +8 -0
  3. package/dist/components/checkbox/src/checkbox-icon.js +41 -0
  4. package/dist/components/checkbox/src/checkbox.d.ts +2 -0
  5. package/dist/components/checkbox/src/checkbox.js +18 -5
  6. package/dist/components/checkbox/src/index.d.ts +2 -0
  7. package/dist/components/colors/src/color-image-paint/color-image-paint.js +2 -2
  8. package/dist/components/dropdown/dist/index.d.ts +0 -6
  9. package/dist/components/dropdown/dist/index.js +8 -12
  10. package/dist/components/dropdown/src/dropdown.js +8 -2
  11. package/dist/components/emoji-picker/dist/index.d.ts +1 -29
  12. package/dist/components/emoji-picker/dist/index.js +42 -144
  13. package/dist/components/form/src/adapters/range-adapter.js +2 -2
  14. package/dist/components/icon-button/dist/index.d.ts +1 -1
  15. package/dist/components/icon-button/dist/index.js +0 -39
  16. package/dist/components/menus/dist/index.d.ts +0 -5
  17. package/dist/components/menus/dist/index.js +1 -18
  18. package/dist/components/menus/src/context/menu-context-sub-trigger.js +6 -1
  19. package/dist/components/menus/src/hooks/use-menu-tree.js +8 -1
  20. package/dist/components/radio/src/context.d.ts +2 -0
  21. package/dist/components/radio/src/index.d.ts +2 -0
  22. package/dist/components/radio/src/radio-icon.d.ts +7 -0
  23. package/dist/components/radio/src/radio-icon.js +41 -0
  24. package/dist/components/radio/src/radio.d.ts +2 -0
  25. package/dist/components/radio/src/radio.js +19 -6
  26. package/dist/components/range/dist/index.d.ts +20 -276
  27. package/dist/components/range/dist/index.js +616 -1044
  28. package/dist/components/textarea/dist/index.js +1 -3
  29. package/dist/components/tooltip/dist/index.d.ts +0 -2
  30. package/dist/components/tooltip/dist/index.js +5 -23
  31. package/package.json +32 -20
  32. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -244,13 +244,6 @@ var buttonTv = tcv({
244
244
  loading: false,
245
245
  variant: "dark",
246
246
  class: { button: "active:bg-gray-600" }
247
- },
248
- {
249
- disabled: false,
250
- loading: false,
251
- variant: "secondary",
252
- active: false,
253
- class: { button: "hover:bg-secondary-background" }
254
247
  }
255
248
  ],
256
249
  defaultVariants: {
@@ -0,0 +1,8 @@
1
+ import { HTMLProps, ReactNode } from 'react';
2
+ export interface CheckboxIconProps extends Omit<HTMLProps<HTMLDivElement>, "children"> {
3
+ children?: ReactNode | ((props: {
4
+ value?: boolean;
5
+ mixed?: boolean;
6
+ }) => ReactNode);
7
+ }
8
+ export declare const CheckboxIcon: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<CheckboxIconProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
@@ -0,0 +1,41 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Indeterminate, Check } from "@choiceform/icons-react";
3
+ import { memo, forwardRef } from "react";
4
+ import { useCheckboxContext } from "./context.js";
5
+ import { checkboxTv } from "./tv.js";
6
+ import { tcx } from "../../../shared/utils/tcx/tcx.js";
7
+ const CheckboxIcon = memo(
8
+ forwardRef(function CheckboxIcon2(props, ref) {
9
+ const { className, children, ...rest } = props;
10
+ const { value, mixed, disabled, variant } = useCheckboxContext();
11
+ const tv = checkboxTv({
12
+ type: "checkbox",
13
+ variant,
14
+ disabled,
15
+ checked: value || mixed
16
+ });
17
+ const renderIcon = () => {
18
+ if (typeof children === "function") {
19
+ return children({ value, mixed });
20
+ }
21
+ if (children !== void 0) {
22
+ return children;
23
+ }
24
+ return mixed ? /* @__PURE__ */ jsx(Indeterminate, {}) : value ? /* @__PURE__ */ jsx(Check, {}) : 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
+ CheckboxIcon.displayName = "Checkbox.Icon";
39
+ export {
40
+ CheckboxIcon
41
+ };
@@ -1,4 +1,5 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
+ import { CheckboxIcon } from './checkbox-icon';
2
3
  import { CheckboxLabel } from './checkbox-label';
3
4
  export interface CheckboxProps extends Omit<HTMLProps<HTMLInputElement>, "value" | "onChange"> {
4
5
  children?: ReactNode;
@@ -14,6 +15,7 @@ interface CheckboxType {
14
15
  (props: CheckboxProps & {
15
16
  ref?: React.Ref<HTMLInputElement>;
16
17
  }): JSX.Element;
18
+ Icon: typeof CheckboxIcon;
17
19
  Label: typeof CheckboxLabel;
18
20
  displayName?: string;
19
21
  }
@@ -1,7 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Indeterminate, Check } 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
+ import { CheckboxIcon } from "./checkbox-icon.js";
5
6
  import { CheckboxLabel } from "./checkbox-label.js";
6
7
  import { CheckboxContext } from "./context.js";
7
8
  import { checkboxTv } from "./tv.js";
@@ -45,12 +46,23 @@ const CheckboxBase = forwardRef(function Checkbox2(props, ref) {
45
46
  }
46
47
  onKeyDown == null ? void 0 : onKeyDown(e);
47
48
  });
49
+ const isIconElement = (child) => {
50
+ var _a;
51
+ return isValidElement(child) && (child.type === CheckboxIcon || ((_a = child.type) == null ? void 0 : _a.displayName) === "Checkbox.Icon");
52
+ };
53
+ const childArray = Children.toArray(children);
54
+ const iconChild = childArray.find(isIconElement);
55
+ const otherChildren = childArray.filter((child) => !isIconElement(child));
48
56
  const renderChildren = () => {
49
- if (typeof children === "string" || typeof children === "number") {
50
- return /* @__PURE__ */ jsx(CheckboxLabel, { children });
57
+ if (otherChildren.length === 1) {
58
+ const child = otherChildren[0];
59
+ if (typeof child === "string" || typeof child === "number") {
60
+ return /* @__PURE__ */ jsx(CheckboxLabel, { children: child });
61
+ }
51
62
  }
52
- return children;
63
+ return otherChildren;
53
64
  };
65
+ const renderDefaultIcon = () => /* @__PURE__ */ jsx("div", { className: tv.box(), children: mixed ? /* @__PURE__ */ jsx(Indeterminate, {}) : value ? /* @__PURE__ */ jsx(Check, {}) : null });
54
66
  return /* @__PURE__ */ jsx(
55
67
  CheckboxContext.Provider,
56
68
  {
@@ -84,7 +96,7 @@ const CheckboxBase = forwardRef(function Checkbox2(props, ref) {
84
96
  ...rest
85
97
  }
86
98
  ),
87
- /* @__PURE__ */ jsx("div", { className: tv.box(), children: mixed ? /* @__PURE__ */ jsx(Indeterminate, {}) : value ? /* @__PURE__ */ jsx(Check, {}) : null })
99
+ iconChild ?? renderDefaultIcon()
88
100
  ] }),
89
101
  renderChildren()
90
102
  ] })
@@ -93,6 +105,7 @@ const CheckboxBase = forwardRef(function Checkbox2(props, ref) {
93
105
  });
94
106
  const MemoizedCheckbox = memo(CheckboxBase);
95
107
  const Checkbox = MemoizedCheckbox;
108
+ Checkbox.Icon = CheckboxIcon;
96
109
  Checkbox.Label = CheckboxLabel;
97
110
  Checkbox.displayName = "Checkbox";
98
111
  export {
@@ -1,2 +1,4 @@
1
1
  export { Checkbox } from './checkbox';
2
2
  export type { CheckboxProps } from './checkbox';
3
+ export type { CheckboxIconProps } from './checkbox-icon';
4
+ export type { CheckboxLabelProps } from './checkbox-label';
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Button } from "../../../button/dist/index.js";
3
- import { Range as Range2 } from "../../../range/dist/index.js";
3
+ import { Range } from "../../../range/dist/index.js";
4
4
  import React__default, { memo, useState, useRef, useMemo, useEffect, useCallback } from "react";
5
5
  import { useEventCallback } from "usehooks-ts";
6
6
  import { ColorImageToolbar } from "./color-image-toolbar.js";
@@ -209,7 +209,7 @@ const ColorImagePaint = memo(function ColorImagePaint2(props) {
209
209
  return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
210
210
  /* @__PURE__ */ jsx("span", { className: styles.adjustLabel(), children: (_a2 = features == null ? void 0 : features.labels) == null ? void 0 : _a2[filterName] }),
211
211
  /* @__PURE__ */ jsx(
212
- Range2,
212
+ Range,
213
213
  {
214
214
  min: -100,
215
215
  max: 100,
@@ -7,12 +7,6 @@ interface DropdownProps {
7
7
  * @default true
8
8
  */
9
9
  autoSelectFirstItem?: boolean;
10
- /**
11
- * Whether to avoid collisions by flipping or shifting the dropdown position.
12
- * When false, the dropdown will strictly follow the placement direction.
13
- * @default true
14
- */
15
- avoidCollisions?: boolean;
16
10
  children?: React.ReactNode;
17
11
  disabledNested?: boolean;
18
12
  focusManagerProps?: Partial<FloatingFocusManagerProps>;
@@ -13,7 +13,6 @@ var DropdownComponent = memo(function DropdownComponent2(props) {
13
13
  const {
14
14
  children,
15
15
  autoSelectFirstItem = true,
16
- avoidCollisions = true,
17
16
  disabledNested = false,
18
17
  offset: offsetDistance = DEFAULT_OFFSET,
19
18
  placement = "bottom-start",
@@ -78,14 +77,11 @@ var DropdownComponent = memo(function DropdownComponent2(props) {
78
77
  });
79
78
  });
80
79
  const lastPositionRef = useRef(null);
81
- const middleware = useMemo(() => {
82
- const baseMiddleware = [
83
- offset({ mainAxis: isNested ? 10 : offsetDistance, alignmentAxis: isNested ? -4 : 0 })
84
- ];
85
- if (avoidCollisions) {
86
- baseMiddleware.push(flip(), shift());
87
- }
88
- baseMiddleware.push(
80
+ const middleware = useMemo(
81
+ () => [
82
+ offset({ mainAxis: isNested ? 10 : offsetDistance, alignmentAxis: isNested ? -4 : 0 }),
83
+ flip(),
84
+ shift(),
89
85
  size({
90
86
  padding: 4,
91
87
  apply({ elements, availableHeight, rects }) {
@@ -108,9 +104,9 @@ var DropdownComponent = memo(function DropdownComponent2(props) {
108
104
  }
109
105
  }
110
106
  })
111
- );
112
- return baseMiddleware;
113
- }, [isNested, offsetDistance, matchTriggerWidth, scrollRef, avoidCollisions]);
107
+ ],
108
+ [isNested, offsetDistance, matchTriggerWidth, scrollRef]
109
+ );
114
110
  const { refs, floatingStyles, context, isPositioned } = useFloating({
115
111
  nodeId,
116
112
  open: isControlledOpen,
@@ -54,7 +54,7 @@ const DropdownComponent = memo(function DropdownComponent2(props) {
54
54
  }
55
55
  onOpenChange == null ? void 0 : onOpenChange(newOpen);
56
56
  });
57
- const { nodeId, item, isNested } = useMenuTree({
57
+ const { nodeId, item, isNested, tree } = useMenuTree({
58
58
  disabledNested,
59
59
  handleOpenChange,
60
60
  isControlledOpen
@@ -169,11 +169,17 @@ const DropdownComponent = memo(function DropdownComponent2(props) {
169
169
  bubbles: true,
170
170
  escapeKey: true
171
171
  });
172
+ const handleNavigate = useEventCallback((index) => {
173
+ setActiveIndex(index);
174
+ if (tree && index !== null) {
175
+ tree.events.emit("navigate", { nodeId, index });
176
+ }
177
+ });
172
178
  const listNavigation = useListNavigation(context, {
173
179
  listRef: elementsRef,
174
180
  activeIndex,
175
181
  nested: isNested,
176
- onNavigate: setActiveIndex,
182
+ onNavigate: handleNavigate,
177
183
  loop: true
178
184
  });
179
185
  const typeahead = useTypeahead(context, {
@@ -15,24 +15,12 @@ type VirtualItem = {
15
15
  emojis: EmojiData[];
16
16
  type: "emojis";
17
17
  };
18
- interface CategoryNames {
19
- activities: string;
20
- animalsNature: string;
21
- flags: string;
22
- foodDrink: string;
23
- frequentlyUsed: string;
24
- objects: string;
25
- smileysPeople: string;
26
- symbols: string;
27
- travelPlaces: string;
28
- }
29
18
  interface UseEmojiDataProps {
30
- categoryNames?: CategoryNames;
31
19
  columns: number;
32
20
  searchQuery: string;
33
21
  showFrequentlyUsed: boolean;
34
22
  }
35
- declare function useEmojiData({ searchQuery, columns, showFrequentlyUsed, categoryNames, }: UseEmojiDataProps): {
23
+ declare function useEmojiData({ searchQuery, columns, showFrequentlyUsed }: UseEmojiDataProps): {
36
24
  categorizedData: VirtualItem[];
37
25
  categoryIndexMap: Map<EmojiCategory, number>;
38
26
  searchResults: {
@@ -64,22 +52,6 @@ interface EmojiPickerProps {
64
52
  showFooter?: boolean;
65
53
  value?: EmojiData | null;
66
54
  variant?: "default" | "dark" | "light";
67
- i18n?: {
68
- noEmojisFoundTitle?: string;
69
- noEmojisFoundDescription?: string;
70
- footerPickAnEmoji?: string;
71
- categories?: {
72
- frequentlyUsed: string;
73
- smileysPeople: string;
74
- animalsNature: string;
75
- foodDrink: string;
76
- travelPlaces: string;
77
- activities: string;
78
- objects: string;
79
- symbols: string;
80
- flags: string;
81
- };
82
- };
83
55
  }
84
56
  declare const EmojiPicker: React.NamedExoticComponent<EmojiPickerProps>;
85
57
 
@@ -141,7 +141,7 @@ var emojiFooterTv = tcv({
141
141
  var emojiEmptyTv = tcv({
142
142
  slots: {
143
143
  container: "flex h-32 flex-col items-center justify-center p-4 text-center",
144
- title: "text-body-large-strong",
144
+ title: "text-heading-display",
145
145
  description: "mt-2 w-32"
146
146
  },
147
147
  variants: {
@@ -179,20 +179,13 @@ var EmojiCategoryHeader = forwardRef(
179
179
  );
180
180
  }
181
181
  );
182
- var EmojiFooter = memo(function EmojiFooter2({
183
- hoveredEmoji,
184
- selectedEmoji,
185
- variant = "dark",
186
- i18n = {
187
- pickAnEmoji: "Pick an emoji..."
188
- }
189
- }) {
182
+ function EmojiFooter({ hoveredEmoji, selectedEmoji, variant = "dark" }) {
190
183
  var _a, _b;
191
184
  const tv = emojiFooterTv({ variant });
192
185
  return /* @__PURE__ */ jsxs("div", { className: tv.footer(), children: [
193
186
  /* @__PURE__ */ jsx("div", { className: tv.emojiPreview(), children: ((_a = hoveredEmoji || selectedEmoji) == null ? void 0 : _a.emoji) || /* @__PURE__ */ jsx("div", { className: tv.emojiPreviewEmpty() }) }),
194
187
  /* @__PURE__ */ jsxs("div", { className: tv.emojiInfo(), children: [
195
- /* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) || i18n.pickAnEmoji }),
188
+ /* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) || "Pick an emoji..." }),
196
189
  hoveredEmoji || selectedEmoji ? /* @__PURE__ */ jsxs("div", { className: tv.emojiCode(), children: [
197
190
  ":",
198
191
  (_b = hoveredEmoji || selectedEmoji) == null ? void 0 : _b.nameUrl,
@@ -200,7 +193,7 @@ var EmojiFooter = memo(function EmojiFooter2({
200
193
  ] }) : /* @__PURE__ */ jsx(Fragment, {})
201
194
  ] })
202
195
  ] });
203
- });
196
+ }
204
197
  var EmojiItem = memo(function EmojiItem2(props) {
205
198
  const { emoji, onSelect, onHover, selected = false, variant = "dark" } = props;
206
199
  return /* @__PURE__ */ jsx(
@@ -216,17 +209,11 @@ var EmojiItem = memo(function EmojiItem2(props) {
216
209
  }
217
210
  );
218
211
  });
219
- var EmojiEmpty = memo(function EmojiEmpty2({
220
- variant = "dark",
221
- i18n = {
222
- title: "No emoji found",
223
- description: "You can search for an emoji by name or use the search bar to find it."
224
- }
225
- }) {
212
+ var EmojiEmpty = memo(function EmojiEmpty2({ variant = "dark" }) {
226
213
  const tv = emojiEmptyTv({ variant });
227
214
  return /* @__PURE__ */ jsxs("div", { className: tv.container(), children: [
228
- /* @__PURE__ */ jsx("div", { className: tv.title(), children: i18n.title }),
229
- /* @__PURE__ */ jsx("p", { className: tv.description(), children: i18n.description })
215
+ /* @__PURE__ */ jsx("div", { className: tv.title(), children: "No emoji found" }),
216
+ /* @__PURE__ */ jsx("p", { className: tv.description(), children: "You can search for an emoji by name or use the search bar to find it." })
230
217
  ] });
231
218
  });
232
219
  var emojis = [
@@ -11740,15 +11727,15 @@ var emojis = [
11740
11727
  }
11741
11728
  ];
11742
11729
  var categories = [
11743
- { id: "frequently_used" },
11744
- { id: "smileys_people", range: [1, 460] },
11745
- { id: "animals_nature", range: [465, 591] },
11746
- { id: "food_drink", range: [592, 712] },
11747
- { id: "travel_places", range: [713, 922] },
11748
- { id: "activities", range: [923, 1001] },
11749
- { id: "objects", range: [1002, 1234] },
11750
- { id: "symbols", range: [1235, 1451] },
11751
- { id: "flags", range: [1452, 1719] }
11730
+ { id: "frequently_used", name: "Frequently used" },
11731
+ { id: "smileys_people", name: "Smileys & People", range: [1, 460] },
11732
+ { id: "animals_nature", name: "Animals & Nature", range: [465, 591] },
11733
+ { id: "food_drink", name: "Food & Drink", range: [592, 712] },
11734
+ { id: "travel_places", name: "Travel & Places", range: [713, 922] },
11735
+ { id: "activities", name: "Activities", range: [923, 1001] },
11736
+ { id: "objects", name: "Objects", range: [1002, 1234] },
11737
+ { id: "symbols", name: "Symbols", range: [1235, 1451] },
11738
+ { id: "flags", name: "Flags", range: [1452, 1719] }
11752
11739
  ];
11753
11740
  var STORAGE_KEY = "emoji-picker-frequently-used";
11754
11741
  function getEmojiCategory(id) {
@@ -11782,34 +11769,7 @@ function saveFrequentlyUsedEmoji(emojiId) {
11782
11769
  } catch {
11783
11770
  }
11784
11771
  }
11785
- var defaultCategoryNames = {
11786
- frequentlyUsed: "Frequently used",
11787
- smileysPeople: "Smileys & People",
11788
- animalsNature: "Animals & Nature",
11789
- foodDrink: "Food & Drink",
11790
- travelPlaces: "Travel & Places",
11791
- activities: "Activities",
11792
- objects: "Objects",
11793
- symbols: "Symbols",
11794
- flags: "Flags"
11795
- };
11796
- var categoryIdToI18nKey = {
11797
- frequently_used: "frequentlyUsed",
11798
- smileys_people: "smileysPeople",
11799
- animals_nature: "animalsNature",
11800
- food_drink: "foodDrink",
11801
- travel_places: "travelPlaces",
11802
- activities: "activities",
11803
- objects: "objects",
11804
- symbols: "symbols",
11805
- flags: "flags"
11806
- };
11807
- function useEmojiData({
11808
- searchQuery,
11809
- columns,
11810
- showFrequentlyUsed,
11811
- categoryNames = defaultCategoryNames
11812
- }) {
11772
+ function useEmojiData({ searchQuery, columns, showFrequentlyUsed }) {
11813
11773
  const [frequentlyUsed, setFrequentlyUsed] = useState([]);
11814
11774
  useEffect(() => {
11815
11775
  if (showFrequentlyUsed) {
@@ -11839,7 +11799,7 @@ function useEmojiData({
11839
11799
  items.push({
11840
11800
  type: "header",
11841
11801
  category: "frequently_used",
11842
- title: categoryNames.frequentlyUsed
11802
+ title: "Frequently used"
11843
11803
  });
11844
11804
  for (let i = 0; i < frequentlyUsed.length; i += columns) {
11845
11805
  items.push({
@@ -11854,11 +11814,10 @@ function useEmojiData({
11854
11814
  (emoji) => emoji.id >= category.range[0] && emoji.id <= category.range[1]
11855
11815
  );
11856
11816
  if (categoryEmojis.length > 0) {
11857
- const i18nKey = categoryIdToI18nKey[category.id];
11858
11817
  items.push({
11859
11818
  type: "header",
11860
11819
  category: category.id,
11861
- title: i18nKey ? categoryNames[i18nKey] : category.id
11820
+ title: category.name
11862
11821
  });
11863
11822
  for (let i = 0; i < categoryEmojis.length; i += columns) {
11864
11823
  items.push({
@@ -11869,7 +11828,7 @@ function useEmojiData({
11869
11828
  }
11870
11829
  });
11871
11830
  return items;
11872
- }, [searchQuery, searchResults, frequentlyUsed, columns, showFrequentlyUsed, categoryNames]);
11831
+ }, [searchQuery, searchResults, frequentlyUsed, columns, showFrequentlyUsed]);
11873
11832
  const categoryIndexMap = useMemo(() => {
11874
11833
  const map = /* @__PURE__ */ new Map();
11875
11834
  categorizedData.forEach((item, index) => {
@@ -11925,8 +11884,6 @@ function useEmojiScroll({
11925
11884
  const [currentVisibleCategory, setCurrentVisibleCategory] = useState("frequently_used");
11926
11885
  const isScrollingToTarget = useRef(false);
11927
11886
  const isInternalUpdate = useRef(false);
11928
- const scrollingTimeoutRef = useRef(null);
11929
- const internalUpdateTimeoutRef = useRef(null);
11930
11887
  const virtualizer = useVirtualizer({
11931
11888
  count: categorizedData.length,
11932
11889
  getScrollElement: () => scrollRef.current,
@@ -11991,10 +11948,7 @@ function useEmojiScroll({
11991
11948
  align: "start",
11992
11949
  behavior: "auto"
11993
11950
  });
11994
- if (scrollingTimeoutRef.current) {
11995
- clearTimeout(scrollingTimeoutRef.current);
11996
- }
11997
- scrollingTimeoutRef.current = setTimeout(() => {
11951
+ setTimeout(() => {
11998
11952
  isScrollingToTarget.current = false;
11999
11953
  }, 100);
12000
11954
  }
@@ -12007,33 +11961,17 @@ function useEmojiScroll({
12007
11961
  align: "center",
12008
11962
  behavior: "auto"
12009
11963
  });
12010
- if (scrollingTimeoutRef.current) {
12011
- clearTimeout(scrollingTimeoutRef.current);
12012
- }
12013
- scrollingTimeoutRef.current = setTimeout(() => {
11964
+ setTimeout(() => {
12014
11965
  isScrollingToTarget.current = false;
12015
11966
  }, 100);
12016
11967
  }
12017
11968
  });
12018
11969
  const markInternalUpdate = useEventCallback(() => {
12019
11970
  isInternalUpdate.current = true;
12020
- if (internalUpdateTimeoutRef.current) {
12021
- clearTimeout(internalUpdateTimeoutRef.current);
12022
- }
12023
- internalUpdateTimeoutRef.current = setTimeout(() => {
11971
+ setTimeout(() => {
12024
11972
  isInternalUpdate.current = false;
12025
11973
  }, 50);
12026
11974
  });
12027
- useEffect(() => {
12028
- return () => {
12029
- if (scrollingTimeoutRef.current) {
12030
- clearTimeout(scrollingTimeoutRef.current);
12031
- }
12032
- if (internalUpdateTimeoutRef.current) {
12033
- clearTimeout(internalUpdateTimeoutRef.current);
12034
- }
12035
- };
12036
- }, []);
12037
11975
  useEffect(() => {
12038
11976
  if (value && !searchQuery.trim() && !isInternalUpdate.current) {
12039
11977
  scrollToEmoji(value);
@@ -12058,6 +11996,17 @@ function useEmojiScroll({
12058
11996
  PADDING
12059
11997
  };
12060
11998
  }
11999
+ var categoriesWithIcons = [
12000
+ { id: "frequently_used", name: "Frequently used", icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {}) },
12001
+ { id: "smileys_people", name: "Smileys & People", icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
12002
+ { id: "animals_nature", name: "Animals & Nature", icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
12003
+ { id: "food_drink", name: "Food & Drink", icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
12004
+ { id: "travel_places", name: "Travel & Places", icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
12005
+ { id: "activities", name: "Activities", icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
12006
+ { id: "objects", name: "Objects", icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
12007
+ { id: "symbols", name: "Symbols", icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
12008
+ { id: "flags", name: "Flags", icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
12009
+ ];
12061
12010
  var EmojiPicker = memo(function EmojiPicker2({
12062
12011
  value,
12063
12012
  onChange,
@@ -12070,49 +12019,11 @@ var EmojiPicker = memo(function EmojiPicker2({
12070
12019
  showSearch = true,
12071
12020
  showFooter = true,
12072
12021
  children,
12073
- variant = "dark",
12074
- i18n = {
12075
- noEmojisFoundTitle: "No emoji found",
12076
- noEmojisFoundDescription: "You can search for an emoji by name or use the search bar to find it.",
12077
- footerPickAnEmoji: "Pick an emoji...",
12078
- categories: {
12079
- frequentlyUsed: "Frequently used",
12080
- smileysPeople: "Smileys & People",
12081
- animalsNature: "Animals & Nature",
12082
- foodDrink: "Food & Drink",
12083
- travelPlaces: "Travel & Places",
12084
- activities: "Activities",
12085
- objects: "Objects",
12086
- symbols: "Symbols",
12087
- flags: "Flags"
12088
- }
12089
- }
12022
+ variant = "dark"
12090
12023
  }) {
12091
12024
  const [searchQuery, setSearchQuery] = useState("");
12092
12025
  const [hoveredEmoji, setHoveredEmoji] = useState(null);
12093
- const safeColumns = Math.max(1, columns);
12094
12026
  const tv = emojiTv({ variant });
12095
- const categoriesWithIcons = useMemo(
12096
- () => {
12097
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12098
- return [
12099
- {
12100
- id: "frequently_used",
12101
- name: (_a = i18n.categories) == null ? void 0 : _a.frequentlyUsed,
12102
- icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {})
12103
- },
12104
- { id: "smileys_people", name: (_b = i18n.categories) == null ? void 0 : _b.smileysPeople, icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
12105
- { id: "animals_nature", name: (_c = i18n.categories) == null ? void 0 : _c.animalsNature, icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
12106
- { id: "food_drink", name: (_d = i18n.categories) == null ? void 0 : _d.foodDrink, icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
12107
- { id: "travel_places", name: (_e = i18n.categories) == null ? void 0 : _e.travelPlaces, icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
12108
- { id: "activities", name: (_f = i18n.categories) == null ? void 0 : _f.activities, icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
12109
- { id: "objects", name: (_g = i18n.categories) == null ? void 0 : _g.objects, icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
12110
- { id: "symbols", name: (_h = i18n.categories) == null ? void 0 : _h.symbols, icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
12111
- { id: "flags", name: (_i = i18n.categories) == null ? void 0 : _i.flags, icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
12112
- ];
12113
- },
12114
- [i18n.categories]
12115
- );
12116
12027
  const {
12117
12028
  categorizedData,
12118
12029
  categoryIndexMap,
@@ -12120,9 +12031,8 @@ var EmojiPicker = memo(function EmojiPicker2({
12120
12031
  findEmojiPosition
12121
12032
  } = useEmojiData({
12122
12033
  searchQuery,
12123
- columns: safeColumns,
12124
- showFrequentlyUsed,
12125
- categoryNames: i18n.categories
12034
+ columns,
12035
+ showFrequentlyUsed
12126
12036
  });
12127
12037
  const {
12128
12038
  scrollRef,
@@ -12138,7 +12048,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12138
12048
  findEmojiPosition,
12139
12049
  searchQuery,
12140
12050
  value,
12141
- columns: safeColumns
12051
+ columns
12142
12052
  });
12143
12053
  const availableCategories = useMemo(() => {
12144
12054
  return categoriesWithIcons.filter((category) => {
@@ -12147,7 +12057,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12147
12057
  }
12148
12058
  return true;
12149
12059
  });
12150
- }, [categoriesWithIcons, showFrequentlyUsed]);
12060
+ }, [showFrequentlyUsed]);
12151
12061
  const handleEmojiSelect = useEventCallback((emoji) => {
12152
12062
  markInternalUpdate();
12153
12063
  addToFrequentlyUsed(emoji.id);
@@ -12163,7 +12073,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12163
12073
  const rootStyle = {
12164
12074
  "--emoji-height": `${height}px`,
12165
12075
  "--emoji-padding": `${PADDING2}px`,
12166
- "--emoji-columns": `${safeColumns}`
12076
+ "--emoji-columns": `${columns}`
12167
12077
  };
12168
12078
  return /* @__PURE__ */ jsxs(
12169
12079
  "div",
@@ -12266,16 +12176,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12266
12176
  },
12267
12177
  virtualItem.key
12268
12178
  );
12269
- }) : /* @__PURE__ */ jsx(
12270
- EmojiEmpty,
12271
- {
12272
- variant,
12273
- i18n: {
12274
- title: i18n.noEmojisFoundTitle,
12275
- description: i18n.noEmojisFoundDescription
12276
- }
12277
- }
12278
- )
12179
+ }) : /* @__PURE__ */ jsx(EmojiEmpty, { variant })
12279
12180
  }
12280
12181
  )
12281
12182
  }
@@ -12287,10 +12188,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12287
12188
  {
12288
12189
  hoveredEmoji,
12289
12190
  selectedEmoji: value || null,
12290
- variant,
12291
- i18n: {
12292
- pickAnEmoji: i18n.footerPickAnEmoji
12293
- }
12191
+ variant
12294
12192
  }
12295
12193
  ),
12296
12194
  children
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Range as Range2 } from "../../../range/dist/index.js";
2
+ import { Range } 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
- Range2,
26
+ Range,
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" | "submit" | "reset";
17
+ variant?: "default" | "secondary" | "solid" | "highlight" | "ghost" | "dark" | "reset";
18
18
  }
19
19
  declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & react.RefAttributes<HTMLElement>>;
20
20