···11+import type { TextOptions } from '@clack/prompts';
22+import { text } from '@clack/prompts';
33+44+export type TextProps = TextOptions;
55+66+export function Text(props: TextProps): ReturnType<typeof text> {
77+ return text(props);
88+}
+31-22
packages/jsx/src/index.ts
···11-import type { ConfirmOptions } from '@clack/prompts';
22-import { confirm } from '@clack/prompts';
33-44-namespace JSX {
55- export interface IntrinsicElements {
66- }
77-88- export type Element = Promise<unknown>;
99-}
11+import { Confirm, type ConfirmProps } from './components/confirm.js';
22+import { Note, type NoteProps } from './components/note.js';
33+import { Option, type OptionProps } from './components/option.js';
44+import { Password, type PasswordProps } from './components/password.js';
55+import { Select, type SelectProps } from './components/select.js';
66+import { Text, type TextProps } from './components/text.js';
77+import type { JSX } from './types.js';
108119export type { JSX };
1010+export {
1111+ Confirm,
1212+ type ConfirmProps,
1313+ Note,
1414+ type NoteProps,
1515+ Text,
1616+ type TextProps,
1717+ Password,
1818+ type PasswordProps,
1919+ Option,
2020+ type OptionProps,
2121+ Select,
2222+ type SelectProps,
2323+};
12241313-export function Confirm(props: ConfirmOptions): ReturnType<typeof confirm> {
1414- return confirm(props);
2525+export function Fragment(props: { children: JSX.Element | JSX.Element[] }): JSX.Element {
2626+ return Promise.resolve(props.children);
1527}
16281729export type Component =
1818- | typeof Confirm;
3030+ | typeof Confirm
3131+ | typeof Note
3232+ | typeof Text
3333+ | typeof Password
3434+ | typeof Option
3535+ | typeof Select;
19362037function jsx<T extends keyof JSX.IntrinsicElements>(
2138 tag: T,
2239 props: JSX.IntrinsicElements[T],
2340 _key?: string
2441): JSX.Element;
2525-function jsx<T extends Component>(
2626- fn: T,
2727- props: Parameters<T>[0],
2828- _key?: string
2929-): JSX.Element;
3030-function jsx(
3131- tagOrFn: string | Component,
3232- props: unknown,
3333- _key?: string
3434-): JSX.Element {
4242+function jsx<T extends Component>(fn: T, props: Parameters<T>[0], _key?: string): JSX.Element;
4343+function jsx(tagOrFn: string | Component, props: unknown, _key?: string): JSX.Element {
3544 if (typeof tagOrFn === 'function') {
3645 return (tagOrFn as (props: unknown) => JSX.Element)(props);
3746 }
+7
packages/jsx/src/types.ts
···11+namespace JSX {
22+ export type IntrinsicElements = {};
33+44+ export type Element = Promise<unknown>;
55+}
66+77+export type { JSX };
+16
packages/jsx/src/utils.ts
···11+import type { JSX } from './types.js';
22+33+export async function resolveChildren(
44+ children: JSX.Element[] | JSX.Element | string
55+): Promise<unknown[]> {
66+ const arr = Array.isArray(children) ? children : [children];
77+ const results: unknown[] = [];
88+99+ for (const child of arr) {
1010+ const result = await child;
1111+1212+ results.push(result);
1313+ }
1414+1515+ return results;
1616+}