@flowtomic/ui 0.1.2 → 0.1.5
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/blocks/developer-panel/page.d.ts.map +1 -1
- package/dist/blocks/developer-panel/page.js +2 -2
- package/dist/components/atoms/actions/badge/badge.d.ts +1 -1
- package/dist/components/atoms/actions/button/button.d.ts +2 -2
- package/dist/components/atoms/animation/encrypted-text/encrypted-text.d.ts +57 -0
- package/dist/components/atoms/animation/encrypted-text/encrypted-text.d.ts.map +1 -0
- package/dist/components/atoms/animation/encrypted-text/encrypted-text.js +104 -0
- package/dist/components/atoms/animation/encrypted-text/index.d.ts +3 -0
- package/dist/components/atoms/animation/encrypted-text/index.d.ts.map +1 -0
- package/dist/components/atoms/animation/encrypted-text/index.js +1 -0
- package/dist/components/atoms/animation/index.d.ts +2 -0
- package/dist/components/atoms/animation/index.d.ts.map +1 -1
- package/dist/components/atoms/animation/index.js +1 -0
- package/dist/components/atoms/data-display/index.d.ts +2 -0
- package/dist/components/atoms/data-display/index.d.ts.map +1 -1
- package/dist/components/atoms/data-display/index.js +1 -0
- package/dist/components/atoms/data-display/qr-code/index.d.ts +3 -0
- package/dist/components/atoms/data-display/qr-code/index.d.ts.map +1 -0
- package/dist/components/atoms/data-display/qr-code/index.js +1 -0
- package/dist/components/atoms/data-display/qr-code/qr-code.d.ts +18 -0
- package/dist/components/atoms/data-display/qr-code/qr-code.d.ts.map +1 -0
- package/dist/components/atoms/data-display/qr-code/qr-code.js +79 -0
- package/dist/components/atoms/feedback/tooltip/index.d.ts +1 -1
- package/dist/components/atoms/feedback/tooltip/index.d.ts.map +1 -1
- package/dist/components/atoms/feedback/tooltip/index.js +1 -1
- package/dist/components/atoms/feedback/tooltip/tooltip.d.ts +42 -5
- package/dist/components/atoms/feedback/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/atoms/feedback/tooltip/tooltip.js +188 -5
- package/dist/components/atoms/forms/autocomplete/autocomplete-context.d.ts +29 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-context.d.ts.map +1 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-context.js +10 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-item.d.ts +16 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-item.d.ts.map +1 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-item.js +48 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-section.d.ts +14 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-section.d.ts.map +1 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete-section.js +13 -0
- package/dist/components/atoms/forms/autocomplete/autocomplete.d.ts +13 -9
- package/dist/components/atoms/forms/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/atoms/forms/autocomplete/autocomplete.js +295 -87
- package/dist/components/atoms/forms/autocomplete/index.d.ts +6 -0
- package/dist/components/atoms/forms/autocomplete/index.d.ts.map +1 -1
- package/dist/components/atoms/forms/autocomplete/index.js +3 -0
- package/dist/components/atoms/forms/index.d.ts +0 -2
- package/dist/components/atoms/forms/index.d.ts.map +1 -1
- package/dist/components/atoms/forms/index.js +0 -1
- package/dist/components/atoms/forms/input/input.d.ts +1 -1
- package/dist/components/atoms/forms/toggle/toggle.d.ts +1 -1
- package/dist/components/atoms/layout/sidebar/sidebar.d.ts +1 -1
- package/dist/components/atoms/navigation/command/command.d.ts +13 -13
- package/dist/components/atoms/navigation/tabs/tabs.js +2 -2
- package/dist/components/molecules/auth/auth-navigation-link/auth-navigation-link.d.ts +1 -11
- package/dist/components/molecules/auth/auth-navigation-link/auth-navigation-link.d.ts.map +1 -1
- package/dist/components/molecules/auth/auth-navigation-link/auth-navigation-link.js +2 -3
- package/dist/components/molecules/forms/autocomplete/autocomplete-context.d.ts +16 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-context.d.ts.map +1 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-context.js +14 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-item.d.ts +23 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-item.d.ts.map +1 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-item.js +29 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-section.d.ts +19 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-section.d.ts.map +1 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-section.js +13 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete.d.ts +33 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete.js +101 -0
- package/dist/components/molecules/forms/autocomplete/index.d.ts +9 -0
- package/dist/components/molecules/forms/autocomplete/index.d.ts.map +1 -0
- package/dist/components/molecules/forms/autocomplete/index.js +4 -0
- package/dist/components/molecules/forms/item/item.d.ts +1 -1
- package/dist/components/molecules/forms/text-editor/index.d.ts +3 -0
- package/dist/components/molecules/forms/text-editor/index.d.ts.map +1 -0
- package/dist/components/molecules/forms/text-editor/index.js +1 -0
- package/dist/components/molecules/forms/text-editor/text-editor.d.ts +33 -0
- package/dist/components/molecules/forms/text-editor/text-editor.d.ts.map +1 -0
- package/dist/components/molecules/forms/text-editor/text-editor.js +211 -0
- package/dist/components/molecules/index.d.ts +4 -2
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/index.js +2 -1
- package/dist/components/molecules/navigation/menu-dock/menu-dock.d.ts +5 -0
- package/dist/components/molecules/navigation/menu-dock/menu-dock.d.ts.map +1 -1
- package/dist/components/molecules/navigation/menu-dock/menu-dock.js +103 -10
- package/dist/components/molecules/typography/index.d.ts +0 -2
- package/dist/components/molecules/typography/index.d.ts.map +1 -1
- package/dist/components/molecules/typography/index.js +1 -1
- package/dist/components/organisms/context/context.d.ts +4 -4
- package/dist/components/organisms/document-editor/document-editor.d.ts +43 -0
- package/dist/components/organisms/document-editor/document-editor.d.ts.map +1 -0
- package/dist/components/organisms/document-editor/document-editor.js +144 -0
- package/dist/components/organisms/document-editor/index.d.ts +3 -0
- package/dist/components/organisms/document-editor/index.d.ts.map +1 -0
- package/dist/components/organisms/document-editor/index.js +1 -0
- package/dist/components/organisms/form-layout/form-layout.d.ts +111 -0
- package/dist/components/organisms/form-layout/form-layout.d.ts.map +1 -0
- package/dist/components/organisms/form-layout/form-layout.js +83 -0
- package/dist/components/organisms/form-layout/index.d.ts +2 -0
- package/dist/components/organisms/form-layout/index.d.ts.map +1 -0
- package/dist/components/organisms/form-layout/index.js +1 -0
- package/dist/components/organisms/index.d.ts +4 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/organisms/index.js +2 -0
- package/dist/components/organisms/model-selector/model-selector.d.ts +1 -1
- package/dist/index.js +623 -526
- package/dist/styles/globals.css +489 -0
- package/dist/styles/theme.css +1364 -0
- package/dist/styles/typography.css +430 -0
- package/package.json +45 -18
|
@@ -1,119 +1,327 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
-
import {
|
|
3
|
+
import { useComboBox } from "@react-aria/combobox";
|
|
4
|
+
import { useListBox } from "@react-aria/listbox";
|
|
5
|
+
import { usePopover } from "@react-aria/overlays";
|
|
6
|
+
import { useComboBoxState } from "@react-stately/combobox";
|
|
7
|
+
import { useListState } from "@react-stately/list";
|
|
8
|
+
import { ChevronDownIcon, XIcon } from "lucide-react";
|
|
4
9
|
import * as React from "react";
|
|
5
10
|
import { cn } from "@/lib/utils";
|
|
6
11
|
import { inputVariants } from "../input/input";
|
|
12
|
+
import { AutocompleteContext, useAutocompleteContext, } from "./autocomplete-context";
|
|
13
|
+
import { AutocompleteItem } from "./autocomplete-item";
|
|
7
14
|
function defaultFilter(option, searchTerm) {
|
|
8
15
|
return option.label.toLowerCase().includes(searchTerm.toLowerCase());
|
|
9
16
|
}
|
|
10
|
-
const
|
|
11
|
-
const [open, setOpen] = React.useState(false);
|
|
12
|
-
const [inputValue, setInputValue] = React.useState(controlledValue || defaultValue || "");
|
|
13
|
-
const [selectedValue, setSelectedValue] = React.useState(controlledValue || defaultValue);
|
|
17
|
+
const AutocompleteRoot = React.forwardRef(({ options = [], value: controlledValue, defaultValue, onValueChange, placeholder = "Selecione uma opção...", disabled = false, size = "default", className, inputClassName, emptyMessage = "Nenhum resultado encontrado.", filterFunction = defaultFilter, allowCustomValue = false, isLoading = false, maxListboxHeight = "300px", children, id, ...props }, ref) => {
|
|
14
18
|
const isControlled = controlledValue !== undefined;
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
//
|
|
18
|
-
React.useEffect(() => {
|
|
19
|
-
if (isControlled) {
|
|
20
|
-
setInputValue(controlledValue || "");
|
|
21
|
-
}
|
|
22
|
-
}, [controlledValue, isControlled]);
|
|
19
|
+
const [selectedKey, setSelectedKey] = React.useState(controlledValue || defaultValue || null);
|
|
20
|
+
const [inputValue, setInputValue] = React.useState("");
|
|
21
|
+
// Filtrar opções baseado no inputValue
|
|
23
22
|
const filteredOptions = React.useMemo(() => {
|
|
24
|
-
if (!
|
|
23
|
+
if (!inputValue.trim()) {
|
|
25
24
|
return options;
|
|
26
25
|
}
|
|
27
|
-
return options.filter((option) => filterFunction(option,
|
|
28
|
-
}, [options,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
else {
|
|
43
|
-
// Se não permite valor customizado, limpa a seleção se não encontrar match exato
|
|
44
|
-
const matchingOption = options.find((opt) => opt.label === newValue);
|
|
45
|
-
if (matchingOption) {
|
|
46
|
-
setSelectedValue(matchingOption.value);
|
|
47
|
-
onValueChange?.(matchingOption.value);
|
|
26
|
+
return options.filter((option) => filterFunction(option, inputValue));
|
|
27
|
+
}, [options, inputValue, filterFunction]);
|
|
28
|
+
// Determinar se deve usar composição ou API antiga
|
|
29
|
+
const useComposition = React.useMemo(() => {
|
|
30
|
+
return children !== undefined;
|
|
31
|
+
}, [children]);
|
|
32
|
+
// Função helper para extrair items dos children em modo composição
|
|
33
|
+
const extractItemsFromChildren = React.useCallback((childrenNodes) => {
|
|
34
|
+
const items = [];
|
|
35
|
+
const processChild = (child) => {
|
|
36
|
+
// Ignorar valores primitivos (null, undefined, strings, números, booleanos)
|
|
37
|
+
if (!React.isValidElement(child)) {
|
|
38
|
+
// Se for um Fragment, processar seus children
|
|
39
|
+
if (child === null || child === undefined) {
|
|
40
|
+
return;
|
|
48
41
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const props = child.props;
|
|
45
|
+
const componentType = child.type;
|
|
46
|
+
const displayName = componentType?.displayName;
|
|
47
|
+
// Debug: verificar tipo do componente
|
|
48
|
+
if (process.env.NODE_ENV === "development") {
|
|
49
|
+
// biome-ignore lint/suspicious/noConsoleLog: Debug temporário
|
|
50
|
+
console.log("[extractItemsFromChildren] Processing child:", {
|
|
51
|
+
type: typeof componentType,
|
|
52
|
+
displayName,
|
|
53
|
+
hasValue: props.value !== undefined,
|
|
54
|
+
hasTitle: props.title !== undefined,
|
|
55
|
+
hasChildren: props.children !== undefined,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Se tiver prop 'value', é um Autocomplete.Item
|
|
59
|
+
if (props.value !== undefined) {
|
|
60
|
+
const value = String(props.value);
|
|
61
|
+
// Extrair o texto dos children (pode ser string, ReactNode, etc)
|
|
62
|
+
let name = value;
|
|
63
|
+
if (props.children !== undefined && props.children !== null) {
|
|
64
|
+
if (typeof props.children === "string") {
|
|
65
|
+
name = props.children;
|
|
66
|
+
}
|
|
67
|
+
else if (typeof props.children === "number") {
|
|
68
|
+
name = String(props.children);
|
|
69
|
+
}
|
|
70
|
+
else if (typeof props.children === "boolean") {
|
|
71
|
+
name = String(props.children);
|
|
72
|
+
}
|
|
73
|
+
else if (React.isValidElement(props.children)) {
|
|
74
|
+
// Se children é um elemento React, tentar extrair texto recursivamente
|
|
75
|
+
const childProps = props.children.props;
|
|
76
|
+
if (typeof childProps?.children === "string") {
|
|
77
|
+
name = childProps.children;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
name = String(props.children);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (Array.isArray(props.children)) {
|
|
84
|
+
// Se children é um array, processar recursivamente e pegar o primeiro texto encontrado
|
|
85
|
+
React.Children.forEach(props.children, (c) => {
|
|
86
|
+
if (typeof c === "string" && name === value) {
|
|
87
|
+
name = c;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
name = String(props.children);
|
|
93
|
+
}
|
|
52
94
|
}
|
|
95
|
+
items.push({
|
|
96
|
+
id: value,
|
|
97
|
+
name,
|
|
98
|
+
disabled: props.disabled,
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
53
101
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
102
|
+
// Se tiver prop 'title', é um AutocompleteSection - processar seus children
|
|
103
|
+
if (props.title !== undefined) {
|
|
104
|
+
if (props.children) {
|
|
105
|
+
React.Children.forEach(props.children, processChild);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
59
108
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
109
|
+
// Se tiver children mas não é Item nem Section, pode ser um wrapper (como Autocomplete.List, Fragment, etc)
|
|
110
|
+
// Processar seus children recursivamente
|
|
111
|
+
if (props.children !== undefined && props.children !== null) {
|
|
112
|
+
// Se children é uma string, número ou booleano, não processar (é conteúdo de texto, não componentes)
|
|
113
|
+
if (typeof props.children === "string" || typeof props.children === "number" || typeof props.children === "boolean") {
|
|
114
|
+
// É um componente com conteúdo de texto (como Autocomplete.Loading ou Autocomplete.Empty)
|
|
115
|
+
// Ignorar - não contém items
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
// Se children é um array ou ReactNode, processar recursivamente
|
|
119
|
+
if (Array.isArray(props.children) || React.isValidElement(props.children)) {
|
|
120
|
+
React.Children.forEach(props.children, processChild);
|
|
64
121
|
}
|
|
65
|
-
else {
|
|
66
|
-
|
|
122
|
+
else if (typeof props.children === "object") {
|
|
123
|
+
// Pode ser um Fragment ou outro wrapper
|
|
124
|
+
React.Children.forEach(props.children, processChild);
|
|
67
125
|
}
|
|
126
|
+
return;
|
|
68
127
|
}
|
|
128
|
+
// Se chegou aqui, é um componente sem children e sem value (como Autocomplete.Empty ou Autocomplete.Loading vazio)
|
|
129
|
+
// Ignorar esses componentes
|
|
130
|
+
};
|
|
131
|
+
// Processar todos os children, incluindo arrays e Fragments
|
|
132
|
+
React.Children.forEach(childrenNodes, processChild);
|
|
133
|
+
return items;
|
|
134
|
+
}, []);
|
|
135
|
+
// Criar items para o React Aria
|
|
136
|
+
const items = React.useMemo(() => {
|
|
137
|
+
if (useComposition) {
|
|
138
|
+
// Em modo composição, extrair items dos children
|
|
139
|
+
const extractedItems = extractItemsFromChildren(children);
|
|
140
|
+
// Debug temporário: verificar se items foram extraídos
|
|
141
|
+
if (process.env.NODE_ENV === "development") {
|
|
142
|
+
// biome-ignore lint/suspicious/noConsoleLog: Debug temporário
|
|
143
|
+
console.log("[Autocomplete] Children:", children);
|
|
144
|
+
// biome-ignore lint/suspicious/noConsoleLog: Debug temporário
|
|
145
|
+
console.log("[Autocomplete] Extracted items:", extractedItems);
|
|
146
|
+
// biome-ignore lint/suspicious/noConsoleLog: Debug temporário
|
|
147
|
+
console.log("[Autocomplete] Items count:", extractedItems.length);
|
|
148
|
+
}
|
|
149
|
+
return extractedItems;
|
|
69
150
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
151
|
+
return filteredOptions.map((option) => ({
|
|
152
|
+
id: option.value,
|
|
153
|
+
name: option.label,
|
|
154
|
+
disabled: option.disabled,
|
|
155
|
+
}));
|
|
156
|
+
}, [filteredOptions, useComposition, children, extractItemsFromChildren]);
|
|
157
|
+
// Estado do combobox
|
|
158
|
+
const state = useComboBoxState({
|
|
159
|
+
items,
|
|
160
|
+
selectedKey: selectedKey ?? undefined,
|
|
161
|
+
onSelectionChange: (key) => {
|
|
162
|
+
setSelectedKey(key ? String(key) : null);
|
|
163
|
+
onValueChange?.(key ? String(key) : undefined);
|
|
164
|
+
},
|
|
165
|
+
inputValue,
|
|
166
|
+
onInputChange: setInputValue,
|
|
167
|
+
allowsCustomValue: allowCustomValue,
|
|
168
|
+
isDisabled: disabled,
|
|
169
|
+
defaultSelectedKey: defaultValue ? defaultValue : undefined,
|
|
170
|
+
});
|
|
171
|
+
// Sincronizar com valor controlado
|
|
172
|
+
React.useEffect(() => {
|
|
173
|
+
if (isControlled && controlledValue !== undefined) {
|
|
174
|
+
const option = options.find((opt) => opt.value === controlledValue);
|
|
175
|
+
if (option) {
|
|
176
|
+
setSelectedKey(controlledValue);
|
|
76
177
|
setInputValue(option.label);
|
|
77
178
|
}
|
|
78
|
-
|
|
79
|
-
|
|
179
|
+
else {
|
|
180
|
+
setSelectedKey(null);
|
|
181
|
+
setInputValue(controlledValue);
|
|
182
|
+
}
|
|
80
183
|
}
|
|
81
|
-
};
|
|
184
|
+
}, [isControlled, controlledValue, options]);
|
|
185
|
+
// Sincronizar inputValue quando seleção muda (apenas para API antiga)
|
|
186
|
+
React.useEffect(() => {
|
|
187
|
+
if (!useComposition && state.selectedKey) {
|
|
188
|
+
const option = options.find((opt) => opt.value === state.selectedKey);
|
|
189
|
+
if (option && state.inputValue !== option.label) {
|
|
190
|
+
state.setInputValue(option.label);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, [state.selectedKey, options, state, useComposition]);
|
|
194
|
+
// Refs
|
|
195
|
+
const inputRef = React.useRef(null);
|
|
196
|
+
const listBoxRef = React.useRef(null);
|
|
197
|
+
const popoverRef = React.useRef(null);
|
|
198
|
+
const mergedInputRef = React.useMemo(() => {
|
|
199
|
+
if (ref) {
|
|
200
|
+
if (typeof ref === "function") {
|
|
201
|
+
return (node) => {
|
|
202
|
+
ref(node);
|
|
203
|
+
inputRef.current = node;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return Object.assign(ref, inputRef);
|
|
207
|
+
}
|
|
208
|
+
return inputRef;
|
|
209
|
+
}, [ref]);
|
|
210
|
+
// Hooks do React Aria
|
|
211
|
+
const { inputProps, listBoxProps } = useComboBox({
|
|
212
|
+
...props,
|
|
213
|
+
inputRef: mergedInputRef,
|
|
214
|
+
listBoxRef,
|
|
215
|
+
popoverRef,
|
|
216
|
+
isDisabled: disabled,
|
|
217
|
+
placeholder,
|
|
218
|
+
}, state);
|
|
219
|
+
const listState = useListState({
|
|
220
|
+
items,
|
|
221
|
+
selectedKeys: state.selectedKey ? [state.selectedKey] : [],
|
|
222
|
+
});
|
|
223
|
+
const { listBoxProps: listBoxPropsMerged } = useListBox({
|
|
224
|
+
...listBoxProps,
|
|
225
|
+
autoFocus: state.focusStrategy ?? undefined,
|
|
226
|
+
shouldSelectOnPressUp: true,
|
|
227
|
+
}, listState, listBoxRef);
|
|
228
|
+
const { popoverProps } = usePopover({
|
|
229
|
+
popoverRef,
|
|
230
|
+
triggerRef: mergedInputRef,
|
|
231
|
+
placement: "bottom start",
|
|
232
|
+
offset: 4,
|
|
233
|
+
}, state);
|
|
234
|
+
// Handler para limpar
|
|
82
235
|
const handleClear = (e) => {
|
|
83
236
|
e.stopPropagation();
|
|
84
237
|
e.preventDefault();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setInputValue("");
|
|
88
|
-
}
|
|
238
|
+
state.setSelectedKey(null);
|
|
239
|
+
state.setInputValue("");
|
|
89
240
|
onValueChange?.(undefined);
|
|
90
|
-
setOpen(false);
|
|
91
241
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
242
|
+
// Valor de exibição
|
|
243
|
+
const displayValue = React.useMemo(() => {
|
|
244
|
+
if (useComposition) {
|
|
245
|
+
// Em modo composição, usar inputValue diretamente
|
|
246
|
+
return state.inputValue;
|
|
95
247
|
}
|
|
248
|
+
// Em modo API antiga, buscar label da opção
|
|
249
|
+
if (state.selectedKey) {
|
|
250
|
+
const option = options.find((opt) => opt.value === state.selectedKey);
|
|
251
|
+
return option?.label || state.inputValue;
|
|
252
|
+
}
|
|
253
|
+
return state.inputValue;
|
|
254
|
+
}, [state.selectedKey, state.inputValue, options, useComposition]);
|
|
255
|
+
const contextValue = {
|
|
256
|
+
state,
|
|
257
|
+
listState,
|
|
258
|
+
inputRef: mergedInputRef,
|
|
259
|
+
listBoxRef: listBoxRef,
|
|
260
|
+
popoverRef: popoverRef,
|
|
261
|
+
inputProps,
|
|
262
|
+
listBoxProps: listBoxPropsMerged,
|
|
263
|
+
popoverProps,
|
|
264
|
+
handleClear,
|
|
265
|
+
size,
|
|
266
|
+
disabled,
|
|
267
|
+
maxListboxHeight,
|
|
268
|
+
isLoading,
|
|
269
|
+
emptyMessage,
|
|
270
|
+
options: useComposition ? undefined : filteredOptions,
|
|
96
271
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
const displayValue = selectedOption?.label || currentInputValue;
|
|
110
|
-
return (_jsx(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: _jsxs("div", { className: cn("relative w-full", className), children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsx("input", { ref: ref, id: id, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: placeholder, disabled: disabled, className: cn(inputVariants({ size }), "pr-8", inputClassName), ...props }) }), _jsxs("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1 pointer-events-none", children: [currentValue && !disabled && (_jsxs("button", { type: "button", onClick: handleClear, onMouseDown: (e) => {
|
|
272
|
+
return (_jsx(AutocompleteContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("relative w-full", className), children: _jsxs(PopoverPrimitive.Root, { open: state.isOpen, onOpenChange: state.setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("div", { className: "relative", children: [_jsx("input", { ...inputProps, ...props, ref: mergedInputRef, id: id, value: displayValue, onChange: (e) => {
|
|
273
|
+
setInputValue(e.target.value);
|
|
274
|
+
state.setInputValue(e.target.value);
|
|
275
|
+
state.open();
|
|
276
|
+
}, className: cn(inputVariants({ size }), "pr-8", inputClassName), disabled: disabled }), _jsxs("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1 pointer-events-none", children: [state.selectedKey && !disabled && (_jsxs("button", { type: "button", onClick: handleClear, onMouseDown: (e) => {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
e.stopPropagation();
|
|
279
|
+
}, className: "text-muted-foreground hover:text-foreground rounded-sm p-1 opacity-70 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-events-auto", children: [_jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Limpar" })] })), _jsx(ChevronDownIcon, { className: cn("size-4 text-muted-foreground transition-transform", state.isOpen && "rotate-180") })] })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { ...popoverProps, ref: popoverRef, className: cn("bg-popover text-popover-foreground", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", "relative z-50", "min-w-(--radix-popover-trigger-width) w-full", "overflow-hidden rounded-md border shadow-md"), style: {
|
|
280
|
+
maxHeight: maxListboxHeight,
|
|
281
|
+
...popoverProps.style,
|
|
282
|
+
}, align: "start", sideOffset: 4, onOpenAutoFocus: (e) => {
|
|
111
283
|
e.preventDefault();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
284
|
+
}, children: _jsx("div", { className: "overflow-y-auto overflow-x-hidden", style: { maxHeight: maxListboxHeight }, children: useComposition ? (children) : isLoading ? (_jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "Carregando..." })) : filteredOptions.length > 0 ? (_jsx("ul", { ...listBoxPropsMerged, ref: listBoxRef, className: "p-1 outline-none", children: Array.from(listState.collection).map((item) => {
|
|
285
|
+
return _jsx(AutocompleteItem, { item: item, state: listState }, item.key);
|
|
286
|
+
}) })) : (_jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: emptyMessage })) }) }) })] }) }) }));
|
|
287
|
+
});
|
|
288
|
+
AutocompleteRoot.displayName = "Autocomplete";
|
|
289
|
+
// Subcomponentes para composição
|
|
290
|
+
const AutocompleteList = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
291
|
+
const { listBoxProps, listBoxRef } = useAutocompleteContext();
|
|
292
|
+
const mergedRef = React.useMemo(() => {
|
|
293
|
+
if (ref) {
|
|
294
|
+
if (typeof ref === "function") {
|
|
295
|
+
return (node) => {
|
|
296
|
+
ref(node);
|
|
297
|
+
if (listBoxRef.current !== node) {
|
|
298
|
+
listBoxRef.current = node;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return Object.assign(ref, listBoxRef);
|
|
303
|
+
}
|
|
304
|
+
return listBoxRef;
|
|
305
|
+
}, [ref, listBoxRef]);
|
|
306
|
+
return (_jsx("ul", { ...listBoxProps, ...props, ref: mergedRef, className: cn("p-1 outline-none", className), children: children }));
|
|
307
|
+
});
|
|
308
|
+
AutocompleteList.displayName = "AutocompleteList";
|
|
309
|
+
const AutocompleteEmpty = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
310
|
+
const { emptyMessage } = useAutocompleteContext();
|
|
311
|
+
return (_jsx("div", { ref: ref, ...props, className: cn("py-6 text-center text-sm text-muted-foreground", className), children: children || emptyMessage }));
|
|
312
|
+
});
|
|
313
|
+
AutocompleteEmpty.displayName = "AutocompleteEmpty";
|
|
314
|
+
const AutocompleteLoading = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
315
|
+
const { isLoading } = useAutocompleteContext();
|
|
316
|
+
if (!isLoading)
|
|
317
|
+
return null;
|
|
318
|
+
return (_jsx("div", { ref: ref, ...props, className: cn("py-6 text-center text-sm text-muted-foreground", className), children: children || "Carregando..." }));
|
|
319
|
+
});
|
|
320
|
+
AutocompleteLoading.displayName = "AutocompleteLoading";
|
|
321
|
+
// Exportar componente composto
|
|
322
|
+
export const Autocomplete = Object.assign(AutocompleteRoot, {
|
|
323
|
+
List: AutocompleteList,
|
|
324
|
+
Empty: AutocompleteEmpty,
|
|
325
|
+
Loading: AutocompleteLoading,
|
|
326
|
+
Item: AutocompleteItem,
|
|
117
327
|
});
|
|
118
|
-
Autocomplete.displayName = "Autocomplete";
|
|
119
|
-
export { Autocomplete };
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export type { AutocompleteOption, AutocompleteProps } from "./autocomplete";
|
|
2
2
|
export { Autocomplete } from "./autocomplete";
|
|
3
|
+
export type { AutocompleteContextValue } from "./autocomplete-context";
|
|
4
|
+
export { useAutocompleteContext } from "./autocomplete-context";
|
|
5
|
+
export type { AutocompleteItemProps } from "./autocomplete-item";
|
|
6
|
+
export { AutocompleteItem } from "./autocomplete-item";
|
|
7
|
+
export type { AutocompleteSectionProps } from "./autocomplete-section";
|
|
8
|
+
export { AutocompleteSection } from "./autocomplete-section";
|
|
3
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/forms/autocomplete/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/forms/autocomplete/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export type { AutocompleteOption, AutocompleteProps } from "./autocomplete";
|
|
2
|
-
export { Autocomplete } from "./autocomplete";
|
|
3
1
|
export type { CheckboxProps } from "./checkbox";
|
|
4
2
|
export { Checkbox } from "./checkbox";
|
|
5
3
|
export type { FieldContentProps, FieldDescriptionProps, FieldErrorProps, FieldGroupProps, FieldLabelProps, FieldLegendProps, FieldProps, FieldSeparatorProps, FieldSetProps, FieldTitleProps, } from "./field";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/forms/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/forms/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvF,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { Autocomplete } from "./autocomplete";
|
|
2
1
|
export { Checkbox } from "./checkbox";
|
|
3
2
|
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, } from "./field";
|
|
4
3
|
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, } from "./form";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const inputVariants: (props?: ({
|
|
4
|
-
size?: "
|
|
4
|
+
size?: "lg" | "default" | "sm" | null | undefined;
|
|
5
5
|
variant?: "default" | "success" | "error" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof inputVariants> {
|
|
@@ -3,7 +3,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import type * as React from "react";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
5
|
variant?: "default" | "outline" | null | undefined;
|
|
6
|
-
size?: "
|
|
6
|
+
size?: "lg" | "default" | "sm" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface ToggleProps extends React.ComponentProps<typeof TogglePrimitive.Root>, VariantProps<typeof toggleVariants> {
|
|
9
9
|
}
|
|
@@ -107,7 +107,7 @@ declare namespace SidebarMenuItem {
|
|
|
107
107
|
}
|
|
108
108
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
109
109
|
variant?: "default" | "outline" | null | undefined;
|
|
110
|
-
size?: "
|
|
110
|
+
size?: "lg" | "default" | "sm" | null | undefined;
|
|
111
111
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
112
112
|
export interface SidebarMenuButtonProps extends React.ComponentProps<"button">, VariantProps<typeof sidebarMenuButtonVariants> {
|
|
113
113
|
asChild?: boolean;
|
|
@@ -19,11 +19,11 @@ export type CommandSeparatorProps = React.ComponentPropsWithoutRef<typeof Comman
|
|
|
19
19
|
*/
|
|
20
20
|
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
22
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
23
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
24
24
|
} & {
|
|
25
25
|
asChild?: boolean;
|
|
26
|
-
}, "asChild" | "key"
|
|
26
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
27
27
|
label?: string;
|
|
28
28
|
shouldFilter?: boolean;
|
|
29
29
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -48,7 +48,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
48
48
|
ref?: React.Ref<HTMLInputElement>;
|
|
49
49
|
} & {
|
|
50
50
|
asChild?: boolean;
|
|
51
|
-
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "
|
|
51
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
|
|
52
52
|
value?: string;
|
|
53
53
|
onValueChange?: (search: string) => void;
|
|
54
54
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -57,11 +57,11 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
57
57
|
*/
|
|
58
58
|
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
59
59
|
children?: React.ReactNode;
|
|
60
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
60
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
61
61
|
ref?: React.Ref<HTMLDivElement>;
|
|
62
62
|
} & {
|
|
63
63
|
asChild?: boolean;
|
|
64
|
-
}, "asChild" | "key"
|
|
64
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
65
65
|
label?: string;
|
|
66
66
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
67
|
/**
|
|
@@ -69,21 +69,21 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
69
69
|
*/
|
|
70
70
|
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
71
71
|
children?: React.ReactNode;
|
|
72
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
72
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
73
73
|
ref?: React.Ref<HTMLDivElement>;
|
|
74
74
|
} & {
|
|
75
75
|
asChild?: boolean;
|
|
76
|
-
}, "asChild" | "key"
|
|
76
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
77
77
|
/**
|
|
78
78
|
* CommandGroup - Grupo do command
|
|
79
79
|
*/
|
|
80
80
|
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
81
81
|
children?: React.ReactNode;
|
|
82
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
82
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
83
83
|
ref?: React.Ref<HTMLDivElement>;
|
|
84
84
|
} & {
|
|
85
85
|
asChild?: boolean;
|
|
86
|
-
}, "asChild" | "key"
|
|
86
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "value" | "heading"> & {
|
|
87
87
|
heading?: React.ReactNode;
|
|
88
88
|
value?: string;
|
|
89
89
|
forceMount?: boolean;
|
|
@@ -91,11 +91,11 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
91
91
|
/**
|
|
92
92
|
* CommandSeparator - Separador do command
|
|
93
93
|
*/
|
|
94
|
-
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
94
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
95
95
|
ref?: React.Ref<HTMLDivElement>;
|
|
96
96
|
} & {
|
|
97
97
|
asChild?: boolean;
|
|
98
|
-
}, "asChild" | "key"
|
|
98
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
99
99
|
alwaysRender?: boolean;
|
|
100
100
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
101
101
|
/**
|
|
@@ -103,11 +103,11 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
103
103
|
*/
|
|
104
104
|
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
105
105
|
children?: React.ReactNode;
|
|
106
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
106
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
107
107
|
ref?: React.Ref<HTMLDivElement>;
|
|
108
108
|
} & {
|
|
109
109
|
asChild?: boolean;
|
|
110
|
-
}, "asChild" | "key"
|
|
110
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "onSelect" | "value" | "disabled"> & {
|
|
111
111
|
disabled?: boolean;
|
|
112
112
|
onSelect?: (value: string) => void;
|
|
113
113
|
value?: string;
|
|
@@ -41,7 +41,7 @@ const TabsList = React.forwardRef(({ className, ...props }, ref) => {
|
|
|
41
41
|
ref.current = node;
|
|
42
42
|
}
|
|
43
43
|
listRef.current = node;
|
|
44
|
-
}, className: cn("relative inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", className), ...props, children: [props.children, _jsx(motion.div, { className: "absolute rounded-md bg-
|
|
44
|
+
}, className: cn("relative inline-flex h-10 items-center justify-center rounded-lg bg-muted/50 p-1 text-muted-foreground", className), ...props, children: [props.children, _jsx(motion.div, { className: "absolute rounded-md bg-primary/10", initial: false, animate: shouldReduceMotion
|
|
45
45
|
? {
|
|
46
46
|
opacity: indicatorStyle.opacity,
|
|
47
47
|
}
|
|
@@ -88,7 +88,7 @@ const TabsTrigger = React.forwardRef(({ className, value, ...props }, ref) => {
|
|
|
88
88
|
node.setAttribute("data-value", value);
|
|
89
89
|
context.registerTrigger(node, value);
|
|
90
90
|
}
|
|
91
|
-
}, value: value, "data-value": value, className: cn("relative inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-
|
|
91
|
+
}, value: value, "data-value": value, className: cn("relative inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 text-muted-foreground hover:text-foreground data-[state=active]:bg-primary/10 data-[state=active]:text-primary", className), ...props, children: _jsx("span", { className: "relative z-10", children: props.children }) }));
|
|
92
92
|
});
|
|
93
93
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
94
94
|
const TabsContent = React.forwardRef(({ className, value, ...props }, ref) => {
|