Skip to content

Commit

Permalink
Revert "fix(abp1-fixes): add hcd feedback to ABP1 "
Browse files Browse the repository at this point in the history
This reverts commit b42d55c.
  • Loading branch information
mdial89f committed Jul 1, 2024
1 parent b42d55c commit 05d5d9e
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 347 deletions.
1 change: 0 additions & 1 deletion src/packages/shared-types/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export type RHFSlotProps = {
descriptionClassName?: string;
dependency?: DependencyRule;
rules?: RegisterOptions;
horizontalLayout?: boolean;
} & {
[K in keyof RHFComponentMap]: {
rhf: K;
Expand Down
1 change: 0 additions & 1 deletion src/packages/shared-types/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type DatePickerProps = {
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {
icon?: string;
iconRight?: boolean;
}

export type RadioProps = React.ComponentPropsWithoutRef<
Expand Down
592 changes: 272 additions & 320 deletions src/services/api/webforms/ABP1/v202402.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/services/ui/src/components/Inputs/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { cn } from "@/utils";
import { Loader2 } from "lucide-react";

const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-base font-bold 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",
"inline-flex items-center justify-center rounded-md 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",
{
variants: {
variant: {
Expand Down
10 changes: 4 additions & 6 deletions src/services/ui/src/components/Inputs/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ import { cn } from "@/utils";
import { InputProps } from "shared-types";

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, icon, iconRight, ...props }, ref) => {
({ className, icon, ...props }, ref) => {
return (
<div className="relative w-fit">
<div className="relative">
{icon && (
<span
className={`absolute inset-y-0 flex items-center text-gray-500 ${iconRight ? "right-0 pr-2" : "left-0 pl-2"}`}
>
<span className="absolute inset-y-0 left-0 flex items-center pl-2 text-gray-500">
{icon}
</span>
)}
<input
className={cn(
"flex h-9 w-full rounded-sm border border-black bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
icon && (iconRight ? "pr-6" : "pl-6"),
icon && "pl-6",
className,
)}
ref={ref}
Expand Down
14 changes: 3 additions & 11 deletions src/services/ui/src/components/RHF/Slot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const RHFSlot = <
descriptionClassName,
labelClassName,
formItemClassName,
horizontalLayout,
...rest
}: RHFSlotProps & { control: any; parentId?: string }): ControllerProps<
TFieldValues,
Expand All @@ -40,11 +39,9 @@ export const RHFSlot = <

return (
<FormItem
className={`flex gap-1 py-2${
className={`flex flex-col gap-1 py-2${
formItemClassName ? ` ${formItemClassName}` : ""
}
${horizontalLayout ? "" : " flex-col"}
`}
}`}
data-testid={rest.name + "Wrapper"}
>
{(label || styledLabel) && (
Expand All @@ -58,12 +55,7 @@ export const RHFSlot = <
</FormDescription>
)}
<FormControl>
<SlotField
{...rest}
horizontalLayout={horizontalLayout}
control={control}
field={field}
/>
<SlotField {...rest} control={control} field={field} />
</FormControl>
{description && !descriptionAbove && (
<FormDescription className={descriptionClassName}>
Expand Down
5 changes: 2 additions & 3 deletions src/services/ui/src/components/RHF/SlotField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const SlotField = ({
parentId,
fields,
name,
horizontalLayout,
}: SlotFieldProps) => {
switch (rhf) {
case "Input":
Expand Down Expand Up @@ -212,7 +211,7 @@ export const SlotField = ({
<RadioGroup
onValueChange={field.onChange}
defaultValue={field.value}
className={`flex ${horizontalLayout ? "pl-5 gap-5" : "flex-col space-y-1"}`}
className="flex flex-col space-y-1"
>
{(props as RHFComponentMap["Radio"]).options.map((OPT) => {
return (
Expand Down Expand Up @@ -276,7 +275,7 @@ export const OptChildren = ({
control={control}
name={parentId + SLOT.name}
{...(SLOT.rules && { rules: SLOT.rules })}
render={RHFSlot({ ...SLOT, control, parentId })}
render={RHFSlot({ ...SLOT, parentId, control })}
/>
</div>
))}
Expand Down
6 changes: 3 additions & 3 deletions src/services/ui/src/components/RHF/dependencyWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DependencyRule, DependencyWrapperProps } from "shared-types";

const checkTriggeringValue = (
dependentValue: unknown[],
dependency?: DependencyRule,
dependency?: DependencyRule
) => {
return !!dependency?.conditions?.every((d, i) => {
switch (d.type) {
Expand All @@ -27,7 +27,7 @@ const checkTriggeringValue = (
};

export const DependencyWrapper = (
props: PropsWithChildren<DependencyWrapperProps>,
props: PropsWithChildren<DependencyWrapperProps>
) => {
// Check for dependencies which won't exist outside of forms
if (
Expand All @@ -51,7 +51,7 @@ const DependencyWrapperHandler = ({
const { watch, setValue } = useFormContext();
const [wasSetLast, setWasSetLast] = useState(false);
const dependentValues = watch(
dependency?.conditions?.map((c) => c.name) ?? [],
dependency?.conditions?.map((c) => c.name) ?? []
);
const isTriggered =
dependency && checkTriggeringValue(dependentValues, dependency);
Expand Down
2 changes: 1 addition & 1 deletion src/services/ui/src/features/webforms/WebFormBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ClearDataButton: FC<{ reset: () => void }> = ({ reset }) => {
if (clearDataButton) {
return (
<Button type="button" onClick={reset} variant="outline" className="mx-2">
Clear
Clear Data
</Button>
);
}
Expand Down

0 comments on commit 05d5d9e

Please sign in to comment.