@fangxinyan/lumina 0.9.3 → 0.9.5

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 (104) hide show
  1. package/dist/AutoComplete.cjs +4 -4
  2. package/dist/AutoComplete.js +3 -3
  3. package/dist/Cascader.cjs +4 -4
  4. package/dist/Cascader.js +3 -3
  5. package/dist/ColorPicker.cjs +4 -4
  6. package/dist/ColorPicker.js +3 -3
  7. package/dist/CommandPalette.cjs +3 -3
  8. package/dist/CommandPalette.js +2 -2
  9. package/dist/ContextMenu.cjs +3 -3
  10. package/dist/ContextMenu.js +2 -2
  11. package/dist/DatePicker.cjs +5 -5
  12. package/dist/DatePicker.js +4 -4
  13. package/dist/DateTimePicker.cjs +5 -5
  14. package/dist/DateTimePicker.js +4 -4
  15. package/dist/Drawer.cjs +3 -3
  16. package/dist/Drawer.js +2 -2
  17. package/dist/Form.cjs +5 -5
  18. package/dist/Form.js +2 -2
  19. package/dist/Image.cjs +6 -6
  20. package/dist/Image.js +2 -2
  21. package/dist/Message.cjs +6 -6
  22. package/dist/Message.js +2 -2
  23. package/dist/Modal.cjs +3 -3
  24. package/dist/Modal.js +2 -2
  25. package/dist/Pagination.cjs +5 -5
  26. package/dist/Pagination.js +4 -4
  27. package/dist/Popover.cjs +4 -4
  28. package/dist/Popover.js +3 -3
  29. package/dist/{Select-UTNBARSQ.css → Select-M3HCB3PW.css} +66 -0
  30. package/dist/Select.cjs +4 -4
  31. package/dist/Select.d.cts +6 -2
  32. package/dist/Select.d.ts +6 -2
  33. package/dist/Select.js +3 -3
  34. package/dist/Table.cjs +6 -6
  35. package/dist/Table.js +5 -5
  36. package/dist/TablePro.cjs +7 -7
  37. package/dist/TablePro.js +6 -6
  38. package/dist/ThemePanel.cjs +7 -7
  39. package/dist/ThemePanel.js +4 -4
  40. package/dist/TimePicker.cjs +5 -5
  41. package/dist/TimePicker.js +4 -4
  42. package/dist/Tooltip.cjs +4 -4
  43. package/dist/Tooltip.js +3 -3
  44. package/dist/Typography.cjs +8 -8
  45. package/dist/Typography.js +3 -3
  46. package/dist/{chunk-7PUYEPLK.js → chunk-4K6PQCWU.js} +1 -1
  47. package/dist/{chunk-ZT7ZWAF2.cjs → chunk-5OQB5UUT.cjs} +6 -6
  48. package/dist/{chunk-Z7GKR4LL.js → chunk-5PDEOGFV.js} +2 -2
  49. package/dist/{chunk-AE5XWZ24.cjs → chunk-5PGRAEGA.cjs} +4 -4
  50. package/dist/{chunk-FJB3243S.cjs → chunk-6A5KEWVU.cjs} +2 -2
  51. package/dist/{chunk-6MT3APJ3.js → chunk-6EHKQDMX.js} +1 -1
  52. package/dist/{chunk-GW77XQEF.cjs → chunk-73IEJLSD.cjs} +6 -6
  53. package/dist/{chunk-EBU3DTUN.cjs → chunk-757JNNLH.cjs} +2 -2
  54. package/dist/{chunk-TNQJA5JF.js → chunk-7QKSXVN3.js} +1 -1
  55. package/dist/{chunk-MEBAE7DB.js → chunk-AEMDX4S7.js} +2 -2
  56. package/dist/{chunk-3J7HOTD6.cjs → chunk-BCQIVYL6.cjs} +4 -4
  57. package/dist/{chunk-4ZSFMWLF.cjs → chunk-BM2J5QAE.cjs} +4 -4
  58. package/dist/{chunk-HSDMJUB6.cjs → chunk-BN44QG2B.cjs} +14 -1
  59. package/dist/{chunk-2A4GYSN4.js → chunk-BZB45GGK.js} +14 -2
  60. package/dist/{chunk-P3ZIABMZ.cjs → chunk-D5HLHN5N.cjs} +6 -6
  61. package/dist/{chunk-35RCCUGO.cjs → chunk-ELKGV3NA.cjs} +3 -3
  62. package/dist/{chunk-2V6RQQRI.js → chunk-G4E5QA2M.js} +1 -1
  63. package/dist/{chunk-MKVONDTB.js → chunk-G62HAXAL.js} +3 -3
  64. package/dist/{chunk-7IWUBBYX.cjs → chunk-HPNZDAXF.cjs} +6 -6
  65. package/dist/{chunk-AR3MT2ZT.cjs → chunk-IM47JR57.cjs} +4 -4
  66. package/dist/{chunk-5Q2ZYR5Z.cjs → chunk-JNDATLOY.cjs} +2 -2
  67. package/dist/{chunk-QK3E6FAQ.js → chunk-K4P45V67.js} +1 -1
  68. package/dist/{chunk-A34P5CU7.js → chunk-KJG44Z5J.js} +2 -2
  69. package/dist/{chunk-TPFY5SKB.cjs → chunk-L6ELDWUX.cjs} +2 -2
  70. package/dist/{chunk-AQN3PD24.cjs → chunk-LDZCDOMW.cjs} +2 -2
  71. package/dist/{chunk-XHKSUKKL.cjs → chunk-LQKP7MEA.cjs} +4 -4
  72. package/dist/{chunk-7ZMUCSCJ.cjs → chunk-M4GXFACD.cjs} +4 -4
  73. package/dist/{chunk-IU6PLLEL.js → chunk-MAXOCM5I.js} +1 -1
  74. package/dist/{chunk-HJGPUE67.cjs → chunk-NALBGFHY.cjs} +4 -4
  75. package/dist/{chunk-3QXP2ZNP.js → chunk-NKIXCDZC.js} +1 -1
  76. package/dist/{chunk-RWM44VCZ.cjs → chunk-OA3O5S7X.cjs} +4 -4
  77. package/dist/{chunk-EP7QREID.js → chunk-PK5ZMOW6.js} +1 -1
  78. package/dist/{chunk-BDPJ2BPN.js → chunk-QS4GORDY.js} +1 -1
  79. package/dist/{chunk-ZGZLEJKA.cjs → chunk-QV4SPR4Z.cjs} +3 -3
  80. package/dist/{chunk-2COQYOVG.js → chunk-QVDW32F2.js} +2 -2
  81. package/dist/{chunk-AFYNTVSH.js → chunk-ROCX6JDG.js} +130 -58
  82. package/dist/{chunk-X547KNTP.js → chunk-S6KPLYLT.js} +3 -3
  83. package/dist/{chunk-RC6ULCQP.js → chunk-SW3KEFIA.js} +3 -3
  84. package/dist/{chunk-QI6BJJXM.cjs → chunk-U5B2JLNE.cjs} +3 -3
  85. package/dist/{chunk-CFKAKB2B.js → chunk-UNUFUTFQ.js} +2 -2
  86. package/dist/{chunk-3D5RJA7R.cjs → chunk-UOXJH4AR.cjs} +4 -4
  87. package/dist/{chunk-DQMG4XPX.js → chunk-VSIBZ7VH.js} +3 -3
  88. package/dist/{chunk-TALNKJQ2.js → chunk-WOE73NDO.js} +2 -2
  89. package/dist/{chunk-7RYLV5CM.cjs → chunk-XPFAAATJ.cjs} +133 -61
  90. package/dist/{chunk-INCTDROH.js → chunk-XX7YYKIJ.js} +1 -1
  91. package/dist/{chunk-RJCPXAZ3.js → chunk-XXCKQSWD.js} +1 -1
  92. package/dist/{chunk-SOAGRYM3.cjs → chunk-ZNSTIRSE.cjs} +4 -4
  93. package/dist/{chunk-SXT672KF.js → chunk-ZP4ROQEZ.js} +3 -3
  94. package/dist/index.cjs +60 -60
  95. package/dist/index.d.cts +1 -1
  96. package/dist/index.d.ts +1 -1
  97. package/dist/index.js +25 -25
  98. package/dist/styles.css +65 -0
  99. package/docs/llms/datepicker.md +26 -1
  100. package/docs/llms/datetimepicker.md +3 -1
  101. package/docs/llms/select.md +15 -1
  102. package/docs/llms/timepicker.md +3 -1
  103. package/docs/llms.md +1 -1
  104. package/package.json +1 -1
