twico-ui 1.29.0 → 1.31.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/dist/index.d.cts CHANGED
@@ -1536,6 +1536,10 @@ interface Option {
1536
1536
  label: string;
1537
1537
  /** Optional second line shown under the label. */
1538
1538
  description?: string;
1539
+ /** #326: leading icon/swatch node, rendered before the label (mirrors a Command item's icon). */
1540
+ icon?: React.ReactNode;
1541
+ /** #326: trailing hint node, right-aligned after the label (e.g. a code, shortcut, or badge). */
1542
+ hint?: React.ReactNode;
1539
1543
  /** Disable this option — not selectable, skipped by keyboard navigation. */
1540
1544
  disabled?: boolean;
1541
1545
  }
@@ -1601,6 +1605,10 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
1601
1605
  * ellipsis — useful when options share a long prefix and differ only in a truncated tail. Takes precedence
1602
1606
  * over `virtualized` (wrapped rows aren't a fixed height). @default false */
1603
1607
  wrapOptions?: boolean;
1608
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
1609
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
1610
+ * (custom rows aren't a fixed height). */
1611
+ renderOption?: (option: ComboboxOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
1604
1612
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
1605
1613
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
1606
1614
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -1814,6 +1822,15 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1814
1822
  quickFilter?: string;
1815
1823
  /** Fires with the new quick-search string as the user types (and when a host sets it). */
1816
1824
  onQuickFilterChange?: (value: string) => void;
1825
+ /** #330: how the filter clauses combine — `"and"` (all must match) or `"or"` (any). A single, set-wide
1826
+ * connective (matching MUI DataGrid's `logicOperator`), surfaced as the per-row And/Or connector in the
1827
+ * Filters panel and included as `filterLogic` in the `onServerChange` query. Pass this (with
1828
+ * `onFilterLogicChange`) to control it; omit for uncontrolled (seeded by `defaultFilterLogic`). */
1829
+ filterLogic?: "and" | "or";
1830
+ /** #330: initial And/Or connective when `filterLogic` is uncontrolled. @default "and" */
1831
+ defaultFilterLogic?: "and" | "or";
1832
+ /** #330: fires with the new connective (`"and"` | `"or"`) when the user changes the per-row And/Or select. */
1833
+ onFilterLogicChange?: (logic: "and" | "or") => void;
1817
1834
  /** Custom node rendered in a **leading slot** of the toolbar row, before the built-in Columns/Filters
1818
1835
  * cluster (#286) — for host controls like an "Add row" button or bulk actions. Mirrors `CardGrid`'s
1819
1836
  * `toolbar` prop, so no internal-class/absolute-position hacks are needed. */
@@ -2704,6 +2721,10 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
2704
2721
  virtualized?: boolean;
2705
2722
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
2706
2723
  overscan?: number;
2724
+ /** #326: render a custom option row body (twico keeps the checkbox, keyboard nav, and ARIA wiring). For
2725
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
2726
+ * (custom rows aren't a fixed height). */
2727
+ renderOption?: (option: MultiSelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
2707
2728
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
2708
2729
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
2709
2730
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -3011,6 +3032,10 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
3011
3032
  rightAddon?: React.ReactNode;
3012
3033
  /** With `maxLength`, render a live `current / max` character counter on the hint/error line; danger-toned near the limit. @default false */
3013
3034
  showCount?: boolean;
3035
+ /** #328: show a trailing clear (X) button when the field is non-empty; clicking it empties the field and
3036
+ * fires `onChange` with the empty value (controlled callers update). Composes with `rightIcon` and, for
3037
+ * `type="password"`, sits alongside the reveal-eye toggle. @default false */
3038
+ clearable?: boolean;
3014
3039
  }
3015
3040
 
3016
3041
  declare function Input(props: InputProps): React.JSX.Element;
@@ -3383,6 +3408,10 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
3383
3408
  virtualized?: boolean;
3384
3409
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
3385
3410
  overscan?: number;
3411
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
3412
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
3413
+ * (custom rows aren't a fixed height). */
3414
+ renderOption?: (option: SelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
3386
3415
  }
3387
3416
 
3388
3417
  /** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
@@ -3761,6 +3790,9 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
3761
3790
  maxRows?: number;
3762
3791
  /** With `maxLength`, render a live `current / max` character counter; danger-toned near the limit. @default false */
3763
3792
  showCount?: boolean;
3793
+ /** #328: show a trailing clear (X) button (top-inline-end, clear of the resize handle) when non-empty;
3794
+ * clicking it empties the field and fires `onChange` with the empty value. @default false */
3795
+ clearable?: boolean;
3764
3796
  }
3765
3797
 
3766
3798
  /** Forwards `ref` to the inner `<textarea>`. */
package/dist/index.d.ts CHANGED
@@ -1536,6 +1536,10 @@ interface Option {
1536
1536
  label: string;
1537
1537
  /** Optional second line shown under the label. */
1538
1538
  description?: string;
1539
+ /** #326: leading icon/swatch node, rendered before the label (mirrors a Command item's icon). */
1540
+ icon?: React.ReactNode;
1541
+ /** #326: trailing hint node, right-aligned after the label (e.g. a code, shortcut, or badge). */
1542
+ hint?: React.ReactNode;
1539
1543
  /** Disable this option — not selectable, skipped by keyboard navigation. */
1540
1544
  disabled?: boolean;
1541
1545
  }
@@ -1601,6 +1605,10 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
1601
1605
  * ellipsis — useful when options share a long prefix and differ only in a truncated tail. Takes precedence
1602
1606
  * over `virtualized` (wrapped rows aren't a fixed height). @default false */
1603
1607
  wrapOptions?: boolean;
1608
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
1609
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
1610
+ * (custom rows aren't a fixed height). */
1611
+ renderOption?: (option: ComboboxOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
1604
1612
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
1605
1613
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
1606
1614
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -1814,6 +1822,15 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1814
1822
  quickFilter?: string;
1815
1823
  /** Fires with the new quick-search string as the user types (and when a host sets it). */
1816
1824
  onQuickFilterChange?: (value: string) => void;
1825
+ /** #330: how the filter clauses combine — `"and"` (all must match) or `"or"` (any). A single, set-wide
1826
+ * connective (matching MUI DataGrid's `logicOperator`), surfaced as the per-row And/Or connector in the
1827
+ * Filters panel and included as `filterLogic` in the `onServerChange` query. Pass this (with
1828
+ * `onFilterLogicChange`) to control it; omit for uncontrolled (seeded by `defaultFilterLogic`). */
1829
+ filterLogic?: "and" | "or";
1830
+ /** #330: initial And/Or connective when `filterLogic` is uncontrolled. @default "and" */
1831
+ defaultFilterLogic?: "and" | "or";
1832
+ /** #330: fires with the new connective (`"and"` | `"or"`) when the user changes the per-row And/Or select. */
1833
+ onFilterLogicChange?: (logic: "and" | "or") => void;
1817
1834
  /** Custom node rendered in a **leading slot** of the toolbar row, before the built-in Columns/Filters
1818
1835
  * cluster (#286) — for host controls like an "Add row" button or bulk actions. Mirrors `CardGrid`'s
1819
1836
  * `toolbar` prop, so no internal-class/absolute-position hacks are needed. */
@@ -2704,6 +2721,10 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
2704
2721
  virtualized?: boolean;
2705
2722
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
2706
2723
  overscan?: number;
2724
+ /** #326: render a custom option row body (twico keeps the checkbox, keyboard nav, and ARIA wiring). For
2725
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
2726
+ * (custom rows aren't a fixed height). */
2727
+ renderOption?: (option: MultiSelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
2707
2728
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
2708
2729
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
2709
2730
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -3011,6 +3032,10 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
3011
3032
  rightAddon?: React.ReactNode;
3012
3033
  /** With `maxLength`, render a live `current / max` character counter on the hint/error line; danger-toned near the limit. @default false */
3013
3034
  showCount?: boolean;
3035
+ /** #328: show a trailing clear (X) button when the field is non-empty; clicking it empties the field and
3036
+ * fires `onChange` with the empty value (controlled callers update). Composes with `rightIcon` and, for
3037
+ * `type="password"`, sits alongside the reveal-eye toggle. @default false */
3038
+ clearable?: boolean;
3014
3039
  }
3015
3040
 
3016
3041
  declare function Input(props: InputProps): React.JSX.Element;
@@ -3383,6 +3408,10 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
3383
3408
  virtualized?: boolean;
3384
3409
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
3385
3410
  overscan?: number;
3411
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
3412
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
3413
+ * (custom rows aren't a fixed height). */
3414
+ renderOption?: (option: SelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
3386
3415
  }
3387
3416
 
3388
3417
  /** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
@@ -3761,6 +3790,9 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
3761
3790
  maxRows?: number;
3762
3791
  /** With `maxLength`, render a live `current / max` character counter; danger-toned near the limit. @default false */
3763
3792
  showCount?: boolean;
3793
+ /** #328: show a trailing clear (X) button (top-inline-end, clear of the resize handle) when non-empty;
3794
+ * clicking it empties the field and fires `onChange` with the empty value. @default false */
3795
+ clearable?: boolean;
3764
3796
  }
3765
3797
 
3766
3798
  /** Forwards `ref` to the inner `<textarea>`. */