twico-ui 1.22.3 → 1.23.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.
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1597,6 +1597,10 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
1597
1597
|
virtualized?: boolean;
|
|
1598
1598
|
/** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
|
|
1599
1599
|
overscan?: number;
|
|
1600
|
+
/** Let long option labels/descriptions wrap onto multiple lines instead of truncating to one line with an
|
|
1601
|
+
* ellipsis — useful when options share a long prefix and differ only in a truncated tail. Takes precedence
|
|
1602
|
+
* over `virtualized` (wrapped rows aren't a fixed height). @default false */
|
|
1603
|
+
wrapOptions?: boolean;
|
|
1600
1604
|
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
1601
1605
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
1602
1606
|
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1597,6 +1597,10 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
1597
1597
|
virtualized?: boolean;
|
|
1598
1598
|
/** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
|
|
1599
1599
|
overscan?: number;
|
|
1600
|
+
/** Let long option labels/descriptions wrap onto multiple lines instead of truncating to one line with an
|
|
1601
|
+
* ellipsis — useful when options share a long prefix and differ only in a truncated tail. Takes precedence
|
|
1602
|
+
* over `virtualized` (wrapped rows aren't a fixed height). @default false */
|
|
1603
|
+
wrapOptions?: boolean;
|
|
1600
1604
|
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
1601
1605
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
1602
1606
|
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
package/dist/index.mjs
CHANGED
|
@@ -5650,6 +5650,10 @@ var COMBO_CSS = `
|
|
|
5650
5650
|
.twc-opt__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
|
|
5651
5651
|
.twc-opt__label { line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
5652
5652
|
.twc-opt__desc { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
5653
|
+
/* #300: wrapOptions \u2014 let long labels/descriptions wrap onto multiple lines instead of truncating.
|
|
5654
|
+
overflow-wrap: anywhere also breaks a single very long token so it can't overflow the popover edge. */
|
|
5655
|
+
.twc-opt[data-wrap="true"] { align-items: flex-start; }
|
|
5656
|
+
.twc-opt[data-wrap="true"] .twc-opt__label, .twc-opt[data-wrap="true"] .twc-opt__desc { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
|
|
5653
5657
|
.twc-opt__check { flex: none; color: var(--color-primary); display: inline-flex; }
|
|
5654
5658
|
.twc-opt__check svg { width: 16px; height: 16px; }
|
|
5655
5659
|
.twc-pop__empty { padding: 14px 12px; text-align: center; font-size: var(--text-sm); color: var(--color-text-subtle); }
|
|
@@ -5710,8 +5714,9 @@ function Combobox({
|
|
|
5710
5714
|
loading = false,
|
|
5711
5715
|
emptyText = "No results found",
|
|
5712
5716
|
name,
|
|
5713
|
-
virtualized = false,
|
|
5717
|
+
virtualized: virtualizedProp = false,
|
|
5714
5718
|
overscan = 8,
|
|
5719
|
+
wrapOptions = false,
|
|
5715
5720
|
id,
|
|
5716
5721
|
className = "",
|
|
5717
5722
|
onFocus,
|
|
@@ -5719,6 +5724,8 @@ function Combobox({
|
|
|
5719
5724
|
...rest
|
|
5720
5725
|
}) {
|
|
5721
5726
|
const __twcStyles = useScopedStyles("twc-combo-styles", COMBO_CSS);
|
|
5727
|
+
if (virtualizedProp && wrapOptions) warnOnce("combobox-wrap-virtualized", "twico-ui Combobox: `wrapOptions` disables `virtualized` \u2014 wrapped option rows aren't a fixed height.");
|
|
5728
|
+
const virtualized = virtualizedProp && !wrapOptions;
|
|
5722
5729
|
const groups = React51__default.useMemo(() => normalizeGroups(options), [options]);
|
|
5723
5730
|
const flat = React51__default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
|
|
5724
5731
|
const autoId = React51__default.useId();
|
|
@@ -5905,6 +5912,7 @@ function Combobox({
|
|
|
5905
5912
|
"data-disabled": o.disabled || void 0,
|
|
5906
5913
|
"data-selected": isSel || void 0,
|
|
5907
5914
|
"data-active": idx === active || void 0,
|
|
5915
|
+
"data-wrap": wrapOptions || void 0,
|
|
5908
5916
|
onMouseEnter: () => {
|
|
5909
5917
|
if (!o.disabled) setActive(idx);
|
|
5910
5918
|
},
|