{"version":3,"sources":["../src/components/Radio/useRadioStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { RadioSlots, RadioState } from './Radio.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const radioClassNames: SlotClassNames<RadioSlots> = {\n  root: 'fui-Radio',\n  indicator: 'fui-Radio__indicator',\n  input: 'fui-Radio__input',\n  label: 'fui-Radio__label',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSize = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n  display: 'inline-flex',\n  position: 'relative',\n  ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n  vertical: {\n    flexDirection: 'column',\n    alignItems: 'center',\n  },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n  position: 'absolute',\n  left: 0,\n  top: 0,\n  width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n  height: '100%',\n  boxSizing: 'border-box',\n  margin: 0,\n  opacity: 0,\n\n  ':enabled': {\n    cursor: 'pointer',\n    [`& ~ .${radioClassNames.label}`]: {\n      cursor: 'pointer',\n    },\n  },\n\n  // Colors for the unchecked state\n  ':enabled:not(:checked)': {\n    [`& ~ .${radioClassNames.label}`]: {\n      color: tokens.colorNeutralForeground3,\n    },\n    [`& ~ .${radioClassNames.indicator}`]: {\n      borderColor: tokens.colorNeutralStrokeAccessible,\n      '@media (forced-colors: active)': {\n        borderColor: 'ButtonBorder',\n      },\n    },\n\n    ':hover': {\n      [`& ~ .${radioClassNames.label}`]: {\n        color: tokens.colorNeutralForeground2,\n      },\n      [`& ~ .${radioClassNames.indicator}`]: {\n        borderColor: tokens.colorNeutralStrokeAccessibleHover,\n      },\n    },\n\n    ':hover:active': {\n      [`& ~ .${radioClassNames.label}`]: {\n        color: tokens.colorNeutralForeground1,\n      },\n      [`& ~ .${radioClassNames.indicator}`]: {\n        borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n      },\n    },\n  },\n\n  // Colors for the checked state\n  ':enabled:checked': {\n    [`& ~ .${radioClassNames.label}`]: {\n      color: tokens.colorNeutralForeground1,\n    },\n    [`& ~ .${radioClassNames.indicator}`]: {\n      borderColor: tokens.colorCompoundBrandStroke,\n      color: tokens.colorCompoundBrandForeground1,\n      '@media (forced-colors: active)': {\n        borderColor: 'Highlight',\n        color: 'Highlight',\n        '::after': {\n          backgroundColor: 'Highlight',\n        },\n      },\n    },\n\n    ':hover': {\n      [`& ~ .${radioClassNames.indicator}`]: {\n        borderColor: tokens.colorCompoundBrandStrokeHover,\n        color: tokens.colorCompoundBrandForeground1Hover,\n      },\n    },\n\n    ':hover:active': {\n      [`& ~ .${radioClassNames.indicator}`]: {\n        borderColor: tokens.colorCompoundBrandStrokePressed,\n        color: tokens.colorCompoundBrandForeground1Pressed,\n      },\n    },\n  },\n\n  // Colors for the disabled state\n  ':disabled': {\n    [`& ~ .${radioClassNames.label}`]: {\n      color: tokens.colorNeutralForegroundDisabled,\n      cursor: 'default',\n      '@media (forced-colors: active)': {\n        color: 'GrayText',\n      },\n    },\n    [`& ~ .${radioClassNames.indicator}`]: {\n      borderColor: tokens.colorNeutralStrokeDisabled,\n      color: tokens.colorNeutralForegroundDisabled,\n      '@media (forced-colors: active)': {\n        borderColor: 'GrayText',\n        color: 'GrayText',\n        '::after': {\n          backgroundColor: 'GrayText',\n        },\n      },\n    },\n  },\n});\n\nconst useInputStyles = makeStyles({\n  below: {\n    width: '100%',\n    height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\n  },\n\n  // If the indicator has no children, use the ::after pseudo-element for the checked state\n  defaultIndicator: {\n    [`:checked ~ .${radioClassNames.indicator}::after`]: {\n      content: '\"\"',\n    },\n  },\n\n  // If the indicator has a child, hide it until the radio is checked\n  customIndicator: {\n    [`:not(:checked) ~ .${radioClassNames.indicator} > *`]: {\n      opacity: '0',\n    },\n  },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n  position: 'relative',\n  width: indicatorSize,\n  height: indicatorSize,\n  fontSize: '12px',\n  boxSizing: 'border-box',\n  flexShrink: 0,\n\n  display: 'flex',\n  alignItems: 'center',\n  justifyContent: 'center',\n  overflow: 'hidden',\n\n  border: tokens.strokeWidthThin + ' solid',\n  borderRadius: tokens.borderRadiusCircular,\n  margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n  fill: 'currentColor',\n  pointerEvents: 'none',\n\n  '::after': {\n    position: 'absolute',\n    width: indicatorSize,\n    height: indicatorSize,\n    borderRadius: tokens.borderRadiusCircular,\n    // Use a transform to avoid pixel rounding errors at 125% DPI\n    // https://github.com/microsoft/fluentui/issues/30025\n    transform: 'scale(0.625)',\n    backgroundColor: 'currentColor',\n  },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n  base: {\n    alignSelf: 'center',\n    padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n  },\n\n  after: {\n    paddingLeft: tokens.spacingHorizontalXS,\n\n    // Use a (negative) margin to account for the difference between the indicator's height and the label's line height.\n    // This prevents the label from expanding the height of the Radio, but preserves line height if the label wraps.\n    marginTop: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n    marginBottom: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n  },\n\n  below: {\n    paddingTop: tokens.spacingVerticalXS,\n    textAlign: 'center',\n  },\n});\n\n/**\n * Apply styling to the Radio slots based on the state\n */\nexport const useRadioStyles_unstable = (state: RadioState): RadioState => {\n  const { labelPosition } = state;\n\n  const rootBaseClassName = useRootBaseClassName();\n  const rootStyles = useRootStyles();\n  // eslint-disable-next-line react-hooks/immutability\n  state.root.className = mergeClasses(\n    radioClassNames.root,\n    rootBaseClassName,\n    labelPosition === 'below' && rootStyles.vertical,\n    state.root.className,\n  );\n\n  const inputBaseClassName = useInputBaseClassName();\n  const inputStyles = useInputStyles();\n  // eslint-disable-next-line react-hooks/immutability\n  state.input.className = mergeClasses(\n    radioClassNames.input,\n    inputBaseClassName,\n    labelPosition === 'below' && inputStyles.below,\n    state.indicator.children ? inputStyles.customIndicator : inputStyles.defaultIndicator,\n    state.input.className,\n  );\n\n  const indicatorBaseClassName = useIndicatorBaseClassName();\n  // eslint-disable-next-line react-hooks/immutability\n  state.indicator.className = mergeClasses(\n    radioClassNames.indicator,\n    indicatorBaseClassName,\n    state.indicator.className,\n  );\n\n  const labelStyles = useLabelStyles();\n  if (state.label) {\n    // eslint-disable-next-line react-hooks/immutability\n    state.label.className = mergeClasses(\n      radioClassNames.label,\n      labelStyles.base,\n      labelStyles[labelPosition],\n      state.label.className,\n    );\n  }\n\n  return state;\n};\n"],"names":["createFocusOutlineStyle","tokens","makeResetStyles","makeStyles","mergeClasses","radioClassNames","root","indicator","input","label","indicatorSize","useRootBaseClassName","display","position","style","selector","useRootStyles","vertical","flexDirection","alignItems","useInputBaseClassName","left","top","width","spacingHorizontalS","height","boxSizing","margin","opacity","cursor","color","colorNeutralForeground3","borderColor","colorNeutralStrokeAccessible","colorNeutralForeground2","colorNeutralStrokeAccessibleHover","colorNeutralForeground1","colorNeutralStrokeAccessiblePressed","colorCompoundBrandStroke","colorCompoundBrandForeground1","backgroundColor","colorCompoundBrandStrokeHover","colorCompoundBrandForeground1Hover","colorCompoundBrandStrokePressed","colorCompoundBrandForeground1Pressed","colorNeutralForegroundDisabled","colorNeutralStrokeDisabled","useInputStyles","below","spacingVerticalS","defaultIndicator","content","customIndicator","useIndicatorBaseClassName","fontSize","flexShrink","justifyContent","overflow","border","strokeWidthThin","borderRadius","borderRadiusCircular","fill","pointerEvents","transform","useLabelStyles","base","alignSelf","padding","after","paddingLeft","spacingHorizontalXS","marginTop","lineHeightBase300","marginBottom","paddingTop","spacingVerticalXS","textAlign","useRadioStyles_unstable","state","labelPosition","rootBaseClassName","rootStyles","className","inputBaseClassName","inputStyles","children","indicatorBaseClassName","labelStyles"],"mappings":"AAAA;;;;;;;;;;;;IAQaK,eAAAA;;;2BA2MAyE;eAAAA;;;8BAjN2B,0BAA0B;4BAC3C,wBAAwB;uBACW,iBAAiB;AAIpE,wBAAoD;IACzDxE,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,+DAA+D;AAC/D,MAAMC,gBAAgB;AAEtB,MAAMC,2BAAuBT,sBAAAA,EAAgB;IAC3CU,SAAS;IACTC,UAAU;IACV,OAAGb,qCAAAA,EAAwB;QAAEc,OAAO,CAAC;QAAGC,UAAU;IAAe,EAAE;AACrE;AAEA,MAAMC,oBAAgBb,iBAAAA,EAAW;IAC/Bc,UAAU;QACRC,eAAe;QACfC,YAAY;IACd;AACF;AAEA,MAAMC,4BAAwBlB,sBAAAA,EAAgB;IAC5CW,UAAU;IACVQ,MAAM;IACNC,KAAK;IACLC,OAAO,CAAC,KAAK,EAAEb,cAAc,OAAO,EAAET,kBAAAA,CAAOuB,kBAAkB,CAAC,CAAC,CAAC;IAClEC,QAAQ;IACRC,WAAW;IACXC,QAAQ;IACRC,SAAS;IAET,YAAY;QACVC,QAAQ;QACR,CAAC,CAAC,KAAK,EAAExB,gBAAgBI,KAAK,EAAE,CAAC,EAAE;YACjCoB,QAAQ;QACV;IACF;IAEA,iCAAiC;IACjC,0BAA0B;QACxB,CAAC,CAAC,KAAK,EAAExB,gBAAgBI,KAAK,EAAE,CAAC,EAAE;YACjCqB,OAAO7B,kBAAAA,CAAO8B,uBAAuB;QACvC;QACA,CAAC,CAAC,KAAK,EAAE1B,gBAAgBE,SAAS,EAAE,CAAC,EAAE;YACrCyB,aAAa/B,kBAAAA,CAAOgC,4BAA4B;YAChD,kCAAkC;gBAChCD,aAAa;YACf;QACF;QAEA,UAAU;YACR,CAAC,CAAC,KAAK,EAAE3B,gBAAgBI,KAAK,EAAE,CAAC,EAAE;gBACjCq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