@epilot/spark-ui 0.32.1 → 0.32.3
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/{button-i1Bgbw4p.d.ts → button-4QGaO78M.d.ts} +2 -2
- package/dist/{button-CT39v1M3.d.cts → button-C-KeUy2j.d.cts} +2 -2
- package/dist/components/accordion.cjs +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert-dialog.cjs +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/attachment.cjs +3 -3
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/attachment.d.cts +3 -3
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +3 -3
- package/dist/components/attachment.js.map +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.cjs +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/banner.cjs +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/breadcrumbs.cjs +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/bubble.cjs +2 -2
- package/dist/components/bubble.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/bubble.js +2 -2
- package/dist/components/bubble.js.map +1 -1
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/calendar.cjs +3 -3
- package/dist/components/calendar.js +3 -3
- package/dist/components/callout.cjs +2 -2
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +2 -2
- package/dist/components/callout.js +2 -2
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combobox.cjs +70 -25
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -5
- package/dist/components/combobox.d.ts +2 -5
- package/dist/components/combobox.js +70 -25
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.cjs +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.js +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/dropzone.cjs +1 -1
- package/dist/components/dropzone.cjs.map +1 -1
- package/dist/components/dropzone.d.cts +1 -1
- package/dist/components/dropzone.d.ts +1 -1
- package/dist/components/dropzone.js +1 -1
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +2 -2
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entity-card.cjs +4 -4
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.d.ts +1 -1
- package/dist/components/entity-card.js +4 -4
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +8 -8
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +8 -8
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +4 -4
- package/dist/components/hero-metric.cjs.map +1 -1
- package/dist/components/hero-metric.js +4 -4
- package/dist/components/hero-metric.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/image-carousel.cjs +2 -2
- package/dist/components/image-carousel.d.cts +1 -1
- package/dist/components/image-carousel.d.ts +1 -1
- package/dist/components/image-carousel.js +3 -3
- package/dist/components/info-block.cjs +1 -1
- package/dist/components/info-block.js +1 -1
- package/dist/components/input-group.cjs +4 -4
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.js +4 -4
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +3 -3
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +3 -3
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.cjs +3 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/line-chart.cjs +1 -1
- package/dist/components/line-chart.js +2 -2
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/marker.cjs +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/marker.js +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- package/dist/components/message-scroller.d.cts +1 -1
- package/dist/components/message-scroller.d.ts +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/page-header.cjs +2 -2
- package/dist/components/page-header.d.cts +2 -2
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/page-header.js +2 -2
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.d.cts +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/period-tabs.d.cts +1 -1
- package/dist/components/period-tabs.d.ts +1 -1
- package/dist/components/pill.cjs +1 -1
- package/dist/components/pill.d.cts +1 -1
- package/dist/components/pill.d.ts +1 -1
- package/dist/components/pill.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/power-history-chart.cjs +1 -1
- package/dist/components/power-history-chart.js +2 -2
- package/dist/components/power-network.cjs +2 -2
- package/dist/components/power-network.js +2 -2
- package/dist/components/radio-card-group.cjs +2 -2
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +2 -2
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/schedule-list.cjs +2 -2
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +2 -2
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +2 -2
- package/dist/components/select.js +2 -2
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/solar-forecast-chart.d.ts +1 -1
- package/dist/components/step-indicator.cjs +2 -2
- package/dist/components/step-indicator.js +2 -2
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch-group.js +1 -1
- 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 +22 -11
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +5 -1
- package/dist/components/tabs.d.ts +5 -1
- package/dist/components/tabs.js +23 -12
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +3 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.js +2 -2
- package/dist/components/toast.cjs +4 -4
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +4 -4
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +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 +3 -3
- package/dist/components/trace.cjs.map +1 -1
- package/dist/components/trace.js +3 -3
- package/dist/components/trace.js.map +1 -1
- package/dist/hooks/use-overflow-list.cjs +79 -0
- package/dist/hooks/use-overflow-list.cjs.map +1 -0
- package/dist/hooks/use-overflow-list.d.cts +48 -0
- package/dist/hooks/use-overflow-list.d.ts +48 -0
- package/dist/hooks/use-overflow-list.js +77 -0
- package/dist/hooks/use-overflow-list.js.map +1 -0
- package/dist/lib/calendar-lists.cjs +2 -2
- package/dist/lib/calendar-lists.js +2 -2
- package/dist/lib/date-field.cjs +8 -7
- package/dist/lib/date-field.cjs.map +1 -1
- package/dist/lib/date-field.d.cts +7 -1
- package/dist/lib/date-field.d.ts +7 -1
- package/dist/lib/date-field.js +8 -7
- package/dist/lib/date-field.js.map +1 -1
- package/dist/lib/input-box-variants.cjs +3 -3
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/lib/input-box-variants.d.cts +1 -1
- package/dist/lib/input-box-variants.d.ts +1 -1
- package/dist/lib/input-box-variants.js +3 -3
- package/dist/lib/input-box-variants.js.map +1 -1
- package/dist/lib/toggle-group-context.d.cts +1 -1
- package/dist/lib/toggle-group-context.d.ts +1 -1
- package/dist/styles/theme.css +10 -5
- package/package.json +1 -1
|
@@ -174,7 +174,7 @@ function DropzoneMedia({ className, ...props }) {
|
|
|
174
174
|
return /* @__PURE__ */ jsx("div", {
|
|
175
175
|
"aria-hidden": "true",
|
|
176
176
|
"data-slot": "dropzone-media",
|
|
177
|
-
className: cn("flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-a3 text-gray-a11 transition-colors motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-5", "group-data-[drag-active]/dropzone:bg-primary-soft-hover group-data-[drag-active]/dropzone:text-primary", "group-data-[invalid]/dropzone:bg-red-a3 group-data-[invalid]/dropzone:text-error", className),
|
|
177
|
+
className: cn("flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-a3 text-gray-a11 transition-colors motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-5", "group-data-[drag-active]/dropzone:bg-primary-soft-hover group-data-[drag-active]/dropzone:text-primary", "group-data-[invalid]/dropzone:bg-red-a3 group-data-[invalid]/dropzone:text-error-soft-foreground", className),
|
|
178
178
|
...props
|
|
179
179
|
});
|
|
180
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.js","names":["React"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\n\n/** Why a file was rejected; the same codes as react-dropzone. */\ntype DropzoneErrorCode =\n | 'file-invalid-type'\n | 'file-too-large'\n | 'file-too-small'\n | 'too-many-files'\n\ntype DropzoneRejection = { file: File; errors: { code: DropzoneErrorCode }[] }\n\ntype DropzoneEvent =\n | React.DragEvent<HTMLElement>\n | React.ChangeEvent<HTMLInputElement>\n\ntype DropzoneProps = Omit<React.ComponentProps<'div'>, 'onDrop'> & {\n /** File types, as the file input's `accept` (`image/*, .csv, application/pdf`). */\n accept?: string\n /** Smallest file size in bytes. */\n minSize?: number\n /** Largest file size in bytes. */\n maxSize?: number\n /** Accept more than one file per drop. Default: true */\n multiple?: boolean\n /** Most files per drop when `multiple`; 0 means no limit. Default: 0 */\n maxFiles?: number\n disabled?: boolean\n invalid?: boolean\n /** Keep the browser from opening files dropped next to the zone. Default: true */\n preventDropOnDocument?: boolean\n /** Every drop or pick, with the files sorted into accepted and rejected. */\n onDrop?: (\n accepted: File[],\n rejections: DropzoneRejection[],\n event: DropzoneEvent,\n ) => void\n}\n\ntype DragState = 'idle' | 'active' | 'accept' | 'reject'\n\ntype DropzoneContextValue = { disabled: boolean; open: () => void }\n\nconst DropzoneContext = React.createContext<DropzoneContextValue | null>(null)\n\n/** Whether a file matches an `accept` list, like the file input (and attr-accept) does. */\nconst acceptsFile = (\n file: { name?: string; type?: string },\n accept?: string,\n) => {\n const types = (accept ?? '')\n .split(',')\n .map((type) => type.trim().toLowerCase())\n .filter(Boolean)\n\n if (!types.length) return true\n\n const name = (file.name ?? '').toLowerCase()\n const mime = (file.type ?? '').toLowerCase()\n const baseMime = mime.replace(/\\/.*$/, '')\n\n return types.some((type) => {\n if (type.startsWith('.')) return name.endsWith(type)\n if (type.endsWith('/*')) return baseMime === type.replace(/\\/.*$/, '')\n\n return mime === type\n })\n}\n\ntype CheckOptions = Pick<\n DropzoneProps,\n 'accept' | 'minSize' | 'maxSize' | 'multiple' | 'maxFiles'\n>\n\nconst isOverCount = (count: number, multiple = true, maxFiles = 0) =>\n (!multiple && count > 1) || (multiple && maxFiles >= 1 && count > maxFiles)\n\nconst fileErrors = (\n file: File,\n { accept, minSize, maxSize }: CheckOptions,\n): DropzoneRejection['errors'] => {\n const errors: DropzoneRejection['errors'] = []\n\n if (file.type !== 'application/x-moz-file' && !acceptsFile(file, accept)) {\n errors.push({ code: 'file-invalid-type' })\n }\n if (maxSize !== undefined && file.size > maxSize)\n errors.push({ code: 'file-too-large' })\n else if (minSize !== undefined && file.size < minSize)\n errors.push({ code: 'file-too-small' })\n\n return errors\n}\n\n/** Sorts files into accepted and rejected: type, then size, then the file count. */\nconst checkFiles = (files: File[], options: CheckOptions) => {\n const accepted: File[] = []\n const rejections: DropzoneRejection[] = []\n\n for (const file of files) {\n const errors = fileErrors(file, options)\n\n if (errors.length) rejections.push({ file, errors })\n else accepted.push(file)\n }\n\n if (isOverCount(accepted.length, options.multiple, options.maxFiles)) {\n rejections.push(\n ...accepted.map((file) => ({\n file,\n errors: [{ code: 'too-many-files' as const }],\n })),\n )\n accepted.length = 0\n }\n\n return { accepted, rejections }\n}\n\n/** The drag's verdict from the item types the browser shows while dragging (names come on drop). */\nconst dragStateOf = (\n transfer: DataTransfer | null,\n options: CheckOptions,\n): DragState => {\n const items = Array.from(transfer?.items ?? []).filter(\n (item) => item.kind === 'file',\n )\n\n if (!items.length) return 'active'\n\n const tooMany = isOverCount(items.length, options.multiple, options.maxFiles)\n const wrongType = items.some(\n (item) => item.type && !acceptsFile({ type: item.type }, options.accept),\n )\n\n return tooMany || wrongType ? 'reject' : 'accept'\n}\n\nconst flag = (on: boolean) => (on ? '' : undefined)\n\n/** A drop area with a hidden file input: drop files on it, or click it (or its trigger) to pick them. */\nconst Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n minSize,\n maxSize,\n multiple = true,\n maxFiles = 0,\n disabled = false,\n invalid = false,\n preventDropOnDocument = true,\n onDrop,\n className,\n children,\n role = 'group',\n onClick,\n onKeyDown,\n onDragEnter,\n onDragOver,\n onDragLeave,\n ...props\n },\n ref,\n ) => {\n const rootRef = React.useRef<HTMLDivElement | null>(null)\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n const dragDepth = React.useRef(0)\n const [dragState, setDragState] = React.useState<DragState>('idle')\n const options = { accept, minSize, maxSize, multiple, maxFiles }\n\n const setRefs = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const open = React.useCallback(() => {\n if (disabled || !inputRef.current) return\n // Picking the same file again must fire a change\n inputRef.current.value = ''\n inputRef.current.click()\n }, [disabled])\n\n const receive = (files: File[], event: DropzoneEvent) => {\n const { accepted, rejections } = checkFiles(files, options)\n onDrop?.(accepted, rejections, event)\n }\n\n React.useEffect(() => {\n if (!preventDropOnDocument) return\n const onDocumentDragOver = (event: DragEvent) => event.preventDefault()\n const onDocumentDrop = (event: DragEvent) => {\n if (rootRef.current?.contains(event.target as Node)) return\n event.preventDefault()\n }\n\n document.addEventListener('dragover', onDocumentDragOver)\n document.addEventListener('drop', onDocumentDrop)\n\n return () => {\n document.removeEventListener('dragover', onDocumentDragOver)\n document.removeEventListener('drop', onDocumentDrop)\n }\n }, [preventDropOnDocument])\n\n const context = React.useMemo(() => ({ disabled, open }), [disabled, open])\n\n return (\n <DropzoneContext.Provider value={context}>\n {/* oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- the role comes from props, `group` by default */}\n <div\n data-slot=\"dropzone\"\n role={role}\n aria-disabled={disabled || undefined}\n data-disabled={flag(disabled)}\n data-invalid={flag(invalid)}\n data-drag-active={flag(dragState !== 'idle')}\n data-drag-accept={flag(dragState === 'accept')}\n data-drag-reject={flag(dragState === 'reject')}\n className={cn(\n 'group/dropzone flex w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-gray-a7 bg-gray-2 px-4 py-6 text-center text-gray-a12 transition-colors outline-none motion-reduce:transition-none',\n 'hover:bg-gray-a2 data-[invalid]:border-error',\n 'data-[drag-active]:border-primary data-[drag-active]:bg-primary-soft',\n 'data-[drag-reject]:border-error data-[drag-reject]:bg-error-soft',\n 'data-[disabled]:cursor-default data-[disabled]:opacity-50 data-[disabled]:hover:bg-gray-2',\n className,\n )}\n ref={setRefs}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) open()\n }}\n // Like react-dropzone: Enter or Space on the focused zone itself opens the picker\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (\n event.target !== event.currentTarget ||\n !['Enter', ' '].includes(event.key)\n )\n return\n event.preventDefault()\n open()\n }}\n onDragEnter={(event) => {\n onDragEnter?.(event)\n event.preventDefault()\n if (disabled) return\n dragDepth.current += 1\n setDragState(dragStateOf(event.dataTransfer, options))\n }}\n onDragOver={(event) => {\n onDragOver?.(event)\n event.preventDefault()\n event.dataTransfer.dropEffect = disabled ? 'none' : 'copy'\n }}\n onDragLeave={(event) => {\n onDragLeave?.(event)\n event.preventDefault()\n dragDepth.current = Math.max(0, dragDepth.current - 1)\n if (dragDepth.current === 0) setDragState('idle')\n }}\n onDrop={(event) => {\n event.preventDefault()\n dragDepth.current = 0\n setDragState('idle')\n if (!disabled) receive(Array.from(event.dataTransfer.files), event)\n }}\n {...props}\n >\n <input\n accept={accept}\n data-slot=\"dropzone-input\"\n disabled={disabled}\n multiple={multiple}\n ref={inputRef}\n style={{ display: 'none' }}\n tabIndex={-1}\n type=\"file\"\n onChange={(event) =>\n receive(Array.from(event.target.files ?? []), event)\n }\n // The input sits inside the zone, whose click would open the picker again\n onClick={(event) => event.stopPropagation()}\n />\n {children}\n </div>\n </DropzoneContext.Provider>\n )\n },\n)\n\nDropzone.displayName = 'Dropzone'\n\ntype DropzoneMediaProps = React.ComponentProps<'div'>\n\n/** The icon above the message. */\nfunction DropzoneMedia({ className, ...props }: DropzoneMediaProps) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"dropzone-media\"\n className={cn(\n 'flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-a3 text-gray-a11 transition-colors motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-5',\n 'group-data-[drag-active]/dropzone:bg-primary-soft-hover group-data-[drag-active]/dropzone:text-primary',\n 'group-data-[invalid]/dropzone:bg-red-a3 group-data-[invalid]/dropzone:text-error',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype DropzoneTitleProps = React.ComponentProps<'p'>\n\nfunction DropzoneTitle({ className, ...props }: DropzoneTitleProps) {\n return (\n <p\n data-slot=\"dropzone-title\"\n className={cn(\n 'text-sm leading-normal font-medium text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nfunction DropzoneDescription({\n className,\n ...props\n}: DropzoneDescriptionProps) {\n return (\n <p\n data-slot=\"dropzone-description\"\n className={cn('text-xs leading-normal text-gray-light', className)}\n {...props}\n />\n )\n}\n\ntype DropzoneTriggerProps = ButtonProps\n\n/** Opens the file picker; disabled with the zone. */\nfunction DropzoneTrigger({\n onClick,\n disabled,\n styleVariant = 'outline',\n ...props\n}: DropzoneTriggerProps) {\n const dropzone = React.useContext(DropzoneContext)\n if (!dropzone)\n throw new Error('DropzoneTrigger must be placed inside Dropzone.')\n\n return (\n <Button\n data-slot=\"dropzone-trigger\"\n disabled={disabled ?? dropzone.disabled}\n styleVariant={styleVariant}\n type=\"button\"\n onClick={(event) => {\n // The zone's own click would open the picker a second time\n event.stopPropagation()\n onClick?.(event)\n if (!event.defaultPrevented) dropzone.open()\n }}\n {...props}\n />\n )\n}\n\nexport {\n Dropzone,\n DropzoneDescription,\n DropzoneMedia,\n DropzoneTitle,\n DropzoneTrigger,\n acceptsFile,\n checkFiles,\n}\nexport type {\n DropzoneDescriptionProps,\n DropzoneErrorCode,\n DropzoneEvent,\n DropzoneMediaProps,\n DropzoneProps,\n DropzoneRejection,\n DropzoneTitleProps,\n DropzoneTriggerProps,\n}\n"],"mappings":";;;;;;;AA8CA,MAAM,kBAAkBA,QAAM,cAA2C,IAAI;;AAG7E,MAAM,eACJ,MACA,WACG;CACH,MAAM,SAAS,UAAU,IACtB,MAAM,GAAG,EACT,KAAK,SAAS,KAAK,KAAK,EAAE,YAAY,CAAC,EACvC,OAAO,OAAO;CAEjB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,MAAM,QAAQ,KAAK,QAAQ,IAAI,YAAY;CAC3C,MAAM,QAAQ,KAAK,QAAQ,IAAI,YAAY;CAC3C,MAAM,WAAW,KAAK,QAAQ,SAAS,EAAE;CAEzC,OAAO,MAAM,MAAM,SAAS;EAC1B,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO,KAAK,SAAS,IAAI;EACnD,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,SAAS,EAAE;EAErE,OAAO,SAAS;CAClB,CAAC;AACH;AAOA,MAAM,eAAe,OAAe,WAAW,MAAM,WAAW,MAC7D,CAAC,YAAY,QAAQ,KAAO,YAAY,YAAY,KAAK,QAAQ;AAEpE,MAAM,cACJ,MACA,EAAE,QAAQ,SAAS,cACa;CAChC,MAAM,SAAsC,CAAC;CAE7C,IAAI,KAAK,SAAS,4BAA4B,CAAC,YAAY,MAAM,MAAM,GACrE,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;CAE3C,IAAI,YAAY,KAAA,KAAa,KAAK,OAAO,SACvC,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;MACnC,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AAc;;AAKvB,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;CAClE,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,WAAW,GACT,0MACA,0GACA,oFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;CAClE,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GACT,oDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,oBAAoB,EAC3B,WACA,GAAG,SACwB;CAC3B,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GAAG,0CAA0C,SAAS;EACjE,GAAI;CACL,CAAA;AAEL;;AAKA,SAAS,gBAAgB,EACvB,SACA,UACA,eAAe,WACf,GAAG,SACoB;CACvB,MAAM,WAAWA,QAAM,WAAW,eAAe;CACjD,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,iDAAiD;CAEnE,OACE,oBAAC,QAAD;EACE,aAAU;EACV,UAAU,YAAY,SAAS;EACjB;EACd,MAAK;EACL,UAAU,UAAU;GAElB,MAAM,gBAAgB;GACtB,UAAU,KAAK;GACf,IAAI,CAAC,MAAM,kBAAkB,SAAS,KAAK;EAC7C;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropzone.js","names":["React"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\n\n/** Why a file was rejected; the same codes as react-dropzone. */\ntype DropzoneErrorCode =\n | 'file-invalid-type'\n | 'file-too-large'\n | 'file-too-small'\n | 'too-many-files'\n\ntype DropzoneRejection = { file: File; errors: { code: DropzoneErrorCode }[] }\n\ntype DropzoneEvent =\n | React.DragEvent<HTMLElement>\n | React.ChangeEvent<HTMLInputElement>\n\ntype DropzoneProps = Omit<React.ComponentProps<'div'>, 'onDrop'> & {\n /** File types, as the file input's `accept` (`image/*, .csv, application/pdf`). */\n accept?: string\n /** Smallest file size in bytes. */\n minSize?: number\n /** Largest file size in bytes. */\n maxSize?: number\n /** Accept more than one file per drop. Default: true */\n multiple?: boolean\n /** Most files per drop when `multiple`; 0 means no limit. Default: 0 */\n maxFiles?: number\n disabled?: boolean\n invalid?: boolean\n /** Keep the browser from opening files dropped next to the zone. Default: true */\n preventDropOnDocument?: boolean\n /** Every drop or pick, with the files sorted into accepted and rejected. */\n onDrop?: (\n accepted: File[],\n rejections: DropzoneRejection[],\n event: DropzoneEvent,\n ) => void\n}\n\ntype DragState = 'idle' | 'active' | 'accept' | 'reject'\n\ntype DropzoneContextValue = { disabled: boolean; open: () => void }\n\nconst DropzoneContext = React.createContext<DropzoneContextValue | null>(null)\n\n/** Whether a file matches an `accept` list, like the file input (and attr-accept) does. */\nconst acceptsFile = (\n file: { name?: string; type?: string },\n accept?: string,\n) => {\n const types = (accept ?? '')\n .split(',')\n .map((type) => type.trim().toLowerCase())\n .filter(Boolean)\n\n if (!types.length) return true\n\n const name = (file.name ?? '').toLowerCase()\n const mime = (file.type ?? '').toLowerCase()\n const baseMime = mime.replace(/\\/.*$/, '')\n\n return types.some((type) => {\n if (type.startsWith('.')) return name.endsWith(type)\n if (type.endsWith('/*')) return baseMime === type.replace(/\\/.*$/, '')\n\n return mime === type\n })\n}\n\ntype CheckOptions = Pick<\n DropzoneProps,\n 'accept' | 'minSize' | 'maxSize' | 'multiple' | 'maxFiles'\n>\n\nconst isOverCount = (count: number, multiple = true, maxFiles = 0) =>\n (!multiple && count > 1) || (multiple && maxFiles >= 1 && count > maxFiles)\n\nconst fileErrors = (\n file: File,\n { accept, minSize, maxSize }: CheckOptions,\n): DropzoneRejection['errors'] => {\n const errors: DropzoneRejection['errors'] = []\n\n if (file.type !== 'application/x-moz-file' && !acceptsFile(file, accept)) {\n errors.push({ code: 'file-invalid-type' })\n }\n if (maxSize !== undefined && file.size > maxSize)\n errors.push({ code: 'file-too-large' })\n else if (minSize !== undefined && file.size < minSize)\n errors.push({ code: 'file-too-small' })\n\n return errors\n}\n\n/** Sorts files into accepted and rejected: type, then size, then the file count. */\nconst checkFiles = (files: File[], options: CheckOptions) => {\n const accepted: File[] = []\n const rejections: DropzoneRejection[] = []\n\n for (const file of files) {\n const errors = fileErrors(file, options)\n\n if (errors.length) rejections.push({ file, errors })\n else accepted.push(file)\n }\n\n if (isOverCount(accepted.length, options.multiple, options.maxFiles)) {\n rejections.push(\n ...accepted.map((file) => ({\n file,\n errors: [{ code: 'too-many-files' as const }],\n })),\n )\n accepted.length = 0\n }\n\n return { accepted, rejections }\n}\n\n/** The drag's verdict from the item types the browser shows while dragging (names come on drop). */\nconst dragStateOf = (\n transfer: DataTransfer | null,\n options: CheckOptions,\n): DragState => {\n const items = Array.from(transfer?.items ?? []).filter(\n (item) => item.kind === 'file',\n )\n\n if (!items.length) return 'active'\n\n const tooMany = isOverCount(items.length, options.multiple, options.maxFiles)\n const wrongType = items.some(\n (item) => item.type && !acceptsFile({ type: item.type }, options.accept),\n )\n\n return tooMany || wrongType ? 'reject' : 'accept'\n}\n\nconst flag = (on: boolean) => (on ? '' : undefined)\n\n/** A drop area with a hidden file input: drop files on it, or click it (or its trigger) to pick them. */\nconst Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n minSize,\n maxSize,\n multiple = true,\n maxFiles = 0,\n disabled = false,\n invalid = false,\n preventDropOnDocument = true,\n onDrop,\n className,\n children,\n role = 'group',\n onClick,\n onKeyDown,\n onDragEnter,\n onDragOver,\n onDragLeave,\n ...props\n },\n ref,\n ) => {\n const rootRef = React.useRef<HTMLDivElement | null>(null)\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n const dragDepth = React.useRef(0)\n const [dragState, setDragState] = React.useState<DragState>('idle')\n const options = { accept, minSize, maxSize, multiple, maxFiles }\n\n const setRefs = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const open = React.useCallback(() => {\n if (disabled || !inputRef.current) return\n // Picking the same file again must fire a change\n inputRef.current.value = ''\n inputRef.current.click()\n }, [disabled])\n\n const receive = (files: File[], event: DropzoneEvent) => {\n const { accepted, rejections } = checkFiles(files, options)\n onDrop?.(accepted, rejections, event)\n }\n\n React.useEffect(() => {\n if (!preventDropOnDocument) return\n const onDocumentDragOver = (event: DragEvent) => event.preventDefault()\n const onDocumentDrop = (event: DragEvent) => {\n if (rootRef.current?.contains(event.target as Node)) return\n event.preventDefault()\n }\n\n document.addEventListener('dragover', onDocumentDragOver)\n document.addEventListener('drop', onDocumentDrop)\n\n return () => {\n document.removeEventListener('dragover', onDocumentDragOver)\n document.removeEventListener('drop', onDocumentDrop)\n }\n }, [preventDropOnDocument])\n\n const context = React.useMemo(() => ({ disabled, open }), [disabled, open])\n\n return (\n <DropzoneContext.Provider value={context}>\n {/* oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- the role comes from props, `group` by default */}\n <div\n data-slot=\"dropzone\"\n role={role}\n aria-disabled={disabled || undefined}\n data-disabled={flag(disabled)}\n data-invalid={flag(invalid)}\n data-drag-active={flag(dragState !== 'idle')}\n data-drag-accept={flag(dragState === 'accept')}\n data-drag-reject={flag(dragState === 'reject')}\n className={cn(\n 'group/dropzone flex w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-gray-a7 bg-gray-2 px-4 py-6 text-center text-gray-a12 transition-colors outline-none motion-reduce:transition-none',\n 'hover:bg-gray-a2 data-[invalid]:border-error',\n 'data-[drag-active]:border-primary data-[drag-active]:bg-primary-soft',\n 'data-[drag-reject]:border-error data-[drag-reject]:bg-error-soft',\n 'data-[disabled]:cursor-default data-[disabled]:opacity-50 data-[disabled]:hover:bg-gray-2',\n className,\n )}\n ref={setRefs}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) open()\n }}\n // Like react-dropzone: Enter or Space on the focused zone itself opens the picker\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (\n event.target !== event.currentTarget ||\n !['Enter', ' '].includes(event.key)\n )\n return\n event.preventDefault()\n open()\n }}\n onDragEnter={(event) => {\n onDragEnter?.(event)\n event.preventDefault()\n if (disabled) return\n dragDepth.current += 1\n setDragState(dragStateOf(event.dataTransfer, options))\n }}\n onDragOver={(event) => {\n onDragOver?.(event)\n event.preventDefault()\n event.dataTransfer.dropEffect = disabled ? 'none' : 'copy'\n }}\n onDragLeave={(event) => {\n onDragLeave?.(event)\n event.preventDefault()\n dragDepth.current = Math.max(0, dragDepth.current - 1)\n if (dragDepth.current === 0) setDragState('idle')\n }}\n onDrop={(event) => {\n event.preventDefault()\n dragDepth.current = 0\n setDragState('idle')\n if (!disabled) receive(Array.from(event.dataTransfer.files), event)\n }}\n {...props}\n >\n <input\n accept={accept}\n data-slot=\"dropzone-input\"\n disabled={disabled}\n multiple={multiple}\n ref={inputRef}\n style={{ display: 'none' }}\n tabIndex={-1}\n type=\"file\"\n onChange={(event) =>\n receive(Array.from(event.target.files ?? []), event)\n }\n // The input sits inside the zone, whose click would open the picker again\n onClick={(event) => event.stopPropagation()}\n />\n {children}\n </div>\n </DropzoneContext.Provider>\n )\n },\n)\n\nDropzone.displayName = 'Dropzone'\n\ntype DropzoneMediaProps = React.ComponentProps<'div'>\n\n/** The icon above the message. */\nfunction DropzoneMedia({ className, ...props }: DropzoneMediaProps) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"dropzone-media\"\n className={cn(\n 'flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-a3 text-gray-a11 transition-colors motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-5',\n 'group-data-[drag-active]/dropzone:bg-primary-soft-hover group-data-[drag-active]/dropzone:text-primary',\n 'group-data-[invalid]/dropzone:bg-red-a3 group-data-[invalid]/dropzone:text-error-soft-foreground',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype DropzoneTitleProps = React.ComponentProps<'p'>\n\nfunction DropzoneTitle({ className, ...props }: DropzoneTitleProps) {\n return (\n <p\n data-slot=\"dropzone-title\"\n className={cn(\n 'text-sm leading-normal font-medium text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nfunction DropzoneDescription({\n className,\n ...props\n}: DropzoneDescriptionProps) {\n return (\n <p\n data-slot=\"dropzone-description\"\n className={cn('text-xs leading-normal text-gray-light', className)}\n {...props}\n />\n )\n}\n\ntype DropzoneTriggerProps = ButtonProps\n\n/** Opens the file picker; disabled with the zone. */\nfunction DropzoneTrigger({\n onClick,\n disabled,\n styleVariant = 'outline',\n ...props\n}: DropzoneTriggerProps) {\n const dropzone = React.useContext(DropzoneContext)\n if (!dropzone)\n throw new Error('DropzoneTrigger must be placed inside Dropzone.')\n\n return (\n <Button\n data-slot=\"dropzone-trigger\"\n disabled={disabled ?? dropzone.disabled}\n styleVariant={styleVariant}\n type=\"button\"\n onClick={(event) => {\n // The zone's own click would open the picker a second time\n event.stopPropagation()\n onClick?.(event)\n if (!event.defaultPrevented) dropzone.open()\n }}\n {...props}\n />\n )\n}\n\nexport {\n Dropzone,\n DropzoneDescription,\n DropzoneMedia,\n DropzoneTitle,\n DropzoneTrigger,\n acceptsFile,\n checkFiles,\n}\nexport type {\n DropzoneDescriptionProps,\n DropzoneErrorCode,\n DropzoneEvent,\n DropzoneMediaProps,\n DropzoneProps,\n DropzoneRejection,\n DropzoneTitleProps,\n DropzoneTriggerProps,\n}\n"],"mappings":";;;;;;;AA8CA,MAAM,kBAAkBA,QAAM,cAA2C,IAAI;;AAG7E,MAAM,eACJ,MACA,WACG;CACH,MAAM,SAAS,UAAU,IACtB,MAAM,GAAG,EACT,KAAK,SAAS,KAAK,KAAK,EAAE,YAAY,CAAC,EACvC,OAAO,OAAO;CAEjB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,MAAM,QAAQ,KAAK,QAAQ,IAAI,YAAY;CAC3C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AAiD;CAEnE,OACE,oBAAC,QAAD;EACE,aAAU;EACV,UAAU,YAAY,SAAS;EACjB;EACd,MAAK;EACL,UAAU,UAAU;GAElB,MAAM,gBAAgB;GACtB,UAAU,KAAK;GACf,IAAI,CAAC,MAAM,kBAAkB,SAAS,KAAK;EAC7C;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_components_icon = require("./icon.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
|
-
let class_variance_authority = require("class-variance-authority");
|
|
6
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let class_variance_authority = require("class-variance-authority");
|
|
7
7
|
let cn = require("cn");
|
|
8
8
|
//#region src/components/empty-state.tsx
|
|
9
9
|
const emptyStateVariants = (0, class_variance_authority.cva)("flex", {
|
|
@@ -7,7 +7,7 @@ import { SparkIcon } from "@epilot/spark-icons";
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
9
|
variant?: "ghost" | "dashed" | null | undefined;
|
|
10
|
-
size?: "
|
|
10
|
+
size?: "default" | "sm" | null | undefined;
|
|
11
11
|
layout?: "inline" | "stacked" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
4
3
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
4
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
9
|
variant?: "ghost" | "dashed" | null | undefined;
|
|
10
|
-
size?: "
|
|
10
|
+
size?: "default" | "sm" | null | undefined;
|
|
11
11
|
layout?: "inline" | "stacked" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { Icon } from "./icon.js";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
|
-
import { cva } from "class-variance-authority";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
7
|
//#region src/components/empty-state.tsx
|
|
8
8
|
const emptyStateVariants = cva("flex", {
|
|
9
9
|
variants: {
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_chunk.__toESM(react);
|
|
6
|
-
let class_variance_authority = require("class-variance-authority");
|
|
7
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let class_variance_authority = require("class-variance-authority");
|
|
8
8
|
let cn = require("cn");
|
|
9
9
|
//#region src/components/entity-card.tsx
|
|
10
10
|
const EntityCard = ({ className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -53,9 +53,9 @@ const EntityCardTitle = ({ className, ...rest }) => /* @__PURE__ */ (0, react_js
|
|
|
53
53
|
});
|
|
54
54
|
const stateToneVariants = (0, class_variance_authority.cva)("inline-flex items-center gap-1.5 text-xs font-medium", {
|
|
55
55
|
variants: { tone: {
|
|
56
|
-
success: "text-success",
|
|
57
|
-
warning: "text-warning",
|
|
58
|
-
error: "text-error",
|
|
56
|
+
success: "text-success-soft-foreground",
|
|
57
|
+
warning: "text-warning-soft-foreground",
|
|
58
|
+
error: "text-error-soft-foreground",
|
|
59
59
|
accent: "text-accent",
|
|
60
60
|
neutral: "text-gray-light"
|
|
61
61
|
} },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-card.cjs","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n data-slot=\"entity-card-body\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:-outline-offset-2',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,uFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,kBAAkB,EACtB,WACA,QACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,UAAD;CACE,MAAK;CACL,aAAU;CACV,YAAA,GAAA,GAAA,IACE,8HACA,UAAU,uDACV,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CAAK,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;CAAG,GAAI;AAAO,CAAA;AAG9E,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,oBAAA,GAAA,yBAAA,KAGJ,sHACA;CACE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,E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R,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,mBAAmB,EACvB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IACE,oFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,+EACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
1
|
+
{"version":3,"file":"entity-card.cjs","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n data-slot=\"entity-card-body\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:-outline-offset-2',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success-soft-foreground',\n warning: 'text-warning-soft-foreground',\n error: 'text-error-soft-foreground',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,uFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,kBAAkB,EACtB,WACA,QACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,UAAD;CACE,MAAK;CACL,aAAU;CACV,YAAA,GAAA,GAAA,IACE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AsB,kCAAkC;CAC5D,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,MAAM,mBAAmB,EACvB,WACA,MACA,UACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,MAAC,QAAD;CAAM,WAAW,kBAAkB;EAAE;EAAM;CAAU,CAAC;CAAG,GAAI;WAA7D,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,WAAW,gBAAgB,EAAE,KAAK,CAAC,EAAI,CAAA,GAC7C,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,WAAU;EAAY;CAAe,CAAA,CACvC;;AAGR,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,mBAAmB,EACvB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IACE,oFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,+EACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
6
|
//#region src/components/entity-card.tsx
|
|
7
7
|
const EntityCard = ({ className, ...rest }) => /* @__PURE__ */ jsx("div", {
|
|
8
8
|
className: cn("flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)", className),
|
|
@@ -50,9 +50,9 @@ const EntityCardTitle = ({ className, ...rest }) => /* @__PURE__ */ jsx("span",
|
|
|
50
50
|
});
|
|
51
51
|
const stateToneVariants = cva("inline-flex items-center gap-1.5 text-xs font-medium", {
|
|
52
52
|
variants: { tone: {
|
|
53
|
-
success: "text-success",
|
|
54
|
-
warning: "text-warning",
|
|
55
|
-
error: "text-error",
|
|
53
|
+
success: "text-success-soft-foreground",
|
|
54
|
+
warning: "text-warning-soft-foreground",
|
|
55
|
+
error: "text-error-soft-foreground",
|
|
56
56
|
accent: "text-accent",
|
|
57
57
|
neutral: "text-gray-light"
|
|
58
58
|
} },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-card.js","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n data-slot=\"entity-card-body\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:-outline-offset-2',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC,oBAAC,OAAD;CACE,WAAW,GACT,uFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,kBAAkB,EACtB,WACA,QACA,GAAG,WAEH,oBAAC,UAAD;CACE,MAAK;CACL,aAAU;CACV,WAAW,GACT,8HACA,UAAU,uDACV,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBA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EAAM,WAAW,gBAAgB,EAAE,KAAK,CAAC,EAAI,CAAA,GAC7C,oBAAC,QAAD;EAAM,WAAU;EAAY;CAAe,CAAA,CACvC;;AAGR,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GAAG,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,mBAAmB,EACvB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GACT,oFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,+EACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
1
|
+
{"version":3,"file":"entity-card.js","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n data-slot=\"entity-card-body\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:-outline-offset-2',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success-soft-foreground',\n warning: 'text-warning-soft-foreground',\n error: 'text-error-soft-foreground',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC,oBAAC,OAAD;CACE,WAAW,GACT,uFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,kBAAkB,EACtB,WACA,QACA,GAAG,WAEH,oBAAC,UAAD;CACE,MAAK;CACL,aAAU;CACV,WAAW,GACT,8HACA,UAAU,uDACV,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG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AAC,QAAD,EAAM,WAAW,gBAAgB,EAAE,KAAK,CAAC,EAAI,CAAA,GAC7C,oBAAC,QAAD;EAAM,WAAU;EAAY;CAAe,CAAA,CACvC;;AAGR,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GAAG,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,mBAAmB,EACvB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GACT,oFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,+EACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
@@ -2,16 +2,16 @@
|
|
|
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_hooks_use_isomorphic_layout_effect = require("../hooks/use-isomorphic-layout-effect.cjs");
|
|
6
5
|
const require_components_theme = require("./theme.cjs");
|
|
6
|
+
const require_hooks_use_isomorphic_layout_effect = require("../hooks/use-isomorphic-layout-effect.cjs");
|
|
7
7
|
const require_components_callout = require("./callout.cjs");
|
|
8
8
|
const require_components_separator = require("./separator.cjs");
|
|
9
9
|
const require_components_skeleton = require("./skeleton.cjs");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_chunk.__toESM(react);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
13
|
let class_variance_authority = require("class-variance-authority");
|
|
13
14
|
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
14
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
15
|
let cn = require("cn");
|
|
16
16
|
//#region src/components/field.tsx
|
|
17
17
|
const FieldContext = react.createContext(null);
|
|
@@ -113,7 +113,7 @@ function FieldLegend({ className, variant = "legend", children, ...props }) {
|
|
|
113
113
|
"data-invalid": fieldSet?.invalid || void 0,
|
|
114
114
|
"data-slot": "field-legend",
|
|
115
115
|
"data-variant": variant,
|
|
116
|
-
className: (0, cn.cn)("mb-1.5 font-medium text-gray data-[invalid=true]:text-error-
|
|
116
|
+
className: (0, cn.cn)("mb-1.5 font-medium text-gray data-[invalid=true]:text-error-soft-foreground! data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
|
|
117
117
|
...props,
|
|
118
118
|
children: [
|
|
119
119
|
children,
|
|
@@ -146,7 +146,7 @@ function FieldGroup({ className, ...props }) {
|
|
|
146
146
|
...props
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
const fieldVariants = (0, class_variance_authority.cva)("group/field relative flex w-full flex-col data-[invalid=true]:text-error-
|
|
149
|
+
const fieldVariants = (0, class_variance_authority.cva)("group/field relative flex w-full flex-col data-[invalid=true]:text-error-soft-foreground", {
|
|
150
150
|
variants: {
|
|
151
151
|
labelPosition: {
|
|
152
152
|
inset: "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)",
|
|
@@ -315,8 +315,8 @@ function FieldContent({ className, ...props }) {
|
|
|
315
315
|
...props
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
const fieldLabelClassName = "text-sm leading-5 font-normal text-gray transition-colors group-data-[invalid=true]/field:text-error-
|
|
319
|
-
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-
|
|
318
|
+
const fieldLabelClassName = "text-sm leading-5 font-normal text-gray transition-colors group-data-[invalid=true]/field:text-error-soft-foreground! motion-reduce:transition-none";
|
|
319
|
+
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-soft-foreground! group-data-[invalid=true]/field:text-error-soft-foreground! 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";
|
|
320
320
|
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-data-[warning=true]/field:border-input-warning group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none";
|
|
321
321
|
const notchColorClassName = {
|
|
322
322
|
brand: "border-input",
|
|
@@ -486,7 +486,7 @@ function FieldError({ className, children, errors, id, variant, ...props }) {
|
|
|
486
486
|
role: "alert",
|
|
487
487
|
"data-slot": "field-error",
|
|
488
488
|
id: id ?? owner?.errorId,
|
|
489
|
-
className: (0, cn.cn)("text-sm font-normal text-error", className),
|
|
489
|
+
className: (0, cn.cn)("text-sm font-normal text-error-soft-foreground", className),
|
|
490
490
|
...props,
|
|
491
491
|
children: content
|
|
492
492
|
});
|
|
@@ -511,7 +511,7 @@ function FieldWarning({ className, id, ...props }) {
|
|
|
511
511
|
role: "status",
|
|
512
512
|
"data-slot": "field-warning",
|
|
513
513
|
id: id ?? field?.warningId,
|
|
514
|
-
className: (0, cn.cn)("text-sm font-normal text-warning", className),
|
|
514
|
+
className: (0, cn.cn)("text-sm font-normal text-warning-soft-foreground", className),
|
|
515
515
|
...props
|
|
516
516
|
});
|
|
517
517
|
}
|
|
@@ -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 { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\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 /** A FieldLabel carries `labelId`, so controls can point `aria-labelledby` at it. */\n hasLabel: boolean\n setHasLabel: (has: boolean) => void\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n warningId: string\n hasWarning: boolean\n setHasWarning: (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\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 warningId = field?.hasWarning ? field.warningId : 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, warningId, 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 labelPosition: 'inset',\n inputStyle: 'soft',\n class:\n 'data-[warning=true]:inset-ring data-[warning=true]:inset-ring-input-warning',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class: 'data-[warning=true]:border-input-warning',\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 [hasWarning, setHasWarning] = useSlotCount()\n const [hasLabel, setHasLabel] = useSlotCount()\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 const invalid =\n dataInvalid === undefined ? hasError : String(dataInvalid) === 'true'\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 hasLabel,\n setHasLabel,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n warningId: `${fieldId}-warning`,\n hasWarning,\n setHasWarning,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasLabel,\n setHasLabel,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n hasWarning,\n setHasWarning,\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 data-warning={(hasWarning && !invalid) || 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-[[data-floating-control]]/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-data-[warning=true]/field:border-input-warning 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 const setHasLabel = field?.setHasLabel\n const carriesLabelId = field?.readOnly || props.id == null\n React.useEffect(() => {\n if (!setHasLabel || !carriesLabelId) return\n setHasLabel(true)\n return () => setHasLabel(false)\n }, [setHasLabel, carriesLabelId])\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 id={field?.labelId}\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 variant,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n /** `callout` (a FieldSet's default) draws an error Callout; `inline` (a Field's default) a red text line. */\n variant?: 'callout' | 'inline'\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 ((variant ?? (!field && fieldSet ? 'callout' : 'inline')) === 'callout') {\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 ?? owner?.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 ?? owner?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\n/** An advisory message: the value is accepted, but worth a second look. */\nfunction FieldWarning({\n className,\n id,\n ...props\n}: React.ComponentProps<'div'>) {\n const field = useFieldContext()\n const setHasWarning = field?.setHasWarning\n const hasContent = Boolean(props.children)\n const hasCustomId = id != null\n\n React.useEffect(() => {\n if (!hasContent || hasCustomId || !setHasWarning) return\n setHasWarning(true)\n return () => setHasWarning(false)\n }, [setHasWarning, hasContent, hasCustomId])\n\n if (!hasContent) return null\n\n return (\n <div\n role=\"status\"\n data-slot=\"field-warning\"\n id={id ?? field?.warningId}\n className={cn('text-sm font-normal text-warning', className)}\n {...props}\n />\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 FieldWarning,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAEA,SAAgB,qBAAqB;CACnC,MAAM,sBAAsB,gBAAgB,GAAG;CAC/C,2CAAA,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;CAKjC,MAAM,kBACJ;EALc,OAAO,WAAW,MAAM,UAAU,KAAA;EAChC,OAAO,aAAa,MAAM,YAAY,KAAA;EAClC,OAAO,iBAAiB,MAAM,gBAAgB,KAAA;EAG9B,SAAS;CAAe,EACzD,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,OAAO,YAAY,KAAA;EACW;EAAY;CAAW;AAC3E;AAkBA,MAAM,kBAAkBD,MAAM,cAA2C,IAAI;;AAG7E,SAAS,qBAAqB;CAC5B,OAAOA,MAAM,WAAW,eAAe,GAAG,WAAW,KAAA;AACvD;AAEA,SAAS,eAAe;CACtB,MAAM,CAAC,OAAO,YAAYA,MAAM,SAAS,CAAC;CAC1C,MAAM,SAASA,MAAM,aAClB,QAAiB,UAAU,MAAM,KAAK,MAAM,IA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,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,KAAK,YAAY,CAAC,SAAS,WAAW,YAAY,eAAe,WAE/D,OACE,iBAAA,GAAA,kBAAA,KAACI,2BAAAA,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACN;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;;AAGA,SAAS,aAAa,EACpB,WACA,IACA,GAAG,SAC2B;CAC9B,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,gBAAgB,OAAO;CAC7B,MAAM,aAAa,QAAQ,MAAM,QAAQ;CACzC,MAAM,cAAc,MAAM;CAE1B,MAAM,gBAAgB;EACpB,IAAI,CAAC,cAAc,eAAe,CAAC,eAAe;EAClD,cAAc,IAAI;EAClB,aAAa,cAAc,KAAK;CAClC,GAAG;EAAC;EAAe;EAAY;CAAW,CAAC;CAE3C,IAAI,CAAC,YAAY,OAAO;CAExB,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,YAAA,GAAA,GAAA,IAAc,oCAAoC,SAAS;EAC3D,GAAI;CACL,CAAA;AAEL"}
|
|
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 { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\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 /** A FieldLabel carries `labelId`, so controls can point `aria-labelledby` at it. */\n hasLabel: boolean\n setHasLabel: (has: boolean) => void\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n warningId: string\n hasWarning: boolean\n setHasWarning: (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\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 warningId = field?.hasWarning ? field.warningId : 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, warningId, 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-soft-foreground! 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-soft-foreground',\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 labelPosition: 'inset',\n inputStyle: 'soft',\n class:\n 'data-[warning=true]:inset-ring data-[warning=true]:inset-ring-input-warning',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class: 'data-[warning=true]:border-input-warning',\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 [hasWarning, setHasWarning] = useSlotCount()\n const [hasLabel, setHasLabel] = useSlotCount()\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 const invalid =\n dataInvalid === undefined ? hasError : String(dataInvalid) === 'true'\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 hasLabel,\n setHasLabel,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n warningId: `${fieldId}-warning`,\n hasWarning,\n setHasWarning,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasLabel,\n setHasLabel,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n hasWarning,\n setHasWarning,\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 data-warning={(hasWarning && !invalid) || 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-[[data-floating-control]]/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-soft-foreground! 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-soft-foreground! group-data-[invalid=true]/field:text-error-soft-foreground! 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-data-[warning=true]/field:border-input-warning 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 const setHasLabel = field?.setHasLabel\n const carriesLabelId = field?.readOnly || props.id == null\n React.useEffect(() => {\n if (!setHasLabel || !carriesLabelId) return\n setHasLabel(true)\n return () => setHasLabel(false)\n }, [setHasLabel, carriesLabelId])\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 id={field?.labelId}\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 variant,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n /** `callout` (a FieldSet's default) draws an error Callout; `inline` (a Field's default) a red text line. */\n variant?: 'callout' | 'inline'\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 ((variant ?? (!field && fieldSet ? 'callout' : 'inline')) === 'callout') {\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 ?? owner?.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 ?? owner?.errorId}\n className={cn(\n 'text-sm font-normal text-error-soft-foreground',\n className,\n )}\n {...props}\n >\n {content}\n </div>\n )\n}\n\n/** An advisory message: the value is accepted, but worth a second look. */\nfunction FieldWarning({\n className,\n id,\n ...props\n}: React.ComponentProps<'div'>) {\n const field = useFieldContext()\n const setHasWarning = field?.setHasWarning\n const hasContent = Boolean(props.children)\n const hasCustomId = id != null\n\n React.useEffect(() => {\n if (!hasContent || hasCustomId || !setHasWarning) return\n setHasWarning(true)\n return () => setHasWarning(false)\n }, [setHasWarning, hasContent, hasCustomId])\n\n if (!hasContent) return null\n\n return (\n <div\n role=\"status\"\n data-slot=\"field-warning\"\n id={id ?? field?.warningId}\n className={cn(\n 'text-sm font-normal text-warning-soft-foreground',\n className,\n )}\n {...props}\n />\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 FieldWarning,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAEA,SAAgB,qBAAqB;CACnC,MAAM,sBAAsB,gBAAgB,GAAG;CAC/C,2CAAA,gCAAgC;EAC9B,IAAI,CAAC,qBAAqB;EAC1B,oBAAoB,IAAI;EACxB,aAAa,oBAAoB,KAAK;CACxC,GAAG,CAAC,mBA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