@dinofront/design_system 1.2.1 → 1.2.2

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.
@@ -1,14 +1,14 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- import { BaseProps } from '../../types';
2
+ import { BaseProps, OptionValue } from '../../types';
3
3
  export type AccordionType = 'single' | 'multiple';
4
- export interface AccordionProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
4
+ export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'>, BaseProps {
5
5
  /** `'single'` keeps at most one item open at a time; `'multiple'` allows any number. */
6
6
  type?: AccordionType;
7
- /** Uncontrolled initial open value(s) — a single string for `'single'`, an array for `'multiple'`. */
8
- defaultValue?: string | string[];
7
+ /** Uncontrolled initial open value(s) — a single value for `'single'`, an array for `'multiple'`. */
8
+ defaultValue?: OptionValue | OptionValue[];
9
9
  /** Controlled open value(s). Pass alongside `onValueChange` to fully control which item(s) are open. */
10
- value?: string | string[];
11
- onValueChange?: (value: string | string[]) => void;
10
+ value?: OptionValue | OptionValue[];
11
+ onValueChange?: (value: OptionValue | OptionValue[] | undefined) => void;
12
12
  /** Animates each panel open/closed. Set `false` for the pre-1.x instant toggle (also restores the plain `hidden` attribute instead of the animated grid wrapper). */
13
13
  animated?: boolean;
14
14
  /** Renders a Divider between each item's header and its panel content. */
@@ -17,7 +17,7 @@ export interface AccordionProps extends HTMLAttributes<HTMLDivElement>, BaseProp
17
17
  }
