@televet/kibble-ui 4.0.0-beta.117 → 4.0.0-beta.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/radioGroup.types-BWWTyhYq.js +2 -0
- package/dist/chunks/radioGroup.types-BWWTyhYq.js.map +1 -0
- package/dist/chunks/radioGroup.types-DINWHug_.js +227 -0
- package/dist/chunks/radioGroup.types-DINWHug_.js.map +1 -0
- package/dist/chunks/{theme.provider-4wzRpSmC.js → theme.provider-DqrVxdA-.js} +2 -2
- package/dist/chunks/{theme.provider-4wzRpSmC.js.map → theme.provider-DqrVxdA-.js.map} +1 -1
- package/dist/chunks/{theme.provider-Ko_Dr9p5.js → theme.provider-wySHNrYP.js} +95 -4
- package/dist/chunks/{theme.provider-Ko_Dr9p5.js.map → theme.provider-wySHNrYP.js.map} +1 -1
- package/dist/cjs/components/RadioGroup/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/esm/components/RadioGroup/index.js +3 -2
- package/dist/esm/components/index.js +55 -54
- package/dist/esm/index.js +75 -74
- package/dist/esm/theme/index.js +1 -1
- package/dist/types/components/RadioGroup/components/Radio/radio.component.d.ts +5 -3
- package/dist/types/components/RadioGroup/index.d.ts +1 -0
- package/dist/types/components/RadioGroup/radioGroup.component.d.ts +3 -9
- package/dist/types/components/RadioGroup/radioGroup.recipe.d.ts +8 -0
- package/dist/types/components/RadioGroup/radioGroup.types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/radioGroup.component-DLEnjQgU.js +0 -2
- package/dist/chunks/radioGroup.component-DLEnjQgU.js.map +0 -1
- package/dist/chunks/radioGroup.component-Df9hg6FA.js +0 -251
- package/dist/chunks/radioGroup.component-Df9hg6FA.js.map +0 -1
- package/dist/types/components/PinInput/pinInput.records.d.ts +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-BjDatQAs.js"),g=require("./withFormControl-ClG2Nbcf.js"),d=require("react"),L=require("./text.component-waIIFgwB.js"),H=require("./create-slot-recipe-context-IwVIgtBt.js"),v=require("./attr-BMs6szZx.js"),W=require("./empty-B5_AO6Pg.js"),V=require("./factory-D6tdBUPG.js"),F=require("./use-recipe-DaPWl_pL.js"),i=require("./use-locale-context-D0LByRu9.js"),k=require("./index-P9qG5HsO.js"),l=require("./index-CHIISuTq.js"),M=require("./buttonGroup.component-DzmuqXEs.js"),Y=require("./stack-BKu3hWEQ.js"),B=o=>o&&o.__esModule?o:{default:o},D=B(d),[E,R]=i.createContext({name:"RadioGroupContext",hookName:"useRadioGroupContext",providerName:"<RadioGroupProvider />"}),[O,J]=i.createContext({name:"RadioGroupItemContext",hookName:"useRadioGroupItemContext",providerName:"<RadioGroupItemProvider />"}),[K,I]=i.createContext({name:"RadioGroupItemPropsContext",hookName:"useRadioGroupItemPropsContext",providerName:"<RadioGroupItemPropsProvider />"}),b=d.forwardRef((o,e)=>{const[t,r]=i.createSplitProps()(o,["value","disabled","invalid"]),a=R(),n=l.mergeProps(a.getItemProps(t),r),u=a.getItemState(t);return s.jsxRuntimeExports.jsx(O,{value:u,children:s.jsxRuntimeExports.jsx(K,{value:t,children:s.jsxRuntimeExports.jsx(i.ark.label,{...n,ref:e})})})});b.displayName="RadioGroupItem";const Q=o=>o.children(J()),C=d.forwardRef((o,e)=>{const t=R(),r=I(),a=l.mergeProps(t.getItemControlProps(r),o);return s.jsxRuntimeExports.jsx(i.ark.div,{...a,ref:e})});C.displayName="RadioGroupItemControl";const y=d.forwardRef((o,e)=>{const t=R(),r=I(),a=l.mergeProps(t.getItemHiddenInputProps(r),o);return s.jsxRuntimeExports.jsx(i.ark.input,{...a,ref:e})});y.displayName="RadioGroupItemHiddenInput";const w=d.forwardRef((o,e)=>{const t=R(),r=I(),a=l.mergeProps(t.getItemTextProps(r),o);return s.jsxRuntimeExports.jsx(i.ark.span,{...a,ref:e})});w.displayName="RadioGroupItemText";const N=d.forwardRef((o,e)=>{const t=R(),r=l.mergeProps(t.getLabelProps(),o);return s.jsxRuntimeExports.jsx(i.ark.label,{...r,ref:e})});N.displayName="RadioGroupLabel";const U=o=>{const e=d.useId(),{getRootNode:t}=i.useEnvironmentContext(),{dir:r}=i.useLocaleContext(),a={id:e,dir:r,getRootNode:t,...o},n=i.useMachine(k.machine,a);return k.connect(n,i.normalizeProps)},_=d.forwardRef((o,e)=>{const[t,r]=i.createSplitProps()(o,["defaultValue","disabled","form","id","ids","name","onValueChange","orientation","readOnly","value"]),a=U(t),n=l.mergeProps(a.getRootProps(),r);return s.jsxRuntimeExports.jsx(E,{value:a,children:s.jsxRuntimeExports.jsx(i.ark.div,{...n,ref:e})})});_.displayName="RadioGroupRoot";const q=d.forwardRef((o,e)=>{const[{value:t},r]=i.createSplitProps()(o,["value"]),a=l.mergeProps(t.getRootProps(),r);return s.jsxRuntimeExports.jsx(E,{value:t,children:s.jsxRuntimeExports.jsx(i.ark.div,{...a,ref:e})})});q.displayName="RadioGroupRootProvider";const X=d.forwardRef(function(e,t){const r=F.useRecipe({key:"radiomark",recipe:e.recipe}),[a,n]=r.splitVariantProps(e),{checked:u,disabled:c,unstyled:m,children:x,...P}=n,j=m?W.EMPTY_STYLES:r(a),f={ref:t,"data-checked":v.dataAttr(u),"data-disabled":v.dataAttr(c),...P,css:[j,e.css]};return s.jsxRuntimeExports.jsx(V.chakra.span,{...f,children:u&&s.jsxRuntimeExports.jsx("span",{className:"dot"})})}),{withProvider:S,withContext:G,useStyles:Z}=H.createSlotRecipeContext({key:"radioGroup"});S(q,"root",{forwardAsChild:!0});const z=S(_,"root",{forwardAsChild:!0});G(N,"label",{forwardAsChild:!0});const oo=G(b,"item",{forwardAsChild:!0}),eo=G(w,"itemText",{forwardAsChild:!0});G(C,"itemControl",{forwardAsChild:!0});const to=d.forwardRef(function(e,t){const r=Z();return s.jsxRuntimeExports.jsx(Q,{children:a=>s.jsxRuntimeExports.jsx(C,{asChild:!0,children:s.jsxRuntimeExports.jsx(X,{ref:t,unstyled:!0,...e,checked:a.checked,disabled:a.disabled,css:[r.itemControl,e.css]})})})}),ro=y,T=D.default.forwardRef(({children:o,disabled:e=!1,invalid:t=!1,onContrast:r=!1,radioRef:a,radioType:n,rootRef:u,size:c="md",...m},x)=>s.jsxRuntimeExports.jsxs(oo,{className:"Radio","data-testid":"kibble-radio",invalid:t,disabled:e,ref:u,...m,children:[s.jsxRuntimeExports.jsx(ro,{className:"Radio__Input","data-testid":"kibble-radio-input",ref:a||x}),s.jsxRuntimeExports.jsx(to,{className:"Radio__Indicator","data-testid":"kibble-radio-indicator"}),o&&s.jsxRuntimeExports.jsx(eo,{className:"Radio__Text","data-testid":"kibble-radio-label",...n==="cards"&&typeof o!="string"&&{mt:"-4px"},children:typeof o=="string"?s.jsxRuntimeExports.jsx(L.WrappedText,{size:c,lineHeight:"unset",variant:r?"onContrast":"default",children:o}):o})]}));T.displayName="Radio";const so=g.withFormControl(T),A=({radios:o,defaultValue:e,direction:t="column",disabled:r,invalid:a,onContrast:n,onChange:u,size:c="md",radioType:m="default",value:x,gap:P=2,...j})=>{const f=n?"onContrast":"default";return s.jsxRuntimeExports.jsx(z,{className:"RadioGroup","data-testid":"kibble-radio-group",disabled:r,defaultValue:e,value:x,onValueChange:({value:p})=>u?.(p),size:c,variant:f,withCard:m==="cards",...j,children:m==="buttons"?s.jsxRuntimeExports.jsx(M.ButtonGroup,{onContrast:n,variant:"secondarySubtle",size:c,buttons:o.map((p,h)=>{const $=e===p.value||x===p.value;return{key:`button-radio-${h}`,children:p.children,active:$,disabled:r,onClick:()=>u?.(p.value)}})}):s.jsxRuntimeExports.jsx(Y.Stack,{gap:P,direction:t,children:o.map((p,h)=>s.jsxRuntimeExports.jsx(so,{invalid:a,disabled:r,size:c,radioType:m,onContrast:n,...t==="row"&&{fullWidth:!1},...p},`radio-${h}`))})})};A.displayName="RadioGroup";const ao=g.withFormControl(A),io=["default","buttons","cards"];exports.WrappedRadioGroup=ao;exports.radioTypes=io;
|
|
2
|
+
//# sourceMappingURL=radioGroup.types-BWWTyhYq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radioGroup.types-BWWTyhYq.js","sources":["../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-item-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-item-props-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-label.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root-provider.js","../../node_modules/@chakra-ui/react/dist/esm/components/radiomark/radiomark.js","../../node_modules/@chakra-ui/react/dist/esm/components/radio-group/radio-group.js","../../src/components/RadioGroup/components/Radio/radio.component.tsx","../../src/components/RadioGroup/radioGroup.component.tsx","../../src/components/RadioGroup/radioGroup.types.ts"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupProvider, useRadioGroupContext] = createContext({\n name: \"RadioGroupContext\",\n hookName: \"useRadioGroupContext\",\n providerName: \"<RadioGroupProvider />\"\n});\n\nexport { RadioGroupProvider, useRadioGroupContext };\n","'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupItemProvider, useRadioGroupItemContext] = createContext({\n name: \"RadioGroupItemContext\",\n hookName: \"useRadioGroupItemContext\",\n providerName: \"<RadioGroupItemProvider />\"\n});\n\nexport { RadioGroupItemProvider, useRadioGroupItemContext };\n","'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupItemPropsProvider, useRadioGroupItemPropsContext] = createContext({\n name: \"RadioGroupItemPropsContext\",\n hookName: \"useRadioGroupItemPropsContext\",\n providerName: \"<RadioGroupItemPropsProvider />\"\n});\n\nexport { RadioGroupItemPropsProvider, useRadioGroupItemPropsContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { RadioGroupItemProvider } from './use-radio-group-item-context.js';\nimport { RadioGroupItemPropsProvider } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItem = forwardRef((props, ref) => {\n const [itemProps, localProps] = createSplitProps()(props, [\"value\", \"disabled\", \"invalid\"]);\n const radioGroup = useRadioGroupContext();\n const mergedProps = mergeProps(radioGroup.getItemProps(itemProps), localProps);\n const itemState = radioGroup.getItemState(itemProps);\n return /* @__PURE__ */ jsx(RadioGroupItemProvider, { value: itemState, children: /* @__PURE__ */ jsx(RadioGroupItemPropsProvider, { value: itemProps, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) }) });\n});\nRadioGroupItem.displayName = \"RadioGroupItem\";\n\nexport { RadioGroupItem };\n","'use client';\nimport { useRadioGroupItemContext } from './use-radio-group-item-context.js';\n\nconst RadioGroupItemContext = (props) => props.children(useRadioGroupItemContext());\n\nexport { RadioGroupItemContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemControl = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemControlProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });\n});\nRadioGroupItemControl.displayName = \"RadioGroupItemControl\";\n\nexport { RadioGroupItemControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemHiddenInput = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemHiddenInputProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nRadioGroupItemHiddenInput.displayName = \"RadioGroupItemHiddenInput\";\n\nexport { RadioGroupItemHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemText = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemTextProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nRadioGroupItemText.displayName = \"RadioGroupItemText\";\n\nexport { RadioGroupItemText };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\n\nconst RadioGroupLabel = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const mergedProps = mergeProps(radioGroup.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref });\n});\nRadioGroupLabel.displayName = \"RadioGroupLabel\";\n\nexport { RadioGroupLabel };\n","'use client';\nimport * as radio from '@zag-js/radio-group';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\n\nconst useRadioGroup = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const machineProps = {\n id,\n dir,\n getRootNode,\n ...props\n };\n const service = useMachine(radio.machine, machineProps);\n return radio.connect(service, normalizeProps);\n};\n\nexport { useRadioGroup };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useRadioGroup } from './use-radio-group.js';\nimport { RadioGroupProvider } from './use-radio-group-context.js';\n\nconst RadioGroupRoot = forwardRef((props, ref) => {\n const [useRadioGroupProps, localProps] = createSplitProps()(props, [\n \"defaultValue\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"name\",\n \"onValueChange\",\n \"orientation\",\n \"readOnly\",\n \"value\"\n ]);\n const radioGroup = useRadioGroup(useRadioGroupProps);\n const mergedProps = mergeProps(radioGroup.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { value: radioGroup, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });\n});\nRadioGroupRoot.displayName = \"RadioGroupRoot\";\n\nexport { RadioGroupRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { RadioGroupProvider } from './use-radio-group-context.js';\n\nconst RadioGroupRootProvider = forwardRef((props, ref) => {\n const [{ value: radioGroup }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(radioGroup.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { value: radioGroup, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });\n});\nRadioGroupRootProvider.displayName = \"RadioGroupRootProvider\";\n\nexport { RadioGroupRootProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { EMPTY_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst Radiomark = forwardRef(\n function Radiomark2(props, ref) {\n const recipe = useRecipe({ key: \"radiomark\", recipe: props.recipe });\n const [variantProps, restProps] = recipe.splitVariantProps(props);\n const { checked, disabled, unstyled, children, ...rest } = restProps;\n const styles = unstyled ? EMPTY_STYLES : recipe(variantProps);\n const sharedProps = {\n ref,\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(disabled),\n ...rest,\n css: [styles, props.css]\n };\n return /* @__PURE__ */ jsx(chakra.span, { ...sharedProps, children: checked && /* @__PURE__ */ jsx(\"span\", { className: \"dot\" }) });\n }\n);\n\nexport { Radiomark };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { RadioGroup } from '@ark-ui/react/radio-group';\nimport { forwardRef } from 'react';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { Radiomark } from '../radiomark/radiomark.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useRadioGroupStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"radioGroup\" });\nconst RadioGroupRootProvider = withProvider(RadioGroup.RootProvider, \"root\", { forwardAsChild: true });\nconst RadioGroupRoot = withProvider(\n RadioGroup.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst RadioGroupPropsProvider = PropsProvider;\nconst RadioGroupLabel = withContext(RadioGroup.Label, \"label\", { forwardAsChild: true });\nconst RadioGroupItem = withContext(\n RadioGroup.Item,\n \"item\",\n { forwardAsChild: true }\n);\nconst RadioGroupItemText = withContext(RadioGroup.ItemText, \"itemText\", { forwardAsChild: true });\nconst RadioGroupItemControl = withContext(RadioGroup.ItemControl, \"itemControl\", { forwardAsChild: true });\nconst RadioGroupItemIndicator = forwardRef(function RadioGroupItemIndicator2(props, ref) {\n const styles = useRadioGroupStyles();\n return /* @__PURE__ */ jsx(RadioGroup.ItemContext, { children: (itemState) => /* @__PURE__ */ jsx(RadioGroup.ItemControl, { asChild: true, children: /* @__PURE__ */ jsx(\n Radiomark,\n {\n ref,\n unstyled: true,\n ...props,\n checked: itemState.checked,\n disabled: itemState.disabled,\n css: [styles[\"itemControl\"], props.css]\n }\n ) }) });\n});\nconst RadioGroupContext = RadioGroup.Context;\nconst RadioGroupItemContext = RadioGroup.ItemContext;\nconst RadioGroupItemHiddenInput = RadioGroup.ItemHiddenInput;\n\nexport { RadioGroupContext, RadioGroupItem, RadioGroupItemContext, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemIndicator, RadioGroupItemText, RadioGroupLabel, RadioGroupPropsProvider, RadioGroupRoot, RadioGroupRootProvider, useRadioGroupStyles };\n","import React from 'react';\nimport { RadioGroup } from '@chakra-ui/react/radio-group';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Text } from 'components/Text/text.component';\nimport { RadioType } from 'components/RadioGroup/radioGroup.types';\n\nexport interface RadioProps extends WithFormControlProps, RadioGroup.ItemProps {\n onContrast?: boolean;\n radioRef?: React.Ref<HTMLInputElement | null>;\n rootRef?: React.Ref<HTMLDivElement | null>;\n size?: FormControlSize;\n}\n\ninterface InternalRadioProps extends RadioProps {\n radioType?: RadioType;\n}\n\nconst Radio = React.forwardRef<HTMLInputElement, InternalRadioProps>(\n (\n {\n children,\n disabled = false,\n invalid = false,\n onContrast = false,\n radioRef,\n radioType,\n rootRef,\n size = 'md',\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n return (\n <RadioGroup.Item\n className=\"Radio\"\n data-testid=\"kibble-radio\"\n invalid={invalid}\n disabled={disabled}\n ref={rootRef}\n {...rest}\n >\n <RadioGroup.ItemHiddenInput className=\"Radio__Input\" data-testid=\"kibble-radio-input\" ref={radioRef || ref} />\n <RadioGroup.ItemIndicator className=\"Radio__Indicator\" data-testid=\"kibble-radio-indicator\" />\n {children && (\n <RadioGroup.ItemText\n className=\"Radio__Text\"\n data-testid=\"kibble-radio-label\"\n {...(radioType === 'cards' && typeof children !== 'string' && { mt: '-4px' })}\n >\n {typeof children === 'string' ? (\n <Text size={size} lineHeight=\"unset\" variant={onContrast ? 'onContrast' : 'default'}>\n {children}\n </Text>\n ) : (\n children\n )}\n </RadioGroup.ItemText>\n )}\n </RadioGroup.Item>\n );\n },\n);\n\nRadio.displayName = 'Radio';\nconst WrappedRadio = withFormControl<InternalRadioProps>(Radio);\n\nexport { WrappedRadio as Radio };\n","import React from 'react';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Radio, RadioProps } from './components/Radio/radio.component';\nimport { RadioGroup as CRadioGroup } from '@chakra-ui/react/radio-group';\nimport { Stack } from '@chakra-ui/react/stack';\nimport { ConditionalValue } from '@chakra-ui/react/styled-system';\nimport { FlexDirection } from 'shared/types/alignment';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { ButtonGroup } from 'components/ButtonGroup';\nimport { RadioType } from './radioGroup.types';\n\nexport interface RadioGroupProps\n extends WithFormControlProps,\n Omit<CRadioGroup.RootProps, 'onValueChange' | 'onChange'> {\n direction?: ConditionalValue<FlexDirection>;\n onChange?: (value: string | null) => void;\n size?: FormControlSize;\n radioType?: RadioType;\n radios: RadioProps[];\n}\n\nconst RadioGroup = ({\n radios,\n defaultValue,\n direction = 'column',\n disabled,\n invalid,\n onContrast,\n onChange,\n size = 'md',\n radioType = 'default',\n value,\n gap = 2,\n ...rest\n}: RadioGroupProps): React.JSX.Element => {\n const _computedVariant = onContrast ? 'onContrast' : 'default';\n return (\n <CRadioGroup.Root\n className=\"RadioGroup\"\n data-testid=\"kibble-radio-group\"\n disabled={disabled}\n defaultValue={defaultValue}\n value={value}\n onValueChange={({ value }) => onChange?.(value)}\n size={size}\n variant={_computedVariant}\n withCard={radioType === 'cards'}\n {...rest}\n >\n {radioType === 'buttons' ? (\n <ButtonGroup\n onContrast={onContrast}\n variant=\"secondarySubtle\"\n size={size}\n buttons={radios.map((radio, index) => {\n const active = defaultValue === radio.value || value === radio.value;\n return {\n key: `button-radio-${index}`,\n children: radio.children,\n active,\n disabled,\n onClick: () => onChange?.(radio.value),\n };\n })}\n />\n ) : (\n <Stack gap={gap} direction={direction}>\n {radios.map((radio, index) => (\n <Radio\n key={`radio-${index}`}\n invalid={invalid}\n disabled={disabled}\n size={size}\n radioType={radioType}\n onContrast={onContrast}\n {...(direction === 'row' && { fullWidth: false })}\n {...radio}\n />\n ))}\n </Stack>\n )}\n </CRadioGroup.Root>\n );\n};\n\nRadioGroup.displayName = 'RadioGroup';\nconst WrappedRadioGroup = withFormControl(RadioGroup);\n\nexport { WrappedRadioGroup as RadioGroup };\n","export const radioTypes = ['default', 'buttons', 'cards'] as const;\nexport type RadioType = (typeof radioTypes)[number];\n"],"names":["RadioGroupProvider","useRadioGroupContext","createContext","RadioGroupItemProvider","useRadioGroupItemContext","RadioGroupItemPropsProvider","useRadioGroupItemPropsContext","RadioGroupItem","forwardRef","props","ref","itemProps","localProps","createSplitProps","radioGroup","mergedProps","mergeProps","itemState","jsx","ark","RadioGroupItemContext","RadioGroupItemControl","RadioGroupItemHiddenInput","RadioGroupItemText","RadioGroupLabel","useRadioGroup","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","radio.machine","radio.connect","normalizeProps","RadioGroupRoot","useRadioGroupProps","RadioGroupRootProvider","Radiomark","recipe","useRecipe","variantProps","restProps","checked","disabled","unstyled","children","rest","styles","EMPTY_STYLES","sharedProps","dataAttr","chakra","withProvider","withContext","useRadioGroupStyles","createSlotRecipeContext","RadioGroup.RootProvider","RadioGroup.Root","RadioGroup.Label","RadioGroup.Item","RadioGroup.ItemText","RadioGroup.ItemControl","RadioGroupItemIndicator","RadioGroup.ItemContext","RadioGroup.ItemHiddenInput","Radio","React","invalid","onContrast","radioRef","radioType","rootRef","size","jsxs","RadioGroup.ItemIndicator","Text","WrappedRadio","withFormControl","RadioGroup","radios","defaultValue","direction","onChange","value","gap","_computedVariant","CRadioGroup.Root","ButtonGroup","radio","index","active","Stack","WrappedRadioGroup","radioTypes"],"mappings":"8kBAGM,CAACA,EAAoBC,CAAoB,EAAIC,gBAAc,CAC/D,KAAM,oBACN,SAAU,uBACV,aAAc,wBAChB,CAAC,ECJK,CAACC,EAAwBC,CAAwB,EAAIF,gBAAc,CACvE,KAAM,wBACN,SAAU,2BACV,aAAc,4BAChB,CAAC,ECJK,CAACG,EAA6BC,CAA6B,EAAIJ,gBAAc,CACjF,KAAM,6BACN,SAAU,gCACV,aAAc,iCAChB,CAAC,ECGKK,EAAiBC,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAChD,KAAM,CAACC,EAAWC,CAAU,EAAIC,EAAgB,iBAAA,EAAGJ,EAAO,CAAC,QAAS,WAAY,SAAS,CAAC,EACpFK,EAAab,EAAsB,EACnCc,EAAcC,EAAAA,WAAWF,EAAW,aAAaH,CAAS,EAAGC,CAAU,EACvEK,EAAYH,EAAW,aAAaH,CAAS,EACnD,OAAuBO,EAAG,kBAAA,IAACf,EAAwB,CAAE,MAAOc,EAAW,SAA0BC,EAAAA,kBAAAA,IAAIb,EAA6B,CAAE,MAAOM,EAAW,SAA0BO,EAAAA,kBAAAA,IAAIC,EAAG,IAAC,MAAO,CAAE,GAAGJ,EAAa,IAAAL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0C,CAClC,MAAAuC,EAAmBjB,EAAa,aAAe,UAEnD,OAAAtD,EAAA,kBAAA,IAACwE,EAAA,CACC,UAAU,aACV,cAAY,qBACZ,SAAA3C,EACA,aAAAqC,EACA,MAAAG,EACA,cAAe,CAAC,CAAE,MAAAA,CAAM,IAAMD,IAAWC,CAAK,EAC9C,KAAAX,EACA,QAASa,EACT,SAAUf,IAAc,QACvB,GAAGxB,EAEH,aAAc,UACbhC,EAAA,kBAAA,IAACyE,EAAA,YAAA,CACC,WAAAnB,EACA,QAAQ,kBACR,KAAAI,EACA,QAASO,EAAO,IAAI,CAACS,EAAOC,IAAU,CACpC,MAAMC,EAASV,IAAiBQ,EAAM,OAASL,IAAUK,EAAM,MACxD,MAAA,CACL,IAAK,gBAAgBC,CAAK,GAC1B,SAAUD,EAAM,SAChB,OAAAE,EACA,SAAA/C,EACA,QAAS,IAAMuC,IAAWM,EAAM,KAAK,CACvC,CACD,CAAA,CAAA,CACH,0BAECG,EAAAA,MAAM,CAAA,IAAAP,EAAU,UAAAH,EACd,SAAOF,EAAA,IAAI,CAACS,EAAOC,IAClB3E,EAAA,kBAAA,IAACmD,GAAA,CAEC,QAAAE,EACA,SAAAxB,EACA,KAAA6B,EACA,UAAAF,EACA,WAAAF,EACC,GAAIa,IAAc,OAAS,CAAE,UAAW,EAAM,EAC9C,GAAGO,CAAA,EAPC,SAASC,CAAK,EAAA,CAStB,CACH,CAAA,CAAA,CAEJ,CAEJ,EAEAX,EAAW,YAAc,aACnB,MAAAc,GAAoBf,kBAAgBC,CAAU,ECtFvCe,GAAa,CAAC,UAAW,UAAW,OAAO","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13]}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { w as g } from "./withFormControl-D0tbS4T0.js";
|
|
3
|
+
import E, { forwardRef as n, useId as V } from "react";
|
|
4
|
+
import { W as B } from "./text.component-BthmuMFV.js";
|
|
5
|
+
import { c as M } from "./create-slot-recipe-context-BJmsuxih.js";
|
|
6
|
+
import { d as k } from "./attr-sm10PXOd.js";
|
|
7
|
+
import { a as Y } from "./empty-BU2EAux9.js";
|
|
8
|
+
import { c as F } from "./factory-Ctbv0Ozn.js";
|
|
9
|
+
import { u as O } from "./use-recipe-d63ABaZ3.js";
|
|
10
|
+
import { c as v, a as C, f as m, i as q, j as D, k as J, n as K } from "./use-locale-context-BA2M-8sK.js";
|
|
11
|
+
import { m as Q, c as U } from "./index-CjxarSH6.js";
|
|
12
|
+
import { a1 as l } from "./index-1syExFDc.js";
|
|
13
|
+
import { B as X } from "./buttonGroup.component-aBdWtwRc.js";
|
|
14
|
+
import { S as Z } from "./stack-Dnuh5Zgf.js";
|
|
15
|
+
const [N, G] = v({
|
|
16
|
+
name: "RadioGroupContext",
|
|
17
|
+
hookName: "useRadioGroupContext",
|
|
18
|
+
providerName: "<RadioGroupProvider />"
|
|
19
|
+
}), [z, oo] = v({
|
|
20
|
+
name: "RadioGroupItemContext",
|
|
21
|
+
hookName: "useRadioGroupItemContext",
|
|
22
|
+
providerName: "<RadioGroupItemProvider />"
|
|
23
|
+
}), [to, j] = v({
|
|
24
|
+
name: "RadioGroupItemPropsContext",
|
|
25
|
+
hookName: "useRadioGroupItemPropsContext",
|
|
26
|
+
providerName: "<RadioGroupItemPropsProvider />"
|
|
27
|
+
}), y = n((o, t) => {
|
|
28
|
+
const [e, r] = C()(o, ["value", "disabled", "invalid"]), s = G(), i = l(s.getItemProps(e), r), d = s.getItemState(e);
|
|
29
|
+
return /* @__PURE__ */ a.jsx(z, { value: d, children: /* @__PURE__ */ a.jsx(to, { value: e, children: /* @__PURE__ */ a.jsx(m.label, { ...i, ref: t }) }) });
|
|
30
|
+
});
|
|
31
|
+
y.displayName = "RadioGroupItem";
|
|
32
|
+
const eo = (o) => o.children(oo()), b = n((o, t) => {
|
|
33
|
+
const e = G(), r = j(), s = l(e.getItemControlProps(r), o);
|
|
34
|
+
return /* @__PURE__ */ a.jsx(m.div, { ...s, ref: t });
|
|
35
|
+
});
|
|
36
|
+
b.displayName = "RadioGroupItemControl";
|
|
37
|
+
const w = n((o, t) => {
|
|
38
|
+
const e = G(), r = j(), s = l(e.getItemHiddenInputProps(r), o);
|
|
39
|
+
return /* @__PURE__ */ a.jsx(m.input, { ...s, ref: t });
|
|
40
|
+
});
|
|
41
|
+
w.displayName = "RadioGroupItemHiddenInput";
|
|
42
|
+
const S = n((o, t) => {
|
|
43
|
+
const e = G(), r = j(), s = l(e.getItemTextProps(r), o);
|
|
44
|
+
return /* @__PURE__ */ a.jsx(m.span, { ...s, ref: t });
|
|
45
|
+
});
|
|
46
|
+
S.displayName = "RadioGroupItemText";
|
|
47
|
+
const _ = n((o, t) => {
|
|
48
|
+
const e = G(), r = l(e.getLabelProps(), o);
|
|
49
|
+
return /* @__PURE__ */ a.jsx(m.label, { ...r, ref: t });
|
|
50
|
+
});
|
|
51
|
+
_.displayName = "RadioGroupLabel";
|
|
52
|
+
const ro = (o) => {
|
|
53
|
+
const t = V(), { getRootNode: e } = q(), { dir: r } = D(), s = {
|
|
54
|
+
id: t,
|
|
55
|
+
dir: r,
|
|
56
|
+
getRootNode: e,
|
|
57
|
+
...o
|
|
58
|
+
}, i = J(Q, s);
|
|
59
|
+
return U(i, K);
|
|
60
|
+
}, T = n((o, t) => {
|
|
61
|
+
const [e, r] = C()(o, [
|
|
62
|
+
"defaultValue",
|
|
63
|
+
"disabled",
|
|
64
|
+
"form",
|
|
65
|
+
"id",
|
|
66
|
+
"ids",
|
|
67
|
+
"name",
|
|
68
|
+
"onValueChange",
|
|
69
|
+
"orientation",
|
|
70
|
+
"readOnly",
|
|
71
|
+
"value"
|
|
72
|
+
]), s = ro(e), i = l(s.getRootProps(), r);
|
|
73
|
+
return /* @__PURE__ */ a.jsx(N, { value: s, children: /* @__PURE__ */ a.jsx(m.div, { ...i, ref: t }) });
|
|
74
|
+
});
|
|
75
|
+
T.displayName = "RadioGroupRoot";
|
|
76
|
+
const A = n((o, t) => {
|
|
77
|
+
const [{ value: e }, r] = C()(o, ["value"]), s = l(e.getRootProps(), r);
|
|
78
|
+
return /* @__PURE__ */ a.jsx(N, { value: e, children: /* @__PURE__ */ a.jsx(m.div, { ...s, ref: t }) });
|
|
79
|
+
});
|
|
80
|
+
A.displayName = "RadioGroupRootProvider";
|
|
81
|
+
const ao = n(
|
|
82
|
+
function(t, e) {
|
|
83
|
+
const r = O({ key: "radiomark", recipe: t.recipe }), [s, i] = r.splitVariantProps(t), { checked: d, disabled: u, unstyled: c, children: R, ...P } = i, f = c ? Y : r(s), I = {
|
|
84
|
+
ref: e,
|
|
85
|
+
"data-checked": k(d),
|
|
86
|
+
"data-disabled": k(u),
|
|
87
|
+
...P,
|
|
88
|
+
css: [f, t.css]
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ a.jsx(F.span, { ...I, children: d && /* @__PURE__ */ a.jsx("span", { className: "dot" }) });
|
|
91
|
+
}
|
|
92
|
+
), {
|
|
93
|
+
withProvider: W,
|
|
94
|
+
withContext: x,
|
|
95
|
+
useStyles: so
|
|
96
|
+
} = M({ key: "radioGroup" });
|
|
97
|
+
W(A, "root", { forwardAsChild: !0 });
|
|
98
|
+
const io = W(
|
|
99
|
+
T,
|
|
100
|
+
"root",
|
|
101
|
+
{ forwardAsChild: !0 }
|
|
102
|
+
);
|
|
103
|
+
x(_, "label", { forwardAsChild: !0 });
|
|
104
|
+
const no = x(
|
|
105
|
+
y,
|
|
106
|
+
"item",
|
|
107
|
+
{ forwardAsChild: !0 }
|
|
108
|
+
), po = x(S, "itemText", { forwardAsChild: !0 });
|
|
109
|
+
x(b, "itemControl", { forwardAsChild: !0 });
|
|
110
|
+
const uo = n(function(t, e) {
|
|
111
|
+
const r = so();
|
|
112
|
+
return /* @__PURE__ */ a.jsx(eo, { children: (s) => /* @__PURE__ */ a.jsx(b, { asChild: !0, children: /* @__PURE__ */ a.jsx(
|
|
113
|
+
ao,
|
|
114
|
+
{
|
|
115
|
+
ref: e,
|
|
116
|
+
unstyled: !0,
|
|
117
|
+
...t,
|
|
118
|
+
checked: s.checked,
|
|
119
|
+
disabled: s.disabled,
|
|
120
|
+
css: [r.itemControl, t.css]
|
|
121
|
+
}
|
|
122
|
+
) }) });
|
|
123
|
+
}), co = w, $ = E.forwardRef(
|
|
124
|
+
({
|
|
125
|
+
children: o,
|
|
126
|
+
disabled: t = !1,
|
|
127
|
+
invalid: e = !1,
|
|
128
|
+
onContrast: r = !1,
|
|
129
|
+
radioRef: s,
|
|
130
|
+
radioType: i,
|
|
131
|
+
rootRef: d,
|
|
132
|
+
size: u = "md",
|
|
133
|
+
...c
|
|
134
|
+
}, R) => /* @__PURE__ */ a.jsxs(
|
|
135
|
+
no,
|
|
136
|
+
{
|
|
137
|
+
className: "Radio",
|
|
138
|
+
"data-testid": "kibble-radio",
|
|
139
|
+
invalid: e,
|
|
140
|
+
disabled: t,
|
|
141
|
+
ref: d,
|
|
142
|
+
...c,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ a.jsx(co, { className: "Radio__Input", "data-testid": "kibble-radio-input", ref: s || R }),
|
|
145
|
+
/* @__PURE__ */ a.jsx(uo, { className: "Radio__Indicator", "data-testid": "kibble-radio-indicator" }),
|
|
146
|
+
o && /* @__PURE__ */ a.jsx(
|
|
147
|
+
po,
|
|
148
|
+
{
|
|
149
|
+
className: "Radio__Text",
|
|
150
|
+
"data-testid": "kibble-radio-label",
|
|
151
|
+
...i === "cards" && typeof o != "string" && { mt: "-4px" },
|
|
152
|
+
children: typeof o == "string" ? /* @__PURE__ */ a.jsx(B, { size: u, lineHeight: "unset", variant: r ? "onContrast" : "default", children: o }) : o
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
$.displayName = "Radio";
|
|
160
|
+
const mo = g($), H = ({
|
|
161
|
+
radios: o,
|
|
162
|
+
defaultValue: t,
|
|
163
|
+
direction: e = "column",
|
|
164
|
+
disabled: r,
|
|
165
|
+
invalid: s,
|
|
166
|
+
onContrast: i,
|
|
167
|
+
onChange: d,
|
|
168
|
+
size: u = "md",
|
|
169
|
+
radioType: c = "default",
|
|
170
|
+
value: R,
|
|
171
|
+
gap: P = 2,
|
|
172
|
+
...f
|
|
173
|
+
}) => {
|
|
174
|
+
const I = i ? "onContrast" : "default";
|
|
175
|
+
return /* @__PURE__ */ a.jsx(
|
|
176
|
+
io,
|
|
177
|
+
{
|
|
178
|
+
className: "RadioGroup",
|
|
179
|
+
"data-testid": "kibble-radio-group",
|
|
180
|
+
disabled: r,
|
|
181
|
+
defaultValue: t,
|
|
182
|
+
value: R,
|
|
183
|
+
onValueChange: ({ value: p }) => d?.(p),
|
|
184
|
+
size: u,
|
|
185
|
+
variant: I,
|
|
186
|
+
withCard: c === "cards",
|
|
187
|
+
...f,
|
|
188
|
+
children: c === "buttons" ? /* @__PURE__ */ a.jsx(
|
|
189
|
+
X,
|
|
190
|
+
{
|
|
191
|
+
onContrast: i,
|
|
192
|
+
variant: "secondarySubtle",
|
|
193
|
+
size: u,
|
|
194
|
+
buttons: o.map((p, h) => {
|
|
195
|
+
const L = t === p.value || R === p.value;
|
|
196
|
+
return {
|
|
197
|
+
key: `button-radio-${h}`,
|
|
198
|
+
children: p.children,
|
|
199
|
+
active: L,
|
|
200
|
+
disabled: r,
|
|
201
|
+
onClick: () => d?.(p.value)
|
|
202
|
+
};
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
) : /* @__PURE__ */ a.jsx(Z, { gap: P, direction: e, children: o.map((p, h) => /* @__PURE__ */ a.jsx(
|
|
206
|
+
mo,
|
|
207
|
+
{
|
|
208
|
+
invalid: s,
|
|
209
|
+
disabled: r,
|
|
210
|
+
size: u,
|
|
211
|
+
radioType: c,
|
|
212
|
+
onContrast: i,
|
|
213
|
+
...e === "row" && { fullWidth: !1 },
|
|
214
|
+
...p
|
|
215
|
+
},
|
|
216
|
+
`radio-${h}`
|
|
217
|
+
)) })
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
H.displayName = "RadioGroup";
|
|
222
|
+
const No = g(H), yo = ["default", "buttons", "cards"];
|
|
223
|
+
export {
|
|
224
|
+
No as W,
|
|
225
|
+
yo as r
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=radioGroup.types-DINWHug_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radioGroup.types-DINWHug_.js","sources":["../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-item-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group-item-props-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-context.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-label.js","../../node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root.js","../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root-provider.js","../../node_modules/@chakra-ui/react/dist/esm/components/radiomark/radiomark.js","../../node_modules/@chakra-ui/react/dist/esm/components/radio-group/radio-group.js","../../src/components/RadioGroup/components/Radio/radio.component.tsx","../../src/components/RadioGroup/radioGroup.component.tsx","../../src/components/RadioGroup/radioGroup.types.ts"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupProvider, useRadioGroupContext] = createContext({\n name: \"RadioGroupContext\",\n hookName: \"useRadioGroupContext\",\n providerName: \"<RadioGroupProvider />\"\n});\n\nexport { RadioGroupProvider, useRadioGroupContext };\n","'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupItemProvider, useRadioGroupItemContext] = createContext({\n name: \"RadioGroupItemContext\",\n hookName: \"useRadioGroupItemContext\",\n providerName: \"<RadioGroupItemProvider />\"\n});\n\nexport { RadioGroupItemProvider, useRadioGroupItemContext };\n","'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [RadioGroupItemPropsProvider, useRadioGroupItemPropsContext] = createContext({\n name: \"RadioGroupItemPropsContext\",\n hookName: \"useRadioGroupItemPropsContext\",\n providerName: \"<RadioGroupItemPropsProvider />\"\n});\n\nexport { RadioGroupItemPropsProvider, useRadioGroupItemPropsContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { RadioGroupItemProvider } from './use-radio-group-item-context.js';\nimport { RadioGroupItemPropsProvider } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItem = forwardRef((props, ref) => {\n const [itemProps, localProps] = createSplitProps()(props, [\"value\", \"disabled\", \"invalid\"]);\n const radioGroup = useRadioGroupContext();\n const mergedProps = mergeProps(radioGroup.getItemProps(itemProps), localProps);\n const itemState = radioGroup.getItemState(itemProps);\n return /* @__PURE__ */ jsx(RadioGroupItemProvider, { value: itemState, children: /* @__PURE__ */ jsx(RadioGroupItemPropsProvider, { value: itemProps, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) }) });\n});\nRadioGroupItem.displayName = \"RadioGroupItem\";\n\nexport { RadioGroupItem };\n","'use client';\nimport { useRadioGroupItemContext } from './use-radio-group-item-context.js';\n\nconst RadioGroupItemContext = (props) => props.children(useRadioGroupItemContext());\n\nexport { RadioGroupItemContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemControl = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemControlProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });\n});\nRadioGroupItemControl.displayName = \"RadioGroupItemControl\";\n\nexport { RadioGroupItemControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemHiddenInput = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemHiddenInputProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nRadioGroupItemHiddenInput.displayName = \"RadioGroupItemHiddenInput\";\n\nexport { RadioGroupItemHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\nimport { useRadioGroupItemPropsContext } from './use-radio-group-item-props-context.js';\n\nconst RadioGroupItemText = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const itemProps = useRadioGroupItemPropsContext();\n const mergedProps = mergeProps(radioGroup.getItemTextProps(itemProps), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nRadioGroupItemText.displayName = \"RadioGroupItemText\";\n\nexport { RadioGroupItemText };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useRadioGroupContext } from './use-radio-group-context.js';\n\nconst RadioGroupLabel = forwardRef((props, ref) => {\n const radioGroup = useRadioGroupContext();\n const mergedProps = mergeProps(radioGroup.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref });\n});\nRadioGroupLabel.displayName = \"RadioGroupLabel\";\n\nexport { RadioGroupLabel };\n","'use client';\nimport * as radio from '@zag-js/radio-group';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\n\nconst useRadioGroup = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const machineProps = {\n id,\n dir,\n getRootNode,\n ...props\n };\n const service = useMachine(radio.machine, machineProps);\n return radio.connect(service, normalizeProps);\n};\n\nexport { useRadioGroup };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useRadioGroup } from './use-radio-group.js';\nimport { RadioGroupProvider } from './use-radio-group-context.js';\n\nconst RadioGroupRoot = forwardRef((props, ref) => {\n const [useRadioGroupProps, localProps] = createSplitProps()(props, [\n \"defaultValue\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"name\",\n \"onValueChange\",\n \"orientation\",\n \"readOnly\",\n \"value\"\n ]);\n const radioGroup = useRadioGroup(useRadioGroupProps);\n const mergedProps = mergeProps(radioGroup.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { value: radioGroup, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });\n});\nRadioGroupRoot.displayName = \"RadioGroupRoot\";\n\nexport { RadioGroupRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { RadioGroupProvider } from './use-radio-group-context.js';\n\nconst RadioGroupRootProvider = forwardRef((props, ref) => {\n const [{ value: radioGroup }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(radioGroup.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { value: radioGroup, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });\n});\nRadioGroupRootProvider.displayName = \"RadioGroupRootProvider\";\n\nexport { RadioGroupRootProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { EMPTY_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst Radiomark = forwardRef(\n function Radiomark2(props, ref) {\n const recipe = useRecipe({ key: \"radiomark\", recipe: props.recipe });\n const [variantProps, restProps] = recipe.splitVariantProps(props);\n const { checked, disabled, unstyled, children, ...rest } = restProps;\n const styles = unstyled ? EMPTY_STYLES : recipe(variantProps);\n const sharedProps = {\n ref,\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(disabled),\n ...rest,\n css: [styles, props.css]\n };\n return /* @__PURE__ */ jsx(chakra.span, { ...sharedProps, children: checked && /* @__PURE__ */ jsx(\"span\", { className: \"dot\" }) });\n }\n);\n\nexport { Radiomark };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { RadioGroup } from '@ark-ui/react/radio-group';\nimport { forwardRef } from 'react';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { Radiomark } from '../radiomark/radiomark.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useRadioGroupStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"radioGroup\" });\nconst RadioGroupRootProvider = withProvider(RadioGroup.RootProvider, \"root\", { forwardAsChild: true });\nconst RadioGroupRoot = withProvider(\n RadioGroup.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst RadioGroupPropsProvider = PropsProvider;\nconst RadioGroupLabel = withContext(RadioGroup.Label, \"label\", { forwardAsChild: true });\nconst RadioGroupItem = withContext(\n RadioGroup.Item,\n \"item\",\n { forwardAsChild: true }\n);\nconst RadioGroupItemText = withContext(RadioGroup.ItemText, \"itemText\", { forwardAsChild: true });\nconst RadioGroupItemControl = withContext(RadioGroup.ItemControl, \"itemControl\", { forwardAsChild: true });\nconst RadioGroupItemIndicator = forwardRef(function RadioGroupItemIndicator2(props, ref) {\n const styles = useRadioGroupStyles();\n return /* @__PURE__ */ jsx(RadioGroup.ItemContext, { children: (itemState) => /* @__PURE__ */ jsx(RadioGroup.ItemControl, { asChild: true, children: /* @__PURE__ */ jsx(\n Radiomark,\n {\n ref,\n unstyled: true,\n ...props,\n checked: itemState.checked,\n disabled: itemState.disabled,\n css: [styles[\"itemControl\"], props.css]\n }\n ) }) });\n});\nconst RadioGroupContext = RadioGroup.Context;\nconst RadioGroupItemContext = RadioGroup.ItemContext;\nconst RadioGroupItemHiddenInput = RadioGroup.ItemHiddenInput;\n\nexport { RadioGroupContext, RadioGroupItem, RadioGroupItemContext, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemIndicator, RadioGroupItemText, RadioGroupLabel, RadioGroupPropsProvider, RadioGroupRoot, RadioGroupRootProvider, useRadioGroupStyles };\n","import React from 'react';\nimport { RadioGroup } from '@chakra-ui/react/radio-group';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Text } from 'components/Text/text.component';\nimport { RadioType } from 'components/RadioGroup/radioGroup.types';\n\nexport interface RadioProps extends WithFormControlProps, RadioGroup.ItemProps {\n onContrast?: boolean;\n radioRef?: React.Ref<HTMLInputElement | null>;\n rootRef?: React.Ref<HTMLDivElement | null>;\n size?: FormControlSize;\n}\n\ninterface InternalRadioProps extends RadioProps {\n radioType?: RadioType;\n}\n\nconst Radio = React.forwardRef<HTMLInputElement, InternalRadioProps>(\n (\n {\n children,\n disabled = false,\n invalid = false,\n onContrast = false,\n radioRef,\n radioType,\n rootRef,\n size = 'md',\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n return (\n <RadioGroup.Item\n className=\"Radio\"\n data-testid=\"kibble-radio\"\n invalid={invalid}\n disabled={disabled}\n ref={rootRef}\n {...rest}\n >\n <RadioGroup.ItemHiddenInput className=\"Radio__Input\" data-testid=\"kibble-radio-input\" ref={radioRef || ref} />\n <RadioGroup.ItemIndicator className=\"Radio__Indicator\" data-testid=\"kibble-radio-indicator\" />\n {children && (\n <RadioGroup.ItemText\n className=\"Radio__Text\"\n data-testid=\"kibble-radio-label\"\n {...(radioType === 'cards' && typeof children !== 'string' && { mt: '-4px' })}\n >\n {typeof children === 'string' ? (\n <Text size={size} lineHeight=\"unset\" variant={onContrast ? 'onContrast' : 'default'}>\n {children}\n </Text>\n ) : (\n children\n )}\n </RadioGroup.ItemText>\n )}\n </RadioGroup.Item>\n );\n },\n);\n\nRadio.displayName = 'Radio';\nconst WrappedRadio = withFormControl<InternalRadioProps>(Radio);\n\nexport { WrappedRadio as Radio };\n","import React from 'react';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Radio, RadioProps } from './components/Radio/radio.component';\nimport { RadioGroup as CRadioGroup } from '@chakra-ui/react/radio-group';\nimport { Stack } from '@chakra-ui/react/stack';\nimport { ConditionalValue } from '@chakra-ui/react/styled-system';\nimport { FlexDirection } from 'shared/types/alignment';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { ButtonGroup } from 'components/ButtonGroup';\nimport { RadioType } from './radioGroup.types';\n\nexport interface RadioGroupProps\n extends WithFormControlProps,\n Omit<CRadioGroup.RootProps, 'onValueChange' | 'onChange'> {\n direction?: ConditionalValue<FlexDirection>;\n onChange?: (value: string | null) => void;\n size?: FormControlSize;\n radioType?: RadioType;\n radios: RadioProps[];\n}\n\nconst RadioGroup = ({\n radios,\n defaultValue,\n direction = 'column',\n disabled,\n invalid,\n onContrast,\n onChange,\n size = 'md',\n radioType = 'default',\n value,\n gap = 2,\n ...rest\n}: RadioGroupProps): React.JSX.Element => {\n const _computedVariant = onContrast ? 'onContrast' : 'default';\n return (\n <CRadioGroup.Root\n className=\"RadioGroup\"\n data-testid=\"kibble-radio-group\"\n disabled={disabled}\n defaultValue={defaultValue}\n value={value}\n onValueChange={({ value }) => onChange?.(value)}\n size={size}\n variant={_computedVariant}\n withCard={radioType === 'cards'}\n {...rest}\n >\n {radioType === 'buttons' ? (\n <ButtonGroup\n onContrast={onContrast}\n variant=\"secondarySubtle\"\n size={size}\n buttons={radios.map((radio, index) => {\n const active = defaultValue === radio.value || value === radio.value;\n return {\n key: `button-radio-${index}`,\n children: radio.children,\n active,\n disabled,\n onClick: () => onChange?.(radio.value),\n };\n })}\n />\n ) : (\n <Stack gap={gap} direction={direction}>\n {radios.map((radio, index) => (\n <Radio\n key={`radio-${index}`}\n invalid={invalid}\n disabled={disabled}\n size={size}\n radioType={radioType}\n onContrast={onContrast}\n {...(direction === 'row' && { fullWidth: false })}\n {...radio}\n />\n ))}\n </Stack>\n )}\n </CRadioGroup.Root>\n );\n};\n\nRadioGroup.displayName = 'RadioGroup';\nconst WrappedRadioGroup = withFormControl(RadioGroup);\n\nexport { WrappedRadioGroup as RadioGroup };\n","export const radioTypes = ['default', 'buttons', 'cards'] as const;\nexport type RadioType = (typeof radioTypes)[number];\n"],"names":["RadioGroupProvider","useRadioGroupContext","createContext","RadioGroupItemProvider","useRadioGroupItemContext","RadioGroupItemPropsProvider","useRadioGroupItemPropsContext","RadioGroupItem","forwardRef","props","ref","itemProps","localProps","createSplitProps","radioGroup","mergedProps","mergeProps","itemState","jsx","ark","RadioGroupItemContext","RadioGroupItemControl","RadioGroupItemHiddenInput","RadioGroupItemText","RadioGroupLabel","useRadioGroup","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","radio.machine","radio.connect","normalizeProps","RadioGroupRoot","useRadioGroupProps","RadioGroupRootProvider","Radiomark","recipe","useRecipe","variantProps","restProps","checked","disabled","unstyled","children","rest","styles","EMPTY_STYLES","sharedProps","dataAttr","chakra","withProvider","withContext","useRadioGroupStyles","createSlotRecipeContext","RadioGroup.RootProvider","RadioGroup.Root","RadioGroup.Label","RadioGroup.Item","RadioGroup.ItemText","RadioGroup.ItemControl","RadioGroupItemIndicator","RadioGroup.ItemContext","RadioGroup.ItemHiddenInput","Radio","React","invalid","onContrast","radioRef","radioType","rootRef","size","jsxs","RadioGroup.ItemIndicator","Text","WrappedRadio","withFormControl","RadioGroup","radios","defaultValue","direction","onChange","value","gap","_computedVariant","CRadioGroup.Root","ButtonGroup","radio","index","active","Stack","WrappedRadioGroup","radioTypes"],"mappings":";;;;;;;;;;;;;;AAGA,MAAM,CAACA,GAAoBC,CAAoB,IAAIC,EAAc;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GCJK,CAACC,GAAwBC,EAAwB,IAAIF,EAAc;AAAA,EACvE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GCJK,CAACG,IAA6BC,CAA6B,IAAIJ,EAAc;AAAA,EACjF,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GCGKK,IAAiBC,EAAW,CAACC,GAAOC,MAAQ;AAChD,QAAM,CAACC,GAAWC,CAAU,IAAIC,EAAgB,EAAGJ,GAAO,CAAC,SAAS,YAAY,SAAS,CAAC,GACpFK,IAAab,EAAsB,GACnCc,IAAcC,EAAWF,EAAW,aAAaH,CAAS,GAAGC,CAAU,GACvEK,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