@jarllyng/nostromo 3.9.0 → 3.10.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.
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import {a}from'./chunk-AC2JBXHQ.js';import*as e from'react';import {cva}from'class-variance-authority';var V=cva("grid gap-2",{variants:{orientation:{vertical:"grid-cols-1",horizontal:"grid-cols-2 sm:grid-cols-3 md:grid-cols-4"}},defaultVariants:{orientation:"vertical"}}),w=cva("peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200",{variants:{variant:{default:"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary",error:"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive",success:"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500"},size:{default:"h-4 w-4",sm:"h-3 w-3",lg:"h-5 w-5"}},defaultVariants:{variant:"default",size:"default"}}),E=e.forwardRef(({className:u,error:t,helperText:r,label:s,required:d,orientation:p,name:m,defaultValue:o,value:n,onValueChange:l,disabled:b,children:c,...f},v)=>{let g=e.useId(),h=s?`${g}-label`:void 0,R=r?`${g}-helper`:void 0,y=t?`${g}-error`:void 0,x=a=>{l&&l(a.target.value);};return e.createElement("div",{className:"space-y-2"},s&&e.createElement("label",{id:h,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},s,d&&e.createElement("span",{className:"text-error-500 ml-1"},"*")),e.createElement("div",{ref:v,className:a(V({orientation:p,className:u})),role:"radiogroup","aria-labelledby":h,"aria-describedby":a(R,y)||void 0,"aria-invalid":t,...f},e.Children.map(c,a=>{if(e.isValidElement(a)){let k=n!==void 0,P={name:m,disabled:!!(b??a.props.disabled),variant:t?"error":a.props.variant,...k?{checked:n===a.props.value}:{defaultChecked:o===a.props.value},onChange:x};return e.cloneElement(a,P)}return a})),r&&e.createElement("p",{id:R,className:a("text-sm text-muted-foreground",t&&"text-destructive")},r))});E.displayName="RadioGroup";var N=e.forwardRef(({className:u,variant:t,size:r,value:s,label:d,disabled:p,id:m,onChange:o,...n},l)=>{let b=e.useId(),c=m||b,f=v=>{o&&o(v);};return e.createElement("div",{className:"flex items-center space-x-2"},e.createElement("input",{type:"radio",className:a(w({variant:t,size:r,className:u})),ref:l,id:c,value:s,disabled:p,onChange:f,...n}),d&&e.createElement("label",{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},d))});N.displayName="RadioItem";export{V as a,w as b,E as c,N as d};//# sourceMappingURL=chunk-WW2DDHCI.js.map
3
- //# sourceMappingURL=chunk-WW2DDHCI.js.map
2
+ import {a}from'./chunk-AC2JBXHQ.js';import*as e from'react';import {cva}from'class-variance-authority';var V=cva("grid gap-2",{variants:{orientation:{vertical:"grid-cols-1",horizontal:"grid-cols-2 sm:grid-cols-3 md:grid-cols-4"}},defaultVariants:{orientation:"vertical"}}),w=cva("peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200",{variants:{variant:{default:"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary",error:"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive",success:"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500"},size:{default:"h-4 w-4",sm:"h-3 w-3",lg:"h-5 w-5"}},defaultVariants:{variant:"default",size:"default"}}),E=e.forwardRef(({className:u,error:t,helperText:r,label:s,required:d,orientation:p,name:m,defaultValue:o,value:n,onValueChange:l,disabled:b,children:c,...f},v)=>{let g=e.useId(),R=s?`${g}-label`:void 0,h=r?`${g}-helper`:void 0,y=t?`${g}-error`:void 0,x=a=>{l&&l(a.target.value);};return e.createElement("div",{className:"space-y-2"},s&&e.createElement("label",{id:R,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},s,d&&e.createElement("span",{className:"text-error-500 ml-1"},"*")),e.createElement("div",{ref:v,className:a(V({orientation:p,className:u})),role:"radiogroup","aria-labelledby":R,"aria-describedby":a(h,y)||void 0,"aria-invalid":t,...f},e.Children.map(c,a=>{if(e.isValidElement(a)){let k=n!==void 0,P={name:m,disabled:!!(b??a.props.disabled),variant:t?"error":a.props.variant,...k?{checked:n===a.props.value}:{defaultChecked:o===a.props.value},onChange:x};return e.cloneElement(a,P)}return a})),r&&e.createElement("p",{id:h,className:a("text-sm text-muted-foreground",t&&"text-destructive")},r))});E.displayName="RadioGroup";var N=e.forwardRef(({className:u,variant:t,size:r,value:s,label:d,disabled:p,id:m,onChange:o,...n},l)=>{let b=e.useId(),c=m||b,f=v=>{o&&o(v);};return e.createElement("div",{className:"flex items-center space-x-2"},e.createElement("input",{type:"radio",className:a(w({variant:t,size:r,className:u})),ref:l,id:c,value:s,disabled:p,onChange:f,...n}),d&&e.createElement("label",{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},d))});N.displayName="RadioItem";export{V as a,w as b,E as c,N as d};//# sourceMappingURL=chunk-KR6IVHNR.js.map
3
+ //# sourceMappingURL=chunk-KR6IVHNR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/core/radio-group.tsx"],"names":["radioGroupVariants","cva","radioItemVariants","RadioGroup","className","error","helperText","label","required","orientation","name","defaultValue","value","onValueChange","disabled","children","props","ref","radioGroupId","labelId","helperTextId","errorId","handleChange","event","cn","child","isControlled","childProps","RadioItem","variant","rad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,CAAC,KACC,EAAA,CAAIc,CAAAA,CACJ,UAAWI,CAAAA,CACT,+BAAA,CACAnB,GAAS,kBACX,CAAA,CAAA,CAECC,CACH,CAEJ,CAEJ,CACF,EACAH,EAAW,WAAA,CAAc,YAAA,KAEnByB,CAAAA,CAAkB,CAAA,CAAA,UAAA,CACtB,CACE,CACE,UAAAxB,CAAAA,CACA,OAAA,CAAAyB,EACA,IAAA,CAAMC,CAAAA,CACN,MAAAlB,CAAAA,CACA,KAAA,CAAAL,CAAAA,CACA,QAAA,CAAAO,EACA,EAAA,CAAAiB,CAAAA,CACA,SAAAC,CAAAA,CACA,GAAGhB,CACL,CAAA,CACAC,CAAAA,GACG,CACH,IAAMgB,EAAoB,CAAA,CAAA,KAAA,EAAM,CAC1BC,EAAUH,CAAAA,EAAME,CAAAA,CAEhBX,EAAgBC,CAAAA,EAA+C,CAC/DS,CAAAA,EACFA,CAAAA,CAAST,CAAK,EAElB,CAAA,CAEA,OACE,CAAA,CAAA,aAAA,CAAC,KAAA,CAAA,CAAI,UAAU,6BAAA,CAAA,CACb,CAAA,CAAA,aAAA,CAAC,OAAA,CAAA,CACC,IAAA,CAAK,QACL,SAAA,CAAWC,CAAAA,CACTtB,EAAkB,CAAE,OAAA,CAAA2B,EAAS,IAAA,CAAMC,CAAAA,CAAW,SAAA,CAAA1B,CAAU,CAAC,CAC3D,CAAA,CACA,IAAKa,CAAAA,CACL,EAAA,CAAIiB,EACJ,KAAA,CAAOtB,CAAAA,CACP,QAAA,CAAUE,CAAAA,CACV,SAAUQ,CAAAA,CACT,GAAGN,EACN,CAAA,CACCT,CAAAA,EACC,gBAAC,OAAA,CAAA,CACC,OAAA,CAAS2B,CAAAA,CACT,SAAA,CAAU,8FAET3B,CACH,CAEJ,CAEJ,CACF,EACAqB,EAAU,WAAA,CAAc,WAAA","file":"chunk-WW2DDHCI.js","sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst radioGroupVariants = cva(\"grid gap-2\", {\n variants: {\n orientation: {\n vertical: \"grid-cols-1\",\n horizontal: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nconst radioItemVariants = cva(\n \"peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200\",\n {\n variants: {\n variant: {\n default:\n \"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n error:\n \"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive\",\n success:\n \"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500\",\n },\n size: {\n default: \"h-4 w-4\",\n sm: \"h-3 w-3\",\n lg: \"h-5 w-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface RadioGroupProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof radioGroupVariants> {\n /**\n * Whether the radio group is in an error state\n * @default false\n */\n error?: boolean;\n /**\n * Helper text to display below the radio group\n */\n helperText?: string;\n /**\n * Label text for the radio group\n */\n label?: string;\n /**\n * Whether the radio group is required\n * @default false\n */\n required?: boolean;\n /**\n * The name attribute for all radio buttons in the group\n */\n name?: string;\n /**\n * The default value of the radio group\n */\n defaultValue?: string;\n /**\n * The controlled value of the radio group\n */\n value?: string;\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Whether the radio group is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nexport interface RadioItemProps\n extends\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\">,\n VariantProps<typeof radioItemVariants> {\n /**\n * The value of the radio item\n */\n value: string;\n /**\n * The label for the radio item\n */\n label?: string;\n /**\n * Whether the radio item is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nconst RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n className,\n error,\n helperText,\n label,\n required,\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const radioGroupId = React.useId();\n const labelId = label ? `${radioGroupId}-label` : undefined;\n const helperTextId = helperText ? `${radioGroupId}-helper` : undefined;\n const errorId = error ? `${radioGroupId}-error` : undefined;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onValueChange) {\n onValueChange(event.target.value);\n }\n };\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <label\n id={labelId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n {required && <span className=\"text-error-500 ml-1\">*</span>}\n </label>\n )}\n <div\n ref={ref}\n className={cn(radioGroupVariants({ orientation, className }))}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n aria-describedby={cn(helperTextId, errorId) || undefined}\n aria-invalid={error}\n {...props}\n >\n {React.Children.map(children, (child) => {\n if (React.isValidElement<RadioItemProps>(child)) {\n // Use controlled mode if value is provided, otherwise use uncontrolled\n const isControlled = value !== undefined;\n\n const childProps: Partial<RadioItemProps> = {\n name,\n disabled: Boolean(disabled ?? child.props.disabled),\n variant: error ? \"error\" : child.props.variant,\n ...(isControlled\n ? { checked: value === child.props.value }\n : { defaultChecked: defaultValue === child.props.value }),\n onChange: handleChange,\n };\n\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n {helperText && (\n <p\n id={helperTextId}\n className={cn(\n \"text-sm text-muted-foreground\",\n error && \"text-destructive\",\n )}\n >\n {helperText}\n </p>\n )}\n </div>\n );\n },\n);\nRadioGroup.displayName = \"RadioGroup\";\n\nconst RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(\n (\n {\n className,\n variant,\n size: radioSize,\n value,\n label,\n disabled,\n id,\n onChange,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const radioId = id || generatedId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"radio\"\n className={cn(\n radioItemVariants({ variant, size: radioSize, className }),\n )}\n ref={ref}\n id={radioId}\n value={value}\n disabled={disabled}\n onChange={handleChange}\n {...props}\n />\n {label && (\n <label\n htmlFor={radioId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n </div>\n );\n },\n);\nRadioItem.displayName = \"RadioItem\";\n\nexport { RadioGroup, RadioItem, radioGroupVariants, radioItemVariants };\n"]}
1
+ {"version":3,"sources":["../src/components/core/radio-group.tsx"],"names":["radioGroupVariants","cva","radioItemVariants","RadioGroup","className","error","helperText","label","required","orientation","name","defaultValue","value","onValueChange","disabled","children","props","ref","radioGroupId","labelId","helperTextId","errorId","handleChange","event","cn","child","isControlled","childProps","RadioItem","variant","radioSize","id","onChange","generatedId","radioId"],"mappings":"uGAIA,IAAMA,CAAAA,CAAqBC,GAAAA,CAAI,YAAA,CAAc,CAC3C,QAAA,CAAU,CACR,YAAa,CACX,QAAA,CAAU,cACV,UAAA,CAAY,2CACd,CACF,CAAA,CACA,gBAAiB,CACf,WAAA,CAAa,UACf,CACF,CAAC,EAEKC,CAAAA,CAAoBD,GAAAA,CACxB,oWAAA,CACA,CACE,SAAU,CACR,OAAA,CAAS,CACP,OAAA,CACE,uGAAA,CACF,MACE,+HAAA,CACF,OAAA,CACE,+HACJ,CAAA,CACA,KAAM,CACJ,OAAA,CAAS,UACT,EAAA,CAAI,SAAA,CACJ,GAAI,SACN,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,SAAA,CACT,KAAM,SACR,CACF,CACF,C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,CAEhBX,EAAgBC,CAAAA,EAA+C,CAC/DS,CAAAA,EACFA,CAAAA,CAAST,CAAK,EAElB,CAAA,CAEA,OACE,CAAA,CAAA,aAAA,CAAC,KAAA,CAAA,CAAI,UAAU,6BAAA,CAAA,CACb,CAAA,CAAA,aAAA,CAAC,OAAA,CAAA,CACC,IAAA,CAAK,QACL,SAAA,CAAWC,CAAAA,CACTtB,EAAkB,CAAE,OAAA,CAAA2B,EAAS,IAAA,CAAMC,CAAAA,CAAW,SAAA,CAAA1B,CAAU,CAAC,CAC3D,CAAA,CACA,IAAKa,CAAAA,CACL,EAAA,CAAIiB,EACJ,KAAA,CAAOtB,CAAAA,CACP,QAAA,CAAUE,CAAAA,CACV,SAAUQ,CAAAA,CACT,GAAGN,EACN,CAAA,CACCT,CAAAA,EACC,gBAAC,OAAA,CAAA,CACC,OAAA,CAAS2B,CAAAA,CACT,SAAA,CAAU,8FAET3B,CACH,CAEJ,CAEJ,CACF,EACAqB,EAAU,WAAA,CAAc,WAAA","file":"chunk-KR6IVHNR.js","sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst radioGroupVariants = cva(\"grid gap-2\", {\n variants: {\n orientation: {\n vertical: \"grid-cols-1\",\n horizontal: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nconst radioItemVariants = cva(\n \"peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200\",\n {\n variants: {\n variant: {\n default:\n \"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n error:\n \"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive\",\n success:\n \"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500\",\n },\n size: {\n default: \"h-4 w-4\",\n sm: \"h-3 w-3\",\n lg: \"h-5 w-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface RadioGroupProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof radioGroupVariants> {\n /**\n * Whether the radio group is in an error state\n * @default false\n */\n error?: boolean;\n /**\n * Helper text to display below the radio group\n */\n helperText?: string;\n /**\n * Label text for the radio group\n */\n label?: string;\n /**\n * Whether the radio group is required\n * @default false\n */\n required?: boolean;\n /**\n * The name attribute for all radio buttons in the group\n */\n name?: string;\n /**\n * The default value of the radio group\n */\n defaultValue?: string;\n /**\n * The controlled value of the radio group\n */\n value?: string;\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Whether the radio group is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nexport interface RadioItemProps\n extends\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\">,\n VariantProps<typeof radioItemVariants> {\n /**\n * The value of the radio item\n */\n value: string;\n /**\n * The label for the radio item\n */\n label?: string;\n /**\n * Whether the radio item is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nconst RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n className,\n error,\n helperText,\n label,\n required,\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const radioGroupId = React.useId();\n const labelId = label ? `${radioGroupId}-label` : undefined;\n const helperTextId = helperText ? `${radioGroupId}-helper` : undefined;\n const errorId = error ? `${radioGroupId}-error` : undefined;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onValueChange) {\n onValueChange(event.target.value);\n }\n };\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <label\n id={labelId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n {required && <span className=\"text-error-500 ml-1\">*</span>}\n </label>\n )}\n <div\n ref={ref}\n className={cn(radioGroupVariants({ orientation, className }))}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n aria-describedby={cn(helperTextId, errorId) || undefined}\n aria-invalid={error}\n {...props}\n >\n {React.Children.map(children, (child) => {\n if (React.isValidElement<RadioItemProps>(child)) {\n // Use controlled mode if value is provided, otherwise use uncontrolled\n const isControlled = value !== undefined;\n\n const childProps: Partial<RadioItemProps> = {\n name,\n disabled: Boolean(disabled ?? child.props.disabled),\n variant: error ? \"error\" : child.props.variant,\n ...(isControlled\n ? { checked: value === child.props.value }\n : { defaultChecked: defaultValue === child.props.value }),\n onChange: handleChange,\n };\n\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n {helperText && (\n <p\n id={helperTextId}\n className={cn(\n \"text-sm text-muted-foreground\",\n error && \"text-destructive\",\n )}\n >\n {helperText}\n </p>\n )}\n </div>\n );\n },\n);\nRadioGroup.displayName = \"RadioGroup\";\n\nconst RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(\n (\n {\n className,\n variant,\n size: radioSize,\n value,\n label,\n disabled,\n id,\n onChange,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const radioId = id || generatedId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"radio\"\n className={cn(\n radioItemVariants({ variant, size: radioSize, className }),\n )}\n ref={ref}\n id={radioId}\n value={value}\n disabled={disabled}\n onChange={handleChange}\n {...props}\n />\n {label && (\n <label\n htmlFor={radioId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n </div>\n );\n },\n);\nRadioItem.displayName = \"RadioItem\";\n\n// Both names, on purpose. `RadioGroupItem` is what shadcn calls it and what\n// every example in the docs uses; `RadioItem` is what this file has always\n// called it. The alias used to live only in the barrel, so\n// `@jarllyng/nostromo/radio-group` and `@jarllyng/nostromo` disagreed about the\n// name of the same component - and the documented subpath import did not resolve.\nexport {\n RadioGroup,\n RadioItem,\n RadioItem as RadioGroupItem,\n radioGroupVariants,\n radioItemVariants,\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- 'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),e=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var e__namespace=/*#__PURE__*/_interopNamespace(e);var V=classVarianceAuthority.cva("grid gap-2",{variants:{orientation:{vertical:"grid-cols-1",horizontal:"grid-cols-2 sm:grid-cols-3 md:grid-cols-4"}},defaultVariants:{orientation:"vertical"}}),w=classVarianceAuthority.cva("peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200",{variants:{variant:{default:"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary",error:"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive",success:"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500"},size:{default:"h-4 w-4",sm:"h-3 w-3",lg:"h-5 w-5"}},defaultVariants:{variant:"default",size:"default"}}),E=e__namespace.forwardRef(({className:u,error:t,helperText:r,label:s,required:d,orientation:p,name:m,defaultValue:o,value:n,onValueChange:l,disabled:b,children:c,...f},v)=>{let g=e__namespace.useId(),h=s?`${g}-label`:void 0,R=r?`${g}-helper`:void 0,y=t?`${g}-error`:void 0,x=a=>{l&&l(a.target.value);};return e__namespace.createElement("div",{className:"space-y-2"},s&&e__namespace.createElement("label",{id:h,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},s,d&&e__namespace.createElement("span",{className:"text-error-500 ml-1"},"*")),e__namespace.createElement("div",{ref:v,className:chunkITRGJNWL_cjs.a(V({orientation:p,className:u})),role:"radiogroup","aria-labelledby":h,"aria-describedby":chunkITRGJNWL_cjs.a(R,y)||void 0,"aria-invalid":t,...f},e__namespace.Children.map(c,a=>{if(e__namespace.isValidElement(a)){let k=n!==void 0,P={name:m,disabled:!!(b??a.props.disabled),variant:t?"error":a.props.variant,...k?{checked:n===a.props.value}:{defaultChecked:o===a.props.value},onChange:x};return e__namespace.cloneElement(a,P)}return a})),r&&e__namespace.createElement("p",{id:R,className:chunkITRGJNWL_cjs.a("text-sm text-muted-foreground",t&&"text-destructive")},r))});E.displayName="RadioGroup";var N=e__namespace.forwardRef(({className:u,variant:t,size:r,value:s,label:d,disabled:p,id:m,onChange:o,...n},l)=>{let b=e__namespace.useId(),c=m||b,f=v=>{o&&o(v);};return e__namespace.createElement("div",{className:"flex items-center space-x-2"},e__namespace.createElement("input",{type:"radio",className:chunkITRGJNWL_cjs.a(w({variant:t,size:r,className:u})),ref:l,id:c,value:s,disabled:p,onChange:f,...n}),d&&e__namespace.createElement("label",{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},d))});N.displayName="RadioItem";exports.a=V;exports.b=w;exports.c=E;exports.d=N;//# sourceMappingURL=chunk-MLJZU63I.cjs.map
3
- //# sourceMappingURL=chunk-MLJZU63I.cjs.map
2
+ 'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),e=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var e__namespace=/*#__PURE__*/_interopNamespace(e);var V=classVarianceAuthority.cva("grid gap-2",{variants:{orientation:{vertical:"grid-cols-1",horizontal:"grid-cols-2 sm:grid-cols-3 md:grid-cols-4"}},defaultVariants:{orientation:"vertical"}}),w=classVarianceAuthority.cva("peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200",{variants:{variant:{default:"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary",error:"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive",success:"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500"},size:{default:"h-4 w-4",sm:"h-3 w-3",lg:"h-5 w-5"}},defaultVariants:{variant:"default",size:"default"}}),E=e__namespace.forwardRef(({className:u,error:t,helperText:r,label:s,required:d,orientation:p,name:m,defaultValue:o,value:n,onValueChange:l,disabled:b,children:c,...f},v)=>{let g=e__namespace.useId(),R=s?`${g}-label`:void 0,h=r?`${g}-helper`:void 0,y=t?`${g}-error`:void 0,x=a=>{l&&l(a.target.value);};return e__namespace.createElement("div",{className:"space-y-2"},s&&e__namespace.createElement("label",{id:R,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},s,d&&e__namespace.createElement("span",{className:"text-error-500 ml-1"},"*")),e__namespace.createElement("div",{ref:v,className:chunkITRGJNWL_cjs.a(V({orientation:p,className:u})),role:"radiogroup","aria-labelledby":R,"aria-describedby":chunkITRGJNWL_cjs.a(h,y)||void 0,"aria-invalid":t,...f},e__namespace.Children.map(c,a=>{if(e__namespace.isValidElement(a)){let k=n!==void 0,P={name:m,disabled:!!(b??a.props.disabled),variant:t?"error":a.props.variant,...k?{checked:n===a.props.value}:{defaultChecked:o===a.props.value},onChange:x};return e__namespace.cloneElement(a,P)}return a})),r&&e__namespace.createElement("p",{id:h,className:chunkITRGJNWL_cjs.a("text-sm text-muted-foreground",t&&"text-destructive")},r))});E.displayName="RadioGroup";var N=e__namespace.forwardRef(({className:u,variant:t,size:r,value:s,label:d,disabled:p,id:m,onChange:o,...n},l)=>{let b=e__namespace.useId(),c=m||b,f=v=>{o&&o(v);};return e__namespace.createElement("div",{className:"flex items-center space-x-2"},e__namespace.createElement("input",{type:"radio",className:chunkITRGJNWL_cjs.a(w({variant:t,size:r,className:u})),ref:l,id:c,value:s,disabled:p,onChange:f,...n}),d&&e__namespace.createElement("label",{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},d))});N.displayName="RadioItem";exports.a=V;exports.b=w;exports.c=E;exports.d=N;//# sourceMappingURL=chunk-YLAUFUIS.cjs.map
3
+ //# sourceMappingURL=chunk-YLAUFUIS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/core/radio-group.tsx"],"names":["radioGroupVariants","cva","radioItemVariants","RadioGroup","e","className","error","helperText","label","required","orientation","name","defaultValue","value","onValueChange","disabled","children","props","ref","radioGroupId","labelId","helperTextId","errorId","handleChange","event","cn","child","isControlled","childProps","RadioItem","variant","radioSize","id","onChange","generatedId","radioId"],"mappings":"ufAIA,IAAMA,CAAAA,CAAqBC,0BAAAA,CAAI,YAAA,CAAc,CAC3C,QAAA,CAAU,CACR,YAAa,CACX,QAAA,CAAU,cACV,UAAA,CAAY,2CACd,CACF,CAAA,CACA,gBAAiB,CACf,WAAA,CAAa,UACf,CACF,CAAC,EAEKC,CAAAA,CAAoBD,0BAAAA,CACxB,oWAAA,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,CACA,OAAA,CAAAyB,EACA,IAAA,CAAMC,CAAAA,CACN,MAAAlB,CAAAA,CACA,KAAA,CAAAL,CAAAA,CACA,QAAA,CAAAO,EACA,EAAA,CAAAiB,CAAAA,CACA,SAAAC,CAAAA,CACA,GAAGhB,CACL,CAAA,CACAC,CAAAA,GACG,CACH,IAAMgB,EAAoB9B,YAAA,CAAA,KAAA,EAAM,CAC1B+B,EAAUH,CAAAA,EAAME,CAAAA,CAEhBX,EAAgBC,CAAAA,EAA+C,CAC/DS,CAAAA,EACFA,CAAAA,CAAST,CAAK,EAElB,CAAA,CAEA,OACEpB,YAAA,CAAA,aAAA,CAAC,KAAA,CAAA,CAAI,UAAU,6BAAA,CAAA,CACbA,YAAA,CAAA,aAAA,CAAC,OAAA,CAAA,CACC,IAAA,CAAK,QACL,SAAA,CAAWqB,mBAAAA,CACTvB,EAAkB,CAAE,OAAA,CAAA4B,EAAS,IAAA,CAAMC,CAAAA,CAAW,SAAA,CAAA1B,CAAU,CAAC,CAC3D,CAAA,CACA,IAAKa,CAAAA,CACL,EAAA,CAAIiB,EACJ,KAAA,CAAOtB,CAAAA,CACP,QAAA,CAAUE,CAAAA,CACV,SAAUQ,CAAAA,CACT,GAAGN,EACN,CAAA,CACCT,CAAAA,EACCJ,2BAAC,OAAA,CAAA,CACC,OAAA,CAAS+B,CAAAA,CACT,SAAA,CAAU,8FAET3B,CACH,CAEJ,CAEJ,CACF,EACAqB,EAAU,WAAA,CAAc,WAAA","file":"chunk-MLJZU63I.cjs","sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst radioGroupVariants = cva(\"grid gap-2\", {\n variants: {\n orientation: {\n vertical: \"grid-cols-1\",\n horizontal: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nconst radioItemVariants = cva(\n \"peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200\",\n {\n variants: {\n variant: {\n default:\n \"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n error:\n \"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive\",\n success:\n \"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500\",\n },\n size: {\n default: \"h-4 w-4\",\n sm: \"h-3 w-3\",\n lg: \"h-5 w-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface RadioGroupProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof radioGroupVariants> {\n /**\n * Whether the radio group is in an error state\n * @default false\n */\n error?: boolean;\n /**\n * Helper text to display below the radio group\n */\n helperText?: string;\n /**\n * Label text for the radio group\n */\n label?: string;\n /**\n * Whether the radio group is required\n * @default false\n */\n required?: boolean;\n /**\n * The name attribute for all radio buttons in the group\n */\n name?: string;\n /**\n * The default value of the radio group\n */\n defaultValue?: string;\n /**\n * The controlled value of the radio group\n */\n value?: string;\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Whether the radio group is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nexport interface RadioItemProps\n extends\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\">,\n VariantProps<typeof radioItemVariants> {\n /**\n * The value of the radio item\n */\n value: string;\n /**\n * The label for the radio item\n */\n label?: string;\n /**\n * Whether the radio item is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nconst RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n className,\n error,\n helperText,\n label,\n required,\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const radioGroupId = React.useId();\n const labelId = label ? `${radioGroupId}-label` : undefined;\n const helperTextId = helperText ? `${radioGroupId}-helper` : undefined;\n const errorId = error ? `${radioGroupId}-error` : undefined;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onValueChange) {\n onValueChange(event.target.value);\n }\n };\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <label\n id={labelId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n {required && <span className=\"text-error-500 ml-1\">*</span>}\n </label>\n )}\n <div\n ref={ref}\n className={cn(radioGroupVariants({ orientation, className }))}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n aria-describedby={cn(helperTextId, errorId) || undefined}\n aria-invalid={error}\n {...props}\n >\n {React.Children.map(children, (child) => {\n if (React.isValidElement<RadioItemProps>(child)) {\n // Use controlled mode if value is provided, otherwise use uncontrolled\n const isControlled = value !== undefined;\n\n const childProps: Partial<RadioItemProps> = {\n name,\n disabled: Boolean(disabled ?? child.props.disabled),\n variant: error ? \"error\" : child.props.variant,\n ...(isControlled\n ? { checked: value === child.props.value }\n : { defaultChecked: defaultValue === child.props.value }),\n onChange: handleChange,\n };\n\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n {helperText && (\n <p\n id={helperTextId}\n className={cn(\n \"text-sm text-muted-foreground\",\n error && \"text-destructive\",\n )}\n >\n {helperText}\n </p>\n )}\n </div>\n );\n },\n);\nRadioGroup.displayName = \"RadioGroup\";\n\nconst RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(\n (\n {\n className,\n variant,\n size: radioSize,\n value,\n label,\n disabled,\n id,\n onChange,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const radioId = id || generatedId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"radio\"\n className={cn(\n radioItemVariants({ variant, size: radioSize, className }),\n )}\n ref={ref}\n id={radioId}\n value={value}\n disabled={disabled}\n onChange={handleChange}\n {...props}\n />\n {label && (\n <label\n htmlFor={radioId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n </div>\n );\n },\n);\nRadioItem.displayName = \"RadioItem\";\n\nexport { RadioGroup, RadioItem, radioGroupVariants, radioItemVariants };\n"]}
1
+ {"version":3,"sources":["../src/components/core/radio-group.tsx"],"names":["radioGroupVariants","cva","radioItemVariants","RadioGroup","e","className","error","helperText","label","required","orientation","name","defaultValue","value","onValueChange","disabled","children","props","ref","radioGroupId","labelId","helperTextId","errorId","handleChange","event","cn","child","isControlled","childProps","RadioItem","variant","radioSize","id","onChange","generatedId","radioId"],"mappings":"ufAIA,IAAMA,CAAAA,CAAqBC,0BAAAA,CAAI,YAAA,CAAc,CAC3C,QAAA,CAAU,CACR,YAAa,CACX,QAAA,CAAU,cACV,UAAA,CAAY,2CACd,CACF,CAAA,CACA,gBAAiB,CACf,WAAA,CAAa,UACf,CACF,CAAC,EAEKC,CAAAA,CAAoBD,0BAAAA,CACxB,oWAAA,CACA,CACE,SAAU,CACR,OAAA,CAAS,CACP,OAAA,CACE,uGAAA,CACF,MACE,+HAAA,CACF,OAAA,CACE,+HACJ,CAAA,CACA,KAAM,CACJ,OAAA,CAAS,UACT,EAAA,CAAI,SAAA,CACJ,GAAI,SACN,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,SAAA,CACT,KAAM,SACR,CACF,CACF,CAAA,CAkEME,CAAAA,CAAmBC,YAAA,CAAA,UAAA,CACvB,CACE,CACE,SAAA,CAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,UAAA,CAAAC,EACA,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CACA,IAAA,CAAAC,EAC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,aAAA,CAAC,OAAA,CAAA,CACC,IAAA,CAAK,QACL,SAAA,CAAWqB,mBAAAA,CACTvB,EAAkB,CAAE,OAAA,CAAA4B,EAAS,IAAA,CAAMC,CAAAA,CAAW,SAAA,CAAA1B,CAAU,CAAC,CAC3D,CAAA,CACA,IAAKa,CAAAA,CACL,EAAA,CAAIiB,EACJ,KAAA,CAAOtB,CAAAA,CACP,QAAA,CAAUE,CAAAA,CACV,SAAUQ,CAAAA,CACT,GAAGN,EACN,CAAA,CACCT,CAAAA,EACCJ,2BAAC,OAAA,CAAA,CACC,OAAA,CAAS+B,CAAAA,CACT,SAAA,CAAU,8FAET3B,CACH,CAEJ,CAEJ,CACF,EACAqB,EAAU,WAAA,CAAc,WAAA","file":"chunk-YLAUFUIS.cjs","sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst radioGroupVariants = cva(\"grid gap-2\", {\n variants: {\n orientation: {\n vertical: \"grid-cols-1\",\n horizontal: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nconst radioItemVariants = cva(\n \"peer h-4 w-4 shrink-0 rounded-full border border-border shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary transition-all duration-200\",\n {\n variants: {\n variant: {\n default:\n \"border-border hover:border-border data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n error:\n \"border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive\",\n success:\n \"border-success-500 focus-visible:ring-success-500 data-[state=checked]:bg-success-500 data-[state=checked]:border-success-500\",\n },\n size: {\n default: \"h-4 w-4\",\n sm: \"h-3 w-3\",\n lg: \"h-5 w-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface RadioGroupProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof radioGroupVariants> {\n /**\n * Whether the radio group is in an error state\n * @default false\n */\n error?: boolean;\n /**\n * Helper text to display below the radio group\n */\n helperText?: string;\n /**\n * Label text for the radio group\n */\n label?: string;\n /**\n * Whether the radio group is required\n * @default false\n */\n required?: boolean;\n /**\n * The name attribute for all radio buttons in the group\n */\n name?: string;\n /**\n * The default value of the radio group\n */\n defaultValue?: string;\n /**\n * The controlled value of the radio group\n */\n value?: string;\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Whether the radio group is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nexport interface RadioItemProps\n extends\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\">,\n VariantProps<typeof radioItemVariants> {\n /**\n * The value of the radio item\n */\n value: string;\n /**\n * The label for the radio item\n */\n label?: string;\n /**\n * Whether the radio item is disabled\n * @default false\n */\n disabled?: boolean;\n}\n\nconst RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n className,\n error,\n helperText,\n label,\n required,\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const radioGroupId = React.useId();\n const labelId = label ? `${radioGroupId}-label` : undefined;\n const helperTextId = helperText ? `${radioGroupId}-helper` : undefined;\n const errorId = error ? `${radioGroupId}-error` : undefined;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onValueChange) {\n onValueChange(event.target.value);\n }\n };\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <label\n id={labelId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n {required && <span className=\"text-error-500 ml-1\">*</span>}\n </label>\n )}\n <div\n ref={ref}\n className={cn(radioGroupVariants({ orientation, className }))}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n aria-describedby={cn(helperTextId, errorId) || undefined}\n aria-invalid={error}\n {...props}\n >\n {React.Children.map(children, (child) => {\n if (React.isValidElement<RadioItemProps>(child)) {\n // Use controlled mode if value is provided, otherwise use uncontrolled\n const isControlled = value !== undefined;\n\n const childProps: Partial<RadioItemProps> = {\n name,\n disabled: Boolean(disabled ?? child.props.disabled),\n variant: error ? \"error\" : child.props.variant,\n ...(isControlled\n ? { checked: value === child.props.value }\n : { defaultChecked: defaultValue === child.props.value }),\n onChange: handleChange,\n };\n\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n {helperText && (\n <p\n id={helperTextId}\n className={cn(\n \"text-sm text-muted-foreground\",\n error && \"text-destructive\",\n )}\n >\n {helperText}\n </p>\n )}\n </div>\n );\n },\n);\nRadioGroup.displayName = \"RadioGroup\";\n\nconst RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(\n (\n {\n className,\n variant,\n size: radioSize,\n value,\n label,\n disabled,\n id,\n onChange,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const radioId = id || generatedId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"radio\"\n className={cn(\n radioItemVariants({ variant, size: radioSize, className }),\n )}\n ref={ref}\n id={radioId}\n value={value}\n disabled={disabled}\n onChange={handleChange}\n {...props}\n />\n {label && (\n <label\n htmlFor={radioId}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n </div>\n );\n },\n);\nRadioItem.displayName = \"RadioItem\";\n\n// Both names, on purpose. `RadioGroupItem` is what shadcn calls it and what\n// every example in the docs uses; `RadioItem` is what this file has always\n// called it. The alias used to live only in the barrel, so\n// `@jarllyng/nostromo/radio-group` and `@jarllyng/nostromo` disagreed about the\n// name of the same component - and the documented subpath import did not resolve.\nexport {\n RadioGroup,\n RadioItem,\n RadioItem as RadioGroupItem,\n radioGroupVariants,\n radioItemVariants,\n};\n"]}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ 'use strict';var chunk7YFUAGIW_cjs=require('../../chunk-7YFUAGIW.cjs'),chunkXPIBRXTW_cjs=require('../../chunk-XPIBRXTW.cjs'),chunkV77N662N_cjs=require('../../chunk-V77N662N.cjs'),chunkITRGJNWL_cjs=require('../../chunk-ITRGJNWL.cjs'),r=require('react'),reactSlot=require('@radix-ui/react-slot'),reactHookForm=require('react-hook-form');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var r__namespace=/*#__PURE__*/_interopNamespace(r);var v=reactHookForm.FormProvider,f=r__namespace.createContext(null);function N({...e}){let t=r__namespace.useId(),o=r__namespace.useMemo(()=>({name:e.name,id:t}),[e.name,t]);return r__namespace.createElement(f.Provider,{value:o},r__namespace.createElement(reactHookForm.Controller,{...e}))}function i(){let e=r__namespace.useContext(f);if(!e)throw new Error("useFormField must be used inside a <FormField>. Without it there is no field id to attach a label or a message to.");let{errors:t}=reactHookForm.useFormState({name:e.name}),o=e.name.split(".").reduce((s,a)=>s?.[a],t);return {name:e.name,formItemId:e.id,formDescriptionId:`${e.id}-description`,formMessageId:`${e.id}-message`,error:o}}function g({className:e,...t}){return r__namespace.createElement("div",{className:chunkITRGJNWL_cjs.a("space-y-1.5",e),...t})}g.displayName="FormItem";var y=r__namespace.forwardRef(({className:e,...t},o)=>{let{error:s,formItemId:a}=i();return r__namespace.createElement(chunkXPIBRXTW_cjs.b,{ref:o,htmlFor:a,className:chunkITRGJNWL_cjs.a(s&&"text-destructive",e),...t})});y.displayName="FormLabel";var C=r__namespace.forwardRef(({...e},t)=>{let{error:o,formItemId:s,formDescriptionId:a,formMessageId:n}=i();return r__namespace.createElement(reactSlot.Slot,{ref:t,id:s,"aria-describedby":o?`${a} ${n}`:a,"aria-invalid":o?true:void 0,...e})});C.displayName="FormControl";var I=r__namespace.forwardRef(({...e},t)=>{let{formDescriptionId:o}=i();return r__namespace.createElement(chunk7YFUAGIW_cjs.b,{ref:t,id:o,...e})});I.displayName="FormDescription";var M=r__namespace.forwardRef(({children:e,...t},o)=>{let{error:s,formMessageId:a}=i(),n=s?.message??e;return n?r__namespace.createElement(chunkV77N662N_cjs.b,{ref:o,id:a,...t},n):null});M.displayName="FormMessage";Object.defineProperty(exports,"useFormContext",{enumerable:true,get:function(){return reactHookForm.useFormContext}});exports.Form=v;exports.FormControl=C;exports.FormDescription=I;exports.FormField=N;exports.FormItem=g;exports.FormLabel=y;exports.FormMessage=M;exports.useFormField=i;//# sourceMappingURL=form.cjs.map
3
+ //# sourceMappingURL=form.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/core/form.tsx"],"names":["Form","FormProvider","FormFieldContext","r","FormField","props","id","value","Controller","useFormField","field","errors","useFormState","error","acc","key","FormItem","className","cn","FormLabel","ref","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","HelperText","FormMessage","children","body","ErrorMessage"],"mappings":"qrBAgDA,IAAMA,CAAAA,CAAOC,0BAAAA,CAOPC,CAAAA,CAAyBC,2BAC7B,IACF,EAQA,SAASC,CAAAA,CAGP,CAAE,GAAGC,CAAM,CAAA,CAAyC,CACpD,IAAMC,CAAAA,CAAWH,YAAA,CAAA,KAAA,EAAM,CACjBI,CAAAA,CAAcJ,qBAClB,KAAO,CAAE,IAAA,CAAME,CAAAA,CAAM,KAAgB,EAAA,CAAAC,CAAG,CAAA,CAAA,CACxC,CAACD,EAAM,IAAA,CAAMC,CAAE,CACjB,CAAA,CACA,OACEH,YAAA,CAAA,aAAA,CAACD,CAAAA,CAAiB,QAAA,CAAjB,CAA0B,MAAOK,CAAAA,CAAAA,CAChCJ,Y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OAAA,EAAWiB,CAAAA,CAC/B,OAAKC,CAAAA,CAGH5B,YAAA,CAAA,aAAA,CAAC6B,mBAAAA,CAAA,CAAa,IAAKZ,CAAAA,CAAK,EAAA,CAAIK,CAAAA,CAAgB,GAAGpB,GAC5C0B,CACH,CAAA,CALgB,IAOpB,CAAC,EACDF,EAAY,WAAA,CAAc,aAAA","file":"form.cjs","sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\n\nimport { cn } from \"../../lib/utils\";\nimport { ErrorMessage } from \"./error-message\";\nimport { HelperText } from \"./helper-text\";\nimport { Label } from \"./label\";\n\n/**\n * Wires react-hook-form to this library's Label, HelperText and ErrorMessage,\n * and generates the ids that connect them.\n *\n * The three pieces have always existed separately, and connecting them was left\n * to the caller: an id on the input, a matching htmlFor, an aria-describedby\n * listing the description and the error, and aria-invalid toggled by hand. That\n * is four things to get right per field, and the failure is silent - a form that\n * looks correct and tells a screen reader nothing.\n *\n * `FormField` generates one id per field and `FormControl` applies the wiring, so\n * a field is a label, a control and a message with no bookkeeping.\n *\n * ## react-hook-form is an optional peer dependency, and this is not in the barrel\n *\n * `react-hook-form` is around 25kB and most consumers of a component library do\n * not want it forced on them, so it is an optional peer: install it if you use\n * `Form`, and pay nothing if you do not.\n *\n * That only works if importing something unrelated cannot pull it in. A bundler\n * has to *resolve* every import in a module before it can tree-shake anything,\n * so a barrel that re-exported this file would fail to build for anyone without\n * the peer installed, even if they only wanted `Button`. So `Form` is reachable\n * only through its own entry point:\n *\n * import { Form, FormField } from \"@jarllyng/nostromo/components/core/form\";\n *\n * Verified rather than assumed - see the react-compat job, which installs the\n * packed tarball into a project with no react-hook-form and imports the barrel.\n */\n\nconst Form = FormProvider;\n\ninterface FormFieldContextValue {\n name: string;\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(\n null,\n);\n\n/**\n * One field: a name, and the ids that tie its parts together.\n *\n * Wraps react-hook-form's `Controller`, so it works with controlled components\n * like `Select` and `Checkbox` as well as with plain inputs.\n */\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: ControllerProps<TFieldValues, TName>) {\n const id = React.useId();\n const value = React.useMemo(\n () => ({ name: props.name as string, id }),\n [props.name, id],\n );\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/**\n * The ids and error state for the field being rendered.\n *\n * Throws rather than returning undefined when used outside a `FormField`. The\n * quiet alternative is a label whose `htmlFor` points at nothing, which is the\n * exact class of silent breakage this component exists to remove.\n */\nfunction useFormField() {\n const field = React.useContext(FormFieldContext);\n if (!field) {\n throw new Error(\n \"useFormField must be used inside a <FormField>. Without it there is no field id to attach a label or a message to.\",\n );\n }\n const { errors } = useFormState({ name: field.name });\n // Nested names like \"address.city\" reach into the error object.\n const error = field.name\n .split(\".\")\n .reduce<unknown>(\n (acc, key) => (acc as Record<string, unknown>)?.[key],\n errors,\n );\n\n return {\n name: field.name,\n formItemId: field.id,\n formDescriptionId: `${field.id}-description`,\n formMessageId: `${field.id}-message`,\n error: error as { message?: string } | undefined,\n };\n}\n\nfunction FormItem({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"space-y-1.5\", className)} {...props} />;\n}\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n return (\n <Label\n ref={ref}\n htmlFor={formItemId}\n className={cn(error && \"text-destructive\", className)}\n {...props}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\n/**\n * Applies the wiring to whatever control it wraps.\n *\n * A `Slot`, so it passes the id and the aria attributes to the child rather than\n * rendering an element of its own. `aria-describedby` lists the description and,\n * when there is one, the message - both, because a field can have guidance and\n * an error at the same time and a screen reader should hear both.\n */\nconst FormControl = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\n }\n aria-invalid={error ? true : undefined}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n React.ElementRef<typeof HelperText>,\n React.ComponentPropsWithoutRef<typeof HelperText>\n>(({ ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n return <HelperText ref={ref} id={formDescriptionId} {...props} />;\n});\nFormDescription.displayName = \"FormDescription\";\n\n/**\n * The field's error, or nothing.\n *\n * Renders the validation message when there is one and `children` otherwise, so\n * a field can carry a persistent hint that the error replaces. Renders nothing\n * at all when there is neither, rather than an empty element that still takes up\n * space in the layout.\n */\nconst FormMessage = React.forwardRef<\n React.ElementRef<typeof ErrorMessage>,\n React.ComponentPropsWithoutRef<typeof ErrorMessage>\n>(({ children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ?? children;\n if (!body) return null;\n\n return (\n <ErrorMessage ref={ref} id={formMessageId} {...props}>\n {body}\n </ErrorMessage>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n Form,\n FormField,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n useFormField,\n useFormContext,\n};\n"]}
@@ -0,0 +1,90 @@
1
+ import { ErrorMessageProps } from './error-message.cjs';
2
+ import { HelperTextProps } from './helper-text.cjs';
3
+ import { LabelProps } from './label.cjs';
4
+ import * as react_hook_form from 'react-hook-form';
5
+ import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
6
+ export { useFormContext } from 'react-hook-form';
7
+ import * as React from 'react';
8
+ import 'class-variance-authority/types';
9
+ import 'class-variance-authority';
10
+
11
+ /**
12
+ * Wires react-hook-form to this library's Label, HelperText and ErrorMessage,
13
+ * and generates the ids that connect them.
14
+ *
15
+ * The three pieces have always existed separately, and connecting them was left
16
+ * to the caller: an id on the input, a matching htmlFor, an aria-describedby
17
+ * listing the description and the error, and aria-invalid toggled by hand. That
18
+ * is four things to get right per field, and the failure is silent - a form that
19
+ * looks correct and tells a screen reader nothing.
20
+ *
21
+ * `FormField` generates one id per field and `FormControl` applies the wiring, so
22
+ * a field is a label, a control and a message with no bookkeeping.
23
+ *
24
+ * ## react-hook-form is an optional peer dependency, and this is not in the barrel
25
+ *
26
+ * `react-hook-form` is around 25kB and most consumers of a component library do
27
+ * not want it forced on them, so it is an optional peer: install it if you use
28
+ * `Form`, and pay nothing if you do not.
29
+ *
30
+ * That only works if importing something unrelated cannot pull it in. A bundler
31
+ * has to *resolve* every import in a module before it can tree-shake anything,
32
+ * so a barrel that re-exported this file would fail to build for anyone without
33
+ * the peer installed, even if they only wanted `Button`. So `Form` is reachable
34
+ * only through its own entry point:
35
+ *
36
+ * import { Form, FormField } from "@jarllyng/nostromo/components/core/form";
37
+ *
38
+ * Verified rather than assumed - see the react-compat job, which installs the
39
+ * packed tarball into a project with no react-hook-form and imports the barrel.
40
+ */
41
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
42
+ /**
43
+ * One field: a name, and the ids that tie its parts together.
44
+ *
45
+ * Wraps react-hook-form's `Controller`, so it works with controlled components
46
+ * like `Select` and `Checkbox` as well as with plain inputs.
47
+ */
48
+ declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>): React.JSX.Element;
49
+ /**
50
+ * The ids and error state for the field being rendered.
51
+ *
52
+ * Throws rather than returning undefined when used outside a `FormField`. The
53
+ * quiet alternative is a label whose `htmlFor` points at nothing, which is the
54
+ * exact class of silent breakage this component exists to remove.
55
+ */
56
+ declare function useFormField(): {
57
+ name: string;
58
+ formItemId: string;
59
+ formDescriptionId: string;
60
+ formMessageId: string;
61
+ error: {
62
+ message?: string;
63
+ } | undefined;
64
+ };
65
+ declare function FormItem({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
66
+ declare namespace FormItem {
67
+ var displayName: string;
68
+ }
69
+ declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
70
+ /**
71
+ * Applies the wiring to whatever control it wraps.
72
+ *
73
+ * A `Slot`, so it passes the id and the aria attributes to the child rather than
74
+ * rendering an element of its own. `aria-describedby` lists the description and,
75
+ * when there is one, the message - both, because a field can have guidance and
76
+ * an error at the same time and a screen reader should hear both.
77
+ */
78
+ declare const FormControl: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
79
+ declare const FormDescription: React.ForwardRefExoticComponent<Omit<HelperTextProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
80
+ /**
81
+ * The field's error, or nothing.
82
+ *
83
+ * Renders the validation message when there is one and `children` otherwise, so
84
+ * a field can carry a persistent hint that the error replaces. Renders nothing
85
+ * at all when there is neither, rather than an empty element that still takes up
86
+ * space in the layout.
87
+ */
88
+ declare const FormMessage: React.ForwardRefExoticComponent<Omit<ErrorMessageProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
89
+
90
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -0,0 +1,90 @@
1
+ import { ErrorMessageProps } from './error-message.js';
2
+ import { HelperTextProps } from './helper-text.js';
3
+ import { LabelProps } from './label.js';
4
+ import * as react_hook_form from 'react-hook-form';
5
+ import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
6
+ export { useFormContext } from 'react-hook-form';
7
+ import * as React from 'react';
8
+ import 'class-variance-authority/types';
9
+ import 'class-variance-authority';
10
+
11
+ /**
12
+ * Wires react-hook-form to this library's Label, HelperText and ErrorMessage,
13
+ * and generates the ids that connect them.
14
+ *
15
+ * The three pieces have always existed separately, and connecting them was left
16
+ * to the caller: an id on the input, a matching htmlFor, an aria-describedby
17
+ * listing the description and the error, and aria-invalid toggled by hand. That
18
+ * is four things to get right per field, and the failure is silent - a form that
19
+ * looks correct and tells a screen reader nothing.
20
+ *
21
+ * `FormField` generates one id per field and `FormControl` applies the wiring, so
22
+ * a field is a label, a control and a message with no bookkeeping.
23
+ *
24
+ * ## react-hook-form is an optional peer dependency, and this is not in the barrel
25
+ *
26
+ * `react-hook-form` is around 25kB and most consumers of a component library do
27
+ * not want it forced on them, so it is an optional peer: install it if you use
28
+ * `Form`, and pay nothing if you do not.
29
+ *
30
+ * That only works if importing something unrelated cannot pull it in. A bundler
31
+ * has to *resolve* every import in a module before it can tree-shake anything,
32
+ * so a barrel that re-exported this file would fail to build for anyone without
33
+ * the peer installed, even if they only wanted `Button`. So `Form` is reachable
34
+ * only through its own entry point:
35
+ *
36
+ * import { Form, FormField } from "@jarllyng/nostromo/components/core/form";
37
+ *
38
+ * Verified rather than assumed - see the react-compat job, which installs the
39
+ * packed tarball into a project with no react-hook-form and imports the barrel.
40
+ */
41
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
42
+ /**
43
+ * One field: a name, and the ids that tie its parts together.
44
+ *
45
+ * Wraps react-hook-form's `Controller`, so it works with controlled components
46
+ * like `Select` and `Checkbox` as well as with plain inputs.
47
+ */
48
+ declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>): React.JSX.Element;
49
+ /**
50
+ * The ids and error state for the field being rendered.
51
+ *
52
+ * Throws rather than returning undefined when used outside a `FormField`. The
53
+ * quiet alternative is a label whose `htmlFor` points at nothing, which is the
54
+ * exact class of silent breakage this component exists to remove.
55
+ */
56
+ declare function useFormField(): {
57
+ name: string;
58
+ formItemId: string;
59
+ formDescriptionId: string;
60
+ formMessageId: string;
61
+ error: {
62
+ message?: string;
63
+ } | undefined;
64
+ };
65
+ declare function FormItem({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
66
+ declare namespace FormItem {
67
+ var displayName: string;
68
+ }
69
+ declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
70
+ /**
71
+ * Applies the wiring to whatever control it wraps.
72
+ *
73
+ * A `Slot`, so it passes the id and the aria attributes to the child rather than
74
+ * rendering an element of its own. `aria-describedby` lists the description and,
75
+ * when there is one, the message - both, because a field can have guidance and
76
+ * an error at the same time and a screen reader should hear both.
77
+ */
78
+ declare const FormControl: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
79
+ declare const FormDescription: React.ForwardRefExoticComponent<Omit<HelperTextProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
80
+ /**
81
+ * The field's error, or nothing.
82
+ *
83
+ * Renders the validation message when there is one and `children` otherwise, so
84
+ * a field can carry a persistent hint that the error replaces. Renders nothing
85
+ * at all when there is neither, rather than an empty element that still takes up
86
+ * space in the layout.
87
+ */
88
+ declare const FormMessage: React.ForwardRefExoticComponent<Omit<ErrorMessageProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
89
+
90
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import {b as b$1}from'../../chunk-ABA7B5DE.js';import {b}from'../../chunk-LYVCB45L.js';import {b as b$2}from'../../chunk-XQUZ7DUN.js';import {a}from'../../chunk-AC2JBXHQ.js';import*as r from'react';import {Slot}from'@radix-ui/react-slot';import {useFormState,FormProvider,Controller}from'react-hook-form';export{useFormContext}from'react-hook-form';var v=FormProvider,f=r.createContext(null);function N({...e}){let t=r.useId(),o=r.useMemo(()=>({name:e.name,id:t}),[e.name,t]);return r.createElement(f.Provider,{value:o},r.createElement(Controller,{...e}))}function i(){let e=r.useContext(f);if(!e)throw new Error("useFormField must be used inside a <FormField>. Without it there is no field id to attach a label or a message to.");let{errors:t}=useFormState({name:e.name}),o=e.name.split(".").reduce((s,a)=>s?.[a],t);return {name:e.name,formItemId:e.id,formDescriptionId:`${e.id}-description`,formMessageId:`${e.id}-message`,error:o}}function g({className:e,...t}){return r.createElement("div",{className:a("space-y-1.5",e),...t})}g.displayName="FormItem";var y=r.forwardRef(({className:e,...t},o)=>{let{error:s,formItemId:a$1}=i();return r.createElement(b,{ref:o,htmlFor:a$1,className:a(s&&"text-destructive",e),...t})});y.displayName="FormLabel";var C=r.forwardRef(({...e},t)=>{let{error:o,formItemId:s,formDescriptionId:a,formMessageId:n}=i();return r.createElement(Slot,{ref:t,id:s,"aria-describedby":o?`${a} ${n}`:a,"aria-invalid":o?true:void 0,...e})});C.displayName="FormControl";var I=r.forwardRef(({...e},t)=>{let{formDescriptionId:o}=i();return r.createElement(b$1,{ref:t,id:o,...e})});I.displayName="FormDescription";var M=r.forwardRef(({children:e,...t},o)=>{let{error:s,formMessageId:a}=i(),n=s?.message??e;return n?r.createElement(b$2,{ref:o,id:a,...t},n):null});M.displayName="FormMessage";export{v as Form,C as FormControl,I as FormDescription,N as FormField,g as FormItem,y as FormLabel,M as FormMessage,i as useFormField};//# sourceMappingURL=form.js.map
3
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/core/form.tsx"],"names":["Form","FormProvider","FormFieldContext","FormField","props","id","value","Controller","useFormField","field","errors","useFormState","error","acc","key","FormItem","className","cn","FormLabel","ref","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","HelperText","FormMessage","children","body","ErrorMessage"],"mappings":"6VAgDA,IAAMA,CAAAA,CAAOC,YAAAA,CAOPC,CAAAA,CAAyB,gBAC7B,IACF,EAQA,SAASC,CAAAA,CAGP,CAAE,GAAGC,CAAM,CAAA,CAAyC,CACpD,IAAMC,CAAAA,CAAW,CAAA,CAAA,KAAA,EAAM,CACjBC,CAAAA,CAAc,UAClB,KAAO,CAAE,IAAA,CAAMF,CAAAA,CAAM,KAAgB,EAAA,CAAAC,CAAG,CAAA,CAAA,CACxC,CAACD,EAAM,IAAA,CAAMC,CAAE,CACjB,CAAA,CACA,OACE,CAAA,CAAA,aAAA,CAACH,CAAAA,CAAiB,QAAA,CAAjB,CAA0B,MAAOI,CAAAA,CAAAA,CAChC,CAAA,CAAA,aAAA,CAACC,UAAAA,CAAA,CAAY,GAAGH,CAAAA,CAAO,CACzB,CAEJ,CASA,SAASI,CAAAA,EAAe,CACtB,IAAMC,CAAAA,CAAc,aAAWP,CAAgB,CAAA,CAC/C,GAAI,CAACO,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,oHACF,CAAA,CAEF,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,aAAa,CAAE,IAAA,CAAMF,CAAAA,CAAM,IAAK,CAAC,CAAA,CAE9CG,CAAAA,CAAQH,CAAAA,CAAM,IAAA,CACjB,MAAM,GAAG,CAAA,CACT,MAAA,CACC,CAACI,EAAKC,CAAAA,GAASD,CAAAA,GAAkCC,CA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C,CAAAA,CACJ,kBAAA,CACER,EAAQ,CAAA,EAAGW,CAAiB,CAAA,CAAA,EAAIC,CAAa,GAAKD,CAAAA,CAEpD,cAAA,CAAcX,EAAQ,IAAA,CAAO,MAAA,CAC5B,GAAGR,CAAAA,CACN,CAEJ,CAAC,EACDkB,EAAY,WAAA,CAAc,aAAA,CAE1B,IAAMI,CAAAA,CAAwB,aAG5B,CAAC,CAAE,GAAGtB,CAAM,EAAGe,CAAAA,GAAQ,CACvB,GAAM,CAAE,kBAAAI,CAAkB,CAAA,CAAIf,CAAAA,EAAa,CAC3C,OAAO,CAAA,CAAA,aAAA,CAACmB,GAAAA,CAAA,CAAW,GAAA,CAAKR,EAAK,EAAA,CAAII,CAAAA,CAAoB,GAAGnB,CAAAA,CAAO,CACjE,CAAC,EACDsB,EAAgB,WAAA,CAAc,iBAAA,KAUxBE,CAAAA,CAAoB,CAAA,CAAA,UAAA,CAGxB,CAAC,CAAE,SAAAC,CAAAA,CAAU,GAAGzB,CAAM,CAAA,CAAGe,IAAQ,CACjC,GAAM,CAAE,KAAA,CAAAP,EAAO,aAAA,CAAAY,CAAc,CAAA,CAAIhB,CAAAA,GAC3BsB,CAAAA,CAAOlB,CAAAA,EAAO,OAAA,EAAWiB,CAAAA,CAC/B,OAAKC,CAAAA,CAGH,CAAA,CAAA,aAAA,CAACC,GAAAA,CAAA,CAAa,IAAKZ,CAAAA,CAAK,EAAA,CAAIK,CAAAA,CAAgB,GAAGpB,GAC5C0B,CACH,CAAA,CALgB,IAOpB,CAAC,EACDF,EAAY,WAAA,CAAc,aAAA","file":"form.js","sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\n\nimport { cn } from \"../../lib/utils\";\nimport { ErrorMessage } from \"./error-message\";\nimport { HelperText } from \"./helper-text\";\nimport { Label } from \"./label\";\n\n/**\n * Wires react-hook-form to this library's Label, HelperText and ErrorMessage,\n * and generates the ids that connect them.\n *\n * The three pieces have always existed separately, and connecting them was left\n * to the caller: an id on the input, a matching htmlFor, an aria-describedby\n * listing the description and the error, and aria-invalid toggled by hand. That\n * is four things to get right per field, and the failure is silent - a form that\n * looks correct and tells a screen reader nothing.\n *\n * `FormField` generates one id per field and `FormControl` applies the wiring, so\n * a field is a label, a control and a message with no bookkeeping.\n *\n * ## react-hook-form is an optional peer dependency, and this is not in the barrel\n *\n * `react-hook-form` is around 25kB and most consumers of a component library do\n * not want it forced on them, so it is an optional peer: install it if you use\n * `Form`, and pay nothing if you do not.\n *\n * That only works if importing something unrelated cannot pull it in. A bundler\n * has to *resolve* every import in a module before it can tree-shake anything,\n * so a barrel that re-exported this file would fail to build for anyone without\n * the peer installed, even if they only wanted `Button`. So `Form` is reachable\n * only through its own entry point:\n *\n * import { Form, FormField } from \"@jarllyng/nostromo/components/core/form\";\n *\n * Verified rather than assumed - see the react-compat job, which installs the\n * packed tarball into a project with no react-hook-form and imports the barrel.\n */\n\nconst Form = FormProvider;\n\ninterface FormFieldContextValue {\n name: string;\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(\n null,\n);\n\n/**\n * One field: a name, and the ids that tie its parts together.\n *\n * Wraps react-hook-form's `Controller`, so it works with controlled components\n * like `Select` and `Checkbox` as well as with plain inputs.\n */\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: ControllerProps<TFieldValues, TName>) {\n const id = React.useId();\n const value = React.useMemo(\n () => ({ name: props.name as string, id }),\n [props.name, id],\n );\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/**\n * The ids and error state for the field being rendered.\n *\n * Throws rather than returning undefined when used outside a `FormField`. The\n * quiet alternative is a label whose `htmlFor` points at nothing, which is the\n * exact class of silent breakage this component exists to remove.\n */\nfunction useFormField() {\n const field = React.useContext(FormFieldContext);\n if (!field) {\n throw new Error(\n \"useFormField must be used inside a <FormField>. Without it there is no field id to attach a label or a message to.\",\n );\n }\n const { errors } = useFormState({ name: field.name });\n // Nested names like \"address.city\" reach into the error object.\n const error = field.name\n .split(\".\")\n .reduce<unknown>(\n (acc, key) => (acc as Record<string, unknown>)?.[key],\n errors,\n );\n\n return {\n name: field.name,\n formItemId: field.id,\n formDescriptionId: `${field.id}-description`,\n formMessageId: `${field.id}-message`,\n error: error as { message?: string } | undefined,\n };\n}\n\nfunction FormItem({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"space-y-1.5\", className)} {...props} />;\n}\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n return (\n <Label\n ref={ref}\n htmlFor={formItemId}\n className={cn(error && \"text-destructive\", className)}\n {...props}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\n/**\n * Applies the wiring to whatever control it wraps.\n *\n * A `Slot`, so it passes the id and the aria attributes to the child rather than\n * rendering an element of its own. `aria-describedby` lists the description and,\n * when there is one, the message - both, because a field can have guidance and\n * an error at the same time and a screen reader should hear both.\n */\nconst FormControl = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\n }\n aria-invalid={error ? true : undefined}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n React.ElementRef<typeof HelperText>,\n React.ComponentPropsWithoutRef<typeof HelperText>\n>(({ ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n return <HelperText ref={ref} id={formDescriptionId} {...props} />;\n});\nFormDescription.displayName = \"FormDescription\";\n\n/**\n * The field's error, or nothing.\n *\n * Renders the validation message when there is one and `children` otherwise, so\n * a field can carry a persistent hint that the error replaces. Renders nothing\n * at all when there is neither, rather than an empty element that still takes up\n * space in the layout.\n */\nconst FormMessage = React.forwardRef<\n React.ElementRef<typeof ErrorMessage>,\n React.ComponentPropsWithoutRef<typeof ErrorMessage>\n>(({ children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ?? children;\n if (!body) return null;\n\n return (\n <ErrorMessage ref={ref} id={formMessageId} {...props}>\n {body}\n </ErrorMessage>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n Form,\n FormField,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n useFormField,\n useFormContext,\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- 'use strict';var chunkMLJZU63I_cjs=require('../../chunk-MLJZU63I.cjs');require('../../chunk-ITRGJNWL.cjs');Object.defineProperty(exports,"RadioGroup",{enumerable:true,get:function(){return chunkMLJZU63I_cjs.c}});Object.defineProperty(exports,"RadioItem",{enumerable:true,get:function(){return chunkMLJZU63I_cjs.d}});Object.defineProperty(exports,"radioGroupVariants",{enumerable:true,get:function(){return chunkMLJZU63I_cjs.a}});Object.defineProperty(exports,"radioItemVariants",{enumerable:true,get:function(){return chunkMLJZU63I_cjs.b}});//# sourceMappingURL=radio-group.cjs.map
2
+ 'use strict';var chunkYLAUFUIS_cjs=require('../../chunk-YLAUFUIS.cjs');require('../../chunk-ITRGJNWL.cjs');Object.defineProperty(exports,"RadioGroup",{enumerable:true,get:function(){return chunkYLAUFUIS_cjs.c}});Object.defineProperty(exports,"RadioGroupItem",{enumerable:true,get:function(){return chunkYLAUFUIS_cjs.d}});Object.defineProperty(exports,"RadioItem",{enumerable:true,get:function(){return chunkYLAUFUIS_cjs.d}});Object.defineProperty(exports,"radioGroupVariants",{enumerable:true,get:function(){return chunkYLAUFUIS_cjs.a}});Object.defineProperty(exports,"radioItemVariants",{enumerable:true,get:function(){return chunkYLAUFUIS_cjs.b}});//# sourceMappingURL=radio-group.cjs.map
3
3
  //# sourceMappingURL=radio-group.cjs.map
@@ -68,4 +68,4 @@ interface RadioItemProps extends Omit<React.InputHTMLAttributes<HTMLInputElement
68
68
  declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
69
69
  declare const RadioItem: React.ForwardRefExoticComponent<RadioItemProps & React.RefAttributes<HTMLInputElement>>;
70
70
 
71
- export { RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, radioGroupVariants, radioItemVariants };
71
+ export { RadioGroup, RadioItem as RadioGroupItem, type RadioGroupProps, RadioItem, type RadioItemProps, radioGroupVariants, radioItemVariants };
@@ -68,4 +68,4 @@ interface RadioItemProps extends Omit<React.InputHTMLAttributes<HTMLInputElement
68
68
  declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
69
69
  declare const RadioItem: React.ForwardRefExoticComponent<RadioItemProps & React.RefAttributes<HTMLInputElement>>;
70
70
 
71
- export { RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, radioGroupVariants, radioItemVariants };
71
+ export { RadioGroup, RadioItem as RadioGroupItem, type RadioGroupProps, RadioItem, type RadioItemProps, radioGroupVariants, radioItemVariants };
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- export{c as RadioGroup,d as RadioItem,a as radioGroupVariants,b as radioItemVariants}from'../../chunk-WW2DDHCI.js';import'../../chunk-AC2JBXHQ.js';//# sourceMappingURL=radio-group.js.map
2
+ export{c as RadioGroup,d as RadioGroupItem,d as RadioItem,a as radioGroupVariants,b as radioItemVariants}from'../../chunk-KR6IVHNR.js';import'../../chunk-AC2JBXHQ.js';//# sourceMappingURL=radio-group.js.map
3
3
  //# sourceMappingURL=radio-group.js.map