@commercetools/nimbus 0.0.0-canary-20250929125459 → 0.0.0-canary-20250930095152

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.
Files changed (64) hide show
  1. package/dist/chunks/data-table-BFGyPJvT.cjs.js +2 -0
  2. package/dist/chunks/{data-table-BBgNLX1F.cjs.js.map → data-table-BFGyPJvT.cjs.js.map} +1 -1
  3. package/dist/chunks/{data-table-D3e1Jwo7.es.js → data-table-CommJV1y.es.js} +883 -872
  4. package/dist/chunks/{data-table-D3e1Jwo7.es.js.map → data-table-CommJV1y.es.js.map} +1 -1
  5. package/dist/chunks/form-field-C6lWjdck.cjs.js +11 -0
  6. package/dist/chunks/form-field-C6lWjdck.cjs.js.map +1 -0
  7. package/dist/chunks/form-field-bP4SYMaC.es.js +319 -0
  8. package/dist/chunks/form-field-bP4SYMaC.es.js.map +1 -0
  9. package/dist/chunks/make-element-focusable-BDByS8Na.cjs.js +2 -0
  10. package/dist/chunks/make-element-focusable-BDByS8Na.cjs.js.map +1 -0
  11. package/dist/chunks/make-element-focusable-BamCHW5U.es.js +25 -0
  12. package/dist/chunks/make-element-focusable-BamCHW5U.es.js.map +1 -0
  13. package/dist/chunks/{money-input-B2X3PtKX.es.js → money-input-BN_yFB_R.es.js} +3 -3
  14. package/dist/chunks/{money-input-B2X3PtKX.es.js.map → money-input-BN_yFB_R.es.js.map} +1 -1
  15. package/dist/chunks/{money-input-BFhtaiLG.cjs.js → money-input-BPrFeUBJ.cjs.js} +2 -2
  16. package/dist/chunks/{money-input-BFhtaiLG.cjs.js.map → money-input-BPrFeUBJ.cjs.js.map} +1 -1
  17. package/dist/chunks/{pagination-Dis-nnBy.cjs.js → pagination-0rlXyI2R.cjs.js} +2 -2
  18. package/dist/chunks/{pagination-Dis-nnBy.cjs.js.map → pagination-0rlXyI2R.cjs.js.map} +1 -1
  19. package/dist/chunks/{pagination-ZXOMcPAB.es.js → pagination-C4dyNajw.es.js} +2 -2
  20. package/dist/chunks/{pagination-ZXOMcPAB.es.js.map → pagination-C4dyNajw.es.js.map} +1 -1
  21. package/dist/chunks/{rich-text-input-3MgAtZuL.cjs.js → rich-text-input-DbpI_805.cjs.js} +12 -12
  22. package/dist/chunks/{rich-text-input-3MgAtZuL.cjs.js.map → rich-text-input-DbpI_805.cjs.js.map} +1 -1
  23. package/dist/chunks/{rich-text-input-C8bdPxGb.es.js → rich-text-input-DynX9BO2.es.js} +658 -655
  24. package/dist/chunks/{rich-text-input-C8bdPxGb.es.js.map → rich-text-input-DynX9BO2.es.js.map} +1 -1
  25. package/dist/chunks/select-5dgbT8AN.cjs.js +2 -0
  26. package/dist/chunks/{select-C1SC1XAp.cjs.js.map → select-5dgbT8AN.cjs.js.map} +1 -1
  27. package/dist/chunks/select-CwavXa9Y.es.js +580 -0
  28. package/dist/chunks/{select-DpHmAHrs.es.js.map → select-CwavXa9Y.es.js.map} +1 -1
  29. package/dist/components/components.cjs +1 -1
  30. package/dist/components/components.es.js +7 -7
  31. package/dist/components/data-table.cjs +1 -1
  32. package/dist/components/data-table.es.js +1 -1
  33. package/dist/components/form-field.cjs +1 -1
  34. package/dist/components/form-field.es.js +1 -1
  35. package/dist/components/money-input.cjs +1 -1
  36. package/dist/components/money-input.es.js +1 -1
  37. package/dist/components/pagination.cjs +1 -1
  38. package/dist/components/pagination.es.js +1 -1
  39. package/dist/components/rich-text-input.cjs +1 -1
  40. package/dist/components/rich-text-input.es.js +1 -1
  41. package/dist/components/select.cjs +1 -1
  42. package/dist/components/select.es.js +1 -1
  43. package/dist/components/tooltip.cjs +1 -1
  44. package/dist/components/tooltip.es.js +1 -1
  45. package/dist/components.d.ts +76 -21
  46. package/dist/data-table.d.ts +45 -14
  47. package/dist/form-field.d.ts +7 -4
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.ts +74 -19
  50. package/dist/index.es.js +8 -8
  51. package/dist/select.d.ts +12 -4
  52. package/dist/tooltip.d.ts +13 -6
  53. package/package.json +5 -5
  54. package/dist/chunks/data-table-BBgNLX1F.cjs.js +0 -2
  55. package/dist/chunks/form-field-D2DlhLF_.cjs.js +0 -11
  56. package/dist/chunks/form-field-D2DlhLF_.cjs.js.map +0 -1
  57. package/dist/chunks/form-field-DY3B_1tq.es.js +0 -310
  58. package/dist/chunks/form-field-DY3B_1tq.es.js.map +0 -1
  59. package/dist/chunks/make-element-focusable-C4ZHUSEU.es.js +0 -22
  60. package/dist/chunks/make-element-focusable-C4ZHUSEU.es.js.map +0 -1
  61. package/dist/chunks/make-element-focusable-bPAMXt4D.cjs.js +0 -2
  62. package/dist/chunks/make-element-focusable-bPAMXt4D.cjs.js.map +0 -1
  63. package/dist/chunks/select-C1SC1XAp.cjs.js +0 -2
  64. package/dist/chunks/select-DpHmAHrs.es.js +0 -579
