@fuf-stack/uniform 1.28.0 → 2.0.0-next.1
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/README.md +6 -35
- package/dist/Checkboxes/index.d.mts +192 -263
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +294 -90
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +1278 -496
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +403 -83
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.d.mts +105 -98
- package/dist/FieldArray/index.d.mts.map +1 -1
- package/dist/FieldArray/index.mjs +344 -195
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.d.mts +37 -35
- package/dist/FieldCard/index.d.mts.map +1 -1
- package/dist/FieldCard/index.mjs +187 -128
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/{FieldCopyTestIdButton-9xTF-DBW.mjs → FieldCopyTestIdButton-DV0tkdh2.mjs} +4 -2
- package/dist/FieldCopyTestIdButton-DV0tkdh2.mjs.map +1 -0
- package/dist/FieldDescription-C4l0HKGL.mjs +36 -0
- package/dist/FieldDescription-C4l0HKGL.mjs.map +1 -0
- package/dist/FieldLabel-DKzqkuY1.mjs +125 -0
- package/dist/FieldLabel-DKzqkuY1.mjs.map +1 -0
- package/dist/FieldLayout-BLW5S-Jm.mjs +46 -0
- package/dist/FieldLayout-BLW5S-Jm.mjs.map +1 -0
- package/dist/FieldValidationError-DgkCL3cC.mjs +77 -0
- package/dist/FieldValidationError-DgkCL3cC.mjs.map +1 -0
- package/dist/Form/index.d.mts +12 -12
- package/dist/Form/index.d.mts.map +1 -1
- package/dist/Form/index.mjs +9 -7
- package/dist/Form/index.mjs.map +1 -1
- package/dist/{FormContext-CB7Glm02.mjs → FormContext-CHctWFAP.mjs} +51 -8
- package/dist/FormContext-CHctWFAP.mjs.map +1 -0
- package/dist/FormContext-CsFiNvuJ.d.mts.map +1 -1
- package/dist/Grid/index.mjs +1 -2
- package/dist/{Grid-CTs-Rb9G.mjs → Grid-DfcZeuib.mjs} +4 -2
- package/dist/Grid-DfcZeuib.mjs.map +1 -0
- package/dist/Input/index.d.mts +638 -394
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +414 -165
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +1588 -125
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +159 -114
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +300 -81
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +277 -86
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +1354 -109
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +105 -54
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +554 -3009
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +319 -177
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +416 -1328
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +276 -94
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/SubmitButton/index.d.mts.map +1 -1
- package/dist/SubmitButton/index.mjs +4 -1
- package/dist/SubmitButton/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +2 -1248
- package/dist/Switch/index.mjs +167 -68
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/Switch-CvPO8IF9.d.mts +601 -0
- package/dist/Switch-CvPO8IF9.d.mts.map +1 -0
- package/dist/SwitchBox/index.d.mts +135 -39
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +142 -87
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +295 -411
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +200 -48
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +1170 -601
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +162 -74
- package/dist/Time/index.mjs.map +1 -1
- package/dist/helpers/index.d.mts +1 -1
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/hooks/useClientValidation/index.mjs +1 -1
- package/dist/hooks/useController/index.d.mts +31 -3
- package/dist/hooks/useController/index.d.mts.map +1 -0
- package/dist/hooks/useController/index.mjs +1 -2
- package/dist/hooks/useFormContext/index.d.mts +65 -3
- package/dist/hooks/useFormContext/index.d.mts.map +1 -0
- package/dist/hooks/useFormContext/index.mjs +1 -2
- package/dist/hooks/useInputValueDebounce/index.d.mts +11 -5
- package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.mjs +27 -5
- package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
- package/dist/hooks/useInputValueTransform/index.d.mts +1 -2
- package/dist/hooks/useInputValueTransform/index.mjs +1 -2
- package/dist/hooks/useWatchFormReset/index.mjs +1 -1
- package/dist/hooks/useWatchUserChange/index.d.mts +2 -2
- package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
- package/dist/{useInputValueTransform-LOaEim7k.d.mts → index-BS8IoBOn.d.mts} +3 -3
- package/dist/index-BS8IoBOn.d.mts.map +1 -0
- package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -2
- package/dist/partials/FieldValidationError/index.d.mts +637 -3
- package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
- package/dist/partials/FieldValidationError/index.mjs +1 -2
- package/dist/radioControlVariants-Cm6WufWo.mjs +188 -0
- package/dist/radioControlVariants-Cm6WufWo.mjs.map +1 -0
- package/dist/switchVariants-BaQw2DA7.mjs +67 -0
- package/dist/switchVariants-BaQw2DA7.mjs.map +1 -0
- package/dist/timeVariants-B9HDfNYt.mjs +58 -0
- package/dist/timeVariants-B9HDfNYt.mjs.map +1 -0
- package/dist/{useController-BBSbeKbn.mjs → useController-BCFeZbBZ.mjs} +2 -2
- package/dist/{useController-BBSbeKbn.mjs.map → useController-BCFeZbBZ.mjs.map} +1 -1
- package/dist/{useFormContext-DNb_B8LQ.mjs → useFormContext-BPjJjNnM.mjs} +2 -2
- package/dist/{useFormContext-DNb_B8LQ.mjs.map → useFormContext-BPjJjNnM.mjs.map} +1 -1
- package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-Mw8YEOXT.mjs} +2 -2
- package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-Mw8YEOXT.mjs.map} +1 -1
- package/package.json +17 -29
- package/dist/FieldCopyTestIdButton-9xTF-DBW.mjs.map +0 -1
- package/dist/FieldValidationError-ByRoIxaM.mjs +0 -50
- package/dist/FieldValidationError-ByRoIxaM.mjs.map +0 -1
- package/dist/FormContext-CB7Glm02.mjs.map +0 -1
- package/dist/Grid-CTs-Rb9G.mjs.map +0 -1
- package/dist/Switch/index.d.mts.map +0 -1
- package/dist/hooks/useInput/index.d.mts +0 -2
- package/dist/hooks/useInput/index.mjs +0 -7
- package/dist/hooks/useInput/index.mjs.map +0 -1
- package/dist/hooks/useUniformField/index.d.mts +0 -100
- package/dist/hooks/useUniformField/index.d.mts.map +0 -1
- package/dist/hooks/useUniformField/index.mjs +0 -139
- package/dist/hooks/useUniformField/index.mjs.map +0 -1
- package/dist/hooks/useUniformFieldArray/index.d.mts +0 -73
- package/dist/hooks/useUniformFieldArray/index.d.mts.map +0 -1
- package/dist/hooks/useUniformFieldArray/index.mjs +0 -101
- package/dist/hooks/useUniformFieldArray/index.mjs.map +0 -1
- package/dist/index-CAdGtKE_.d.mts +0 -1
- package/dist/index-CaxrMD1A.d.mts +0 -1
- package/dist/index-CwJo1b4Z.d.mts +0 -1
- package/dist/useController-DcK2YHbw.d.mts +0 -32
- package/dist/useController-DcK2YHbw.d.mts.map +0 -1
- package/dist/useFormContext-BegmYvGA.d.mts +0 -66
- package/dist/useFormContext-BegmYvGA.d.mts.map +0 -1
- package/dist/useInput-C0aJaAGe.mjs +0 -2
- package/dist/useInput-ClpHDPdr.d.mts +0 -2
- package/dist/useInputValueTransform-LOaEim7k.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Grid"],"sources":["../../src/FieldArray/subcomponents/ElementAppendButton.tsx","../../src/FieldArray/subcomponents/ElementActionsMenu.tsx","../../src/FieldArray/subcomponents/ElementRemoveButton.tsx","../../src/FieldArray/subcomponents/SortDragHandle.tsx","../../src/FieldArray/subcomponents/FieldArrayElement.tsx","../../src/FieldArray/subcomponents/FieldArrayLabel.tsx","../../src/FieldArray/subcomponents/FieldArrayValidationError.tsx","../../src/FieldArray/subcomponents/SortContext.tsx","../../src/FieldArray/FieldArray.tsx","../../src/FieldArray/index.ts"],"sourcesContent":["import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaPlus } from 'react-icons/fa';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface ElementAppendButtonProps {\n /** text of the append element button */\n appendButtonText?: string;\n /** CSS class name */\n className?: ClassValue;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst ElementAppendButton = ({\n appendButtonText = 'Add Element',\n className = undefined,\n onClick,\n testId = undefined,\n}: ElementAppendButtonProps) => {\n return (\n <Button\n className={cn(className)}\n disableAnimation\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n >\n <FaPlus />\n <span>{appendButtonText}</span>\n </Button>\n );\n};\n\nexport default ElementAppendButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { MenuItem } from '@fuf-stack/pixels';\nimport type { Key } from 'react';\nimport type { FieldArrayElementMethods } from './FieldArrayElement';\n\nimport { FaCopy, FaTimes } from 'react-icons/fa';\nimport { VscInsert } from 'react-icons/vsc';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Menu } from '@fuf-stack/pixels';\n\nexport interface ElementActionsMenuProps {\n /** CSS class name */\n className?: ClassValue;\n /** Whether duplicate action is available */\n duplicate?: boolean;\n /** Whether insert after action is available */\n insertAfter?: boolean;\n /** Whether to show remove button (false when last element is not deletable) */\n showRemove?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Menu component for field array element actions (remove, duplicate, insert after)\n */\nconst ElementActionsMenu = ({\n className = undefined,\n duplicate = false,\n insertAfter = false,\n showRemove = true,\n methods,\n testId = undefined,\n}: ElementActionsMenuProps) => {\n const handleAction = (key: Key) => {\n switch (key) {\n case 'remove':\n methods.remove();\n break;\n case 'duplicate':\n methods.duplicate();\n break;\n case 'insertAfter':\n methods.insert();\n break;\n default:\n break;\n }\n };\n\n // Build menu items based on available actions\n const menuItems: MenuItem[] = [];\n\n if (duplicate) {\n menuItems.push({\n key: 'duplicate',\n label: 'Duplicate',\n icon: <FaCopy />,\n });\n }\n\n if (insertAfter) {\n menuItems.push({\n key: 'insertAfter',\n label: 'Insert After',\n icon: <VscInsert />,\n });\n }\n\n if (showRemove) {\n menuItems.push({\n key: 'remove',\n className: 'text-danger',\n label: 'Remove',\n icon: <FaTimes />,\n });\n }\n\n return (\n <Menu\n ariaLabel=\"Element actions\"\n items={menuItems}\n onAction={handleAction}\n placement=\"right\"\n testId={testId}\n triggerButtonProps={{\n className: cn(className),\n disableRipple: true,\n size: 'md',\n variant: 'light',\n }}\n />\n );\n};\n\nexport default ElementActionsMenu;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaTimes } from 'react-icons/fa';\n\nimport { motion } from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface ElementRemoveButtonProps {\n /** CSS class name */\n className?: ClassValue;\n /** Globally disable animations (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst ElementRemoveButton = ({\n className = undefined,\n disableAnimation = false,\n onClick,\n testId = undefined,\n}: ElementRemoveButtonProps) => {\n const button = (\n <Button\n ariaLabel=\"remove element\"\n className={cn(className)}\n color=\"danger\"\n icon={<FaTimes />}\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n />\n );\n\n if (disableAnimation) {\n return button;\n }\n\n return (\n <motion.div\n animate={{ opacity: 1, width: 'auto' }}\n className=\"flex\"\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n transition={{ duration: 0.2 }}\n >\n {button}\n </motion.div>\n );\n};\n\nexport default ElementRemoveButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaGripVertical } from 'react-icons/fa';\n\nimport { useSortable } from '@dnd-kit/sortable';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface SortDragHandleProps {\n /** Optional CSS class name */\n className?: ClassValue;\n /** Unique identifier for sortable item */\n id: string | number;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Drag handle component that integrates with dnd-kit sortable functionality.\n * Renders a vertical grip icon that can be used to reorder items.\n */\nconst SortDragHandle = ({\n className = undefined,\n id,\n testId = undefined,\n}: SortDragHandleProps) => {\n // Get dnd-kit sortable attributes and listeners\n const { attributes, listeners } = useSortable({ id });\n\n return (\n <div\n className={cn(className)}\n data-testid={testId}\n {...attributes}\n {...listeners}\n >\n <FaGripVertical />\n </div>\n );\n};\n\nexport default SortDragHandle;\n","import type { Variants as MotionVariants } from '@fuf-stack/pixel-motion';\nimport type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { FieldArrayFeatures } from '../types';\n\nimport { useState } from 'react';\n\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\n\nimport { AnimatePresence, motion } from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport Grid from '../../Grid';\nimport ElementActionsMenu from './ElementActionsMenu';\nimport ElementRemoveButton from './ElementRemoveButton';\nimport SortDragHandle from './SortDragHandle';\n\nexport interface FieldArrayElementMethods {\n /** Add new element at end */\n append: () => void;\n /** Clone current element */\n duplicate: () => void;\n /** Add new element after current */\n insert: () => void;\n /** Remove current element */\n remove: () => void;\n}\n\ninterface FieldArrayElementProps extends FieldArrayFeatures {\n /** Form elements to render inside array element */\n children: React.ReactNode;\n /** CSS class names for component parts */\n className: {\n /** Class of wrapper grid inside the li that wraps the rendered element fields directly */\n elementFieldsGrid?: ClassValue;\n /** Class for the li (performs motion animations) */\n listItem?: ClassValue;\n /** Class for the li inner div (wraps the rendered element fields) */\n listItemInner?: ClassValue;\n /** Class for the actions menu button */\n actionsMenuButton?: ClassValue;\n /** Class for the remove element button (when menu is not used) */\n removeButton?: ClassValue;\n /** Class for the drag handle when sorting enabled */\n sortDragHandle?: ClassValue;\n };\n /** Globally disable animations for this item (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** Bottom margin for elements (for backwards compatibility) */\n elementMarginBottom?: React.CSSProperties['marginBottom'];\n /** All fields in the form array */\n fields: Record<'id', string>[];\n /** Unique identifier for drag/drop */\n id: string | number;\n /** Field index in array */\n index: number;\n /** Prevent deletion of last remaining element */\n lastNotDeletable?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** HTML data-testid of the element */\n testId?: string;\n}\n\n/**\n * Form array element component using react-hook-form with drag-drop sorting\n * and validation capabilities. Animations when elements are added or removed\n * improve the user experience and provide a better visual feedback.\n */\nconst FieldArrayElement = ({\n children,\n className,\n disableAnimation = false,\n duplicate = false,\n elementMarginBottom: _elementMarginBottom = undefined,\n fields,\n id,\n index: _index,\n insertAfter = false,\n lastNotDeletable = true,\n methods,\n sortable = false,\n testId = undefined,\n}: FieldArrayElementProps) => {\n // Apply transform styles when sortable is enabled for smooth drag animations\n // transform: handles the item's position during drag\n // transition: controls the animation timing when dropping\n const { setNodeRef, transform, transition, isDragging } = useSortable({ id });\n const sortingStyle = sortable\n ? {\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isDragging ? 50 : undefined,\n }\n : undefined;\n\n // Local visibility to allow exit animation before removing from RHF state\n const [isVisible, setIsVisible] = useState(true);\n\n // Motion variants for the list item\n const listItemMotionVariants: MotionVariants = {\n hidden: { opacity: 0, height: 0, marginBottom: 0 },\n visible: {\n opacity: 1,\n height: 'auto',\n transition: { duration: 0.2, ease: 'circOut' },\n // push last visible item down to overlap with append button (hide double border)\n marginBottom: '-1px',\n },\n exit: {\n opacity: 0,\n height: 0,\n marginBottom: 0,\n transition: {\n // on exit first fade out, then shrink\n opacity: { duration: 0.1, ease: 'circOut' },\n height: { delay: 0.1, duration: 0.2, ease: 'circOut' },\n },\n },\n };\n\n // Height animation handled on <motion.li> using overflow hidden\n return (\n <AnimatePresence\n mode=\"wait\"\n // remove from RHF state after exit animation\n onExitComplete={() => {\n methods.remove();\n }}\n >\n {isVisible ? (\n <motion.li\n key={id}\n ref={setNodeRef}\n animate={disableAnimation ? undefined : 'visible'}\n className={cn(className.listItem)}\n data-dragging={isDragging}\n data-testid={`${testId}_element`}\n exit={disableAnimation ? undefined : 'exit'}\n initial={disableAnimation ? false : 'hidden'}\n style={sortingStyle}\n variants={disableAnimation ? undefined : listItemMotionVariants}\n >\n <div className={cn(className.listItemInner)}>\n {/** sorting drag handle */}\n {sortable ? (\n <SortDragHandle\n className={className.sortDragHandle}\n id={id}\n testId={`${testId}_sort_drag_handle`}\n />\n ) : null}\n\n {/** render element fields in Grid component */}\n <Grid\n className={cn(className.elementFieldsGrid)}\n testId={`${testId}_element_fields_grid`}\n >\n {/* render actual fields */}\n {children}\n </Grid>\n\n {/** actions menu when duplicate or insertAfter is enabled */}\n {duplicate || insertAfter ? (\n <ElementActionsMenu\n className={className.actionsMenuButton}\n duplicate={duplicate}\n insertAfter={insertAfter}\n methods={{\n ...methods,\n remove: () => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n },\n }}\n showRemove={!(lastNotDeletable && fields.length === 1)}\n testId={`${testId}_actions_menu`}\n />\n ) : (\n <>\n {/** remove element button (when menu is not used) */}\n <AnimatePresence initial={false}>\n {lastNotDeletable && fields.length === 1 ? null : (\n <ElementRemoveButton\n key=\"remove-button\"\n className={className.removeButton}\n disableAnimation={disableAnimation}\n onClick={() => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n }}\n testId={`${testId}_remove_button`}\n />\n )}\n </AnimatePresence>\n </>\n )}\n </div>\n </motion.li>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayElement;\n","import type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\n\nexport interface FieldArrayLabelProps {\n /** CSS class name */\n className?: string;\n /** Label content */\n label: ReactNode;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders the label for a FieldArray component.\n *\n * This component handles displaying the array label with proper accessibility\n * attributes using the label props from useUniformField.\n */\nconst FieldArrayLabel = ({\n className = undefined,\n label: _label,\n name,\n}: FieldArrayLabelProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n label: _label,\n });\n\n // when no label is provided, don't render anything\n if (!_label) {\n return null;\n }\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <div\n {...getLabelProps()}\n aria-level={3}\n className={cn(getLabelProps()?.className, className, {\n // when there are no array level errors, the label should have foreground color\n 'text-foreground!': !hasErrors,\n })}\n role=\"heading\"\n >\n {label}\n </div>\n );\n};\n\nexport default FieldArrayLabel;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldArrayValidationErrorProps {\n /** Field name */\n name: string;\n}\n\n/**\n * Renders array-level validation errors for FieldArray.\n *\n * This component handles validation errors that apply to the entire array\n * (e.g., \"Array must contain at least 3 elements\", \"Array elements are not unique\"),\n * as opposed to field-level errors which apply to individual array elements.\n *\n * The component wraps errors in the proper accessibility markup and animates\n * them in/out using Framer Motion when they appear or are resolved.\n */\nconst FieldArrayValidationError = ({\n name,\n}: FieldArrayValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-array-errors\"\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.4, ease: 'circOut' }}\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible and add padding (pt-1 to compensate for inner content's top padding)\n 'block px-3 pb-2 pt-1',\n )}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayValidationError;\n","import type { DragEndEvent } from '@dnd-kit/core';\nimport type { ReactNode } from 'react';\nimport type { UseFieldArrayMove } from 'react-hook-form';\n\nimport { useFormContext } from 'react-hook-form';\n\nimport {\n closestCenter,\n DndContext,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {\n restrictToVerticalAxis,\n restrictToWindowEdges,\n} from '@dnd-kit/modifiers';\nimport {\n SortableContext,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable';\n\ninterface SortContextProps {\n /** child components */\n children: ReactNode;\n /** Array of objects containing unique IDs for sortable items */\n fields: Record<'id', string>[];\n /** name of the field array */\n name: string;\n /** react-hook-form's move function to update field array indices */\n move: UseFieldArrayMove;\n /** enable/disable sorting functionality */\n sortable: boolean;\n}\n\n/**\n * A wrapper component that provides drag-and-drop sorting functionality for field arrays\n * using dnd-kit and react-hook-form.\n *\n * This component integrates with react-hook-form's field arrays to enable vertical\n * drag-and-drop reordering of form fields. It supports both pointer (mouse/touch)\n * and keyboard interactions for accessibility.\n */\nconst SortContext = ({\n children,\n fields,\n move,\n name,\n sortable,\n}: SortContextProps): ReactNode => {\n const { trigger } = useFormContext();\n\n // Initialize sensors for both pointer (mouse/touch) and keyboard interactions\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor),\n );\n\n // Early return if sorting is disabled\n if (!sortable) {\n return children;\n }\n\n /**\n * Handles the end of a drag operation by updating field positions\n * @param event - The drag end event containing active and over elements\n */\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n\n // Only move if dropping over a different item\n if (active.id !== over?.id) {\n // Find the indices of the dragged item and drop target\n const oldIndex = fields.findIndex((field) => {\n return field.id === active.id;\n });\n const newIndex = fields.findIndex((field) => {\n return field.id === over?.id;\n });\n // Update the field array order using react-hook-form's move function\n move(oldIndex, newIndex);\n\n // Finally trigger validation for the array field,\n // so validation errors are updated for the new order\n trigger(name);\n }\n };\n\n return (\n <DndContext\n collisionDetection={closestCenter}\n modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}\n onDragEnd={handleDragEnd}\n sensors={sensors}\n >\n <SortableContext\n items={fields.map((field) => {\n return field.id;\n })}\n strategy={verticalListSortingStrategy}\n >\n {children}\n </SortableContext>\n </DndContext>\n );\n};\n\nexport default SortContext;\n","import type { FieldArrayElementMethods } from './subcomponents/FieldArrayElement';\nimport type { FieldArrayProps } from './types';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { flatArrayKey } from '../helpers';\nimport { useUniformFieldArray } from '../hooks/useUniformFieldArray';\nimport ElementAppendButton from './subcomponents/ElementAppendButton';\nimport FieldArrayElement from './subcomponents/FieldArrayElement';\nimport FieldArrayLabel from './subcomponents/FieldArrayLabel';\nimport FieldArrayValidationError from './subcomponents/FieldArrayValidationError';\nimport SortContext from './subcomponents/SortContext';\n\nexport const fieldArrayVariants = tv({\n slots: {\n /** base class for the field array wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border border-divider bg-content1',\n // divider between items\n 'divide-y divide-divider',\n ],\n /** class for the actions menu button */\n actionsMenuButton: [\n // base styles\n 'flex items-center justify-center text-default-600',\n // fixed height/no round corners/center align\n 'h-full rounded-none',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the append button */\n appendButton: [\n // base styles\n 'w-full justify-start rounded-b-small rounded-t-none font-semibold',\n // match label height (p-3 = 12px vertical padding + text-base line height)\n '!h-[48px] !min-h-0',\n // focus styles - inset ring with rounded bottom corners to match container\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the element fields grid */\n elementFieldsGrid: ['w-full grow p-3'],\n /** class for the label */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) instead of text-base for correct 48px height\n 'rounded-t-small p-3 font-semibold text-medium',\n ],\n /** class for the list */\n list: ['overflow-hidden'],\n /** class for the list wrapper */\n listWrapper: ['overflow-hidden'],\n /** class for the list item (performs motion animations) */\n listItem: [\n // base styles\n 'group relative flex flex-row',\n // overlap borders by shifting first item up 1px (similar to how last item overlaps with append button)\n 'first:-mt-px',\n ],\n /** class for the list item inner */\n listItemInner: [\n // base styles\n 'flex w-full flex-row items-stretch divide-divider bg-content1',\n // x division and borders\n 'divide-x divide-solid border-b border-t border-divider',\n ],\n /** class for the remove button */\n removeButton: [\n // base styles\n 'flex items-center justify-center',\n // fixed height/no round corners\n '!h-full !min-h-0 !rounded-none px-3',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the sort drag handle */\n sortDragHandle: [\n // base styles\n 'flex cursor-grab items-center justify-center px-2 text-default-600 transition-colors',\n // hover and dragging state\n 'hover:bg-default-100 active:cursor-grabbing group-data-[dragging=true]:bg-default-100',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n },\n variants: {\n hasLabel: {\n false: {\n // focus styles - when there is no label, the first item actions menu button should have rounded top right corners\n actionsMenuButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item remove button focus ring should have rounded top right corners\n removeButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item sort drag handle focus ring should have rounded top left corners\n sortDragHandle:\n 'group-[:first-child]:rounded-tl-small group-[:first-child]:group-data-[dragging=true]:rounded-tl-none',\n },\n },\n },\n});\n\n/**\n * FieldArray component based in [RHF useFieldArray](https://react-hook-form.com/docs/usefieldarray)\n */\nconst FieldArray = ({\n appendButtonText = 'Add Element',\n children,\n className: _className = undefined,\n duplicate = false,\n elementInitialValue: _elementInitialValue = null,\n elementMarginBottom = undefined,\n flat = false,\n insertAfter = false,\n lastElementNotRemovable = false,\n name,\n sortable = false,\n ...uniformFieldProps\n}: FieldArrayProps) => {\n const {\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n getValues,\n testId,\n } = useUniformFieldArray({\n name,\n flat,\n elementInitialValue: _elementInitialValue,\n lastElementNotRemovable,\n ...uniformFieldProps,\n });\n\n // className from slots\n const variants = fieldArrayVariants({ hasLabel: !!uniformFieldProps.label });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* field array label */}\n <FieldArrayLabel\n className={className.label}\n label={uniformFieldProps.label}\n name={name}\n />\n\n {fields.length ? (\n /* list wrapper */\n <div className={cn(className.listWrapper)}>\n {/* sortable context */}\n <SortContext\n fields={fields}\n move={move}\n name={name}\n sortable={sortable}\n >\n {/* list container */}\n <ul className={className.list} data-testid={testId}>\n {/* fields / list elements */}\n {fields.map((field, index) => {\n const elementName = flat\n ? `${name}.${index}.${flatArrayKey}`\n : `${name}.${index}`;\n const elementTestId = `${testId}_${index}`;\n\n // create methods for element\n const elementMethods: FieldArrayElementMethods = {\n append: () => {\n append(elementInitialValue);\n },\n duplicate: () => {\n const values = getValues(name);\n const currentValue = (values as unknown[])[index];\n const nextValue = flat\n ? { [flatArrayKey]: currentValue }\n : currentValue;\n insert(index + 1, nextValue);\n },\n insert: () => {\n insert(index + 1, elementInitialValue);\n },\n remove: () => {\n remove(index);\n },\n };\n\n return (\n <FieldArrayElement\n key={field.id}\n className={className}\n disableAnimation={disableAnimation}\n duplicate={duplicate}\n elementMarginBottom={elementMarginBottom}\n fields={fields}\n id={field.id}\n index={index}\n insertAfter={insertAfter}\n lastNotDeletable={lastElementNotRemovable}\n methods={elementMethods}\n sortable={sortable}\n testId={elementTestId}\n >\n {children({\n index,\n length: fields.length,\n methods: elementMethods,\n name: elementName,\n testId: elementTestId,\n })}\n </FieldArrayElement>\n );\n })}\n </ul>\n </SortContext>\n </div>\n ) : null}\n\n {/* top level field array errors */}\n <FieldArrayValidationError name={name} />\n\n {/* append elements button */}\n <ElementAppendButton\n appendButtonText={appendButtonText}\n className={className.appendButton}\n onClick={() => {\n append(elementInitialValue);\n }}\n testId={`${testId}_append_button`}\n />\n </div>\n );\n};\n\nexport default FieldArray;\n","import FieldArray from './FieldArray';\n\nexport type * from './types';\n\nexport { fieldArrayVariants } from './FieldArray';\n\nexport default FieldArray;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,uBAAuB,EAC3B,mBAAmB,eACnB,YAAY,KAAA,GACZ,SACA,SAAS,KAAA,QACqB;CAC9B,OACE,qBAAC,QAAD;EACE,WAAW,GAAG,SAAS;EACvB,kBAAA;EACS;EACT,MAAK;EACG;EACR,SAAQ;EANV,UAAA,CAQE,oBAAC,QAAD,CAAS,CAAA,GACT,oBAAC,QAAD,EAAA,UAAO,iBAAuB,CAAA,CACxB;;AAEZ;;;;;;ACRA,MAAM,sBAAsB,EAC1B,YAAY,KAAA,GACZ,YAAY,OACZ,cAAc,OACd,aAAa,MACb,SACA,SAAS,KAAA,QACoB;CAC7B,MAAM,gBAAgB,QAAa;EACjC,QAAQ,KAAR;GACE,KAAK;IACH,QAAQ,OAAO;IACf;GACF,KAAK;IACH,QAAQ,UAAU;IAClB;GACF,KAAK,eACH,QAAQ,OAAO;EAInB;CACF;CAGA,MAAM,YAAwB,CAAC;CAE/B,IAAI,WACF,UAAU,KAAK;EACb,KAAK;EACL,OAAO;EACP,MAAM,oBAAC,QAAD,CAAS,CAAA;CACjB,CAAC;CAGH,IAAI,aACF,UAAU,KAAK;EACb,KAAK;EACL,OAAO;EACP,MAAM,oBAAC,WAAD,CAAY,CAAA;CACpB,CAAC;CAGH,IAAI,YACF,UAAU,KAAK;EACb,KAAK;EACL,WAAW;EACX,OAAO;EACP,MAAM,oBAAC,SAAD,CAAU,CAAA;CAClB,CAAC;CAGH,OACE,oBAAC,MAAD;EACE,WAAU;EACV,OAAO;EACP,UAAU;EACV,WAAU;EACF;EACR,oBAAoB;GAClB,WA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AAS;QAC7B;QACA,cAAc;SACZ,OAAO,QAAQ,GAAG,mBAAmB;QACvC;QACA,cAAc;SACZ,OAAO,KAAK;QACd;OACF;OAEA,OACE,oBAAC,mBAAD;QAEa;QACO;QACP;QACU;QACb;QACR,IAAI,MAAM;QACH;QACM;QACb,kBAAkB;QAClB,SAAS;QACC;QACV,QAAQ;QAEP,UAAA,SAAS;SACR;SACA,QAAQ,OAAO;SACf,SAAS;SACT,MAAM;SACN,QAAQ;QACV,CAAC;OACgB,GArBZ,MAAM,EAqBM;MAEvB,CAAC;KACC,CAAA;IACO,CAAA;GACV,CAAA,IACH;GAGJ,oBAAC,2BAAD,EAAiC,KAAO,CAAA;GAGxC,oBAAC,qBAAD;IACoB;IAClB,WAAW,UAAU;IACrB,eAAe;KACb,OAAO,mBAAmB;IAC5B;IACA,QAAQ,GAAG,OAAO;GACnB,CAAA;EACE;;AAET;;;ACxOA,IAAA,qBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["useRHFFieldArray","useFormContext","Grid"],"sources":["../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../src/FieldArray/fieldArrayVariants.ts","../../src/FieldArray/subcomponents/ElementAppendButton.tsx","../../src/FieldArray/subcomponents/ElementActionsMenu.tsx","../../src/FieldArray/subcomponents/ElementRemoveButton.tsx","../../src/FieldArray/subcomponents/SortDragHandle.tsx","../../src/FieldArray/subcomponents/FieldArrayElement.tsx","../../src/FieldArray/subcomponents/FieldArrayLabel.tsx","../../src/FieldArray/subcomponents/fieldArrayValidationErrorVariants.ts","../../src/FieldArray/subcomponents/FieldArrayValidationError.tsx","../../src/FieldArray/subcomponents/SortContext.tsx","../../src/FieldArray/subcomponents/FieldArrayControl.tsx","../../src/FieldArray/FieldArray.tsx","../../src/FieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type {\n FieldArray as ArrayElement,\n ArrayPath,\n FieldValues,\n Path,\n} from 'react-hook-form';\nimport type { UniformFieldState } from '../useUniformField/types';\nimport type { FieldArrayElementMethods, FieldArrayItem } from './types';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey, isValueEmpty } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport useUniformField from '../useUniformField/useUniformField';\nimport { useWatchFormReset } from '../useWatchFormReset';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Disable the field */\n disabled?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)\n * - Animation control (disabled during initialization)\n * - Temporary animation disable during reset normalization collapse\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArrayMethods = <\n TFieldValues extends FieldValues = FieldValues,\n>(\n {\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n }: UseUniformFieldArrayProps<TFieldValues>,\n uniformField: UniformFieldState<TFieldValues>,\n) => {\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move, replace } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue, getValues } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // lastElementNotRemovable is purely a minimum-count guarantee: when there are\n // no rows, add one. This handles both:\n // - Initial mount: fields.length starts at 0\n // - Form reset to an empty array: fields.length becomes 0 again\n // It intentionally does NOT inspect row contents, so manually added empty rows\n // are never collapsed.\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Reset normalization:\n // Run ONLY when an actual form reset is emitted (via useWatchFormReset), not\n // on regular field edits. This does not collapse rows users add manually.\n //\n // Why this exists:\n // RHF can keep stale field-array rows after reset when array defaults are\n // missing (e.g. value becomes undefined or [null, null] while UI still has\n // multiple rows). We normalize this reset-only state to:\n // - one row when lastElementNotRemovable is enabled\n // - zero rows otherwise\n useWatchFormReset({\n onReset: () => {\n const currentValue = getValues(name as Path<TFieldValues>) as unknown;\n const valueIsArray = Array.isArray(currentValue);\n const arrayValue = valueIsArray ? (currentValue as unknown[]) : [];\n const normalizedLength = lastElementNotRemovable ? 1 : 0;\n const alreadyNormalized =\n valueIsArray && arrayValue.length === normalizedLength;\n\n // Treat these as \"effectively empty after reset\":\n // - value missing/not-array\n // - empty array\n // - array where all entries are empty placeholders\n const isEffectivelyEmptyAfterReset =\n !valueIsArray ||\n arrayValue.length === 0 ||\n arrayValue.every((entry) => {\n return isValueEmpty(entry);\n });\n\n // Nothing to fix when the reset restored real values (e.g. from defaults).\n if (!isEffectivelyEmptyAfterReset) {\n return;\n }\n\n // Already normalized to the target row count.\n if (alreadyNormalized) {\n return;\n }\n\n // Avoid collapse animation flicker during reset normalization.\n setDisableAnimation(true);\n\n // use replace so the RHF field-array length actually matches the target.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n replace((lastElementNotRemovable ? [elementInitialValue] : []) as any);\n\n // Restore normal animation state right after normalization.\n if (!prefersReducedMotion) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n },\n });\n\n // Initialization/Re-initialization: add one element only when array length is 0.\n // This is the min-count behavior for lastElementNotRemovable and is intentionally\n // separate from reset normalization above.\n //\n // Reset behavior in this hook is split into two phases:\n // 1) Reset normalization (useWatchFormReset): collapse stale placeholder rows\n // left by reset edge cases.\n // 2) Length-based initialization (this effect): ensure a min-one array when\n // the field array is truly empty.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n const { testId } = uniformField.field;\n\n // bind row identification and operations for the renderer\n const items: FieldArrayItem[] = fields.map((row, index) => {\n const elementName = flat\n ? `${name}.${index}.${flatArrayKey}`\n : `${name}.${index}`;\n const elementTestId = `${testId}_${index}`;\n\n const methods: FieldArrayElementMethods = {\n append: () => {\n append(elementInitialValue as ArrayElement<TFieldValues>);\n },\n duplicate: () => {\n const values = getValues(name as Path<TFieldValues>);\n const currentValue = (values as unknown as unknown[])[index];\n\n insert(\n index + 1,\n (flat\n ? { [flatArrayKey]: currentValue }\n : currentValue) as ArrayElement<TFieldValues>,\n );\n },\n insert: () => {\n insert(index + 1, elementInitialValue as ArrayElement<TFieldValues>);\n },\n remove: () => {\n remove(index);\n },\n };\n\n return {\n id: row.id,\n renderProps: {\n index,\n length: fields.length,\n methods,\n name: elementName,\n testId: elementTestId,\n },\n };\n });\n\n // append an element using the configured initial value\n const appendItem = () => {\n append(elementInitialValue as ArrayElement<TFieldValues>);\n };\n\n // validate the array after its row order changes\n const moveItem = (from: number, to: number) => {\n move(from, to);\n trigger(name as Path<TFieldValues>);\n };\n\n return {\n // Field array methods and state\n fields,\n append,\n appendItem,\n items,\n remove,\n insert,\n move,\n moveItem,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n\nconst useUniformFieldArray = <TFieldValues extends FieldValues = FieldValues>(\n params: UseUniformFieldArrayProps<TFieldValues>,\n) => {\n const field = useUniformField<TFieldValues>({\n ...params,\n name: params.name as Path<TFieldValues> & string,\n });\n return useUniformFieldArrayMethods(params, field);\n};\nexport default useUniformFieldArray;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const fieldArrayVariants = tv({\n slots: {\n /** class for the actions menu button */\n actionsMenuButton: [\n // base styles\n 'flex items-center justify-center text-default-600',\n // fixed height/no round corners/center align\n 'h-full rounded-none',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the append button */\n appendButton: [\n // base styles\n 'w-full justify-start rounded-b-small rounded-t-none font-semibold',\n // match label height (p-3 = 12px vertical padding + text-base line height)\n '!h-[48px] !min-h-0',\n // focus styles - inset ring with rounded bottom corners to match container\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** base class for the field array wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border border-divider bg-content1',\n // divider between items\n 'divide-y divide-divider',\n ],\n /** class for the element fields grid */\n elementFieldsGrid: ['w-full grow p-3'],\n /** class for the label */\n label: [\n // keep the label in normal flow at full width\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) instead of text-base for correct 48px height\n 'rounded-t-small p-3 font-semibold text-medium',\n ],\n /** class for the list */\n list: ['overflow-hidden'],\n /** class for the list item (performs motion animations) */\n listItem: [\n // base styles\n 'group relative flex flex-row',\n // overlap borders by shifting first item up 1px (similar to how last item overlaps with append button)\n 'first:-mt-px',\n ],\n /** class for the list item inner */\n listItemInner: [\n // base styles\n 'flex w-full flex-row items-stretch divide-divider bg-content1',\n // x division and borders\n 'divide-x divide-solid border-b border-t border-divider',\n ],\n /** class for the list wrapper */\n listWrapper: ['overflow-hidden'],\n /** class for the remove button */\n removeButton: [\n // base styles\n 'flex items-center justify-center',\n // fixed height/no round corners\n '!h-full !min-h-0 !rounded-none px-3',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the sort drag handle */\n sortDragHandle: [\n // base styles\n 'flex cursor-grab items-center justify-center px-2 text-default-600 transition-colors',\n // hover and dragging state\n 'hover:bg-default-100 active:cursor-grabbing group-data-[dragging=true]:bg-default-100',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n },\n variants: {\n hasLabel: {\n false: {\n // focus styles - when there is no label, the first item actions menu button should have rounded top right corners\n actionsMenuButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item remove button focus ring should have rounded top right corners\n removeButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item sort drag handle focus ring should have rounded top left corners\n sortDragHandle:\n 'group-[:first-child]:rounded-tl-small group-[:first-child]:group-data-[dragging=true]:rounded-tl-none',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof fieldArrayVariants>;\n\nexport type ClassName = TVClassName<typeof fieldArrayVariants>;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaPlus } from 'react-icons/fa';\n\nimport { Button } from '@fuf-stack/pixels';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\ninterface ElementAppendButtonProps {\n /** text of the append element button */\n appendButtonText?: string;\n /** CSS class name */\n className?: ClassValue;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\nconst ElementAppendButton = ({\n appendButtonText = 'Add Element',\n className = undefined,\n onClick,\n testId = undefined,\n}: ElementAppendButtonProps) => {\n const { cn } = useStyling();\n return (\n <Button\n className={cn(className)}\n disableAnimation\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n >\n <FaPlus />\n <span>{appendButtonText}</span>\n </Button>\n );\n};\n\nexport default ElementAppendButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { MenuItem } from '@fuf-stack/pixels';\nimport type { Key } from 'react';\nimport type { FieldArrayElementMethods } from './FieldArrayElement';\n\nimport { FaCopy, FaTimes } from 'react-icons/fa';\nimport { VscInsert } from 'react-icons/vsc';\n\nimport { Menu } from '@fuf-stack/pixels';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nexport interface ElementActionsMenuProps {\n /** CSS class name */\n className?: ClassValue;\n /** Whether duplicate action is available */\n duplicate?: boolean;\n /** Whether insert after action is available */\n insertAfter?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** Whether to show remove button (false when last element is not deletable) */\n showRemove?: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/**\n * Menu component for field array element actions (remove, duplicate, insert after)\n */\nconst ElementActionsMenu = ({\n className = undefined,\n duplicate = false,\n insertAfter = false,\n showRemove = true,\n methods,\n testId = undefined,\n}: ElementActionsMenuProps) => {\n const { cn } = useStyling();\n\n // dispatch the selected row action\n const handleAction = (key: Key) => {\n switch (key) {\n case 'remove':\n methods.remove();\n break;\n case 'duplicate':\n methods.duplicate();\n break;\n case 'insertAfter':\n methods.insert();\n break;\n default:\n break;\n }\n };\n\n // include the enabled row actions\n const menuItems: MenuItem[] = [];\n\n if (duplicate) {\n menuItems.push({\n key: 'duplicate',\n label: 'Duplicate',\n icon: <FaCopy />,\n });\n }\n\n if (insertAfter) {\n menuItems.push({\n key: 'insertAfter',\n label: 'Insert After',\n icon: <VscInsert />,\n });\n }\n\n if (showRemove) {\n menuItems.push({\n key: 'remove',\n className: 'text-danger',\n label: 'Remove',\n icon: <FaTimes />,\n });\n }\n\n return (\n <Menu\n ariaLabel=\"Element actions\"\n items={menuItems}\n onAction={handleAction}\n placement=\"right\"\n testId={testId}\n triggerButtonProps={{\n className: cn(className),\n disableRipple: true,\n size: 'md',\n variant: 'light',\n }}\n />\n );\n};\n\nexport default ElementActionsMenu;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaTimes } from 'react-icons/fa';\n\nimport { motion } from '@fuf-stack/pixel-motion';\nimport { Button } from '@fuf-stack/pixels';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\ninterface ElementRemoveButtonProps {\n /** CSS class name */\n className?: ClassValue;\n /** Globally disable animations (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\nconst ElementRemoveButton = ({\n className = undefined,\n disableAnimation = false,\n onClick,\n testId = undefined,\n}: ElementRemoveButtonProps) => {\n const { cn } = useStyling();\n\n const button = (\n <Button\n ariaLabel=\"remove element\"\n className={cn(className)}\n color=\"danger\"\n icon={<FaTimes />}\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n />\n );\n\n if (disableAnimation) {\n return button;\n }\n\n return (\n <motion.div\n animate={{ opacity: 1, width: 'auto' }}\n className=\"flex\"\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n transition={{ duration: 0.2 }}\n >\n {button}\n </motion.div>\n );\n};\n\nexport default ElementRemoveButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaGripVertical } from 'react-icons/fa';\n\nimport { useSortable } from '@dnd-kit/sortable';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\ninterface SortDragHandleProps {\n /** CSS class name */\n className?: ClassValue;\n /** Unique identifier for sortable item */\n id: string | number;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/**\n * Drag handle component that integrates with dnd-kit sortable functionality.\n * Renders a vertical grip icon that can be used to reorder items.\n */\nconst SortDragHandle = ({\n className = undefined,\n id,\n testId = undefined,\n}: SortDragHandleProps) => {\n const { cn } = useStyling();\n const { attributes, listeners } = useSortable({ id });\n\n return (\n <div\n className={cn(className)}\n data-testid={testId}\n {...attributes}\n {...listeners}\n aria-label=\"Reorder item\"\n >\n <FaGripVertical />\n </div>\n );\n};\n\nexport default SortDragHandle;\n","import type { Variants as MotionVariants } from '@fuf-stack/pixel-motion';\nimport type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { FieldArrayElementMethods } from '../../hooks/useUniformFieldArray/types';\nimport type { FieldArrayFeatures } from '../types';\n\nimport { useState } from 'react';\n\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\n\nimport { AnimatePresence, motion } from '@fuf-stack/pixel-motion';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport Grid from '../../Grid';\nimport ElementActionsMenu from './ElementActionsMenu';\nimport ElementRemoveButton from './ElementRemoveButton';\nimport SortDragHandle from './SortDragHandle';\n\nexport type { FieldArrayElementMethods } from '../../hooks/useUniformFieldArray/types';\n\ninterface FieldArrayElementProps extends FieldArrayFeatures {\n /** Form elements to render inside array element */\n children: React.ReactNode;\n /** CSS class name */\n className: {\n /** Class of wrapper grid inside the li that wraps the rendered element fields directly */\n elementFieldsGrid?: ClassValue;\n /** Class for the li (performs motion animations) */\n listItem?: ClassValue;\n /** Class for the li inner div (wraps the rendered element fields) */\n listItemInner?: ClassValue;\n /** Class for the actions menu button */\n actionsMenuButton?: ClassValue;\n /** Class for the remove element button (when menu is not used) */\n removeButton?: ClassValue;\n /** Class for the drag handle when sorting enabled */\n sortDragHandle?: ClassValue;\n };\n /** Globally disable animations for this item (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** Bottom margin for elements (for backwards compatibility) */\n elementMarginBottom?: React.CSSProperties['marginBottom'];\n /** All fields in the form array */\n fields: Record<'id', string>[];\n /** Unique identifier for drag/drop */\n id: string | number;\n /** Field index in array */\n index: number;\n /** Prevent deletion of last remaining element */\n lastNotDeletable?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/**\n * Form array element component using react-hook-form with drag-drop sorting\n * and validation capabilities. Animations when elements are added or removed\n * improve the user experience and provide a better visual feedback.\n */\nconst FieldArrayElement = ({\n children,\n className,\n disableAnimation = false,\n duplicate = false,\n elementMarginBottom: _elementMarginBottom = undefined,\n fields,\n id,\n index: _index,\n insertAfter = false,\n lastNotDeletable = true,\n methods,\n sortable = false,\n testId = undefined,\n}: FieldArrayElementProps) => {\n const { cn } = useStyling();\n const { setNodeRef, transform, transition, isDragging } = useSortable({ id });\n // keep the row mounted until its exit animation finishes\n const [isVisible, setIsVisible] = useState(true);\n\n // apply drag positioning only when sorting is enabled\n const sortingStyle = sortable\n ? {\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isDragging ? 50 : undefined,\n }\n : undefined;\n\n // animate row insertion and removal\n const listItemMotionVariants: MotionVariants = {\n hidden: { opacity: 0, height: 0, marginBottom: 0 },\n visible: {\n opacity: 1,\n height: 'auto',\n transition: { duration: 0.2, ease: 'circOut' },\n // push last visible item down to overlap with append button (hide double border)\n marginBottom: '-1px',\n },\n exit: {\n opacity: 0,\n height: 0,\n marginBottom: 0,\n transition: {\n // on exit first fade out, then shrink\n opacity: { duration: 0.1, ease: 'circOut' },\n height: { delay: 0.1, duration: 0.2, ease: 'circOut' },\n },\n },\n };\n\n // let the exit animation finish before removing the registered row\n const handleRemove = () => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n };\n\n return (\n <AnimatePresence\n mode=\"wait\"\n // remove from RHF state after exit animation\n onExitComplete={methods.remove}\n >\n {isVisible ? (\n <motion.li\n key={id}\n ref={setNodeRef}\n animate={disableAnimation ? undefined : 'visible'}\n className={cn(className.listItem)}\n data-dragging={isDragging}\n data-testid={`${testId}_element`}\n exit={disableAnimation ? undefined : 'exit'}\n initial={disableAnimation ? false : 'hidden'}\n style={sortingStyle}\n variants={disableAnimation ? undefined : listItemMotionVariants}\n >\n <div className={cn(className.listItemInner)}>\n {/** sorting drag handle */}\n {sortable ? (\n <SortDragHandle\n className={className.sortDragHandle}\n id={id}\n testId={`${testId}_sort_drag_handle`}\n />\n ) : null}\n\n {/** render element fields in Grid component */}\n <Grid\n className={cn(className.elementFieldsGrid)}\n testId={`${testId}_element_fields_grid`}\n >\n {/* render actual fields */}\n {children}\n </Grid>\n\n {/** actions menu when duplicate or insertAfter is enabled */}\n {duplicate || insertAfter ? (\n <ElementActionsMenu\n className={className.actionsMenuButton}\n duplicate={duplicate}\n insertAfter={insertAfter}\n methods={{\n ...methods,\n remove: handleRemove,\n }}\n showRemove={!(lastNotDeletable && fields.length === 1)}\n testId={`${testId}_actions_menu`}\n />\n ) : (\n <>\n {/** remove element button (when menu is not used) */}\n <AnimatePresence initial={false}>\n {lastNotDeletable && fields.length === 1 ? null : (\n <ElementRemoveButton\n key=\"remove-button\"\n className={className.removeButton}\n disableAnimation={disableAnimation}\n onClick={handleRemove}\n testId={`${testId}_remove_button`}\n />\n )}\n </AnimatePresence>\n </>\n )}\n </div>\n </motion.li>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayElement;\n","import type { ReactNode } from 'react';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\n\nexport interface FieldArrayLabelProps {\n /** CSS class name */\n className?: string;\n /** Optional heading ID supplied by the owning group. */\n id?: string;\n /** Shows an array-level validation failure */\n invalid: boolean;\n /** Field label */\n label: ReactNode;\n /** Marks the array as required */\n required: boolean;\n}\n\n/**\n * Renders the label for a FieldArray component.\n *\n * This component handles displaying the array label with proper accessibility\n * attributes using owned heading markup and field state.\n */\nconst FieldArrayLabel = ({\n className = undefined,\n id = undefined,\n label,\n invalid,\n required,\n}: FieldArrayLabelProps) => {\n const { cn } = useStyling();\n\n // when no label is provided, don't render anything\n if (!label) {\n return null;\n }\n\n const hasErrors = invalid;\n\n return (\n <FieldLabel\n aria-level={3}\n as=\"div\"\n className={cn(\n 'block max-w-full overflow-hidden text-ellipsis subpixel-antialiased text-small',\n hasErrors ? 'text-danger!' : undefined,\n className,\n {\n // when there are no array level errors, the label should have foreground color\n 'text-foreground!': !hasErrors,\n },\n )}\n id={id}\n required={required}\n requiredClassName=\"ms-0.5 text-danger\"\n role=\"heading\"\n >\n {label}\n </FieldLabel>\n );\n};\n\nexport default FieldArrayLabel;\n","import { tv } from '@fuf-stack/pixel-utils';\n\nconst fieldArrayValidationErrorVariants = tv({\n slots: {\n /** Container for array-level validation messages */\n errorMessage: 'text-danger text-tiny',\n /** Padded footer containing array-level validation */\n helperWrapper: ['relative flex-col gap-1.5', 'block px-3 pb-2 pt-1'],\n },\n});\n\nexport default fieldArrayValidationErrorVariants;\n","import type { FieldError } from 'react-hook-form';\nimport type { FieldIds } from '../../partials/types';\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\nimport fieldArrayValidationErrorVariants from './fieldArrayValidationErrorVariants';\n\nexport interface FieldArrayValidationErrorProps {\n /** Array-level validation errors */\n error: FieldError[] | undefined;\n /** IDs shared with the owning field */\n ids: FieldIds;\n /** Shows array-level validation failure */\n invalid: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId: string;\n}\n\n/**\n * Renders array-level validation errors for FieldArray.\n *\n * This component handles validation errors that apply to the entire array\n * (e.g., \"Array must contain at least 3 elements\", \"Array elements are not unique\"),\n * as opposed to field-level errors which apply to individual array elements.\n *\n * The component wraps errors in the proper accessibility markup and animates\n * them in/out using Framer Motion when they appear or are resolved.\n */\nconst FieldArrayValidationError = ({\n error,\n ids,\n invalid,\n testId,\n}: FieldArrayValidationErrorProps) => {\n const styling = useStyling();\n const disableAnimation = useReducedMotion();\n\n // classNames from slots\n const variants = styling.resolve(fieldArrayValidationErrorVariants);\n const classNames = styling.variantsToClassNames(variants);\n\n const objectErrors = (error as unknown as { _errors?: FieldError[] })\n ?._errors;\n const hasErrors = invalid && objectErrors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-array-errors\"\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.4, ease: 'circOut' }}\n >\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <FieldValidationError\n className={{ wrapper: classNames.errorMessage }}\n error={objectErrors}\n id={ids.error}\n testId={testId}\n />\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayValidationError;\n","import type { DragEndEvent } from '@dnd-kit/core';\nimport type { ReactNode } from 'react';\nimport type { UseFieldArrayMove } from 'react-hook-form';\n\nimport {\n closestCenter,\n DndContext,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {\n restrictToVerticalAxis,\n restrictToWindowEdges,\n} from '@dnd-kit/modifiers';\nimport {\n SortableContext,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable';\n\ninterface SortContextProps {\n /** child components */\n children: ReactNode;\n /** Array of objects containing unique IDs for sortable items */\n fields: Record<'id', string>[];\n /** react-hook-form's move function to update field array indices */\n move: UseFieldArrayMove;\n /** enable/disable sorting functionality */\n sortable: boolean;\n}\n\n/**\n * A wrapper component that provides drag-and-drop sorting functionality for field arrays\n * using dnd-kit and react-hook-form.\n *\n * This component integrates with react-hook-form's field arrays to enable vertical\n * drag-and-drop reordering of form fields. It supports both pointer (mouse/touch)\n * and keyboard interactions for accessibility.\n */\nconst SortContext = ({\n children,\n fields,\n move,\n sortable,\n}: SortContextProps): ReactNode => {\n // Initialize sensors for both pointer (mouse/touch) and keyboard interactions\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor),\n );\n\n // Early return if sorting is disabled\n if (!sortable) {\n return children;\n }\n\n /**\n * Handles the end of a drag operation by updating field positions\n * @param event - The drag end event containing active and over elements\n */\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n\n // Only move if dropping over a different item\n if (active.id !== over?.id) {\n // Find the indices of the dragged item and drop target\n const oldIndex = fields.findIndex((field) => {\n return field.id === active.id;\n });\n const newIndex = fields.findIndex((field) => {\n return field.id === over?.id;\n });\n // Update the field array order using react-hook-form's move function\n move(oldIndex, newIndex);\n }\n };\n\n return (\n <DndContext\n collisionDetection={closestCenter}\n modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}\n onDragEnd={handleDragEnd}\n sensors={sensors}\n >\n <SortableContext\n items={fields.map((field) => {\n return field.id;\n })}\n strategy={verticalListSortingStrategy}\n >\n {children}\n </SortableContext>\n </DndContext>\n );\n};\n\nexport default SortContext;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { FieldArrayItem } from '../../hooks/useUniformFieldArray/types';\nimport type { FieldArrayProps } from '../FieldArray';\n\nimport { useId } from 'react';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { fieldArrayVariants } from '../fieldArrayVariants';\nimport ElementAppendButton from './ElementAppendButton';\nimport FieldArrayElement from './FieldArrayElement';\nimport FieldArrayLabel from './FieldArrayLabel';\nimport FieldArrayValidationError from './FieldArrayValidationError';\nimport SortContext from './SortContext';\n\nexport type { FieldArrayItem } from '../../hooks/useUniformFieldArray/types';\n\ninterface FieldArrayControlProps extends Pick<\n FieldArrayProps,\n | 'appendButtonText'\n | 'children'\n | 'className'\n | 'duplicate'\n | 'elementMarginBottom'\n | 'insertAfter'\n | 'lastElementNotRemovable'\n | 'sortable'\n> {\n /** Disables animation during array initialization */\n disableAnimation: boolean;\n /** Bound field values, interactions and metadata */\n field: UniformField;\n /** Stable row IDs used by the sorting engine */\n fields: Record<'id', string>[];\n /** Bound rows to arrange in the list */\n items: FieldArrayItem[];\n /** Callback when the append button is activated */\n onAppend: () => void;\n /** Callback when sorting moves a row */\n onMove: (from: number, to: number) => void;\n}\n\n/** Array group presentation with row controls, sorting and validation messages */\nconst FieldArrayControl = ({\n field,\n appendButtonText,\n children,\n className,\n disableAnimation,\n duplicate,\n elementMarginBottom,\n fields,\n items,\n insertAfter,\n lastElementNotRemovable,\n onAppend,\n onMove,\n sortable = false,\n}: FieldArrayControlProps) => {\n const { error, ids, invalid, name, required, testId } = field;\n\n // keep the array heading hidden when only debug label content exists\n const label = field.hasLabel ? field.label : undefined;\n\n const styling = useStyling();\n const labelId = useId();\n\n // @ts-expect-error - object-level errors include an _errors property\n const hasArrayErrors = !!(invalid && error?._errors);\n\n const { cn } = styling;\n\n // classNames from slots\n const variants = styling.resolve(fieldArrayVariants, { hasLabel: !!label });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n return (\n <div\n aria-label={!label ? name : undefined}\n aria-labelledby={label ? labelId : undefined}\n className={classNames.base}\n data-component=\"field-array\"\n role=\"group\"\n >\n {/* field array label */}\n <FieldArrayLabel\n className={classNames.label}\n id={labelId}\n invalid={hasArrayErrors}\n label={label}\n required={required}\n />\n\n {fields.length ? (\n /* sortable rows */\n <div className={cn(classNames.listWrapper)}>\n <SortContext fields={fields} move={onMove} sortable={sortable}>\n <ul className={classNames.list} data-testid={testId}>\n {items.map(({ id, renderProps }) => {\n return (\n <FieldArrayElement\n key={id}\n className={classNames}\n disableAnimation={disableAnimation}\n duplicate={duplicate}\n elementMarginBottom={elementMarginBottom}\n fields={fields}\n id={id}\n index={renderProps.index}\n insertAfter={insertAfter}\n lastNotDeletable={lastElementNotRemovable}\n methods={renderProps.methods}\n sortable={sortable}\n testId={renderProps.testId}\n >\n {children(renderProps)}\n </FieldArrayElement>\n );\n })}\n </ul>\n </SortContext>\n </div>\n ) : null}\n\n {/* top level field array errors */}\n <FieldArrayValidationError\n error={error}\n ids={ids}\n invalid={invalid}\n testId={testId}\n />\n\n {/* append elements button */}\n <ElementAppendButton\n appendButtonText={appendButtonText}\n className={classNames.appendButton}\n onClick={onAppend}\n testId={`${testId}_append_button`}\n />\n </div>\n );\n};\n\nexport default FieldArrayControl;\n","import type { CSSProperties, ReactNode } from 'react';\nimport type { ClassName, VariantProps } from './fieldArrayVariants';\nimport type { FieldArrayChildrenRenderFn, FieldArrayFeatures } from './types';\n\nimport useUniformFieldArray from '../hooks/useUniformFieldArray/useUniformFieldArray';\nimport FieldArrayControl from './subcomponents/FieldArrayControl';\n\nexport { fieldArrayVariants } from './fieldArrayVariants';\n\nexport interface FieldArrayProps extends FieldArrayFeatures, VariantProps {\n /** text of the append element button */\n appendButtonText?: string;\n /** function that renders the children with provided Properties. */\n children: FieldArrayChildrenRenderFn;\n /** CSS class name */\n className?: ClassName;\n /* initial value of a filed that is created in the array */\n elementInitialValue?: unknown;\n /*\n * bottom margin of a list element (default 1rem), this needs to be set as a prop (and not via className slot)\n * because the margin bottom needs to be animated when elements are added or removed\n */\n elementMarginBottom?: CSSProperties['marginBottom'];\n /** when true, array stores primitives as wrapper objects: { __FLAT__: value } */\n flat?: boolean;\n /** Field label */\n label?: ReactNode;\n /** when true (default false) last element can not be removed and will be shown even if field array is empty */\n lastElementNotRemovable?: boolean;\n /** Field name */\n name: string;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/** Form field group for adding, removing and reordering array entries */\nconst FieldArray = ({\n appendButtonText = 'Add Element',\n children,\n className: _className = undefined,\n duplicate = false,\n elementInitialValue: _elementInitialValue = null,\n elementMarginBottom = undefined,\n flat = false,\n insertAfter = false,\n lastElementNotRemovable = false,\n name,\n sortable = false,\n ...uniformFieldProps\n}: FieldArrayProps) => {\n const { field, fields, appendItem, items, moveItem, disableAnimation } =\n useUniformFieldArray({\n ...uniformFieldProps,\n elementInitialValue: _elementInitialValue,\n flat,\n lastElementNotRemovable,\n name,\n });\n\n return (\n <FieldArrayControl\n appendButtonText={appendButtonText}\n className={_className}\n disableAnimation={disableAnimation}\n duplicate={duplicate}\n elementMarginBottom={elementMarginBottom}\n field={field}\n fields={fields}\n insertAfter={insertAfter}\n items={items}\n lastElementNotRemovable={lastElementNotRemovable}\n onAppend={appendItem}\n onMove={moveItem}\n sortable={sortable}\n >\n {children}\n </FieldArrayControl>\n );\n};\n\nexport default FieldArray;\n","import FieldArray from './FieldArray';\n\nexport type * from './types';\n\nexport { fieldArrayVariants } from './FieldArray';\n\nexport default FieldArray;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAa,+BAGX,EACE,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,SAE5B,iBACG;CACH,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,YAAYA,cAAiB;EACzE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,UAAU,cAAcC,iBAA6B;CAStE,MAAM,kBAAkB,cAAc;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,iBAAiB,OAAO,CAAC,eAAe;CAK9C,gBAAgB;EACd,IAAI,iBACF,eAAe,U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,YAAY,OAAO,UAAU,qBAClD,qBAAqB;EACnB,GAAG;EACH,qBAAqB;EACrB;EACA;EACA;CACF,CAAC;CAEH,OACE,oBAAC,mBAAD;EACoB;EAClB,WAAW;EACO;EACP;EACU;EACd;EACC;EACK;EACN;EACkB;EACzB,UAAU;EACV,QAAQ;EACE;EAET;CACgB,CAAA;AAEvB;;;ACxEA,IAAA,qBAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TVClassName } from "@fuf-stack/pixel-utils";
|
|
2
1
|
import { ReactNode } from "react";
|
|
3
|
-
|
|
2
|
+
import { TVClassName } from "@fuf-stack/pixel-utils";
|
|
3
|
+
//#region src/FieldCard/fieldCardVariants.d.ts
|
|
4
4
|
export declare const fieldCardVariants: ((props?: ({
|
|
5
5
|
invalid?: boolean | undefined;
|
|
6
6
|
} & ({
|
|
@@ -19,7 +19,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
19
19
|
class?: never;
|
|
20
20
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
21
21
|
})) | undefined) => string;
|
|
22
|
-
|
|
22
|
+
content: (slotProps?: ({
|
|
23
23
|
invalid?: boolean | undefined;
|
|
24
24
|
} & ({
|
|
25
25
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -28,7 +28,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
28
28
|
class?: never;
|
|
29
29
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
30
30
|
})) | undefined) => string;
|
|
31
|
-
|
|
31
|
+
errorFooter: (slotProps?: ({
|
|
32
32
|
invalid?: boolean | undefined;
|
|
33
33
|
} & ({
|
|
34
34
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -37,7 +37,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
37
37
|
class?: never;
|
|
38
38
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
39
39
|
})) | undefined) => string;
|
|
40
|
-
|
|
40
|
+
errorText: (slotProps?: ({
|
|
41
41
|
invalid?: boolean | undefined;
|
|
42
42
|
} & ({
|
|
43
43
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -46,7 +46,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
46
46
|
class?: never;
|
|
47
47
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
48
48
|
})) | undefined) => string;
|
|
49
|
-
|
|
49
|
+
label: (slotProps?: ({
|
|
50
50
|
invalid?: boolean | undefined;
|
|
51
51
|
} & ({
|
|
52
52
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -65,7 +65,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
65
65
|
class?: never;
|
|
66
66
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
67
67
|
})) | undefined) => string;
|
|
68
|
-
|
|
68
|
+
content: (slotProps?: ({
|
|
69
69
|
invalid?: boolean | undefined;
|
|
70
70
|
} & ({
|
|
71
71
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -74,7 +74,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
74
74
|
class?: never;
|
|
75
75
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
76
76
|
})) | undefined) => string;
|
|
77
|
-
|
|
77
|
+
errorFooter: (slotProps?: ({
|
|
78
78
|
invalid?: boolean | undefined;
|
|
79
79
|
} & ({
|
|
80
80
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -83,7 +83,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
83
83
|
class?: never;
|
|
84
84
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
85
85
|
})) | undefined) => string;
|
|
86
|
-
|
|
86
|
+
errorText: (slotProps?: ({
|
|
87
87
|
invalid?: boolean | undefined;
|
|
88
88
|
} & ({
|
|
89
89
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -92,7 +92,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
92
92
|
class?: never;
|
|
93
93
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
94
94
|
})) | undefined) => string;
|
|
95
|
-
|
|
95
|
+
label: (slotProps?: ({
|
|
96
96
|
invalid?: boolean | undefined;
|
|
97
97
|
} & ({
|
|
98
98
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -120,7 +120,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
120
120
|
class?: never;
|
|
121
121
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
122
122
|
})) | undefined) => string;
|
|
123
|
-
|
|
123
|
+
content: (slotProps?: ({
|
|
124
124
|
invalid?: boolean | undefined;
|
|
125
125
|
} & ({
|
|
126
126
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -129,7 +129,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
129
129
|
class?: never;
|
|
130
130
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
131
131
|
})) | undefined) => string;
|
|
132
|
-
|
|
132
|
+
errorFooter: (slotProps?: ({
|
|
133
133
|
invalid?: boolean | undefined;
|
|
134
134
|
} & ({
|
|
135
135
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -138,7 +138,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
138
138
|
class?: never;
|
|
139
139
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
140
140
|
})) | undefined) => string;
|
|
141
|
-
|
|
141
|
+
errorText: (slotProps?: ({
|
|
142
142
|
invalid?: boolean | undefined;
|
|
143
143
|
} & ({
|
|
144
144
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -147,7 +147,7 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
147
147
|
class?: never;
|
|
148
148
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
149
149
|
})) | undefined) => string;
|
|
150
|
-
|
|
150
|
+
label: (slotProps?: ({
|
|
151
151
|
invalid?: boolean | undefined;
|
|
152
152
|
} & ({
|
|
153
153
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
@@ -162,28 +162,28 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
162
162
|
slots: {
|
|
163
163
|
/** base class for the field card wrapper */
|
|
164
164
|
base: string[];
|
|
165
|
-
/** class for the label/header */
|
|
166
|
-
label: string[];
|
|
167
165
|
/** class for the content */
|
|
168
166
|
content: string[];
|
|
169
167
|
/** class for the error footer wrapper */
|
|
170
168
|
errorFooter: string[];
|
|
171
169
|
/** class for the error text (empty base, color controlled by variant) */
|
|
172
170
|
errorText: never[];
|
|
171
|
+
/** class for the label/header */
|
|
172
|
+
label: string[];
|
|
173
173
|
};
|
|
174
174
|
variants: {
|
|
175
175
|
invalid: {
|
|
176
|
-
|
|
176
|
+
false: {
|
|
177
177
|
base: string;
|
|
178
|
-
label: string;
|
|
179
178
|
errorFooter: string;
|
|
180
179
|
errorText: string;
|
|
180
|
+
label: string;
|
|
181
181
|
};
|
|
182
|
-
|
|
182
|
+
true: {
|
|
183
183
|
base: string;
|
|
184
|
-
label: string;
|
|
185
184
|
errorFooter: string;
|
|
186
185
|
errorText: string;
|
|
186
|
+
label: string;
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
};
|
|
@@ -228,28 +228,28 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
228
228
|
slots: {
|
|
229
229
|
/** base class for the field card wrapper */
|
|
230
230
|
base: string[];
|
|
231
|
-
/** class for the label/header */
|
|
232
|
-
label: string[];
|
|
233
231
|
/** class for the content */
|
|
234
232
|
content: string[];
|
|
235
233
|
/** class for the error footer wrapper */
|
|
236
234
|
errorFooter: string[];
|
|
237
235
|
/** class for the error text (empty base, color controlled by variant) */
|
|
238
236
|
errorText: never[];
|
|
237
|
+
/** class for the label/header */
|
|
238
|
+
label: string[];
|
|
239
239
|
};
|
|
240
240
|
variants: {
|
|
241
241
|
invalid: {
|
|
242
|
-
|
|
242
|
+
false: {
|
|
243
243
|
base: string;
|
|
244
|
-
label: string;
|
|
245
244
|
errorFooter: string;
|
|
246
245
|
errorText: string;
|
|
246
|
+
label: string;
|
|
247
247
|
};
|
|
248
|
-
|
|
248
|
+
true: {
|
|
249
249
|
base: string;
|
|
250
|
-
label: string;
|
|
251
250
|
errorFooter: string;
|
|
252
251
|
errorText: string;
|
|
252
|
+
label: string;
|
|
253
253
|
};
|
|
254
254
|
};
|
|
255
255
|
};
|
|
@@ -291,26 +291,28 @@ export declare const fieldCardVariants: ((props?: ({
|
|
|
291
291
|
variantKeys: "invalid"[];
|
|
292
292
|
};
|
|
293
293
|
type ClassName = TVClassName<typeof fieldCardVariants>;
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/FieldCard/FieldCard.d.ts
|
|
294
296
|
interface FieldCardProps {
|
|
295
297
|
/** Content to render inside the card */
|
|
296
298
|
children: ReactNode;
|
|
297
299
|
/** CSS class name */
|
|
298
300
|
className?: ClassName;
|
|
299
|
-
/**
|
|
301
|
+
/** Field label */
|
|
300
302
|
label: ReactNode;
|
|
301
|
-
/** Field name
|
|
303
|
+
/** Field name */
|
|
302
304
|
name: string;
|
|
303
|
-
/** HTML data-testid attribute
|
|
305
|
+
/** HTML data-testid attribute for e2e tests */
|
|
304
306
|
testId?: string;
|
|
305
307
|
}
|
|
306
308
|
/**
|
|
307
|
-
*
|
|
309
|
+
* Groups related form fields in a card with a heading and validation footer
|
|
310
|
+
*
|
|
311
|
+
* Renders nested fields in the body and object-level validation messages in the
|
|
312
|
+
* footer. Individual fields retain their own validation messages
|
|
308
313
|
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* - Content in the body
|
|
312
|
-
* - Validation errors in the footer
|
|
313
|
-
* - Danger outline when validation errors exist
|
|
314
|
+
* The card's required indicator reflects its nested fields, and its danger
|
|
315
|
+
* outline follows child interaction and form submission
|
|
314
316
|
*/
|
|
315
317
|
declare const FieldCard: ({ children, className: _className, name, ...uniformFieldProps }: FieldCardProps) => import("react").JSX.Element;
|
|
316
318
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/FieldCard/FieldCard.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/FieldCard/fieldCardVariants.ts","../../src/FieldCard/FieldCard.tsx"],"mappings":";;;qBAIa,qBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2DlB,YAAY,mBAAmB;;;UCjD1B;;EAEf,UAAU;;EAEV,YAAY;;EAEZ,OAAO;;EAEP;;EAEA;;;;;;;;;;;cAYI,cAAa,UAAA,WAAA,YAAA,SAAA,qBAKhB,mCAAc,IAAA"}
|