@diceui/tags-input 0.7.2 → 1.0.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,137 @@
1
+
2
+ import { Direction, Primitive } from "@diceui/shared";
3
+ import * as React from "react";
4
+ //#region src/tags-input-clear.d.ts
5
+ interface TagsInputClearProps extends React.ComponentPropsWithoutRef<typeof Primitive.button> {
6
+ /**
7
+ * Whether the clear button should always be rendered.
8
+ *
9
+ * Can be used to animate the enter and exit of the clear button.
10
+ * @default false
11
+ */
12
+ forceMount?: boolean;
13
+ }
14
+ declare const TagsInputClear: React.ForwardRefExoticComponent<TagsInputClearProps & React.RefAttributes<HTMLButtonElement>>;
15
+ declare const Clear: React.ForwardRefExoticComponent<TagsInputClearProps & React.RefAttributes<HTMLButtonElement>>;
16
+ //#endregion
17
+ //#region src/tags-input-input.d.ts
18
+ interface TagsInputInputProps extends React.ComponentPropsWithoutRef<typeof Primitive.input> {}
19
+ declare const TagsInputInput: React.ForwardRefExoticComponent<TagsInputInputProps & React.RefAttributes<HTMLInputElement>>;
20
+ declare const Input: React.ForwardRefExoticComponent<TagsInputInputProps & React.RefAttributes<HTMLInputElement>>;
21
+ //#endregion
22
+ //#region src/tags-input-root.d.ts
23
+ type InputValue = string;
24
+ interface TagsInputRootProps<T = InputValue> extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.div>, "value" | "defaultValue" | "onValueChange" | "onInvalid" | "children"> {
25
+ /** Controlled array of tag values. */
26
+ value?: T[];
27
+ /** Initial array of tag values when uncontrolled. */
28
+ defaultValue?: T[];
29
+ /** Callback function to handle changes in the tag values. */
30
+ onValueChange?: (value: T[]) => void;
31
+ /** Callback function to validate tags before they're added. */
32
+ onValidate?: (value: T) => boolean;
33
+ /** Callback function to handle invalid input. */
34
+ onInvalid?: (value: T) => void;
35
+ /** Function to convert a tag value to its display string representation. */
36
+ displayValue?: (value: T) => string;
37
+ /**
38
+ * Enable adding tags by pasting text, which will be split by the delimiter.
39
+ * @default false
40
+ */
41
+ addOnPaste?: boolean;
42
+ /**
43
+ * Enable adding tags when Tab key is pressed.
44
+ * @default false
45
+ */
46
+ addOnTab?: boolean;
47
+ /**
48
+ * Disables the entire tags input.
49
+ * @default false
50
+ */
51
+ disabled?: boolean;
52
+ /**
53
+ * Allow editing of existing tags
54
+ * @default false
55
+ */
56
+ editable?: boolean;
57
+ /**
58
+ * Enable wrapping focus from last to first tag and vice versa.
59
+ * @default false
60
+ */
61
+ loop?: boolean;
62
+ /**
63
+ * Behavior when the input loses focus.
64
+ * - "add": Add the current input value as a new tag.
65
+ * - "clear": Reset the input field, removing its value.
66
+ * By default, the input value will stay in the input field.
67
+ * Can be overridden by the preventDefault() call in the input's onBlur handler.
68
+ */
69
+ blurBehavior?: "add" | "clear";
70
+ /**
71
+ * Character used to split pasted text into multiple tags.
72
+ * @default ","
73
+ */
74
+ delimiter?: string;
75
+ /**
76
+ * Maximum number of tags allowed.
77
+ * @default Number.POSITIVE_INFINITY
78
+ */
79
+ max?: number;
80
+ /**
81
+ * Whether the field is required in a form context.
82
+ * @default false
83
+ */
84
+ required?: boolean;
85
+ /**
86
+ * Whether the tags input is read-only.
87
+ * @default false
88
+ */
89
+ readOnly?: boolean;
90
+ /**
91
+ * The content of the tags input.
92
+ *
93
+ * Can be a React node or a function that receives the current value as an argument.
94
+ * @default undefined
95
+ */
96
+ children?: React.ReactNode | ((context: {
97
+ value: InputValue[];
98
+ }) => React.ReactNode);
99
+ /**
100
+ * The reading direction of the tags input.
101
+ * @default "ltr"
102
+ */
103
+ dir?: Direction;
104
+ /** Name of the form field when used in a form. */
105
+ name?: string;
106
+ /** Unique identifier for the tags input. */
107
+ id?: string;
108
+ }
109
+ declare const TagsInputRoot: React.ForwardRefExoticComponent<TagsInputRootProps<string> & React.RefAttributes<HTMLDivElement>>;
110
+ declare const Root: React.ForwardRefExoticComponent<TagsInputRootProps<string> & React.RefAttributes<HTMLDivElement>>;
111
+ //#endregion
112
+ //#region src/tags-input-item.d.ts
113
+ interface TagsInputItemProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {
114
+ /** The value of the item. */
115
+ value: InputValue;
116
+ /** Whether the item is disabled. */
117
+ disabled?: boolean;
118
+ }
119
+ declare const TagsInputItem: React.ForwardRefExoticComponent<TagsInputItemProps & React.RefAttributes<HTMLDivElement>>;
120
+ declare const Item: React.ForwardRefExoticComponent<TagsInputItemProps & React.RefAttributes<HTMLDivElement>>;
121
+ //#endregion
122
+ //#region src/tags-input-item-delete.d.ts
123
+ interface TagsInputItemDeleteProps extends React.ComponentPropsWithoutRef<typeof Primitive.button> {}
124
+ declare const TagsInputItemDelete: React.ForwardRefExoticComponent<TagsInputItemDeleteProps & React.RefAttributes<HTMLButtonElement>>;
125
+ declare const ItemDelete: React.ForwardRefExoticComponent<TagsInputItemDeleteProps & React.RefAttributes<HTMLButtonElement>>;
126
+ //#endregion
127
+ //#region src/tags-input-item-text.d.ts
128
+ interface TagsInputItemTextProps extends React.ComponentPropsWithoutRef<typeof Primitive.span> {}
129
+ declare const TagsInputItemText: React.ForwardRefExoticComponent<TagsInputItemTextProps & React.RefAttributes<HTMLSpanElement>>;
130
+ declare const ItemText: React.ForwardRefExoticComponent<TagsInputItemTextProps & React.RefAttributes<HTMLSpanElement>>;
131
+ //#endregion
132
+ //#region src/tags-input-label.d.ts
133
+ interface TagsInputLabelProps extends React.ComponentPropsWithoutRef<typeof Primitive.label> {}
134
+ declare const TagsInputLabel: React.ForwardRefExoticComponent<TagsInputLabelProps & React.RefAttributes<HTMLLabelElement>>;
135
+ declare const Label: React.ForwardRefExoticComponent<TagsInputLabelProps & React.RefAttributes<HTMLLabelElement>>;
136
+ //#endregion
137
+ export { Clear, Input, Item, ItemDelete, ItemText, Label, Root, TagsInputClear, type TagsInputClearProps, TagsInputInput, type TagsInputInputProps, TagsInputItem, TagsInputItemDelete, type TagsInputItemDeleteProps, type TagsInputItemProps, TagsInputItemText, type TagsInputItemTextProps, TagsInputLabel, type TagsInputLabelProps, TagsInputRoot, type TagsInputRootProps };