mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign). Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files) and align docker/Dockerfile turbo --scope/--filter to the actual remix package name @hanzo/esign (was a pre-existing mismatch with -remix that broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { useLingui } from '@lingui/react/macro';
|
|
import { createCallable } from 'react-call';
|
|
|
|
import type { TDropdownFieldMeta } from '@hanzo/esign-lib/types/field-meta';
|
|
import {
|
|
CommandDialog,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandInput,
|
|
CommandItem,
|
|
CommandList,
|
|
} from '@hanzo/esign-ui/primitives/command';
|
|
|
|
export type SignFieldDropdownDialogProps = {
|
|
fieldMeta: TDropdownFieldMeta;
|
|
};
|
|
|
|
export const SignFieldDropdownDialog = createCallable<SignFieldDropdownDialogProps, string | null>(
|
|
({ call, fieldMeta }) => {
|
|
const { t } = useLingui();
|
|
|
|
const values = fieldMeta.values?.map((value) => value.value) ?? [];
|
|
|
|
return (
|
|
<CommandDialog
|
|
position="start"
|
|
dialogContentClassName="mt-4"
|
|
open={true}
|
|
onOpenChange={(value) => (!value ? call.end(null) : null)}
|
|
>
|
|
<CommandInput placeholder={t`Select an option`} />
|
|
<CommandList>
|
|
<CommandEmpty>No results found.</CommandEmpty>
|
|
<CommandGroup heading={t`Options`}>
|
|
{values.map((value, i) => (
|
|
<CommandItem onSelect={() => call.end(value)} key={i} value={value}>
|
|
{value}
|
|
</CommandItem>
|
|
))}
|
|
</CommandGroup>
|
|
</CommandList>
|
|
</CommandDialog>
|
|
);
|
|
},
|
|
);
|