twico-ui 1.28.0 → 1.30.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. */
@@ -1949,6 +1957,13 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1949
1957
  selectionMode?: "none" | "row" | "cell";
1950
1958
  /** Fired when a row is clicked in "row" selection mode: (row, key). */
1951
1959
  onRowClick?: (row: T, key: string | number) => void;
1960
+ /** #324: controlled highlighted row key for `selectionMode="row"`. When provided, the grid highlights THIS
1961
+ * row (not its internal state) and reports clicks via `onRowClick` so you update the prop — the same
1962
+ * controlled/uncontrolled split as `page`. Pass `null` to clear. Lets an external selection (a graph, a
1963
+ * master/detail pane) drive the row highlight, with scroll-into-view. */
1964
+ activeRowId?: string | number | null;
1965
+ /** #324: scroll the controlled active row into view when `activeRowId` changes. @default true */
1966
+ scrollActiveRowIntoView?: boolean;
1952
1967
  /** Fired when a cell is clicked in "cell" selection mode: (value, row, field). */
1953
1968
  onCellClick?: (value: any, row: T, field: string) => void;
1954
1969
  /** Fired when the active cell changes: ({ key, field } | null). */
@@ -2697,6 +2712,10 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
2697
2712
  virtualized?: boolean;
2698
2713
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
2699
2714
  overscan?: number;
2715
+ /** #326: render a custom option row body (twico keeps the checkbox, keyboard nav, and ARIA wiring). For
2716
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
2717
+ * (custom rows aren't a fixed height). */
2718
+ renderOption?: (option: MultiSelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
2700
2719
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
2701
2720
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
2702
2721
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -3004,6 +3023,10 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
3004
3023
  rightAddon?: React.ReactNode;
3005
3024
  /** With `maxLength`, render a live `current / max` character counter on the hint/error line; danger-toned near the limit. @default false */
3006
3025
  showCount?: boolean;
3026
+ /** #328: show a trailing clear (X) button when the field is non-empty; clicking it empties the field and
3027
+ * fires `onChange` with the empty value (controlled callers update). Composes with `rightIcon` and, for
3028
+ * `type="password"`, sits alongside the reveal-eye toggle. @default false */
3029
+ clearable?: boolean;
3007
3030
  }
3008
3031
 
3009
3032
  declare function Input(props: InputProps): React.JSX.Element;
@@ -3376,6 +3399,10 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
3376
3399
  virtualized?: boolean;
3377
3400
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
3378
3401
  overscan?: number;
3402
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
3403
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
3404
+ * (custom rows aren't a fixed height). */
3405
+ renderOption?: (option: SelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
3379
3406
  }
3380
3407
 
3381
3408
  /** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
@@ -3754,6 +3781,9 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
3754
3781
  maxRows?: number;
3755
3782
  /** With `maxLength`, render a live `current / max` character counter; danger-toned near the limit. @default false */
3756
3783
  showCount?: boolean;
3784
+ /** #328: show a trailing clear (X) button (top-inline-end, clear of the resize handle) when non-empty;
3785
+ * clicking it empties the field and fires `onChange` with the empty value. @default false */
3786
+ clearable?: boolean;
3757
3787
  }
3758
3788
 
3759
3789
  /** 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. */
@@ -1949,6 +1957,13 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1949
1957
  selectionMode?: "none" | "row" | "cell";
1950
1958
  /** Fired when a row is clicked in "row" selection mode: (row, key). */
1951
1959
  onRowClick?: (row: T, key: string | number) => void;
1960
+ /** #324: controlled highlighted row key for `selectionMode="row"`. When provided, the grid highlights THIS
1961
+ * row (not its internal state) and reports clicks via `onRowClick` so you update the prop — the same
1962
+ * controlled/uncontrolled split as `page`. Pass `null` to clear. Lets an external selection (a graph, a
1963
+ * master/detail pane) drive the row highlight, with scroll-into-view. */
1964
+ activeRowId?: string | number | null;
1965
+ /** #324: scroll the controlled active row into view when `activeRowId` changes. @default true */
1966
+ scrollActiveRowIntoView?: boolean;
1952
1967
  /** Fired when a cell is clicked in "cell" selection mode: (value, row, field). */
1953
1968
  onCellClick?: (value: any, row: T, field: string) => void;
1954
1969
  /** Fired when the active cell changes: ({ key, field } | null). */
@@ -2697,6 +2712,10 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
2697
2712
  virtualized?: boolean;
2698
2713
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
2699
2714
  overscan?: number;
2715
+ /** #326: render a custom option row body (twico keeps the checkbox, keyboard nav, and ARIA wiring). For
2716
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
2717
+ * (custom rows aren't a fixed height). */
2718
+ renderOption?: (option: MultiSelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
2700
2719
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
2701
2720
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
2702
2721
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -3004,6 +3023,10 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
3004
3023
  rightAddon?: React.ReactNode;
3005
3024
  /** With `maxLength`, render a live `current / max` character counter on the hint/error line; danger-toned near the limit. @default false */
3006
3025
  showCount?: boolean;
3026
+ /** #328: show a trailing clear (X) button when the field is non-empty; clicking it empties the field and
3027
+ * fires `onChange` with the empty value (controlled callers update). Composes with `rightIcon` and, for
3028
+ * `type="password"`, sits alongside the reveal-eye toggle. @default false */
3029
+ clearable?: boolean;
3007
3030
  }
3008
3031
 
3009
3032
  declare function Input(props: InputProps): React.JSX.Element;
@@ -3376,6 +3399,10 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
3376
3399
  virtualized?: boolean;
3377
3400
  /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
3378
3401
  overscan?: number;
3402
+ /** #326: render a custom option row body (twico keeps the checkmark, keyboard nav, and ARIA wiring). For
3403
+ * lightweight cases prefer the additive `icon`/`hint` fields on an option instead. Disables `virtualized`
3404
+ * (custom rows aren't a fixed height). */
3405
+ renderOption?: (option: SelectOption, state: { selected: boolean; active: boolean }) => React.ReactNode;
3379
3406
  }
3380
3407
 
3381
3408
  /** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
@@ -3754,6 +3781,9 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
3754
3781
  maxRows?: number;
3755
3782
  /** With `maxLength`, render a live `current / max` character counter; danger-toned near the limit. @default false */
3756
3783
  showCount?: boolean;
3784
+ /** #328: show a trailing clear (X) button (top-inline-end, clear of the resize handle) when non-empty;
3785
+ * clicking it empties the field and fires `onChange` with the empty value. @default false */
3786
+ clearable?: boolean;
3757
3787
  }
3758
3788
 
3759
3789
  /** Forwards `ref` to the inner `<textarea>`. */