@langchain/macaw-components 1.0.0-beta.9 → 1.1.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.
Files changed (114) hide show
  1. package/README.md +3 -3
  2. package/dist/_chunks/{ErrorState-CmPX01HV.js → ErrorState-BY6VBCRB.js} +2 -2
  3. package/dist/_chunks/{ErrorState-CmPX01HV.js.map → ErrorState-BY6VBCRB.js.map} +1 -1
  4. package/dist/_chunks/{LoadingIndicator-DujSAzqj.js → LoadingIndicator-Itl4c0WV.js} +10 -10
  5. package/dist/_chunks/LoadingIndicator-Itl4c0WV.js.map +1 -0
  6. package/dist/base.css +19 -6
  7. package/dist/catalog.json +493 -480
  8. package/dist/components/BarChart/AnimatedBar.js +1 -1
  9. package/dist/components/BarChart/AnimatedBar.js.map +1 -1
  10. package/dist/components/BarChart/BarChartPlot.js +1 -1
  11. package/dist/components/BarChart/BarChartPlot.js.map +1 -1
  12. package/dist/components/Button/constants.js +4 -4
  13. package/dist/components/Button/constants.js.map +1 -1
  14. package/dist/components/ChartLegend/ChartLegend.js +1 -1
  15. package/dist/components/ChartLegend/ChartLegend.js.map +1 -1
  16. package/dist/components/ChartLegend/ChartLegendItemRenderer.js +2 -2
  17. package/dist/components/ChartLegend/ChartLegendItemRenderer.js.map +1 -1
  18. package/dist/components/ChartTooltip/ChartTooltip.js +2 -2
  19. package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -1
  20. package/dist/components/Checkbox/constants.d.ts +1 -1
  21. package/dist/components/Checkbox/constants.js +1 -1
  22. package/dist/components/Checkbox/constants.js.map +1 -1
  23. package/dist/components/Code/CodeLite.js +2 -2
  24. package/dist/components/Code/CodeLite.js.map +1 -1
  25. package/dist/components/Code/JsonHighlighterExtension.js +1 -1
  26. package/dist/components/Code/JsonHighlighterExtension.js.map +1 -1
  27. package/dist/components/Command/Command.js +1 -1
  28. package/dist/components/Command/Command.js.map +1 -1
  29. package/dist/components/Command/CommandMenu.js +2 -2
  30. package/dist/components/Command/CommandMenu.js.map +1 -1
  31. package/dist/components/ContextMenu/ContextMenu.js +2 -2
  32. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  33. package/dist/components/CopyButton/CopyButton.d.ts +3 -2
  34. package/dist/components/CopyButton/CopyButton.js +5 -0
  35. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  36. package/dist/components/Dialog/index.d.ts +3 -2
  37. package/dist/components/Dialog/index.js +44 -17
  38. package/dist/components/Dialog/index.js.map +1 -1
  39. package/dist/components/DonutChart/DonutChart.js +1 -1
  40. package/dist/components/DonutChart/DonutChart.js.map +1 -1
  41. package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
  42. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  43. package/dist/components/ErrorState/ErrorState.js +1 -1
  44. package/dist/components/ErrorState/index.js +1 -1
  45. package/dist/components/GroupedTabs/GroupedTabs.d.ts +3 -2
  46. package/dist/components/GroupedTabs/GroupedTabs.js +3 -1
  47. package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -1
  48. package/dist/components/Input/Input.js +7 -6
  49. package/dist/components/Input/Input.js.map +1 -1
  50. package/dist/components/Input/inputStyles.js +5 -5
  51. package/dist/components/Input/inputStyles.js.map +1 -1
  52. package/dist/components/Link/Link.js +3 -3
  53. package/dist/components/Link/Link.js.map +1 -1
  54. package/dist/components/Pane/Pane.d.ts +3 -2
  55. package/dist/components/Pane/Pane.js +107 -101
  56. package/dist/components/Pane/Pane.js.map +1 -1
  57. package/dist/components/Popover/Popover.js +15 -4
  58. package/dist/components/Popover/Popover.js.map +1 -1
  59. package/dist/components/Popover/constants.d.ts +1 -1
  60. package/dist/components/Popover/constants.js +1 -1
  61. package/dist/components/Popover/constants.js.map +1 -1
  62. package/dist/components/RadioButton/constants.d.ts +1 -1
  63. package/dist/components/RadioButton/constants.js +1 -1
  64. package/dist/components/RadioButton/constants.js.map +1 -1
  65. package/dist/components/RadioGroup/RadioGroupItem.js +1 -1
  66. package/dist/components/RadioGroup/RadioGroupItem.js.map +1 -1
  67. package/dist/components/SankeyChart/AnimatedSankeyLink.js +1 -1
  68. package/dist/components/SankeyChart/AnimatedSankeyLink.js.map +1 -1
  69. package/dist/components/SankeyChart/AnimatedSankeyNode.js +1 -1
  70. package/dist/components/SankeyChart/AnimatedSankeyNode.js.map +1 -1
  71. package/dist/components/Select/Select.d.ts +2 -1
  72. package/dist/components/Select/Select.js +5 -3
  73. package/dist/components/Select/Select.js.map +1 -1
  74. package/dist/components/Select/SelectPrimitive.js +6 -4
  75. package/dist/components/Select/SelectPrimitive.js.map +1 -1
  76. package/dist/components/Slider/Slider.js +1 -1
  77. package/dist/components/Slider/Slider.js.map +1 -1
  78. package/dist/components/SplitViewPane/SplitViewPane.js +1 -1
  79. package/dist/components/SplitViewPane/SplitViewPane.js.map +1 -1
  80. package/dist/components/Switch/Switch.js +1 -1
  81. package/dist/components/Switch/Switch.js.map +1 -1
  82. package/dist/components/Tabs/index.d.ts +3 -2
  83. package/dist/components/Tabs/index.js +5 -3
  84. package/dist/components/Tabs/index.js.map +1 -1
  85. package/dist/components/Textarea/Textarea.js +9 -9
  86. package/dist/components/Textarea/Textarea.js.map +1 -1
  87. package/dist/components/ThinkingState/LoadingIndicator.js +1 -1
  88. package/dist/components/ThinkingState/ThinkingState.js +1 -1
  89. package/dist/components/ThinkingState/index.js +1 -1
  90. package/dist/components/Toast/index.js +2 -2
  91. package/dist/components/Toast/index.js.map +1 -1
  92. package/dist/components/Tooltip/Tooltip.js +1 -1
  93. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  94. package/dist/components/Typeahead/TypeaheadParts.js +1 -1
  95. package/dist/components/Typeahead/TypeaheadParts.js.map +1 -1
  96. package/dist/components/Typeahead/TypeaheadView.js +9 -9
  97. package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
  98. package/dist/components/index.js +1 -1
  99. package/dist/components.css +2 -105
  100. package/dist/index.js +1 -1
  101. package/dist/utilities.css +2 -2
  102. package/dist/utils/ModalLayerContext.d.ts +23 -0
  103. package/dist/utils/ModalLayerContext.js +92 -0
  104. package/dist/utils/ModalLayerContext.js.map +1 -0
  105. package/dist/utils/cn.js +21 -11
  106. package/dist/utils/cn.js.map +1 -1
  107. package/dist/utils/dataAttributes.d.ts +9 -0
  108. package/dist/utils/dataAttributes.js +13 -0
  109. package/dist/utils/dataAttributes.js.map +1 -0
  110. package/docs/DESIGN.md +33 -3
  111. package/docs/STYLES.md +96 -46
  112. package/package.json +10 -9
  113. package/tailwind.preset.cjs +292 -332
  114. package/dist/_chunks/LoadingIndicator-DujSAzqj.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Toast/index.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\n\nimport { ExclamationMarkIcon } from '@phosphor-icons/react/dist/ssr/ExclamationMark';\nimport { InfoIcon } from '@phosphor-icons/react/dist/ssr/Info';\nimport * as ToastLib from '@radix-ui/react-toast';\n\nimport { CheckIcon, XCloseIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { CopyIconButton } from '../CopyButton';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { ToastContext } from './ToastContext';\n\nconst DEFAULT_DURATION_MS = 5000;\n// Error toasts do not auto-dismiss; the user must click the close button.\nconst ERROR_DURATION_MS = Infinity;\n\n// Provider wraps whole application\nexport function ToastProvider({ children }: { children: React.ReactNode }) {\n // note this only supports one toast at a time currently\n const [open, setOpen] = React.useState(false);\n const [toast, setToast] = React.useState<{\n id: number;\n config: ToastConfig;\n } | null>(null);\n const config = toast?.config;\n\n const createToast = useCallback((titleOrConfig: ToastConfig | string) => {\n const preConfig =\n typeof titleOrConfig === 'string'\n ? { title: titleOrConfig }\n : titleOrConfig;\n const isError = preConfig.error || preConfig.type === 'error';\n const config: ToastConfig = {\n duration: isError ? ERROR_DURATION_MS : DEFAULT_DURATION_MS,\n ...preConfig,\n };\n\n setToast((previous) => ({ id: (previous?.id ?? 0) + 1, config }));\n setOpen(true);\n }, []);\n\n return (\n <ToastContext.Provider value={{ createToast }}>\n {children}\n {/* Reset Radix's paused state without remounting application children. */}\n <ToastLib.Provider key={toast?.id} swipeDirection=\"right\">\n <ZIndexProvider value={zIndices.toast}>\n <Toast\n title={config?.title}\n description={config?.description}\n open={open}\n setOpen={setOpen}\n action={config?.action}\n error={config?.error}\n duration={config?.duration}\n type={config?.type}\n />\n </ZIndexProvider>\n <ToastLib.Viewport\n className={cn(\n 'fixed bottom-0 right-0 m-0 flex w-[390px] max-w-full list-none flex-col gap-[10px] p-[var(--viewport-padding)] outline-none [--viewport-padding:_25px]',\n config?.viewPortClassName\n )}\n style={{ zIndex: zIndices.toast }}\n />\n </ToastLib.Provider>\n </ToastContext.Provider>\n );\n}\n\nexport type ToastConfig = {\n title?: string | React.ReactNode;\n description?: React.ReactNode;\n action?: React.ReactNode;\n duration?: number;\n viewPortClassName?: string;\n error?: boolean;\n type?: 'error' | 'info' | 'warning' | 'success';\n};\n\nconst stopSwipeOnTextSelect = (e: React.PointerEvent) => e.stopPropagation();\n\nconst SURFACE_BY_TYPE = {\n default: 'bg-surface-level-2 border-subtle',\n error: 'bg-error border-error',\n warning: 'bg-warning border-warning',\n success: 'bg-success border-success',\n info: 'bg-brand-subtle border-brand-75',\n} as const;\n\nfunction renderToastIcon(isError: boolean, type: ToastConfig['type']) {\n if (isError)\n return (\n <Icon\n icon={ExclamationMarkIcon}\n weight=\"regular\"\n size=\"sm\"\n rounded\n color=\"error\"\n />\n );\n if (type === 'success')\n return <Icon icon={CheckIcon} size=\"sm\" rounded color=\"success\" />;\n if (type === 'warning')\n return (\n <Icon\n icon={ExclamationMarkIcon}\n weight=\"regular\"\n size=\"sm\"\n rounded\n color=\"warning\"\n />\n );\n if (type === 'info')\n return (\n <Icon icon={InfoIcon} weight=\"fill\" size=\"sm\" rounded color=\"info\" />\n );\n return (\n <Icon icon={InfoIcon} weight=\"fill\" size=\"sm\" rounded color=\"neutral\" />\n );\n}\n\nfunction Toast({\n title,\n open,\n setOpen,\n description,\n action,\n error,\n duration,\n type,\n}: {\n title?: string | React.ReactNode;\n open: boolean;\n setOpen?: (open: boolean) => void;\n description?: React.ReactNode;\n action?: React.ReactNode;\n error?: boolean;\n duration?: number;\n type?: 'error' | 'info' | 'warning' | 'success';\n}) {\n const isError = error || type === 'error';\n const surface = SURFACE_BY_TYPE[isError ? 'error' : (type ?? 'default')];\n const hasTitle = title !== undefined && title !== null && title !== '';\n const copyText =\n isError && typeof title === 'string'\n ? typeof description === 'string'\n ? `${title}\\n${description}`\n : title\n : null;\n\n const descriptionNode = description && (\n <ToastLib.Description asChild>\n <div\n className={cn(\n 'max-h-32 cursor-text select-text overflow-y-auto whitespace-pre-wrap',\n hasTitle\n ? 'ml-space-6 text-xxs text-secondary'\n : 'text-sm text-primary'\n )}\n onPointerDown={stopSwipeOnTextSelect}\n >\n {description}\n </div>\n </ToastLib.Description>\n );\n\n const trailingButtons = (\n <div className=\"flex gap-space-2\">\n {copyText && (\n <CopyIconButton\n size=\"xs\"\n copy={copyText}\n copyText=\"Copy error message\"\n />\n )}\n <ToastLib.Close asChild>\n <IconButton\n icon={XCloseIcon}\n label=\"Dismiss\"\n size=\"xs\"\n variant=\"plain\"\n color=\"secondary\"\n />\n </ToastLib.Close>\n </div>\n );\n\n return (\n <ToastLib.Root\n className={cn(\n 'flex items-start gap-space-2 rounded-md border p-space-3',\n surface,\n 'shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px]',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[state=closed]:animate-hide data-[state=open]:animate-slideIn data-[swipe=end]:animate-swipeOut data-[swipe=cancel]:transition-[transform_200ms_ease-out]'\n )}\n open={open}\n onOpenChange={setOpen}\n duration={duration}\n >\n {hasTitle ? (\n <div\n className={cn(\n 'flex w-full flex-col gap-space-1',\n Boolean(description) && 'pb-space-1'\n )}\n >\n <div className=\"flex w-full items-center\">\n <div className=\"flex w-full items-center gap-space-3\">\n {renderToastIcon(isError, type)}\n <ToastLib.Title\n className=\"cursor-text select-text text-sm font-medium text-primary\"\n onPointerDown={stopSwipeOnTextSelect}\n >\n {title}\n </ToastLib.Title>\n </div>\n {trailingButtons}\n </div>\n {descriptionNode}\n {action && <div className=\"ml-space-6\">{action}</div>}\n </div>\n ) : (\n <div className=\"flex w-full items-start gap-space-2\">\n {renderToastIcon(isError, type)}\n <div className=\"flex flex-1 flex-col gap-space-2\">\n {descriptionNode}\n {action}\n </div>\n {trailingButtons}\n </div>\n )}\n </ToastLib.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAM,sBAAsB;AAE5B,IAAM,oBAAoB;AAG1B,SAAgB,cAAc,EAAE,YAA2C;CAEzE,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,MAAM,SAGtB,IAAI;CACd,MAAM,SAAS,OAAO;CAEtB,MAAM,cAAc,aAAa,kBAAwC;EACvE,MAAM,YACJ,OAAO,kBAAkB,WACrB,EAAE,OAAO,cAAc,IACvB;EAEN,MAAM,SAAsB;GAC1B,UAFc,UAAU,SAAS,UAAU,SAAS,UAEhC,oBAAoB;GACxC,GAAG;EACL;EAEA,UAAU,cAAc;GAAE,KAAK,UAAU,MAAM,KAAK;GAAG;EAAO,EAAE;EAChE,QAAQ,IAAI;CACd,GAAG,CAAC,CAAC;CAEL,OACE,qBAAC,aAAa,UAAd;EAAuB,OAAO,EAAE,YAAY;EAA5C,UAAA,CACG,UAED,qBAAC,SAAS,UAAV;GAAmC,gBAAe;GAAlD,UAAA,CACE,oBAAC,gBAAD;IAAgB,OAAO,SAAS;IAC9B,UAAA,oBAAC,OAAD;KACE,OA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B,GAAG,MAAM,IAAI,gBACb,QACF;CAEN,MAAM,kBAAkB,eACtB,oBAAC,SAAS,aAAV;EAAsB,SAAA;EACpB,UAAA,oBAAC,OAAD;GACE,WAAW,GACT,wEACA,WACI,uCACA,sBACN;GACA,eAAe;GAEd,UAAA;EACE,CAAA;CACe,CAAA;CAGxB,MAAM,kBACJ,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,YACC,oBAAC,gBAAD;GACE,MAAK;GACL,MAAM;GACN,UAAS;EACV,CAAA,GAEH,oBAAC,SAAS,OAAV;GAAgB,SAAA;GACd,UAAA,oBAAC,YAAD;IACE,MAAM;IACN,OAAM;IACN,MAAK;IACL,SAAQ;IACR,OAAM;GACP,CAAA;EACa,CAAA,CACb;;CAGP,OACE,oBAAC,SAAS,MAAV;EACE,WAAW,GACT,4DACA,SACA,iGACA,kQACF;EACM;EACN,cAAc;EACJ;EAET,UAAA,WACC,qBAAC,OAAD;GACE,WAAW,GACT,oCACA,QAAQ,WAAW,KAAK,YAC1B;GAJF,UAAA;IAME,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACG,gBAAgB,SAAS,IAAI,GAC9B,oBAAC,SAAS,OAAV;OACE,WAAU;OACV,eAAe;OAEd,UAAA;MACa,CAAA,CACb;KACJ,CAAA,GAAA,eACE;;IACJ;IACA,UAAU,oBAAC,OAAD;KAAK,WAAU;KAAc,UAAA;IAAY,CAAA;GACjD;EAEL,CAAA,IAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACG,gBAAgB,SAAS,IAAI;IAC9B,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,iBACA,MACE;;IACJ;GACE;;CAEM,CAAA;AAEnB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Toast/index.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\n\nimport { ExclamationMarkIcon } from '@phosphor-icons/react/dist/ssr/ExclamationMark';\nimport { InfoIcon } from '@phosphor-icons/react/dist/ssr/Info';\nimport * as ToastLib from '@radix-ui/react-toast';\n\nimport { CheckIcon, XCloseIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { CopyIconButton } from '../CopyButton';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { ToastContext } from './ToastContext';\n\nconst DEFAULT_DURATION_MS = 5000;\n// Error toasts do not auto-dismiss; the user must click the close button.\nconst ERROR_DURATION_MS = Infinity;\n\n// Provider wraps whole application\nexport function ToastProvider({ children }: { children: React.ReactNode }) {\n // note this only supports one toast at a time currently\n const [open, setOpen] = React.useState(false);\n const [toast, setToast] = React.useState<{\n id: number;\n config: ToastConfig;\n } | null>(null);\n const config = toast?.config;\n\n const createToast = useCallback((titleOrConfig: ToastConfig | string) => {\n const preConfig =\n typeof titleOrConfig === 'string'\n ? { title: titleOrConfig }\n : titleOrConfig;\n const isError = preConfig.error || preConfig.type === 'error';\n const config: ToastConfig = {\n duration: isError ? ERROR_DURATION_MS : DEFAULT_DURATION_MS,\n ...preConfig,\n };\n\n setToast((previous) => ({ id: (previous?.id ?? 0) + 1, config }));\n setOpen(true);\n }, []);\n\n return (\n <ToastContext.Provider value={{ createToast }}>\n {children}\n {/* Reset Radix's paused state without remounting application children. */}\n <ToastLib.Provider key={toast?.id} swipeDirection=\"right\">\n <ZIndexProvider value={zIndices.toast}>\n <Toast\n title={config?.title}\n description={config?.description}\n open={open}\n setOpen={setOpen}\n action={config?.action}\n error={config?.error}\n duration={config?.duration}\n type={config?.type}\n />\n </ZIndexProvider>\n <ToastLib.Viewport\n className={cn(\n 'fixed bottom-0 right-0 m-0 flex w-[390px] max-w-full list-none flex-col gap-[10px] p-[var(--viewport-padding)] outline-hidden [--viewport-padding:_25px]',\n config?.viewPortClassName\n )}\n style={{ zIndex: zIndices.toast }}\n />\n </ToastLib.Provider>\n </ToastContext.Provider>\n );\n}\n\nexport type ToastConfig = {\n title?: string | React.ReactNode;\n description?: React.ReactNode;\n action?: React.ReactNode;\n duration?: number;\n viewPortClassName?: string;\n error?: boolean;\n type?: 'error' | 'info' | 'warning' | 'success';\n};\n\nconst stopSwipeOnTextSelect = (e: React.PointerEvent) => e.stopPropagation();\n\nconst SURFACE_BY_TYPE = {\n default: 'bg-surface-level-2 border-subtle',\n error: 'bg-error border-error',\n warning: 'bg-warning border-warning',\n success: 'bg-success border-success',\n info: 'bg-brand-subtle border-brand-75',\n} as const;\n\nfunction renderToastIcon(isError: boolean, type: ToastConfig['type']) {\n if (isError)\n return (\n <Icon\n icon={ExclamationMarkIcon}\n weight=\"regular\"\n size=\"sm\"\n rounded\n color=\"error\"\n />\n );\n if (type === 'success')\n return <Icon icon={CheckIcon} size=\"sm\" rounded color=\"success\" />;\n if (type === 'warning')\n return (\n <Icon\n icon={ExclamationMarkIcon}\n weight=\"regular\"\n size=\"sm\"\n rounded\n color=\"warning\"\n />\n );\n if (type === 'info')\n return (\n <Icon icon={InfoIcon} weight=\"fill\" size=\"sm\" rounded color=\"info\" />\n );\n return (\n <Icon icon={InfoIcon} weight=\"fill\" size=\"sm\" rounded color=\"neutral\" />\n );\n}\n\nfunction Toast({\n title,\n open,\n setOpen,\n description,\n action,\n error,\n duration,\n type,\n}: {\n title?: string | React.ReactNode;\n open: boolean;\n setOpen?: (open: boolean) => void;\n description?: React.ReactNode;\n action?: React.ReactNode;\n error?: boolean;\n duration?: number;\n type?: 'error' | 'info' | 'warning' | 'success';\n}) {\n const isError = error || type === 'error';\n const surface = SURFACE_BY_TYPE[isError ? 'error' : (type ?? 'default')];\n const hasTitle = title !== undefined && title !== null && title !== '';\n const copyText =\n isError && typeof title === 'string'\n ? typeof description === 'string'\n ? `${title}\\n${description}`\n : title\n : null;\n\n const descriptionNode = description && (\n <ToastLib.Description asChild>\n <div\n className={cn(\n 'max-h-32 cursor-text select-text overflow-y-auto whitespace-pre-wrap',\n hasTitle\n ? 'ml-space-6 text-xxs text-secondary'\n : 'text-sm text-primary'\n )}\n onPointerDown={stopSwipeOnTextSelect}\n >\n {description}\n </div>\n </ToastLib.Description>\n );\n\n const trailingButtons = (\n <div className=\"flex gap-space-2\">\n {copyText && (\n <CopyIconButton\n size=\"xs\"\n copy={copyText}\n copyText=\"Copy error message\"\n />\n )}\n <ToastLib.Close asChild>\n <IconButton\n icon={XCloseIcon}\n label=\"Dismiss\"\n size=\"xs\"\n variant=\"plain\"\n color=\"secondary\"\n />\n </ToastLib.Close>\n </div>\n );\n\n return (\n <ToastLib.Root\n className={cn(\n 'flex items-start gap-space-2 rounded-md border p-space-3',\n surface,\n 'shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] dark:shadow-none',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[state=closed]:animate-hide data-[state=open]:animate-slideIn data-[swipe=end]:animate-swipeOut data-[swipe=cancel]:transition-[transform_200ms_ease-out]'\n )}\n open={open}\n onOpenChange={setOpen}\n duration={duration}\n >\n {hasTitle ? (\n <div\n className={cn(\n 'flex w-full flex-col gap-space-1',\n Boolean(description) && 'pb-space-1'\n )}\n >\n <div className=\"flex w-full items-center\">\n <div className=\"flex w-full items-center gap-space-3\">\n {renderToastIcon(isError, type)}\n <ToastLib.Title\n className=\"cursor-text select-text text-sm font-medium text-primary\"\n onPointerDown={stopSwipeOnTextSelect}\n >\n {title}\n </ToastLib.Title>\n </div>\n {trailingButtons}\n </div>\n {descriptionNode}\n {action && <div className=\"ml-space-6\">{action}</div>}\n </div>\n ) : (\n <div className=\"flex w-full items-start gap-space-2\">\n {renderToastIcon(isError, type)}\n <div className=\"flex flex-1 flex-col gap-space-2\">\n {descriptionNode}\n {action}\n </div>\n {trailingButtons}\n </div>\n )}\n </ToastLib.Root>\n );\n}\n"],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,SACA,kHACA,kQACF;EACM;EACN,cAAc;EACJ;EAET,UAAA,WACC,qBAAC,OAAD;GACE,WAAW,GACT,oCACA,QAAQ,WAAW,KAAK,YAC1B;GAJF,UAAA;IAME,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACG,gBAAgB,SAAS,IAAI,GAC9B,oBAAC,SAAS,OAAV;OACE,WAAU;OACV,eAAe;OAEd,UAAA;MACa,CAAA,CACb;KACJ,CAAA,GAAA,eACE;;IACJ;IACA,UAAU,oBAAC,OAAD;KAAK,WAAU;KAAc,UAAA;IAAY,CAAA;GACjD;EAEL,CAAA,IAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACG,gBAAgB,SAAS,IAAI;IAC9B,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,iBACA,MACE;;IACJ;GACE;;CAEM,CAAA;AAEnB"}
@@ -29,7 +29,7 @@ function Tooltip({ title, description, children, tooltipClassName, side = "top",
29
29
  align,
30
30
  alignOffset,
31
31
  collisionPadding: 8,
32
- className: cn("max-w-[320px] overflow-hidden rounded-md border border-secondary bg-background p-space-2 text-sm shadow-md dark:bg-secondary", "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", tooltipClassName, invert && "invert"),
32
+ className: cn("max-w-[320px] overflow-hidden rounded-md border border-subtle bg-popover p-space-2 text-sm shadow-md", "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", tooltipClassName, invert && "invert"),
33
33
  style: { zIndex },
34
34
  children: /* @__PURE__ */ jsx(ZIndexProvider, {
35
35
  value: zIndex,
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","names":[],"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nimport { cn } from '../../utils/cn';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { Text } from '../Text';\n\nexport type TooltipProps = {\n title?: string | ReactNode;\n description?: ReactNode;\n children: ReactNode;\n tooltipClassName?: string;\n side?: 'top' | 'bottom' | 'left' | 'right';\n sideOffset?: number;\n align?: 'start' | 'center' | 'end';\n alignOffset?: number;\n invert?: boolean;\n delayDuration?: number;\n disabled?: boolean;\n blockTriggerEvents?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n disableHoverableContent?: boolean;\n};\n\n// Tooltip sets two opinionated defaults — override with caution:\n// - delayDuration=300: prevents tooltips from blocking clicks\n// - disableHoverableContent=true: dismisses the tooltip when hovering off the trigger\nexport function Tooltip({\n title,\n description,\n children,\n tooltipClassName,\n side = 'top',\n sideOffset = 10,\n align = 'center',\n alignOffset = 0,\n invert = false,\n delayDuration = 300,\n disabled = false,\n blockTriggerEvents = false,\n open,\n onOpenChange,\n disableHoverableContent = true,\n}: TooltipProps) {\n // Tooltips have no fixed z-index floor — they always render one level above\n // their parent caller so they naturally stack above whichever layer triggered them.\n const zIndex = useZIndex(zIndices.tooltip);\n\n if ((!title && !description) || disabled) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root\n delayDuration={delayDuration}\n open={open}\n onOpenChange={onOpenChange}\n disableHoverableContent={disableHoverableContent}\n >\n <TooltipPrimitive.Trigger\n asChild\n onPointerDown={(e) => {\n if (blockTriggerEvents) {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n sideOffset={sideOffset}\n side={side}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={8}\n className={cn(\n 'max-w-[320px] overflow-hidden rounded-md border border-secondary bg-background p-space-2 text-sm shadow-md dark:bg-secondary',\n 'animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n tooltipClassName,\n invert && 'invert'\n )}\n style={{ zIndex }}\n >\n <ZIndexProvider value={zIndex}>\n <div className=\"flex flex-col gap-space-2 text-xxs\">\n {typeof title === 'string' ? (\n <Text\n variant=\"sm\"\n data-target=\"title\"\n className={!tooltipClassName ? 'text-primary' : ''}\n >\n {title}\n </Text>\n ) : (\n title\n )}\n {description && (\n <Text\n variant=\"sm\"\n className={!tooltipClassName ? 'text-secondary' : ''}\n data-target=\"description\"\n >\n {description}\n </Text>\n )}\n </div>\n </ZIndexProvider>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,QAAQ,EACtB,OACA,aACA,UACA,kBACA,OAAO,OACP,aAAa,IACb,QAAQ,UACR,cAAc,GACd,SAAS,OACT,gBAAgB,KAChB,WAAW,OACX,qBAAqB,OACrB,MACA,cACA,0BAA0B,QACX;CAGf,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,IAAK,CAAC,SAAS,CAAC,eAAgB,UAC9B,OAAO;CAGT,OACE,qBAAC,iBAAiB,MAAlB;EACiB;EACT;EACQ;EACW;EAJ3B,UAAA,CAME,oBAAC,iBAAiB,SAAlB;GACE,SAAA;GACA,gBAAgB,MAAM;IACpB,IAAI,oBAAoB;KACtB,EAAE,eAAe;KACjB,EAAE,gBAAgB;IACpB;GACF;GAEC;EACuB,CAAA,GAC1B,oBAAC,iBAAiB,QAAlB,EAAA,UACE,oBAAC,iBAAiB,SAAlB;GACc;GACN;GACC;GACM;GACb,kBAAkB;GAClB,WAAW,GACT,gIACA,8RACA,kBACA,UAAU,QACZ;GACA,OAAO,EAAE,OAAO;GAEhB,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IACrB,UAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,OAAO,UAAU,WAChB,oBAAC,MAAD;MACE,SAAQ;MACR,eAAY;MACZ,WAAW,CAAC,mBAAmB,iBAAiB;MAE/C,UAAA;KACG,CAAA,IAEN,OAED,eACC,oBAAC,MAAD;MACE,SAAQ;MACR,WAAW,CAAC,mBAAmB,mBAAmB;MAClD,eAAY;MAEX,UAAA;KACG,CAAA,CAEL;;GACS,CAAA;EACQ,CAAA,EACH,CAAA,CACJ;;AAE3B"}
1
+ {"version":3,"file":"Tooltip.js","names":[],"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nimport { cn } from '../../utils/cn';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { Text } from '../Text';\n\nexport type TooltipProps = {\n title?: string | ReactNode;\n description?: ReactNode;\n children: ReactNode;\n tooltipClassName?: string;\n side?: 'top' | 'bottom' | 'left' | 'right';\n sideOffset?: number;\n align?: 'start' | 'center' | 'end';\n alignOffset?: number;\n invert?: boolean;\n delayDuration?: number;\n disabled?: boolean;\n blockTriggerEvents?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n disableHoverableContent?: boolean;\n};\n\n// Tooltip sets two opinionated defaults — override with caution:\n// - delayDuration=300: prevents tooltips from blocking clicks\n// - disableHoverableContent=true: dismisses the tooltip when hovering off the trigger\nexport function Tooltip({\n title,\n description,\n children,\n tooltipClassName,\n side = 'top',\n sideOffset = 10,\n align = 'center',\n alignOffset = 0,\n invert = false,\n delayDuration = 300,\n disabled = false,\n blockTriggerEvents = false,\n open,\n onOpenChange,\n disableHoverableContent = true,\n}: TooltipProps) {\n // Tooltips have no fixed z-index floor — they always render one level above\n // their parent caller so they naturally stack above whichever layer triggered them.\n const zIndex = useZIndex(zIndices.tooltip);\n\n if ((!title && !description) || disabled) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root\n delayDuration={delayDuration}\n open={open}\n onOpenChange={onOpenChange}\n disableHoverableContent={disableHoverableContent}\n >\n <TooltipPrimitive.Trigger\n asChild\n onPointerDown={(e) => {\n if (blockTriggerEvents) {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n sideOffset={sideOffset}\n side={side}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={8}\n className={cn(\n 'max-w-[320px] overflow-hidden rounded-md border border-subtle bg-popover p-space-2 text-sm shadow-md',\n 'animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n tooltipClassName,\n invert && 'invert'\n )}\n style={{ zIndex }}\n >\n <ZIndexProvider value={zIndex}>\n <div className=\"flex flex-col gap-space-2 text-xxs\">\n {typeof title === 'string' ? (\n <Text\n variant=\"sm\"\n data-target=\"title\"\n className={!tooltipClassName ? 'text-primary' : ''}\n >\n {title}\n </Text>\n ) : (\n title\n )}\n {description && (\n <Text\n variant=\"sm\"\n className={!tooltipClassName ? 'text-secondary' : ''}\n data-target=\"description\"\n >\n {description}\n </Text>\n )}\n </div>\n </ZIndexProvider>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,QAAQ,EACtB,OACA,aACA,UACA,kBACA,OAAO,OACP,aAAa,IACb,QAAQ,UACR,cAAc,GACd,SAAS,OACT,gBAAgB,KAChB,WAAW,OACX,qBAAqB,OACrB,MACA,cACA,0BAA0B,QACX;CAGf,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,IAAK,CAAC,SAAS,CAAC,eAAgB,UAC9B,OAAO;CAGT,OACE,qBAAC,iBAAiB,MAAlB;EACiB;EACT;EACQ;EACW;EAJ3B,UAAA,CAME,oBAAC,iBAAiB,SAAlB;GACE,SAAA;GACA,gBAAgB,MAAM;IACpB,IAAI,oBAAoB;KACtB,EAAE,eAAe;KACjB,EAAE,gBAAgB;IACpB;GACF;GAEC;EACuB,CAAA,GAC1B,oBAAC,iBAAiB,QAAlB,EAAA,UACE,oBAAC,iBAAiB,SAAlB;GACc;GACN;GACC;GACM;GACb,kBAAkB;GAClB,WAAW,GACT,wGACA,8RACA,kBACA,UAAU,QACZ;GACA,OAAO,EAAE,OAAO;GAEhB,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IACrB,UAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,OAAO,UAAU,WAChB,oBAAC,MAAD;MACE,SAAQ;MACR,eAAY;MACZ,WAAW,CAAC,mBAAmB,iBAAiB;MAE/C,UAAA;KACG,CAAA,IAEN,OAED,eACC,oBAAC,MAAD;MACE,SAAQ;MACR,WAAW,CAAC,mBAAmB,mBAAmB;MAClD,eAAY;MAEX,UAAA;KACG,CAAA,CAEL;;GACS,CAAA;EACQ,CAAA,EACH,CAAA,CACJ;;AAE3B"}
@@ -48,7 +48,7 @@ function TypeaheadDefaultTag({ selected, index, disabled, size, getLabel, getVal
48
48
  event.stopPropagation();
49
49
  onRemove();
50
50
  } : void 0,
51
- className: cn("min-w-0 max-w-full justify-start border-default bg-surface-level-2 px-space-1 text-primary [&>span]:min-w-0 [&>span]:truncate [&>span]:text-xxs", size === "xs" && "border-0 py-0", !disabled && "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--border-focus)]", disabled && "cursor-not-allowed"),
51
+ className: cn("min-w-0 max-w-full justify-start border-default bg-surface-level-2 px-space-1 text-primary [&>span]:min-w-0 [&>span]:truncate [&>span]:text-xxs [&>span]:leading-[1.125rem]", size === "xs" && "border-0 py-0", !disabled && "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--border-focus)]", disabled && "cursor-not-allowed"),
52
52
  children: label
53
53
  }, `${getValue(selected)}-${index}`);
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TypeaheadParts.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadParts.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { CheckIcon, PlusIcon, XIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport type { OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Badge } from '../Badge';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\nimport type {\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\n\nexport function TypeaheadClearButton({\n label,\n onClick,\n size,\n}: {\n label: string;\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n size: TypeaheadSize;\n}) {\n // Let the click target extend vertically without making tag rows taller.\n return (\n <IconButton\n type=\"button\"\n icon={XIcon}\n iconWeight=\"regular\"\n label={label}\n variant=\"plain\"\n color=\"secondary\"\n size={CONTROL_ICON_SIZES[size].buttonSize}\n tooltipProps={{ title: null }}\n className=\"bg-transparent text-icon-tertiary shadow-none hover:bg-elevated-hover hover:text-icon-primary\"\n style={{ marginBlock: CONTROL_ICON_SIZES[size].actionOffset }}\n onMouseDown={(event) => event.preventDefault()}\n onClick={onClick}\n />\n );\n}\n\nexport function TypeaheadDefaultTag<TOption>({\n selected,\n index,\n disabled,\n size,\n getLabel,\n getValue,\n onRemove,\n}: {\n selected: TypeaheadSelectedValue<TOption>;\n index: number;\n disabled: boolean;\n size: TypeaheadSize;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n onRemove: () => void;\n}) {\n const label = getLabel(selected);\n\n return (\n <Badge\n key={`${getValue(selected)}-${index}`}\n color=\"plain\"\n rounded=\"xs\"\n size={size === 'xs' || size === 'sm' ? 'xs' : 'sm'}\n textWeight=\"normal\"\n rightDecorator={!disabled ? XIcon : undefined}\n iconWeight=\"regular\"\n aria-label={!disabled ? `Remove ${label}` : undefined}\n role={!disabled ? 'button' : undefined}\n tabIndex={!disabled ? 0 : undefined}\n onMouseDown={(event) => event.preventDefault()}\n onKeyDown={(event) => {\n if (!disabled && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n event.stopPropagation();\n onRemove();\n }\n }}\n onClick={\n !disabled\n ? (event) => {\n event.stopPropagation();\n onRemove();\n }\n : undefined\n }\n className={cn(\n 'min-w-0 max-w-full justify-start border-default bg-surface-level-2 px-space-1 text-primary [&>span]:min-w-0 [&>span]:truncate [&>span]:text-xxs',\n size === 'xs' && 'border-0 py-0',\n !disabled &&\n 'cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--border-focus)]',\n disabled && 'cursor-not-allowed'\n )}\n >\n {label}\n </Badge>\n );\n}\n\nexport function TypeaheadDefaultOption<TOption>({\n option,\n state,\n getLabel,\n size,\n}: {\n option: TypeaheadSelectedValue<TOption>;\n state: TypeaheadRenderOptionState;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n size: OptionRowSize;\n}) {\n const label = getLabel(option);\n const description = isTypeaheadOption(option)\n ? option.description\n : undefined;\n const rightDecorator = isTypeaheadOption(option)\n ? option.rightDecorator\n : undefined;\n\n return (\n <>\n <Icon\n aria-hidden=\"true\"\n icon={CheckIcon}\n size=\"md\"\n className={cn(\n 'shrink-0 text-icon-primary',\n state.selected ? 'opacity-100' : 'opacity-0'\n )}\n />\n <OptionText label={label} description={description} size={size} />\n {rightDecorator && (\n <div className=\"ml-auto shrink-0\">{rightDecorator}</div>\n )}\n </>\n );\n}\n\nfunction OptionText({\n label,\n description,\n size,\n}: {\n label: string;\n description: ReactNode;\n size: OptionRowSize;\n}) {\n return (\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text\n as=\"span\"\n variant={size}\n className={cn(\n 'truncate tracking-normal text-primary',\n size === 'sm' ? 'leading-4' : 'leading-5'\n )}\n >\n {label}\n </Text>\n {description && (\n <Text as=\"span\" variant=\"xs\" className=\"truncate text-tertiary\">\n {description}\n </Text>\n )}\n </div>\n );\n}\n\nexport function TypeaheadCreateOption({\n inputValue,\n label,\n}: {\n inputValue: string;\n label?: ReactNode;\n}) {\n if (label != null) {\n return label;\n }\n\n return (\n <>\n <span\n aria-hidden\n className=\"inline-flex size-4 shrink-0 text-icon-secondary\"\n >\n <PlusIcon size=\"100%\" weight=\"regular\" />\n </span>\n <span className=\"min-w-0 truncate\">{inputValue || 'Add new'}</span>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,qBAAqB,EACnC,OACA,SACA,QAKC;CAED,OACE,oBAAC,YAAD;EACE,MAAK;EACL,MAAM;EACN,YAAW;EACJ;EACP,SAAQ;EACR,OAAM;EACN,MAAM,mBAAmB,KAAK,CAAC;EAC/B,cAAc,EAAE,OAAO,KAAK;EAC5B,WAAU;EACV,OAAO,EAAE,aAAa,mBAAmB,KAAK,CAAC,aAAa;EAC5D,cAAc,UAAU,MAAM,eAAe;EACpC;CACV,CAAA;AAEL;AAEA,SAAgB,oBAA6B,EAC3C,UACA,OACA,UACA,MACA,UACA,UACA,YASC;CACD,MAAM,QAAQ,SAAS,QAAQ;CAE/B,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AAC,MAAD;GACE,IAAG;GACH,SAAS;GACT,WAAW,GACT,yCACA,SAAS,OAAO,cAAc,WAChC;GAEC,UAAA;EACG,CAAA,GACL,eACC,oBAAC,MAAD;GAAM,IAAG;GAAO,SAAQ;GAAK,WAAU;GACpC,UAAA;EACG,CAAA,CAEL;;AAET;AAEA,SAAgB,sBAAsB,EACpC,YACA,SAIC;CACD,IAAI,SAAS,MACX,OAAO;CAGT,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EACE,eAAA;EACA,WAAU;EAEV,UAAA,oBAAC,UAAD;GAAU,MAAK;GAAO,QAAO;EAAW,CAAA;CACpC,CAAA,GACN,oBAAC,QAAD;EAAM,WAAU;EAAoB,UAAA,cAAc;CAAgB,CAAA,CAClE,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"TypeaheadParts.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadParts.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { CheckIcon, PlusIcon, XIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport type { OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Badge } from '../Badge';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\nimport type {\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\n\nexport function TypeaheadClearButton({\n label,\n onClick,\n size,\n}: {\n label: string;\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n size: TypeaheadSize;\n}) {\n // Let the click target extend vertically without making tag rows taller.\n return (\n <IconButton\n type=\"button\"\n icon={XIcon}\n iconWeight=\"regular\"\n label={label}\n variant=\"plain\"\n color=\"secondary\"\n size={CONTROL_ICON_SIZES[size].buttonSize}\n tooltipProps={{ title: null }}\n className=\"bg-transparent text-icon-tertiary shadow-none hover:bg-elevated-hover hover:text-icon-primary\"\n style={{ marginBlock: CONTROL_ICON_SIZES[size].actionOffset }}\n onMouseDown={(event) => event.preventDefault()}\n onClick={onClick}\n />\n );\n}\n\nexport function TypeaheadDefaultTag<TOption>({\n selected,\n index,\n disabled,\n size,\n getLabel,\n getValue,\n onRemove,\n}: {\n selected: TypeaheadSelectedValue<TOption>;\n index: number;\n disabled: boolean;\n size: TypeaheadSize;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n onRemove: () => void;\n}) {\n const label = getLabel(selected);\n\n return (\n <Badge\n key={`${getValue(selected)}-${index}`}\n color=\"plain\"\n rounded=\"xs\"\n size={size === 'xs' || size === 'sm' ? 'xs' : 'sm'}\n textWeight=\"normal\"\n rightDecorator={!disabled ? XIcon : undefined}\n iconWeight=\"regular\"\n aria-label={!disabled ? `Remove ${label}` : undefined}\n role={!disabled ? 'button' : undefined}\n tabIndex={!disabled ? 0 : undefined}\n onMouseDown={(event) => event.preventDefault()}\n onKeyDown={(event) => {\n if (!disabled && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n event.stopPropagation();\n onRemove();\n }\n }}\n onClick={\n !disabled\n ? (event) => {\n event.stopPropagation();\n onRemove();\n }\n : undefined\n }\n className={cn(\n 'min-w-0 max-w-full justify-start border-default bg-surface-level-2 px-space-1 text-primary [&>span]:min-w-0 [&>span]:truncate [&>span]:text-xxs [&>span]:leading-[1.125rem]',\n size === 'xs' && 'border-0 py-0',\n !disabled &&\n 'cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--border-focus)]',\n disabled && 'cursor-not-allowed'\n )}\n >\n {label}\n </Badge>\n );\n}\n\nexport function TypeaheadDefaultOption<TOption>({\n option,\n state,\n getLabel,\n size,\n}: {\n option: TypeaheadSelectedValue<TOption>;\n state: TypeaheadRenderOptionState;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n size: OptionRowSize;\n}) {\n const label = getLabel(option);\n const description = isTypeaheadOption(option)\n ? option.description\n : undefined;\n const rightDecorator = isTypeaheadOption(option)\n ? option.rightDecorator\n : undefined;\n\n return (\n <>\n <Icon\n aria-hidden=\"true\"\n icon={CheckIcon}\n size=\"md\"\n className={cn(\n 'shrink-0 text-icon-primary',\n state.selected ? 'opacity-100' : 'opacity-0'\n )}\n />\n <OptionText label={label} description={description} size={size} />\n {rightDecorator && (\n <div className=\"ml-auto shrink-0\">{rightDecorator}</div>\n )}\n </>\n );\n}\n\nfunction OptionText({\n label,\n description,\n size,\n}: {\n label: string;\n description: ReactNode;\n size: OptionRowSize;\n}) {\n return (\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text\n as=\"span\"\n variant={size}\n className={cn(\n 'truncate tracking-normal text-primary',\n size === 'sm' ? 'leading-4' : 'leading-5'\n )}\n >\n {label}\n </Text>\n {description && (\n <Text as=\"span\" variant=\"xs\" className=\"truncate text-tertiary\">\n {description}\n </Text>\n )}\n </div>\n );\n}\n\nexport function TypeaheadCreateOption({\n inputValue,\n label,\n}: {\n inputValue: string;\n label?: ReactNode;\n}) {\n if (label != null) {\n return label;\n }\n\n return (\n <>\n <span\n aria-hidden\n className=\"inline-flex size-4 shrink-0 text-icon-secondary\"\n >\n <PlusIcon size=\"100%\" weight=\"regular\" />\n </span>\n <span className=\"min-w-0 truncate\">{inputValue || 'Add new'}</span>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,qBAAqB,EACnC,OACA,SACA,QAKC;CAED,OACE,oBAAC,YAAD;EACE,MAAK;EACL,MAAM;EACN,YAAW;EACJ;EACP,SAAQ;EACR,OAAM;EACN,MAAM,mBAAmB,KAAK,CAAC;EAC/B,cAAc,EAAE,OAAO,KAAK;EAC5B,WAAU;EACV,OAAO,EAAE,aAAa,mBAAmB,KAAK,CAAC,aAAa;EAC5D,cAAc,UAAU,MAAM,eAAe;EACpC;CACV,CAAA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A,CAAA;AAEN;AAEA,SAAS,WAAW,EAClB,OACA,aACA,QAKC;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,MAAD;GACE,IAAG;GACH,SAAS;GACT,WAAW,GACT,yCACA,SAAS,OAAO,cAAc,WAChC;GAEC,UAAA;EACG,CAAA,GACL,eACC,oBAAC,MAAD;GAAM,IAAG;GAAO,SAAQ;GAAK,WAAU;GACpC,UAAA;EACG,CAAA,CAEL;;AAET;AAEA,SAAgB,sBAAsB,EACpC,YACA,SAIC;CACD,IAAI,SAAS,MACX,OAAO;CAGT,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EACE,eAAA;EACA,WAAU;EAEV,UAAA,oBAAC,UAAD;GAAU,MAAK;GAAO,QAAO;EAAW,CAAA;CACpC,CAAA,GACN,oBAAC,QAAD;EAAM,WAAU;EAAoB,UAAA,cAAc;CAAgB,CAAA,CAClE,EAAA,CAAA;AAEN"}
@@ -67,13 +67,13 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
67
67
  const inputField = /* @__PURE__ */ jsxs("div", {
68
68
  className: cn("flex items-center gap-space-2", multiple ? "min-w-0 flex-1" : "flex-1", !multiple && (size === "xs" ? "min-w-12" : "min-w-16")),
69
69
  children: [leftDecorator != null ? /* @__PURE__ */ jsx("div", {
70
- className: "flex min-w-0 shrink items-center text-icon-tertiary",
70
+ className: cn("flex min-w-0 shrink items-center text-icon-tertiary", disabled && "text-icon-disabled"),
71
71
  children: leftDecorator
72
72
  }) : !multiple && !hasValue ? /* @__PURE__ */ jsx(Icon, {
73
73
  "aria-hidden": true,
74
74
  icon: MagnifyingGlassIcon,
75
75
  iconClassName: CONTROL_ICON_SIZES[size].iconClassName,
76
- className: "text-icon-tertiary",
76
+ className: disabled ? "text-icon-disabled" : "text-icon-tertiary",
77
77
  weight: "regular"
78
78
  }) : null, /* @__PURE__ */ jsx(Command.Input, {
79
79
  ref: setInputNode,
@@ -96,7 +96,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
96
96
  "aria-invalid": isError || void 0,
97
97
  "aria-describedby": multiple ? selectedSummaryId : void 0,
98
98
  "aria-label": inputAriaLabel,
99
- className: cn("min-w-0 max-w-full border-none bg-transparent p-0 outline-none placeholder:text-placeholder", INPUT_TEXT_CLASSES[size], disabled && "cursor-not-allowed", multiple ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], "w-full") : "h-full w-full flex-1")
99
+ className: cn("min-w-0 max-w-full border-none bg-transparent p-0 outline-hidden placeholder:text-placeholder", INPUT_TEXT_CLASSES[size], disabled && "cursor-not-allowed text-disabled placeholder:text-disabled", multiple ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], "w-full") : "h-full w-full flex-1")
100
100
  })]
101
101
  });
102
102
  const actionControls = /* @__PURE__ */ jsxs("div", {
@@ -113,7 +113,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
113
113
  "aria-hidden": true,
114
114
  icon: CaretDownIcon,
115
115
  iconClassName: CONTROL_ICON_SIZES[size].iconClassName,
116
- className: cn("text-icon-tertiary transition-transform", open && "rotate-180"),
116
+ className: cn("text-icon-tertiary transition-transform", disabled && "text-icon-disabled", open && "rotate-180"),
117
117
  weight: "regular"
118
118
  })]
119
119
  });
