@ymjin/ui-native 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/index.cjs +547 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +219 -0
- package/dist/index.d.ts +219 -0
- package/dist/index.js +498 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/Button.tsx","../src/utils/cx.ts","../src/components/TextField.tsx","../src/components/Switch.tsx","../src/components/Checkbox.tsx","../src/components/Modal.tsx","../src/components/Badge.tsx","../src/components/Card.tsx","../src/components/Spinner.tsx","../src/components/RadioGroup.tsx","../src/components/Select.tsx","../src/components/Slider.tsx","../src/components/DatePicker.tsx","../src/components/Toast.tsx"],"sourcesContent":["/**\n * @ymjin/ui-native — React Native components styled with @ymjin/tokens\n * via NativeWind.\n *\n * Mirrors `@ymjin/ui`'s `variant`/`size` API so the mental model transfers\n * web ↔ native (events use RN's `onPress`/`onValueChange`). The styling is\n * NativeWind classes resolved through the SAME `@ymjin/tokens` Tailwind\n * preset the web build uses — so `bg-primary-500` is the same value everywhere.\n *\n * ## Setup\n *\n * ```bash\n * npm i @ymjin/ui-native @ymjin/tokens nativewind react-native\n * ```\n * ```js\n * // tailwind.config.js\n * module.exports = {\n * presets: [require(\"nativewind/preset\"), require(\"@ymjin/tokens/tailwind\")],\n * content: [\"./node_modules/@ymjin/ui-native/dist/**\\/*.js\", \"./app/**\\/*.{tsx,jsx}\"],\n * };\n * ```\n * Add `nativewind/babel` to your Babel config and import your `global.css`\n * (NativeWind v4). Then:\n *\n * ```tsx\n * import { Button, TextField, Switch } from \"@ymjin/ui-native\";\n * <Button variant=\"primary\" onPress={save}>저장</Button>\n * ```\n *\n * Phase 1: Button, TextField, Switch, Checkbox, Modal, Badge, Card, Spinner.\n * Phase 2: RadioGroup, Select, Slider, DatePicker, Toast.\n */\n\nexport { Button } from \"./components/Button.js\";\nexport type { ButtonProps, ButtonVariant, ButtonSize } from \"./components/Button.js\";\n\nexport { TextField } from \"./components/TextField.js\";\nexport type { TextFieldProps } from \"./components/TextField.js\";\n\nexport { Switch } from \"./components/Switch.js\";\nexport type { SwitchProps } from \"./components/Switch.js\";\n\nexport { Checkbox } from \"./components/Checkbox.js\";\nexport type { CheckboxProps } from \"./components/Checkbox.js\";\n\nexport { Modal } from \"./components/Modal.js\";\nexport type { ModalProps } from \"./components/Modal.js\";\n\nexport { Badge } from \"./components/Badge.js\";\nexport type { BadgeProps, BadgeVariant } from \"./components/Badge.js\";\n\nexport { Card, CardHeader, CardBody, CardFooter } from \"./components/Card.js\";\nexport type { CardProps } from \"./components/Card.js\";\n\nexport { Spinner } from \"./components/Spinner.js\";\nexport type { SpinnerProps, SpinnerSize } from \"./components/Spinner.js\";\n\n// ── Phase 2 ──────────────────────────────────────────────────────────────────\nexport { RadioGroup, Radio } from \"./components/RadioGroup.js\";\nexport type { RadioGroupProps, RadioProps } from \"./components/RadioGroup.js\";\n\nexport { Select } from \"./components/Select.js\";\nexport type { SelectProps, SelectOption } from \"./components/Select.js\";\n\nexport { Slider } from \"./components/Slider.js\";\nexport type { SliderProps } from \"./components/Slider.js\";\n\nexport { DatePicker } from \"./components/DatePicker.js\";\nexport type { DatePickerProps } from \"./components/DatePicker.js\";\n\nexport { ToastProvider, useToast } from \"./components/Toast.js\";\nexport type { ToastProviderProps, ToastOptions, ToastVariant } from \"./components/Toast.js\";\n\nexport { cx } from \"./utils/cx.js\";\n","import { Pressable, Text } from \"react-native\";\nimport type { ReactNode } from \"react\";\nimport { cx } from \"../utils/cx.js\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nconst VARIANT: Record<ButtonVariant, { container: string; text: string }> = {\n primary: { container: \"bg-primary-500 active:bg-primary-700\", text: \"text-white\" },\n secondary: { container: \"bg-neutral-100 active:bg-neutral-300\", text: \"text-neutral-900\" },\n outline: { container: \"border border-neutral-300 active:bg-neutral-100\", text: \"text-neutral-900\" },\n ghost: { container: \"active:bg-neutral-100\", text: \"text-neutral-900\" },\n danger: { container: \"bg-danger-500 active:bg-danger-700\", text: \"text-white\" },\n};\n\nconst SIZE: Record<ButtonSize, { container: string; text: string }> = {\n sm: { container: \"px-2.5 py-1\", text: \"text-sm\" },\n md: { container: \"px-4 py-2\", text: \"text-base\" },\n lg: { container: \"px-5 py-3\", text: \"text-lg\" },\n};\n\nexport interface ButtonProps {\n /** Visual style. Default: `\"primary\"`. */\n variant?: ButtonVariant;\n /** Size. Default: `\"md\"`. */\n size?: ButtonSize;\n onPress?: () => void;\n disabled?: boolean;\n /** Label text (string) or custom content. */\n children: ReactNode;\n /** Extra NativeWind classes for the container. */\n className?: string;\n}\n\n/**\n * A button (React Native `Pressable`), styled with `@ymjin/tokens` via\n * NativeWind. Same `variant`/`size` API as `@ymjin/ui` on web; uses `onPress`.\n */\nexport function Button({\n variant = \"primary\",\n size = \"md\",\n onPress,\n disabled,\n children,\n className,\n}: ButtonProps) {\n const v = VARIANT[variant];\n const s = SIZE[size];\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityState={{ disabled }}\n onPress={onPress}\n disabled={disabled}\n className={cx(\n \"flex-row items-center justify-center rounded-md\",\n v.container,\n s.container,\n disabled && \"opacity-50\",\n className,\n )}\n >\n <Text className={cx(\"font-medium\", v.text, s.text)}>{children}</Text>\n </Pressable>\n );\n}\n","/** Join truthy class-name parts with spaces (NativeWind className composition). */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n","import { Text, TextInput, View } from \"react-native\";\nimport { color } from \"@ymjin/tokens\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface TextFieldProps {\n label?: string;\n placeholder?: string;\n value?: string;\n onChangeText?: (text: string) => void;\n /** Helper text below the input. */\n description?: string;\n /** Error message; when set, renders the invalid state. */\n errorMessage?: string;\n secureTextEntry?: boolean;\n keyboardType?: \"default\" | \"email-address\" | \"numeric\" | \"phone-pad\" | \"number-pad\";\n autoCapitalize?: \"none\" | \"sentences\" | \"words\" | \"characters\";\n editable?: boolean;\n className?: string;\n}\n\n/** A labelled text input (React Native `TextInput`) with description + error slots. */\nexport function TextField({\n label,\n placeholder,\n value,\n onChangeText,\n description,\n errorMessage,\n secureTextEntry,\n keyboardType,\n autoCapitalize,\n editable,\n className,\n}: TextFieldProps) {\n const invalid = errorMessage != null;\n return (\n <View className={cx(\"gap-1.5\", className)}>\n {label != null && <Text className=\"text-sm font-medium text-neutral-800\">{label}</Text>}\n <TextInput\n value={value}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={color.neutral[400]}\n secureTextEntry={secureTextEntry}\n keyboardType={keyboardType}\n autoCapitalize={autoCapitalize}\n editable={editable}\n className={cx(\n \"rounded-md border px-3 py-2 text-base text-neutral-900\",\n invalid ? \"border-danger-500\" : \"border-neutral-300\",\n )}\n />\n {description != null && !invalid && (\n <Text className=\"text-xs text-neutral-500\">{description}</Text>\n )}\n {invalid && <Text className=\"text-xs text-danger-600\">{errorMessage}</Text>}\n </View>\n );\n}\n","import { Switch as RNSwitch, Text, View } from \"react-native\";\nimport { color } from \"@ymjin/tokens\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface SwitchProps {\n value?: boolean;\n onValueChange?: (value: boolean) => void;\n label?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * A toggle (React Native `Switch`) tinted with `@ymjin/tokens` colors —\n * importing the token JS values directly, since RN's `trackColor` needs a raw\n * color rather than a class.\n */\nexport function Switch({ value, onValueChange, label, disabled, className }: SwitchProps) {\n return (\n <View className={cx(\"flex-row items-center gap-2\", disabled && \"opacity-50\", className)}>\n <RNSwitch\n value={value}\n onValueChange={onValueChange}\n disabled={disabled}\n trackColor={{ false: color.neutral[300], true: color.primary[500] }}\n thumbColor={color.white}\n />\n {label != null && <Text className=\"text-base text-neutral-900\">{label}</Text>}\n </View>\n );\n}\n","import { Pressable, Text, View } from \"react-native\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface CheckboxProps {\n value?: boolean;\n onValueChange?: (value: boolean) => void;\n label?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/** A checkbox (React Native `Pressable` + custom box) with a token-styled indicator. */\nexport function Checkbox({ value, onValueChange, label, disabled, className }: CheckboxProps) {\n return (\n <Pressable\n accessibilityRole=\"checkbox\"\n accessibilityState={{ checked: value, disabled }}\n onPress={() => onValueChange?.(!value)}\n disabled={disabled}\n className={cx(\"flex-row items-center gap-2\", disabled && \"opacity-50\", className)}\n >\n <View\n className={cx(\n \"h-5 w-5 items-center justify-center rounded border-2\",\n value ? \"border-primary-500 bg-primary-500\" : \"border-neutral-300 bg-white\",\n )}\n >\n {value && <Text className=\"text-xs text-white\">✓</Text>}\n </View>\n {label != null && <Text className=\"text-base text-neutral-900\">{label}</Text>}\n </Pressable>\n );\n}\n","import { Modal as RNModal, Pressable, Text, View } from \"react-native\";\nimport type { ReactNode } from \"react\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface ModalProps {\n visible: boolean;\n /** Called on backdrop tap or hardware back. */\n onClose: () => void;\n title?: string;\n children: ReactNode;\n /** Extra NativeWind classes for the dialog surface. */\n className?: string;\n}\n\n/**\n * A centered modal dialog (React Native `Modal`) with a dimmed backdrop.\n * Tapping the backdrop closes it; tapping the surface does not.\n */\nexport function Modal({ visible, onClose, title, children, className }: ModalProps) {\n return (\n <RNModal visible={visible} transparent animationType=\"fade\" onRequestClose={onClose}>\n <Pressable onPress={onClose} className=\"flex-1 items-center justify-center bg-black/40 p-4\">\n {/* Absorb taps so they don't reach the backdrop. */}\n <Pressable\n onPress={() => undefined}\n className={cx(\"w-full max-w-md rounded-xl bg-white p-6\", className)}\n >\n {title != null && (\n <Text className=\"mb-3 text-xl font-semibold text-neutral-900\">{title}</Text>\n )}\n <View>{children}</View>\n </Pressable>\n </Pressable>\n </RNModal>\n );\n}\n","import { Text, View } from \"react-native\";\nimport type { ReactNode } from \"react\";\nimport { cx } from \"../utils/cx.js\";\n\nexport type BadgeVariant = \"neutral\" | \"primary\" | \"success\" | \"warning\" | \"danger\";\n\nconst CONTAINER: Record<BadgeVariant, string> = {\n neutral: \"bg-neutral-100\",\n primary: \"bg-primary-100\",\n success: \"bg-success-100\",\n warning: \"bg-warning-100\",\n danger: \"bg-danger-100\",\n};\n\nconst TEXT: Record<BadgeVariant, string> = {\n neutral: \"text-neutral-700\",\n primary: \"text-primary-700\",\n success: \"text-success-700\",\n warning: \"text-warning-700\",\n danger: \"text-danger-700\",\n};\n\nexport interface BadgeProps {\n variant?: BadgeVariant;\n children: ReactNode;\n className?: string;\n}\n\n/** A small status pill (React Native), styled with `@ymjin/tokens`. */\nexport function Badge({ variant = \"neutral\", children, className }: BadgeProps) {\n return (\n <View className={cx(\"self-start rounded-full px-2 py-0.5\", CONTAINER[variant], className)}>\n <Text className={cx(\"text-xs font-medium\", TEXT[variant])}>{children}</Text>\n </View>\n );\n}\n","import { View } from \"react-native\";\nimport type { ReactNode } from \"react\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface CardProps {\n children: ReactNode;\n className?: string;\n}\n\n/** A surface container with token-based radius, border, and padding. */\nexport function Card({ children, className }: CardProps) {\n return (\n <View className={cx(\"overflow-hidden rounded-lg border border-neutral-200 bg-white\", className)}>\n {children}\n </View>\n );\n}\n\n/** Optional header region for a {@link Card}. */\nexport function CardHeader({ children, className }: CardProps) {\n return (\n <View className={cx(\"border-b border-neutral-100 px-5 py-4\", className)}>{children}</View>\n );\n}\n\n/** Main content region for a {@link Card}. */\nexport function CardBody({ children, className }: CardProps) {\n return <View className={cx(\"p-5\", className)}>{children}</View>;\n}\n\n/** Optional footer region for a {@link Card}. */\nexport function CardFooter({ children, className }: CardProps) {\n return (\n <View className={cx(\"border-t border-neutral-100 px-5 py-4\", className)}>{children}</View>\n );\n}\n","import { ActivityIndicator } from \"react-native\";\nimport { color } from \"@ymjin/tokens\";\n\nexport type SpinnerSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface SpinnerProps {\n /** Size preset. Default: `\"md\"`. */\n size?: SpinnerSize;\n /** Override the spinner color (defaults to the primary token). */\n color?: string;\n className?: string;\n}\n\n/** An indeterminate loading spinner (React Native `ActivityIndicator`). */\nexport function Spinner({ size = \"md\", color: tint, className }: SpinnerProps) {\n return (\n <ActivityIndicator\n size={size === \"lg\" ? \"large\" : \"small\"}\n color={tint ?? color.primary[500]}\n className={className}\n />\n );\n}\n","import { createContext, useContext, type ReactNode } from \"react\";\nimport { Pressable, Text, View } from \"react-native\";\nimport { cx } from \"../utils/cx.js\";\n\ninterface RadioContextValue {\n value?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n}\nconst RadioContext = createContext<RadioContextValue>({});\n\nexport interface RadioGroupProps {\n value?: string;\n onValueChange?: (value: string) => void;\n label?: string;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** A group of radio options. Compose with `Radio` children. */\nexport function RadioGroup({\n value,\n onValueChange,\n label,\n disabled,\n children,\n className,\n}: RadioGroupProps) {\n return (\n <View className={cx(\"gap-1.5\", className)}>\n {label != null && <Text className=\"text-sm font-medium text-neutral-800\">{label}</Text>}\n <RadioContext.Provider value={{ value, onChange: onValueChange, disabled }}>\n <View className=\"gap-2\">{children}</View>\n </RadioContext.Provider>\n </View>\n );\n}\n\nexport interface RadioProps {\n value: string;\n label?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/** A single radio option inside a {@link RadioGroup}. */\nexport function Radio({ value, label, disabled, className }: RadioProps) {\n const ctx = useContext(RadioContext);\n const selected = ctx.value === value;\n const isDisabled = disabled || ctx.disabled;\n return (\n <Pressable\n accessibilityRole=\"radio\"\n accessibilityState={{ selected, disabled: isDisabled }}\n onPress={() => ctx.onChange?.(value)}\n disabled={isDisabled}\n className={cx(\"flex-row items-center gap-2\", isDisabled && \"opacity-50\", className)}\n >\n <View\n className={cx(\n \"h-5 w-5 items-center justify-center rounded-full border-2\",\n selected ? \"border-primary-500\" : \"border-neutral-300\",\n )}\n >\n {selected && <View className=\"h-2.5 w-2.5 rounded-full bg-primary-500\" />}\n </View>\n {label != null && <Text className=\"text-base text-neutral-900\">{label}</Text>}\n </Pressable>\n );\n}\n","import { useState } from \"react\";\nimport { Pressable, Text, View } from \"react-native\";\nimport { cx } from \"../utils/cx.js\";\nimport { Modal } from \"./Modal.js\";\n\nexport interface SelectOption {\n label: string;\n value: string;\n}\n\nexport interface SelectProps {\n label?: string;\n placeholder?: string;\n value?: string;\n onValueChange?: (value: string) => void;\n options: SelectOption[];\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * A select built from a token-styled trigger + a `Modal` option list (pure RN,\n * no native picker) — so it looks identical on iOS and Android, matching the\n * web `Select`.\n */\nexport function Select({\n label,\n placeholder = \"선택하세요\",\n value,\n onValueChange,\n options,\n disabled,\n className,\n}: SelectProps) {\n const [open, setOpen] = useState(false);\n const selected = options.find((o) => o.value === value);\n\n return (\n <View className={cx(\"gap-1.5\", className)}>\n {label != null && <Text className=\"text-sm font-medium text-neutral-800\">{label}</Text>}\n <Pressable\n accessibilityRole=\"button\"\n onPress={() => setOpen(true)}\n disabled={disabled}\n className={cx(\n \"flex-row items-center justify-between rounded-md border border-neutral-300 bg-white px-3 py-2\",\n disabled && \"opacity-50\",\n )}\n >\n <Text className={cx(\"text-base\", selected ? \"text-neutral-900\" : \"text-neutral-400\")}>\n {selected ? selected.label : placeholder}\n </Text>\n <Text className=\"text-neutral-500\">▾</Text>\n </Pressable>\n\n <Modal visible={open} onClose={() => setOpen(false)} title={label}>\n <View className=\"gap-1\">\n {options.map((o) => {\n const isSelected = o.value === value;\n return (\n <Pressable\n key={o.value}\n onPress={() => {\n onValueChange?.(o.value);\n setOpen(false);\n }}\n className={cx(\"rounded px-2 py-3\", isSelected && \"bg-primary-50\")}\n >\n <Text\n className={cx(\n \"text-base\",\n isSelected ? \"text-primary-700\" : \"text-neutral-900\",\n )}\n >\n {o.label}\n </Text>\n </Pressable>\n );\n })}\n </View>\n </Modal>\n </View>\n );\n}\n","import RNSlider from \"@react-native-community/slider\";\nimport { Text, View } from \"react-native\";\nimport { color } from \"@ymjin/tokens\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface SliderProps {\n value?: number;\n onValueChange?: (value: number) => void;\n minimumValue?: number;\n maximumValue?: number;\n step?: number;\n label?: string;\n /** Show the current value next to the label. Default: true. */\n showValue?: boolean;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * A range slider wrapping `@react-native-community/slider`, tinted with\n * `@ymjin/tokens` colors. Requires that package as a peer dependency.\n */\nexport function Slider({\n value,\n onValueChange,\n minimumValue = 0,\n maximumValue = 100,\n step,\n label,\n showValue = true,\n disabled,\n className,\n}: SliderProps) {\n return (\n <View className={cx(\"gap-2\", className)}>\n {(label != null || showValue) && (\n <View className=\"flex-row items-center justify-between\">\n {label != null ? (\n <Text className=\"text-sm font-medium text-neutral-800\">{label}</Text>\n ) : (\n <View />\n )}\n {showValue && value != null && (\n <Text className=\"text-sm text-neutral-600\">{value}</Text>\n )}\n </View>\n )}\n <RNSlider\n value={value}\n onValueChange={onValueChange}\n minimumValue={minimumValue}\n maximumValue={maximumValue}\n step={step}\n disabled={disabled}\n minimumTrackTintColor={color.primary[500]}\n maximumTrackTintColor={color.neutral[200]}\n thumbTintColor={color.primary[500]}\n />\n </View>\n );\n}\n","import { useState } from \"react\";\nimport DateTimePicker from \"@react-native-community/datetimepicker\";\nimport { Platform, Pressable, Text, View } from \"react-native\";\nimport { cx } from \"../utils/cx.js\";\n\nexport interface DatePickerProps {\n label?: string;\n value?: Date;\n onChange?: (date: Date) => void;\n /** `\"date\"` (default), `\"time\"`, or `\"datetime\"`. */\n mode?: \"date\" | \"time\" | \"datetime\";\n placeholder?: string;\n minimumDate?: Date;\n maximumDate?: Date;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * A date/time picker wrapping `@react-native-community/datetimepicker` — the\n * platform-native wheel (iOS) / dialog (Android), which is the preferred mobile\n * date UX. Requires that package as a peer dependency.\n */\nexport function DatePicker({\n label,\n value,\n onChange,\n mode = \"date\",\n placeholder = \"날짜 선택\",\n minimumDate,\n maximumDate,\n disabled,\n className,\n}: DatePickerProps) {\n const [show, setShow] = useState(false);\n\n return (\n <View className={cx(\"gap-1.5\", className)}>\n {label != null && <Text className=\"text-sm font-medium text-neutral-800\">{label}</Text>}\n <Pressable\n accessibilityRole=\"button\"\n onPress={() => setShow(true)}\n disabled={disabled}\n className={cx(\n \"rounded-md border border-neutral-300 bg-white px-3 py-2\",\n disabled && \"opacity-50\",\n )}\n >\n <Text className={cx(\"text-base\", value ? \"text-neutral-900\" : \"text-neutral-400\")}>\n {value ? formatDate(value, mode) : placeholder}\n </Text>\n </Pressable>\n {show && (\n <DateTimePicker\n value={value ?? new Date()}\n mode={mode}\n minimumDate={minimumDate}\n maximumDate={maximumDate}\n onChange={(event, date) => {\n // Android dismisses on selection; iOS stays inline.\n setShow(Platform.OS === \"ios\");\n if (event.type !== \"dismissed\" && date) onChange?.(date);\n }}\n />\n )}\n </View>\n );\n}\n\nfunction formatDate(d: Date, mode: \"date\" | \"time\" | \"datetime\"): string {\n const pad = (n: number) => String(n).padStart(2, \"0\");\n const date = `${d.getFullYear()}.${pad(d.getMonth() + 1)}.${pad(d.getDate())}`;\n const time = `${pad(d.getHours())}:${pad(d.getMinutes())}`;\n if (mode === \"time\") return time;\n if (mode === \"datetime\") return `${date} ${time}`;\n return date;\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { Text, View } from \"react-native\";\nimport { cx } from \"../utils/cx.js\";\n\nexport type ToastVariant = \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ToastOptions {\n title?: string;\n description?: string;\n variant?: ToastVariant;\n /** Override the provider's auto-dismiss duration (ms). 0 disables. */\n duration?: number;\n}\n\ninterface ToastItem extends Required<Pick<ToastOptions, \"variant\">> {\n id: string;\n title?: string;\n description?: string;\n}\n\ninterface ToastContextValue {\n toast: (options: ToastOptions | string) => string;\n dismiss: (id: string) => void;\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null);\n\nconst BORDER: Record<ToastVariant, string> = {\n info: \"border-l-primary-500\",\n success: \"border-l-success-500\",\n warning: \"border-l-warning-500\",\n danger: \"border-l-danger-500\",\n};\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** Auto-dismiss after this many ms. 0 disables. Default: 4000. */\n duration?: number;\n}\n\n/**\n * Provides a toast queue. RN has no portal, so the overlay renders as an\n * absolutely-positioned `View` within the provider — mount it near your app\n * root so toasts float above the screen.\n */\nexport function ToastProvider({ children, duration = 4000 }: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastItem[]>([]);\n const seq = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n setToasts((list) => list.filter((t) => t.id !== id));\n }, []);\n\n const toast = useCallback(\n (options: ToastOptions | string) => {\n const opts: ToastOptions = typeof options === \"string\" ? { description: options } : options;\n seq.current += 1;\n const id = `kf-toast-${seq.current}`;\n setToasts((list) => [\n ...list,\n { id, title: opts.title, description: opts.description, variant: opts.variant ?? \"info\" },\n ]);\n const ms = opts.duration ?? duration;\n if (ms > 0) setTimeout(() => dismiss(id), ms);\n return id;\n },\n [duration, dismiss],\n );\n\n return (\n <ToastContext.Provider value={{ toast, dismiss }}>\n {children}\n <View pointerEvents=\"box-none\" className=\"absolute inset-x-0 bottom-0 gap-2 p-4\">\n {toasts.map((t) => (\n <View\n key={t.id}\n accessibilityRole=\"alert\"\n className={cx(\n \"rounded-lg border border-neutral-200 border-l-4 bg-white px-4 py-3\",\n BORDER[t.variant],\n )}\n >\n {t.title != null && (\n <Text className=\"text-sm font-semibold text-neutral-900\">{t.title}</Text>\n )}\n {t.description != null && (\n <Text className=\"text-sm text-neutral-600\">{t.description}</Text>\n )}\n </View>\n ))}\n </View>\n </ToastContext.Provider>\n );\n}\n\n/** Access the toast queue. Must be used inside a {@link ToastProvider}. */\nexport function useToast(): ToastContextValue {\n const ctx = useContext(ToastContext);\n if (!ctx) {\n throw new Error(\"[@ymjin/ui-native] useToast must be used inside a <ToastProvider>.\");\n }\n return ctx;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;;;ACCzB,SAAS,MAAM,OAAyD;AAC7E,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;;;AD2DM;AAvDN,IAAM,UAAsE;AAAA,EAC1E,SAAS,EAAE,WAAW,wCAAwC,MAAM,aAAa;AAAA,EACjF,WAAW,EAAE,WAAW,wCAAwC,MAAM,mBAAmB;AAAA,EACzF,SAAS,EAAE,WAAW,mDAAmD,MAAM,mBAAmB;AAAA,EAClG,OAAO,EAAE,WAAW,yBAAyB,MAAM,mBAAmB;AAAA,EACtE,QAAQ,EAAE,WAAW,sCAAsC,MAAM,aAAa;AAChF;AAEA,IAAM,OAAgE;AAAA,EACpE,IAAI,EAAE,WAAW,eAAe,MAAM,UAAU;AAAA,EAChD,IAAI,EAAE,WAAW,aAAa,MAAM,YAAY;AAAA,EAChD,IAAI,EAAE,WAAW,aAAa,MAAM,UAAU;AAChD;AAmBO,SAAS,OAAO;AAAA,EACrB,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgB;AACd,QAAM,IAAI,QAAQ,OAAO;AACzB,QAAM,IAAI,KAAK,IAAI;AACnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,mBAAkB;AAAA,MAClB,oBAAoB,EAAE,SAAS;AAAA,MAC/B;AAAA,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,EACrD,GAAG,CAAC,CAAC;AAEL,QAAM,YAAQ;AAAA,IACZ,CAAC,YAAmC;AAClC,YAAM,OAAqB,OAAO,YAAY,WAAW,EAAE,aAAa,QAAQ,IAAI;AACpF,UAAI,WAAW;AACf,YAAM,KAAK,YAAY,IAAI,OAAO;AAClC,gBAAU,CAAC,SAAS;AAAA,QAClB,GAAG;AAAA,QACH,EAAE,IAAI,OAAO,KAAK,OAAO,aAAa,KAAK,aAAa,SAAS,KAAK,WAAW,OAAO;AAAA,MAC1F,CAAC;AACD,YAAM,KAAK,KAAK,YAAY;AAC5B,UAAI,KAAK,EAAG,YAAW,MAAM,QAAQ,EAAE,GAAG,EAAE;AAC5C,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,OAAO;AAAA,EACpB;AAEA,SACE,+CAAC,aAAa,UAAb,EAAsB,OAAO,EAAE,OAAO,QAAQ,GAC5C;AAAA;AAAA,IACD,8CAAC,8BAAK,eAAc,YAAW,WAAU,yCACtC,iBAAO,IAAI,CAAC,MACX;AAAA,MAAC;AAAA;AAAA,QAEC,mBAAkB;AAAA,QAClB,WAAW;AAAA,UACT;AAAA,UACA,OAAO,EAAE,OAAO;AAAA,QAClB;AAAA,QAEC;AAAA,YAAE,SAAS,QACV,8CAAC,8BAAK,WAAU,0CAA0C,YAAE,OAAM;AAAA,UAEnE,EAAE,eAAe,QAChB,8CAAC,8BAAK,WAAU,4BAA4B,YAAE,aAAY;AAAA;AAAA;AAAA,MAXvD,EAAE;AAAA,IAaT,CACD,GACH;AAAA,KACF;AAEJ;AAGO,SAAS,WAA8B;AAC5C,QAAM,UAAM,0BAAW,YAAY;AACnC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AACA,SAAO;AACT;","names":["import_react_native","import_jsx_runtime","import_react_native","import_tokens","import_jsx_runtime","RNSwitch","import_react_native","import_jsx_runtime","import_react_native","import_jsx_runtime","RNModal","import_react_native","import_jsx_runtime","import_react_native","import_jsx_runtime","import_react_native","import_tokens","import_jsx_runtime","import_react_native","import_jsx_runtime","import_react","import_react_native","import_jsx_runtime","import_react_native","import_tokens","import_jsx_runtime","RNSlider","import_react","import_react_native","import_jsx_runtime","DateTimePicker","import_react","import_react_native","import_jsx_runtime"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
5
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
/** Visual style. Default: `"primary"`. */
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
/** Size. Default: `"md"`. */
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Label text (string) or custom content. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Extra NativeWind classes for the container. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A button (React Native `Pressable`), styled with `@ymjin/tokens` via
|
|
20
|
+
* NativeWind. Same `variant`/`size` API as `@ymjin/ui` on web; uses `onPress`.
|
|
21
|
+
*/
|
|
22
|
+
declare function Button({ variant, size, onPress, disabled, children, className, }: ButtonProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
interface TextFieldProps {
|
|
25
|
+
label?: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
onChangeText?: (text: string) => void;
|
|
29
|
+
/** Helper text below the input. */
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Error message; when set, renders the invalid state. */
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
secureTextEntry?: boolean;
|
|
34
|
+
keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "number-pad";
|
|
35
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters";
|
|
36
|
+
editable?: boolean;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A labelled text input (React Native `TextInput`) with description + error slots. */
|
|
40
|
+
declare function TextField({ label, placeholder, value, onChangeText, description, errorMessage, secureTextEntry, keyboardType, autoCapitalize, editable, className, }: TextFieldProps): react.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface SwitchProps {
|
|
43
|
+
value?: boolean;
|
|
44
|
+
onValueChange?: (value: boolean) => void;
|
|
45
|
+
label?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A toggle (React Native `Switch`) tinted with `@ymjin/tokens` colors —
|
|
51
|
+
* importing the token JS values directly, since RN's `trackColor` needs a raw
|
|
52
|
+
* color rather than a class.
|
|
53
|
+
*/
|
|
54
|
+
declare function Switch({ value, onValueChange, label, disabled, className }: SwitchProps): react.JSX.Element;
|
|
55
|
+
|
|
56
|
+
interface CheckboxProps {
|
|
57
|
+
value?: boolean;
|
|
58
|
+
onValueChange?: (value: boolean) => void;
|
|
59
|
+
label?: string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
/** A checkbox (React Native `Pressable` + custom box) with a token-styled indicator. */
|
|
64
|
+
declare function Checkbox({ value, onValueChange, label, disabled, className }: CheckboxProps): react.JSX.Element;
|
|
65
|
+
|
|
66
|
+
interface ModalProps {
|
|
67
|
+
visible: boolean;
|
|
68
|
+
/** Called on backdrop tap or hardware back. */
|
|
69
|
+
onClose: () => void;
|
|
70
|
+
title?: string;
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
/** Extra NativeWind classes for the dialog surface. */
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A centered modal dialog (React Native `Modal`) with a dimmed backdrop.
|
|
77
|
+
* Tapping the backdrop closes it; tapping the surface does not.
|
|
78
|
+
*/
|
|
79
|
+
declare function Modal({ visible, onClose, title, children, className }: ModalProps): react.JSX.Element;
|
|
80
|
+
|
|
81
|
+
type BadgeVariant = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
82
|
+
interface BadgeProps {
|
|
83
|
+
variant?: BadgeVariant;
|
|
84
|
+
children: ReactNode;
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/** A small status pill (React Native), styled with `@ymjin/tokens`. */
|
|
88
|
+
declare function Badge({ variant, children, className }: BadgeProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
interface CardProps {
|
|
91
|
+
children: ReactNode;
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
/** A surface container with token-based radius, border, and padding. */
|
|
95
|
+
declare function Card({ children, className }: CardProps): react.JSX.Element;
|
|
96
|
+
/** Optional header region for a {@link Card}. */
|
|
97
|
+
declare function CardHeader({ children, className }: CardProps): react.JSX.Element;
|
|
98
|
+
/** Main content region for a {@link Card}. */
|
|
99
|
+
declare function CardBody({ children, className }: CardProps): react.JSX.Element;
|
|
100
|
+
/** Optional footer region for a {@link Card}. */
|
|
101
|
+
declare function CardFooter({ children, className }: CardProps): react.JSX.Element;
|
|
102
|
+
|
|
103
|
+
type SpinnerSize = "sm" | "md" | "lg";
|
|
104
|
+
interface SpinnerProps {
|
|
105
|
+
/** Size preset. Default: `"md"`. */
|
|
106
|
+
size?: SpinnerSize;
|
|
107
|
+
/** Override the spinner color (defaults to the primary token). */
|
|
108
|
+
color?: string;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
/** An indeterminate loading spinner (React Native `ActivityIndicator`). */
|
|
112
|
+
declare function Spinner({ size, color: tint, className }: SpinnerProps): react.JSX.Element;
|
|
113
|
+
|
|
114
|
+
interface RadioGroupProps {
|
|
115
|
+
value?: string;
|
|
116
|
+
onValueChange?: (value: string) => void;
|
|
117
|
+
label?: string;
|
|
118
|
+
disabled?: boolean;
|
|
119
|
+
children: ReactNode;
|
|
120
|
+
className?: string;
|
|
121
|
+
}
|
|
122
|
+
/** A group of radio options. Compose with `Radio` children. */
|
|
123
|
+
declare function RadioGroup({ value, onValueChange, label, disabled, children, className, }: RadioGroupProps): react.JSX.Element;
|
|
124
|
+
interface RadioProps {
|
|
125
|
+
value: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
className?: string;
|
|
129
|
+
}
|
|
130
|
+
/** A single radio option inside a {@link RadioGroup}. */
|
|
131
|
+
declare function Radio({ value, label, disabled, className }: RadioProps): react.JSX.Element;
|
|
132
|
+
|
|
133
|
+
interface SelectOption {
|
|
134
|
+
label: string;
|
|
135
|
+
value: string;
|
|
136
|
+
}
|
|
137
|
+
interface SelectProps {
|
|
138
|
+
label?: string;
|
|
139
|
+
placeholder?: string;
|
|
140
|
+
value?: string;
|
|
141
|
+
onValueChange?: (value: string) => void;
|
|
142
|
+
options: SelectOption[];
|
|
143
|
+
disabled?: boolean;
|
|
144
|
+
className?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A select built from a token-styled trigger + a `Modal` option list (pure RN,
|
|
148
|
+
* no native picker) — so it looks identical on iOS and Android, matching the
|
|
149
|
+
* web `Select`.
|
|
150
|
+
*/
|
|
151
|
+
declare function Select({ label, placeholder, value, onValueChange, options, disabled, className, }: SelectProps): react.JSX.Element;
|
|
152
|
+
|
|
153
|
+
interface SliderProps {
|
|
154
|
+
value?: number;
|
|
155
|
+
onValueChange?: (value: number) => void;
|
|
156
|
+
minimumValue?: number;
|
|
157
|
+
maximumValue?: number;
|
|
158
|
+
step?: number;
|
|
159
|
+
label?: string;
|
|
160
|
+
/** Show the current value next to the label. Default: true. */
|
|
161
|
+
showValue?: boolean;
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A range slider wrapping `@react-native-community/slider`, tinted with
|
|
167
|
+
* `@ymjin/tokens` colors. Requires that package as a peer dependency.
|
|
168
|
+
*/
|
|
169
|
+
declare function Slider({ value, onValueChange, minimumValue, maximumValue, step, label, showValue, disabled, className, }: SliderProps): react.JSX.Element;
|
|
170
|
+
|
|
171
|
+
interface DatePickerProps {
|
|
172
|
+
label?: string;
|
|
173
|
+
value?: Date;
|
|
174
|
+
onChange?: (date: Date) => void;
|
|
175
|
+
/** `"date"` (default), `"time"`, or `"datetime"`. */
|
|
176
|
+
mode?: "date" | "time" | "datetime";
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
minimumDate?: Date;
|
|
179
|
+
maximumDate?: Date;
|
|
180
|
+
disabled?: boolean;
|
|
181
|
+
className?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A date/time picker wrapping `@react-native-community/datetimepicker` — the
|
|
185
|
+
* platform-native wheel (iOS) / dialog (Android), which is the preferred mobile
|
|
186
|
+
* date UX. Requires that package as a peer dependency.
|
|
187
|
+
*/
|
|
188
|
+
declare function DatePicker({ label, value, onChange, mode, placeholder, minimumDate, maximumDate, disabled, className, }: DatePickerProps): react.JSX.Element;
|
|
189
|
+
|
|
190
|
+
type ToastVariant = "info" | "success" | "warning" | "danger";
|
|
191
|
+
interface ToastOptions {
|
|
192
|
+
title?: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
variant?: ToastVariant;
|
|
195
|
+
/** Override the provider's auto-dismiss duration (ms). 0 disables. */
|
|
196
|
+
duration?: number;
|
|
197
|
+
}
|
|
198
|
+
interface ToastContextValue {
|
|
199
|
+
toast: (options: ToastOptions | string) => string;
|
|
200
|
+
dismiss: (id: string) => void;
|
|
201
|
+
}
|
|
202
|
+
interface ToastProviderProps {
|
|
203
|
+
children: ReactNode;
|
|
204
|
+
/** Auto-dismiss after this many ms. 0 disables. Default: 4000. */
|
|
205
|
+
duration?: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Provides a toast queue. RN has no portal, so the overlay renders as an
|
|
209
|
+
* absolutely-positioned `View` within the provider — mount it near your app
|
|
210
|
+
* root so toasts float above the screen.
|
|
211
|
+
*/
|
|
212
|
+
declare function ToastProvider({ children, duration }: ToastProviderProps): react.JSX.Element;
|
|
213
|
+
/** Access the toast queue. Must be used inside a {@link ToastProvider}. */
|
|
214
|
+
declare function useToast(): ToastContextValue;
|
|
215
|
+
|
|
216
|
+
/** Join truthy class-name parts with spaces (NativeWind className composition). */
|
|
217
|
+
declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
218
|
+
|
|
219
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardBody, CardFooter, CardHeader, type CardProps, Checkbox, type CheckboxProps, DatePicker, type DatePickerProps, Modal, type ModalProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectOption, type SelectProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, TextField, type TextFieldProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastVariant, cx, useToast };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
5
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
/** Visual style. Default: `"primary"`. */
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
/** Size. Default: `"md"`. */
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Label text (string) or custom content. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Extra NativeWind classes for the container. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A button (React Native `Pressable`), styled with `@ymjin/tokens` via
|
|
20
|
+
* NativeWind. Same `variant`/`size` API as `@ymjin/ui` on web; uses `onPress`.
|
|
21
|
+
*/
|
|
22
|
+
declare function Button({ variant, size, onPress, disabled, children, className, }: ButtonProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
interface TextFieldProps {
|
|
25
|
+
label?: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
onChangeText?: (text: string) => void;
|
|
29
|
+
/** Helper text below the input. */
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Error message; when set, renders the invalid state. */
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
secureTextEntry?: boolean;
|
|
34
|
+
keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "number-pad";
|
|
35
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters";
|
|
36
|
+
editable?: boolean;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A labelled text input (React Native `TextInput`) with description + error slots. */
|
|
40
|
+
declare function TextField({ label, placeholder, value, onChangeText, description, errorMessage, secureTextEntry, keyboardType, autoCapitalize, editable, className, }: TextFieldProps): react.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface SwitchProps {
|
|
43
|
+
value?: boolean;
|
|
44
|
+
onValueChange?: (value: boolean) => void;
|
|
45
|
+
label?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A toggle (React Native `Switch`) tinted with `@ymjin/tokens` colors —
|
|
51
|
+
* importing the token JS values directly, since RN's `trackColor` needs a raw
|
|
52
|
+
* color rather than a class.
|
|
53
|
+
*/
|
|
54
|
+
declare function Switch({ value, onValueChange, label, disabled, className }: SwitchProps): react.JSX.Element;
|
|
55
|
+
|
|
56
|
+
interface CheckboxProps {
|
|
57
|
+
value?: boolean;
|
|
58
|
+
onValueChange?: (value: boolean) => void;
|
|
59
|
+
label?: string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
/** A checkbox (React Native `Pressable` + custom box) with a token-styled indicator. */
|
|
64
|
+
declare function Checkbox({ value, onValueChange, label, disabled, className }: CheckboxProps): react.JSX.Element;
|
|
65
|
+
|
|
66
|
+
interface ModalProps {
|
|
67
|
+
visible: boolean;
|
|
68
|
+
/** Called on backdrop tap or hardware back. */
|
|
69
|
+
onClose: () => void;
|
|
70
|
+
title?: string;
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
/** Extra NativeWind classes for the dialog surface. */
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A centered modal dialog (React Native `Modal`) with a dimmed backdrop.
|
|
77
|
+
* Tapping the backdrop closes it; tapping the surface does not.
|
|
78
|
+
*/
|
|
79
|
+
declare function Modal({ visible, onClose, title, children, className }: ModalProps): react.JSX.Element;
|
|
80
|
+
|
|
81
|
+
type BadgeVariant = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
82
|
+
interface BadgeProps {
|
|
83
|
+
variant?: BadgeVariant;
|
|
84
|
+
children: ReactNode;
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/** A small status pill (React Native), styled with `@ymjin/tokens`. */
|
|
88
|
+
declare function Badge({ variant, children, className }: BadgeProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
interface CardProps {
|
|
91
|
+
children: ReactNode;
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
/** A surface container with token-based radius, border, and padding. */
|
|
95
|
+
declare function Card({ children, className }: CardProps): react.JSX.Element;
|
|
96
|
+
/** Optional header region for a {@link Card}. */
|
|
97
|
+
declare function CardHeader({ children, className }: CardProps): react.JSX.Element;
|
|
98
|
+
/** Main content region for a {@link Card}. */
|
|
99
|
+
declare function CardBody({ children, className }: CardProps): react.JSX.Element;
|
|
100
|
+
/** Optional footer region for a {@link Card}. */
|
|
101
|
+
declare function CardFooter({ children, className }: CardProps): react.JSX.Element;
|
|
102
|
+
|
|
103
|
+
type SpinnerSize = "sm" | "md" | "lg";
|
|
104
|
+
interface SpinnerProps {
|
|
105
|
+
/** Size preset. Default: `"md"`. */
|
|
106
|
+
size?: SpinnerSize;
|
|
107
|
+
/** Override the spinner color (defaults to the primary token). */
|
|
108
|
+
color?: string;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
/** An indeterminate loading spinner (React Native `ActivityIndicator`). */
|
|
112
|
+
declare function Spinner({ size, color: tint, className }: SpinnerProps): react.JSX.Element;
|
|
113
|
+
|
|
114
|
+
interface RadioGroupProps {
|
|
115
|
+
value?: string;
|
|
116
|
+
onValueChange?: (value: string) => void;
|
|
117
|
+
label?: string;
|
|
118
|
+
disabled?: boolean;
|
|
119
|
+
children: ReactNode;
|
|
120
|
+
className?: string;
|
|
121
|
+
}
|
|
122
|
+
/** A group of radio options. Compose with `Radio` children. */
|
|
123
|
+
declare function RadioGroup({ value, onValueChange, label, disabled, children, className, }: RadioGroupProps): react.JSX.Element;
|
|
124
|
+
interface RadioProps {
|
|
125
|
+
value: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
className?: string;
|
|
129
|
+
}
|
|
130
|
+
/** A single radio option inside a {@link RadioGroup}. */
|
|
131
|
+
declare function Radio({ value, label, disabled, className }: RadioProps): react.JSX.Element;
|
|
132
|
+
|
|
133
|
+
interface SelectOption {
|
|
134
|
+
label: string;
|
|
135
|
+
value: string;
|
|
136
|
+
}
|
|
137
|
+
interface SelectProps {
|
|
138
|
+
label?: string;
|
|
139
|
+
placeholder?: string;
|
|
140
|
+
value?: string;
|
|
141
|
+
onValueChange?: (value: string) => void;
|
|
142
|
+
options: SelectOption[];
|
|
143
|
+
disabled?: boolean;
|
|
144
|
+
className?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A select built from a token-styled trigger + a `Modal` option list (pure RN,
|
|
148
|
+
* no native picker) — so it looks identical on iOS and Android, matching the
|
|
149
|
+
* web `Select`.
|
|
150
|
+
*/
|
|
151
|
+
declare function Select({ label, placeholder, value, onValueChange, options, disabled, className, }: SelectProps): react.JSX.Element;
|
|
152
|
+
|
|
153
|
+
interface SliderProps {
|
|
154
|
+
value?: number;
|
|
155
|
+
onValueChange?: (value: number) => void;
|
|
156
|
+
minimumValue?: number;
|
|
157
|
+
maximumValue?: number;
|
|
158
|
+
step?: number;
|
|
159
|
+
label?: string;
|
|
160
|
+
/** Show the current value next to the label. Default: true. */
|
|
161
|
+
showValue?: boolean;
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A range slider wrapping `@react-native-community/slider`, tinted with
|
|
167
|
+
* `@ymjin/tokens` colors. Requires that package as a peer dependency.
|
|
168
|
+
*/
|
|
169
|
+
declare function Slider({ value, onValueChange, minimumValue, maximumValue, step, label, showValue, disabled, className, }: SliderProps): react.JSX.Element;
|
|
170
|
+
|
|
171
|
+
interface DatePickerProps {
|
|
172
|
+
label?: string;
|
|
173
|
+
value?: Date;
|
|
174
|
+
onChange?: (date: Date) => void;
|
|
175
|
+
/** `"date"` (default), `"time"`, or `"datetime"`. */
|
|
176
|
+
mode?: "date" | "time" | "datetime";
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
minimumDate?: Date;
|
|
179
|
+
maximumDate?: Date;
|
|
180
|
+
disabled?: boolean;
|
|
181
|
+
className?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A date/time picker wrapping `@react-native-community/datetimepicker` — the
|
|
185
|
+
* platform-native wheel (iOS) / dialog (Android), which is the preferred mobile
|
|
186
|
+
* date UX. Requires that package as a peer dependency.
|
|
187
|
+
*/
|
|
188
|
+
declare function DatePicker({ label, value, onChange, mode, placeholder, minimumDate, maximumDate, disabled, className, }: DatePickerProps): react.JSX.Element;
|
|
189
|
+
|
|
190
|
+
type ToastVariant = "info" | "success" | "warning" | "danger";
|
|
191
|
+
interface ToastOptions {
|
|
192
|
+
title?: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
variant?: ToastVariant;
|
|
195
|
+
/** Override the provider's auto-dismiss duration (ms). 0 disables. */
|
|
196
|
+
duration?: number;
|
|
197
|
+
}
|
|
198
|
+
interface ToastContextValue {
|
|
199
|
+
toast: (options: ToastOptions | string) => string;
|
|
200
|
+
dismiss: (id: string) => void;
|
|
201
|
+
}
|
|
202
|
+
interface ToastProviderProps {
|
|
203
|
+
children: ReactNode;
|
|
204
|
+
/** Auto-dismiss after this many ms. 0 disables. Default: 4000. */
|
|
205
|
+
duration?: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Provides a toast queue. RN has no portal, so the overlay renders as an
|
|
209
|
+
* absolutely-positioned `View` within the provider — mount it near your app
|
|
210
|
+
* root so toasts float above the screen.
|
|
211
|
+
*/
|
|
212
|
+
declare function ToastProvider({ children, duration }: ToastProviderProps): react.JSX.Element;
|
|
213
|
+
/** Access the toast queue. Must be used inside a {@link ToastProvider}. */
|
|
214
|
+
declare function useToast(): ToastContextValue;
|
|
215
|
+
|
|
216
|
+
/** Join truthy class-name parts with spaces (NativeWind className composition). */
|
|
217
|
+
declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
218
|
+
|
|
219
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardBody, CardFooter, CardHeader, type CardProps, Checkbox, type CheckboxProps, DatePicker, type DatePickerProps, Modal, type ModalProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectOption, type SelectProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, TextField, type TextFieldProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastVariant, cx, useToast };
|