@@ -0,0 +1,11 @@
1
+ "use strict";const o=require("react/jsx-runtime"),t=require("react"),H=require("@chakra-ui/react"),F=require("@chakra-ui/react/styled-system"),m=require("./Dialog-32GmWneq.cjs.js"),f=require("./box-CWni3A32.cjs.js"),q=require("./icon-button-0GLW7WtL.cjs.js"),b=require("@commercetools/nimbus-icons"),I=require("./useObjectRef-dXOJdONs.cjs.js"),L=require("./useField-DmqO9k7a.cjs.js"),s=t.createContext({context:{label:null,description:null,error:null,info:null,input:null},setContext:()=>{}}),M=`
2
+ "label"
3
+ "input"
4
+ "description"
5
+ "error"
6
+ `,T=`
7
+ "label input"
8
+ "label description"
9
+ "label error"
10
+ `,W=F.defineSlotRecipe({slots:["root","label","input","description","error","popover"],className:"nimbus-ui-form-field",base:{root:{"--grid-gap":"spacing.100",display:"grid",width:"auto"},label:{gridArea:"label",fontWeight:"500",color:"neutral.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)"},input:{gridArea:"input"},description:{gridArea:"description",color:"neutral.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)"},error:{gridArea:"error",color:"critical.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)",display:"flex",gap:"100"},popover:{"--scrollbar-color":"colors.neutral.8","--scrollbar-bg":"colors.neutral.3",bg:"neutral.1",maxWidth:"xl",borderRadius:"200",boxShadow:"6",border:"solid-25",borderColor:"neutral.8",maxHeight:"40svh",overflow:"auto",scrollbarWidth:"thin",scrollbarColor:"var(--scrollbar-color) var(--scrollbar-bg)",focusRing:"outside"}},variants:{size:{md:{root:{"--form-field-font-size":"fontSizes.350","--form-field-line-height":"lineHeights.500"}},sm:{root:{"--form-field-font-size":"fontSizes.300","--form-field-line-height":"lineHeights.450"}}},direction:{column:{root:{gridTemplateAreas:M},input:{mt:"var(--grid-gap)"},description:{mt:"var(--grid-gap)"},error:{mt:"var(--grid-gap)"}},row:{root:{gridTemplateAreas:T,gridTemplateColumns:"auto 1fr",gridColumnGap:"200"},description:{mt:"var(--grid-gap)"},error:{mt:"var(--grid-gap)"}}}},defaultVariants:{direction:"column",size:"md"}}),{withProvider:k,withContext:c}=F.createSlotRecipeContext({recipe:W}),D=k("div","root"),N=c("div","label"),O=c("div","input"),V=c("div","description"),_=c("div","error"),G=c("div","popover"),g=function({ref:n,isInvalid:e,isRequired:l,isDisabled:d,isReadOnly:u,children:$,...z}){const E=t.useRef(null),P=I.$df56164dff5785e2$export$4338b53315abf666(H.mergeRefs(E,n)),[r,x]=t.useState({label:null,description:null,error:null,info:null,input:null,isInvalid:e,isRequired:l,isDisabled:d,isReadOnly:u}),p={description:r.description,errorMessage:r.error};r.label?p.label=r.label:(p["aria-label"]="empty-label",p["aria-labelledby"]="empty-label");const{labelProps:R,fieldProps:y,descriptionProps:B,errorMessageProps:w}=L.$2baaea4c71418dea$export$294aa081a6c6f55d(p);t.useEffect(()=>{x(a=>({...a,isInvalid:e,isRequired:l,isDisabled:d,isReadOnly:u}))},[e,l,d,u]);const A={...y,isInvalid:e,isRequired:l,isDisabled:d,isReadOnly:u};return o.jsx(s.Provider,{value:{context:r,setContext:x},children:o.jsxs(D,{ref:P,...z,children:[r.label&&o.jsxs(N,{...r.labelSlotProps,children:[o.jsxs("label",{...R,children:[r.label,l&&o.jsx("sup",{"aria-hidden":"true",children:"*"})]}),r.info&&o.jsxs(m.$de32f1b87079253c$export$2e1e1122cf0cba88,{children:[o.jsx(f.Box,{as:"span",display:"inline-block",position:"relative",width:"1ch",height:"1ch",ml:"200",children:o.jsx(f.Box,{as:"span",display:"inline-flex",position:"absolute",top:"50%",right:"50%",transform:"translate(50%, -50%)",children:o.jsx(q.IconButton,{"aria-label":"__MORE INFO",size:"2xs",tone:"info",variant:"link",children:o.jsx(b.HelpOutline,{})})})}),o.jsx(m.$07b14b47974efb58$export$5b6b19405a83ff9d,{children:o.jsx(G,{asChild:!0,children:o.jsx(m.$de32f1b87079253c$export$3ddf2d174ce01153,{children:o.jsx(f.Box,{p:"300",children:r.info})})})})]})]}),r.input&&o.jsx(O,{...r.inputSlotProps,children:t.Children.map(r.input,a=>t.isValidElement(a)?t.cloneElement(a,A):a)}),r.description&&o.jsx(V,{...B,...r.descriptionSlotProps,children:r.description}),e&&r.error&&o.jsxs(_,{...w,...r.errorSlotProps,children:[o.jsx(f.Box,{as:b.ErrorOutline,display:"inline-flex",boxSize:"400",verticalAlign:"text-bottom",mr:"100"}),r.error]}),$]})})},h=({children:i,...n})=>{const{setContext:e}=t.useContext(s);return t.useEffect(()=>{e(l=>({...l,label:i,labelSlotProps:n}))},[i,e]),null},v=({children:i,...n})=>{const{setContext:e}=t.useContext(s);return t.useEffect(()=>{e(l=>({...l,input:i,inputSlotProps:n}))},[i,e]),null},C=({children:i,...n})=>{const{setContext:e}=t.useContext(s);return t.useEffect(()=>{e(l=>({...l,description:i,descriptionSlotProps:n}))},[i,e]),null},S=({children:i,...n})=>{const{setContext:e}=t.useContext(s);return t.useEffect(()=>{e(l=>({...l,error:i,errorSlotProps:n}))},[i,e]),null},j=({children:i})=>{const{setContext:n}=t.useContext(s);return t.useEffect(()=>{n(e=>({...e,info:i}))},[i,n]),null},J={Root:g,Label:h,Input:v,Description:C,Error:S,InfoBox:j};exports.FormField=J;exports.FormFieldDescription=C;exports.FormFieldError=S;exports.FormFieldInfoBox=j;exports.FormFieldInput=v;exports.FormFieldLabel=h;exports.FormFieldRoot=g;
11
+ //# sourceMappingURL=form-field-C6lWjdck.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field-C6lWjdck.cjs.js","sources":["../../src/components/form-field/components/form-field.context.tsx","../../src/components/form-field/form-field.recipe.tsx","../../src/components/form-field/form-field.slots.tsx","../../src/components/form-field/components/form-field.root.tsx","../../src/components/form-field/components/form-field.label.tsx","../../src/components/form-field/components/form-field.input.tsx","../../src/components/form-field/components/form-field.description.tsx","../../src/components/form-field/components/form-field.error.tsx","../../src/components/form-field/components/form-field.info-box.tsx","../../src/components/form-field/form-field.tsx"],"sourcesContent":["import { createContext, type ReactNode } from \"react\";\nimport type {\n FormFieldDescriptionSlotProps,\n FormFieldErrorSlotProps,\n FormFieldInputSlotProps,\n FormFieldLabelSlotProps,\n} from \"../form-field.slots\";\n\nexport type FormFieldContextPayloadType = {\n label: ReactNode;\n labelSlotProps?: FormFieldLabelSlotProps;\n input: ReactNode;\n inputSlotProps?: FormFieldInputSlotProps;\n description: ReactNode;\n descriptionSlotProps?: FormFieldDescriptionSlotProps;\n error: ReactNode;\n errorSlotProps?: FormFieldErrorSlotProps;\n info: ReactNode;\n isInvalid?: boolean;\n isRequired?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n};\n\nexport type FormFieldContextType = {\n context: FormFieldContextPayloadType;\n setContext: React.Dispatch<React.SetStateAction<FormFieldContextPayloadType>>;\n};\n\nexport const FormFieldContext = createContext<FormFieldContextType>({\n context: {\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n },\n setContext: () => {},\n});\n","import { defineSlotRecipe } from \"@chakra-ui/react/styled-system\";\n\nconst columnLayout = `\n\"label\"\n\"input\"\n\"description\"\n\"error\"\n`;\nconst rowLayout = `\n\"label input\"\n\"label description\"\n\"label error\"\n`;\n\n/**\n * Recipe configuration for the FormField component.\n * Defines the styling variants and base styles using Chakra UI's recipe system.\n */\nexport const formFieldRecipe = defineSlotRecipe({\n slots: [\"root\", \"label\", \"input\", \"description\", \"error\", \"popover\"],\n // Unique class name prefix for the component\n className: \"nimbus-ui-form-field\",\n\n base: {\n root: {\n \"--grid-gap\": \"spacing.100\",\n\n display: \"grid\",\n width: \"auto\",\n },\n label: {\n gridArea: \"label\",\n fontWeight: \"500\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n input: {\n gridArea: \"input\",\n },\n description: {\n gridArea: \"description\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n error: {\n gridArea: \"error\",\n color: \"critical.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n display: \"flex\",\n gap: \"100\",\n },\n popover: {\n \"--scrollbar-color\": \"colors.neutral.8\",\n \"--scrollbar-bg\": \"colors.neutral.3\",\n bg: \"neutral.1\",\n maxWidth: \"xl\",\n borderRadius: \"200\",\n boxShadow: \"6\",\n border: \"solid-25\",\n borderColor: \"neutral.8\",\n maxHeight: \"40svh\",\n overflow: \"auto\",\n scrollbarWidth: \"thin\",\n scrollbarColor: \"var(--scrollbar-color) var(--scrollbar-bg)\",\n focusRing: \"outside\",\n },\n },\n\n variants: {\n size: {\n md: {\n root: {\n \"--form-field-font-size\": \"fontSizes.350\",\n \"--form-field-line-height\": \"lineHeights.500\",\n },\n },\n sm: {\n root: {\n \"--form-field-font-size\": \"fontSizes.300\",\n \"--form-field-line-height\": \"lineHeights.450\",\n },\n },\n },\n direction: {\n column: {\n root: {\n gridTemplateAreas: columnLayout,\n },\n input: {\n mt: \"var(--grid-gap)\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n row: {\n root: {\n gridTemplateAreas: rowLayout,\n gridTemplateColumns: \"auto 1fr\",\n gridColumnGap: \"200\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n },\n },\n\n // Default variant values when not explicitly specified\n defaultVariants: {\n direction: \"column\",\n size: \"md\",\n },\n});\n","/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react/styled-system\";\n\nimport { formFieldRecipe } from \"./form-field.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: formFieldRecipe,\n});\n\n// Root slot\nexport interface FormFieldRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof formFieldRecipe> & UnstyledProp\n > {}\n\nexport const FormFieldRootSlot = withProvider<\n HTMLDivElement,\n FormFieldRootSlotProps\n>(\"div\", \"root\");\n\n// Label Slot\nexport interface FormFieldLabelSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldLabelSlot = withContext<\n HTMLDivElement,\n FormFieldLabelSlotProps\n>(\"div\", \"label\");\n\n// Input Slot\nexport interface FormFieldInputSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldInputSlot = withContext<\n HTMLDivElement,\n FormFieldInputSlotProps\n>(\"div\", \"input\");\n\n// Description Slot\nexport interface FormFieldDescriptionSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldDescriptionSlot = withContext<\n HTMLDivElement,\n FormFieldDescriptionSlotProps\n>(\"div\", \"description\");\n\n// Error Slot\nexport interface FormFieldErrorSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldErrorSlot = withContext<\n HTMLDivElement,\n FormFieldErrorSlotProps\n>(\"div\", \"error\");\n\n// Error Slot\nexport interface FormFieldPopoverSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldPopoverSlot = withContext<\n HTMLDivElement,\n FormFieldPopoverSlotProps\n>(\"div\", \"popover\");\n","import {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useState,\n useRef,\n} from \"react\";\nimport type { FormFieldProps } from \"../form-field.types\";\nimport { useField, useObjectRef } from \"react-aria\";\nimport { mergeRefs } from \"@chakra-ui/react\";\nimport {\n FormFieldContext,\n type FormFieldContextPayloadType,\n} from \"./form-field.context\";\nimport {\n FormFieldDescriptionSlot,\n FormFieldErrorSlot,\n FormFieldInputSlot,\n FormFieldLabelSlot,\n FormFieldPopoverSlot,\n FormFieldRootSlot,\n} from \"../form-field.slots\";\nimport { Dialog, DialogTrigger, Popover } from \"react-aria-components\";\nimport { Box, IconButton } from \"@/components\";\nimport { ErrorOutline, HelpOutline } from \"@commercetools/nimbus-icons\";\n\n/**\n * # FormField\n *\n * displays miscellaneous inputs in a FormField context\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/formfield}\n */\nexport const FormFieldRoot = function FormFieldRoot({\n ref: forwardedRef,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n children,\n ...props\n}: FormFieldProps) {\n const localRef = useRef<HTMLDivElement>(null);\n const ref = useObjectRef(mergeRefs(localRef, forwardedRef));\n const [context, setContext] = useState<FormFieldContextPayloadType>({\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n });\n\n const useFieldArgs: Parameters<typeof useField>[0] = {\n description: context.description,\n errorMessage: context.error,\n };\n\n if (context.label) {\n useFieldArgs.label = context.label;\n } else {\n // Context will always start out null, so we need to stub out some aria attributes\n // FIXME: This is a hack to get the form field to work, but it's not the best solution\n // FIXME: We should find a better way to handle this by redesigning the FormField component's structure\n useFieldArgs[\"aria-label\"] = \"empty-label\";\n useFieldArgs[\"aria-labelledby\"] = \"empty-label\";\n }\n\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } =\n useField(useFieldArgs);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n }));\n }, [isInvalid, isRequired, isDisabled, isReadOnly]);\n\n const inputProps = {\n ...fieldProps,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n };\n\n return (\n <FormFieldContext.Provider value={{ context, setContext }}>\n <FormFieldRootSlot ref={ref} {...props}>\n {context.label && (\n <FormFieldLabelSlot {...context.labelSlotProps}>\n <label {...labelProps}>\n {context.label}\n {isRequired && <sup aria-hidden=\"true\">*</sup>}\n </label>\n {context.info && (\n <DialogTrigger>\n <Box\n as=\"span\"\n display=\"inline-block\"\n position=\"relative\"\n width=\"1ch\"\n height=\"1ch\"\n ml=\"200\"\n >\n <Box\n as=\"span\"\n display=\"inline-flex\"\n position=\"absolute\"\n top=\"50%\"\n right=\"50%\"\n transform=\"translate(50%, -50%)\"\n >\n <IconButton\n aria-label=\"__MORE INFO\"\n size=\"2xs\"\n tone=\"info\"\n variant=\"link\"\n >\n <HelpOutline />\n </IconButton>\n </Box>\n </Box>\n <Popover>\n <FormFieldPopoverSlot asChild>\n <Dialog>\n <Box p=\"300\">{context.info}</Box>\n </Dialog>\n </FormFieldPopoverSlot>\n </Popover>\n </DialogTrigger>\n )}\n </FormFieldLabelSlot>\n )}\n {context.input && (\n <FormFieldInputSlot {...context.inputSlotProps}>\n {Children.map(context.input, (child) => {\n // Important: Check if the child is a valid React element before cloning.\n if (isValidElement(child)) {\n return cloneElement(child, inputProps);\n }\n // If it's not a valid element (e.g., text node, null, undefined), return it as is.\n return child;\n })}\n </FormFieldInputSlot>\n )}\n {context.description && (\n <FormFieldDescriptionSlot\n {...descriptionProps}\n {...context.descriptionSlotProps}\n >\n {context.description}\n </FormFieldDescriptionSlot>\n )}\n {isInvalid && context.error && (\n <FormFieldErrorSlot\n {...errorMessageProps}\n {...context.errorSlotProps}\n >\n <Box\n as={ErrorOutline}\n display=\"inline-flex\"\n boxSize=\"400\"\n verticalAlign=\"text-bottom\"\n mr=\"100\"\n />\n {context.error}\n </FormFieldErrorSlot>\n )}\n {children}\n </FormFieldRootSlot>\n </FormFieldContext.Provider>\n );\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldLabelSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldLabel = ({\n children,\n ...labelSlotProps\n}: FormFieldLabelSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n label: children,\n labelSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldInputSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldInput = ({\n children,\n ...inputSlotProps\n}: FormFieldInputSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n input: children,\n inputSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldDescriptionSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldDescription = ({\n children,\n ...descriptionSlotProps\n}: FormFieldDescriptionSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n description: children,\n descriptionSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldErrorSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldError = ({\n children,\n ...errorSlotProps\n}: FormFieldErrorSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n error: children,\n errorSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect, type ReactNode } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\n\ntype FormFieldInfoBoxProps = {\n /**\n * The content to display in the InfoBox\n */\n children: ReactNode;\n};\n\nexport const FormFieldInfoBox = ({ children }: FormFieldInfoBoxProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n info: children,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { FormFieldRoot } from \"./components/form-field.root\";\nimport { FormFieldLabel } from \"./components/form-field.label\";\nimport { FormFieldInput } from \"./components/form-field.input\";\nimport { FormFieldDescription } from \"./components/form-field.description\";\nimport { FormFieldError } from \"./components/form-field.error\";\nimport { FormFieldInfoBox } from \"./components/form-field.info-box\";\n\nexport const FormField = {\n Root: FormFieldRoot,\n Label: FormFieldLabel,\n Input: FormFieldInput,\n Description: FormFieldDescription,\n Error: FormFieldError,\n InfoBox: FormFieldInfoBox,\n};\n\nexport {\n FormFieldRoot as _FormFieldRoot,\n FormFieldLabel as _FormFieldLabel,\n FormFieldInput as _FormFieldInput,\n FormFieldDescription as _FormFieldDescription,\n FormFieldError as _FormFieldError,\n FormFieldInfoBox as _FormFieldInfoBox,\n};\n"],"names":["FormFieldContext","createContext","columnLayout","rowLayout","formFieldRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","FormFieldRootSlot","FormFieldLabelSlot","FormFieldInputSlot","FormFieldDescriptionSlot","FormFieldErrorSlot","FormFieldPopoverSlot","FormFieldRoot","forwardedRef","isInvalid","isRequired","isDisabled","isReadOnly","children","props","localRef","useRef","ref","useObjectRef","mergeRefs","context","setContext","useState","useFieldArgs","labelProps","fieldProps","descriptionProps","errorMessageProps","useField","useEffect","prevContext","inputProps","jsx","jsxs","DialogTrigger","Box","IconButton","HelpOutline","Popover","Dialog","Children","child","isValidElement","cloneElement","ErrorOutline","FormFieldLabel","labelSlotProps","useContext","FormFieldInput","inputSlotProps","FormFieldDescription","descriptionSlotProps","FormFieldError","errorSlotProps","FormFieldInfoBox","FormField"],"mappings":"gYA6BaA,EAAmB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ACH,YAAajB,EACb,qBAAAsC,CAAA,EACA,CACJ,EAAG,CAACtC,EAAUQ,CAAU,CAAC,EAElB,IACT,ECfa+B,EAAiB,CAAC,CAC7B,SAAAvC,EACA,GAAGwC,CACL,IAA+B,CAC7B,KAAM,CAAE,WAAAhC,CAAA,EAAe0B,EAAAA,WAAWvD,CAAgB,EAElDqC,OAAAA,EAAAA,UAAU,IAAM,CACdR,EAAYS,IAAiB,CAC3B,GAAGA,EACH,MAAOjB,EACP,eAAAwC,CAAA,EACA,CACJ,EAAG,CAACxC,EAAUQ,CAAU,CAAC,EAElB,IACT,ECTaiC,EAAmB,CAAC,CAAE,SAAAzC,KAAsC,CACvE,KAAM,CAAE,WAAAQ,CAAA,EAAe0B,EAAAA,WAAWvD,CAAgB,EAElDqC,OAAAA,EAAAA,UAAU,IAAM,CACdR,EAAYS,IAAiB,CAC3B,GAAGA,EACH,KAAMjB,CAAA,EACN,CACJ,EAAG,CAACA,EAAUQ,CAAU,CAAC,EAElB,IACT,ECdakC,EAAY,CACvB,KAAMhD,EACN,MAAOsC,EACP,MAAOG,EACP,YAAaE,EACb,MAAOE,EACP,QAASE,CACX"}
@@ -0,0 +1,319 @@
1
+ import { jsx as l, jsxs as c } from "react/jsx-runtime";
2
+ import { createContext as w, useRef as A, useState as E, useEffect as n, Children as y, isValidElement as H, cloneElement as R, useContext as d } from "react";
3
+ import { mergeRefs as B } from "@chakra-ui/react";
4
+ import { defineSlotRecipe as L, createSlotRecipeContext as I } from "@chakra-ui/react/styled-system";
5
+ import { e as M, $ as T, a as W } from "./Dialog-CpUyTYgL.es.js";
6
+ import { B as b } from "./box-DuBoAZvq.es.js";
7
+ import { I as j } from "./icon-button-C_i4ydsN.es.js";
8
+ import { HelpOutline as k, ErrorOutline as N } from "@commercetools/nimbus-icons";
9
+ import { $ as V } from "./useObjectRef-CaJ5pgjX.es.js";
10
+ import { $ as _ } from "./useField-Ce9zQxmx.es.js";
11
+ const a = /* @__PURE__ */ w({
12
+ context: {
13
+ label: null,
14
+ description: null,
15
+ error: null,
16
+ info: null,
17
+ input: null
18
+ },
19
+ setContext: () => {
20
+ }
21
+ }), G = `
22
+ "label"
23
+ "input"
24
+ "description"
25
+ "error"
26
+ `, O = `
27
+ "label input"
28
+ "label description"
29
+ "label error"
30
+ `, D = /* @__PURE__ */ L({
31
+ slots: ["root", "label", "input", "description", "error", "popover"],
32
+ // Unique class name prefix for the component
33
+ className: "nimbus-ui-form-field",
34
+ base: {
35
+ root: {
36
+ "--grid-gap": "spacing.100",
37
+ display: "grid",
38
+ width: "auto"
39
+ },
40
+ label: {
41
+ gridArea: "label",
42
+ fontWeight: "500",
43
+ color: "neutral.11",
44
+ fontSize: "var(--form-field-font-size)",
45
+ lineHeight: "var(--form-field-line-height)"
46
+ },
47
+ input: {
48
+ gridArea: "input"
49
+ },
50
+ description: {
51
+ gridArea: "description",
52
+ color: "neutral.11",
53
+ fontSize: "var(--form-field-font-size)",
54
+ lineHeight: "var(--form-field-line-height)"
55
+ },
56
+ error: {
57
+ gridArea: "error",
58
+ color: "critical.11",
59
+ fontSize: "var(--form-field-font-size)",
60
+ lineHeight: "var(--form-field-line-height)",
61
+ display: "flex",
62
+ gap: "100"
63
+ },
64
+ popover: {
65
+ "--scrollbar-color": "colors.neutral.8",
66
+ "--scrollbar-bg": "colors.neutral.3",
67
+ bg: "neutral.1",
68
+ maxWidth: "xl",
69
+ borderRadius: "200",
70
+ boxShadow: "6",
71
+ border: "solid-25",
72
+ borderColor: "neutral.8",
73
+ maxHeight: "40svh",
74
+ overflow: "auto",
75
+ scrollbarWidth: "thin",
76
+ scrollbarColor: "var(--scrollbar-color) var(--scrollbar-bg)",
77
+ focusRing: "outside"
78
+ }
79
+ },
80
+ variants: {
81
+ size: {
82
+ md: {
83
+ root: {
84
+ "--form-field-font-size": "fontSizes.350",
85
+ "--form-field-line-height": "lineHeights.500"
86
+ }
87
+ },
88
+ sm: {
89
+ root: {
90
+ "--form-field-font-size": "fontSizes.300",
91
+ "--form-field-line-height": "lineHeights.450"
92
+ }
93
+ }
94
+ },
95
+ direction: {
96
+ column: {
97
+ root: {
98
+ gridTemplateAreas: G
99
+ },
100
+ input: {
101
+ mt: "var(--grid-gap)"
102
+ },
103
+ description: {
104
+ mt: "var(--grid-gap)"
105
+ },
106
+ error: {
107
+ mt: "var(--grid-gap)"
108
+ }
109
+ },
110
+ row: {
111
+ root: {
112
+ gridTemplateAreas: O,
113
+ gridTemplateColumns: "auto 1fr",
114
+ gridColumnGap: "200"
115
+ },
116
+ description: {
117
+ mt: "var(--grid-gap)"
118
+ },
119
+ error: {
120
+ mt: "var(--grid-gap)"
121
+ }
122
+ }
123
+ }
124
+ },
125
+ // Default variant values when not explicitly specified
126
+ defaultVariants: {
127
+ direction: "column",
128
+ size: "md"
129
+ }
130
+ }), { withProvider: J, withContext: p } = /* @__PURE__ */ I({
131
+ recipe: D
132
+ }), K = /* @__PURE__ */ J("div", "root"), Q = /* @__PURE__ */ p("div", "label"), U = /* @__PURE__ */ p("div", "input"), X = /* @__PURE__ */ p("div", "description"), Y = /* @__PURE__ */ p("div", "error"), Z = /* @__PURE__ */ p("div", "popover"), q = function({
133
+ ref: i,
134
+ isInvalid: r,
135
+ isRequired: t,
136
+ isDisabled: f,
137
+ isReadOnly: m,
138
+ children: h,
139
+ ...x
140
+ }) {
141
+ const F = A(null), v = V(B(F, i)), [o, g] = E({
142
+ label: null,
143
+ description: null,
144
+ error: null,
145
+ info: null,
146
+ input: null,
147
+ isInvalid: r,
148
+ isRequired: t,
149
+ isDisabled: f,
150
+ isReadOnly: m
151
+ }), u = {
152
+ description: o.description,
153
+ errorMessage: o.error
154
+ };
155
+ o.label ? u.label = o.label : (u["aria-label"] = "empty-label", u["aria-labelledby"] = "empty-label");
156
+ const { labelProps: S, fieldProps: C, descriptionProps: $, errorMessageProps: z } = _(u);
157
+ n(() => {
158
+ g((s) => ({
159
+ ...s,
160
+ isInvalid: r,
161
+ isRequired: t,
162
+ isDisabled: f,
163
+ isReadOnly: m
164
+ }));
165
+ }, [r, t, f, m]);
166
+ const P = {
167
+ ...C,
168
+ isInvalid: r,
169
+ isRequired: t,
170
+ isDisabled: f,
171
+ isReadOnly: m
172
+ };
173
+ return /* @__PURE__ */ l(a.Provider, { value: { context: o, setContext: g }, children: /* @__PURE__ */ c(K, { ref: v, ...x, children: [
174
+ o.label && /* @__PURE__ */ c(Q, { ...o.labelSlotProps, children: [
175
+ /* @__PURE__ */ c("label", { ...S, children: [
176
+ o.label,
177
+ t && /* @__PURE__ */ l("sup", { "aria-hidden": "true", children: "*" })
178
+ ] }),
179
+ o.info && /* @__PURE__ */ c(M, { children: [
180
+ /* @__PURE__ */ l(
181
+ b,
182
+ {
183
+ as: "span",
184
+ display: "inline-block",
185
+ position: "relative",
186
+ width: "1ch",
187
+ height: "1ch",
188
+ ml: "200",
189
+ children: /* @__PURE__ */ l(
190
+ b,
191
+ {
192
+ as: "span",
193
+ display: "inline-flex",
194
+ position: "absolute",
195
+ top: "50%",
196
+ right: "50%",
197
+ transform: "translate(50%, -50%)",
198
+ children: /* @__PURE__ */ l(
199
+ j,
200
+ {
201
+ "aria-label": "__MORE INFO",
202
+ size: "2xs",
203
+ tone: "info",
204
+ variant: "link",
205
+ children: /* @__PURE__ */ l(k, {})
206
+ }
207
+ )
208
+ }
209
+ )
210
+ }
211
+ ),
212
+ /* @__PURE__ */ l(T, { children: /* @__PURE__ */ l(Z, { asChild: !0, children: /* @__PURE__ */ l(W, { children: /* @__PURE__ */ l(b, { p: "300", children: o.info }) }) }) })
213
+ ] })
214
+ ] }),
215
+ o.input && /* @__PURE__ */ l(U, { ...o.inputSlotProps, children: y.map(o.input, (s) => H(s) ? R(s, P) : s) }),
216
+ o.description && /* @__PURE__ */ l(
217
+ X,
218
+ {
219
+ ...$,
220
+ ...o.descriptionSlotProps,
221
+ children: o.description
222
+ }
223
+ ),
224
+ r && o.error && /* @__PURE__ */ c(
225
+ Y,
226
+ {
227
+ ...z,
228
+ ...o.errorSlotProps,
229
+ children: [
230
+ /* @__PURE__ */ l(
231
+ b,
232
+ {
233
+ as: N,
234
+ display: "inline-flex",
235
+ boxSize: "400",
236
+ verticalAlign: "text-bottom",
237
+ mr: "100"
238
+ }
239
+ ),
240
+ o.error
241
+ ]
242
+ }
243
+ ),
244
+ h
245
+ ] }) });
246
+ }, rr = ({
247
+ children: e,
248
+ ...i
249
+ }) => {
250
+ const { setContext: r } = d(a);
251
+ return n(() => {
252
+ r((t) => ({
253
+ ...t,
254
+ label: e,
255
+ labelSlotProps: i
256
+ }));
257
+ }, [e, r]), null;
258
+ }, or = ({
259
+ children: e,
260
+ ...i
261
+ }) => {
262
+ const { setContext: r } = d(a);
263
+ return n(() => {
264
+ r((t) => ({
265
+ ...t,
266
+ input: e,
267
+ inputSlotProps: i
268
+ }));
269
+ }, [e, r]), null;
270
+ }, er = ({
271
+ children: e,
272
+ ...i
273
+ }) => {
274
+ const { setContext: r } = d(a);
275
+ return n(() => {
276
+ r((t) => ({
277
+ ...t,
278
+ description: e,
279
+ descriptionSlotProps: i
280
+ }));
281
+ }, [e, r]), null;
282
+ }, tr = ({
283
+ children: e,
284
+ ...i
285
+ }) => {
286
+ const { setContext: r } = d(a);
287
+ return n(() => {
288
+ r((t) => ({
289
+ ...t,
290
+ error: e,
291
+ errorSlotProps: i
292
+ }));
293
+ }, [e, r]), null;
294
+ }, lr = ({ children: e }) => {
295
+ const { setContext: i } = d(a);
296
+ return n(() => {
297
+ i((r) => ({
298
+ ...r,
299
+ info: e
300
+ }));
301
+ }, [e, i]), null;
302
+ }, br = {
303
+ Root: q,
304
+ Label: rr,
305
+ Input: or,
306
+ Description: er,
307
+ Error: tr,
308
+ InfoBox: lr
309
+ };
310
+ export {
311
+ br as F,
312
+ q as a,
313
+ rr as b,
314
+ or as c,
315
+ er as d,
316
+ tr as e,
317
+ lr as f
318
+ };
319
+ //# sourceMappingURL=form-field-bP4SYMaC.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field-bP4SYMaC.es.js","sources":["../../src/components/form-field/components/form-field.context.tsx","../../src/components/form-field/form-field.recipe.tsx","../../src/components/form-field/form-field.slots.tsx","../../src/components/form-field/components/form-field.root.tsx","../../src/components/form-field/components/form-field.label.tsx","../../src/components/form-field/components/form-field.input.tsx","../../src/components/form-field/components/form-field.description.tsx","../../src/components/form-field/components/form-field.error.tsx","../../src/components/form-field/components/form-field.info-box.tsx","../../src/components/form-field/form-field.tsx"],"sourcesContent":["import { createContext, type ReactNode } from \"react\";\nimport type {\n FormFieldDescriptionSlotProps,\n FormFieldErrorSlotProps,\n FormFieldInputSlotProps,\n FormFieldLabelSlotProps,\n} from \"../form-field.slots\";\n\nexport type FormFieldContextPayloadType = {\n label: ReactNode;\n labelSlotProps?: FormFieldLabelSlotProps;\n input: ReactNode;\n inputSlotProps?: FormFieldInputSlotProps;\n description: ReactNode;\n descriptionSlotProps?: FormFieldDescriptionSlotProps;\n error: ReactNode;\n errorSlotProps?: FormFieldErrorSlotProps;\n info: ReactNode;\n isInvalid?: boolean;\n isRequired?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n};\n\nexport type FormFieldContextType = {\n context: FormFieldContextPayloadType;\n setContext: React.Dispatch<React.SetStateAction<FormFieldContextPayloadType>>;\n};\n\nexport const FormFieldContext = createContext<FormFieldContextType>({\n context: {\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n },\n setContext: () => {},\n});\n","import { defineSlotRecipe } from \"@chakra-ui/react/styled-system\";\n\nconst columnLayout = `\n\"label\"\n\"input\"\n\"description\"\n\"error\"\n`;\nconst rowLayout = `\n\"label input\"\n\"label description\"\n\"label error\"\n`;\n\n/**\n * Recipe configuration for the FormField component.\n * Defines the styling variants and base styles using Chakra UI's recipe system.\n */\nexport const formFieldRecipe = defineSlotRecipe({\n slots: [\"root\", \"label\", \"input\", \"description\", \"error\", \"popover\"],\n // Unique class name prefix for the component\n className: \"nimbus-ui-form-field\",\n\n base: {\n root: {\n \"--grid-gap\": \"spacing.100\",\n\n display: \"grid\",\n width: \"auto\",\n },\n label: {\n gridArea: \"label\",\n fontWeight: \"500\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n input: {\n gridArea: \"input\",\n },\n description: {\n gridArea: \"description\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n error: {\n gridArea: \"error\",\n color: \"critical.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n display: \"flex\",\n gap: \"100\",\n },\n popover: {\n \"--scrollbar-color\": \"colors.neutral.8\",\n \"--scrollbar-bg\": \"colors.neutral.3\",\n bg: \"neutral.1\",\n maxWidth: \"xl\",\n borderRadius: \"200\",\n boxShadow: \"6\",\n border: \"solid-25\",\n borderColor: \"neutral.8\",\n maxHeight: \"40svh\",\n overflow: \"auto\",\n scrollbarWidth: \"thin\",\n scrollbarColor: \"var(--scrollbar-color) var(--scrollbar-bg)\",\n focusRing: \"outside\",\n },\n },\n\n variants: {\n size: {\n md: {\n root: {\n \"--form-field-font-size\": \"fontSizes.350\",\n \"--form-field-line-height\": \"lineHeights.500\",\n },\n },\n sm: {\n root: {\n \"--form-field-font-size\": \"fontSizes.300\",\n \"--form-field-line-height\": \"lineHeights.450\",\n },\n },\n },\n direction: {\n column: {\n root: {\n gridTemplateAreas: columnLayout,\n },\n input: {\n mt: \"var(--grid-gap)\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n row: {\n root: {\n gridTemplateAreas: rowLayout,\n gridTemplateColumns: \"auto 1fr\",\n gridColumnGap: \"200\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n },\n },\n\n // Default variant values when not explicitly specified\n defaultVariants: {\n direction: \"column\",\n size: \"md\",\n },\n});\n","/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react/styled-system\";\n\nimport { formFieldRecipe } from \"./form-field.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: formFieldRecipe,\n});\n\n// Root slot\nexport interface FormFieldRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof formFieldRecipe> & UnstyledProp\n > {}\n\nexport const FormFieldRootSlot = withProvider<\n HTMLDivElement,\n FormFieldRootSlotProps\n>(\"div\", \"root\");\n\n// Label Slot\nexport interface FormFieldLabelSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldLabelSlot = withContext<\n HTMLDivElement,\n FormFieldLabelSlotProps\n>(\"div\", \"label\");\n\n// Input Slot\nexport interface FormFieldInputSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldInputSlot = withContext<\n HTMLDivElement,\n FormFieldInputSlotProps\n>(\"div\", \"input\");\n\n// Description Slot\nexport interface FormFieldDescriptionSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldDescriptionSlot = withContext<\n HTMLDivElement,\n FormFieldDescriptionSlotProps\n>(\"div\", \"description\");\n\n// Error Slot\nexport interface FormFieldErrorSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldErrorSlot = withContext<\n HTMLDivElement,\n FormFieldErrorSlotProps\n>(\"div\", \"error\");\n\n// Error Slot\nexport interface FormFieldPopoverSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldPopoverSlot = withContext<\n HTMLDivElement,\n FormFieldPopoverSlotProps\n>(\"div\", \"popover\");\n","import {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useState,\n useRef,\n} from \"react\";\nimport type { FormFieldProps } from \"../form-field.types\";\nimport { useField, useObjectRef } from \"react-aria\";\nimport { mergeRefs } from \"@chakra-ui/react\";\nimport {\n FormFieldContext,\n type FormFieldContextPayloadType,\n} from \"./form-field.context\";\nimport {\n FormFieldDescriptionSlot,\n FormFieldErrorSlot,\n FormFieldInputSlot,\n FormFieldLabelSlot,\n FormFieldPopoverSlot,\n FormFieldRootSlot,\n} from \"../form-field.slots\";\nimport { Dialog, DialogTrigger, Popover } from \"react-aria-components\";\nimport { Box, IconButton } from \"@/components\";\nimport { ErrorOutline, HelpOutline } from \"@commercetools/nimbus-icons\";\n\n/**\n * # FormField\n *\n * displays miscellaneous inputs in a FormField context\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/formfield}\n */\nexport const FormFieldRoot = function FormFieldRoot({\n ref: forwardedRef,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n children,\n ...props\n}: FormFieldProps) {\n const localRef = useRef<HTMLDivElement>(null);\n const ref = useObjectRef(mergeRefs(localRef, forwardedRef));\n const [context, setContext] = useState<FormFieldContextPayloadType>({\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n });\n\n const useFieldArgs: Parameters<typeof useField>[0] = {\n description: context.description,\n errorMessage: context.error,\n };\n\n if (context.label) {\n useFieldArgs.label = context.label;\n } else {\n // Context will always start out null, so we need to stub out some aria attributes\n // FIXME: This is a hack to get the form field to work, but it's not the best solution\n // FIXME: We should find a better way to handle this by redesigning the FormField component's structure\n useFieldArgs[\"aria-label\"] = \"empty-label\";\n useFieldArgs[\"aria-labelledby\"] = \"empty-label\";\n }\n\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } =\n useField(useFieldArgs);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n }));\n }, [isInvalid, isRequired, isDisabled, isReadOnly]);\n\n const inputProps = {\n ...fieldProps,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n };\n\n return (\n <FormFieldContext.Provider value={{ context, setContext }}>\n <FormFieldRootSlot ref={ref} {...props}>\n {context.label && (\n <FormFieldLabelSlot {...context.labelSlotProps}>\n <label {...labelProps}>\n {context.label}\n {isRequired && <sup aria-hidden=\"true\">*</sup>}\n </label>\n {context.info && (\n <DialogTrigger>\n <Box\n as=\"span\"\n display=\"inline-block\"\n position=\"relative\"\n width=\"1ch\"\n height=\"1ch\"\n ml=\"200\"\n >\n <Box\n as=\"span\"\n display=\"inline-flex\"\n position=\"absolute\"\n top=\"50%\"\n right=\"50%\"\n transform=\"translate(50%, -50%)\"\n >\n <IconButton\n aria-label=\"__MORE INFO\"\n size=\"2xs\"\n tone=\"info\"\n variant=\"link\"\n >\n <HelpOutline />\n </IconButton>\n </Box>\n </Box>\n <Popover>\n <FormFieldPopoverSlot asChild>\n <Dialog>\n <Box p=\"300\">{context.info}</Box>\n </Dialog>\n </FormFieldPopoverSlot>\n </Popover>\n </DialogTrigger>\n )}\n </FormFieldLabelSlot>\n )}\n {context.input && (\n <FormFieldInputSlot {...context.inputSlotProps}>\n {Children.map(context.input, (child) => {\n // Important: Check if the child is a valid React element before cloning.\n if (isValidElement(child)) {\n return cloneElement(child, inputProps);\n }\n // If it's not a valid element (e.g., text node, null, undefined), return it as is.\n return child;\n })}\n </FormFieldInputSlot>\n )}\n {context.description && (\n <FormFieldDescriptionSlot\n {...descriptionProps}\n {...context.descriptionSlotProps}\n >\n {context.description}\n </FormFieldDescriptionSlot>\n )}\n {isInvalid && context.error && (\n <FormFieldErrorSlot\n {...errorMessageProps}\n {...context.errorSlotProps}\n >\n <Box\n as={ErrorOutline}\n display=\"inline-flex\"\n boxSize=\"400\"\n verticalAlign=\"text-bottom\"\n mr=\"100\"\n />\n {context.error}\n </FormFieldErrorSlot>\n )}\n {children}\n </FormFieldRootSlot>\n </FormFieldContext.Provider>\n );\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldLabelSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldLabel = ({\n children,\n ...labelSlotProps\n}: FormFieldLabelSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n label: children,\n labelSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldInputSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldInput = ({\n children,\n ...inputSlotProps\n}: FormFieldInputSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n input: children,\n inputSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldDescriptionSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldDescription = ({\n children,\n ...descriptionSlotProps\n}: FormFieldDescriptionSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n description: children,\n descriptionSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldErrorSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldError = ({\n children,\n ...errorSlotProps\n}: FormFieldErrorSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n error: children,\n errorSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect, type ReactNode } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\n\ntype FormFieldInfoBoxProps = {\n /**\n * The content to display in the InfoBox\n */\n children: ReactNode;\n};\n\nexport const FormFieldInfoBox = ({ children }: FormFieldInfoBoxProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n info: children,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { FormFieldRoot } from \"./components/form-field.root\";\nimport { FormFieldLabel } from \"./components/form-field.label\";\nimport { FormFieldInput } from \"./components/form-field.input\";\nimport { FormFieldDescription } from \"./components/form-field.description\";\nimport { FormFieldError } from \"./components/form-field.error\";\nimport { FormFieldInfoBox } from \"./components/form-field.info-box\";\n\nexport const FormField = {\n Root: FormFieldRoot,\n Label: FormFieldLabel,\n Input: FormFieldInput,\n Description: FormFieldDescription,\n Error: FormFieldError,\n InfoBox: FormFieldInfoBox,\n};\n\nexport {\n FormFieldRoot as _FormFieldRoot,\n FormFieldLabel as _FormFieldLabel,\n FormFieldInput as _FormFieldInput,\n FormFieldDescription as _FormFieldDescription,\n FormFieldError as _FormFieldError,\n FormFieldInfoBox as _FormFieldInfoBox,\n};\n"],"names":["FormFieldContext","createContext","columnLayout","rowLayout","formFieldRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","FormFieldRootSlot","FormFieldLabelSlot","FormFieldInputSlot","FormFieldDescriptionSlot","FormFieldErrorSlot","FormFieldPopoverSlot","FormFieldRoot","forwardedRef","isInvalid","isRequired","isDisabled","isReadOnly","children","props","localRef","useRef","ref","useObjectRef","mergeRefs","context","setContext","useState","useFieldArgs","labelProps","fieldProps","descriptionProps","errorMessageProps","useField","useEffect","prevContext","inputProps","jsx","jsxs","DialogTrigger","Box","IconButton","HelpOutline","Popover","Dialog","Children","child","isValidElement","cloneElement","ErrorOutline","FormFieldLabel","labelSlotProps","useContext","FormFieldInput","inputSlotProps","FormFieldDescription","descriptionSlotProps","FormFieldError","errorSlotProps","FormFieldInfoBox","FormField"],"mappings":";;;;;;;;;;AA6BO,MAAMA,IAAmB,gBAAAC,EAAoC;AAAA,EAClE,SAAS;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA,EAET,YAAY,MAAM;AAAA,EAAC;AACrB,CAAC,GCpCKC,IAAe;AAAA;AAAA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AAC,GAElB;AACT,GCfa+B,KAAiB,CAAC;AAAA,EAC7B,UAAAvC;AAAA,EACA,GAAGwC;AACL,MAA+B;AAC7B,QAAM,EAAE,YAAAhC,EAAA,IAAe0B,EAAWvD,CAAgB;AAElD,SAAAqC,EAAU,MAAM;AACd,IAAAR,EAAW,CAACS,OAAiB;AAAA,MAC3B,GAAGA;AAAA,MACH,OAAOjB;AAAA,MACP,gBAAAwC;AAAA,IAAA,EACA;AAAA,EACJ,GAAG,CAACxC,GAAUQ,CAAU,CAAC,GAElB;AACT,GCTaiC,KAAmB,CAAC,EAAE,UAAAzC,QAAsC;AACvE,QAAM,EAAE,YAAAQ,EAAA,IAAe0B,EAAWvD,CAAgB;AAElD,SAAAqC,EAAU,MAAM;AACd,IAAAR,EAAW,CAACS,OAAiB;AAAA,MAC3B,GAAGA;AAAA,MACH,MAAMjB;AAAA,IAAA,EACN;AAAA,EACJ,GAAG,CAACA,GAAUQ,CAAU,CAAC,GAElB;AACT,GCdakC,KAAY;AAAA,EACvB,MAAMhD;AAAA,EACN,OAAOsC;AAAA,EACP,OAAOG;AAAA,EACP,aAAaE;AAAA,EACb,OAAOE;AAAA,EACP,SAASE;AACX;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const s=require("react"),f=require("@chakra-ui/react"),l=require("./useObjectRef-dXOJdONs.cjs.js"),a=require("./mergeProps-BA5Cwf5w.cjs.js"),b=require("./useFocusable-DCgmQxS1.cjs.js"),c=function({ref:o,children:e,...r}){const n=s.useRef(null),t=l.$df56164dff5785e2$export$4338b53315abf666(f.mergeRefs(n,o)),{focusableProps:u}=b.$f645667febf57a63$export$4c014de7c8940b4c(r,t);return s.isValidElement(e)?s.cloneElement(e,a.$3ef42575df84b30b$export$9d1611c77c2fe928(u,e.props,{ref:t})):null};c.displayName="MakeElementFocusable";exports.MakeElementFocusable=c;
2
+ //# sourceMappingURL=make-element-focusable-BDByS8Na.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-element-focusable-BDByS8Na.cjs.js","sources":["../../src/components/tooltip/make-element-focusable.tsx"],"sourcesContent":["import {\n cloneElement,\n useRef,\n type PropsWithChildren,\n isValidElement,\n} from \"react\";\nimport {\n mergeProps,\n useObjectRef,\n useFocusable,\n type FocusableOptions,\n} from \"react-aria\";\n\nimport { mergeRefs } from \"@chakra-ui/react\";\n\nexport interface MakeElementFocusableProps\n extends PropsWithChildren<FocusableOptions<HTMLElement>> {\n /**\n * React ref to be forwarded to the underlying element\n */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * MakeElementFocusable\n * ============================================================\n * A helper component that adds props from `react-aria`s `useFocusable` hook\n * to its child so that it can be used as a trigger element for a `Tooltip`\n *\n * Caveats:\n * - Using non-interactive elements as tooltip triggers is against ARIA best-practices,\n * it is your responsibility to ensure that the underlying trigger element handles\n * focus and hover interactions correctly for keyboard-only users\n *\n * Features:\n * - allows forwarding refs to the underlying DOM element\n * - accepts all native html 'HTMLElement' attributes (including aria- & data-attributes)\n *\n * Further Context:\n * - [React Aria Components Tooltip Documentation](https://react-spectrum.adobe.com/react-aria/Tooltip.html)\n * - [React Aria Components Issue re:Tooltip with custom trigger](https://github.com/adobe/react-spectrum/issues/5733#issuecomment-1918691983)\n * - [ARIA Tooltip Pattern](https://www.w3.org/TR/wai-aria-1.2/#tooltip)\n */\nexport const MakeElementFocusable = function MakeElementFocusable({\n ref: forwardedRef,\n children,\n ...props\n}: MakeElementFocusableProps) {\n const localRef = useRef<HTMLElement>(null);\n const ref = useObjectRef(mergeRefs(localRef, forwardedRef));\n const { focusableProps } = useFocusable(props, ref);\n\n if (isValidElement(children)) {\n return cloneElement(\n children,\n mergeProps(\n focusableProps,\n children.props as PropsWithChildren<FocusableOptions<HTMLElement>>,\n { ref: ref }\n )\n );\n }\n\n return null;\n};\nMakeElementFocusable.displayName = \"MakeElementFocusable\";\n"],"names":["MakeElementFocusable","forwardedRef","children","props","localRef","useRef","ref","useObjectRef","mergeRefs","focusableProps","useFocusable","isValidElement","cloneElement","mergeProps"],"mappings":"sMA2CaA,EAAuB,SAA8B,CAChE,IAAKC,EACL,SAAAC,EACA,GAAGC,CACL,EAA8B,CAC5B,MAAMC,EAAWC,EAAAA,OAAoB,IAAI,EACnCC,EAAMC,EAAAA,0CAAaC,EAAAA,UAAUJ,EAAUH,CAAY,CAAC,EACpD,CAAE,eAAAQ,CAAA,EAAmBC,4CAAaP,EAAOG,CAAG,EAElD,OAAIK,EAAAA,eAAeT,CAAQ,EAClBU,EAAAA,aACLV,EACAW,EAAAA,0CACEJ,EACAP,EAAS,MACT,CAAE,IAAAI,CAAA,CAAS,CACb,EAIG,IACT,EACAN,EAAqB,YAAc"}
@@ -0,0 +1,25 @@
1
+ import { useRef as a, isValidElement as m, cloneElement as l } from "react";
2
+ import { mergeRefs as c } from "@chakra-ui/react";
3
+ import { $ as n } from "./useObjectRef-CaJ5pgjX.es.js";
4
+ import { $ as p } from "./mergeProps-B_9syxhT.es.js";
5
+ import { $ } from "./useFocusable-CrsD8ZcF.es.js";
6
+ const b = function({
7
+ ref: f,
8
+ children: e,
9
+ ...r
10
+ }) {
11
+ const t = a(null), o = n(c(t, f)), { focusableProps: s } = $(r, o);
12
+ return m(e) ? l(
13
+ e,
14
+ p(
15
+ s,
16
+ e.props,
17
+ { ref: o }
18
+ )
19
+ ) : null;
20
+ };
21
+ b.displayName = "MakeElementFocusable";
22
+ export {
23
+ b as M
24
+ };
25
+ //# sourceMappingURL=make-element-focusable-BamCHW5U.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-element-focusable-BamCHW5U.es.js","sources":["../../src/components/tooltip/make-element-focusable.tsx"],"sourcesContent":["import {\n cloneElement,\n useRef,\n type PropsWithChildren,\n isValidElement,\n} from \"react\";\nimport {\n mergeProps,\n useObjectRef,\n useFocusable,\n type FocusableOptions,\n} from \"react-aria\";\n\nimport { mergeRefs } from \"@chakra-ui/react\";\n\nexport interface MakeElementFocusableProps\n extends PropsWithChildren<FocusableOptions<HTMLElement>> {\n /**\n * React ref to be forwarded to the underlying element\n */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * MakeElementFocusable\n * ============================================================\n * A helper component that adds props from `react-aria`s `useFocusable` hook\n * to its child so that it can be used as a trigger element for a `Tooltip`\n *\n * Caveats:\n * - Using non-interactive elements as tooltip triggers is against ARIA best-practices,\n * it is your responsibility to ensure that the underlying trigger element handles\n * focus and hover interactions correctly for keyboard-only users\n *\n * Features:\n * - allows forwarding refs to the underlying DOM element\n * - accepts all native html 'HTMLElement' attributes (including aria- & data-attributes)\n *\n * Further Context:\n * - [React Aria Components Tooltip Documentation](https://react-spectrum.adobe.com/react-aria/Tooltip.html)\n * - [React Aria Components Issue re:Tooltip with custom trigger](https://github.com/adobe/react-spectrum/issues/5733#issuecomment-1918691983)\n * - [ARIA Tooltip Pattern](https://www.w3.org/TR/wai-aria-1.2/#tooltip)\n */\nexport const MakeElementFocusable = function MakeElementFocusable({\n ref: forwardedRef,\n children,\n ...props\n}: MakeElementFocusableProps) {\n const localRef = useRef<HTMLElement>(null);\n const ref = useObjectRef(mergeRefs(localRef, forwardedRef));\n const { focusableProps } = useFocusable(props, ref);\n\n if (isValidElement(children)) {\n return cloneElement(\n children,\n mergeProps(\n focusableProps,\n children.props as PropsWithChildren<FocusableOptions<HTMLElement>>,\n { ref: ref }\n )\n );\n }\n\n return null;\n};\nMakeElementFocusable.displayName = \"MakeElementFocusable\";\n"],"names":["MakeElementFocusable","forwardedRef","children","props","localRef","useRef","ref","useObjectRef","mergeRefs","focusableProps","useFocusable","isValidElement","cloneElement","mergeProps"],"mappings":";;;;;AA2CO,MAAMA,IAAuB,SAA8B;AAAA,EAChE,KAAKC;AAAA,EACL,UAAAC;AAAA,EACA,GAAGC;AACL,GAA8B;AAC5B,QAAMC,IAAWC,EAAoB,IAAI,GACnCC,IAAMC,EAAaC,EAAUJ,GAAUH,CAAY,CAAC,GACpD,EAAE,gBAAAQ,EAAA,IAAmBC,EAAaP,GAAOG,CAAG;AAElD,SAAIK,EAAeT,CAAQ,IAClBU;AAAA,IACLV;AAAA,IACAW;AAAAA,MACEJ;AAAA,MACAP,EAAS;AAAA,MACT,EAAE,KAAAI,EAAA;AAAA,IAAS;AAAA,EACb,IAIG;AACT;AACAN,EAAqB,cAAc;"}
@@ -4,9 +4,9 @@ import { createSlotRecipeContext as di, useSlotRecipe as mi } from "@chakra-ui/r
4
4
  import { defineMessages as yi, useIntl as hi, FormattedMessage as Mi } from "react-intl";
5
5
  import { B as Si } from "./box-DuBoAZvq.es.js";
6
6
  import { b as w } from "./tooltip-B1YdruCE.es.js";
7
- import { M as bi } from "./make-element-focusable-C4ZHUSEU.es.js";
7
+ import { M as bi } from "./make-element-focusable-BamCHW5U.es.js";
8
8
  import { N as Ci } from "./number-input-COfobs8H.es.js";
9
- import { S as B } from "./select-DpHmAHrs.es.js";
9
+ import { S as B } from "./select-CwavXa9Y.es.js";
10
10
  import { HighPrecision as Ii } from "@commercetools/nimbus-icons";
11
11
  import { e as Pi } from "./extractStyleProps-DkXeCUuq.es.js";
12
12
  import { G as Ri } from "./group-CqfSQXe7.es.js";
@@ -614,4 +614,4 @@ u.isHighPrecision = Y;
614
614
  export {
615
615
  u as M
616
616
  };
617
- //# sourceMappingURL=money-input-B2X3PtKX.es.js.map
617
+ //# sourceMappingURL=money-input-BN_yFB_R.es.js.map