{"version":3,"file":"chunk-SystemButton.mjs","names":["_Fragment"],"sources":["../../src/components/SystemButton/SystemButton.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport React, {\n  type ButtonHTMLAttributes,\n  type InputHTMLAttributes,\n  type KeyboardEvent,\n  type PointerEvent,\n  useCallback,\n  useContext,\n  useEffect,\n  useId,\n  useRef,\n  useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { composeEventHandlers, useControllableState } from '@dxos/react-hooks';\nimport { AI_ACTION_ICON } from '@dxos/ui-types';\nimport { downloadBlob } from '@dxos/util';\n\nimport { translationKey } from '#translations';\n\nimport { composable } from '../../util/slots.ts';\nimport { Button, type ButtonContentProps, type ButtonVariantProps } from '../Button/Button.tsx';\nimport { RowContext } from '../Listbox/grid.ts';\nimport { Toggle } from '../Toggle/Toggle.tsx';\nimport type * as Tooltip from '../Tooltip/Tooltip.tsx';\n\n/**\n * Every preset is a Button whose icon is fixed and whose label defaults from the `system-button.*` translations;\n * callers may still override `label`.\n */\ntype SystemButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label' | 'title'> &\n  ButtonVariantProps & {\n    label?: string;\n    /** Only the icon, named by the label in a Tooltip (the default); `false` shows the label after the icon. */\n    iconOnly?: boolean;\n    /** Icon-only: opt out of the label Tooltip. */\n    showTooltip?: boolean;\n    /** Icon-only: the side the label Tooltip opens on. */\n    tooltipSide?: Tooltip.Side;\n  };\n\ntype PresetContent = Pick<SystemButtonProps, 'iconOnly' | 'showTooltip' | 'tooltipSide'> & {\n  icon: string;\n  label: string;\n};\n\n/** Button content for a preset: icon-only with its Tooltip unless `iconOnly` is false, when the label shows. */\nconst presetContent = ({\n  icon,\n  label,\n  iconOnly = true,\n  showTooltip,\n  tooltipSide,\n}: PresetContent): ButtonContentProps =>\n  iconOnly ? { iconOnly: true, icon, label, showTooltip, tooltipSide } : { icon, label };\n\n/** Star and Bookmark: a Toggle (`aria-pressed`) whose icon and label follow the pressed state. */\nexport type SystemTogglePresetProps = SystemButtonProps & {\n  pressed?: boolean;\n  defaultPressed?: boolean;\n  onPressedChange?: (pressed: boolean) => void;\n};\n\ntype ToggleSpec = {\n  icon: string;\n  activeIcon: string;\n  labelKey: string;\n  activeLabelKey: string;\n  iconValence?: 'warning' | 'success';\n};\n\nconst createTogglePreset = (\n  displayName: string,\n  { icon, activeIcon, labelKey, activeLabelKey, iconValence }: ToggleSpec,\n) => {\n  const Preset = composable<HTMLButtonElement, SystemTogglePresetProps>(\n    (\n      { label, iconOnly, showTooltip, tooltipSide, pressed: pressedProp, defaultPressed, onPressedChange, ...props },\n      forwardedRef,\n    ) => {\n      const { t } = useTranslation(translationKey);\n      // Owned here, not left to the toggle machine, because the label (not only the icon) follows the pressed state.\n      const [pressed = false, setPressed] = useControllableState({\n        prop: pressedProp,\n        defaultProp: defaultPressed ?? false,\n        onChange: onPressedChange,\n      });\n      return (\n        <Toggle\n          {...props}\n          {...presetContent({\n            icon,\n            label: label ?? t(pressed ? activeLabelKey : labelKey),\n            iconOnly,\n            showTooltip,\n            tooltipSide,\n          })}\n          activeIcon={activeIcon}\n          pressed={pressed}\n          onPressedChange={setPressed}\n          data-icon-valence={pressed ? iconValence : undefined}\n          ref={forwardedRef}\n        />\n      );\n    },\n  );\n  Preset.displayName = displayName;\n  return Preset;\n};\n\nconst createStaticPreset = (\n  displayName: string,\n  icon: string,\n  labelKey: string,\n  defaults: Pick<SystemButtonProps, 'variant'> = {},\n) => {\n  const Preset = composable<HTMLButtonElement, SystemButtonProps>(\n    ({ label, iconOnly, showTooltip, tooltipSide, ...props }, forwardedRef) => {\n      const { t } = useTranslation(translationKey);\n      return (\n        <Button\n          {...defaults}\n          {...props}\n          {...presetContent({ icon, label: label ?? t(labelKey), iconOnly, showTooltip, tooltipSide })}\n          ref={forwardedRef}\n        />\n      );\n    },\n  );\n  Preset.displayName = displayName;\n  return Preset;\n};\n\n//\n// Toggles\n//\n\nconst Star = createTogglePreset('SystemButton.Star', {\n  icon: 'ph--star--regular',\n  activeIcon: 'ph--star--fill',\n  labelKey: 'system-button.star.label',\n  activeLabelKey: 'system-button.unstar.label',\n  iconValence: 'warning',\n});\n\nconst Bookmark = createTogglePreset('SystemButton.Bookmark', {\n  icon: 'ph--bookmark-simple--regular',\n  activeIcon: 'ph--bookmark-simple--fill',\n  labelKey: 'system-button.bookmark.label',\n  activeLabelKey: 'system-button.unbookmark.label',\n});\n\n/** Marks one of several as chosen: an empty circle, and a green check circle while checked. */\nconst Check = createTogglePreset('SystemButton.Check', {\n  icon: 'ph--circle--regular',\n  activeIcon: 'ph--check-circle--fill',\n  labelKey: 'system-button.check.label',\n  activeLabelKey: 'system-button.uncheck.label',\n  iconValence: 'success',\n});\n\n//\n// Disclosure\n//\n\nexport type SystemDisclosureProps = SystemButtonProps & {\n  expanded?: boolean;\n  defaultExpanded?: boolean;\n  onExpandedChange?: (expanded: boolean) => void;\n};\n\n/**\n * Shows and hides a region — the WAI-ARIA disclosure pattern, so it reports `aria-expanded` rather than the\n * `aria-pressed` of a toggle. Give it `aria-controls` at the call site, where the region's id is known. Its caret\n * turns a quarter while expanded (`theme/system-button.css`).\n */\nconst Disclosure = composable<HTMLButtonElement, SystemDisclosureProps>(\n  (\n    {\n      label,\n      iconOnly,\n      showTooltip,\n      tooltipSide,\n      expanded: expandedProp,\n      defaultExpanded,\n      onExpandedChange,\n      onClick,\n      ...props\n    },\n    forwardedRef,\n  ) => {\n    const { t } = useTranslation(translationKey);\n    const [expanded = false, setExpanded] = useControllableState({\n      prop: expandedProp,\n      defaultProp: defaultExpanded ?? false,\n      onChange: onExpandedChange,\n    });\n    return (\n      <Button\n        {...props}\n        {...presetContent({\n          icon: 'ph--caret-right--regular',\n          label: label ?? t(expanded ? 'system-button.close.label' : 'system-button.open.label'),\n          iconOnly,\n          showTooltip,\n          tooltipSide,\n        })}\n        aria-expanded={expanded}\n        data-disclosure=''\n        onClick={composeEventHandlers(onClick, () => setExpanded(!expanded))}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nDisclosure.displayName = 'SystemButton.Disclosure';\n\n//\n// Static\n//\n\nconst Add = createStaticPreset('SystemButton.Add', 'ph--plus--regular', 'system-button.add.label');\n\n/** The button form of {@link AI_ACTION_ICON}, which metadata call sites take as a string instead. */\nconst Ai = createStaticPreset('SystemButton.Ai', AI_ACTION_ICON, 'system-button.ai.label');\n\nconst Close = createStaticPreset('SystemButton.Close', 'ph--x--regular', 'system-button.close.label');\n\n/** Commits a form or dialog; `primary` by default, and usually labelled (`iconOnly={false}`) in a footer. */\nconst Save = createStaticPreset('SystemButton.Save', 'ph--check--regular', 'system-button.save.label', {\n  variant: 'primary',\n});\n\n/** Abandons a form or dialog; the glyph is Close's, the label and intent differ. */\nconst Cancel = createStaticPreset('SystemButton.Cancel', 'ph--x--regular', 'system-button.cancel.label');\n\nconst Delete = createStaticPreset('SystemButton.Delete', 'ph--trash--regular', 'system-button.delete.label');\n\n/**\n * Takes a row out of a list without destroying what it names; the glyph is Close's, the intent Delete's. In a list row\n * it is named by its label followed by the row's `ItemText` (\"Delete Q3 budget\"); a `label` replaces both.\n */\nconst Remove = composable<HTMLButtonElement, SystemButtonProps>(\n  ({ label, iconOnly, showTooltip, tooltipSide, id, ...props }, forwardedRef) => {\n    const { t } = useTranslation(translationKey);\n    const row = useContext(RowContext);\n    const generatedId = useId();\n    const ownId = id ?? generatedId;\n    const labelledBy =\n      label === undefined && row && props['aria-labelledby'] === undefined ? `${ownId} ${row.textId}` : undefined;\n    return (\n      <Button\n        aria-labelledby={labelledBy}\n        {...props}\n        id={ownId}\n        {...presetContent({\n          icon: 'ph--x--regular',\n          label: label ?? t('system-button.remove.label'),\n          iconOnly,\n          showTooltip,\n          tooltipSide,\n        })}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nRemove.displayName = 'SystemButton.Remove';\n\nconst Edit = createStaticPreset('SystemButton.Edit', 'ph--pencil-simple--regular', 'system-button.edit.label');\n\n//\n// Clipboard\n//\n\n/** Copy a fixed `value`, or text produced on click by `onCopy` when it is costly or changes. */\nexport type SystemClipboardProps = SystemButtonProps & {\n  /** The glyph shown until a copy lands; the clipboard by default. */\n  icon?: string;\n} & ({ value: string; onCopy?: never } | { onCopy: () => string; value?: never });\n\nconst Clipboard = composable<HTMLButtonElement, SystemClipboardProps>(\n  (\n    { label, iconOnly, showTooltip, tooltipSide, value, onCopy, icon = 'ph--clipboard--regular', onClick, ...props },\n    forwardedRef,\n  ) => {\n    const { t } = useTranslation(translationKey);\n    const [copied, setCopied] = useState(false);\n    const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n    // Confirmed only once the write resolves: `writeText` rejects when the document is unfocused or permission is\n    // refused, and feedback shown before that would report a copy that never happened.\n    const handleCopy = useCallback(() => {\n      const text = onCopy ? onCopy() : value;\n      if (!text) {\n        return;\n      }\n\n      void navigator.clipboard\n        .writeText(text)\n        .then(() => {\n          setCopied(true);\n          clearTimeout(timeoutRef.current);\n          timeoutRef.current = setTimeout(() => setCopied(false), 1_000);\n        })\n        .catch(() => setCopied(false));\n    }, [onCopy, value]);\n\n    // The pending reset would otherwise set state on an unmounted component.\n    useEffect(() => () => clearTimeout(timeoutRef.current), []);\n\n    return (\n      <Button\n        {...props}\n        {...presetContent({\n          icon: copied ? 'ph--check--regular' : icon,\n          label: copied ? t('system-button.copied.label') : (label ?? t('system-button.clipboard.label')),\n          iconOnly,\n          showTooltip,\n          tooltipSide,\n        })}\n        data-icon-valence={copied ? 'success' : undefined}\n        onClick={composeEventHandlers(onClick, handleCopy)}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nClipboard.displayName = 'SystemButton.Clipboard';\n\n//\n// Upload\n//\n\nexport type SystemUploadProps = SystemButtonProps &\n  Pick<InputHTMLAttributes<HTMLInputElement>, 'accept' | 'multiple'> & {\n    onFileChange?: InputHTMLAttributes<HTMLInputElement>['onChange'];\n  };\n\nconst Upload = composable<HTMLButtonElement, SystemUploadProps>(\n  ({ accept, multiple, onFileChange, label, iconOnly, showTooltip, tooltipSide, onClick, ...props }, forwardedRef) => {\n    const { t } = useTranslation(translationKey);\n    const fileInputRef = useRef<HTMLInputElement>(null);\n    return (\n      <>\n        <input hidden type='file' accept={accept} multiple={multiple} onChange={onFileChange} ref={fileInputRef} />\n        <Button\n          {...props}\n          {...presetContent({\n            icon: 'ph--upload-simple--regular',\n            label: label ?? t('system-button.upload.label'),\n            iconOnly,\n            showTooltip,\n            tooltipSide,\n          })}\n          onClick={composeEventHandlers(onClick, () => fileInputRef.current?.click())}\n          ref={forwardedRef}\n        />\n      </>\n    );\n  },\n);\n\nUpload.displayName = 'SystemButton.Upload';\n\n//\n// Download\n//\n\nexport type SystemDownloadProps = SystemButtonProps & {\n  filename: string;\n  /** The blob may be produced asynchronously (e.g. serialized from a query) or synchronously. */\n  onDownload: () => Blob | null | Promise<Blob | null>;\n};\n\nconst Download = composable<HTMLButtonElement, SystemDownloadProps>(\n  ({ filename, onDownload, label, iconOnly, showTooltip, tooltipSide, onClick, ...props }, forwardedRef) => {\n    const { t } = useTranslation(translationKey);\n    const handleDownload = useCallback(async () => {\n      try {\n        const blob = await onDownload();\n        if (!blob) {\n          return;\n        }\n\n        await downloadBlob(blob, filename);\n      } catch {\n        // Best-effort: the click handler discards this promise, so a failure must not surface as unhandled.\n      }\n    }, [onDownload, filename]);\n    return (\n      <Button\n        {...props}\n        {...presetContent({\n          icon: 'ph--download-simple--regular',\n          label: label ?? t('system-button.download.label'),\n          iconOnly,\n          showTooltip,\n          tooltipSide,\n        })}\n        onClick={composeEventHandlers(onClick, () => void handleDownload())}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nDownload.displayName = 'SystemButton.Download';\n\n//\n// Mic\n//\n\nexport type SystemMicMode = 'toggle' | 'hold';\n\nexport type SystemMicProps = Omit<SystemButtonProps, 'label' | 'onClick'> & {\n  /** Required: there is no default, since the caller's recording state decides it (e.g. \"Start\"/\"Stop recording\"). */\n  label: string;\n  /** `toggle`: a click flips recording. `hold`: records only while held (push-to-talk). */\n  mode?: SystemMicMode;\n  /** Whether recording is active; fills the button with the error hue. */\n  recording?: boolean;\n  /** Fired in `toggle` mode on click. */\n  onToggle?: () => void;\n  /** Fired in `hold` mode when the press begins. */\n  onPressStart?: () => void;\n  /** Fired in `hold` mode when the press ends (release, cancel, or lost capture). */\n  onPressEnd?: () => void;\n};\n\n/**\n * Microphone record button; presentational, the caller owns recording state. `hold` mode uses pointer capture so the\n * release still arrives if the pointer leaves the button.\n */\nconst Mic = composable<HTMLButtonElement, SystemMicProps>(\n  (\n    {\n      label,\n      iconOnly,\n      showTooltip,\n      tooltipSide,\n      mode = 'toggle',\n      recording,\n      onToggle,\n      onPressStart,\n      onPressEnd,\n      ...props\n    },\n    forwardedRef,\n  ) => {\n    // A press spans down→up; the guard fires start/end once though a release arrives as both `pointerup` and\n    // `lostpointercapture`.\n    const pressedRef = useRef(false);\n    const beginPress = useCallback(() => {\n      if (!pressedRef.current) {\n        pressedRef.current = true;\n        onPressStart?.();\n      }\n    }, [onPressStart]);\n\n    const endPress = useCallback(() => {\n      if (pressedRef.current) {\n        pressedRef.current = false;\n        onPressEnd?.();\n      }\n    }, [onPressEnd]);\n\n    const handlePointerDown = useCallback(\n      (event: PointerEvent<HTMLButtonElement>) => {\n        // Primary button only: other buttons do not activate a button, and their release would not end the press.\n        if (event.button !== 0) {\n          return;\n        }\n        event.currentTarget.setPointerCapture(event.pointerId);\n        beginPress();\n      },\n      [beginPress],\n    );\n\n    const handleKeyDown = useCallback(\n      (event: KeyboardEvent<HTMLButtonElement>) => {\n        if ((event.key === ' ' || event.key === 'Enter') && !event.repeat) {\n          event.preventDefault();\n          beginPress();\n        }\n      },\n      [beginPress],\n    );\n\n    const handleKeyUp = useCallback(\n      (event: KeyboardEvent<HTMLButtonElement>) => {\n        if (event.key === ' ' || event.key === 'Enter') {\n          event.preventDefault();\n          endPress();\n        }\n      },\n      [endPress],\n    );\n\n    const handlers =\n      mode === 'hold'\n        ? {\n            onPointerDown: handlePointerDown,\n            onPointerUp: endPress,\n            onPointerCancel: endPress,\n            onLostPointerCapture: endPress,\n            onKeyDown: handleKeyDown,\n            onKeyUp: handleKeyUp,\n            // Focus leaving mid-hold (e.g. tabbing away) must still end the press.\n            onBlur: endPress,\n          }\n        : { onClick: onToggle };\n\n    return (\n      <Button\n        {...props}\n        {...handlers}\n        {...presetContent({\n          icon: recording ? 'ph--microphone--duotone' : 'ph--microphone--regular',\n          label,\n          iconOnly,\n          showTooltip,\n          tooltipSide,\n        })}\n        hue={recording ? 'error' : props.hue}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nMic.displayName = 'SystemButton.Mic';\n\n//\n// Namespace\n//\n\nexport {\n  Add,\n  Ai,\n  Bookmark,\n  Cancel,\n  Check,\n  Clipboard,\n  Close,\n  Delete,\n  Disclosure,\n  Download,\n  Edit,\n  Mic,\n  Remove,\n  Save,\n  Star,\n  Upload,\n};\nexport type { SystemButtonProps as Props };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAM,iBAAiB,EACrB,MACA,OACA,WAAW,MACX,aACA,kBAEA,WAAW;CAAE,UAAU;CAAM;CAAM;CAAO;CAAa;AAAY,IAAI;CAAE;CAAM;AAAM;AAiBvF,IAAM,sBACJ,aACA,EAAE,MAAM,YAAY,UAAU,gBAAgB,kBAC3C;CACH,MAAM,SAAS,YAEX,EAAE,OAAO,UAAU,aAAa,aAAa,SAAS,aAAa,gBAAgB,iBAAiB,GAAG,SACvG,iBACG;EACH,MAAM,EAAE,MAAM,eAAe,cAAc;EAE3C,MAAM,CAAC,UAAU,OAAO,cAAc,qBAAqB;GACzD,MAAM;GACN,aAAa,kBAAkB;GAC/B,UAAU;EACZ,CAAC;EACD,OACE,oBAAC,QAAD;GACE,GAAI;GACJ,GAAI,cAAc;IAChB;IACA,OAAO,SAAS,EAAE,UAAU,iBAAiB,QAAQ;IACrD;IACA;I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