{"version":3,"file":"chunk-Toggle.mjs","names":["Toggle","TogglePrimitive"],"sources":["../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Toggle as TogglePrimitive, useToggleContext } from '@ark-ui/react/toggle';\nimport React from 'react';\n\nimport { composable } from '../../util/slots.ts';\nimport { Button, type ButtonProps } from '../Button/Button.tsx';\n\ntype ToggleIconProps = {\n  /** Icon shown while pressed, in place of `icon` (e.g. a filled star for a pinned item). */\n  activeIcon?: string;\n};\n\nexport type ToggleProps = ButtonProps &\n  ToggleIconProps & {\n    pressed?: boolean;\n    defaultPressed?: boolean;\n    onPressedChange?: (pressed: boolean) => void;\n  };\n\n/** A Button with a pressed state from the zag toggle machine (`aria-pressed`); icon, label and `iconOnly` are Button's. */\nexport const Toggle = composable<HTMLButtonElement, ToggleProps>(\n  ({ pressed, defaultPressed, onPressedChange, disabled, activeIcon, ...props }, forwardedRef) => (\n    <TogglePrimitive.Root\n      asChild\n      pressed={pressed}\n      defaultPressed={defaultPressed}\n      onPressedChange={onPressedChange}\n      disabled={disabled}\n    >\n      <ToggleButton {...props} activeIcon={activeIcon} disabled={disabled} ref={forwardedRef} />\n    </TogglePrimitive.Root>\n  ),\n);\n\nToggle.displayName = 'Toggle';\n\n/** Reads the machine's pressed state, which an uncontrolled toggle's caller does not have, to swap the icon. */\nconst ToggleButton = composable<HTMLButtonElement, ButtonProps & ToggleIconProps>(\n  ({ activeIcon, ...props }, forwardedRef) => {\n    const { pressed } = useToggleContext();\n    return <Button {...props} {...(pressed && activeIcon && { icon: activeIcon })} ref={forwardedRef} />;\n  },\n);\n"],"mappings":";;;;;;;AAuBA,IAAaA,WAAS,YACnB,EAAE,SAAS,gBAAgB,iBAAiB,UAAU,YAAY,GAAG,SAAS,iBAC7E,oBAACC,OAAgB,MAAjB;CACE,SAAA;CACS;CACO;CACC;CACP;CAEV,UAAA,oBAAC,cAAD;EAAc,GAAI;EAAmB;EAAsB;EAAU,KAAK;CAAe,CAAA;AACrE,CAAA,CAE1B;AAEA,SAAO,cAAc;;AAGrB,IAAM,eAAe,YAClB,EAAE,YAAY,GAAG,SAAS,iBAAiB;CAC1C,MAAM,EAAE,YAAY,iBAAiB;CACrC,OAAO,oBAAC,QAAD;EAAQ,GAAI;EAAO,GAAK,WAAW,cAAc,EAAE,MAAM,WAAW;EAAI,KAAK;CAAe,CAAA;AACrG,CACF"}