@epilot/spark-ui 0.30.3 → 0.31.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/dist/components/accordion.cjs +4 -4
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/accordion.js +4 -4
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.cjs +3 -3
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.js +3 -3
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/attachment.d.cts +1 -1
- package/dist/components/attachment.d.ts +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.cjs +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.cjs.map +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +2 -2
- package/dist/components/calendar.js +2 -2
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.js +1 -1
- package/dist/components/checkbox-group.cjs +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combobox.cjs +3 -3
- package/dist/components/combobox.js +3 -3
- package/dist/components/dialog.cjs +3 -3
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.js +3 -3
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +2 -2
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/field.cjs +1 -1
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-date-time.cjs +4 -4
- package/dist/components/input-date-time.js +4 -4
- package/dist/components/input-date.cjs +1 -1
- package/dist/components/input-date.js +1 -1
- package/dist/components/input-group.cjs +1 -1
- package/dist/components/input-group.d.cts +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +1 -1
- package/dist/components/message-scroller.js +1 -1
- package/dist/components/page-header.cjs +1 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/period-tabs.cjs +1 -1
- package/dist/components/period-tabs.js +1 -1
- package/dist/components/pill.cjs +1 -1
- package/dist/components/pill.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/power-network.cjs +1 -1
- package/dist/components/power-network.js +1 -1
- package/dist/components/progress.cjs +2 -2
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.js +2 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +2 -2
- package/dist/components/schedule-list.cjs +1 -1
- package/dist/components/schedule-list.js +1 -1
- package/dist/components/select.cjs +3 -3
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +3 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.cjs +3 -3
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/sheet.js +3 -3
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/spark-home.cjs +6122 -0
- package/dist/components/spark-home.cjs.map +1 -0
- package/dist/components/spark-home.d.cts +68 -0
- package/dist/components/spark-home.d.ts +68 -0
- package/dist/components/spark-home.js +6118 -0
- package/dist/components/spark-home.js.map +1 -0
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch-group.cjs +1 -1
- package/dist/components/switch-group.js +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +36 -67
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +4 -10
- package/dist/components/tabs.d.ts +4 -10
- package/dist/components/tabs.js +36 -67
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme.js +1 -1
- package/dist/components/toast.cjs +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/trace.cjs +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/lib/calendar-lists.cjs +1 -1
- package/dist/lib/calendar-lists.js +1 -1
- package/dist/styles/index.css +1 -0
- package/dist/styles/spark-default.css +3 -6
- package/dist/styles/spark-home.css +735 -0
- package/dist/styles/theme.css +8 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.cjs","names":["React","useTheme","Skeleton","Separator","Callout"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n setHasOutsetControl: (has: boolean) => void\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport function useKeepLabelOutset() {\n const setHasOutsetControl = useFieldContext()?.setHasOutsetControl\n useIsomorphicLayoutEffect(() => {\n if (!setHasOutsetControl) return\n setHasOutsetControl(true)\n return () => setHasOutsetControl(false)\n }, [setHasOutsetControl])\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const [outsetControlCount, setOutsetControlCount] = React.useState(0)\n const setHasOutsetControl = React.useCallback(\n (has: boolean) => setOutsetControlCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const requestedLabelPosition =\n labelPositionProp ?? theme.labelPosition ?? 'inset'\n const labelPosition =\n requestedLabelPosition === 'floating' && outsetControlCount > 0\n ? 'outset'\n : requestedLabelPosition\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n {labelPosition === 'floating' &&\n inputStyle === 'outlined' && (\n // the outline is FieldLabel's notch; a field without a label still needs one\n <FieldNotch\n className=\"hidden group-has-[:is(input:not([type=checkbox],[type=radio],[type=hidden]),textarea,[data-slot=select-trigger])]/field:block group-has-[>[data-slot=field-label]]/field:hidden!\"\n inputColor={inputColor}\n />\n )}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-all group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n className,\n inputColor,\n children,\n}: {\n className?: string\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor], className)}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAEA,MAAM,4BACJ,OAAO,WAAW,cAAcA,MAAM,YAAYA,MAAM;AAE1D,SAAgB,qBAAqB;CACnC,MAAM,sBAAsB,gBAAgB,GAAG;CAC/C,gCAAgC;EAC9B,IAAI,CAAC,qBAAqB;EAC1B,oBAAoB,IAAI;EACxB,aAAa,oBAAoB,KAAK;CACxC,GAAG,CAAC,mBAAmB,CAAC;AAC1B;AAOA,SAAgB,gBAAgB,SAI7B;CACD,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQC,yB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,MAAM,aAAa,QAAQ,OAAO;CAElC,MAAM,cAAc,MAAM;CAC1B,MAAM,iBAAiB,CAAC,QAAQ,UAAU,sBAAsB,KAAA;CAGhE,MAAM,gBAAgB;EACpB,IAAI,CAAC,YAAY;EACjB,MAAM,MAAM,cAAc,iBAAiB;EAC3C,IAAI,CAAC,KAAK;EACV,IAAI,IAAI;EACR,aAAa,IAAI,KAAK;CACxB,GAAG;EAAC;EAAa;EAAgB;EAAY;CAAW,CAAC;CAEzD,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,CAAC,SAAS,UAEZ,OACE,iBAAA,GAAA,kBAAA,KAACI,2BAAAA,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,SAAS;EACR;EACX,GAAI;YAEH;CACM,CAAA;CAIb,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;YAEH;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"field.cjs","names":["React","useTheme","Skeleton","Separator","Callout"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n setHasOutsetControl: (has: boolean) => void\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport function useKeepLabelOutset() {\n const setHasOutsetControl = useFieldContext()?.setHasOutsetControl\n useIsomorphicLayoutEffect(() => {\n if (!setHasOutsetControl) return\n setHasOutsetControl(true)\n return () => setHasOutsetControl(false)\n }, [setHasOutsetControl])\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const [outsetControlCount, setOutsetControlCount] = React.useState(0)\n const setHasOutsetControl = React.useCallback(\n (has: boolean) => setOutsetControlCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const requestedLabelPosition =\n labelPositionProp ?? theme.labelPosition ?? 'inset'\n const labelPosition =\n requestedLabelPosition === 'floating' && outsetControlCount > 0\n ? 'outset'\n : requestedLabelPosition\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n {labelPosition === 'floating' &&\n inputStyle === 'outlined' && (\n // the outline is FieldLabel's notch; a field without a label still needs one\n <FieldNotch\n className=\"hidden group-has-[:is(input:not([type=checkbox],[type=radio],[type=hidden]),textarea,[data-slot=select-trigger])]/field:block group-has-[>[data-slot=field-label]]/field:hidden!\"\n inputColor={inputColor}\n />\n )}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-colors group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n className,\n inputColor,\n children,\n}: {\n className?: string\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor], className)}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAEA,MAAM,4BACJ,OAAO,WAAW,cAAcA,MAAM,YAAYA,MAAM;AAE1D,SAAgB,qBAAqB;CACnC,MAAM,sBAAsB,gBAAgB,GAAG;CAC/C,gCAAgC;EAC9B,IAAI,CAAC,qBAAqB;EAC1B,oBAAoB,IAAI;EACxB,aAAa,oBAAoB,KAAK;CACxC,GAAG,CAAC,mBAAmB,CAAC;AAC1B;AAOA,SAAgB,gBAAgB,SAI7B;CACD,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQC,yBAAAA,SAAS;CACvB,MAAM,KAAK,SAAS,MAAM,OAAO;CAIjC,MAAM,kBACJ;EAJc,OAAO,WAAW,MAAM,UAAU,KAAA;EAC5B,OAAO,iBAAiB,MAAM,gBAAgB,KAAA;EAGzC,SAAS;CAAe,EAC9C,OAAO,OAAO,EACd,KAAK,GAAG,KAAK,KAAA;CAClB,MAAM,aACJ,SAAS,WAAW,OAAO,cAAc,MAAM,cAAc;CAC/D,MAAM,aAAa,OAAO,cAAc,MAAM,cAAc;CAE5D,OAAO;EAAE;EAAO;EAAI;EAAiB,aADjB,OAA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,OACE,iBAAA,GAAA,kBAAA,KAACI,2BAAAA,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,SAAS;EACR;EACX,GAAI;YAEH;CACM,CAAA;CAIb,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;YAEH;CACE,CAAA;AAET"}
|
package/dist/components/field.js
CHANGED
|
@@ -289,7 +289,7 @@ function FieldContent({ className, ...props }) {
|
|
|
289
289
|
...props
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
const fieldLabelClassName = "text-sm leading-5 font-normal text-gray transition-
|
|
292
|
+
const fieldLabelClassName = "text-sm leading-5 font-normal text-gray transition-colors group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none";
|
|
293
293
|
const floatingLabelClassName = "pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none";
|
|
294
294
|
const notchClassName = "pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none";
|
|
295
295
|
const notchColorClassName = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["React"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n setHasOutsetControl: (has: boolean) => void\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport function useKeepLabelOutset() {\n const setHasOutsetControl = useFieldContext()?.setHasOutsetControl\n useIsomorphicLayoutEffect(() => {\n if (!setHasOutsetControl) return\n setHasOutsetControl(true)\n return () => setHasOutsetControl(false)\n }, [setHasOutsetControl])\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const [outsetControlCount, setOutsetControlCount] = React.useState(0)\n const setHasOutsetControl = React.useCallback(\n (has: boolean) => setOutsetControlCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const requestedLabelPosition =\n labelPositionProp ?? theme.labelPosition ?? 'inset'\n const labelPosition =\n requestedLabelPosition === 'floating' && outsetControlCount > 0\n ? 'outset'\n : requestedLabelPosition\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n {labelPosition === 'floating' &&\n inputStyle === 'outlined' && (\n // the outline is FieldLabel's notch; a field without a label still needs one\n <FieldNotch\n className=\"hidden group-has-[:is(input:not([type=checkbox],[type=radio],[type=hidden]),textarea,[data-slot=select-trigger])]/field:block group-has-[>[data-slot=field-label]]/field:hidden!\"\n inputColor={inputColor}\n />\n )}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-all group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n className,\n inputColor,\n children,\n}: {\n className?: string\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor], className)}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAM,eAAeA,QAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,QAAM,WAAW,YAAY;AACt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":3,"file":"field.js","names":["React"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n setHasOutsetControl: (has: boolean) => void\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport function useKeepLabelOutset() {\n const setHasOutsetControl = useFieldContext()?.setHasOutsetControl\n useIsomorphicLayoutEffect(() => {\n if (!setHasOutsetControl) return\n setHasOutsetControl(true)\n return () => setHasOutsetControl(false)\n }, [setHasOutsetControl])\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const [outsetControlCount, setOutsetControlCount] = React.useState(0)\n const setHasOutsetControl = React.useCallback(\n (has: boolean) => setOutsetControlCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const requestedLabelPosition =\n labelPositionProp ?? theme.labelPosition ?? 'inset'\n const labelPosition =\n requestedLabelPosition === 'floating' && outsetControlCount > 0\n ? 'outset'\n : requestedLabelPosition\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n {labelPosition === 'floating' &&\n inputStyle === 'outlined' && (\n // the outline is FieldLabel's notch; a field without a label still needs one\n <FieldNotch\n className=\"hidden group-has-[:is(input:not([type=checkbox],[type=radio],[type=hidden]),textarea,[data-slot=select-trigger])]/field:block group-has-[>[data-slot=field-label]]/field:hidden!\"\n inputColor={inputColor}\n />\n )}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-colors group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n className,\n inputColor,\n children,\n}: {\n className?: string\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor], className)}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAM,eAAeA,QAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,QAAM,WAAW,YAAY;AACtC;AAEA,MAAM,4BACJ,OAAO,WAAW,cAAcA,QAAM,YAAYA,QAAM;AAE1D,SAAgB,qBAAqB;CACnC,MAAM,sBAAsB,gBAAgB,GAAG;CAC/C,gCAAgC;EAC9B,IAAI,CAAC,qBAAqB;E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,SAAS,WACI;CAC3B,MAAM,UAAUA,QAAM,cAAc;EAClC,IAAI,UAAU,OAAO;EACrB,IAAI,CAAC,QAAQ,QAAQ,OAAO;EAC5B,MAAM,WAAW,CACf,GAAG,IAAI,IAAI,OAAO,KAAK,UAAU,OAAO,OAAO,EAAE,OAAO,OAAO,CAAC,CAClE;EACA,IAAI,SAAS,WAAW,GAAG,OAAO;EAClC,IAAI,SAAS,WAAW,GAAG,OAAO,SAAS;EAC3C,OACE,oBAAC,MAAD;GAAI,WAAU;aACX,SAAS,KAAK,YACb,oBAAC,MAAD,EAAA,UAAmB,QAAY,GAAtB,OAAsB,CAChC;EACC,CAAA;CAER,GAAG,CAAC,UAAU,MAAM,CAAC;CAErB,MAAM,aAAa,QAAQ,OAAO;CAElC,MAAM,cAAc,MAAM;CAC1B,MAAM,iBAAiB,CAAC,QAAQ,UAAU,sBAAsB,KAAA;CAGhE,QAAM,gBAAgB;EACpB,IAAI,CAAC,YAAY;EACjB,MAAM,MAAM,cAAc,iBAAiB;EAC3C,IAAI,CAAC,KAAK;EACV,IAAI,IAAI;EACR,aAAa,IAAI,KAAK;CACxB,GAAG;EAAC;EAAa;EAAgB;EAAY;CAAW,CAAC;CAEzD,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,CAAC,SAAS,UAEZ,OACE,oBAAC,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,SAAS;EACR;EACX,GAAI;YAEH;CACM,CAAA;CAIb,OACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,WAAW,GAAG,kCAAkC,SAAS;EACzD,GAAI;YAEH;CACE,CAAA;AAET"}
|
package/dist/components/icon.js
CHANGED
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "default" | "bare" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "default" | "bare" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
|
-
const require_lib_calendar_day_button = require("../lib/calendar-day-button.cjs");
|
|
6
5
|
const require_components_button = require("./button.cjs");
|
|
7
|
-
const require_lib_date_time_mask = require("../lib/date-time-mask.cjs");
|
|
8
|
-
const require_lib_input_date_parts = require("../lib/input-date-parts.cjs");
|
|
9
6
|
const require_components_input_group = require("./input-group.cjs");
|
|
7
|
+
const require_lib_calendar_day_button = require("../lib/calendar-day-button.cjs");
|
|
10
8
|
const require_components_calendar = require("./calendar.cjs");
|
|
9
|
+
const require_lib_date_time_mask = require("../lib/date-time-mask.cjs");
|
|
10
|
+
const require_lib_input_date_parts = require("../lib/input-date-parts.cjs");
|
|
11
11
|
const require_components_popover = require("./popover.cjs");
|
|
12
12
|
let react = require("react");
|
|
13
13
|
react = require_chunk.__toESM(react);
|
|
14
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
14
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
16
|
let ictus_time = require("ictus/time");
|
|
17
17
|
let cn = require("cn");
|
|
18
18
|
//#region src/components/input-date-time.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { ScrollFreeDayButton } from "../lib/calendar-day-button.js";
|
|
4
3
|
import { cn } from "../utils/cn.js";
|
|
5
4
|
import { Button } from "./button.js";
|
|
6
|
-
import { dateTimeStatus, formatDateTime, formatTime, parseDatePart, parseDateTime } from "../lib/date-time-mask.js";
|
|
7
|
-
import { TimeList, timesOf, useAnnouncement, useMaskHandlers } from "../lib/input-date-parts.js";
|
|
8
5
|
import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
|
|
6
|
+
import { ScrollFreeDayButton } from "../lib/calendar-day-button.js";
|
|
9
7
|
import { Calendar } from "./calendar.js";
|
|
8
|
+
import { dateTimeStatus, formatDateTime, formatTime, parseDatePart, parseDateTime } from "../lib/date-time-mask.js";
|
|
9
|
+
import { TimeList, timesOf, useAnnouncement, useMaskHandlers } from "../lib/input-date-parts.js";
|
|
10
10
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
11
11
|
import * as React$1 from "react";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { CalendarMonth } from "@epilot/spark-icons";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/input-date-time.tsx
|
|
15
15
|
function useControllableState({ defaultProp, onChange, prop }) {
|
|
16
16
|
const [uncontrolled, setUncontrolled] = React$1.useState(defaultProp);
|
|
@@ -9,8 +9,8 @@ const require_components_calendar = require("./calendar.cjs");
|
|
|
9
9
|
const require_components_popover = require("./popover.cjs");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_chunk.__toESM(react);
|
|
12
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
12
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let ictus = require("ictus");
|
|
15
15
|
let cn = require("cn");
|
|
16
16
|
//#region src/components/input-date.tsx
|
|
@@ -7,8 +7,8 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
|
|
|
7
7
|
import { Calendar } from "./calendar.js";
|
|
8
8
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
9
9
|
import * as React$1 from "react";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { CalendarMonth } from "@epilot/spark-icons";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { apply, formatDate, isDateMaskKey, parseDate } from "ictus";
|
|
13
13
|
//#region src/components/input-date.tsx
|
|
14
14
|
function useControllableState({ defaultProp, onChange, prop }) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
5
|
const require_components_theme = require("./theme.cjs");
|
|
6
|
-
require("../lib/input-box-variants.cjs");
|
|
7
6
|
const require_components_field = require("./field.cjs");
|
|
7
|
+
require("../lib/input-box-variants.cjs");
|
|
8
8
|
const require_components_input = require("./input.cjs");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
react = require_chunk.__toESM(react);
|
|
@@ -10,7 +10,7 @@ declare function InputGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
-
align?: "inline-
|
|
13
|
+
align?: "inline-end" | "inline-start" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function InputGroupAddon({
|
|
16
16
|
className,
|
|
@@ -10,7 +10,7 @@ declare function InputGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
-
align?: "inline-
|
|
13
|
+
align?: "inline-end" | "inline-start" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function InputGroupAddon({
|
|
16
16
|
className,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
4
|
import { useTheme } from "./theme.js";
|
|
5
|
-
import "../lib/input-box-variants.js";
|
|
6
5
|
import { useFieldContext } from "./field.js";
|
|
6
|
+
import "../lib/input-box-variants.js";
|
|
7
7
|
import { Input } from "./input.js";
|
|
8
8
|
import * as React$1 from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
4
3
|
const require_components_field = require("./field.cjs");
|
|
4
|
+
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
let class_variance_authority = require("class-variance-authority");
|
|
7
7
|
let _base_ui_react_otp_field = require("@base-ui/react/otp-field");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { INSET_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
|
|
4
3
|
import { useFieldControl, useKeepLabelOutset } from "./field.js";
|
|
4
|
+
import { INSET_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { OTPField } from "@base-ui/react/otp-field";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
-
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
5
4
|
const require_components_field = require("./field.cjs");
|
|
5
|
+
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_chunk.__toESM(react);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
package/dist/components/input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { INSET_UNDERLINE, boxChrome, floatingChrome } from "../lib/input-box-variants.js";
|
|
4
3
|
import { useFieldControl } from "./field.js";
|
|
4
|
+
import { INSET_UNDERLINE, boxChrome, floatingChrome } from "../lib/input-box-variants.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/marker.d.ts
|
|
8
8
|
declare const markerVariants: (props?: ({
|
|
9
|
-
variant?: "separator" | "
|
|
9
|
+
variant?: "separator" | "default" | "border" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
declare function Marker({
|
|
12
12
|
className,
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/marker.d.ts
|
|
8
8
|
declare const markerVariants: (props?: ({
|
|
9
|
-
variant?: "separator" | "
|
|
9
|
+
variant?: "separator" | "default" | "border" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
declare function Marker({
|
|
12
12
|
className,
|
|
@@ -6,8 +6,8 @@ const require_components_button = require("./button.cjs");
|
|
|
6
6
|
const require_lib_message_animations = require("../lib/message-animations.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_chunk.__toESM(react);
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
9
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
let _shadcn_react_message_scroller = require("@shadcn/react/message-scroller");
|
|
12
12
|
let motion_react = require("motion/react");
|
|
13
13
|
let motion_react_m = require("motion/react-m");
|
|
@@ -4,8 +4,8 @@ import { cn } from "../utils/cn.js";
|
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { MESSAGE_ANIMATIONS } from "../lib/message-animations.js";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { ArrowDownward, ArrowUpward } from "@epilot/spark-icons";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { MessageScroller as MessageScroller$1, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
|
|
10
10
|
import { LazyMotion, domAnimation } from "motion/react";
|
|
11
11
|
import { create } from "motion/react-m";
|
|
@@ -5,8 +5,8 @@ const require_components_button = require("./button.cjs");
|
|
|
5
5
|
const require_components_typography = require("./typography.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_chunk.__toESM(react);
|
|
8
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
8
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let _base_ui_react_merge_props = require("@base-ui/react/merge-props");
|
|
11
11
|
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
12
12
|
let cn = require("cn");
|
|
@@ -3,8 +3,8 @@ import { cn } from "../utils/cn.js";
|
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import { PageTitle } from "./typography.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import { ChevronLeft } from "@epilot/spark-icons";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
9
9
|
import { useRender } from "@base-ui/react/use-render";
|
|
10
10
|
//#region src/components/page-header.tsx
|