"use client"; // @subframe/sync-disable -- local fix: generator emitted undefined `checked`/`highlighted` references in Select.Item; selection styling is handled by data-state classes (Phase 0 Subframe migration) /* * Documentation: * Select — https://app.subframe.com/f023064a5ca0/library?component=Select_bb88f90b-8c43-4b73-9c2f-3558ce7838f3 */ import React from "react"; import { FeatherCheck } from "@subframe/core"; import { FeatherChevronDown } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; export interface ContentProps extends React.ComponentProps { children?: React.ReactNode; className?: string; } const Content = React.forwardRef(function Content( { children, className, ...otherProps }: ContentProps, ref ) { return children ? (
{children}
) : null; }); export interface ItemProps extends Omit, "value"> { value: React.ReactNode; children?: React.ReactNode; className?: string; } const Item = React.forwardRef(function Item( { value, children, className, ...otherProps }: ItemProps, ref ) { return (
{children || value}
); }); export interface ItemTextProps extends React.ComponentProps { children?: React.ReactNode; variant?: "option-1" | "selected"; className?: string; } const ItemText = React.forwardRef( function ItemText( { children, variant = "option-1", className, ...otherProps }: ItemTextProps, ref ) { return children ? ( {children} ) : null; } ); export interface TriggerProps extends Omit< React.ComponentProps, "placeholder" > { placeholder?: React.ReactNode; icon?: React.ReactNode; variant?: "not-filled" | "disabled" | "filled"; size?: "medium" | "small" | "large"; noPadding?: boolean; className?: string; } const Trigger = React.forwardRef( function Trigger( { placeholder, icon = null, variant = "not-filled", size = "medium", noPadding = false, className, ...otherProps }: TriggerProps, ref ) { return ( ); } ); export interface TriggerValueProps extends React.ComponentProps { placeholder?: React.ReactNode; variant?: "not-filled" | "disabled" | "filled"; size?: "m" | "s" | "l"; className?: string; } const TriggerValue = React.forwardRef< React.ElementRef, TriggerValueProps >(function TriggerValue( { placeholder, variant = "not-filled", size = "m", className, ...otherProps }: TriggerValueProps, ref ) { return ( Value ); }); export interface SelectRootProps extends React.ComponentProps { disabled?: boolean; error?: boolean; variant?: "outline" | "filled"; borderless?: boolean; noPadding?: boolean; size?: "medium" | "small" | "large"; showLabel?: boolean; label?: React.ReactNode; placeholder?: React.ReactNode; helpText?: React.ReactNode; icon?: React.ReactNode; children?: React.ReactNode; errorText?: React.ReactNode; value?: string; onValueChange?: (value: string) => void; className?: string; } const SelectRoot = React.forwardRef( function SelectRoot( { disabled = false, error = false, variant = "outline", borderless = false, noPadding = false, size = "medium", showLabel = false, label, placeholder, helpText, icon = null, children, errorText, className, value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, dir, name, autoComplete, required, form, ...otherProps }: SelectRootProps, ref ) { return (
{label ? ( {label} ) : null} {helpText ? ( {helpText} ) : null}
{errorText ? ( {errorText} ) : null} {children ? (
{children}
) : null}
); } ); export const Select = Object.assign(SelectRoot, { Content, Item, ItemText, Trigger, TriggerValue, });