@dinofront/design_system 1.2.0 → 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.
- package/dist/components/Accordion/Accordion.types.d.ts +7 -7
- package/dist/components/DatePicker/DatePicker.types.d.ts +12 -0
- package/dist/components/FormField/FormField.types.d.ts +8 -1
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +8 -6
- package/dist/components/Radio/Radio.types.d.ts +14 -6
- package/dist/components/Radio/index.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +22 -5
- package/dist/components/Tabs/Tabs.types.d.ts +7 -7
- package/dist/components/Upload/Upload.types.d.ts +5 -1
- package/dist/hooks/useOnOutsideClick.d.ts +1 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1204 -1070
- package/dist/index.js.map +1 -1
- package/dist/lib/optionValue.d.ts +10 -0
- package/dist/styles.css +20 -0
- package/dist/types/base.d.ts +8 -0
- package/package.json +1 -1
|
@@ -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
|
|
8
|
-
defaultValue?:
|
|
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?:
|
|
11
|
-
onValueChange?: (value:
|
|
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:
|
|
20
|
+
value: OptionValue;
|
|
21
21
|
title: ReactNode;
|
|
22
22
|
icon?: ReactNode;
|
|
23
23
|
disabled?: boolean;
|
|
@@ -18,6 +18,18 @@ export interface DatePickerProps extends BaseProps {
|
|
|
18
18
|
/** Fill the parent's width (like Input/Select) instead of the intrinsic
|
|
19
19
|
* min-width. Use inside form grids so dates line up with other fields. */
|
|
20
20
|
fullWidth?: boolean;
|
|
21
|
+
/** Disable the trigger entirely — blocks both mouse and keyboard activation. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Earliest selectable day, inclusive. Earlier days render disabled. Time-of-day is ignored. */
|
|
24
|
+
minDate?: Date;
|
|
25
|
+
/** Latest selectable day, inclusive. Later days render disabled. Time-of-day is ignored. */
|
|
26
|
+
maxDate?: Date;
|
|
27
|
+
/** Individual days that can't be picked. Matched by calendar day; time-of-day is ignored. */
|
|
28
|
+
excludeDates?: Date[];
|
|
29
|
+
/** Switch the trigger to the danger border/ring styles. */
|
|
30
|
+
error?: boolean;
|
|
31
|
+
/** Message rendered below the control; also switches the trigger to the danger styles. */
|
|
32
|
+
errorText?: ReactNode;
|
|
21
33
|
id?: string;
|
|
22
34
|
className?: string;
|
|
23
35
|
wrapperClassName?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactElement } from 'react';
|
|
2
|
-
import { RefCallBack } from 'react-hook-form';
|
|
2
|
+
import { RefCallBack, SetValueConfig } from 'react-hook-form';
|
|
3
3
|
import { BaseProps } from '../../types';
|
|
4
4
|
/** Deliberately untyped `value`/`onChange`: this render prop feeds whichever
|
|
5
5
|
* input the consumer wires up (native `value`, Select's `string`, Checkbox's
|
|
@@ -13,6 +13,13 @@ export interface FormFieldRenderProps {
|
|
|
13
13
|
error: boolean;
|
|
14
14
|
errorText?: string;
|
|
15
15
|
dataTestId?: string;
|
|
16
|
+
/** Imperatively set this field's value, pre-bound to this FormField's
|
|
17
|
+
* `name` — for a component whose own change contract doesn't fit RHF's
|
|
18
|
+
* field bindings. Defaults `shouldValidate`/`shouldDirty`/`shouldTouch`
|
|
19
|
+
* to `true`, overridable via `options`. */
|
|
20
|
+
setFieldValue: (value: unknown, options?: SetValueConfig) => void;
|
|
21
|
+
/** True once the field has been touched, changed from its default value, and currently passes validation. */
|
|
22
|
+
isValid: boolean;
|
|
16
23
|
}
|
|
17
24
|
export interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'>, BaseProps {
|
|
18
25
|
name: string;
|
|
@@ -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:
|
|
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:
|
|
20
|
-
onChange: (values:
|
|
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:
|
|
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?:
|
|
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,19 +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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
value?: RadioValue;
|
|
15
|
+
defaultValue?: RadioValue;
|
|
16
|
+
onChange?: (value: RadioValue) => void;
|
|
9
17
|
disabled?: boolean;
|
|
10
18
|
size?: RadioSize;
|
|
11
19
|
orientation?: 'horizontal' | 'vertical';
|
|
12
20
|
children: ReactNode;
|
|
13
21
|
className?: string;
|
|
14
22
|
}
|
|
15
|
-
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'name' | 'onChange'>, BaseProps {
|
|
16
|
-
value:
|
|
23
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'name' | 'onChange' | 'value'>, BaseProps {
|
|
24
|
+
value: RadioValue;
|
|
17
25
|
size?: RadioSize;
|
|
18
26
|
label?: ReactNode;
|
|
19
27
|
description?: ReactNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Radio, RadioGroup } from './Radio';
|
|
2
|
-
export type {
|
|
2
|
+
export type { RadioGroupProps, RadioProps, RadioSize, RadioValue } from './Radio.types';
|
|
@@ -1,16 +1,23 @@
|
|
|
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:
|
|
5
|
+
value: OptionValue;
|
|
6
6
|
label: ReactNode;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
/** Group heading this option belongs under. Options sharing a group MUST be
|
|
9
|
+
* contiguous in the `options` array — the heading is emitted whenever this
|
|
10
|
+
* value changes between consecutive options, so a non-contiguous group
|
|
11
|
+
* renders its heading more than once. */
|
|
12
|
+
group?: string;
|
|
13
|
+
/** Text used for `searchable` matching when `label` isn't a plain string. */
|
|
14
|
+
searchText?: string;
|
|
8
15
|
}
|
|
9
16
|
export interface SelectProps extends BaseProps {
|
|
10
17
|
options: SelectOption[];
|
|
11
|
-
value?:
|
|
12
|
-
defaultValue?:
|
|
13
|
-
onChange?: (value:
|
|
18
|
+
value?: OptionValue;
|
|
19
|
+
defaultValue?: OptionValue;
|
|
20
|
+
onChange?: (value: OptionValue) => void;
|
|
14
21
|
placeholder?: string;
|
|
15
22
|
label?: ReactNode;
|
|
16
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. */
|
|
@@ -20,6 +27,16 @@ export interface SelectProps extends BaseProps {
|
|
|
20
27
|
error?: boolean;
|
|
21
28
|
size?: SelectSize;
|
|
22
29
|
disabled?: boolean;
|
|
30
|
+
/** Renders a red asterisk next to the label and sets `aria-required` on the trigger. */
|
|
31
|
+
required?: boolean;
|
|
32
|
+
/** Shows a spinner in place of the chevron and blocks opening the list. Does not set the native `disabled` attribute. */
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
/** Renders a text filter pinned above the open list. */
|
|
35
|
+
searchable?: boolean;
|
|
36
|
+
/** Placeholder for the `searchable` filter input. Defaults to `'Search…'`. */
|
|
37
|
+
searchPlaceholder?: string;
|
|
38
|
+
/** Shown in place of the list when the filter matches nothing. Defaults to `'No results'`. */
|
|
39
|
+
emptyText?: string;
|
|
23
40
|
id?: string;
|
|
24
41
|
className?: string;
|
|
25
42
|
wrapperClassName?: string;
|
|
@@ -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?:
|
|
8
|
+
defaultValue?: OptionValue;
|
|
9
9
|
/** Controlled active tab value. Pass alongside `onValueChange` to fully control which tab is active. */
|
|
10
|
-
value?:
|
|
11
|
-
onValueChange?: (value:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
}
|
|
@@ -6,7 +6,7 @@ export interface UploadRejection {
|
|
|
6
6
|
file: File;
|
|
7
7
|
reason: UploadRejectionReason;
|
|
8
8
|
}
|
|
9
|
-
export interface UploadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop' | 'onDragEnter' | 'onDragOver' | 'onDragLeave' | 'onKeyDown' | 'role' | 'tabIndex' | 'aria-disabled'>, BaseProps {
|
|
9
|
+
export interface UploadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop' | 'onDragEnter' | 'onDragOver' | 'onDragLeave' | 'onKeyDown' | 'role' | 'tabIndex' | 'aria-disabled' | 'aria-invalid'>, BaseProps {
|
|
10
10
|
/** Forwarded to the hidden native `<input type="file">`, e.g. `"image/png,image/jpeg"`. */
|
|
11
11
|
accept?: string;
|
|
12
12
|
multiple?: boolean;
|
|
@@ -35,6 +35,10 @@ export interface UploadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCli
|
|
|
35
35
|
triggerIcon?: ReactNode;
|
|
36
36
|
label?: ReactNode;
|
|
37
37
|
required?: boolean;
|
|
38
|
+
/** Switches the dropzone (or, in `button`/`icon` mode, just the message below) to the danger styles. */
|
|
39
|
+
error?: boolean;
|
|
40
|
+
/** Message rendered below the control; also switches dropzone mode to the danger styles. */
|
|
41
|
+
errorText?: ReactNode;
|
|
38
42
|
/** Content rendered on the label row, right of the label text and required marker — e.g. an info tooltip trigger. */
|
|
39
43
|
labelAddons?: ReactNode;
|
|
40
44
|
}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
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