@rovula/ui 0.1.8 → 0.1.9

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.
@@ -6,12 +6,15 @@ export type ValidationHintRule<TValues> = {
6
6
  validate: (values: TValues) => boolean;
7
7
  when?: (values: TValues) => boolean;
8
8
  };
9
+ export type ValidationHintStateClassMap = Partial<Record<ValidationHintState, string>>;
9
10
  export type ValidationHintListProps<TValues> = {
10
11
  values: TValues;
11
12
  rules: ValidationHintRule<TValues>[];
12
13
  mode?: ValidationHintMode;
13
14
  className?: string;
14
15
  itemClassName?: string;
16
+ labelStateClassName?: ValidationHintStateClassMap;
17
+ iconStateClassName?: ValidationHintStateClassMap;
15
18
  };
16
- export declare const ValidationHintList: <TValues>({ values, rules, mode, className, itemClassName, }: ValidationHintListProps<TValues>) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const ValidationHintList: <TValues>({ values, rules, mode, className, itemClassName, labelStateClassName, iconStateClassName, }: ValidationHintListProps<TValues>) => import("react/jsx-runtime").JSX.Element;
17
20
  export default ValidationHintList;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CheckCircleIcon } from "@heroicons/react/24/outline";
2
+ import { CircleCheck } from "lucide-react";
3
3
  import { cn } from "@/utils/cn";
4
4
  const resolveHintState = (values, rule) => {
5
5
  const shouldEvaluate = rule.when ? rule.when(values) : true;
@@ -7,24 +7,24 @@ const resolveHintState = (values, rule) => {
7
7
  return "pending";
8
8
  return rule.validate(values) ? "valid" : "invalid";
9
9
  };
10
- const hintTextStateClass = {
11
- valid: "text-success",
10
+ const hintLabelStateClass = {
11
+ valid: "text-text-g-contrast-high",
12
12
  invalid: "text-input-error",
13
- pending: "text-text-g-contrast-medium",
13
+ pending: "text-text-g-contrast-high",
14
14
  };
15
15
  const hintIconStateClass = {
16
- valid: "opacity-100",
17
- invalid: "opacity-100",
18
- pending: "opacity-40",
16
+ valid: "text-primary",
17
+ invalid: "text-input-error",
18
+ pending: "text-text-g-contrast-low",
19
19
  };
20
- export const ValidationHintList = ({ values, rules, mode = ["pending", "valid", "invalid"], className, itemClassName, }) => {
20
+ export const ValidationHintList = ({ values, rules, mode = ["pending", "valid", "invalid"], className, itemClassName, labelStateClassName, iconStateClassName, }) => {
21
21
  const enabledStates = new Set(mode);
22
22
  return (_jsx("ul", { className: cn("mt-2 flex flex-col gap-3", className), children: rules.map((rule) => {
23
23
  const state = resolveHintState(values, rule);
24
24
  const normalizedState = enabledStates.has(state)
25
25
  ? state
26
26
  : "pending";
27
- return (_jsxs("li", { className: cn("flex items-center gap-2 typography-small2", hintTextStateClass[normalizedState], itemClassName), children: [_jsx(CheckCircleIcon, { className: cn("size-4", hintIconStateClass[normalizedState]) }), _jsx("span", { children: rule.label })] }, rule.id));
27
+ return (_jsxs("li", { className: cn("flex items-center gap-2 typography-small2 ", hintLabelStateClass[normalizedState], labelStateClassName === null || labelStateClassName === void 0 ? void 0 : labelStateClassName[normalizedState], itemClassName), children: [_jsx(CircleCheck, { className: cn("size-4", hintIconStateClass[normalizedState], iconStateClassName === null || iconStateClassName === void 0 ? void 0 : iconStateClassName[normalizedState]) }), _jsx("span", { children: rule.label })] }, rule.id));
28
28
  }) }));
29
29
  };
30
30
  export default ValidationHintList;
@@ -102,7 +102,7 @@ export const OtpInput = forwardRef(({ value, onChange, onBlur, onComplete, lengt
102
102
  };
103
103
  return (_jsx("div", { className: cn("flex items-center gap-3", className), ref: containerRef, children: slots.map((slot, index) => (_jsx("input", { ref: (element) => {
104
104
  inputRefs.current[index] = element;
105
- }, type: "text", inputMode: inputMode, autoComplete: index === 0 ? "one-time-code" : "off", value: slot, maxLength: 1, disabled: disabled, autoFocus: autoFocus && index === 0, "aria-invalid": invalid || undefined, className: cn("h-14 w-[46px] rounded-[8px] border bg-transparent text-center text-2xl font-semibold text-text-white outline-none transition-all duration-200", "border-input-default-stroke focus:border-input-active-stroke", "disabled:cursor-not-allowed disabled:opacity-50", invalid && "border-input-error focus:border-input-error", inputClassName), onFocus: (event) => {
105
+ }, type: "text", inputMode: inputMode, autoComplete: index === 0 ? "one-time-code" : "off", value: slot, maxLength: 1, disabled: disabled, autoFocus: autoFocus && index === 0, "aria-invalid": invalid || undefined, className: cn("h-14 w-[46px] rounded-[8px] text-input-filled-text border bg-transparent text-center text-2xl font-semibold outline-none transition-all duration-200", "border-input-default-stroke focus:border-input-active-stroke", "disabled:cursor-not-allowed disabled:opacity-50", invalid && "border-input-error focus:border-input-error", inputClassName), onFocus: (event) => {
106
106
  event.target.select();
107
107
  }, onBlur: (event) => {
108
108
  var _a;
@@ -3929,10 +3929,6 @@ input[type=number] {
3929
3929
  --tw-text-opacity: 1;
3930
3930
  color: color-mix(in srgb, var(--text-g-contrast-medium) calc(100% * var(--tw-text-opacity, 1)), transparent);
3931
3931
  }
3932
- .text-text-white{
3933
- --tw-text-opacity: 1;
3934
- color: color-mix(in srgb, var(--text-white) calc(100% * var(--tw-text-opacity, 1)), transparent);
3935
- }
3936
3932
  .text-warning{
3937
3933
  --tw-text-opacity: 1;
3938
3934
  color: color-mix(in srgb, var(--state-warning-default) calc(100% * var(--tw-text-opacity, 1)), transparent);
@@ -3953,12 +3949,6 @@ input[type=number] {
3953
3949
  .opacity-0{
3954
3950
  opacity: 0;
3955
3951
  }
3956
- .opacity-100{
3957
- opacity: 1;
3958
- }
3959
- .opacity-40{
3960
- opacity: 0.4;
3961
- }
3962
3952
  .opacity-50{
3963
3953
  opacity: 0.5;
3964
3954
  }