@choice-ui/react 1.9.7 → 1.9.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 (45) hide show
  1. package/dist/components/button/dist/index.d.ts +9 -2
  2. package/dist/components/button/dist/index.js +19 -45
  3. package/dist/components/checkbox/dist/index.d.ts +1 -10
  4. package/dist/components/checkbox/dist/index.js +5 -49
  5. package/dist/components/code-block/dist/index.d.ts +14 -11
  6. package/dist/components/code-block/dist/index.js +93 -120
  7. package/dist/components/colors/dist/index.d.ts +6 -39
  8. package/dist/components/colors/src/color-image-paint/color-image-paint.js +2 -2
  9. package/dist/components/dropdown/dist/index.d.ts +0 -6
  10. package/dist/components/dropdown/dist/index.js +10 -20
  11. package/dist/components/emoji-picker/dist/index.d.ts +1 -30
  12. package/dist/components/emoji-picker/dist/index.js +44 -148
  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/list/dist/index.d.ts +1 -1
  17. package/dist/components/md-render/dist/index.d.ts +1 -2
  18. package/dist/components/md-render/dist/index.js +9 -5
  19. package/dist/components/menus/dist/index.d.ts +0 -5
  20. package/dist/components/menus/dist/index.js +3 -32
  21. package/dist/components/modal/dist/index.js +2 -2
  22. package/dist/components/notifications/dist/index.d.ts +5 -1
  23. package/dist/components/numeric-input/dist/index.d.ts +10 -27
  24. package/dist/components/numeric-input/dist/index.js +23 -108
  25. package/dist/components/panel/dist/index.d.ts +16 -16
  26. package/dist/components/picture-preview/dist/index.d.ts +0 -5
  27. package/dist/components/picture-preview/dist/index.js +140 -287
  28. package/dist/components/popover/dist/index.d.ts +0 -5
  29. package/dist/components/popover/dist/index.js +2 -21
  30. package/dist/components/radio/dist/index.d.ts +1 -9
  31. package/dist/components/radio/dist/index.js +6 -50
  32. package/dist/components/range/dist/index.d.ts +20 -276
  33. package/dist/components/range/dist/index.js +616 -1044
  34. package/dist/components/scroll-area/dist/index.d.ts +27 -4
  35. package/dist/components/scroll-area/dist/index.js +123 -96
  36. package/dist/components/separator/dist/index.d.ts +8 -1
  37. package/dist/components/splitter/dist/index.d.ts +1 -1
  38. package/dist/components/text-field/dist/index.d.ts +3 -2
  39. package/dist/components/text-field/dist/index.js +19 -4
  40. package/dist/components/textarea/dist/index.js +1 -3
  41. package/dist/components/tooltip/dist/index.d.ts +0 -2
  42. package/dist/components/tooltip/dist/index.js +5 -23
  43. package/package.json +1 -1
  44. package/dist/components/toast/dist/index.d.ts +0 -274
  45. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -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,
