@dinofront/design_system 1.4.1 → 1.6.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.
@@ -0,0 +1,10 @@
1
+ import { TranslationLocale } from '../../types';
2
+ interface SelectV2Translations {
3
+ placeholder: string;
4
+ noResults: string;
5
+ loadingMessage: string;
6
+ selectAllLabel: (count: number) => string;
7
+ createLabel: (value: string) => string;
8
+ }
9
+ export declare const SELECT_V2_TRANSLATIONS: Record<TranslationLocale, SelectV2Translations>;
10
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { BaseProps, OptionValue } from '../../types';
2
+ import { GroupBase, Props as ReactSelectProps } from 'react-select';
3
+ import { BaseProps, OptionValue, TranslationLocale } from '../../types';
3
4
  export type SelectV2Size = 'sm' | 'md' | 'lg';
4
5
  export interface SelectV2Option {
5
6
  value: OptionValue;
@@ -12,7 +13,11 @@ export interface SelectV2Option {
12
13
  /** Group heading this option belongs under. */
13
14
  group?: string;
14
15
  }
15
- export interface SelectV2BaseProps extends BaseProps {
16
+ /** react-select props SelectV2 already computes/owns internally and can't be
17
+ * overridden through passthrough without breaking its own logic. */
18
+ type OwnedReactSelectProps = 'aria-invalid' | 'aria-required' | 'className' | 'classNames' | 'components' | 'formatOptionLabel' | 'getOptionLabel' | 'getOptionValue' | 'id' | 'inputId' | 'inputValue' | 'isClearable' | 'isDisabled' | 'isLoading' | 'isMulti' | 'isOptionDisabled' | 'isSearchable' | 'loadingMessage' | 'noOptionsMessage' | 'onChange' | 'onInputChange' | 'options' | 'placeholder' | 'required' | 'unstyled' | 'value';
19
+ export type SelectV2ReactSelectProps = Omit<ReactSelectProps<SelectV2Option, boolean, GroupBase<SelectV2Option>>, OwnedReactSelectProps>;
20
+ export interface SelectV2BaseProps extends BaseProps, Partial<SelectV2ReactSelectProps> {
16
21
  /** Static option list, matching `Select`'s required `options` prop. Pass
17
22
  * `[]` when `loadOptions` drives the list instead. */
18
23
  options: SelectV2Option[];
@@ -56,6 +61,11 @@ export interface SelectV2BaseProps extends BaseProps {
56
61
  virtualized?: boolean;
57
62
  /** Shown when the list is empty (no matches, or nothing loaded yet). Defaults to `'No results'`. */
58
63
  emptyText?: string;
64
+ /** Language for built-in strings ("Select all", "No results", the async
65
+ * loading message, and the default create-option label). Explicit
66
+ * `placeholder`/`emptyText`/`formatCreateLabel` props still take
67
+ * precedence over the translated defaults. Default `'en-US'`. */
68
+ locale?: TranslationLocale;
59
69
  id?: string;
60
70
  className?: string;
61
71
  wrapperClassName?: string;
@@ -70,4 +80,8 @@ export type SelectV2Props = (SelectV2BaseProps & {
70
80
  value?: OptionValue[];
71
81
  defaultValue?: OptionValue[];
72
82
  onChange?: (values: OptionValue[]) => void;
83
+ /** Keeps selected chips on a single line instead of wrapping, collapsing
84
+ * whatever doesn't fit into a trailing "+N" badge. Default `false`. */
85
+ singleLine?: boolean;
73
86
  });
87
+ export {};
@@ -0,0 +1,21 @@
1
+ import { RefObject } from 'react';
2
+ interface UseVisibleTagCountOptions {
3
+ /** Element to search within for the live value-container node
4
+ * (marked with `.sv2-value-container`). */
5
+ wrapperRef: RefObject<HTMLElement | null>;
6
+ /** Hidden row rendering one measuring chip per selected option plus a
7
+ * measuring badge, mirroring the real chip/badge markup exactly. */
8
+ measureRef: RefObject<HTMLElement | null>;
9
+ total: number;
10
+ /** Joined label text — changes whenever the rendered chip content would
11
+ * change, so a recompute is triggered even if `total` stays the same. */
12
+ labelsKey: string;
13
+ enabled: boolean;
14
+ }
15
+ /** Computes how many multi-value chips fit on one line of the live control,
16
+ * reserving room for a trailing "+N" badge, by measuring a hidden mirror
17
+ * row against the real value-container's content-box width. Recomputes on
18
+ * container resize and whenever the selection changes. Returns `undefined`
19
+ * when disabled, meaning "show every chip" (default, unrestricted). */
20
+ export declare function useVisibleTagCount({ wrapperRef, measureRef, total, labelsKey, enabled, }: UseVisibleTagCountOptions): number | undefined;
21
+ export {};
@@ -30,6 +30,7 @@ export interface TableV2RowAction<TData> {
30
30
  destructive?: boolean;
31
31
  disabled?: (row: TData) => boolean;
32
32
  }
33
+ export type { Column, ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnResizeMode, OnChangeFn, PaginationState, Row, RowSelectionState, SortingState, VisibilityState, } from '@tanstack/react-table';
33
34
  export interface TableV2Props<TData, TValue = unknown> extends BaseProps {
34
35
  data: TData[];
35
36
  columns: ColumnDef<TData, TValue>[];
@@ -6,4 +6,4 @@ export { TableV2ColumnVisibilityMenu } from './TableV2ColumnVisibility';
6
6
  export { TableV2Toolbar } from './TableV2Toolbar';
7
7
  export { TableV2Pagination } from './TableV2Pagination';
8
8
  export { TableV2Skeleton } from './TableV2Skeleton';
9
- export type { TableV2Align, TableV2Density, TableV2FilterOption, TableV2FilterVariant, TableV2Props, TableV2RowAction, } from './TableV2.types';
9
+ export type { TableV2Align, TableV2Density, TableV2FilterOption, TableV2FilterVariant, TableV2Props, TableV2RowAction, Column, ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnResizeMode, OnChangeFn, PaginationState, Row, RowSelectionState, SortingState, VisibilityState, } from './TableV2.types';