@fuf-stack/uniform 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkboxes/index.cjs +16 -0
- package/dist/{RadioGroup → Checkboxes}/index.cjs.map +1 -1
- package/dist/Checkboxes/index.d.cts +10 -0
- package/dist/Checkboxes/index.d.ts +10 -0
- package/dist/Checkboxes/index.js +16 -0
- package/dist/{CheckboxGroup-B1g42iP0.d.cts → Checkboxes-CR0Uu2g9.d.cts} +9 -9
- package/dist/{CheckboxGroup-B1g42iP0.d.ts → Checkboxes-CR0Uu2g9.d.ts} +9 -9
- package/dist/FieldArray/index.cjs +5 -5
- package/dist/FieldArray/index.d.cts +2 -2
- package/dist/FieldArray/index.d.ts +2 -2
- package/dist/FieldArray/index.js +4 -4
- package/dist/FieldArray-EP4otr2x.d.cts +160 -0
- package/dist/FieldArray-EP4otr2x.d.ts +160 -0
- package/dist/{FieldValidationError-CU_xw0BL.d.ts → FieldValidationError-DwtLkGMo.d.cts} +2 -2
- package/dist/{FieldValidationError-CU_xw0BL.d.cts → FieldValidationError-DwtLkGMo.d.ts} +2 -2
- package/dist/Form/index.cjs +6 -4
- package/dist/Form/index.cjs.map +1 -1
- package/dist/Form/index.js +5 -3
- package/dist/Input/index.cjs +5 -5
- package/dist/Input/index.d.cts +2 -2
- package/dist/Input/index.d.ts +2 -2
- package/dist/Input/index.js +4 -4
- package/dist/{Input-C6ujfEkn.d.ts → Input-CCIEnvIp.d.ts} +1 -1
- package/dist/{Input-BQkZtJx8.d.cts → Input-D7HT_8jf.d.cts} +1 -1
- package/dist/RadioBoxes/index.cjs +5 -5
- package/dist/RadioBoxes/index.d.cts +3 -2
- package/dist/RadioBoxes/index.d.ts +3 -2
- package/dist/RadioBoxes/index.js +4 -4
- package/dist/{RadioBoxes-CE3mYoFk.d.cts → RadioBoxes-DpkI28l0.d.cts} +3 -2
- package/dist/{RadioBoxes-CE3mYoFk.d.ts → RadioBoxes-DpkI28l0.d.ts} +3 -2
- package/dist/RadioTabs/index.cjs +5 -5
- package/dist/RadioTabs/index.d.cts +2 -2
- package/dist/RadioTabs/index.d.ts +2 -2
- package/dist/RadioTabs/index.js +4 -4
- package/dist/{RadioTabs-BCWW3tru.d.cts → RadioTabs-DTDcAZoH.d.cts} +1 -1
- package/dist/{RadioTabs-BCWW3tru.d.ts → RadioTabs-DTDcAZoH.d.ts} +1 -1
- package/dist/Radios/index.cjs +16 -0
- package/dist/Radios/index.cjs.map +1 -0
- package/dist/Radios/index.d.cts +9 -0
- package/dist/Radios/index.d.ts +9 -0
- package/dist/Radios/index.js +16 -0
- package/dist/{RadioGroup-CAOX80Xx.d.cts → Radios-DprlJhoq.d.cts} +9 -9
- package/dist/{RadioGroup-CAOX80Xx.d.ts → Radios-DprlJhoq.d.ts} +9 -9
- package/dist/Select/index.cjs +5 -5
- package/dist/Select/index.d.cts +2 -2
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +4 -4
- package/dist/{Select-CTRWinmO.d.cts → Select-CDkZmZp2.d.cts} +1 -1
- package/dist/{Select-CTRWinmO.d.ts → Select-CDkZmZp2.d.ts} +1 -1
- package/dist/SubmitButton/index.cjs +6 -4
- package/dist/SubmitButton/index.cjs.map +1 -1
- package/dist/SubmitButton/index.js +5 -3
- package/dist/Switch/index.cjs +5 -5
- package/dist/Switch/index.js +4 -4
- package/dist/TextArea/index.cjs +5 -5
- package/dist/TextArea/index.d.cts +4 -2
- package/dist/TextArea/index.d.ts +4 -2
- package/dist/TextArea/index.js +4 -4
- package/dist/TextArea-DhxNWYNg.d.cts +86 -0
- package/dist/TextArea-DhxNWYNg.d.ts +86 -0
- package/dist/chunk-2DHTL4PW.cjs +117 -0
- package/dist/chunk-2DHTL4PW.cjs.map +1 -0
- package/dist/{chunk-FOVP54XP.cjs → chunk-3NH4MEMM.cjs} +18 -27
- package/dist/chunk-3NH4MEMM.cjs.map +1 -0
- package/dist/{chunk-M2DNMSQZ.js → chunk-3Q3IUEGL.js} +52 -49
- package/dist/chunk-3Q3IUEGL.js.map +1 -0
- package/dist/{chunk-JSQ77E6L.js → chunk-4WRUHOGY.js} +49 -47
- package/dist/chunk-4WRUHOGY.js.map +1 -0
- package/dist/{chunk-KG4XCEPW.js → chunk-53XSXUNE.js} +42 -40
- package/dist/chunk-53XSXUNE.js.map +1 -0
- package/dist/{chunk-77C6VN4L.cjs → chunk-5LWD6VRV.cjs} +50 -47
- package/dist/chunk-5LWD6VRV.cjs.map +1 -0
- package/dist/{chunk-C64RKQEW.cjs → chunk-62AYJT2H.cjs} +3 -3
- package/dist/{chunk-C64RKQEW.cjs.map → chunk-62AYJT2H.cjs.map} +1 -1
- package/dist/chunk-76KOVUDN.js +138 -0
- package/dist/chunk-76KOVUDN.js.map +1 -0
- package/dist/{chunk-FHRMVL6B.js → chunk-AYWMAPAX.js} +134 -89
- package/dist/chunk-AYWMAPAX.js.map +1 -0
- package/dist/chunk-BWPTCHL7.cjs +103 -0
- package/dist/chunk-BWPTCHL7.cjs.map +1 -0
- package/dist/{chunk-2GYFDVXX.cjs → chunk-C5GIWGQR.cjs} +173 -33
- package/dist/chunk-C5GIWGQR.cjs.map +1 -0
- package/dist/{chunk-IYDCKENI.js → chunk-CJD3DW4J.js} +166 -26
- package/dist/chunk-CJD3DW4J.js.map +1 -0
- package/dist/{chunk-N2EEOWEP.cjs → chunk-CW4VK77Z.cjs} +59 -64
- package/dist/chunk-CW4VK77Z.cjs.map +1 -0
- package/dist/{chunk-LJQ35BUK.js → chunk-D2HI4KE4.js} +2 -2
- package/dist/chunk-DYTE5N3B.cjs +684 -0
- package/dist/chunk-DYTE5N3B.cjs.map +1 -0
- package/dist/chunk-ELYGQTXB.js +47 -0
- package/dist/chunk-ELYGQTXB.js.map +1 -0
- package/dist/chunk-GST3AQOR.js +684 -0
- package/dist/chunk-GST3AQOR.js.map +1 -0
- package/dist/{chunk-AYNTZPKL.cjs → chunk-HQNZYWJX.cjs} +132 -87
- package/dist/chunk-HQNZYWJX.cjs.map +1 -0
- package/dist/chunk-LLQLEDOO.js +103 -0
- package/dist/chunk-LLQLEDOO.js.map +1 -0
- package/dist/chunk-NHEZXA4H.cjs +47 -0
- package/dist/chunk-NHEZXA4H.cjs.map +1 -0
- package/dist/{chunk-M7VM7XBE.js → chunk-OCYJFIPV.js} +8 -8
- package/dist/chunk-OCYJFIPV.js.map +1 -0
- package/dist/{chunk-ORQO6JXK.cjs → chunk-S36CKKDV.cjs} +45 -43
- package/dist/chunk-S36CKKDV.cjs.map +1 -0
- package/dist/chunk-S7K35LVS.js +117 -0
- package/dist/chunk-S7K35LVS.js.map +1 -0
- package/dist/{chunk-Y3GELCDP.js → chunk-VLEYEBRE.js} +62 -67
- package/dist/chunk-VLEYEBRE.js.map +1 -0
- package/dist/{chunk-UGCZORU3.cjs → chunk-YIBISSMT.cjs} +9 -9
- package/dist/chunk-YIBISSMT.cjs.map +1 -0
- package/dist/chunk-Z353BLWI.cjs +138 -0
- package/dist/chunk-Z353BLWI.cjs.map +1 -0
- package/dist/{chunk-ULR4573W.cjs → chunk-ZLQCMOVU.cjs} +40 -38
- package/dist/chunk-ZLQCMOVU.cjs.map +1 -0
- package/dist/{chunk-2B6CDMOZ.js → chunk-ZN3ESUQR.js} +16 -25
- package/dist/chunk-ZN3ESUQR.js.map +1 -0
- package/dist/helpers/index.cjs +4 -2
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.d.cts +54 -10
- package/dist/helpers/index.d.ts +54 -10
- package/dist/helpers/index.js +3 -1
- package/dist/hooks/index.cjs +7 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +86 -4
- package/dist/hooks/index.d.ts +86 -4
- package/dist/hooks/index.js +8 -4
- package/dist/index.cjs +20 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +30 -26
- package/dist/partials/FieldValidationError/index.cjs +2 -2
- package/dist/partials/FieldValidationError/index.d.cts +2 -2
- package/dist/partials/FieldValidationError/index.d.ts +2 -2
- package/dist/partials/FieldValidationError/index.js +1 -1
- package/package.json +13 -12
- package/dist/CheckboxGroup/index.cjs +0 -16
- package/dist/CheckboxGroup/index.cjs.map +0 -1
- package/dist/CheckboxGroup/index.d.cts +0 -10
- package/dist/CheckboxGroup/index.d.ts +0 -10
- package/dist/CheckboxGroup/index.js +0 -16
- package/dist/FieldArray-DVQka7Bh.d.cts +0 -130
- package/dist/FieldArray-DVQka7Bh.d.ts +0 -130
- package/dist/RadioGroup/index.cjs +0 -16
- package/dist/RadioGroup/index.d.cts +0 -9
- package/dist/RadioGroup/index.d.ts +0 -9
- package/dist/RadioGroup/index.js +0 -16
- package/dist/TextArea-DnFGyl4a.d.cts +0 -27
- package/dist/TextArea-DnFGyl4a.d.ts +0 -27
- package/dist/chunk-2B6CDMOZ.js.map +0 -1
- package/dist/chunk-2GYFDVXX.cjs.map +0 -1
- package/dist/chunk-77C6VN4L.cjs.map +0 -1
- package/dist/chunk-AYNTZPKL.cjs.map +0 -1
- package/dist/chunk-CQWA2DFV.js +0 -37
- package/dist/chunk-CQWA2DFV.js.map +0 -1
- package/dist/chunk-EEBHFSBY.cjs +0 -112
- package/dist/chunk-EEBHFSBY.cjs.map +0 -1
- package/dist/chunk-FHRMVL6B.js.map +0 -1
- package/dist/chunk-FOVP54XP.cjs.map +0 -1
- package/dist/chunk-IYDCKENI.js.map +0 -1
- package/dist/chunk-JSQ77E6L.js.map +0 -1
- package/dist/chunk-JZF4HUYO.cjs +0 -409
- package/dist/chunk-JZF4HUYO.cjs.map +0 -1
- package/dist/chunk-KG4XCEPW.js.map +0 -1
- package/dist/chunk-KQN55PEW.js +0 -76
- package/dist/chunk-KQN55PEW.js.map +0 -1
- package/dist/chunk-M2DNMSQZ.js.map +0 -1
- package/dist/chunk-M7VM7XBE.js.map +0 -1
- package/dist/chunk-N2EEOWEP.cjs.map +0 -1
- package/dist/chunk-NAZIH6HV.js +0 -409
- package/dist/chunk-NAZIH6HV.js.map +0 -1
- package/dist/chunk-ORQO6JXK.cjs.map +0 -1
- package/dist/chunk-RDBCJJI7.cjs +0 -88
- package/dist/chunk-RDBCJJI7.cjs.map +0 -1
- package/dist/chunk-RF7KNUCI.js +0 -88
- package/dist/chunk-RF7KNUCI.js.map +0 -1
- package/dist/chunk-UGCZORU3.cjs.map +0 -1
- package/dist/chunk-ULR4573W.cjs.map +0 -1
- package/dist/chunk-XKMLCM5K.js +0 -112
- package/dist/chunk-XKMLCM5K.js.map +0 -1
- package/dist/chunk-Y3AB4GV6.cjs +0 -37
- package/dist/chunk-Y3AB4GV6.cjs.map +0 -1
- package/dist/chunk-Y3GELCDP.js.map +0 -1
- package/dist/chunk-YGNY6CKU.cjs +0 -76
- package/dist/chunk-YGNY6CKU.cjs.map +0 -1
- /package/dist/{CheckboxGroup → Checkboxes}/index.js.map +0 -0
- /package/dist/{RadioGroup → Radios}/index.js.map +0 -0
- /package/dist/{chunk-LJQ35BUK.js.map → chunk-D2HI4KE4.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/FieldArray/FieldArray.tsx","../src/FieldArray/subcomponents/ElementAppendButton.tsx","../src/FieldArray/subcomponents/FieldArrayElement.tsx","../src/FieldArray/subcomponents/ElementActionsMenu.tsx","../src/FieldArray/subcomponents/ElementRemoveButton.tsx","../src/FieldArray/subcomponents/SortDragHandle.tsx","../src/FieldArray/subcomponents/FieldArrayLabel.tsx","../src/FieldArray/subcomponents/FieldArrayValidationError.tsx","../src/FieldArray/subcomponents/SortContext.tsx","../src/FieldArray/index.ts"],"sourcesContent":["import type { FieldArrayElementMethods } from './subcomponents/FieldArrayElement';\nimport type { FieldArrayProps } from './types';\n\nimport { useEffect, useRef } from 'react';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { flatArrayKey } from '../helpers';\nimport { useFieldArray, useUniformField } from '../hooks';\nimport { useFormContext } from '../hooks/useFormContext/useFormContext';\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 'rounded-small border-divider bg-content1 overflow-hidden border',\n // divider between items\n 'divide-divider divide-y',\n ],\n /** class for the actions menu button */\n actionsMenuButton: [\n // base styles\n 'text-default-600 flex items-center justify-center',\n // fixed height/no round corners/center align\n 'h-full rounded-none',\n ],\n /** class for the append button */\n appendButton: [\n // base styles\n 'rounded-b-small w-full rounded-t-none',\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 'focus-visible:ring-focus outline-none focus-visible:ring-2 focus-visible:ring-inset',\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 text-medium p-3 font-semibold',\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 'bg-content1 divide-divider flex w-full flex-row items-stretch',\n // x division and borders\n 'border-divider divide-x divide-solid border-t border-b',\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 'focus-visible:ring-focus outline-none focus-visible:ring-2 focus-visible:ring-inset',\n ],\n /** class for the sort drag handle */\n sortDragHandle: [\n // base styles\n 'text-default-600 flex cursor-grab items-center justify-center px-2 transition-colors',\n // hover and dragging state\n 'hover:bg-default-100 group-data-[dragging=true]:bg-default-100 active:cursor-grabbing',\n // focus styles - inset ring\n 'focus-visible:ring-focus outline-none focus-visible:ring-2 focus-visible:ring-inset',\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 { control, error, getValues, invalid, testId } = useUniformField({\n name,\n showInvalidWhen: 'immediate',\n ...uniformFieldProps,\n });\n\n const { fields, append, remove, insert, move } = useFieldArray({\n control,\n name,\n });\n\n // Validate array-level constraints immediately when length changes\n const { trigger } = useFormContext();\n useEffect(() => {\n setTimeout(() => {\n // Trigger validation for the array field so max/min errors appear instantly\n trigger(name);\n }, 200);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\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 = flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n\n // Track initial render to prevent animating elements on\n // first render cycle or when user prefers reduced motion\n const prefersReducedMotion = useReducedMotion();\n const disableAnimationRef = useRef(true);\n useEffect(() => {\n if (!prefersReducedMotion) {\n disableAnimationRef.current = false;\n }\n }, [prefersReducedMotion]);\n\n // When lastElementNotRemovable is set and the field array is empty,\n // add an initial element to ensure there's always at least one visible element\n if (lastElementNotRemovable && fields.length === 0) {\n append(elementInitialValue);\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 fields={fields} move={move} sortable={sortable}>\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={disableAnimationRef.current}\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 {/* append elements button */}\n <ElementAppendButton\n appendButtonText={appendButtonText}\n testId={`${testId}_append_button`}\n className={cn(\n className.appendButton,\n // only round bottom corners if there are no errors below\n // @ts-expect-error - error._errors exists but not typed\n // eslint-disable-next-line no-underscore-dangle\n { 'rounded-none': invalid && error?._errors },\n )}\n onClick={() => {\n append(elementInitialValue);\n }}\n />\n\n {/* top level field array errors */}\n <FieldArrayValidationError name={name} />\n </div>\n );\n};\n\nexport default FieldArray;\n","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 disableAnimation\n className={cn(className)}\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 { 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 showRemove={!(lastNotDeletable && fields.length === 1)}\n testId={`${testId}_actions_menu`}\n methods={{\n ...methods,\n remove: () => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n },\n }}\n />\n ) : (\n <>\n {/** remove element button (when menu is not used) */}\n {lastNotDeletable && fields.length === 1 ? null : (\n <ElementRemoveButton\n className={className.removeButton}\n testId={`${testId}_remove_button`}\n onClick={() => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n }}\n />\n )}\n </>\n )}\n </div>\n </motion.li>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayElement;\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 { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface ElementRemoveButtonProps {\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 ElementRemoveButton = ({\n className = undefined,\n onClick,\n testId = undefined,\n}: ElementRemoveButtonProps) => {\n return (\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\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 { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks';\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 showInvalidWhen: 'immediate',\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 // eslint-disable-next-line no-underscore-dangle\n const hasErrors = invalid && error?._errors;\n\n return (\n <div\n {...getLabelProps()}\n aria-level={3}\n role=\"heading\"\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 >\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';\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 showInvalidWhen: 'immediate',\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 // eslint-disable-next-line no-underscore-dangle\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-array-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible (for some reason it's hidden by default) and add padding/rounded corners\n 'rounded-b-small block px-3 py-2',\n )}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n // eslint-disable-next-line no-underscore-dangle\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 {\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 /** enable/disable sorting functionality */\n sortable: boolean;\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}\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 sortable,\n fields,\n move,\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 strategy={verticalListSortingStrategy}\n items={fields.map((field) => {\n return field.id;\n })}\n >\n {children}\n </SortableContext>\n </DndContext>\n );\n};\n\nexport default SortContext;\n","import FieldArray from './FieldArray';\n\nexport type * from './types';\n\nexport { FieldArray };\n\nexport default FieldArray;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,WAAW,cAAc;AAElC,SAAS,oBAAAA,yBAAwB;AACjC,SAAS,MAAAC,KAAI,IAAI,4BAA4B;;;ACJ7C,SAAS,cAAc;AAEvB,SAAS,UAAU;AACnB,SAAS,cAAc;AAoBnB,SAQE,KARF;AAPJ,IAAM,sBAAsB,CAAC;AAAA,EAC3B,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ;AAAA,EACA,SAAS;AACX,MAAgC;AAC9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,kBAAgB;AAAA,MA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,kBAAkB;AAAA,YAClB,SAAS;AAAA,YACT;AAAA,YACA,QAAQ;AAAA,YAEP,mBAAS;AAAA,cACR;AAAA,cACA,QAAQ,OAAO;AAAA,cACf,SAAS;AAAA,cACT,MAAM;AAAA,cACN,QAAQ;AAAA,YACV,CAAC;AAAA;AAAA,UApBI,MAAM;AAAA,QAqBb;AAAA,MAEJ,CAAC,GACH,GACF,GACF;AAAA,QACE;AAAA,IAGJ,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,QAAQ,GAAG,MAAM;AAAA,QACjB,WAAWG;AAAA,UACT,UAAU;AAAA;AAAA;AAAA;AAAA,UAIV,EAAE,gBAAgB,YAAW,+BAAO,SAAQ;AAAA,QAC9C;AAAA,QACA,SAAS,MAAM;AACb,iBAAO,mBAAmB;AAAA,QAC5B;AAAA;AAAA,IACF;AAAA,IAGA,gBAAAH,KAAC,qCAA0B,MAAY;AAAA,KACzC;AAEJ;AAEA,IAAO,qBAAQ;;;ASvQf,IAAOI,sBAAQ;","names":["useReducedMotion","cn","useSortable","cn","cn","jsx","FaTimes","cn","Button","jsx","cn","jsx","cn","jsx","jsxs","useSortable","cn","cn","jsx","cn","AnimatePresence","motion","cn","jsx","AnimatePresence","motion","cn","jsx","jsx","jsxs","useReducedMotion","cn","FieldArray_default"]}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkC5GIWGQRcjs = require('./chunk-C5GIWGQR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkY3AB4GV6cjs = require('./chunk-Y3AB4GV6.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunk2GYFDVXXcjs = require('./chunk-2GYFDVXX.cjs');
|
|
11
|
-
|
|
12
6
|
|
|
13
7
|
|
|
14
8
|
var _chunk555JRYCScjs = require('./chunk-555JRYCS.cjs');
|
|
@@ -74,86 +68,85 @@ var DropdownIndicatorComponent = (props) => {
|
|
|
74
68
|
const testId = props == null ? void 0 : props.selectProps["data-testid"];
|
|
75
69
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-testid": `${testId}_select_dropdown`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactselect.components.DropdownIndicator, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, props)) });
|
|
76
70
|
};
|
|
77
|
-
var Select = ({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
71
|
+
var Select = (_a) => {
|
|
72
|
+
var _b = _a, {
|
|
73
|
+
className = void 0,
|
|
74
|
+
clearable = true,
|
|
75
|
+
filterOption = void 0,
|
|
76
|
+
renderOptionLabel = void 0,
|
|
77
|
+
inputValue = void 0,
|
|
78
|
+
loading = false,
|
|
79
|
+
multiSelect = false,
|
|
80
|
+
name,
|
|
81
|
+
onInputChange = void 0,
|
|
82
|
+
options,
|
|
83
|
+
placeholder = void 0
|
|
84
|
+
} = _b, uniformFieldProps = _chunk555JRYCScjs.__objRest.call(void 0, _b, [
|
|
85
|
+
"className",
|
|
86
|
+
"clearable",
|
|
87
|
+
"filterOption",
|
|
88
|
+
"renderOptionLabel",
|
|
89
|
+
"inputValue",
|
|
90
|
+
"loading",
|
|
91
|
+
"multiSelect",
|
|
92
|
+
"name",
|
|
93
|
+
"onInputChange",
|
|
94
|
+
"options",
|
|
95
|
+
"placeholder"
|
|
96
|
+
]);
|
|
97
|
+
var _a2;
|
|
101
98
|
const {
|
|
102
|
-
|
|
99
|
+
disabled,
|
|
100
|
+
errorMessage,
|
|
101
|
+
field: { onBlur, onChange, ref, value },
|
|
103
102
|
getErrorMessageProps,
|
|
104
103
|
getHelperWrapperProps,
|
|
105
104
|
getLabelProps,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
invalid,
|
|
106
|
+
label,
|
|
107
|
+
required,
|
|
108
|
+
testId
|
|
109
|
+
} = _chunkC5GIWGQRcjs.useUniformField.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, { name }, uniformFieldProps));
|
|
110
|
+
const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
|
|
111
|
+
const variants = selectVariants();
|
|
112
|
+
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
|
|
113
|
+
const { getBaseProps, getTriggerProps, getValueProps } = _select.useSelect.call(void 0, {
|
|
110
114
|
children: [],
|
|
111
115
|
classNames,
|
|
112
|
-
errorMessage
|
|
116
|
+
errorMessage,
|
|
113
117
|
isDisabled: disabled,
|
|
114
118
|
isInvalid: invalid,
|
|
115
119
|
isLoading: loading,
|
|
116
120
|
isRequired: required,
|
|
117
|
-
label
|
|
118
|
-
labelPlacement: "outside"
|
|
119
|
-
placeholder: " "
|
|
121
|
+
label,
|
|
122
|
+
labelPlacement: "outside"
|
|
120
123
|
});
|
|
121
|
-
const showTestIdCopyButton = debugMode === "debug-testids";
|
|
122
|
-
const showLabel = label || showTestIdCopyButton;
|
|
123
124
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
124
125
|
"div",
|
|
125
126
|
_chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getBaseProps()), {
|
|
126
127
|
className: _pixelutils.cn.call(void 0, classNames.base),
|
|
127
|
-
"data-testid": `${testId}_wrapper`,
|
|
128
128
|
"data-required": required,
|
|
129
|
+
"data-testid": `${testId}_wrapper`,
|
|
129
130
|
children: [
|
|
130
|
-
|
|
131
|
+
label ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
132
|
"label",
|
|
132
133
|
{
|
|
133
134
|
className: classNames.label,
|
|
134
135
|
"data-slot": "label",
|
|
135
136
|
htmlFor: `react-select-${name}-input`,
|
|
136
137
|
id: getLabelProps().id,
|
|
137
|
-
children:
|
|
138
|
-
label,
|
|
139
|
-
showTestIdCopyButton ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkOE5BOGGXcjs.FieldCopyTestIdButton_default, { testId }) : null
|
|
140
|
-
]
|
|
138
|
+
children: label
|
|
141
139
|
}
|
|
142
140
|
) : null,
|
|
143
141
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
142
|
_reactselect2.default,
|
|
145
143
|
{
|
|
144
|
+
ref,
|
|
146
145
|
menuShouldBlockScroll: true,
|
|
147
146
|
unstyled: true,
|
|
148
147
|
"aria-errormessage": "",
|
|
149
148
|
"aria-invalid": invalid,
|
|
150
|
-
|
|
151
|
-
Input: InputComponent,
|
|
152
|
-
Option: OptionComponent,
|
|
153
|
-
DropdownIndicator: DropdownIndicatorComponent,
|
|
154
|
-
Control: ControlComponent
|
|
155
|
-
},
|
|
156
|
-
"aria-labelledby": (_a = getTriggerProps()["aria-labelledby"]) == null ? void 0 : _a.split(" ")[1],
|
|
149
|
+
"aria-labelledby": (_a2 = getTriggerProps()["aria-labelledby"]) == null ? void 0 : _a2.split(" ")[1],
|
|
157
150
|
"data-testid": testId,
|
|
158
151
|
filterOption,
|
|
159
152
|
formatOptionLabel: renderOptionLabel,
|
|
@@ -162,50 +155,101 @@ var Select = ({
|
|
|
162
155
|
isClearable: clearable,
|
|
163
156
|
isDisabled: disabled,
|
|
164
157
|
isLoading: loading,
|
|
165
|
-
name,
|
|
166
158
|
isMulti: multiSelect,
|
|
167
159
|
menuPosition: "fixed",
|
|
160
|
+
name,
|
|
168
161
|
onInputChange,
|
|
169
162
|
options,
|
|
170
163
|
placeholder,
|
|
171
164
|
classNames: {
|
|
172
|
-
control: () =>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
165
|
+
control: () => {
|
|
166
|
+
return _pixelutils.cn.call(void 0, classNames.control, {
|
|
167
|
+
[classNames.control_focused]: isFocused && !invalid
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
clearIndicator: () => {
|
|
171
|
+
return classNames.clearIndicator;
|
|
172
|
+
},
|
|
173
|
+
dropdownIndicator: () => {
|
|
174
|
+
return classNames.dropdownIndicator;
|
|
175
|
+
},
|
|
176
|
+
groupHeading: () => {
|
|
177
|
+
return classNames.groupHeading;
|
|
178
|
+
},
|
|
179
|
+
indicatorsContainer: () => {
|
|
180
|
+
return classNames.indicatorsContainer;
|
|
181
|
+
},
|
|
182
|
+
indicatorSeparator: () => {
|
|
183
|
+
return classNames.indicatorSeparator;
|
|
184
|
+
},
|
|
185
|
+
loadingIndicator: () => {
|
|
186
|
+
return classNames.loadingIndicator;
|
|
187
|
+
},
|
|
188
|
+
loadingMessage: () => {
|
|
189
|
+
return classNames.loadingMessage;
|
|
190
|
+
},
|
|
191
|
+
input: () => {
|
|
192
|
+
return classNames.input;
|
|
193
|
+
},
|
|
194
|
+
menu: () => {
|
|
195
|
+
return classNames.menu;
|
|
196
|
+
},
|
|
197
|
+
menuList: () => {
|
|
198
|
+
return classNames.menuList;
|
|
199
|
+
},
|
|
200
|
+
menuPortal: () => {
|
|
201
|
+
return classNames.menuPortal;
|
|
202
|
+
},
|
|
203
|
+
multiValue: () => {
|
|
204
|
+
return classNames.multiValue;
|
|
205
|
+
},
|
|
206
|
+
multiValueLabel: () => {
|
|
207
|
+
return _pixelutils.cn.call(void 0,
|
|
208
|
+
classNames.multiValueLabel,
|
|
209
|
+
`${getValueProps().className}`
|
|
210
|
+
);
|
|
211
|
+
},
|
|
212
|
+
multiValueRemove: () => {
|
|
213
|
+
return classNames.multiValueRemove;
|
|
214
|
+
},
|
|
215
|
+
noOptionsMessage: () => {
|
|
216
|
+
return classNames.noOptionsMessage;
|
|
217
|
+
},
|
|
190
218
|
option: ({
|
|
191
219
|
isFocused: optionIsFocused,
|
|
192
220
|
isSelected: optionIsSelected
|
|
193
|
-
}) =>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
221
|
+
}) => {
|
|
222
|
+
return _pixelutils.cn.call(void 0, classNames.option, {
|
|
223
|
+
[classNames.option_focused]: optionIsFocused,
|
|
224
|
+
[classNames.option_selected]: optionIsSelected
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
placeholder: () => {
|
|
228
|
+
return classNames.placeholder;
|
|
229
|
+
},
|
|
230
|
+
singleValue: () => {
|
|
231
|
+
return _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`);
|
|
232
|
+
},
|
|
233
|
+
valueContainer: () => {
|
|
234
|
+
return classNames.valueContainer;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
components: {
|
|
238
|
+
Input: InputComponent,
|
|
239
|
+
Option: OptionComponent,
|
|
240
|
+
DropdownIndicator: DropdownIndicatorComponent,
|
|
241
|
+
Control: ControlComponent
|
|
200
242
|
},
|
|
201
243
|
onBlur: (_e) => {
|
|
202
244
|
setIsFocused(false);
|
|
203
|
-
|
|
245
|
+
onBlur();
|
|
204
246
|
},
|
|
205
247
|
onChange: (option) => {
|
|
206
248
|
if (multiSelect) {
|
|
207
249
|
onChange(
|
|
208
|
-
option == null ? void 0 : option.map((_option) =>
|
|
250
|
+
option == null ? void 0 : option.map((_option) => {
|
|
251
|
+
return _option.value;
|
|
252
|
+
})
|
|
209
253
|
);
|
|
210
254
|
} else {
|
|
211
255
|
onChange(option == null ? void 0 : option.value);
|
|
@@ -214,11 +258,12 @@ var Select = ({
|
|
|
214
258
|
onFocus: (_e) => {
|
|
215
259
|
setIsFocused(true);
|
|
216
260
|
},
|
|
217
|
-
|
|
218
|
-
|
|
261
|
+
value: options.find((option) => {
|
|
262
|
+
return option.value === value;
|
|
263
|
+
})
|
|
219
264
|
}
|
|
220
265
|
),
|
|
221
|
-
|
|
266
|
+
invalid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", _chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getHelperWrapperProps()), { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", _chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getErrorMessageProps()), { children: errorMessage })) })) : null
|
|
222
267
|
]
|
|
223
268
|
})
|
|
224
269
|
);
|
|
@@ -232,4 +277,4 @@ var Select_default2 = Select_default;
|
|
|
232
277
|
|
|
233
278
|
|
|
234
279
|
exports.Select_default = Select_default; exports.Select_default2 = Select_default2;
|
|
235
|
-
//# sourceMappingURL=chunk-
|
|
280
|
+
//# sourceMappingURL=chunk-HQNZYWJX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-HQNZYWJX.cjs","../src/Select/Select.tsx","../src/Select/index.ts"],"names":["_a","Select_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACNA,8BAAyB;AACzB,qGAAwC;AAExC,wCAA0B;AAE1B,oDAAsD;AAgG7C,+CAAA;AA5FF,IAAM,eAAA,EAAiB,4BAAA;AAAG,EAC/B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,cAAA,EACE,wGAAA;AAAA,IACF,OAAA,EACE,q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F,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACE,kBAAA;AACA,kBAAA;AACF,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACA,gBAAA;AACF,cAAA;AACE,gBAAA;AACE,kBAAA;AACA,kBAAA;AACD,gBAAA;AACH,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACA,cAAA;AACE,gBAAA;AACF,cAAA;AACF,YAAA;AACA,YAAA;AACE,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACF,YAAA;AACA,YAAA;AACE,cAAA;AACA,cAAA;AACF,YAAA;AACA,YAAA;AACM,cAAA;AACF,gBAAA;AACG,kBAAA;AACC,oBAAA;AACF,kBAAA;AACF,gBAAA;AACF,cAAA;AACE,gBAAA;AACF,cAAA;AACF,YAAA;AACA,YAAA;AACE,cAAA;AACF,YAAA;AAEA,YAAA;AACE,cAAA;AACD,YAAA;AAAA,UAAA;AACH,QAAA;AAEE,QAAA;AAIE,MAAA;AAAA,IAAA;AACN,EAAA;AAEJ;AAEO;AD5EW;AACA;AE1QXC;AF4QW;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-HQNZYWJX.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'text-foreground-500 hover:bg-default-200 hover:text-foreground-800 rounded-md p-1 hover:cursor-pointer',\n control:\n 'border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger rounded-lg border-2 duration-150! motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'text-foreground-500 hover:bg-default-200 rounded-md p-1 hover:cursor-pointer hover:text-black',\n group: '',\n groupHeading: 'text-foreground-500 mt-2 mb-1 ml-3 text-sm',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-small group-data-[invalid=true]:!text-danger group-data-[required=true]:after:text-danger pointer-events-auto relative bottom-1.5 ml-1 subpixel-antialiased group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:content-[\"*\"]',\n loadingIndicator: '',\n loadingMessage: 'text-foreground-500 rounded-sm p-2',\n menu: 'border-default-200 bg-content1 mt-2 rounded-xl border p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'bg-default-100 items-center gap-1.5 rounded py-0.5 pr-1 pl-2',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'text-default-500 hover:border-default-300 hover:text-default-800 rounded hover:cursor-pointer',\n noOptionsMessage: 'text-foreground-500 rounded-sm p-2',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'text-foreground-500 ml-1 py-0.5 pl-1 text-sm',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ninterface SelectOption {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: React.ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n {}\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(props?.data?.testId ?? props?.data?.value, { replaceDots: true })}`;\n return (\n <div data-testid={testId}>\n {}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n {}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n filterOption = undefined,\n renderOptionLabel = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n const [isFocused, setIsFocused] = useState(false);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n menuShouldBlockScroll\n unstyled\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-labelledby={getTriggerProps()['aria-labelledby']?.split(' ')[1]}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n name={name}\n onInputChange={onInputChange}\n options={options}\n placeholder={placeholder}\n classNames={{\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n input: () => {\n return classNames.input;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n );\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) => {\n return cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Control: ControlComponent,\n }}\n onBlur={(_e) => {\n setIsFocused(false);\n onBlur();\n }}\n onChange={(option) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return _option.value;\n }),\n );\n } else {\n onChange((option as SelectOption)?.value);\n }\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n // set complete option as value by current field value\n value={options.find((option) => {\n return option.value === value;\n })}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n {}\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useUniformField
|
|
3
|
+
} from "./chunk-CJD3DW4J.js";
|
|
4
|
+
import {
|
|
5
|
+
useInputValueDebounce
|
|
6
|
+
} from "./chunk-6IU7IYYB.js";
|
|
7
|
+
import {
|
|
8
|
+
__objRest,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "./chunk-K2V4ULA2.js";
|
|
11
|
+
|
|
12
|
+
// src/TextArea/TextArea.tsx
|
|
13
|
+
import { Textarea as HeroTextArea } from "@heroui/input";
|
|
14
|
+
import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var textAreaVariants = tv({
|
|
17
|
+
slots: {
|
|
18
|
+
/** wrapper around the whole input */
|
|
19
|
+
base: "",
|
|
20
|
+
/** clear button */
|
|
21
|
+
clearButton: "",
|
|
22
|
+
/** actual input element */
|
|
23
|
+
input: "",
|
|
24
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
25
|
+
inputWrapper: "bg-content1 group-data-[focus=true]:border-focus"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var TextArea = (_a) => {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
children = null,
|
|
31
|
+
className: _className = void 0,
|
|
32
|
+
debounceDelay = 300,
|
|
33
|
+
name,
|
|
34
|
+
placeholder = " "
|
|
35
|
+
} = _b, uniformFieldProps = __objRest(_b, [
|
|
36
|
+
"children",
|
|
37
|
+
"className",
|
|
38
|
+
"debounceDelay",
|
|
39
|
+
"name",
|
|
40
|
+
"placeholder"
|
|
41
|
+
]);
|
|
42
|
+
const {
|
|
43
|
+
disabled,
|
|
44
|
+
errorMessage,
|
|
45
|
+
field: {
|
|
46
|
+
onChange: fieldOnChange,
|
|
47
|
+
onBlur: fieldOnBlur,
|
|
48
|
+
value: fieldValue,
|
|
49
|
+
ref
|
|
50
|
+
},
|
|
51
|
+
invalid,
|
|
52
|
+
label,
|
|
53
|
+
required,
|
|
54
|
+
testId
|
|
55
|
+
} = useUniformField(__spreadValues({ name }, uniformFieldProps));
|
|
56
|
+
const { onChange, onBlur, value } = useInputValueDebounce({
|
|
57
|
+
debounceDelay,
|
|
58
|
+
onBlur: fieldOnBlur,
|
|
59
|
+
onChange: fieldOnChange,
|
|
60
|
+
value: fieldValue
|
|
61
|
+
});
|
|
62
|
+
const variants = textAreaVariants();
|
|
63
|
+
const classNames = variantsToClassNames(variants, _className, "base");
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
HeroTextArea,
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
"data-testid": testId,
|
|
69
|
+
errorMessage,
|
|
70
|
+
id: testId,
|
|
71
|
+
isDisabled: disabled,
|
|
72
|
+
isInvalid: invalid,
|
|
73
|
+
isRequired: required,
|
|
74
|
+
label,
|
|
75
|
+
labelPlacement: "outside",
|
|
76
|
+
name,
|
|
77
|
+
onBlur,
|
|
78
|
+
onChange,
|
|
79
|
+
placeholder,
|
|
80
|
+
value,
|
|
81
|
+
variant: "bordered",
|
|
82
|
+
classNames: {
|
|
83
|
+
base: classNames.base,
|
|
84
|
+
clearButton: classNames.clearButton,
|
|
85
|
+
// set padding to 0 for error message exit animation
|
|
86
|
+
helperWrapper: "p-0",
|
|
87
|
+
input: classNames.input,
|
|
88
|
+
inputWrapper: classNames.inputWrapper
|
|
89
|
+
},
|
|
90
|
+
children
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
var TextArea_default = TextArea;
|
|
95
|
+
|
|
96
|
+
// src/TextArea/index.ts
|
|
97
|
+
var TextArea_default2 = TextArea_default;
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
TextArea_default,
|
|
101
|
+
TextArea_default2
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=chunk-LLQLEDOO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { Textarea as HeroTextArea } from '@heroui/input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useInputValueDebounce, useUniformField } from '../hooks';\n\n// input variants\nexport const textAreaVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof textAreaVariants>;\ntype ClassName = TVClassName<typeof textAreaVariants>;\n\nexport interface TextAreaProps extends VariantProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className: _className = undefined,\n debounceDelay = 300,\n name,\n placeholder = ' ',\n ...uniformFieldProps\n}: TextAreaProps) => {\n const {\n disabled,\n errorMessage,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // Use debounced handlers for form updates\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // classNames from slots\n const variants = textAreaVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n return (\n <HeroTextArea\n ref={ref}\n data-testid={testId}\n errorMessage={errorMessage}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n placeholder={placeholder}\n value={value as string}\n variant=\"bordered\"\n classNames={{\n base: classNames.base,\n clearButton: classNames.clearButton,\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n }}\n >\n {children}\n </HeroTextArea>\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,YAAY,oBAAoB;AAEzC,SAAS,IAAI,4BAA4B;AA+ErC;AA1EG,IAAM,mBAAmB,GAAG;AAAA,EACjC,OAAO;AAAA;AAAA,IAEL,MAAM;AAAA;AAAA,IAEN,aAAa;AAAA;AAAA,IAEb,OAAO;AAAA;AAAA,IAEP,cAAc;AAAA,EAChB;AACF,CAAC;AA2BD,IAAM,WAAW,CAAC,OAOG;AAPH,eAChB;AAAA,eAAW;AAAA,IACX,WAAW,aAAa;AAAA,IACxB,gBAAgB;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,EArDhB,IAgDkB,IAMb,8BANa,IAMb;AAAA,IALH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,OAAO;AAAA,MACP;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,gBAAgB,iBAAE,QAAS,kBAAmB;AAGlD,QAAM,EAAE,UAAU,QAAQ,MAAM,IAAI,sBAAsB;AAAA,IACxD;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AAGD,QAAM,WAAW,iBAAiB;AAClC,QAAM,aAAa,qBAAqB,UAAU,YAAY,MAAM;AAEpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa;AAAA,MACb;AAAA,MACA,IAAI;AAAA,MACJ,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,MACZ;AAAA,MACA,gBAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,YAAY;AAAA,QACV,MAAM,WAAW;AAAA,QACjB,aAAa,WAAW;AAAA;AAAA,QAExB,eAAe;AAAA,QACf,OAAO,WAAW;AAAA,QAClB,cAAc,WAAW;AAAA,MAC3B;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,mBAAQ;;;AC5Gf,IAAOA,oBAAQ;","names":["TextArea_default"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/partials/FieldValidationError/FieldValidationError.tsx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _pixelmotion = require('@fuf-stack/pixel-motion');
|
|
7
|
+
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
8
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
9
|
+
var FieldValidationError = ({
|
|
10
|
+
className = void 0,
|
|
11
|
+
error = void 0,
|
|
12
|
+
testId
|
|
13
|
+
}) => {
|
|
14
|
+
const disableAnimation = _pixelmotion.useReducedMotion.call(void 0, );
|
|
15
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
16
|
+
"ul",
|
|
17
|
+
{
|
|
18
|
+
"aria-label": `Validation errors of field ${testId}`,
|
|
19
|
+
className,
|
|
20
|
+
"data-testid": _pixelutils.slugify.call(void 0, `${testId}_error`),
|
|
21
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _pixelmotion.AnimatePresence, { initial: !disableAnimation, children: error == null ? void 0 : error.map(({ message }, i) => {
|
|
22
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
+
_pixelmotion.motion.li,
|
|
24
|
+
{
|
|
25
|
+
exit: disableAnimation ? void 0 : { opacity: 0, height: 0 },
|
|
26
|
+
initial: disableAnimation ? false : { height: 0, opacity: 0 },
|
|
27
|
+
style: { overflow: "hidden" },
|
|
28
|
+
transition: { duration: 0.2, ease: "circOut" },
|
|
29
|
+
animate: disableAnimation ? void 0 : { opacity: 1, height: "auto" },
|
|
30
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-1 pt-1", children: message })
|
|
31
|
+
},
|
|
32
|
+
_pixelutils.slugify.call(void 0, `${testId}_error_${i}`)
|
|
33
|
+
);
|
|
34
|
+
}) })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
var FieldValidationError_default = FieldValidationError;
|
|
39
|
+
|
|
40
|
+
// src/partials/FieldValidationError/index.ts
|
|
41
|
+
var FieldValidationError_default2 = FieldValidationError_default;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.FieldValidationError_default = FieldValidationError_default; exports.FieldValidationError_default2 = FieldValidationError_default2;
|
|
47
|
+
//# sourceMappingURL=chunk-NHEZXA4H.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NHEZXA4H.cjs","../src/partials/FieldValidationError/FieldValidationError.tsx","../src/partials/FieldValidationError/index.ts"],"names":[],"mappings":"AAAA;ACEA;AACE;AACA;AACA;AAAA,sDACK;AACP,oDAAwB;AA0CV,+CAAA;AA5Bd,IAAM,qBAAA,EAAuB,CAAC;AAAA,EAC5B,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ,MAAA,EAAQ,KAAA,CAAA;AAAA,EACR;AACF,CAAA,EAAA,GAAiC;AAE/B,EAAA,MAAM,iBAAA,EAAmB,2CAAA,CAAiB;AAE1C,EAAA,uBACE,6BAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,CAAA,2BAAA,EAA8B,MAAM,CAAA,CAAA;AAChD,MAAA;AACsC,MAAA;AAErB,MAAA;AAGX,QAAA;AAAQ,UAAA;AAAP,UAAA;AAEiD,YAAA;AACV,YAAA;AACV,YAAA;AACiB,YAAA;AAEV,YAAA;AAI9B,YAAA;AAA+B,UAAA;AAVD,UAAA;AAWrC,QAAA;AAGN,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;AAEe;ADpB0C;AACA;AEjC1C;AFmC0C;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NHEZXA4H.cjs","sourcesContent":[null,"import type { FieldError } from 'react-hook-form';\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { slugify } from '@fuf-stack/pixel-utils';\n\nexport interface FieldValidationErrorProps {\n /** CSS class name */\n className?: string;\n /** Field errors */\n error?: FieldError[];\n /** HTML data-testid attribute used in e2e tests */\n testId: string;\n}\n\n/**\n * Renders a validation error of a field\n */\nconst FieldValidationError = ({\n className = undefined,\n error = undefined,\n testId,\n}: FieldValidationErrorProps) => {\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n return (\n <ul\n aria-label={`Validation errors of field ${testId}`}\n className={className}\n data-testid={slugify(`${testId}_error`)}\n >\n <AnimatePresence initial={!disableAnimation}>\n {error?.map(({ message }, i) => {\n return (\n <motion.li\n key={slugify(`${testId}_error_${i}`)}\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n {/* wrap in div to apply padding and animation does not jump */}\n <div className=\"px-1 pt-1\">{message}</div>\n </motion.li>\n );\n })}\n </AnimatePresence>\n </ul>\n );\n};\n\nexport default FieldValidationError;\n","import FieldValidationError from './FieldValidationError';\n\nexport type { FieldValidationErrorProps } from './FieldValidationError';\n\nexport { FieldValidationError };\n\nexport default FieldValidationError;\n"]}
|