@@ -1,16 +1,72 @@
1
1
  import { Tag } from './chunk-OGMI3TO5.js';
2
- import { useFloating } from './chunk-3QXP2ZNP.js';
3
- import { useOverlayLayer } from './chunk-2A4GYSN4.js';
2
+ import { useFloating } from './chunk-NKIXCDZC.js';
3
+ import { useOverlayLayer } from './chunk-BZB45GGK.js';
4
4
  import { Icon, renderIconSlot } from './chunk-2BM65ITV.js';
5
5
  import { withComponentTheme, useComponentPortalTheme, InternalComponentThemePart } from './chunk-5HLNFDV4.js';
6
6
  import { usePortalContainer } from './chunk-CPVUDSIY.js';
7
7
  import './tokens-223RYVVS.css';
8
8
  import './shared-NJHRNLRH.css';
9
- import './Select-UTNBARSQ.css';
10
- import * as React from 'react';
9
+ import './Select-M3HCB3PW.css';
10
+ import * as React2 from 'react';
11
11
  import { createPortal } from 'react-dom';
12
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
13
 
14
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React2.useLayoutEffect : React2.useEffect;
15
+ function measureResponsiveTags(container) {
16
+ const availableWidth = container.getBoundingClientRect().width;
17
+ if (availableWidth <= 0) return void 0;
18
+ const tags = Array.from(container.querySelectorAll("[data-select-tag]"));
19
+ const overflows = Array.from(container.querySelectorAll("[data-select-overflow]"));
20
+ const search = container.querySelector(".select-search-measure");
21
+ const gap = parseFloat(getComputedStyle(container).columnGap) || 0;
22
+ const tagWidths = tags.map((tag) => tag.getBoundingClientRect().width);
23
+ const overflowWidths = [0, ...overflows.map((tag) => tag.getBoundingClientRect().width)];
24
+ const inputWidth = search ? Math.min(search.getBoundingClientRect().width, Math.max(
25
+ 0,
26
+ availableWidth - (overflowWidths[tags.length] ?? 0) - (tags.length > 0 ? gap : 0)
27
+ )) : 0;
28
+ let count = 0;
29
+ let prefixWidth = 0;
30
+ for (let index = 0; index <= tags.length; index += 1) {
31
+ const remaining = tags.length - index;
32
+ const itemCount = index + (remaining > 0 ? 1 : 0) + (search ? 1 : 0);
33
+ const width = prefixWidth + (overflowWidths[remaining] ?? 0) + inputWidth + Math.max(0, itemCount - 1) * gap;
34
+ if (width <= availableWidth) count = index;
35
+ prefixWidth += tagWidths[index] ?? 0;
36
+ }
37
+ return { count, inputWidth };
38
+ }
39
+ function useResponsiveTags(enabled, items, searchable) {
40
+ const tagsRef = React2.useRef(null);
41
+ const [layout, setLayout] = React2.useState({ count: 0, inputWidth: 0 });
42
+ const measure = React2.useCallback(() => {
43
+ if (!tagsRef.current) return;
44
+ const next = measureResponsiveTags(tagsRef.current);
45
+ if (next) setLayout((previous) => previous.count === next.count && previous.inputWidth === next.inputWidth ? previous : next);
46
+ }, []);
47
+ useIsomorphicLayoutEffect(() => {
48
+ if (enabled) measure();
49
+ });
50
+ useIsomorphicLayoutEffect(() => {
51
+ const container = tagsRef.current;
52
+ if (!enabled || !container) return;
53
+ let frame = 0;
54
+ const scheduleMeasure = () => {
55
+ cancelAnimationFrame(frame);
56
+ frame = requestAnimationFrame(measure);
57
+ };
58
+ const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(scheduleMeasure) : void 0;
59
+ observer?.observe(container);
60
+ container.querySelectorAll("[data-select-tag], [data-select-overflow], .select-search-measure").forEach((element) => observer?.observe(element));
61
+ window.addEventListener("resize", scheduleMeasure);
62
+ return () => {
63
+ observer?.disconnect();
64
+ window.removeEventListener("resize", scheduleMeasure);
65
+ cancelAnimationFrame(frame);
66
+ };
67
+ }, [enabled, items, searchable, measure]);
68
+ return { tagsRef, count: Math.min(layout.count, items.length), inputWidth: layout.inputWidth };
69
+ }
14
70
  var isGroup = (it) => Array.isArray(it.options);
