analytica-frontend-lib 1.1.71 → 1.1.73
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/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/Alert/index.js.map +1 -1
- package/dist/Alert/index.mjs.map +1 -1
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/AlertDialog/index.mjs.map +1 -1
- package/dist/Alternative/index.js.map +1 -1
- package/dist/Alternative/index.mjs.map +1 -1
- package/dist/Badge/index.js.map +1 -1
- package/dist/Badge/index.mjs.map +1 -1
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.mjs.map +1 -1
- package/dist/Calendar/index.js.map +1 -1
- package/dist/Calendar/index.mjs.map +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs.map +1 -1
- package/dist/CheckBox/index.js.map +1 -1
- package/dist/CheckBox/index.mjs.map +1 -1
- package/dist/Chips/index.js.map +1 -1
- package/dist/Chips/index.mjs.map +1 -1
- package/dist/Divider/index.js.map +1 -1
- package/dist/Divider/index.mjs.map +1 -1
- package/dist/DropdownMenu/index.js +24 -29
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +24 -29
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButton/index.mjs.map +1 -1
- package/dist/IconRoundedButton/index.js.map +1 -1
- package/dist/IconRoundedButton/index.mjs.map +1 -1
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/MultipleChoice/index.js.map +1 -1
- package/dist/MultipleChoice/index.mjs.map +1 -1
- package/dist/NavButton/index.js.map +1 -1
- package/dist/NavButton/index.mjs.map +1 -1
- package/dist/NotFound/index.js.map +1 -1
- package/dist/NotFound/index.mjs.map +1 -1
- package/dist/NotificationCard/index.d.mts +1 -1
- package/dist/NotificationCard/index.d.ts +1 -1
- package/dist/NotificationCard/index.js +26 -38
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +25 -36
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/{NotificationCard-DMdkuVEr.d.mts → NotificationCard-4GgB0Nsf.d.mts} +2 -7
- package/dist/{NotificationCard-DMdkuVEr.d.ts → NotificationCard-4GgB0Nsf.d.ts} +2 -7
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/ProgressCircle/index.js.map +1 -1
- package/dist/ProgressCircle/index.mjs.map +1 -1
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Radio/index.js.map +1 -1
- package/dist/Radio/index.mjs.map +1 -1
- package/dist/Search/index.js +97 -56
- package/dist/Search/index.js.map +1 -1
- package/dist/Search/index.mjs +98 -57
- package/dist/Search/index.mjs.map +1 -1
- package/dist/Select/index.js.map +1 -1
- package/dist/Select/index.mjs.map +1 -1
- package/dist/SelectionButton/index.js.map +1 -1
- package/dist/SelectionButton/index.mjs.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Skeleton/index.mjs.map +1 -1
- package/dist/Stepper/index.js.map +1 -1
- package/dist/Stepper/index.mjs.map +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs.map +1 -1
- package/dist/Text/index.js.map +1 -1
- package/dist/Text/index.mjs.map +1 -1
- package/dist/TextArea/index.js.map +1 -1
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/ThemeToggle/index.js.map +1 -1
- package/dist/ThemeToggle/index.mjs.map +1 -1
- package/dist/Toast/Toaster/index.js.map +1 -1
- package/dist/Toast/Toaster/index.mjs.map +1 -1
- package/dist/Toast/index.js.map +1 -1
- package/dist/Toast/index.mjs.map +1 -1
- package/dist/VideoPlayer/index.js.map +1 -1
- package/dist/VideoPlayer/index.mjs.map +1 -1
- package/dist/Whiteboard/index.js.map +1 -1
- package/dist/Whiteboard/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +108 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -68
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.d.mts +14 -1
- package/dist/utils/index.d.ts +14 -1
- package/dist/utils/index.js +13 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +11 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/Search/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/Search/Search.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { X as X2, MagnifyingGlass } from "phosphor-react";
|
|
3
3
|
import {
|
|
4
4
|
forwardRef as forwardRef3,
|
|
5
5
|
useState as useState3,
|
|
@@ -947,12 +947,28 @@ var ProfileToggleTheme = ({ ...props }) => {
|
|
|
947
947
|
setModalThemeToggle(false);
|
|
948
948
|
};
|
|
949
949
|
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
|
|
950
|
+
/* @__PURE__ */ jsx6(
|
|
951
|
+
DropdownMenuItem,
|
|
952
952
|
{
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
953
|
+
variant: "profile",
|
|
954
|
+
iconLeft: /* @__PURE__ */ jsx6(
|
|
955
|
+
"svg",
|
|
956
|
+
{
|
|
957
|
+
width: "24",
|
|
958
|
+
height: "24",
|
|
959
|
+
viewBox: "0 0 25 25",
|
|
960
|
+
fill: "none",
|
|
961
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
962
|
+
children: /* @__PURE__ */ jsx6(
|
|
963
|
+
"path",
|
|
964
|
+
{
|
|
965
|
+
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
966
|
+
fill: "currentColor"
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
iconRight: /* @__PURE__ */ jsx6(CaretRight, {}),
|
|
956
972
|
onClick: handleClick,
|
|
957
973
|
onKeyDown: (e) => {
|
|
958
974
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -961,29 +977,8 @@ var ProfileToggleTheme = ({ ...props }) => {
|
|
|
961
977
|
setModalThemeToggle(true);
|
|
962
978
|
}
|
|
963
979
|
},
|
|
964
|
-
tabIndex: 0,
|
|
965
980
|
...props,
|
|
966
|
-
children:
|
|
967
|
-
/* @__PURE__ */ jsx6(
|
|
968
|
-
"svg",
|
|
969
|
-
{
|
|
970
|
-
width: "25",
|
|
971
|
-
height: "25",
|
|
972
|
-
viewBox: "0 0 25 25",
|
|
973
|
-
fill: "none",
|
|
974
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
975
|
-
children: /* @__PURE__ */ jsx6(
|
|
976
|
-
"path",
|
|
977
|
-
{
|
|
978
|
-
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
979
|
-
fill: "#525252"
|
|
980
|
-
}
|
|
981
|
-
)
|
|
982
|
-
}
|
|
983
|
-
),
|
|
984
|
-
/* @__PURE__ */ jsx6(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
|
|
985
|
-
/* @__PURE__ */ jsx6(CaretRight, {})
|
|
986
|
-
]
|
|
981
|
+
children: /* @__PURE__ */ jsx6(Text_default, { size: "md", color: "text-text-700", children: "Apar\xEAncia" })
|
|
987
982
|
}
|
|
988
983
|
),
|
|
989
984
|
/* @__PURE__ */ jsx6(
|
|
@@ -1038,8 +1033,8 @@ var ProfileMenuFooter = ({
|
|
|
1038
1033
|
},
|
|
1039
1034
|
...props,
|
|
1040
1035
|
children: [
|
|
1041
|
-
/* @__PURE__ */ jsx6("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx6(SignOut, {}) }),
|
|
1042
|
-
/* @__PURE__ */ jsx6(Text_default, { children: "Sair" })
|
|
1036
|
+
/* @__PURE__ */ jsx6("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx6(SignOut, { className: "text-inherit" }) }),
|
|
1037
|
+
/* @__PURE__ */ jsx6(Text_default, { color: "inherit", children: "Sair" })
|
|
1043
1038
|
]
|
|
1044
1039
|
}
|
|
1045
1040
|
);
|
|
@@ -1091,11 +1086,15 @@ var Search = forwardRef3(
|
|
|
1091
1086
|
value,
|
|
1092
1087
|
onChange,
|
|
1093
1088
|
placeholder = "Buscar...",
|
|
1089
|
+
onKeyDown: userOnKeyDown,
|
|
1094
1090
|
...props
|
|
1095
1091
|
}, ref) => {
|
|
1096
1092
|
const [dropdownOpen, setDropdownOpen] = useState3(false);
|
|
1093
|
+
const [forceClose, setForceClose] = useState3(false);
|
|
1094
|
+
const justSelectedRef = useRef2(false);
|
|
1097
1095
|
const dropdownStore = useRef2(createDropdownStore()).current;
|
|
1098
1096
|
const dropdownRef = useRef2(null);
|
|
1097
|
+
const inputElRef = useRef2(null);
|
|
1099
1098
|
const filteredOptions = useMemo(() => {
|
|
1100
1099
|
if (!options.length) {
|
|
1101
1100
|
return [];
|
|
@@ -1103,24 +1102,35 @@ var Search = forwardRef3(
|
|
|
1103
1102
|
const filtered = filterOptions(options, value || "");
|
|
1104
1103
|
return filtered;
|
|
1105
1104
|
}, [options, value]);
|
|
1106
|
-
const showDropdown = controlledShowDropdown ?? (dropdownOpen && value && String(value).length > 0);
|
|
1105
|
+
const showDropdown = !forceClose && (controlledShowDropdown ?? (dropdownOpen && value && String(value).length > 0));
|
|
1106
|
+
const setOpenAndNotify = (open) => {
|
|
1107
|
+
setDropdownOpen(open);
|
|
1108
|
+
dropdownStore.setState({ open });
|
|
1109
|
+
onDropdownChange?.(open);
|
|
1110
|
+
};
|
|
1107
1111
|
useEffect5(() => {
|
|
1112
|
+
if (justSelectedRef.current) {
|
|
1113
|
+
justSelectedRef.current = false;
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
if (forceClose) {
|
|
1117
|
+
setOpenAndNotify(false);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1108
1120
|
const shouldShow = Boolean(value && String(value).length > 0);
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
onDropdownChange?.(shouldShow);
|
|
1112
|
-
}, [value, onDropdownChange, dropdownStore]);
|
|
1121
|
+
setOpenAndNotify(shouldShow);
|
|
1122
|
+
}, [value, forceClose, onDropdownChange, dropdownStore]);
|
|
1113
1123
|
const handleSelectOption = (option) => {
|
|
1124
|
+
justSelectedRef.current = true;
|
|
1125
|
+
setForceClose(true);
|
|
1114
1126
|
onSelect?.(option);
|
|
1115
|
-
|
|
1116
|
-
dropdownStore.setState({ open: false });
|
|
1127
|
+
setOpenAndNotify(false);
|
|
1117
1128
|
updateInputValue(option, ref, onChange);
|
|
1118
1129
|
};
|
|
1119
1130
|
useEffect5(() => {
|
|
1120
1131
|
const handleClickOutside = (event) => {
|
|
1121
1132
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1122
|
-
|
|
1123
|
-
dropdownStore.setState({ open: false });
|
|
1133
|
+
setOpenAndNotify(false);
|
|
1124
1134
|
}
|
|
1125
1135
|
};
|
|
1126
1136
|
if (showDropdown) {
|
|
@@ -1129,9 +1139,10 @@ var Search = forwardRef3(
|
|
|
1129
1139
|
return () => {
|
|
1130
1140
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1131
1141
|
};
|
|
1132
|
-
}, [showDropdown, dropdownStore]);
|
|
1142
|
+
}, [showDropdown, dropdownStore, onDropdownChange]);
|
|
1133
1143
|
const generatedId = useId2();
|
|
1134
1144
|
const inputId = id ?? `search-${generatedId}`;
|
|
1145
|
+
const dropdownId = `${inputId}-dropdown`;
|
|
1135
1146
|
const handleClear = () => {
|
|
1136
1147
|
if (onClear) {
|
|
1137
1148
|
onClear();
|
|
@@ -1144,21 +1155,40 @@ var Search = forwardRef3(
|
|
|
1144
1155
|
e.stopPropagation();
|
|
1145
1156
|
handleClear();
|
|
1146
1157
|
};
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1158
|
+
const handleSearchIconClick = (e) => {
|
|
1159
|
+
e.preventDefault();
|
|
1160
|
+
e.stopPropagation();
|
|
1161
|
+
setTimeout(() => {
|
|
1162
|
+
inputElRef.current?.focus();
|
|
1163
|
+
}, 0);
|
|
1151
1164
|
};
|
|
1152
1165
|
const handleInputChange = (e) => {
|
|
1166
|
+
setForceClose(false);
|
|
1153
1167
|
onChange?.(e);
|
|
1154
1168
|
onSearch?.(e.target.value);
|
|
1155
1169
|
};
|
|
1170
|
+
const handleKeyDown = (e) => {
|
|
1171
|
+
userOnKeyDown?.(e);
|
|
1172
|
+
if (e.defaultPrevented) return;
|
|
1173
|
+
if (e.key === "Enter") {
|
|
1174
|
+
e.preventDefault();
|
|
1175
|
+
if (showDropdown && filteredOptions.length > 0) {
|
|
1176
|
+
handleSelectOption(filteredOptions[0]);
|
|
1177
|
+
} else if (value) {
|
|
1178
|
+
onSearch?.(String(value));
|
|
1179
|
+
setForceClose(true);
|
|
1180
|
+
setOpenAndNotify(false);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1156
1184
|
const getInputStateClasses = (disabled2, readOnly2) => {
|
|
1157
1185
|
if (disabled2) return "cursor-not-allowed opacity-40";
|
|
1158
1186
|
if (readOnly2) return "cursor-default focus:outline-none !text-text-900";
|
|
1159
1187
|
return "hover:border-border-400";
|
|
1160
1188
|
};
|
|
1161
|
-
const
|
|
1189
|
+
const hasValue = String(value ?? "").length > 0;
|
|
1190
|
+
const showClearButton = hasValue && !disabled && !readOnly;
|
|
1191
|
+
const showSearchIcon = !hasValue && !disabled && !readOnly;
|
|
1162
1192
|
return /* @__PURE__ */ jsxs5(
|
|
1163
1193
|
"div",
|
|
1164
1194
|
{
|
|
@@ -1166,30 +1196,30 @@ var Search = forwardRef3(
|
|
|
1166
1196
|
className: `w-full max-w-lg md:w-[488px] ${containerClassName}`,
|
|
1167
1197
|
children: [
|
|
1168
1198
|
/* @__PURE__ */ jsxs5("div", { className: "relative flex items-center", children: [
|
|
1169
|
-
/* @__PURE__ */ jsx7("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx7(
|
|
1170
|
-
"button",
|
|
1171
|
-
{
|
|
1172
|
-
type: "button",
|
|
1173
|
-
className: "w-6 h-6 text-text-800 flex items-center justify-center bg-transparent border-0 p-0 cursor-pointer hover:text-text-600 transition-colors",
|
|
1174
|
-
onClick: handleLeftIconClick,
|
|
1175
|
-
"aria-label": "Voltar",
|
|
1176
|
-
children: /* @__PURE__ */ jsx7(CaretLeft, {})
|
|
1177
|
-
}
|
|
1178
|
-
) }),
|
|
1179
1199
|
/* @__PURE__ */ jsx7(
|
|
1180
1200
|
"input",
|
|
1181
1201
|
{
|
|
1182
|
-
ref
|
|
1202
|
+
ref: (node) => {
|
|
1203
|
+
if (ref) {
|
|
1204
|
+
if (typeof ref === "function") ref(node);
|
|
1205
|
+
else
|
|
1206
|
+
ref.current = node;
|
|
1207
|
+
}
|
|
1208
|
+
inputElRef.current = node;
|
|
1209
|
+
},
|
|
1183
1210
|
id: inputId,
|
|
1184
1211
|
type: "text",
|
|
1185
|
-
className: `w-full py-0 px-4
|
|
1212
|
+
className: `w-full py-0 px-4 pr-10 font-normal text-text-900 focus:outline-primary-950 border rounded-full bg-background focus:bg-primary-50 border-border-300 focus:border-2 focus:border-primary-950 h-10 placeholder:text-text-600 ${getInputStateClasses(disabled, readOnly)} ${className}`,
|
|
1186
1213
|
value,
|
|
1187
1214
|
onChange: handleInputChange,
|
|
1215
|
+
onKeyDown: handleKeyDown,
|
|
1188
1216
|
disabled,
|
|
1189
1217
|
readOnly,
|
|
1190
1218
|
placeholder,
|
|
1191
1219
|
"aria-expanded": showDropdown ? "true" : void 0,
|
|
1192
1220
|
"aria-haspopup": options.length > 0 ? "listbox" : void 0,
|
|
1221
|
+
"aria-controls": showDropdown ? dropdownId : void 0,
|
|
1222
|
+
"aria-autocomplete": "list",
|
|
1193
1223
|
role: options.length > 0 ? "combobox" : void 0,
|
|
1194
1224
|
...props
|
|
1195
1225
|
}
|
|
@@ -1203,11 +1233,22 @@ var Search = forwardRef3(
|
|
|
1203
1233
|
"aria-label": "Limpar busca",
|
|
1204
1234
|
children: /* @__PURE__ */ jsx7("span", { className: "w-6 h-6 text-text-800 flex items-center justify-center hover:text-text-600 transition-colors", children: /* @__PURE__ */ jsx7(X2, {}) })
|
|
1205
1235
|
}
|
|
1236
|
+
) }),
|
|
1237
|
+
showSearchIcon && /* @__PURE__ */ jsx7("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx7(
|
|
1238
|
+
"button",
|
|
1239
|
+
{
|
|
1240
|
+
type: "button",
|
|
1241
|
+
className: "p-0 border-0 bg-transparent cursor-pointer",
|
|
1242
|
+
onMouseDown: handleSearchIconClick,
|
|
1243
|
+
"aria-label": "Buscar",
|
|
1244
|
+
children: /* @__PURE__ */ jsx7("span", { className: "w-6 h-6 text-text-800 flex items-center justify-center hover:text-text-600 transition-colors", children: /* @__PURE__ */ jsx7(MagnifyingGlass, {}) })
|
|
1245
|
+
}
|
|
1206
1246
|
) })
|
|
1207
1247
|
] }),
|
|
1208
1248
|
showDropdown && /* @__PURE__ */ jsx7(DropdownMenu_default, { open: showDropdown, onOpenChange: setDropdownOpen, children: /* @__PURE__ */ jsx7(
|
|
1209
1249
|
DropdownMenuContent,
|
|
1210
1250
|
{
|
|
1251
|
+
id: dropdownId,
|
|
1211
1252
|
className: "w-full mt-1",
|
|
1212
1253
|
style: { maxHeight: dropdownMaxHeight },
|
|
1213
1254
|
align: "start",
|