From 76d52c3c3d5fc03b32efb4ab6b3804e17d431c1d Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Wed, 20 Jul 2022 13:25:42 -0500 Subject: [PATCH] Also allow booleans and dates as labels/values, add tests --- src/components/search.ts | 4 +- src/components/selectMultiple.ts | 67 ++++++++++++++++++-------------- src/components/selectSingle.ts | 50 ++++++++++++++++-------- src/examples/basic/index.ts | 10 ++--- src/ioSchema.ts | 36 ++++++++--------- 5 files changed, 97 insertions(+), 70 deletions(-) diff --git a/src/components/search.ts b/src/components/search.ts index 2bd6cf1..e8a9c3a 100644 --- a/src/components/search.ts +++ b/src/components/search.ts @@ -4,8 +4,10 @@ import IOError from '../classes/IOError' type RenderResultDef = | string | number + | boolean + | Date | { - label: string | number + label: string | number | boolean | Date description?: string imageUrl?: string } diff --git a/src/components/selectMultiple.ts b/src/components/selectMultiple.ts index 794be70..e2ee50b 100644 --- a/src/components/selectMultiple.ts +++ b/src/components/selectMultiple.ts @@ -1,46 +1,55 @@ import { z } from 'zod' -import { T_IO_PROPS, T_IO_RETURNS, labelValue } from '../ioSchema' +import { + T_IO_PROPS, + T_IO_RETURNS, + labelValue, + primitiveValue, +} from '../ioSchema' import Logger from '../classes/Logger' -type SelectMultipleProps