@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
36 lines (32 loc) • 862 B
JavaScript
"use client";
import { utils_exports } from "../../utils/index.js";
import { useI18n } from "../../providers/i18n-provider/i18n-provider.js";
import { useCallback } from "react";
//#region src/components/password-input/use-strength-meter.ts
const useStrengthMeter = ({ max = 4, value,...rest }) => {
const { t } = useI18n("passwordInput");
const getRootProps = useCallback((props) => ({
"aria-label": t("Password strength meter"),
"aria-valuemax": max,
"aria-valuemin": 0,
"aria-valuenow": value,
role: "meter",
...rest,
...props
}), [
max,
rest,
value,
t
]);
return {
getIndicatorProps: useCallback(({ index,...props }) => ({
"data-selected": (0, utils_exports.dataAttr)(index < value),
...props
}), [value]),
getRootProps
};
};
//#endregion
export { useStrengthMeter };
//# sourceMappingURL=use-strength-meter.js.map