@@ -12068,51 +12017,12 @@ var EmojiPicker = memo(function EmojiPicker2({
12068
12017
  showCategories = true,
12069
12018
  showFrequentlyUsed = true,
12070
12019
  showSearch = true,
12071
- showFooter = true,
12072
12020
  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
- }
12021
+ variant = "dark"
12090
12022
  }) {
12091
12023
  const [searchQuery, setSearchQuery] = useState("");
12092
12024
  const [hoveredEmoji, setHoveredEmoji] = useState(null);
12093
- const safeColumns = Math.max(1, columns);
12094
12025
  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
12026
  const {
12117
12027
  categorizedData,
12118
12028
  categoryIndexMap,
@@ -12120,9 +12030,8 @@ var EmojiPicker = memo(function EmojiPicker2({
12120
12030
  findEmojiPosition
12121
12031
  } = useEmojiData({
12122
12032
  searchQuery,
12123
- columns: safeColumns,
12124
- showFrequentlyUsed,
12125
- categoryNames: i18n.categories
12033
+ columns,
12034
+ showFrequentlyUsed
12126
12035
  });
12127
12036
  const {
12128
12037
  scrollRef,
@@ -12138,7 +12047,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12138
12047
  findEmojiPosition,
12139
12048
  searchQuery,
12140
12049
  value,
12141
- columns: safeColumns
12050
+ columns
12142
12051
  });
12143
12052
  const availableCategories = useMemo(() => {
12144
12053
  return categoriesWithIcons.filter((category) => {
@@ -12147,14 +12056,13 @@ var EmojiPicker = memo(function EmojiPicker2({
12147
12056
  }
12148
12057
  return true;
12149
12058
  });
12150
- }, [categoriesWithIcons, showFrequentlyUsed]);
12059
+ }, [showFrequentlyUsed]);
12151
12060
  const handleEmojiSelect = useEventCallback((emoji) => {
12152
12061
  markInternalUpdate();
12153
12062
  addToFrequentlyUsed(emoji.id);
12154
12063
  onChange == null ? void 0 : onChange(emoji);
12155
12064
  });
12156
12065
  const handleEmojiHover = useEventCallback((emoji) => {
12157
- if (!showFooter) return;
12158
12066
  setHoveredEmoji(emoji);
12159
12067
  });
12160
12068
  const handleCategoryClick = useEventCallback((category) => {
@@ -12163,7 +12071,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12163
12071
  const rootStyle = {
12164
12072
  "--emoji-height": `${height}px`,
12165
12073
  "--emoji-padding": `${PADDING2}px`,
12166
- "--emoji-columns": `${safeColumns}`
12074
+ "--emoji-columns": `${columns}`
12167
12075
  };
12168
12076
  return /* @__PURE__ */ jsxs(
12169
12077
  "div",
@@ -12171,7 +12079,7 @@ var EmojiPicker = memo(function EmojiPicker2({
12171
12079
  className: tv.container({ className }),
12172
12080
  style: rootStyle,
12173
12081
  children: [
12174
- (showSearch || showCategories) && /* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
12082
+ /* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
12175
12083
  showSearch && /* @__PURE__ */ jsx(
12176
12084
  SearchInput,
12177
12085
  {
@@ -12266,31 +12174,19 @@ var EmojiPicker = memo(function EmojiPicker2({
12266
12174
  },
12267
12175
  virtualItem.key
12268
12176
  );
12269
- }) : /* @__PURE__ */ jsx(
12270
- EmojiEmpty,
12271
- {
12272
- variant,
12273
- i18n: {
12274
- title: i18n.noEmojisFoundTitle,
12275
- description: i18n.noEmojisFoundDescription
12276
- }
12277
- }
12278
- )
12177
+ }) : /* @__PURE__ */ jsx(EmojiEmpty, { variant })
12279
12178
  }
12280
12179
  )
12281
12180
  }
12282
12181
  )
12283
12182
  }
12284
12183
  ),
12285
- showFooter && /* @__PURE__ */ jsx(
12184
+ /* @__PURE__ */ jsx(
12286
12185
  EmojiFooter,
12287
12186
  {
12288
12187
  hoveredEmoji,
12289
12188
  selectedEmoji: value || null,
12290
- variant,
12291
- i18n: {
12292
- pickAnEmoji: i18n.footerPickAnEmoji
12293
- }
12189
+ variant
12294
12190
  }
12295
12191
  ),
12296
12192
  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
 
@@ -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: {
@@ -67,7 +67,7 @@ interface ListProps extends Omit<HTMLProps<HTMLDivElement>, "size" | "as"> {
67
67
  selection?: boolean;
68
68
  shouldShowReferenceLine?: boolean;
69
69
  size?: "default" | "large";
70
- variant?: "default" | "primary" | "dark" | "reset";
70
+ variant?: "default" | "primary";
71
71
  }
72
72
  interface ListComponentProps extends React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLDivElement>> {
73
73
  Content: typeof ListContent;
@@ -8,10 +8,9 @@ interface MentionItemProps {
8
8
  }
9
9
  interface MdRenderProps {
10
10
  allowedPrefixes?: string[];
11
- children?: string;
12
11
  className?: string;
13
12
  components?: Partial<Components>;
14
- content?: string;
13
+ content: string;
15
14
  customColor?: {
16
15
  codeBackground?: string;
17
16
  defaultBackground?: string;
@@ -280,7 +280,13 @@ var createMarkdownComponents = (tv, MentionComponent, mentionItems) => {
280
280
  {
281
281
  className: tv.codeBlock(),
282
282
  lineThreshold: void 0,
283
- children: /* @__PURE__ */ jsx(CodeBlock2.Code, { language, children })
283
+ children: /* @__PURE__ */ jsx(
284
+ CodeBlock2.Code,
285
+ {
286
+ code: children,
287
+ language
288
+ }
289
+ )
284
290
  }
285
291
  );
286
292
  },
@@ -403,7 +409,7 @@ var INITIAL_COMPONENTS = {
403
409
  expandable: false,
404
410
  children: [
405
411
  /* @__PURE__ */ jsx(CodeBlock2.Header, { showLineCount: false }),
406
- /* @__PURE__ */ jsx(CodeBlock2.Content, { children })
412
+ /* @__PURE__ */ jsx(CodeBlock2.Content, { code: children })
407
413
  ]
408
414
  }
409
415
  );
@@ -415,7 +421,6 @@ var MdRender = memo(
415
421
  id,
416
422
  components: customComponents,
417
423
  content,
418
- children,
419
424
  className,
420
425
  mentionRenderComponent,
421
426
  mentionItems,
@@ -424,10 +429,9 @@ var MdRender = memo(
424
429
  size = "default",
425
430
  variant = "default"
426
431
  } = props;
427
- const markdownContent = content ?? children ?? "";
428
432
  const generatedId = useId();
429
433
  const blockId = id ?? generatedId;
430
- const blocks = useMdBlocks(markdownContent);
434
+ const blocks = useMdBlocks(content);
431
435
  const tv = useMemo(() => mdRenderTv({ size, variant }), [size, variant]);
432
436
  const tvComponents = useMemo(
433
437
  () => createMarkdownComponents(tv, mentionRenderComponent, mentionItems),
@@ -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, Launch, ChevronRightSmall, ChevronUpSmall } from "@choiceform/icons-react";
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
  }
@@ -843,25 +839,18 @@ function useMenuTree(config) {
843
839
  handleOpenChange(false);
844
840
  }
845
841
  });
846
- const handleParentNavigate = useEventCallback((event) => {
847
- if (event.nodeId === parentId && event.index !== item.index && isControlledOpen) {
848
- handleOpenChange(false);
849
- }
850
- });
851
842
  const cleanupTreeEvents = useEventCallback(() => {
852
843
  if (tree) {
853
844
  tree.events.off("click", handleTreeClick);
854
845
  tree.events.off("menuopen", handleSubMenuOpen);
855
- tree.events.off("navigate", handleParentNavigate);
856
846
  }
857
847
  });
858
848
  useEffect(() => {
859
849
  if (!tree) return;
860
850
  tree.events.on("click", handleTreeClick);
861
851
  tree.events.on("menuopen", handleSubMenuOpen);
862
- tree.events.on("navigate", handleParentNavigate);
863
852
  return cleanupTreeEvents;
864
- }, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, handleParentNavigate, cleanupTreeEvents]);
853
+ }, [tree, nodeId, parentId, handleTreeClick, handleSubMenuOpen, cleanupTreeEvents]);
865
854
  useEffect(() => {
866
855
  if (isControlledOpen && tree) {
867
856
  tree.events.emit("menuopen", { parentId, nodeId });
@@ -915,9 +904,7 @@ var MenuContextItem = memo(
915
904
  size: size2,
916
905
  shortcut,
917
906
  prefixElement,
918
- suffixElement,
919
907
  variant,
920
- asLink,
921
908
  onClick,
922
909
  onMouseUp,
923
910
  onTouchStart,
@@ -982,16 +969,6 @@ var MenuContextItem = memo(
982
969
  }),
983
970
  [shortcut == null ? void 0 : shortcut.modifier, shortcut == null ? void 0 : shortcut.keys]
984
971
  );
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]);
995
972
  const combinedRef = useCallback(
996
973
  (node) => {
997
974
  item.ref(node);
@@ -1014,7 +991,6 @@ var MenuContextItem = memo(
1014
991
  disabled,
1015
992
  selected,
1016
993
  prefixElement: prefixConfig,
1017
- suffixElement: suffixConfig,
1018
994
  shortcut: shortcutConfig,
1019
995
  variant,
1020
996
  size: size2,
@@ -1082,12 +1058,7 @@ var MenuContextSubTrigger = memo(
1082
1058
  throw new Error("MenuContextSubTrigger must be used within a MenuContext component");
1083
1059
  }
1084
1060
  const isActive = useMemo(
1085
- () => {
1086
- if (menu.activeIndex !== null && menu.activeIndex !== void 0) {
1087
- return item.index === menu.activeIndex;
1088
- }
1089
- return !!active;
1090
- },
1061
+ () => item.index === menu.activeIndex || !!active,
1091
1062
  [item.index, menu.activeIndex, active]
1092
1063
  );
1093
1064
  const handleFocus = useEventCallback((event) => {
@@ -15,7 +15,7 @@ var ModalTv = tcv({
15
15
  });
16
16
  var ModalHeaderTv = tcv({
17
17
  slots: {
18
- root: ["modal__header", "grid border-default-boundary w-full flex-none items-center border-b"],
18
+ root: "modal__header border-default-boundary w-full flex-none items-center border-b",
19
19
  title: "text-body-medium flex min-w-0 items-center gap-2 p-2 font-strong [grid-area:title] select-none",
20
20
  close: "p-2 [grid-area:close]"
21
21
  },
@@ -30,7 +30,7 @@ var ModalHeaderTv = tcv({
30
30
  },
31
31
  close: {
32
32
  true: {
33
- root: "grid-cols-[auto_1fr_2.5rem]"
33
+ root: "modal__header--action"
34
34
  },
35
35
  false: {}
36
36
  }
@@ -1,4 +1,7 @@
1
1
  import { ToasterProps } from 'sonner';
2
+ import * as react from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
2
5
  interface NotificationsProps extends Omit<ToasterProps, "id"> {
3
6
  actions?: (id: string | number) => {
4
7
  action?: {
@@ -17,6 +20,7 @@ interface NotificationsProps extends Omit<ToasterProps, "id"> {
17
20
  text?: string;
18
21
  toasterId?: string;
19
22
  }
23
+ declare const Toast: react.MemoExoticComponent<(props: NotificationsProps) => react_jsx_runtime.JSX.Element>;
20
24
  declare function notifications(toast: Omit<NotificationsProps, "id">): string | number;
21
25
 
22
- export { type NotificationsProps, notifications };
26
+ export { type NotificationsProps, Toast, notifications };