@@ -133,12 +133,12 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
133
133
  ...root.props,
134
134
  "data-testid": dataTestId,
135
135
  onBlur: handleBlur,
136
- className: cn("w-full cursor-text border border-default bg-elevated text-primary transition-colors", multiple ? "flex flex-wrap items-center gap-space-1" : "flex items-center gap-space-1 overflow-hidden", "focus-within:border-focus focus-within:bg-elevated hover:bg-elevated-hover", controlHeightClass, multiple && {
136
+ className: cn("w-full cursor-text border border-muted bg-input text-primary transition-colors", multiple ? "flex flex-wrap items-center gap-space-1" : "flex items-center gap-space-1 overflow-hidden", !disabled && "focus-within:bg-input hover:bg-elevated-hover", !disabled && !isError && "[&:hover:not(:focus-within)]:border-subtle focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]", controlHeightClass, multiple && {
137
137
  "px-space-1 py-0": size === "xs",
138
138
  "px-space-1 py-px": size === "sm",
139
139
  "px-space-2 py-0.5": size === "md",
140
140
  "px-space-3 py-space-1": size === "lg"
141
- }, !multiple && controlPaddingClass, CONTROL_RADIUS_CLASSES[size], isError && "border-error focus-within:border-error", disabled && "cursor-not-allowed border-disabled bg-disabled text-disabled opacity-70", className),
141
+ }, !multiple && controlPaddingClass, CONTROL_RADIUS_CLASSES[size], !disabled && isError && "border-error focus-within:border-error", disabled && "cursor-not-allowed border-muted bg-input-disabled text-disabled", className),
142
142
  onClick: (event) => {
143
143
  root.props.onClick?.(event);
144
144
  if (!disabled) {
@@ -161,7 +161,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
161
161
  }),