15
71
  var flatten = (items) => items.flatMap((it) => isGroup(it) ? it.options : [it]);
16
72
  var prioritizePinnedGroups = (items) => {
@@ -89,21 +145,22 @@ var SelectInner = (props, forwardedRef) => {
89
145
  ...rest
90
146
  } = props;
91
147
  const isMulti = multiple === true;
148
+ const responsiveTags = isMulti && maxTagCount === "responsive";
92
149
  const mergedClearable = clearable ?? !!allowClear;
93
150
  const mergedClearIcon = typeof allowClear === "object" ? allowClear.clearIcon : void 0;
94
151
  const mergedSearchable = searchable ?? !!showSearch;
95
152
  const mergedListHeight = Number.isFinite(listHeight) && listHeight > 0 ? listHeight : 260;
96
153
  const mergedMenuClassName = [menuClassName, popupClassName, dropdownClassName].filter(Boolean).join(" ");
97
- const [innerSingle, setInnerSingle] = React.useState(
154
+ const [innerSingle, setInnerSingle] = React2.useState(
98
155
  !isMulti ? props.defaultValue : void 0
99
156
  );
100
- const [innerMulti, setInnerMulti] = React.useState(
157
+ const [innerMulti, setInnerMulti] = React2.useState(
101
158
  isMulti && Array.isArray(props.defaultValue) ? props.defaultValue : []
102
159
  );
103
- const [innerOpen, setInnerOpen] = React.useState(defaultOpen ?? false);
104
- const [innerSearchValue, setInnerSearchValue] = React.useState(defaultSearchValue ?? "");
105
- const [activeIdx, setActiveIdx] = React.useState(-1);
106
- const searchRef = React.useRef(null);
160
+ const [innerOpen, setInnerOpen] = React2.useState(defaultOpen ?? false);
161
+ const [innerSearchValue, setInnerSearchValue] = React2.useState(defaultSearchValue ?? "");
162
+ const [activeIdx, setActiveIdx] = React2.useState(-1);
163
+ const searchRef = React2.useRef(null);
107
164
  const portalContainer = usePortalContainer();
108
165
  const portalTheme = useComponentPortalTheme([
109
166
  "Select",
@@ -116,26 +173,26 @@ var SelectInner = (props, forwardedRef) => {
116
173
  (styleValue) => styleValue?.width != null || styleValue?.minWidth != null || styleValue?.maxWidth != null
117
174
  );
118
175
  const resolvedPopupWidth = popupStyle?.width ?? themedPopupStyle?.width;
119
- const listboxId = React.useId();
176
+ const listboxId = React2.useId();
120
177
  const openControlled = openProp !== void 0;
121
178
  const requestedOpen = openControlled ? openProp : innerOpen;
122
179
  const open = !disabled && requestedOpen;
123
- const requestedOpenRef = React.useRef(requestedOpen);
180
+ const requestedOpenRef = React2.useRef(requestedOpen);
124
181
  requestedOpenRef.current = requestedOpen;
125
182
  const searchControlled = searchValueProp !== void 0;
126
183
  const searchValue = searchControlled ? searchValueProp : innerSearchValue;
127
184
  const hasInlineSearch = mergedSearchable;
128
185
  const showsInlineSearchInput = hasInlineSearch && (isMulti || open);
129
- const updateSearchValue = React.useCallback((nextValue) => {
186
+ const updateSearchValue = React2.useCallback((nextValue) => {
130
187
  if (!searchControlled) setInnerSearchValue(nextValue);
131
188
  onSearch?.(nextValue);
132
189
  }, [onSearch, searchControlled]);
133
- const resetSearchValue = React.useCallback(() => {
190
+ const resetSearchValue = React2.useCallback(() => {
134
191
  if (!searchValue) return;
135
192
  if (!searchControlled) setInnerSearchValue("");
136
193
  onSearch?.("");
137
194
  }, [onSearch, searchControlled, searchValue]);
138
- const setOpen = React.useCallback((nextOpen) => {
195
+ const setOpen = React2.useCallback((nextOpen) => {
139
196
  if (disabled && nextOpen) return;
140
197
  if (nextOpen === requestedOpenRef.current) return;
141
198
  requestedOpenRef.current = nextOpen;
@@ -143,7 +200,7 @@ var SelectInner = (props, forwardedRef) => {
143
200
  onOpenChange?.(nextOpen);
144
201
  if (!nextOpen) resetSearchValue();
145
202
  }, [disabled, onOpenChange, openControlled, resetSearchValue]);
146
- React.useEffect(() => {
203
+ React2.useEffect(() => {
147
204
  if (!disabled || openControlled || !innerOpen) return;
148
205
  setInnerOpen(false);
149
206
  onOpenChange?.(false);
@@ -163,7 +220,7 @@ var SelectInner = (props, forwardedRef) => {
163
220
  onEscape: () => setOpen(false),
164
221
  restoreFocus: true
165
222
  });
166
- const setTriggerRef = React.useCallback(
223
+ const setTriggerRef = React2.useCallback(
167
224
  (node) => {
168
225
  triggerRef.current = node;
169
226
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -176,16 +233,16 @@ var SelectInner = (props, forwardedRef) => {
176
233
  const singleValue = singleControlled ? props.value : innerSingle;
177
234
  const controlledMultiValue = props.value;
178
235
  const multiValue = multiControlled ? Array.isArray(controlledMultiValue) ? controlledMultiValue : [] : innerMulti;
179
- const selectedValues = React.useMemo(
236
+ const selectedValues = React2.useMemo(
180
237
  () => isMulti ? multiValue : singleValue !== void 0 ? [singleValue] : [],
181
238
  [isMulti, multiValue, singleValue]
182
239
  );
183
240
  const selectionLimit = maxCount !== void 0 && Number.isFinite(maxCount) ? Math.max(0, Math.floor(maxCount)) : void 0;
184
- const isOptionDisabled = React.useCallback((option) => {
241
+ const isOptionDisabled = React2.useCallback((option) => {
185
242
  const selected = selectedValues.includes(option.value);
186
243
  return !!option.disabled || !!getOptionDisabled?.(option, selectedValues) || isMulti && !selected && selectionLimit !== void 0 && selectedValues.length >= selectionLimit;
187
244
  }, [getOptionDisabled, isMulti, selectedValues, selectionLimit]);
188
- React.useEffect(() => {
245
+ React2.useEffect(() => {
189
246
  if (!open) return;
190
247
  const h = (e) => {
191
248
  const t = e.target;
@@ -196,42 +253,43 @@ var SelectInner = (props, forwardedRef) => {
196
253
  document.addEventListener("mousedown", h);
197
254
  return () => document.removeEventListener("mousedown", h);
198
255
  }, [menuRef, open, setOpen, triggerRef]);
199
- React.useEffect(() => {
256
+ React2.useEffect(() => {
200
257
  if (open && mergedSearchable) {
201
258
  requestAnimationFrame(() => searchRef.current?.focus());
202
259
  }
203
260
  if (!open) setActiveIdx(-1);
204
261
  }, [open, mergedSearchable]);
205
- const orderedItems = React.useMemo(
262
+ const orderedItems = React2.useMemo(
206
263
  () => prioritizePinnedGroups(options),
207
264
  [options]
208
265
  );
209
- const allFlat = React.useMemo(() => flatten(orderedItems), [orderedItems]);
210
- const optionByValue = React.useMemo(() => {
266
+ const allFlat = React2.useMemo(() => flatten(orderedItems), [orderedItems]);
267
+ const optionByValue = React2.useMemo(() => {
211
268
  const index = /* @__PURE__ */ new Map();
212
269
  allFlat.forEach((option) => index.set(option.value, option));
213
270
  return index;
214
271
  }, [allFlat]);
215
- const selectedOptionCacheRef = React.useRef(/* @__PURE__ */ new Map());
216
- React.useEffect(() => {
272
+ const selectedOptionCacheRef = React2.useRef(/* @__PURE__ */ new Map());
273
+ React2.useEffect(() => {
217
274
  selectedValues.forEach((selectedValue) => {
218
275
  const option = optionByValue.get(selectedValue);
219
276
  if (option) selectedOptionCacheRef.current.set(selectedValue, option);
220
277
  });
221
278
  }, [optionByValue, selectedValues]);
222
- const selectedOptions = React.useMemo(
279
+ const selectedOptions = React2.useMemo(
223
280
  () => selectedValues.map(
224
281
  (selectedValue) => optionByValue.get(selectedValue) ?? selectedOptionCacheRef.current.get(selectedValue)
225
282
  ).filter((option) => option !== void 0),
226
283
  [optionByValue, selectedValues]
227
284
  );
228
- const filteredFlat = React.useMemo(() => {
285
+ const responsiveLayout = useResponsiveTags(responsiveTags, selectedOptions, hasInlineSearch);
286
+ const filteredFlat = React2.useMemo(() => {
229
287
  if (!searchValue.trim()) return allFlat;
230
288
  if (filterOption === false) return allFlat;
231
289
  const f = typeof filterOption === "function" ? filterOption : (input, option) => defaultFilter(input, option, optionFilterProp);
232
290
  return allFlat.filter((o) => f(searchValue, o));
233
291
  }, [allFlat, filterOption, optionFilterProp, searchValue]);
234
- const filteredItems = React.useMemo(() => {
292
+ const filteredItems = React2.useMemo(() => {
235
293
  if (!searchValue.trim()) {
236
294
  return orderedItems.filter((item) => !isGroup(item) || item.options.length > 0);
237
295
  }
@@ -243,7 +301,7 @@ var SelectInner = (props, forwardedRef) => {
243
301
  return kept.length ? { ...it, options: kept } : null;
244
302
  }).filter((x) => x !== null);
245
303
  }, [orderedItems, filteredFlat, searchValue]);
246
- React.useEffect(() => {
304
+ React2.useEffect(() => {
247
305
  setActiveIdx((current) => {
248
306
  if (current >= 0 && current < filteredFlat.length && !isOptionDisabled(filteredFlat[current])) {
249
307
  return current;
@@ -357,7 +415,7 @@ var SelectInner = (props, forwardedRef) => {
357
415
  "data-inline-size": multiHasSelection ? "content" : "fill",
358
416
  type: "search",
359
417
  value: searchValue,
360
- style: multiHasSelection ? { width: `${Math.min(Math.max(searchDisplayWidth + 1, 2), 32)}ch` } : void 0,
418
+ style: responsiveTags ? { width: responsiveLayout.inputWidth } : multiHasSelection ? { width: `${Math.min(Math.max(searchDisplayWidth + 1, 2), 32)}ch` } : void 0,
361
419
  placeholder: isMulti ? multiValue.length === 0 ? placeholder : void 0 : "\u641C\u7D22...",
362
420
  disabled,
363
421
  autoComplete: "off",
@@ -382,16 +440,21 @@ var SelectInner = (props, forwardedRef) => {
382
440
  const renderTrigger = () => {
383
441
  if (isMulti) {
384
442
  const selected = selectedOptions;
385
- const max = maxTagCount;
443
+ const max = typeof maxTagCount === "number" ? maxTagCount : void 0;
386
444
  const shown = max != null ? selected.slice(0, max) : selected;
387
- const overflow = selected.length - shown.length;
388
- if (selected.length === 0 && !hasInlineSearch) {
445
+ const overflow = selected.length - (responsiveTags ? responsiveLayout.count : shown.length);
446
+ if (selected.length === 0 && !hasInlineSearch && !responsiveTags) {
389
447
  return /* @__PURE__ */ jsx("span", { className: "placeholder", children: placeholder });
390
448
  }
391
- return /* @__PURE__ */ jsx(InternalComponentThemePart, { components: "Tag", children: /* @__PURE__ */ jsxs("span", { className: "select-tags", children: [
392
- shown.map((o) => /* @__PURE__ */ jsx(
449
+ return /* @__PURE__ */ jsx(InternalComponentThemePart, { components: "Tag", children: /* @__PURE__ */ jsxs("span", { className: "select-tags", ref: responsiveLayout.tagsRef, children: [
450
+ selected.length === 0 && !hasInlineSearch && /* @__PURE__ */ jsx("span", { className: "placeholder", children: placeholder }),
451
+ shown.map((o, index) => /* @__PURE__ */ jsx(
393
452
  Tag,
394
453
  {
454
+ "data-select-tag": responsiveTags ? "" : void 0,
455
+ "data-collapsed": responsiveTags && index >= responsiveLayout.count ? "true" : void 0,
456
+ "aria-hidden": responsiveTags && index >= responsiveLayout.count ? true : void 0,
457
+ ...responsiveTags && index >= responsiveLayout.count ? { inert: "" } : {},
395
458
  tone: "accent",
396
459
  removable: !disabled,
397
460
  onRemove: () => removeMultiValue(o.value),
@@ -408,7 +471,14 @@ var SelectInner = (props, forwardedRef) => {
408
471
  "+",
409
472
  overflow
410
473
  ] }),
411
- renderInlineSearchInput()
474
+ renderInlineSearchInput(),
475
+ responsiveTags && /* @__PURE__ */ jsxs("span", { className: "select-tag-measurements", "aria-hidden": "true", ...{ inert: "" }, children: [
476
+ selected.map((option, index) => /* @__PURE__ */ jsxs(Tag, { tone: "neutral", "data-select-overflow": "", children: [
477
+ "+",
478
+ index + 1
479
+ ] }, String(option.value))),
480
+ hasInlineSearch && /* @__PURE__ */ jsx("span", { className: "select-search-measure", children: searchValue || "\u200B" })
481
+ ] })
412
482
  ] }) });
413
483
  }
414
484
  if (showsInlineSearchInput) return renderInlineSearchInput();
@@ -424,6 +494,24 @@ var SelectInner = (props, forwardedRef) => {
424
494
  };
425
495
  const hasSelection = isMulti ? multiValue.length > 0 : singleValue != null;
426
496
  const showClear = mergedClearable && hasSelection && !disabled;
497
+ const renderClearButton = () => showClear && /* @__PURE__ */ jsx(
498
+ "button",
499
+ {
500
+ type: "button",
501
+ className: "select-clear",
502
+ "aria-label": "Clear",
503
+ onPointerDown: (event) => event.stopPropagation(),
504
+ onMouseDown: (event) => {
505
+ if (hasInlineSearch) event.preventDefault();
506
+ event.stopPropagation();
507
+ },
508
+ onClick: (event) => {
509
+ event.stopPropagation();
510
+ clearAll();
511
+ },
512
+ children: mergedClearIcon ?? /* @__PURE__ */ jsx(Icon, { name: "x", size: 12 })
513
+ }
514
+ );
427
515
  let renderIdx = -1;
428
516
  const renderOption = (o, groupPinned = false) => {
429
517
  renderIdx += 1;
@@ -483,7 +571,7 @@ var SelectInner = (props, forwardedRef) => {
483
571
  );
484
572
  };
485
573
  const renderMenuItems = (items) => items.map(
486
- (item, groupIndex) => isGroup(item) ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
574
+ (item, groupIndex) => isGroup(item) ? /* @__PURE__ */ jsxs(React2.Fragment, { children: [
487
575
  /* @__PURE__ */ jsx("div", { className: "menu-group-label", children: item.label }),
488
576
  item.options.map((option) => renderOption(option, !!item.pinned))
489
577
  ] }, `g-${groupIndex}-${item.pinned ? "pinned" : "regular"}`) : renderOption(item)
@@ -507,7 +595,7 @@ var SelectInner = (props, forwardedRef) => {
507
595
  {
508
596
  ref: setTriggerRef,
509
597
  ...rest,
510
- className: `select ${size} ${isMulti ? "multi" : ""} ${hasInlineSearch ? "searchable" : ""} ${open ? "open" : ""} ${disabled ? "disabled" : ""} ${invalid ? "invalid" : ""} ${className}`,
598
+ className: `select ${size} ${isMulti ? "multi" : ""} ${responsiveTags ? "responsive" : ""} ${hasInlineSearch ? "searchable" : ""} ${open ? "open" : ""} ${disabled ? "disabled" : ""} ${invalid ? "invalid" : ""} ${className}`,
511
599
  onKeyDown: (e) => {
512
600
  onRootKeyDown?.(e);
513
601
  const target = e.target;
@@ -554,28 +642,12 @@ var SelectInner = (props, forwardedRef) => {
554
642
  "aria-activedescendant": showsInlineSearchInput ? void 0 : open && activeIdx >= 0 ? `${listboxId}-option-${activeIdx}` : void 0,
555
643
  children: [
556
644
  renderTrigger(),
645
+ responsiveTags && renderClearButton(),
557
646
  /* @__PURE__ */ jsx(Icon, { name: "chevDown", size: 14, className: "select-caret" })
558
647
  ]
559
648
  }
560
649
  ),
561
- showClear && /* @__PURE__ */ jsx(
562
- "button",
563
- {
564
- type: "button",
565
- className: "select-clear",
566
- "aria-label": "Clear",
567
- onPointerDown: (event) => event.stopPropagation(),
568
- onMouseDown: (event) => {
569
- if (hasInlineSearch) event.preventDefault();
570
- event.stopPropagation();
571
- },
572
- onClick: (event) => {
573
- event.stopPropagation();
574
- clearAll();
575
- },
576
- children: mergedClearIcon ?? /* @__PURE__ */ jsx(Icon, { name: "x", size: 12 })
577
- }
578
- ),
650
+ !responsiveTags && renderClearButton(),
579
651
  open && portalContainer && createPortal(
580
652
  /* @__PURE__ */ jsx(
581
653
  "div",
@@ -614,7 +686,7 @@ var SelectInner = (props, forwardedRef) => {
614
686
  }
615
687
  );
616
688
  };
617
- var SelectBase = React.forwardRef(SelectInner);
689
+ var SelectBase = React2.forwardRef(SelectInner);
618
690
  SelectBase.displayName = "Select";
619
691
  var Select = withComponentTheme(
620
692
  SelectBase,
@@ -1,7 +1,7 @@
1
- import { Pagination } from './chunk-6MT3APJ3.js';
1
+ import { Pagination } from './chunk-6EHKQDMX.js';
2
2
  import { Checkbox } from './chunk-QSLXUNLM.js';
3
- import { useFloating } from './chunk-3QXP2ZNP.js';
4
- import { useOverlayLayer } from './chunk-2A4GYSN4.js';
3
+ import { useFloating } from './chunk-NKIXCDZC.js';
4
+ import { useOverlayLayer } from './chunk-BZB45GGK.js';
5
5
  import { Button, IconButton } from './chunk-563SQXH7.js';
6
6
  import { Icon } from './chunk-2BM65ITV.js';
7
7
  import { withComponentTheme, InternalComponentThemePart, useComponentPortalTheme } from './chunk-5HLNFDV4.js';
@@ -1,6 +1,6 @@
1
+ import { isRestoringOverlayFocus } from './chunk-BZB45GGK.js';
1
2
  import * as React from 'react';
2
3
 
3
- // src/utils/useInputTriggerToggle.ts
4
4
  function useInputTriggerToggle({
5
5
  open,
6
6
  disabled,
@@ -13,8 +13,8 @@ function useInputTriggerToggle({
13
13
  pointerDownOpenRef.current = open;
14
14
  focusOpenedRef.current = false;
15
15
  }, [open]);
16
- const handleFocus = React.useCallback(() => {
17
- if (disabled || readOnly || open) return;
16
+ const handleFocus = React.useCallback((event) => {
17
+ if (disabled || readOnly || open || isRestoringOverlayFocus(event.currentTarget)) return;
18
18
  focusOpenedRef.current = true;
19
19
  setOpen(true);
20
20
  }, [disabled, open, readOnly, setOpen]);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHSDMJUB6_cjs = require('./chunk-HSDMJUB6.cjs');
3
+ var chunkBN44QG2B_cjs = require('./chunk-BN44QG2B.cjs');
4
4
  var chunkV6BLBIY6_cjs = require('./chunk-V6BLBIY6.cjs');
5
5
  var chunkI4GJZLJU_cjs = require('./chunk-I4GJZLJU.cjs');
6
6
  require('./tokens-223RYVVS.css');
@@ -67,7 +67,7 @@ var ContextMenuBase = React__namespace.forwardRef((props, ref) => {
67
67
  const menuRef = React__namespace.useRef(null);
68
68
  const triggerRef = React__namespace.useRef(null);
69
69
  const returnFocusRef = React__namespace.useRef(null);
70
- const overlayZIndex = chunkHSDMJUB6_cjs.useOverlayZIndex(open);
70
+ const overlayZIndex = chunkBN44QG2B_cjs.useOverlayZIndex(open);
71
71
  const isSelectable = React__namespace.useCallback(
72
72
  (i) => i.type !== "divider" && !i.disabled,
73
73
  []
@@ -82,7 +82,7 @@ var ContextMenuBase = React__namespace.forwardRef((props, ref) => {
82
82
  React__namespace.useEffect(() => {
83
83
  if (disabled && open) closeAndRestoreFocus();
84
84
  }, [closeAndRestoreFocus, disabled, open]);
85
- chunkHSDMJUB6_cjs.useOverlayLayer({
85
+ chunkBN44QG2B_cjs.useOverlayLayer({
86
86
  open: open && portalContainer != null,
87
87
  containerRef: menuRef,
88
88
  ownerRef: triggerRef,
@@ -1,6 +1,6 @@
1
- import { useFloating } from './chunk-3QXP2ZNP.js';
1
+ import { useFloating } from './chunk-NKIXCDZC.js';
2
2
  import { Input } from './chunk-TUXF2G2O.js';
3
- import { useOverlayLayer } from './chunk-2A4GYSN4.js';
3
+ import { useOverlayLayer } from './chunk-BZB45GGK.js';
4
4
  import { Icon, renderIconSlot } from './chunk-2BM65ITV.js';
5
5
  import { useComponentPortalTheme, InternalComponentThemePart, withComponentTheme } from './chunk-5HLNFDV4.js';
6
6
  import { usePortalContainer } from './chunk-CPVUDSIY.js';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkFJB3243S_cjs = require('./chunk-FJB3243S.cjs');
4
- var chunkHSDMJUB6_cjs = require('./chunk-HSDMJUB6.cjs');
3
+ var chunk6A5KEWVU_cjs = require('./chunk-6A5KEWVU.cjs');
4
+ var chunkBN44QG2B_cjs = require('./chunk-BN44QG2B.cjs');
5
5
  var chunkVDVKY2IX_cjs = require('./chunk-VDVKY2IX.cjs');
6
6
  var chunkV6BLBIY6_cjs = require('./chunk-V6BLBIY6.cjs');
7
7
  var chunkI4GJZLJU_cjs = require('./chunk-I4GJZLJU.cjs');
@@ -113,14 +113,14 @@ var EllipsisTooltip = React__namespace.forwardRef(({ content, children }, forwar
113
113
  floatingStyle,
114
114
  placement,
115
115
  zIndex: tooltipZIndex
116
- } = chunkFJB3243S_cjs.useFloating({
116
+ } = chunk6A5KEWVU_cjs.useFloating({
117
117
  open,
118
118
  placement: "top",
119
119
  panelWidth: 360,
120
120
  panelHeight: 96,
121
121
  alignCross: "center"
122
122
  });
123
- chunkHSDMJUB6_cjs.useOverlayLayer({
123
+ chunkBN44QG2B_cjs.useOverlayLayer({
124
124
  open: open && portalContainer != null,
125
125
  containerRef: floatingRef,
126
126
  ownerRef: triggerRef,
@@ -1,7 +1,7 @@
1
- import { useInputTriggerToggle } from './chunk-RC6ULCQP.js';
2
- import { useFloating } from './chunk-3QXP2ZNP.js';
1
+ import { useInputTriggerToggle } from './chunk-SW3KEFIA.js';
2
+ import { useFloating } from './chunk-NKIXCDZC.js';
3
3
  import { Input } from './chunk-TUXF2G2O.js';
4
- import { useOverlayLayer } from './chunk-2A4GYSN4.js';
4
+ import { useOverlayLayer } from './chunk-BZB45GGK.js';
5
5
  import { Button } from './chunk-563SQXH7.js';
6
6
  import { Calendar } from './chunk-TY5LOU3A.js';
7
7
  import { useComponentPortalTheme, InternalComponentThemePart, withComponentTheme } from './chunk-5HLNFDV4.js';
@@ -1,5 +1,5 @@
1
- import { useFloating } from './chunk-3QXP2ZNP.js';
2
- import { useOverlayLayer } from './chunk-2A4GYSN4.js';
1
+ import { useFloating } from './chunk-NKIXCDZC.js';
2
+ import { useOverlayLayer } from './chunk-BZB45GGK.js';
3
3
  import { useComponentPortalTheme, withComponentTheme } from './chunk-5HLNFDV4.js';
4
4
  import { usePortalContainer } from './chunk-CPVUDSIY.js';
5
5
  import './tokens-223RYVVS.css';