18
18
  export interface AccordionItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, BaseProps {
19
19
  /** Unique identifier used to track open/closed state within the parent `Accordion`. */
20
- value: string;
20
+ value: OptionValue;
21
21
  title: ReactNode;
22
22
  icon?: ReactNode;
23
23
  disabled?: boolean;
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { BaseProps } from '../../types';
2
+ import { BaseProps, OptionValue } from '../../types';
3
3
  export type MultiSelectSize = 'sm' | 'md' | 'lg';
4
4
  export interface MultiSelectOption {
5
- value: string;
5
+ value: OptionValue;
6
6
  label: string;
7
7
  /** Optional second line under the label in the dropdown. */
8
8
  description?: string;
@@ -16,12 +16,12 @@ export interface MultiSelectOption {
16
16
  export interface MultiSelectProps extends BaseProps {
17
17
  options: MultiSelectOption[];
18
18
  /** Selected option values (controlled). */
19
- value: string[];
20
- onChange: (values: string[]) => void;
19
+ value: OptionValue[];
20
+ onChange: (values: OptionValue[]) => void;
21
21
  /** Called with the option that was just added, alongside `onChange` (never instead of it). */
22
22
  onAdd?: (option: MultiSelectOption) => void;
23
23
  /** Called with the value that was just removed, alongside `onChange` (never instead of it). */
24
- onRemove?: (value: string) => void;
24
+ onRemove?: (value: OptionValue) => void;
25
25
  size?: MultiSelectSize;
26
26
  placeholder?: string;
27
27
  /** Placeholder once at least one chip exists. Defaults to "Add another…". */
@@ -35,7 +35,7 @@ export interface MultiSelectProps extends BaseProps {
35
35
  errorText?: ReactNode;
36
36
  required?: boolean;
37
37
  /** Values whose chips can't be removed. */
38
- lockedValues?: string[];
38
+ lockedValues?: OptionValue[];
39
39
  /** Cap on how many can be selected (default: unlimited). */
40
40
  max?: number;
41
41
  /** Renders an Avatar on every chip and dropdown row, falling back to initials derived from the option's `label` when it has no `avatarSrc`. Default `false` — avatars still render for options that already set `avatarSrc` regardless. */
@@ -49,4 +49,6 @@ export interface MultiSelectProps extends BaseProps {
49
49
  id?: string;
50
50
  className?: string;
51
51
  wrapperClassName?: string;
52
+ isLoading?: boolean;
53
+ language?: string;
52
54
  }
@@ -1,20 +1,27 @@
1
1
  import { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
- import { BaseProps } from '../../types';
2
+ import { BaseProps, OptionValue } from '../../types';
3
3
  export type RadioSize = 'md' | 'sm';
4
+ /**
5
+ * A Radio's identity — commonly a string, but numbers and booleans (for
6
+ * yes/no groups) are supported too. Note: like `OptionValue`, values are
7
+ * compared via `String(...)`, so `true` and `'true'` (or `1` and `'1'`) are
8
+ * treated as the same option — don't mix representations within one group.
9
+ */
10
+ export type RadioValue = OptionValue | boolean;
4
11
  export interface RadioGroupProps extends BaseProps {
5
12
  name?: string;
6
13
  label?: ReactNode;
7
- value?: string;
8
- defaultValue?: string;
9
- onChange?: (value: string) => void;
14
+ value?: RadioValue;
15
+ defaultValue?: RadioValue;
16
+ onChange?: (value: RadioValue) => void;
10
17
  disabled?: boolean;
11
18
  size?: RadioSize;
12
19
  orientation?: 'horizontal' | 'vertical';
13
20
  children: ReactNode;
14
21
  className?: string;
15
22
  }
16
- export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'name' | 'onChange'>, BaseProps {
17
- value: string;
23
+ export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'name' | 'onChange' | 'value'>, BaseProps {
24
+ value: RadioValue;
18
25
  size?: RadioSize;
19
26
  label?: ReactNode;
20
27
  description?: ReactNode;
@@ -1,2 +1,2 @@
1
1
  export { Radio, RadioGroup } from './Radio';
2
- export type { RadioProps, RadioGroupProps, RadioSize } from './Radio.types';
2
+ export type { RadioGroupProps, RadioProps, RadioSize, RadioValue } from './Radio.types';
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { BaseProps } from '../../types';
2
+ import { BaseProps, OptionValue } from '../../types';
3
3
  export type SelectSize = 'lg' | 'md' | 'sm';
4
4
  export interface SelectOption {
5
- value: string;
5
+ value: OptionValue;
6
6
  label: ReactNode;
7
7
  disabled?: boolean;
8
8
  /** Group heading this option belongs under. Options sharing a group MUST be
@@ -15,9 +15,9 @@ export interface SelectOption {
15
15
  }
16
16
  export interface SelectProps extends BaseProps {
17
17
  options: SelectOption[];
18
- value?: string;
19
- defaultValue?: string;
20
- onChange?: (value: string) => void;
18
+ value?: OptionValue;
19
+ defaultValue?: OptionValue;
20
+ onChange?: (value: OptionValue) => void;
21
21
  placeholder?: string;
22
22
  label?: ReactNode;
23
23
  /** Content rendered on the label row, right of the label text — e.g. an info tooltip trigger. Rendered as a sibling of the `<label>`, not a child, so an interactive addon never steals focus into the trigger. */
@@ -1,14 +1,14 @@
1
1
  import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
- import { BaseProps } from '../../types';
2
+ import { BaseProps, OptionValue } from '../../types';
3
3
  import { BadgeProps } from '../Badge';
4
4
  export type TabsVariant = 'underline' | 'pills' | 'boxed';
5
5
  export type TabsSize = 'lg' | 'md' | 'sm';
6
6
  export interface TabsProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
7
7
  /** Uncontrolled initial active tab value. Falls back to the first `<Tab>`'s value if omitted. */
8
- defaultValue?: string;
8
+ defaultValue?: OptionValue;
9
9
  /** Controlled active tab value. Pass alongside `onValueChange` to fully control which tab is active. */
10
- value?: string;
11
- onValueChange?: (value: string) => void;
10
+ value?: OptionValue;
11
+ onValueChange?: (value: OptionValue) => void;
12
12
  variant?: TabsVariant;
13
13
  size?: TabsSize;
14
14
  /** Disables every tab in the bar at once. OR'd with each `Tab`'s own `disabled`. */
@@ -20,7 +20,7 @@ export interface TabListProps extends HTMLAttributes<HTMLDivElement>, BaseProps
20
20
  }
21
21
  export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement>, BaseProps {
22
22
  /** Unique identifier matched against the parent `Tabs`'s active value. */
23
- value: string;
23
+ value: OptionValue;
24
24
  icon?: ReactNode;
25
25
  /** Count/indicator rendered after the label. Hidden when `undefined`, `null`, or `false`. */
26
26
  badge?: ReactNode;
@@ -29,13 +29,13 @@ export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement>, BaseP
29
29
  /** Trailing icon rendered as its own button — e.g. a close-tab X. Rendered as a sibling of the tab button, not a nested one (nesting a button inside a button is invalid HTML). */
30
30
  rightIcon?: ReactNode;
31
31
  /** Called with this tab's `value` when `rightIcon` is clicked. Does not activate the tab. */
32
- onRightIconClick?: (value: string) => void;
32
+ onRightIconClick?: (value: OptionValue) => void;
33
33
  /** Accessible name for the `rightIcon` button. Required when `rightIcon` is set. */
34
34
  rightIconLabel?: string;
35
35
  }
36
36
  export interface TabPanelProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
37
37
  /** Matched against the parent `Tabs`'s active value; hidden (or unmounted, depending on `keepMounted`) when not active. */
38
- value: string;
38
+ value: OptionValue;
39
39
  /** Keeps the panel mounted (hidden via the `hidden` attribute) while inactive, instead of unmounting it — preserves scroll position and in-panel state across tab switches. */
40
40
  keepMounted?: boolean;
41
41
  }
@@ -1,6 +1 @@
1
- import { RefObject } from 'react';
2
- /** Fires `handler` on any `mousedown`/`touchstart` outside `ref.current`.
3
- * No effect while `ref.current` is null or `enabled` is false — callers
4
- * don't need to guard call sites where the ref isn't attached yet (e.g.
5
- * before a portal mounts). */
6
- export declare function useOnOutsideClick(ref: RefObject<HTMLElement | null> | null | undefined, handler: (event: MouseEvent | TouchEvent) => void, enabled?: boolean): void;
1
+ export declare const useOnOutsideClick: (ref: HTMLElement | null, callback: (event: MouseEvent) => void, state: boolean, uid: string, shouldRemoveCallback?: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -51,3 +51,4 @@ export { cn } from './lib/cn';
51
51
  export * from './hooks';
52
52
  export * from './tokens';
53
53
  export * from './types';
54
+ export { useFieldArray } from 'react-hook-form';