162
162
  /* @__PURE__ */ jsx(PopoverContent, {
163
163
  ref: popoverContentRef,
164
- className: "w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-elevated p-space-1 text-primary",
164
+ className: "w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-popover p-space-1 text-primary",
165
165
  align: "start",
166
166
  sideOffset: 4,
167
167
  onEscapeKeyDown: handleEscapeKeyDown,
@@ -199,7 +199,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
199
199
  onSelect: () => selectValue(option),
200
200
  "aria-checked": multiple ? selected : void 0,
201
201
  size: itemRowSize,
202
- className: cn("flex items-center gap-space-2 text-primary hover:bg-surface-level-2 aria-selected:bg-surface-level-2", optionDisabled && "text-disabled"),
202
+ className: cn("flex items-center gap-space-2 text-primary", optionDisabled && "text-disabled"),
203
203
  children: renderOption && item.source === "option" ? renderOption(option, optionState) : /* @__PURE__ */ jsx(TypeaheadDefaultOption, {
204
204
  option,
205
205
  state: optionState,
@@ -214,7 +214,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
214
214
  onSelect: createOption.onCreate,
215
215
  size: itemRowSize,
216
216
  "aria-label": createOption.inputValue ? `Add ${createOption.inputValue}` : "Add new",
217
- className: "flex items-center gap-space-2 text-primary hover:bg-surface-level-2 aria-selected:bg-surface-level-2",
217
+ className: "flex items-center gap-space-2 text-primary",
218
218
  children: /* @__PURE__ */ jsx(TypeaheadCreateOption, {
219
219
  inputValue: createOption.inputValue,
220
220
  label: createOption.label
@@ -1 +1 @@
1
- {"version":3,"file":"TypeaheadView.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadView.tsx"],"sourcesContent":["/* eslint-disable max-lines -- Keep the control, tag layout, and popover rendering together in this view. */\nimport type {\n FocusEvent,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n} from 'react';\nimport { useRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Command, CommandEmpty, CommandItem, CommandList } from '../Command';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverAnchor, PopoverContent } from '../Popover';\nimport { Text } from '../Text';\nimport type {\n TypeaheadListItem,\n TypeaheadMultipleValue,\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n TypeaheadTagProps,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\nimport {\n TypeaheadClearButton,\n TypeaheadCreateOption,\n TypeaheadDefaultOption,\n TypeaheadDefaultTag,\n} from './TypeaheadParts';\n\ninterface TypeaheadViewRootProps {\n ref: Ref<HTMLDivElement>;\n props: HTMLAttributes<HTMLDivElement>;\n handleBlur: (event: FocusEvent<HTMLDivElement>) => void;\n dataTestId?: string;\n className?: string;\n}\n\ninterface TypeaheadViewState {\n size: TypeaheadSize;\n disabled: boolean;\n isError: boolean;\n multiple?: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\ninterface TypeaheadViewIds {\n commandLabel: string;\n resolvedInputId: string;\n listId: string;\n selectedSummaryId: string;\n inputAriaLabel?: string;\n}\n\ninterface TypeaheadViewInputProps {\n value: string;\n onValueChange: (value: string) => void;\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;\n placeholder: string;\n leftDecorator?: ReactNode;\n showPlaceholderWithValues: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n setNode: (node: HTMLInputElement | null) => void;\n focus: () => void;\n}\n\ninterface TypeaheadViewSelectionProps<TOption> {\n selectedValues: TypeaheadMultipleValue<TOption>;\n selectedKeys: Set<string>;\n getTagProps: (params: { index: number }) => TypeaheadTagProps;\n renderTags?: (\n value: TypeaheadMultipleValue<TOption>,\n getTagProps: (params: { index: number }) => TypeaheadTagProps\n ) => ReactNode;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n showClearButton: boolean;\n clearValue: () => void;\n forcePopupIcon: boolean;\n selectedSummary?: string;\n}\n\ninterface TypeaheadViewListProps<TOption> {\n ref: Ref<HTMLDivElement>;\n items: TypeaheadListItem<TOption>[];\n emptyText: string;\n emptyState?: ReactNode;\n listFooter?: ReactNode;\n hideEmptyList: boolean;\n optionIsDisabled: (item: TypeaheadListItem<TOption>) => boolean;\n selectValue: (selected: TypeaheadSelectedValue<TOption>) => void;\n renderOption?: (\n option: TOption,\n state: TypeaheadRenderOptionState\n ) => ReactNode;\n}\n\ninterface TypeaheadViewCreateOptionProps {\n show: boolean;\n inputValue: string;\n label?: ReactNode;\n onCreate: () => void;\n}\n\ninterface TypeaheadViewProps<TOption> {\n root: TypeaheadViewRootProps;\n state: TypeaheadViewState;\n ids: TypeaheadViewIds;\n input: TypeaheadViewInputProps;\n selection: TypeaheadViewSelectionProps<TOption>;\n list: TypeaheadViewListProps<TOption>;\n createOption: TypeaheadViewCreateOptionProps;\n popoverContentRef: Ref<HTMLDivElement>;\n}\n\nconst CONTROL_RADIUS_CLASSES = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst MULTIPLE_INPUT_HEIGHT_CLASSES = {\n xs: 'h-4',\n sm: 'h-5',\n md: 'h-6',\n lg: 'h-6',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst INPUT_TEXT_CLASSES = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs leading-normal',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n} as const satisfies Record<TypeaheadSize, string>;\n\nexport function TypeaheadView<TOption>({\n root,\n state,\n ids,\n input,\n selection,\n list,\n createOption,\n popoverContentRef,\n}: TypeaheadViewProps<TOption>) {\n const controlRef = useRef<HTMLDivElement | null>(null);\n const preventInputDismiss = (event: Event) => {\n if (\n open &&\n event.target instanceof HTMLInputElement &&\n event.target.getAttribute('role') === 'combobox' &&\n controlRef.current?.contains(event.target)\n ) {\n event.preventDefault();\n }\n };\n // Escape inside the input must close this typeahead before ancestor layers\n // react to it; document-level capture listeners would otherwise dismiss the\n // enclosing dialog first.\n const handleEscapeKeyDown = (event: globalThis.KeyboardEvent) => {\n if (!open) return;\n event.preventDefault();\n setOpen(false);\n };\n const { ref: rootRef, handleBlur, dataTestId, className } = root;\n const { size, disabled, isError, multiple, open, setOpen } = state;\n const {\n commandLabel,\n resolvedInputId,\n listId,\n selectedSummaryId,\n inputAriaLabel,\n } = ids;\n const {\n value: inputValue,\n onValueChange: handleInputValueChange,\n onKeyDown: handleKeyDown,\n placeholder,\n leftDecorator,\n showPlaceholderWithValues,\n autoFocus,\n autoComplete,\n setNode: setInputNode,\n focus: focusInput,\n } = input;\n const {\n selectedValues,\n selectedKeys,\n getTagProps,\n renderTags,\n getLabel,\n getValue,\n showClearButton,\n clearValue,\n forcePopupIcon,\n selectedSummary,\n } = selection;\n const {\n ref: listRef,\n items,\n emptyText,\n emptyState,\n listFooter,\n hideEmptyList,\n optionIsDisabled,\n selectValue,\n renderOption,\n } = list;\n const hasValue = selectedValues.length > 0;\n const showEmptyState =\n items.length === 0 &&\n !createOption.show &&\n (emptyState != null || !hideEmptyList);\n const controlHeightClass = multiple\n ? CONTROL_SIZES[size].minHeightClassName\n : CONTROL_SIZES[size].heightClassName;\n const controlPaddingClass =\n size === 'xs' || size === 'sm' ? 'px-space-2' : 'px-space-3';\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n const renderedTags =\n multiple &&\n (renderTags\n ? renderTags(selectedValues, getTagProps)\n : selectedValues.map((selected, index) => {\n const tagProps = getTagProps({ index });\n return (\n <TypeaheadDefaultTag\n key={`${getValue(selected)}-${index}`}\n selected={selected}\n index={index}\n disabled={disabled}\n size={size}\n getLabel={getLabel}\n getValue={getValue}\n onRemove={tagProps.onDelete}\n />\n );\n }));\n const inputField = (\n <div\n className={cn(\n 'flex items-center gap-space-2',\n multiple ? 'min-w-0 flex-1' : 'flex-1',\n !multiple && (size === 'xs' ? 'min-w-12' : 'min-w-16')\n )}\n >\n {leftDecorator != null ? (\n <div className=\"flex min-w-0 shrink items-center text-icon-tertiary\">\n {leftDecorator}\n </div>\n ) : !multiple && !hasValue ? (\n <Icon\n aria-hidden\n icon={MagnifyingGlassIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className=\"text-icon-tertiary\"\n weight=\"regular\"\n />\n ) : null}\n {/*\n cmdk rewrites some of these combobox attributes as the query changes, so\n useTypeaheadDomSync re-asserts them imperatively. Keep the two attribute\n sets in sync when editing either here or in that hook.\n */}\n <CommandPrimitive.Input\n ref={setInputNode}\n id={resolvedInputId}\n value={inputValue}\n onValueChange={handleInputValueChange}\n onFocus={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={handleKeyDown}\n placeholder={\n hasValue && multiple && !showPlaceholderWithValues\n ? undefined\n : placeholder\n }\n disabled={disabled}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-invalid={isError || undefined}\n aria-describedby={multiple ? selectedSummaryId : undefined}\n aria-label={inputAriaLabel}\n className={cn(\n 'min-w-0 max-w-full border-none bg-transparent p-0 outline-none placeholder:text-placeholder',\n INPUT_TEXT_CLASSES[size],\n disabled && 'cursor-not-allowed',\n multiple\n ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], 'w-full')\n : 'h-full w-full flex-1'\n )}\n />\n </div>\n );\n const actionControls = (\n <div\n className={cn(\n 'flex shrink-0 items-center gap-space-1 text-icon-tertiary',\n multiple ? 'self-center' : 'ml-auto'\n )}\n style={{\n marginInlineEnd:\n showClearButton && !forcePopupIcon\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined,\n }}\n >\n {showClearButton && (\n <TypeaheadClearButton\n size={size}\n label={multiple ? 'Clear selections' : 'Clear selection'}\n onClick={(event) => {\n event.stopPropagation();\n clearValue();\n }}\n />\n )}\n {forcePopupIcon && (\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={cn(\n 'text-icon-tertiary transition-transform',\n open && 'rotate-180'\n )}\n weight=\"regular\"\n />\n )}\n </div>\n );\n\n return (\n <Command\n ref={rootRef}\n shouldFilter={false}\n label={commandLabel}\n className=\"overflow-visible bg-transparent\"\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverAnchor asChild>\n <div\n ref={controlRef}\n {...root.props}\n data-testid={dataTestId}\n onBlur={handleBlur}\n className={cn(\n 'w-full cursor-text border border-default bg-elevated text-primary transition-colors',\n multiple\n ? 'flex flex-wrap items-center gap-space-1'\n : 'flex items-center gap-space-1 overflow-hidden',\n 'focus-within:border-focus focus-within:bg-elevated hover:bg-elevated-hover',\n controlHeightClass,\n multiple && {\n 'px-space-1 py-0': size === 'xs',\n 'px-space-1 py-px': size === 'sm',\n 'px-space-2 py-0.5': size === 'md',\n 'px-space-3 py-space-1': size === 'lg',\n },\n !multiple && controlPaddingClass,\n CONTROL_RADIUS_CLASSES[size],\n isError && 'border-error focus-within:border-error',\n disabled &&\n 'cursor-not-allowed border-disabled bg-disabled text-disabled opacity-70',\n className\n )}\n onClick={(event) => {\n root.props.onClick?.(event);\n if (!disabled) {\n focusInput();\n setOpen(true);\n }\n }}\n >\n {multiple ? (\n <>\n {renderedTags}\n <div className=\"flex min-w-16 flex-1 items-center gap-space-1\">\n {inputField}\n {actionControls}\n </div>\n </>\n ) : (\n <>\n {inputField}\n {actionControls}\n </>\n )}\n </div>\n </PopoverAnchor>\n\n {multiple && (\n <span\n id={selectedSummaryId}\n className=\"sr-only\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {selectedSummary}\n </span>\n )}\n\n <PopoverContent\n ref={popoverContentRef}\n className=\"w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-elevated p-space-1 text-primary\"\n align=\"start\"\n sideOffset={4}\n onEscapeKeyDown={handleEscapeKeyDown}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={preventInputDismiss}\n onInteractOutside={preventInputDismiss}\n >\n <CommandList\n ref={listRef}\n id={listId}\n aria-label={`${commandLabel} options`}\n aria-multiselectable={multiple ? true : undefined}\n className=\"max-h-[18.75rem]\"\n >\n {showEmptyState && (\n <CommandEmpty>\n {emptyState ?? (\n <Text variant=\"sm\" color=\"secondary\">\n {emptyText}\n </Text>\n )}\n </CommandEmpty>\n )}\n\n {items.map((item) => {\n const { option } = item;\n const optionKey = getValue(option);\n const optionLabel = getLabel(option);\n const selected = selectedKeys.has(optionKey);\n const optionDisabled = optionIsDisabled(item);\n const optionState = {\n selected,\n disabled: optionDisabled,\n inputValue,\n };\n\n return (\n <CommandItem\n key={optionKey}\n value={optionKey}\n disabled={optionDisabled}\n keywords={\n isTypeaheadOption(option)\n ? [optionLabel, ...(option.keywords ?? [])]\n : [optionLabel]\n }\n onSelect={() => selectValue(option)}\n aria-checked={multiple ? selected : undefined}\n size={itemRowSize}\n className={cn(\n 'flex items-center gap-space-2 text-primary hover:bg-surface-level-2 aria-selected:bg-surface-level-2',\n optionDisabled && 'text-disabled'\n )}\n >\n {renderOption && item.source === 'option' ? (\n renderOption(option as TOption, optionState)\n ) : (\n <TypeaheadDefaultOption\n option={option}\n state={optionState}\n getLabel={getLabel}\n size={itemRowSize}\n />\n )}\n </CommandItem>\n );\n })}\n\n {createOption.show && (\n <CommandItem\n value={`__typeahead_create__${createOption.inputValue}`}\n keywords={[createOption.inputValue]}\n onSelect={createOption.onCreate}\n size={itemRowSize}\n aria-label={\n createOption.inputValue\n ? `Add ${createOption.inputValue}`\n : 'Add new'\n }\n className=\"flex items-center gap-space-2 text-primary hover:bg-surface-level-2 aria-selected:bg-surface-level-2\"\n >\n <TypeaheadCreateOption\n inputValue={createOption.inputValue}\n label={createOption.label}\n />\n </CommandItem>\n )}\n\n {listFooter}\n </CommandList>\n </PopoverContent>\n </Popover>\n </Command>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6HA,IAAM,yBAAyB;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,gCAAgC;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAgB,cAAuB,EACrC,MACA,OACA,KACA,OACA,WACA,MACA,cACA,qBAC8B;CAC9B,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,uBAAuB,UAAiB;EAC5C,IACE,QACA,MAAM,kBAAkB,oBACxB,MAAM,OAAO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aAAa,IAAI,SAAS;QAC3C,MAAM,iBAAiB,iBAAiB,IAAI;QAC5C,MAAM,cAAc;SAClB;SACA,UAAU;SACV;QACF;QAEA,OACE,oBAAC,aAAD;SAEE,OAAO;SACP,UAAU;SACV,UACE,kBAAkB,MAAM,IACpB,CAAC,aAAa,GAAI,OAAO,YAAY,CAAC,CAAE,IACxC,CAAC,WAAW;SAElB,gBAAgB,YAAY,MAAM;SAClC,gBAAc,WAAW,WAAW,KAAA;SACpC,MAAM;SACN,WAAW,GACT,wGACA,kBAAkB,eACpB;SAEC,UAAA,gBAAgB,KAAK,WAAW,WAC/B,aAAa,QAAmB,WAAW,IAE3C,oBAAC,wBAAD;UACU;UACR,OAAO;UACG;UACV,MAAM;SACP,CAAA;QAEQ,GA1BN,SA0BM;OAEjB,CAAC;OAEA,aAAa,QACZ,oBAAC,aAAD;QACE,OAAO,uBAAuB,aAAa;QAC3C,UAAU,CAAC,aAAa,UAAU;QAClC,UAAU,aAAa;QACvB,MAAM;QACN,cACE,aAAa,aACT,OAAO,aAAa,eACpB;QAEN,WAAU;QAEV,UAAA,oBAAC,uBAAD;SACE,YAAY,aAAa;SACzB,OAAO,aAAa;QACrB,CAAA;OACU,CAAA;OAGd;MACU;;IACC,CAAA;GACT;;CACF,CAAA;AAEb"}
1
+ {"version":3,"file":"TypeaheadView.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadView.tsx"],"sourcesContent":["/* eslint-disable max-lines -- Keep the control, tag layout, and popover rendering together in this view. */\nimport type {\n FocusEvent,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n} from 'react';\nimport { useRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Command, CommandEmpty, CommandItem, CommandList } from '../Command';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverAnchor, PopoverContent } from '../Popover';\nimport { Text } from '../Text';\nimport type {\n TypeaheadListItem,\n TypeaheadMultipleValue,\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n TypeaheadTagProps,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\nimport {\n TypeaheadClearButton,\n TypeaheadCreateOption,\n TypeaheadDefaultOption,\n TypeaheadDefaultTag,\n} from './TypeaheadParts';\n\ninterface TypeaheadViewRootProps {\n ref: Ref<HTMLDivElement>;\n props: HTMLAttributes<HTMLDivElement>;\n handleBlur: (event: FocusEvent<HTMLDivElement>) => void;\n dataTestId?: string;\n className?: string;\n}\n\ninterface TypeaheadViewState {\n size: TypeaheadSize;\n disabled: boolean;\n isError: boolean;\n multiple?: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\ninterface TypeaheadViewIds {\n commandLabel: string;\n resolvedInputId: string;\n listId: string;\n selectedSummaryId: string;\n inputAriaLabel?: string;\n}\n\ninterface TypeaheadViewInputProps {\n value: string;\n onValueChange: (value: string) => void;\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;\n placeholder: string;\n leftDecorator?: ReactNode;\n showPlaceholderWithValues: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n setNode: (node: HTMLInputElement | null) => void;\n focus: () => void;\n}\n\ninterface TypeaheadViewSelectionProps<TOption> {\n selectedValues: TypeaheadMultipleValue<TOption>;\n selectedKeys: Set<string>;\n getTagProps: (params: { index: number }) => TypeaheadTagProps;\n renderTags?: (\n value: TypeaheadMultipleValue<TOption>,\n getTagProps: (params: { index: number }) => TypeaheadTagProps\n ) => ReactNode;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n showClearButton: boolean;\n clearValue: () => void;\n forcePopupIcon: boolean;\n selectedSummary?: string;\n}\n\ninterface TypeaheadViewListProps<TOption> {\n ref: Ref<HTMLDivElement>;\n items: TypeaheadListItem<TOption>[];\n emptyText: string;\n emptyState?: ReactNode;\n listFooter?: ReactNode;\n hideEmptyList: boolean;\n optionIsDisabled: (item: TypeaheadListItem<TOption>) => boolean;\n selectValue: (selected: TypeaheadSelectedValue<TOption>) => void;\n renderOption?: (\n option: TOption,\n state: TypeaheadRenderOptionState\n ) => ReactNode;\n}\n\ninterface TypeaheadViewCreateOptionProps {\n show: boolean;\n inputValue: string;\n label?: ReactNode;\n onCreate: () => void;\n}\n\ninterface TypeaheadViewProps<TOption> {\n root: TypeaheadViewRootProps;\n state: TypeaheadViewState;\n ids: TypeaheadViewIds;\n input: TypeaheadViewInputProps;\n selection: TypeaheadViewSelectionProps<TOption>;\n list: TypeaheadViewListProps<TOption>;\n createOption: TypeaheadViewCreateOptionProps;\n popoverContentRef: Ref<HTMLDivElement>;\n}\n\nconst CONTROL_RADIUS_CLASSES = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst MULTIPLE_INPUT_HEIGHT_CLASSES = {\n xs: 'h-4',\n sm: 'h-5',\n md: 'h-6',\n lg: 'h-6',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst INPUT_TEXT_CLASSES = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs leading-normal',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n} as const satisfies Record<TypeaheadSize, string>;\n\nexport function TypeaheadView<TOption>({\n root,\n state,\n ids,\n input,\n selection,\n list,\n createOption,\n popoverContentRef,\n}: TypeaheadViewProps<TOption>) {\n const controlRef = useRef<HTMLDivElement | null>(null);\n const preventInputDismiss = (event: Event) => {\n if (\n open &&\n event.target instanceof HTMLInputElement &&\n event.target.getAttribute('role') === 'combobox' &&\n controlRef.current?.contains(event.target)\n ) {\n event.preventDefault();\n }\n };\n // Escape inside the input must close this typeahead before ancestor layers\n // react to it; document-level capture listeners would otherwise dismiss the\n // enclosing dialog first.\n const handleEscapeKeyDown = (event: globalThis.KeyboardEvent) => {\n if (!open) return;\n event.preventDefault();\n setOpen(false);\n };\n const { ref: rootRef, handleBlur, dataTestId, className } = root;\n const { size, disabled, isError, multiple, open, setOpen } = state;\n const {\n commandLabel,\n resolvedInputId,\n listId,\n selectedSummaryId,\n inputAriaLabel,\n } = ids;\n const {\n value: inputValue,\n onValueChange: handleInputValueChange,\n onKeyDown: handleKeyDown,\n placeholder,\n leftDecorator,\n showPlaceholderWithValues,\n autoFocus,\n autoComplete,\n setNode: setInputNode,\n focus: focusInput,\n } = input;\n const {\n selectedValues,\n selectedKeys,\n getTagProps,\n renderTags,\n getLabel,\n getValue,\n showClearButton,\n clearValue,\n forcePopupIcon,\n selectedSummary,\n } = selection;\n const {\n ref: listRef,\n items,\n emptyText,\n emptyState,\n listFooter,\n hideEmptyList,\n optionIsDisabled,\n selectValue,\n renderOption,\n } = list;\n const hasValue = selectedValues.length > 0;\n const showEmptyState =\n items.length === 0 &&\n !createOption.show &&\n (emptyState != null || !hideEmptyList);\n const controlHeightClass = multiple\n ? CONTROL_SIZES[size].minHeightClassName\n : CONTROL_SIZES[size].heightClassName;\n const controlPaddingClass =\n size === 'xs' || size === 'sm' ? 'px-space-2' : 'px-space-3';\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n const renderedTags =\n multiple &&\n (renderTags\n ? renderTags(selectedValues, getTagProps)\n : selectedValues.map((selected, index) => {\n const tagProps = getTagProps({ index });\n return (\n <TypeaheadDefaultTag\n key={`${getValue(selected)}-${index}`}\n selected={selected}\n index={index}\n disabled={disabled}\n size={size}\n getLabel={getLabel}\n getValue={getValue}\n onRemove={tagProps.onDelete}\n />\n );\n }));\n const inputField = (\n <div\n className={cn(\n 'flex items-center gap-space-2',\n multiple ? 'min-w-0 flex-1' : 'flex-1',\n !multiple && (size === 'xs' ? 'min-w-12' : 'min-w-16')\n )}\n >\n {leftDecorator != null ? (\n <div\n className={cn(\n 'flex min-w-0 shrink items-center text-icon-tertiary',\n disabled && 'text-icon-disabled'\n )}\n >\n {leftDecorator}\n </div>\n ) : !multiple && !hasValue ? (\n <Icon\n aria-hidden\n icon={MagnifyingGlassIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={disabled ? 'text-icon-disabled' : 'text-icon-tertiary'}\n weight=\"regular\"\n />\n ) : null}\n {/*\n cmdk rewrites some of these combobox attributes as the query changes, so\n useTypeaheadDomSync re-asserts them imperatively. Keep the two attribute\n sets in sync when editing either here or in that hook.\n */}\n <CommandPrimitive.Input\n ref={setInputNode}\n id={resolvedInputId}\n value={inputValue}\n onValueChange={handleInputValueChange}\n onFocus={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={handleKeyDown}\n placeholder={\n hasValue && multiple && !showPlaceholderWithValues\n ? undefined\n : placeholder\n }\n disabled={disabled}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-invalid={isError || undefined}\n aria-describedby={multiple ? selectedSummaryId : undefined}\n aria-label={inputAriaLabel}\n className={cn(\n 'min-w-0 max-w-full border-none bg-transparent p-0 outline-hidden placeholder:text-placeholder',\n INPUT_TEXT_CLASSES[size],\n disabled &&\n 'cursor-not-allowed text-disabled placeholder:text-disabled',\n multiple\n ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], 'w-full')\n : 'h-full w-full flex-1'\n )}\n />\n </div>\n );\n const actionControls = (\n <div\n className={cn(\n 'flex shrink-0 items-center gap-space-1 text-icon-tertiary',\n multiple ? 'self-center' : 'ml-auto'\n )}\n style={{\n marginInlineEnd:\n showClearButton && !forcePopupIcon\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined,\n }}\n >\n {showClearButton && (\n <TypeaheadClearButton\n size={size}\n label={multiple ? 'Clear selections' : 'Clear selection'}\n onClick={(event) => {\n event.stopPropagation();\n clearValue();\n }}\n />\n )}\n {forcePopupIcon && (\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={cn(\n 'text-icon-tertiary transition-transform',\n disabled && 'text-icon-disabled',\n open && 'rotate-180'\n )}\n weight=\"regular\"\n />\n )}\n </div>\n );\n\n return (\n <Command\n ref={rootRef}\n shouldFilter={false}\n label={commandLabel}\n className=\"overflow-visible bg-transparent\"\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverAnchor asChild>\n <div\n ref={controlRef}\n {...root.props}\n data-testid={dataTestId}\n onBlur={handleBlur}\n className={cn(\n 'w-full cursor-text border border-muted bg-input text-primary transition-colors',\n multiple\n ? 'flex flex-wrap items-center gap-space-1'\n : 'flex items-center gap-space-1 overflow-hidden',\n !disabled &&\n 'focus-within:bg-input hover:bg-elevated-hover',\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-subtle focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]',\n controlHeightClass,\n multiple && {\n 'px-space-1 py-0': size === 'xs',\n 'px-space-1 py-px': size === 'sm',\n 'px-space-2 py-0.5': size === 'md',\n 'px-space-3 py-space-1': size === 'lg',\n },\n !multiple && controlPaddingClass,\n CONTROL_RADIUS_CLASSES[size],\n !disabled && isError && 'border-error focus-within:border-error',\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n className\n )}\n onClick={(event) => {\n root.props.onClick?.(event);\n if (!disabled) {\n focusInput();\n setOpen(true);\n }\n }}\n >\n {multiple ? (\n <>\n {renderedTags}\n <div className=\"flex min-w-16 flex-1 items-center gap-space-1\">\n {inputField}\n {actionControls}\n </div>\n </>\n ) : (\n <>\n {inputField}\n {actionControls}\n </>\n )}\n </div>\n </PopoverAnchor>\n\n {multiple && (\n <span\n id={selectedSummaryId}\n className=\"sr-only\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {selectedSummary}\n </span>\n )}\n\n <PopoverContent\n ref={popoverContentRef}\n className=\"w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-popover p-space-1 text-primary\"\n align=\"start\"\n sideOffset={4}\n onEscapeKeyDown={handleEscapeKeyDown}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={preventInputDismiss}\n onInteractOutside={preventInputDismiss}\n >\n <CommandList\n ref={listRef}\n id={listId}\n aria-label={`${commandLabel} options`}\n aria-multiselectable={multiple ? true : undefined}\n className=\"max-h-[18.75rem]\"\n >\n {showEmptyState && (\n <CommandEmpty>\n {emptyState ?? (\n <Text variant=\"sm\" color=\"secondary\">\n {emptyText}\n </Text>\n )}\n </CommandEmpty>\n )}\n\n {items.map((item) => {\n const { option } = item;\n const optionKey = getValue(option);\n const optionLabel = getLabel(option);\n const selected = selectedKeys.has(optionKey);\n const optionDisabled = optionIsDisabled(item);\n const optionState = {\n selected,\n disabled: optionDisabled,\n inputValue,\n };\n\n return (\n <CommandItem\n key={optionKey}\n value={optionKey}\n disabled={optionDisabled}\n keywords={\n isTypeaheadOption(option)\n ? [optionLabel, ...(option.keywords ?? [])]\n : [optionLabel]\n }\n onSelect={() => selectValue(option)}\n aria-checked={multiple ? selected : undefined}\n size={itemRowSize}\n className={cn(\n 'flex items-center gap-space-2 text-primary',\n optionDisabled && 'text-disabled'\n )}\n >\n {renderOption && item.source === 'option' ? (\n renderOption(option as TOption, optionState)\n ) : (\n <TypeaheadDefaultOption\n option={option}\n state={optionState}\n getLabel={getLabel}\n size={itemRowSize}\n />\n )}\n </CommandItem>\n );\n })}\n\n {createOption.show && (\n <CommandItem\n value={`__typeahead_create__${createOption.inputValue}`}\n keywords={[createOption.inputValue]}\n onSelect={createOption.onCreate}\n size={itemRowSize}\n aria-label={\n createOption.inputValue\n ? `Add ${createOption.inputValue}`\n : 'Add new'\n }\n className=\"flex items-center gap-space-2 text-primary\"\n >\n <TypeaheadCreateOption\n inputValue={createOption.inputValue}\n label={createOption.label}\n />\n </CommandItem>\n )}\n\n {listFooter}\n </CommandList>\n </PopoverContent>\n </Popover>\n </Command>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6HA,IAAM,yBAAyB;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,gCAAgC;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAgB,cAAuB,EACrC,MACA,OACA,KACA,OACA,WACA,MACA,cACA,qBAC8B;CAC9B,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,uBAAuB,UAAiB;EAC5C,IACE,QACA,MAAM,kBAAkB,oBACxB,MAAM,OAAO,aAAa,MAAM,MAAM,cACtC,WAAW,SAAS,SAAS,MAAM,MAAM,GAEzC,MAAM,eAAe;CAEzB;CAIA,MAAM,uBAAuB,UAAoC;EAC/D,IAAI,CAAC,MAAM;EACX,MAAM,eAAe;EACrB,QAAQ,KAAK;CACf;CACA,MAAM,EAAE,KAAK,SAAS,YAAY,YAAY,cAAc;CAC5D,MAAM,EAAE,MAAM,UAAU,SAAS,UAAU,MAAM,YAAY;CAC7D,MAAM,EACJ,cACA,iBACA,QACA,mBACA,mBACE;CACJ,MAAM,EACJ,OAAO,YACP,eAAe,wBACf,WAAW,eACX,aACA,eACA,2BACA,WACA,cACA,SAAS,cACT,OAAO,eACL;CACJ,MAAM,EACJ,gBACA,cACA,aACA,YACA,UACA,UACA,iBACA,YACA,gBACA,oBACE;CACJ,MAAM,EACJ,KAAK,SACL,OACA,WACA,YACA,YACA,eACA,kBACA,aACA,iBACE;CACJ,MAAM,WAAW,eAAe,SAA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jB,CAAC;OAEA,aAAa,QACZ,oBAAC,aAAD;QACE,OAAO,uBAAuB,aAAa;QAC3C,UAAU,CAAC,aAAa,UAAU;QAClC,UAAU,aAAa;QACvB,MAAM;QACN,cACE,aAAa,aACT,OAAO,aAAa,eACpB;QAEN,WAAU;QAEV,UAAA,oBAAC,uBAAD;SACE,YAAY,aAAa;SACzB,OAAO,aAAa;QACrB,CAAA;OACU,CAAA;OAGd;MACU;;IACC,CAAA;GACT;;CACF,CAAA;AAEb"}
@@ -19,7 +19,7 @@ import { ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow } f
19
19
  import { Checkbox } from "./Checkbox/Checkbox.js";
20
20
  import { getCheckedState } from "./Checkbox/getCheckedState.js";
21
21
  import { Divider } from "./Divider/Divider.js";
22
- import { t as ErrorState } from "../_chunks/ErrorState-CmPX01HV.js";
22
+ import { t as ErrorState } from "../_chunks/ErrorState-BY6VBCRB.js";
23
23
  import { GroupedTabs } from "./GroupedTabs/GroupedTabs.js";
24
24
  import { HeatmapBlock } from "./HeatmapChart/HeatmapBlock.js";
25
25
  import { HeatmapChart } from "./HeatmapChart/HeatmapChart.js";
@@ -1,106 +1,3 @@
1
- /* Adapted from TurboKach/ai-native-react-components (MIT). See NOTICE. */
2
- ._grid_167sb_2 {
3
- display: inline-grid;
4
- grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr));
5
- gap: 10%;
6
- }
7
-
8
- ._pixel_167sb_8 {
9
- border-radius: 1px;
10
- opacity: 0.15;
11
- animation: _pixel-on_167sb_1 var(--loading-cycle) ease-in-out infinite;
12
- }
13
-
14
- ._dot_167sb_14 {
15
- border-radius: var(--radius-full);
16
- }
17
-
18
- ._inactive_167sb_18 {
19
- opacity: 0.07;
20
- animation: none;
21
- }
22
-
23
- ._grid_167sb_2[data-animated='false'] ._pixel_167sb_8 {
24
- animation: none;
25
- }
26
-
27
- ._grid_167sb_2[data-animated='false'] ._pixel_167sb_8:not(._inactive_167sb_18) {
28
- opacity: 0.5;
29
- }
30
-
31
- ._shimmer_167sb_31 {
32
- background-image: linear-gradient(to right, var(--tw-gradient-stops));
33
- --tw-gradient-from: var(--text-tertiary) var(--tw-gradient-from-position);
34
- --tw-gradient-to: color-mix(in srgb, var(--text-tertiary) calc(0 * 100%), transparent) var(--tw-gradient-to-position);
35
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
36
- --tw-gradient-from-position: 35%;
37
- --tw-gradient-to: color-mix(in srgb, var(--text-primary) calc(0 * 100%), transparent) var(--tw-gradient-to-position);
38
- --tw-gradient-stops: var(--tw-gradient-from), var(--text-primary) var(--tw-gradient-via-position), var(--tw-gradient-to);
39
- --tw-gradient-via-position: 50%;
40
- --tw-gradient-to: var(--text-tertiary) var(--tw-gradient-to-position);
41
- --tw-gradient-to-position: 65%;
42
- background-clip: text;
43
- color: transparent;
44
- background-size: 200% 100%;
45
- animation: _shimmer-text_167sb_1 1.4s linear infinite;
46
- }
47
-
48
- ._slow_167sb_37 {
49
- animation-duration: 2.8s;
50
- }
51
-
52
- ._brandShimmer_167sb_41 {
53
- --tw-gradient-to: color-mix(in srgb, var(--text-brand-primary) calc(0 * 100%), transparent) var(--tw-gradient-to-position);
54
- --tw-gradient-stops: var(--tw-gradient-from), var(--text-brand-primary) var(--tw-gradient-via-position), var(--tw-gradient-to);
55
- --tw-gradient-to: var(--text-tertiary) var(--tw-gradient-to-position);
56
- }
57
-
58
- @keyframes _pixel-on_167sb_1 {
59
- 0%,
60
- 100% {
61
- opacity: 0.15;
62
- }
63
- 18%,
64
- 42% {
65
- opacity: 1;
66
- }
67
- 62% {
68
- opacity: 0.15;
69
- }
70
- }
71
-
72
- @keyframes _shimmer-text_167sb_1 {
73
- from {
74
- background-position: 150% 50%;
75
- }
76
- to {
77
- background-position: -50% 50%;
78
- }
79
- }
80
-
81
- @media (prefers-reduced-motion: reduce) {
82
- ._pixel_167sb_8,
83
- ._shimmer_167sb_31 {
84
- animation: none;
85
- }
86
-
87
- ._pixel_167sb_8:not(._inactive_167sb_18) {
88
- opacity: 0.5;
89
- }
90
- ._shimmer_167sb_31 {
91
- --tw-text-opacity: 1;
92
- color: color-mix(in srgb, var(--text-secondary) calc(var(--tw-text-opacity, 1) * 100%), transparent);
93
- background: none;
94
- }
95
- }
96
-
97
- @media (forced-colors: active) {
98
- ._shimmer_167sb_31 {
99
- background: none;
100
- color: CanvasText;
101
- }
102
- ._pixel_167sb_8 {
103
- background: CanvasText;
104
- }
105
- }
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ ._grid_rs273_4{grid-template:repeat(3,minmax(0,1fr))/repeat(3,minmax(0,1fr));gap:10%;display:inline-grid}._pixel_rs273_10{opacity:.15;animation:_pixel-on_rs273_1 var(--loading-cycle) ease-in-out infinite;border-radius:1px}._dot_rs273_16{border-radius:var(--radius-full)}._inactive_rs273_20{opacity:.07;animation:none}._grid_rs273_4[data-animated=false] ._pixel_rs273_10{animation:none}._grid_rs273_4[data-animated=false] ._pixel_rs273_10:not(._inactive_rs273_20){opacity:.5}._shimmer_rs273_33{--macaw-shimmer-highlight:var(--text-primary);color:#0000;-webkit-background-clip:text;background-clip:text;background-image:linear-gradient(to right, var(--text-tertiary) 35%, var(--macaw-shimmer-highlight) 50%, var(--text-tertiary) 65%);background-size:200% 100%;animation:1.4s linear infinite _shimmer-text_rs273_1}._slow_rs273_46{animation-duration:2.8s}._brandShimmer_rs273_50{--macaw-shimmer-highlight:var(--text-brand-primary)}@keyframes _pixel-on_rs273_1{0%,to{opacity:.15}18%,42%{opacity:1}62%{opacity:.15}}@keyframes _shimmer-text_rs273_1{0%{background-position:150%}to{background-position:-50%}}@media (prefers-reduced-motion:reduce){._pixel_rs273_10,._shimmer_rs273_33{animation:none}._pixel_rs273_10:not(._inactive_rs273_20){opacity:.5}._shimmer_rs273_33{color:var(--text-secondary);background:0 0}}@media (forced-colors:active){._shimmer_rs273_33{color:canvastext;background:0 0}._pixel_rs273_10{background:canvastext}}
106
3
  /*$vite$:1*/
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import { ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow } f
19
19
  import { Checkbox } from "./components/Checkbox/Checkbox.js";
20
20
  import { getCheckedState } from "./components/Checkbox/getCheckedState.js";
21
21
  import { Divider } from "./components/Divider/Divider.js";
22
- import { t as ErrorState } from "./_chunks/ErrorState-CmPX01HV.js";
22
+ import { t as ErrorState } from "./_chunks/ErrorState-BY6VBCRB.js";
23
23
  import { GroupedTabs } from "./components/GroupedTabs/GroupedTabs.js";
24
24
  import { HeatmapBlock } from "./components/HeatmapChart/HeatmapBlock.js";
25
25
  import { HeatmapChart } from "./components/HeatmapChart/HeatmapChart.js";