@databricks/design-system 1.12.13 → 1.12.15

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 (481) hide show
  1. package/dist/{DropdownMenu-dbeef1b7.js → Stepper-a0fb4d9b.js} +1636 -1741
  2. package/dist/Stepper-a0fb4d9b.js.map +1 -0
  3. package/dist/design-system/AutoComplete/AutoComplete.d.ts +3 -0
  4. package/dist/design-system/AutoComplete/AutoComplete.d.ts.map +1 -1
  5. package/dist/design-system/Avatar/Avatar.d.ts +40 -0
  6. package/dist/design-system/Avatar/Avatar.d.ts.map +1 -0
  7. package/dist/design-system/Avatar/SvgDatabricksIcon.d.ts +3 -0
  8. package/dist/design-system/Avatar/SvgDatabricksIcon.d.ts.map +1 -0
  9. package/dist/design-system/Avatar/SvgSparkleIcon.d.ts +3 -0
  10. package/dist/design-system/Avatar/SvgSparkleIcon.d.ts.map +1 -0
  11. package/dist/design-system/Avatar/SvgUserIcon.d.ts +3 -0
  12. package/dist/design-system/Avatar/SvgUserIcon.d.ts.map +1 -0
  13. package/dist/design-system/Avatar/index.d.ts +2 -0
  14. package/dist/design-system/Avatar/index.d.ts.map +1 -0
  15. package/dist/design-system/Button/Button.d.ts +3 -5
  16. package/dist/design-system/Button/Button.d.ts.map +1 -1
  17. package/dist/design-system/Checkbox/Checkbox.d.ts.map +1 -1
  18. package/dist/design-system/ContextMenu/ContextMenu.d.ts +63 -0
  19. package/dist/design-system/ContextMenu/ContextMenu.d.ts.map +1 -0
  20. package/dist/design-system/ContextMenu/index.d.ts +2 -0
  21. package/dist/design-system/ContextMenu/index.d.ts.map +1 -0
  22. package/dist/design-system/DatePicker/DatePicker.d.ts +25 -15
  23. package/dist/design-system/DatePicker/DatePicker.d.ts.map +1 -1
  24. package/dist/design-system/DesignSystemEventProvider/DesignSystemEventProvider.d.ts +3 -1
  25. package/dist/design-system/DesignSystemEventProvider/DesignSystemEventProvider.d.ts.map +1 -1
  26. package/dist/design-system/DialogCombobox/DialogComboboxAddButton.d.ts +1 -1
  27. package/dist/design-system/DialogCombobox/DialogComboboxAddButton.d.ts.map +1 -1
  28. package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts.map +1 -1
  29. package/dist/design-system/DialogCombobox/DialogComboboxOptionListSearch.d.ts +9 -5
  30. package/dist/design-system/DialogCombobox/DialogComboboxOptionListSearch.d.ts.map +1 -1
  31. package/dist/design-system/DialogCombobox/DialogComboboxOptionListSelectItem.d.ts +1 -1
  32. package/dist/design-system/DialogCombobox/DialogComboboxOptionListSelectItem.d.ts.map +1 -1
  33. package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts.map +1 -1
  34. package/dist/design-system/DialogCombobox/index.d.ts +1 -0
  35. package/dist/design-system/DialogCombobox/index.d.ts.map +1 -1
  36. package/dist/design-system/DialogCombobox/shared.d.ts.map +1 -1
  37. package/dist/design-system/Drawer/Drawer.d.ts.map +1 -1
  38. package/dist/design-system/DropdownMenu/DropdownMenu.d.ts +2 -3
  39. package/dist/design-system/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  40. package/dist/design-system/FormV2/RHFAdapters.d.ts +17 -10
  41. package/dist/design-system/FormV2/RHFAdapters.d.ts.map +1 -1
  42. package/dist/design-system/Header/Header.d.ts.map +1 -1
  43. package/dist/design-system/Icon/Icon.d.ts +1 -1
  44. package/dist/design-system/Icon/__generated/icons/AlignCenterIcon.d.ts +1 -1
  45. package/dist/design-system/Icon/__generated/icons/AlignLeftIcon.d.ts +1 -1
  46. package/dist/design-system/Icon/__generated/icons/AlignRightIcon.d.ts +1 -1
  47. package/dist/design-system/Icon/__generated/icons/AppIcon.d.ts +1 -1
  48. package/dist/design-system/Icon/__generated/icons/ArrowDownIcon.d.ts +1 -1
  49. package/dist/design-system/Icon/__generated/icons/ArrowInIcon.d.ts +1 -1
  50. package/dist/design-system/Icon/__generated/icons/ArrowLeftIcon.d.ts +1 -1
  51. package/dist/design-system/Icon/__generated/icons/ArrowRightIcon.d.ts +1 -1
  52. package/dist/design-system/Icon/__generated/icons/ArrowUpIcon.d.ts +1 -1
  53. package/dist/design-system/Icon/__generated/icons/ArrowsUpDownIcon.d.ts +1 -1
  54. package/dist/design-system/Icon/__generated/icons/AssistantIcon.d.ts +1 -1
  55. package/dist/design-system/Icon/__generated/icons/BadgeCodeIcon.d.ts +1 -1
  56. package/dist/design-system/Icon/__generated/icons/BadgeCodeOffIcon.d.ts +1 -1
  57. package/dist/design-system/Icon/__generated/icons/BarChartIcon.d.ts +1 -1
  58. package/dist/design-system/Icon/__generated/icons/BarGroupedIcon.d.ts +1 -1
  59. package/dist/design-system/Icon/__generated/icons/BarStackedIcon.d.ts +1 -1
  60. package/dist/design-system/Icon/__generated/icons/BarStackedPercentageIcon.d.ts +1 -1
  61. package/dist/design-system/Icon/__generated/icons/BeakerIcon.d.ts +1 -1
  62. package/dist/design-system/Icon/__generated/icons/BinaryIcon.d.ts +1 -1
  63. package/dist/design-system/Icon/__generated/icons/BoldIcon.d.ts +1 -1
  64. package/dist/design-system/Icon/__generated/icons/BookIcon.d.ts +1 -1
  65. package/dist/design-system/Icon/__generated/icons/BookmarkFillIcon.d.ts +1 -1
  66. package/dist/design-system/Icon/__generated/icons/BookmarkIcon.d.ts +1 -1
  67. package/dist/design-system/Icon/__generated/icons/BooksIcon.d.ts +1 -1
  68. package/dist/design-system/Icon/__generated/icons/BracketsCurlyIcon.d.ts +1 -1
  69. package/dist/design-system/Icon/__generated/icons/BracketsSquareIcon.d.ts +1 -1
  70. package/dist/design-system/Icon/__generated/icons/BracketsXIcon.d.ts +1 -1
  71. package/dist/design-system/Icon/__generated/icons/BranchIcon.d.ts +1 -1
  72. package/dist/design-system/Icon/__generated/icons/BriefcaseFillIcon.d.ts +1 -1
  73. package/dist/design-system/Icon/__generated/icons/BriefcaseIcon.d.ts +1 -1
  74. package/dist/design-system/Icon/__generated/icons/CalendarClockIcon.d.ts +1 -1
  75. package/dist/design-system/Icon/__generated/icons/CalendarEventIcon.d.ts +1 -1
  76. package/dist/design-system/Icon/__generated/icons/CalendarIcon.d.ts +1 -1
  77. package/dist/design-system/Icon/__generated/icons/CaretDownSquareIcon.d.ts +1 -1
  78. package/dist/design-system/Icon/__generated/icons/CaretUpSquareIcon.d.ts +1 -1
  79. package/dist/design-system/Icon/__generated/icons/CatalogCloudIcon.d.ts +1 -1
  80. package/dist/design-system/Icon/__generated/icons/CatalogIcon.d.ts +1 -1
  81. package/dist/design-system/Icon/__generated/icons/CatalogOffIcon.d.ts +1 -1
  82. package/dist/design-system/Icon/__generated/icons/ChartLineIcon.d.ts +1 -1
  83. package/dist/design-system/Icon/__generated/icons/CheckCircleBadgeIcon.d.ts +1 -1
  84. package/dist/design-system/Icon/__generated/icons/CheckCircleFillIcon.d.ts +1 -1
  85. package/dist/design-system/Icon/__generated/icons/CheckCircleIcon.d.ts +1 -1
  86. package/dist/design-system/Icon/__generated/icons/CheckIcon.d.ts +1 -1
  87. package/dist/design-system/Icon/__generated/icons/CheckLineIcon.d.ts +1 -1
  88. package/dist/design-system/Icon/__generated/icons/CheckboxIcon.d.ts +1 -1
  89. package/dist/design-system/Icon/__generated/icons/ChecklistIcon.d.ts +1 -1
  90. package/dist/design-system/Icon/__generated/icons/ChevronDoubleDownIcon.d.ts +1 -1
  91. package/dist/design-system/Icon/__generated/icons/ChevronDoubleLeftIcon.d.ts +1 -1
  92. package/dist/design-system/Icon/__generated/icons/ChevronDoubleRightIcon.d.ts +1 -1
  93. package/dist/design-system/Icon/__generated/icons/ChevronDoubleUpIcon.d.ts +1 -1
  94. package/dist/design-system/Icon/__generated/icons/ChevronDownIcon.d.ts +1 -1
  95. package/dist/design-system/Icon/__generated/icons/ChevronLeftIcon.d.ts +1 -1
  96. package/dist/design-system/Icon/__generated/icons/ChevronRightIcon.d.ts +1 -1
  97. package/dist/design-system/Icon/__generated/icons/ChevronUpIcon.d.ts +1 -1
  98. package/dist/design-system/Icon/__generated/icons/CircleIcon.d.ts +1 -1
  99. package/dist/design-system/Icon/__generated/icons/ClipboardIcon.d.ts +1 -1
  100. package/dist/design-system/Icon/__generated/icons/ClockIcon.d.ts +1 -1
  101. package/dist/design-system/Icon/__generated/icons/ClockKeyIcon.d.ts +1 -1
  102. package/dist/design-system/Icon/__generated/icons/CloseIcon.d.ts +1 -1
  103. package/dist/design-system/Icon/__generated/icons/CloudDownloadIcon.d.ts +1 -1
  104. package/dist/design-system/Icon/__generated/icons/CloudIcon.d.ts +1 -1
  105. package/dist/design-system/Icon/__generated/icons/CloudKeyIcon.d.ts +1 -1
  106. package/dist/design-system/Icon/__generated/icons/CloudModelIcon.d.ts +1 -1
  107. package/dist/design-system/Icon/__generated/icons/CloudOffIcon.d.ts +1 -1
  108. package/dist/design-system/Icon/__generated/icons/CloudUploadIcon.d.ts +1 -1
  109. package/dist/design-system/Icon/__generated/icons/CodeIcon.d.ts +1 -1
  110. package/dist/design-system/Icon/__generated/icons/ColorFillIcon.d.ts +1 -1
  111. package/dist/design-system/Icon/__generated/icons/ColumnIcon.d.ts +1 -1
  112. package/dist/design-system/Icon/__generated/icons/ColumnsIcon.d.ts +1 -1
  113. package/dist/design-system/Icon/__generated/icons/ConnectIcon.d.ts +1 -1
  114. package/dist/design-system/Icon/__generated/icons/CopyIcon.d.ts +1 -1
  115. package/dist/design-system/Icon/__generated/icons/CursorIcon.d.ts +1 -1
  116. package/dist/design-system/Icon/__generated/icons/CursorTypeIcon.d.ts +1 -1
  117. package/dist/design-system/Icon/__generated/icons/DIcon.d.ts +1 -1
  118. package/dist/design-system/Icon/__generated/icons/DagIcon.d.ts +1 -1
  119. package/dist/design-system/Icon/__generated/icons/DangerFillIcon.d.ts +1 -1
  120. package/dist/design-system/Icon/__generated/icons/DangerIcon.d.ts +1 -1
  121. package/dist/design-system/Icon/__generated/icons/DashIcon.d.ts +1 -1
  122. package/dist/design-system/Icon/__generated/icons/DashboardIcon.d.ts +1 -1
  123. package/dist/design-system/Icon/__generated/icons/DataIcon.d.ts +1 -1
  124. package/dist/design-system/Icon/__generated/icons/DatabaseIcon.d.ts +1 -1
  125. package/dist/design-system/Icon/__generated/icons/DecimalIcon.d.ts +1 -1
  126. package/dist/design-system/Icon/__generated/icons/DotsCircleIcon.d.ts +1 -1
  127. package/dist/design-system/Icon/__generated/icons/DownloadIcon.d.ts +1 -1
  128. package/dist/design-system/Icon/__generated/icons/DragIcon.d.ts +1 -1
  129. package/dist/design-system/Icon/__generated/icons/ErdIcon.d.ts +1 -1
  130. package/dist/design-system/Icon/__generated/icons/ExpandLessIcon.d.ts +1 -1
  131. package/dist/design-system/Icon/__generated/icons/ExpandMoreIcon.d.ts +1 -1
  132. package/dist/design-system/Icon/__generated/icons/FaceFrownIcon.d.ts +1 -1
  133. package/dist/design-system/Icon/__generated/icons/FaceNeutralIcon.d.ts +1 -1
  134. package/dist/design-system/Icon/__generated/icons/FaceSmileIcon.d.ts +1 -1
  135. package/dist/design-system/Icon/__generated/icons/FileCodeIcon.d.ts +1 -1
  136. package/dist/design-system/Icon/__generated/icons/FileDocumentIcon.d.ts +1 -1
  137. package/dist/design-system/Icon/__generated/icons/FileIcon.d.ts +1 -1
  138. package/dist/design-system/Icon/__generated/icons/FileImageIcon.d.ts +1 -1
  139. package/dist/design-system/Icon/__generated/icons/FileModelIcon.d.ts +1 -1
  140. package/dist/design-system/Icon/__generated/icons/FilterIcon.d.ts +1 -1
  141. package/dist/design-system/Icon/__generated/icons/FloatIcon.d.ts +1 -1
  142. package/dist/design-system/Icon/__generated/icons/FolderBranchIcon.d.ts +1 -1
  143. package/dist/design-system/Icon/__generated/icons/FolderCloudFilledIcon.d.ts +1 -1
  144. package/dist/design-system/Icon/__generated/icons/FolderCloudIcon.d.ts +1 -1
  145. package/dist/design-system/Icon/__generated/icons/FolderFillIcon.d.ts +1 -1
  146. package/dist/design-system/Icon/__generated/icons/FolderIcon.d.ts +1 -1
  147. package/dist/design-system/Icon/__generated/icons/FontIcon.d.ts +1 -1
  148. package/dist/design-system/Icon/__generated/icons/ForkIcon.d.ts +1 -1
  149. package/dist/design-system/Icon/__generated/icons/FullscreenExitIcon.d.ts +1 -1
  150. package/dist/design-system/Icon/__generated/icons/FullscreenIcon.d.ts +1 -1
  151. package/dist/design-system/Icon/__generated/icons/FunctionIcon.d.ts +1 -1
  152. package/dist/design-system/Icon/__generated/icons/GearFillIcon.d.ts +1 -1
  153. package/dist/design-system/Icon/__generated/icons/GearIcon.d.ts +1 -1
  154. package/dist/design-system/Icon/__generated/icons/GiftIcon.d.ts +1 -1
  155. package/dist/design-system/Icon/__generated/icons/GitCommitIcon.d.ts +1 -1
  156. package/dist/design-system/Icon/__generated/icons/GlobeIcon.d.ts +1 -1
  157. package/dist/design-system/Icon/__generated/icons/GridDashIcon.d.ts +1 -1
  158. package/dist/design-system/Icon/__generated/icons/GridIcon.d.ts +1 -1
  159. package/dist/design-system/Icon/__generated/icons/H1Icon.d.ts +1 -1
  160. package/dist/design-system/Icon/__generated/icons/H2Icon.d.ts +1 -1
  161. package/dist/design-system/Icon/__generated/icons/H3Icon.d.ts +1 -1
  162. package/dist/design-system/Icon/__generated/icons/HistoryIcon.d.ts +1 -1
  163. package/dist/design-system/Icon/__generated/icons/HomeIcon.d.ts +1 -1
  164. package/dist/design-system/Icon/__generated/icons/ImageIcon.d.ts +1 -1
  165. package/dist/design-system/Icon/__generated/icons/IndentDecreaseIcon.d.ts +1 -1
  166. package/dist/design-system/Icon/__generated/icons/IndentIncreaseIcon.d.ts +1 -1
  167. package/dist/design-system/Icon/__generated/icons/InfinityIcon.d.ts +1 -1
  168. package/dist/design-system/Icon/__generated/icons/InfoFillIcon.d.ts +1 -1
  169. package/dist/design-system/Icon/__generated/icons/InfoIcon.d.ts +1 -1
  170. package/dist/design-system/Icon/__generated/icons/IngestionIcon.d.ts +1 -1
  171. package/dist/design-system/Icon/__generated/icons/ItalicIcon.d.ts +1 -1
  172. package/dist/design-system/Icon/__generated/icons/KeyIcon.d.ts +1 -1
  173. package/dist/design-system/Icon/__generated/icons/KeyboardIcon.d.ts +1 -1
  174. package/dist/design-system/Icon/__generated/icons/LayerGraphIcon.d.ts +1 -1
  175. package/dist/design-system/Icon/__generated/icons/LayerIcon.d.ts +1 -1
  176. package/dist/design-system/Icon/__generated/icons/LettersIcon.d.ts +1 -1
  177. package/dist/design-system/Icon/__generated/icons/LibrariesIcon.d.ts +1 -1
  178. package/dist/design-system/Icon/__generated/icons/LightningIcon.d.ts +1 -1
  179. package/dist/design-system/Icon/__generated/icons/LinkIcon.d.ts +1 -1
  180. package/dist/design-system/Icon/__generated/icons/LinkOffIcon.d.ts +1 -1
  181. package/dist/design-system/Icon/__generated/icons/ListBorderIcon.d.ts +1 -1
  182. package/dist/design-system/Icon/__generated/icons/ListClearIcon.d.ts +1 -1
  183. package/dist/design-system/Icon/__generated/icons/ListIcon.d.ts +1 -1
  184. package/dist/design-system/Icon/__generated/icons/LoadingIcon.d.ts +1 -1
  185. package/dist/design-system/Icon/__generated/icons/LockFillIcon.d.ts +1 -1
  186. package/dist/design-system/Icon/__generated/icons/LockIcon.d.ts +1 -1
  187. package/dist/design-system/Icon/__generated/icons/LockUnlockedIcon.d.ts +1 -1
  188. package/dist/design-system/Icon/__generated/icons/MIcon.d.ts +1 -1
  189. package/dist/design-system/Icon/__generated/icons/MailIcon.d.ts +1 -1
  190. package/dist/design-system/Icon/__generated/icons/MegaphoneIcon.d.ts +1 -1
  191. package/dist/design-system/Icon/__generated/icons/MenuIcon.d.ts +1 -1
  192. package/dist/design-system/Icon/__generated/icons/MinusBoxIcon.d.ts +1 -1
  193. package/dist/design-system/Icon/__generated/icons/MinusCircleFillIcon.d.ts +1 -1
  194. package/dist/design-system/Icon/__generated/icons/MinusCircleIcon.d.ts +1 -1
  195. package/dist/design-system/Icon/__generated/icons/ModelsIcon.d.ts +1 -1
  196. package/dist/design-system/Icon/__generated/icons/NewWindowIcon.d.ts +1 -1
  197. package/dist/design-system/Icon/__generated/icons/NoIcon.d.ts +1 -1
  198. package/dist/design-system/Icon/__generated/icons/NotebookIcon.d.ts +1 -1
  199. package/dist/design-system/Icon/__generated/icons/NotificationIcon.d.ts +1 -1
  200. package/dist/design-system/Icon/__generated/icons/NotificationOffIcon.d.ts +1 -1
  201. package/dist/design-system/Icon/__generated/icons/NumbersIcon.d.ts +1 -1
  202. package/dist/design-system/Icon/__generated/icons/OfficeIcon.d.ts +1 -1
  203. package/dist/design-system/Icon/__generated/icons/OverflowIcon.d.ts +1 -1
  204. package/dist/design-system/Icon/__generated/icons/PageBottomIcon.d.ts +1 -1
  205. package/dist/design-system/Icon/__generated/icons/PageFirstIcon.d.ts +1 -1
  206. package/dist/design-system/Icon/__generated/icons/PageLastIcon.d.ts +1 -1
  207. package/dist/design-system/Icon/__generated/icons/PageTopIcon.d.ts +1 -1
  208. package/dist/design-system/Icon/__generated/icons/PauseIcon.d.ts +1 -1
  209. package/dist/design-system/Icon/__generated/icons/PencilIcon.d.ts +1 -1
  210. package/dist/design-system/Icon/__generated/icons/PinCancelIcon.d.ts +1 -1
  211. package/dist/design-system/Icon/__generated/icons/PinFillIcon.d.ts +1 -1
  212. package/dist/design-system/Icon/__generated/icons/PinIcon.d.ts +1 -1
  213. package/dist/design-system/Icon/__generated/icons/PipelineIcon.d.ts +1 -1
  214. package/dist/design-system/Icon/__generated/icons/PlayCircleFillIcon.d.ts +1 -1
  215. package/dist/design-system/Icon/__generated/icons/PlayCircleIcon.d.ts +1 -1
  216. package/dist/design-system/Icon/__generated/icons/PlayIcon.d.ts +1 -1
  217. package/dist/design-system/Icon/__generated/icons/PlugIcon.d.ts +1 -1
  218. package/dist/design-system/Icon/__generated/icons/PlusCircleFillIcon.d.ts +1 -1
  219. package/dist/design-system/Icon/__generated/icons/PlusCircleIcon.d.ts +1 -1
  220. package/dist/design-system/Icon/__generated/icons/PlusIcon.d.ts +1 -1
  221. package/dist/design-system/Icon/__generated/icons/PlusSquareIcon.d.ts +1 -1
  222. package/dist/design-system/Icon/__generated/icons/QueryEditorIcon.d.ts +1 -1
  223. package/dist/design-system/Icon/__generated/icons/QueryIcon.d.ts +1 -1
  224. package/dist/design-system/Icon/__generated/icons/QuestionMarkFillIcon.d.ts +1 -1
  225. package/dist/design-system/Icon/__generated/icons/QuestionMarkIcon.d.ts +1 -1
  226. package/dist/design-system/Icon/__generated/icons/QuestionMarkSpeechBubbleIcon.d.ts +1 -1
  227. package/dist/design-system/Icon/__generated/icons/ReaderModeIcon.d.ts +1 -1
  228. package/dist/design-system/Icon/__generated/icons/RedoIcon.d.ts +1 -1
  229. package/dist/design-system/Icon/__generated/icons/RefreshIcon.d.ts +1 -1
  230. package/dist/design-system/Icon/__generated/icons/RobotIcon.d.ts +1 -1
  231. package/dist/design-system/Icon/__generated/icons/RunningIcon.d.ts +5 -0
  232. package/dist/design-system/Icon/__generated/icons/RunningIcon.d.ts.map +1 -0
  233. package/dist/design-system/Icon/__generated/icons/SaveIcon.d.ts +1 -1
  234. package/dist/design-system/Icon/__generated/icons/SchemaIcon.d.ts +5 -0
  235. package/dist/design-system/Icon/__generated/icons/SchemaIcon.d.ts.map +1 -0
  236. package/dist/design-system/Icon/__generated/icons/SchoolIcon.d.ts +1 -1
  237. package/dist/design-system/Icon/__generated/icons/SearchIcon.d.ts +1 -1
  238. package/dist/design-system/Icon/__generated/icons/SecurityIcon.d.ts +1 -1
  239. package/dist/design-system/Icon/__generated/icons/SendIcon.d.ts +1 -1
  240. package/dist/design-system/Icon/__generated/icons/ShareIcon.d.ts +1 -1
  241. package/dist/design-system/Icon/__generated/icons/SidebarAutoIcon.d.ts +1 -1
  242. package/dist/design-system/Icon/__generated/icons/SidebarCollapseIcon.d.ts +1 -1
  243. package/dist/design-system/Icon/__generated/icons/SidebarExpandIcon.d.ts +1 -1
  244. package/dist/design-system/Icon/__generated/icons/SidebarIcon.d.ts +1 -1
  245. package/dist/design-system/Icon/__generated/icons/SlidersIcon.d.ts +1 -1
  246. package/dist/design-system/Icon/__generated/icons/SortAlphabeticalAscendingIcon.d.ts +1 -1
  247. package/dist/design-system/Icon/__generated/icons/SortAlphabeticalDescendingIcon.d.ts +1 -1
  248. package/dist/design-system/Icon/__generated/icons/SortAlphabeticalLeftIcon.d.ts +1 -1
  249. package/dist/design-system/Icon/__generated/icons/SortAlphabeticalRightIcon.d.ts +1 -1
  250. package/dist/design-system/Icon/__generated/icons/SortAscendingIcon.d.ts +1 -1
  251. package/dist/design-system/Icon/__generated/icons/SortDescendingIcon.d.ts +1 -1
  252. package/dist/design-system/Icon/__generated/icons/SortUnsortedIcon.d.ts +1 -1
  253. package/dist/design-system/Icon/__generated/icons/SparkleIcon.d.ts +1 -1
  254. package/dist/design-system/Icon/__generated/icons/SpeechBubbleIcon.d.ts +1 -1
  255. package/dist/design-system/Icon/__generated/icons/SpeechBubblePlusIcon.d.ts +1 -1
  256. package/dist/design-system/Icon/__generated/icons/SpeechBubbleQuestionMarkIcon.d.ts +1 -1
  257. package/dist/design-system/Icon/__generated/icons/StarFillIcon.d.ts +1 -1
  258. package/dist/design-system/Icon/__generated/icons/StarIcon.d.ts +1 -1
  259. package/dist/design-system/Icon/__generated/icons/StepIntoIcon.d.ts +1 -1
  260. package/dist/design-system/Icon/__generated/icons/StepOutIcon.d.ts +1 -1
  261. package/dist/design-system/Icon/__generated/icons/StepOverIcon.d.ts +1 -1
  262. package/dist/design-system/Icon/__generated/icons/StopCircleFillIcon.d.ts +1 -1
  263. package/dist/design-system/Icon/__generated/icons/StopCircleIcon.d.ts +1 -1
  264. package/dist/design-system/Icon/__generated/icons/StopIcon.d.ts +1 -1
  265. package/dist/design-system/Icon/__generated/icons/StorefrontIcon.d.ts +1 -1
  266. package/dist/design-system/Icon/__generated/icons/StreamIcon.d.ts +1 -1
  267. package/dist/design-system/Icon/__generated/icons/SyncIcon.d.ts +1 -1
  268. package/dist/design-system/Icon/__generated/icons/TableGlassesIcon.d.ts +1 -1
  269. package/dist/design-system/Icon/__generated/icons/TableIcon.d.ts +1 -1
  270. package/dist/design-system/Icon/__generated/icons/TableLightningIcon.d.ts +1 -1
  271. package/dist/design-system/Icon/__generated/icons/TableOnlineViewIcon.d.ts +1 -1
  272. package/dist/design-system/Icon/__generated/icons/TableStreamIcon.d.ts +1 -1
  273. package/dist/design-system/Icon/__generated/icons/TableVectorIcon.d.ts +1 -1
  274. package/dist/design-system/Icon/__generated/icons/TableViewIcon.d.ts +1 -1
  275. package/dist/design-system/Icon/__generated/icons/TagIcon.d.ts +5 -0
  276. package/dist/design-system/Icon/__generated/icons/TagIcon.d.ts.map +1 -0
  277. package/dist/design-system/Icon/__generated/icons/TargetIcon.d.ts +1 -1
  278. package/dist/design-system/Icon/__generated/icons/TextBoxIcon.d.ts +1 -1
  279. package/dist/design-system/Icon/__generated/icons/ThumbsDownIcon.d.ts +1 -1
  280. package/dist/design-system/Icon/__generated/icons/ThumbsUpIcon.d.ts +1 -1
  281. package/dist/design-system/Icon/__generated/icons/TrashIcon.d.ts +1 -1
  282. package/dist/design-system/Icon/__generated/icons/TreeIcon.d.ts +1 -1
  283. package/dist/design-system/Icon/__generated/icons/UnderlineIcon.d.ts +1 -1
  284. package/dist/design-system/Icon/__generated/icons/UndoIcon.d.ts +1 -1
  285. package/dist/design-system/Icon/__generated/icons/UploadIcon.d.ts +1 -1
  286. package/dist/design-system/Icon/__generated/icons/UsbIcon.d.ts +1 -1
  287. package/dist/design-system/Icon/__generated/icons/UserBadgeIcon.d.ts +1 -1
  288. package/dist/design-system/Icon/__generated/icons/UserCircleIcon.d.ts +1 -1
  289. package/dist/design-system/Icon/__generated/icons/UserGroupIcon.d.ts +1 -1
  290. package/dist/design-system/Icon/__generated/icons/UserIcon.d.ts +1 -1
  291. package/dist/design-system/Icon/__generated/icons/VectorTableIcon.d.ts +1 -1
  292. package/dist/design-system/Icon/__generated/icons/VisibleIcon.d.ts +1 -1
  293. package/dist/design-system/Icon/__generated/icons/VisibleOffIcon.d.ts +1 -1
  294. package/dist/design-system/Icon/__generated/icons/WarningFillIcon.d.ts +1 -1
  295. package/dist/design-system/Icon/__generated/icons/WarningIcon.d.ts +1 -1
  296. package/dist/design-system/Icon/__generated/icons/WorkflowsIcon.d.ts +1 -1
  297. package/dist/design-system/Icon/__generated/icons/WorkspacesIcon.d.ts +1 -1
  298. package/dist/design-system/Icon/__generated/icons/XCircleFillIcon.d.ts +1 -1
  299. package/dist/design-system/Icon/__generated/icons/XCircleIcon.d.ts +1 -1
  300. package/dist/design-system/Icon/__generated/icons/ZoomInIcon.d.ts +1 -1
  301. package/dist/design-system/Icon/__generated/icons/ZoomMarqueeSelection.d.ts +1 -1
  302. package/dist/design-system/Icon/__generated/icons/ZoomOutIcon.d.ts +1 -1
  303. package/dist/design-system/Icon/__generated/icons/index.d.ts +3 -0
  304. package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
  305. package/dist/design-system/Input/Group.d.ts.map +1 -1
  306. package/dist/design-system/Input/Input.d.ts +9 -1
  307. package/dist/design-system/Input/Input.d.ts.map +1 -1
  308. package/dist/design-system/Input/common.d.ts +3 -2
  309. package/dist/design-system/Input/common.d.ts.map +1 -1
  310. package/dist/design-system/Input/index.d.ts +2 -1
  311. package/dist/design-system/Input/index.d.ts.map +1 -1
  312. package/dist/design-system/LegacySelect/LegacySelect.d.ts +66 -0
  313. package/dist/design-system/LegacySelect/LegacySelect.d.ts.map +1 -0
  314. package/dist/design-system/LegacySelect/index.d.ts +2 -0
  315. package/dist/design-system/LegacySelect/index.d.ts.map +1 -0
  316. package/dist/design-system/Modal/Modal.d.ts +6 -5
  317. package/dist/design-system/Modal/Modal.d.ts.map +1 -1
  318. package/dist/design-system/Notification/Notification.d.ts.map +1 -1
  319. package/dist/design-system/Pagination/index.d.ts +8 -1
  320. package/dist/design-system/Pagination/index.d.ts.map +1 -1
  321. package/dist/design-system/Popover/InfoPopover.d.ts +2 -1
  322. package/dist/design-system/Popover/InfoPopover.d.ts.map +1 -1
  323. package/dist/design-system/Radio/Radio.d.ts +2 -1
  324. package/dist/design-system/Radio/Radio.d.ts.map +1 -1
  325. package/dist/design-system/SegmentedControl/SegmentedControl.d.ts +1 -0
  326. package/dist/design-system/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  327. package/dist/design-system/Select/Select.d.ts +7 -59
  328. package/dist/design-system/Select/Select.d.ts.map +1 -1
  329. package/dist/design-system/Select/SelectContent.d.ts +10 -0
  330. package/dist/design-system/Select/SelectContent.d.ts.map +1 -0
  331. package/dist/design-system/Select/SelectOption.d.ts +10 -0
  332. package/dist/design-system/Select/SelectOption.d.ts.map +1 -0
  333. package/dist/design-system/Select/SelectOptionGroup.d.ts +11 -0
  334. package/dist/design-system/Select/SelectOptionGroup.d.ts.map +1 -0
  335. package/dist/design-system/Select/SelectTrigger.d.ts +10 -0
  336. package/dist/design-system/Select/SelectTrigger.d.ts.map +1 -0
  337. package/dist/design-system/Select/SimpleSelect.d.ts +33 -0
  338. package/dist/design-system/Select/SimpleSelect.d.ts.map +1 -0
  339. package/dist/design-system/Select/hooks/useSelectContext.d.ts.map +1 -0
  340. package/dist/design-system/Select/index.d.ts +5 -0
  341. package/dist/design-system/Select/index.d.ts.map +1 -1
  342. package/dist/design-system/Select/providers/SelectContext.d.ts.map +1 -0
  343. package/dist/design-system/Sidebar/Sidebar.d.ts +6 -2
  344. package/dist/design-system/Sidebar/Sidebar.d.ts.map +1 -1
  345. package/dist/design-system/SplitButton/Dropdown/DropdownButton.d.ts.map +1 -1
  346. package/dist/design-system/SplitButton/SplitButton.d.ts.map +1 -1
  347. package/dist/design-system/Switch/Switch.d.ts.map +1 -1
  348. package/dist/design-system/TableUI/Table.d.ts.map +1 -1
  349. package/dist/design-system/TableUI/TableFilterInput.d.ts +2 -1
  350. package/dist/design-system/TableUI/TableFilterInput.d.ts.map +1 -1
  351. package/dist/design-system/TableUI/TableFilterLayout.d.ts.map +1 -1
  352. package/dist/design-system/Tooltip/Tooltip.d.ts +6 -0
  353. package/dist/design-system/Tooltip/Tooltip.d.ts.map +1 -1
  354. package/dist/design-system/Tree/Tree.d.ts.map +1 -1
  355. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxAddButton.d.ts +3 -0
  356. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxAddButton.d.ts.map +1 -0
  357. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +1 -0
  358. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts.map +1 -1
  359. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts +1 -0
  360. package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts.map +1 -1
  361. package/dist/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts +5 -1
  362. package/dist/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts.map +1 -1
  363. package/dist/design-system/TypeaheadCombobox/index.d.ts +1 -0
  364. package/dist/design-system/TypeaheadCombobox/index.d.ts.map +1 -1
  365. package/dist/design-system/Typography/Hint.d.ts +2 -2
  366. package/dist/design-system/Typography/Hint.d.ts.map +1 -1
  367. package/dist/design-system/Typography/Link.d.ts +2 -2
  368. package/dist/design-system/Typography/Link.d.ts.map +1 -1
  369. package/dist/design-system/Typography/Paragraph.d.ts +2 -2
  370. package/dist/design-system/Typography/Paragraph.d.ts.map +1 -1
  371. package/dist/design-system/Typography/Text.d.ts +2 -2
  372. package/dist/design-system/Typography/Text.d.ts.map +1 -1
  373. package/dist/design-system/Typography/Title.d.ts +2 -2
  374. package/dist/design-system/Typography/Title.d.ts.map +1 -1
  375. package/dist/design-system/Typography/Typography.d.ts +1 -1
  376. package/dist/design-system/Typography/index.d.ts +5 -0
  377. package/dist/design-system/Typography/index.d.ts.map +1 -1
  378. package/dist/design-system/Wizard/Wizard.d.ts +94 -0
  379. package/dist/design-system/Wizard/Wizard.d.ts.map +1 -0
  380. package/dist/design-system/Wizard/WizardFooter.d.ts +16 -0
  381. package/dist/design-system/Wizard/WizardFooter.d.ts.map +1 -0
  382. package/dist/design-system/Wizard/WizardModal.d.ts +7 -0
  383. package/dist/design-system/Wizard/WizardModal.d.ts.map +1 -0
  384. package/dist/design-system/Wizard/WizardStep.d.ts +71 -0
  385. package/dist/design-system/Wizard/WizardStep.d.ts.map +1 -0
  386. package/dist/design-system/Wizard/WizardStepsContent.d.ts +11 -0
  387. package/dist/design-system/Wizard/WizardStepsContent.d.ts.map +1 -0
  388. package/dist/design-system/Wizard/index.d.ts +5 -0
  389. package/dist/design-system/Wizard/index.d.ts.map +1 -0
  390. package/dist/design-system/Wizard/useWizardCurrentStep.d.ts +20 -0
  391. package/dist/design-system/Wizard/useWizardCurrentStep.d.ts.map +1 -0
  392. package/dist/design-system/_shared_/Combobox/styles.d.ts +9 -0
  393. package/dist/design-system/_shared_/Combobox/styles.d.ts.map +1 -1
  394. package/dist/design-system/_shared_/Menu/index.d.ts +5 -0
  395. package/dist/design-system/_shared_/Menu/index.d.ts.map +1 -0
  396. package/dist/design-system/index.d.ts +4 -1
  397. package/dist/design-system/index.d.ts.map +1 -1
  398. package/dist/design-system/types.d.ts +27 -0
  399. package/dist/design-system/types.d.ts.map +1 -1
  400. package/dist/design-system/utils/debug.d.ts +8 -0
  401. package/dist/design-system/utils/debug.d.ts.map +1 -0
  402. package/dist/design-system/utils/index.d.ts +1 -0
  403. package/dist/design-system/utils/index.d.ts.map +1 -1
  404. package/dist/design-system/utils/safex.d.ts +3 -2
  405. package/dist/design-system/utils/safex.d.ts.map +1 -1
  406. package/dist/design-system/utils/useCallbackOnceUntilReset.d.ts +20 -0
  407. package/dist/design-system/utils/useCallbackOnceUntilReset.d.ts.map +1 -0
  408. package/dist/design-system/utils/useIsomorphicLayoutEffect.d.ts +16 -0
  409. package/dist/design-system/utils/useIsomorphicLayoutEffect.d.ts.map +1 -0
  410. package/dist/design-system/utils/useMediaQuery.d.ts +31 -0
  411. package/dist/design-system/utils/useMediaQuery.d.ts.map +1 -0
  412. package/dist/design-system/utils/useNotifyOnFirstView.d.ts +15 -0
  413. package/dist/design-system/utils/useNotifyOnFirstView.d.ts.map +1 -0
  414. package/dist/development/Banner/Banner.d.ts +7 -6
  415. package/dist/development/Banner/Banner.d.ts.map +1 -1
  416. package/dist/development/ChatUI/ChatInput.d.ts.map +1 -1
  417. package/dist/development/ChatUI/Feedback.d.ts.map +1 -1
  418. package/dist/development/PillControl/PillControl.d.ts +13 -0
  419. package/dist/development/PillControl/PillControl.d.ts.map +1 -0
  420. package/dist/development/PillControl/index.d.ts +2 -0
  421. package/dist/development/PillControl/index.d.ts.map +1 -0
  422. package/dist/development/PreviewCard/PreviewCard.d.ts +14 -0
  423. package/dist/development/PreviewCard/PreviewCard.d.ts.map +1 -0
  424. package/dist/development/PreviewCard/index.d.ts +2 -0
  425. package/dist/development/PreviewCard/index.d.ts.map +1 -0
  426. package/dist/development/Progress/Progress.d.ts +10 -0
  427. package/dist/development/Progress/Progress.d.ts.map +1 -0
  428. package/dist/development/Progress/hooks/useProgressContext.d.ts +2 -0
  429. package/dist/development/Progress/hooks/useProgressContext.d.ts.map +1 -0
  430. package/dist/development/Progress/index.d.ts +2 -0
  431. package/dist/development/Progress/index.d.ts.map +1 -0
  432. package/dist/development/Progress/providers/ProgressContex.d.ts +10 -0
  433. package/dist/development/Progress/providers/ProgressContex.d.ts.map +1 -0
  434. package/dist/development/Stepper/Stepper.d.ts +62 -0
  435. package/dist/development/Stepper/Stepper.d.ts.map +1 -0
  436. package/dist/development/Stepper/index.d.ts +2 -0
  437. package/dist/development/Stepper/index.d.ts.map +1 -0
  438. package/dist/development/index.d.ts +3 -1
  439. package/dist/development/index.d.ts.map +1 -1
  440. package/dist/development.js +352 -237
  441. package/dist/development.js.map +1 -1
  442. package/dist/dubois-colors.less +58 -56
  443. package/dist/index-dark.css +201 -193
  444. package/dist/index.css +114 -109
  445. package/dist/index.js +4073 -1943
  446. package/dist/index.js.map +1 -1
  447. package/dist/test-utils/enzyme/selectEvent.d.ts +2 -2
  448. package/dist/test-utils/enzyme/selectEvent.d.ts.map +1 -1
  449. package/dist/test-utils/enzyme.js.map +1 -1
  450. package/dist/test-utils/rtl/selectEvent.d.ts +2 -2
  451. package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -1
  452. package/dist/test-utils/rtl.js +3 -3
  453. package/dist/test-utils/rtl.js.map +1 -1
  454. package/dist/theme/_generated/SemanticColors-Dark.d.ts.map +1 -1
  455. package/dist/theme/_generated/SemanticColors-Light.d.ts.map +1 -1
  456. package/dist/theme/_generated/ValidSemanticColors.d.ts +2 -1
  457. package/dist/theme/_generated/ValidSemanticColors.d.ts.map +1 -1
  458. package/dist/theme/spacing.d.ts +1 -0
  459. package/dist/theme/spacing.d.ts.map +1 -1
  460. package/package.json +9 -7
  461. package/dist/DropdownMenu-dbeef1b7.js.map +0 -1
  462. package/dist/design-system/SelectV2/Select.d.ts +0 -7
  463. package/dist/design-system/SelectV2/Select.d.ts.map +0 -1
  464. package/dist/design-system/SelectV2/SelectContent.d.ts +0 -6
  465. package/dist/design-system/SelectV2/SelectContent.d.ts.map +0 -1
  466. package/dist/design-system/SelectV2/SelectOption.d.ts +0 -6
  467. package/dist/design-system/SelectV2/SelectOption.d.ts.map +0 -1
  468. package/dist/design-system/SelectV2/SelectOptionGroup.d.ts +0 -7
  469. package/dist/design-system/SelectV2/SelectOptionGroup.d.ts.map +0 -1
  470. package/dist/design-system/SelectV2/SelectTrigger.d.ts +0 -6
  471. package/dist/design-system/SelectV2/SelectTrigger.d.ts.map +0 -1
  472. package/dist/design-system/SelectV2/hooks/useSelectContext.d.ts.map +0 -1
  473. package/dist/design-system/SelectV2/index.d.ts +0 -6
  474. package/dist/design-system/SelectV2/index.d.ts.map +0 -1
  475. package/dist/design-system/SelectV2/providers/SelectContext.d.ts.map +0 -1
  476. package/dist/development/ContextMenu/ContextMenu.d.ts +0 -58
  477. package/dist/development/ContextMenu/ContextMenu.d.ts.map +0 -1
  478. package/dist/development/ContextMenu/index.d.ts +0 -2
  479. package/dist/development/ContextMenu/index.d.ts.map +0 -1
  480. /package/dist/design-system/{SelectV2 → Select}/hooks/useSelectContext.d.ts +0 -0
  481. /package/dist/design-system/{SelectV2 → Select}/providers/SelectContext.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- import React__default, { createContext, useContext, useMemo, useEffect, useState, forwardRef, useRef, useLayoutEffect, useImperativeHandle, Children } from 'react';
1
+ import React__default, { useRef, useEffect, createContext, useContext, useMemo, useState, forwardRef, useLayoutEffect, useImperativeHandle, useCallback } from 'react';
2
2
  import { jsx, Fragment, jsxs } from '@emotion/react/jsx-runtime';
3
3
  import { useTheme, ThemeProvider, css, keyframes } from '@emotion/react';
4
- import { notification, ConfigProvider, Button as Button$1, Typography as Typography$1, Tooltip as Tooltip$1, Input as Input$2 } from 'antd';
5
- import * as DropdownMenu$1 from '@radix-ui/react-dropdown-menu';
4
+ import { notification, ConfigProvider, Typography as Typography$1, Button as Button$1, Input as Input$2 } from 'antd';
5
+ import AntDIcon from '@ant-design/icons';
6
6
  import _isNil from 'lodash/isNil';
7
7
  import _endsWith from 'lodash/endsWith';
8
8
  import _isBoolean from 'lodash/isBoolean';
@@ -11,7 +11,6 @@ import _isString from 'lodash/isString';
11
11
  import _mapValues from 'lodash/mapValues';
12
12
  import _memoize from 'lodash/memoize';
13
13
  import unitless from '@emotion/unitless';
14
- import AntDIcon from '@ant-design/icons';
15
14
 
16
15
  /**
17
16
  * Used to hide text visually, but still be readable by screen-readers
@@ -181,7 +180,6 @@ let ValidSemanticColors = /*#__PURE__*/function (ValidSemanticColors) {
181
180
  ValidSemanticColors["ActionTertiaryTextHover"] = "actionTertiaryTextHover";
182
181
  ValidSemanticColors["ActionTertiaryTextPress"] = "actionTertiaryTextPress";
183
182
  ValidSemanticColors["BackgroundDanger"] = "backgroundDanger";
184
- ValidSemanticColors["BackgroundInfo"] = "backgroundInfo";
185
183
  ValidSemanticColors["BackgroundPrimary"] = "backgroundPrimary";
186
184
  ValidSemanticColors["BackgroundSecondary"] = "backgroundSecondary";
187
185
  ValidSemanticColors["BackgroundSuccess"] = "backgroundSuccess";
@@ -192,6 +190,8 @@ let ValidSemanticColors = /*#__PURE__*/function (ValidSemanticColors) {
192
190
  ValidSemanticColors["BorderWarning"] = "borderWarning";
193
191
  ValidSemanticColors["CodeBackground"] = "codeBackground";
194
192
  ValidSemanticColors["OverlayOverlay"] = "overlayOverlay";
193
+ ValidSemanticColors["ProgressFill"] = "progressFill";
194
+ ValidSemanticColors["ProgressTrack"] = "progressTrack";
195
195
  ValidSemanticColors["Skeleton"] = "skeleton";
196
196
  ValidSemanticColors["TableBackgroundSelectedDefault"] = "tableBackgroundSelectedDefault";
197
197
  ValidSemanticColors["TableBackgroundSelectedHover"] = "tableBackgroundSelectedHover";
@@ -399,6 +399,72 @@ const getBottomOnlyShadowScrollStyles = function getBottomOnlyShadowScrollStyles
399
399
  return getBottomOnlyShadowScrollStylesMemoized(theme, backgroundColor);
400
400
  };
401
401
 
402
+ // Define a module-global observer and a WeakMap on elements to hold callbacks
403
+ let sharedObserver = null;
404
+ const entryCallbackMap = new WeakMap();
405
+ const ensureSharedObserverExists = () => {
406
+ if (!sharedObserver) {
407
+ sharedObserver = new IntersectionObserver(entries => {
408
+ entries.forEach(entry => {
409
+ if (entry.isIntersecting) {
410
+ const entryCallback = entryCallbackMap.get(entry.target);
411
+ if (entryCallback) {
412
+ entryCallback();
413
+ entryCallbackMap.delete(entry.target);
414
+ }
415
+ }
416
+ });
417
+ });
418
+ }
419
+ };
420
+ function observeElement(element, callback) {
421
+ var _sharedObserver;
422
+ ensureSharedObserverExists();
423
+ entryCallbackMap.set(element, callback);
424
+ (_sharedObserver = sharedObserver) === null || _sharedObserver === void 0 || _sharedObserver.observe(element);
425
+ return () => {
426
+ if (element) {
427
+ var _sharedObserver2;
428
+ (_sharedObserver2 = sharedObserver) === null || _sharedObserver2 === void 0 || _sharedObserver2.unobserve(element);
429
+ entryCallbackMap.delete(element);
430
+ }
431
+ };
432
+ }
433
+ /**
434
+ * Checks if the element was viewed and calls the onView callback.
435
+ * NOTE: This hook only triggers the onView callback once for the element.
436
+ * @param onView - callback to be called when the element is viewed
437
+ * @typeParam T - extends Element to specify the type of element being observed
438
+ */
439
+ const useNotifyOnFirstView = _ref => {
440
+ let {
441
+ onView
442
+ } = _ref;
443
+ const isViewedRef = useRef(false);
444
+ const elementRef = useRef(null);
445
+ useEffect(() => {
446
+ const element = elementRef.current;
447
+ // If already viewed or element is not available, do nothing
448
+ if (!element || isViewedRef.current) {
449
+ return;
450
+ }
451
+ const callback = () => {
452
+ isViewedRef.current = true;
453
+ onView();
454
+ };
455
+
456
+ // If IntersectionObserver is not available, assume that the element is visible
457
+ if (!window.IntersectionObserver) {
458
+ callback();
459
+ return;
460
+ }
461
+ return observeElement(element, callback);
462
+ }, [onView]);
463
+ return {
464
+ elementRef
465
+ };
466
+ };
467
+
402
468
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
403
469
  var _ref2 = process.env.NODE_ENV === "production" ? {
404
470
  name: "g8zzui",
@@ -490,15 +556,15 @@ const primitiveColors = {
490
556
  green600: '#277C43',
491
557
  green700: '#115026',
492
558
  green800: '#093919',
493
- grey050: '#F2F8F8',
494
- grey100: '#E4ECF1',
495
- grey200: '#CDDAE5',
496
- grey300: '#BDCDDB',
497
- grey350: '#90A4B5',
498
- grey400: '#8196A7',
499
- grey500: '#5D7283',
500
- grey600: '#44535F',
501
- grey650: '#354450',
559
+ grey050: '#F6F7F9',
560
+ grey100: '#E8ECF0',
561
+ grey200: '#D1D9E1',
562
+ grey300: '#C0CDD8',
563
+ grey350: '#92A4B3',
564
+ grey400: '#8396A5',
565
+ grey500: '#5F7281',
566
+ grey600: '#445461',
567
+ grey650: '#37444F',
502
568
  grey700: '#1F272D',
503
569
  grey800: '#11171C',
504
570
  indigo: '#434A93',
@@ -556,9 +622,9 @@ const darkColorList = {
556
622
  actionDefaultTextDefault: primitiveColors.grey100,
557
623
  actionDefaultTextHover: primitiveColors.blue400,
558
624
  actionDefaultTextPress: primitiveColors.blue300,
559
- actionDisabledBackground: primitiveColors.grey700,
560
- actionDisabledBorder: primitiveColors.grey650,
561
- actionDisabledText: primitiveColors.grey600,
625
+ actionDisabledBackground: primitiveColors.grey650,
626
+ actionDisabledBorder: primitiveColors.grey600,
627
+ actionDisabledText: primitiveColors.grey500,
562
628
  actionIconBackgroundDefault: 'rgba(255, 255, 255, 0.0000)',
563
629
  actionIconBackgroundHover: 'rgba(255, 255, 255, 0.0800)',
564
630
  actionIconBackgroundPress: 'rgba(255, 255, 255, 0.1600)',
@@ -585,7 +651,6 @@ const darkColorList = {
585
651
  actionTertiaryTextHover: primitiveColors.blue400,
586
652
  actionTertiaryTextPress: primitiveColors.blue300,
587
653
  backgroundDanger: 'rgba(200, 45, 76, 0.1600)',
588
- backgroundInfo: 'rgba(68, 83, 95, 0.1600)',
589
654
  backgroundPrimary: primitiveColors.grey800,
590
655
  backgroundSecondary: primitiveColors.grey700,
591
656
  backgroundSuccess: 'rgba(39, 124, 67, 0.1600)',
@@ -594,9 +659,11 @@ const darkColorList = {
594
659
  borderAccessible: primitiveColors.grey300,
595
660
  borderDanger: primitiveColors.red500,
596
661
  borderWarning: primitiveColors.yellow500,
597
- codeBackground: primitiveColors.grey700,
662
+ codeBackground: primitiveColors.grey650,
598
663
  overlayOverlay: 'rgba(31, 38, 45, 0.7200)',
599
- skeleton: 'rgba(228, 236, 241, 0.1000)',
664
+ progressFill: primitiveColors.grey600,
665
+ progressTrack: primitiveColors.grey700,
666
+ skeleton: 'rgba(144, 164, 181, 0.1600)',
600
667
  tableBackgroundSelectedDefault: 'rgba(189, 205, 219, 0.0800)',
601
668
  tableBackgroundSelectedHover: 'rgba(189, 205, 219, 0.1200)',
602
669
  tableBackgroundUnselectedDefault: primitiveColors.grey800,
@@ -604,13 +671,13 @@ const darkColorList = {
604
671
  tagBrown: 'rgba(166, 99, 12, 0.8600)',
605
672
  tagCharcoal: 'rgba(68, 83, 95, 0.8600)',
606
673
  tagCoral: 'rgba(200, 50, 67, 0.8600)',
607
- tagDefault: primitiveColors.grey700,
674
+ tagDefault: primitiveColors.grey650,
608
675
  tagHover: 'rgba(138, 202, 255, 0.0800)',
609
676
  tagIconDefault: primitiveColors.grey350,
610
677
  tagIconHover: primitiveColors.grey350,
611
678
  tagIconPress: primitiveColors.grey350,
612
679
  tagIndigo: 'rgba(67, 74, 147, 0.8600)',
613
- tagInverse: primitiveColors.grey100,
680
+ tagInverse: primitiveColors.grey800,
614
681
  tagLemon: 'rgba(250, 203, 102, 0.8600)',
615
682
  tagLime: 'rgba(48, 134, 19, 0.8600)',
616
683
  tagPink: 'rgba(180, 80, 145, 0.8600)',
@@ -619,7 +686,7 @@ const darkColorList = {
619
686
  tagTeal: 'rgba(4, 134, 125, 0.8600)',
620
687
  tagText: primitiveColors.grey100,
621
688
  tagTurquoise: 'rgba(19, 125, 174, 0.8600)',
622
- textPlaceholder: primitiveColors.grey650,
689
+ textPlaceholder: primitiveColors.grey400,
623
690
  textPrimary: primitiveColors.grey100,
624
691
  textSecondary: primitiveColors.grey350,
625
692
  textValidationDanger: primitiveColors.red500,
@@ -657,9 +724,9 @@ const lightColorList = {
657
724
  actionDefaultTextDefault: primitiveColors.grey800,
658
725
  actionDefaultTextHover: primitiveColors.blue700,
659
726
  actionDefaultTextPress: primitiveColors.blue800,
660
- actionDisabledBackground: primitiveColors.grey050,
661
- actionDisabledBorder: primitiveColors.grey100,
662
- actionDisabledText: primitiveColors.grey300,
727
+ actionDisabledBackground: primitiveColors.grey100,
728
+ actionDisabledBorder: primitiveColors.grey200,
729
+ actionDisabledText: primitiveColors.grey350,
663
730
  actionIconBackgroundDefault: 'rgba(34, 114, 180, 0.0000)',
664
731
  actionIconBackgroundHover: 'rgba(34, 114, 180, 0.0800)',
665
732
  actionIconBackgroundPress: 'rgba(34, 114, 180, 0.1600)',
@@ -686,7 +753,6 @@ const lightColorList = {
686
753
  actionTertiaryTextHover: primitiveColors.blue700,
687
754
  actionTertiaryTextPress: primitiveColors.blue800,
688
755
  backgroundDanger: primitiveColors.red100,
689
- backgroundInfo: primitiveColors.grey100,
690
756
  backgroundPrimary: primitiveColors.white,
691
757
  backgroundSecondary: primitiveColors.grey050,
692
758
  backgroundSuccess: primitiveColors.green100,
@@ -697,7 +763,9 @@ const lightColorList = {
697
763
  borderWarning: primitiveColors.yellow300,
698
764
  codeBackground: 'rgba(68, 83, 95, 0.0800)',
699
765
  overlayOverlay: 'rgba(64, 63, 63, 0.7200)',
700
- skeleton: 'rgba(17, 23, 28, 0.1000)',
766
+ progressFill: primitiveColors.grey300,
767
+ progressTrack: primitiveColors.grey100,
768
+ skeleton: 'rgba(144, 164, 181, 0.1600)',
701
769
  tableBackgroundSelectedDefault: 'rgba(68, 83, 95, 0.0800)',
702
770
  tableBackgroundSelectedHover: 'rgba(68, 83, 95, 0.1200)',
703
771
  tableBackgroundUnselectedDefault: primitiveColors.white,
@@ -705,7 +773,7 @@ const lightColorList = {
705
773
  tagBrown: primitiveColors.brown,
706
774
  tagCharcoal: primitiveColors.grey600,
707
775
  tagCoral: primitiveColors.coral,
708
- tagDefault: primitiveColors.grey050,
776
+ tagDefault: primitiveColors.grey100,
709
777
  tagHover: 'rgba(34, 114, 180, 0.0800)',
710
778
  tagIconDefault: primitiveColors.grey600,
711
779
  tagIconHover: primitiveColors.grey600,
@@ -722,7 +790,7 @@ const lightColorList = {
722
790
  tagTurquoise: primitiveColors.turquoise,
723
791
  textPlaceholder: primitiveColors.grey400,
724
792
  textPrimary: primitiveColors.grey800,
725
- textSecondary: primitiveColors.grey600,
793
+ textSecondary: primitiveColors.grey500,
726
794
  textValidationDanger: primitiveColors.red600,
727
795
  textValidationSuccess: primitiveColors.green600,
728
796
  textValidationWarning: primitiveColors.yellow600,
@@ -1314,7 +1382,6 @@ function SvgCursorIcon(props) {
1314
1382
  })
1315
1383
  }), jsx("defs", {
1316
1384
  children: jsx("clipPath", {
1317
- id: "CursorIcon_svg__a",
1318
1385
  children: jsx("path", {
1319
1386
  fill: "#fff",
1320
1387
  d: "M16 0H0v16h16z"
@@ -1382,7 +1449,6 @@ function SvgFaceFrownIcon(props) {
1382
1449
  })]
1383
1450
  }), jsx("defs", {
1384
1451
  children: jsx("clipPath", {
1385
- id: "FaceFrownIcon_svg__a",
1386
1452
  children: jsx("path", {
1387
1453
  fill: "#fff",
1388
1454
  d: "M0 0h16v16H0z"
@@ -1421,7 +1487,6 @@ function SvgFaceNeutralIcon(props) {
1421
1487
  })]
1422
1488
  }), jsx("defs", {
1423
1489
  children: jsx("clipPath", {
1424
- id: "FaceNeutralIcon_svg__a",
1425
1490
  children: jsx("path", {
1426
1491
  fill: "#fff",
1427
1492
  d: "M0 0h16v16H0z"
@@ -1464,7 +1529,6 @@ function SvgFaceSmileIcon(props) {
1464
1529
  })]
1465
1530
  }), jsx("defs", {
1466
1531
  children: jsx("clipPath", {
1467
- id: "FaceSmileIcon_svg__a",
1468
1532
  children: jsx("path", {
1469
1533
  fill: "#fff",
1470
1534
  d: "M0 0h16v16H0z"
@@ -1483,35 +1547,6 @@ const FaceSmileIcon = /*#__PURE__*/forwardRef((props, forwardedRef) => {
1483
1547
  FaceSmileIcon.displayName = 'FaceSmileIcon';
1484
1548
  var FaceSmileIcon$1 = FaceSmileIcon;
1485
1549
 
1486
- function SvgInfoIcon(props) {
1487
- return jsxs("svg", {
1488
- xmlns: "http://www.w3.org/2000/svg",
1489
- width: "1em",
1490
- height: "1em",
1491
- fill: "none",
1492
- viewBox: "0 0 16 16",
1493
- ...props,
1494
- children: [jsx("path", {
1495
- fill: "currentColor",
1496
- d: "M7.25 11V7h1.5v4h-1.5ZM8 4.5A.75.75 0 1 1 8 6a.75.75 0 0 1 0-1.5Z"
1497
- }), jsx("path", {
1498
- fill: "currentColor",
1499
- fillRule: "evenodd",
1500
- d: "M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Z",
1501
- clipRule: "evenodd"
1502
- })]
1503
- });
1504
- }
1505
- const InfoIcon = /*#__PURE__*/forwardRef((props, forwardedRef) => {
1506
- return jsx(Icon, {
1507
- ref: forwardedRef,
1508
- ...props,
1509
- component: SvgInfoIcon
1510
- });
1511
- });
1512
- InfoIcon.displayName = 'InfoIcon';
1513
- var InfoIcon$1 = InfoIcon;
1514
-
1515
1550
  function SvgLoadingIcon(props) {
1516
1551
  return jsx("svg", {
1517
1552
  xmlns: "http://www.w3.org/2000/svg",
@@ -1620,1316 +1655,1257 @@ const WarningIcon = /*#__PURE__*/forwardRef((props, forwardedRef) => {
1620
1655
  WarningIcon.displayName = 'WarningIcon';
1621
1656
  var WarningIcon$1 = WarningIcon;
1622
1657
 
1623
- function getDefaultStyles(theme) {
1624
- let loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1625
- const defaultStyles = {
1626
- backgroundColor: theme.colors.actionDefaultBackgroundDefault,
1627
- borderColor: theme.colors.actionDefaultBorderDefault,
1628
- color: theme.colors.actionDefaultTextDefault
1629
- };
1630
- return {
1631
- ...defaultStyles,
1632
- lineHeight: theme.typography.lineHeightBase,
1633
- textDecoration: 'none',
1634
- '&:hover': {
1635
- backgroundColor: theme.colors.actionDefaultBackgroundHover,
1636
- borderColor: theme.colors.actionDefaultBorderHover,
1637
- color: theme.colors.actionDefaultTextHover
1638
- },
1639
- '&:active': {
1640
- backgroundColor: loading ? theme.colors.actionDefaultBackgroundDefault : theme.colors.actionDefaultBackgroundPress,
1641
- borderColor: theme.colors.actionDefaultBorderPress,
1642
- color: theme.colors.actionDefaultTextPress
1643
- }
1644
- };
1645
- }
1646
- function getPrimaryStyles(theme) {
1647
- const defaultStyles = {
1648
- backgroundColor: theme.colors.actionPrimaryBackgroundDefault,
1649
- borderColor: 'transparent',
1650
- color: theme.colors.actionPrimaryTextDefault
1651
- };
1652
- return {
1653
- ...defaultStyles,
1654
- textShadow: 'none',
1655
- '&:hover': {
1656
- backgroundColor: theme.colors.actionPrimaryBackgroundHover,
1657
- borderColor: 'transparent',
1658
- color: theme.colors.actionPrimaryTextHover
1659
- },
1660
- '&:active': {
1661
- backgroundColor: theme.colors.actionPrimaryBackgroundPress,
1662
- borderColor: 'transparent',
1663
- color: theme.colors.actionPrimaryTextPress
1658
+ const {
1659
+ Text: AntDText$1
1660
+ } = Typography$1;
1661
+ function getTextEmotionStyles$1(theme, props) {
1662
+ return /*#__PURE__*/css({
1663
+ '&&': {
1664
+ display: 'block',
1665
+ fontSize: theme.typography.fontSizeSm,
1666
+ lineHeight: theme.typography.lineHeightSm,
1667
+ color: theme.colors.textSecondary,
1668
+ ...(props.withoutMargins && {
1669
+ '&&': {
1670
+ marginTop: 0,
1671
+ marginBottom: 0
1672
+ }
1673
+ })
1664
1674
  }
1665
- };
1675
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
1666
1676
  }
1667
- function getLinkStyles$1(theme) {
1668
- const defaultStyles = {
1669
- backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
1670
- borderColor: theme.colors.actionTertiaryBackgroundDefault,
1671
- color: theme.colors.actionTertiaryTextDefault
1672
- };
1673
- return {
1674
- ...defaultStyles,
1675
- '&:hover': {
1676
- backgroundColor: theme.colors.actionTertiaryBackgroundHover,
1677
- borderColor: 'transparent',
1678
- color: theme.colors.actionTertiaryTextHover
1679
- },
1680
- '&:active': {
1681
- backgroundColor: theme.colors.actionTertiaryBackgroundPress,
1682
- borderColor: 'transparent',
1683
- color: theme.colors.actionTertiaryTextPress
1684
- },
1685
- '&[disabled]:hover': {
1686
- background: 'none',
1687
- color: theme.colors.actionDisabledText
1688
- }
1689
- };
1677
+ function Hint(userProps) {
1678
+ const {
1679
+ dangerouslySetAntdProps,
1680
+ bold,
1681
+ withoutMargins,
1682
+ color,
1683
+ ...props
1684
+ } = userProps;
1685
+ const {
1686
+ theme
1687
+ } = useDesignSystemTheme();
1688
+ return jsx(DesignSystemAntDConfigProvider, {
1689
+ children: jsx(AntDText$1, {
1690
+ ...props,
1691
+ css: getTextEmotionStyles$1(theme, userProps),
1692
+ ...dangerouslySetAntdProps
1693
+ })
1694
+ });
1690
1695
  }
1691
- function getPrimaryDangerStyles(theme) {
1692
- const defaultStyles = {
1693
- backgroundColor: theme.colors.actionDangerPrimaryBackgroundDefault,
1694
- borderColor: 'transparent',
1695
- color: theme.colors.actionPrimaryTextDefault
1696
- };
1697
- return {
1698
- ...defaultStyles,
1699
- '&:hover': {
1700
- backgroundColor: theme.colors.actionDangerPrimaryBackgroundHover,
1701
- borderColor: 'transparent',
1702
- color: theme.colors.actionPrimaryTextHover
1696
+
1697
+ const getLinkStyles$1 = (theme, clsPrefix) => {
1698
+ const classTypography = `.${clsPrefix}-typography`;
1699
+ const styles = {
1700
+ [`&${classTypography}, &${classTypography}:focus`]: {
1701
+ color: theme.colors.actionTertiaryTextDefault
1703
1702
  },
1704
- '&:active': {
1705
- backgroundColor: theme.colors.actionDangerPrimaryBackgroundPress,
1706
- borderColor: 'transparent',
1707
- color: theme.colors.actionPrimaryTextPress
1703
+ [`&${classTypography}:hover, &${classTypography}:hover .anticon`]: {
1704
+ color: theme.colors.actionTertiaryTextHover,
1705
+ textDecoration: 'underline'
1708
1706
  },
1709
- '&:focus-visible': {
1710
- outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
1711
- }
1712
- };
1713
- }
1714
- function getSecondaryDangerStyles(theme) {
1715
- const defaultStyles = {
1716
- backgroundColor: theme.colors.actionDangerDefaultBackgroundDefault,
1717
- borderColor: theme.colors.actionDangerDefaultBorderDefault,
1718
- color: theme.colors.actionDangerDefaultTextDefault
1719
- };
1720
- return {
1721
- ...defaultStyles,
1722
- '&:hover': {
1723
- backgroundColor: theme.colors.actionDangerDefaultBackgroundHover,
1724
- borderColor: theme.colors.actionDangerDefaultBorderHover,
1725
- color: theme.colors.actionDangerDefaultTextHover
1707
+ [`&${classTypography}:active, &${classTypography}:active .anticon`]: {
1708
+ color: theme.colors.actionTertiaryTextPress,
1709
+ textDecoration: 'underline'
1726
1710
  },
1727
- '&:active': {
1728
- backgroundColor: theme.colors.actionDangerDefaultBackgroundPress,
1729
- borderColor: theme.colors.actionDangerDefaultBorderPress,
1730
- color: theme.colors.actionDangerDefaultTextPress
1711
+ [`&${classTypography}:focus-visible`]: {
1712
+ textDecoration: 'underline'
1731
1713
  },
1732
- '&:focus-visible': {
1733
- outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
1714
+ '.anticon': {
1715
+ fontSize: 12,
1716
+ verticalAlign: 'baseline'
1734
1717
  }
1735
1718
  };
1736
- }
1737
- function getDisabledStyles(theme) {
1738
- const defaultStyles = {
1739
- backgroundColor: theme.colors.actionDisabledBackground,
1740
- borderColor: 'transparent',
1741
- color: theme.colors.actionDisabledText
1719
+ return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getLinkStyles;");
1720
+ };
1721
+ const getEllipsisNewTabLinkStyles = () => {
1722
+ const styles = {
1723
+ paddingRight: 'calc(2px + 1em)',
1724
+ // 1em for icon
1725
+ position: 'relative'
1742
1726
  };
1743
- return {
1744
- ...defaultStyles,
1745
- '&:hover': {
1746
- backgroundColor: theme.colors.actionDisabledBackground,
1747
- borderColor: 'transparent',
1748
- color: theme.colors.actionDisabledText
1749
- },
1750
- '&:active': {
1751
- backgroundColor: theme.colors.actionDisabledBackground,
1752
- borderColor: 'transparent',
1753
- color: theme.colors.actionDisabledText
1754
- }
1727
+ return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisNewTabLinkStyles;");
1728
+ };
1729
+ const getIconStyles = theme => {
1730
+ const styles = {
1731
+ marginLeft: 2,
1732
+ color: theme.colors.actionTertiaryTextDefault
1755
1733
  };
1756
- }
1757
- function getDisabledTertiaryStyles(theme) {
1758
- const defaultStyles = {
1759
- backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
1760
- borderColor: 'transparent',
1761
- color: theme.colors.actionDisabledText
1734
+ return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getIconStyles;");
1735
+ };
1736
+ const getEllipsisIconStyles = useNewIcons => {
1737
+ const styles = {
1738
+ position: 'absolute',
1739
+ right: 0,
1740
+ bottom: 0,
1741
+ top: 0,
1742
+ display: 'flex',
1743
+ alignItems: 'center',
1744
+ ...(useNewIcons && {
1745
+ fontSize: 12
1746
+ })
1762
1747
  };
1763
- return {
1764
- ...defaultStyles,
1765
- '&:hover': {
1766
- backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
1767
- borderColor: 'transparent',
1768
- color: theme.colors.actionDisabledText
1769
- },
1770
- '&:active': {
1771
- backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
1772
- borderColor: 'transparent',
1773
- color: theme.colors.actionDisabledText
1774
- }
1775
- };
1776
- }
1777
-
1778
- let DesignSystemEventProviderComponentTypes = /*#__PURE__*/function (DesignSystemEventProviderComponentTypes) {
1779
- DesignSystemEventProviderComponentTypes["Button"] = "button";
1780
- DesignSystemEventProviderComponentTypes["Input"] = "input";
1781
- return DesignSystemEventProviderComponentTypes;
1782
- }({});
1783
- let DesignSystemEventProviderAnalyticsEventTypes = /*#__PURE__*/function (DesignSystemEventProviderAnalyticsEventTypes) {
1784
- DesignSystemEventProviderAnalyticsEventTypes["OnClick"] = "onClick";
1785
- DesignSystemEventProviderAnalyticsEventTypes["OnView"] = "onView";
1786
- DesignSystemEventProviderAnalyticsEventTypes["OnValueChange"] = "onValueChange";
1787
- return DesignSystemEventProviderAnalyticsEventTypes;
1788
- }({});
1789
- const shouldTriggerCallback = (eventType, analyticsEvents) => {
1790
- return analyticsEvents.includes(eventType);
1791
- };
1792
- const DefaultEmptyCallbacks = {
1793
- callback: () => {}
1794
- };
1795
- const DesignSystemEventProviderContext = /*#__PURE__*/React__default.createContext(DefaultEmptyCallbacks);
1796
-
1797
- /**
1798
- * This gets the event provider, which is used to pass callbacks to the design system for events such as onClick, onView, and onValueChange.
1799
- * If the value is undefined, then the expected behavior is to not emit any events.
1800
- *
1801
- * @returns DesignSystemEventProviderContextType
1802
- */
1803
- const useDesignSystemEventProviderContext = () => {
1804
- return useContext(DesignSystemEventProviderContext);
1748
+ return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisIconStyles;");
1805
1749
  };
1806
-
1807
- /**
1808
- * NOTE: This is not suggested for direct usage from engineers, and should emit your own events.
1809
- * See https://databricks.atlassian.net/wiki/spaces/UN/pages/2533556277/Usage+Logging+in+UI#Send-usage-logging-from-UI for more details.
1810
- *
1811
- * This gets the event provider component event type callbacks.
1812
- * If context & componentId are not undefined, then it will check if the event is in analyticsEvents or the default analyticsEvents for that component.
1813
- * If the context or componentId are undefined, then the expected behavior is to not emit any events.
1814
- *
1815
- * @returns Object of event callbacks
1816
- */
1817
- const useDesignSystemEventComponentCallbacks = _ref => {
1750
+ const Link = /*#__PURE__*/forwardRef(function Link(_ref, ref) {
1818
1751
  let {
1819
- componentType,
1820
- componentId,
1821
- analyticsEvents
1752
+ dangerouslySetAntdProps,
1753
+ ...props
1822
1754
  } = _ref;
1823
- const context = useDesignSystemEventProviderContext();
1824
- const callbacks = useMemo(() => {
1825
- if (context === DefaultEmptyCallbacks || componentId === undefined) {
1826
- return {
1827
- onClick: () => {},
1828
- onValueChange: () => {},
1829
- onView: () => {}
1830
- };
1831
- }
1832
- return {
1833
- onClick: () => {
1834
- if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnClick, analyticsEvents)) {
1835
- context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnClick, componentType, componentId);
1836
- }
1837
- },
1838
- onValueChange: () => {
1839
- if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnValueChange, analyticsEvents)) {
1840
- context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnValueChange, componentType, componentId);
1841
- }
1842
- },
1843
- onView: () => {
1844
- if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnView, analyticsEvents)) {
1845
- context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnView, componentType, componentId);
1846
- }
1847
- }
1848
- };
1849
- }, [context, componentType, componentId, analyticsEvents]);
1850
- return callbacks;
1851
- };
1852
-
1853
- /**
1854
- * NOTE: This is not suggested for direct usage from engineers, and should use RecordEventContext instead.
1855
- * See https://databricks.atlassian.net/wiki/spaces/UN/pages/2533556277/Usage+Logging+in+UI#Send-usage-logging-from-UI for more details.
1856
- *
1857
- * This is the Design System Event Context Provider, and is only used to pass callbacks to the design system for events such as onClick, onView, and onValueChange.
1858
- *
1859
- * @param children Children react elements
1860
- * @param callback The event callback function
1861
- * @returns Design System Event Context Provider with the children inside
1862
- */
1863
- function DesignSystemEventProvider(_ref2) {
1864
- let {
1755
+ const {
1865
1756
  children,
1866
- callback
1867
- } = _ref2;
1868
- const contextValue = useMemo(() => {
1869
- return {
1870
- callback
1871
- };
1872
- }, [callback]);
1873
- return jsx(DesignSystemEventProviderContext.Provider, {
1874
- value: contextValue,
1875
- children: children
1757
+ openInNewTab,
1758
+ ...restProps
1759
+ } = props;
1760
+ const {
1761
+ theme,
1762
+ classNamePrefix
1763
+ } = useDesignSystemTheme();
1764
+ const newTabProps = {
1765
+ rel: 'noopener noreferrer',
1766
+ target: '_blank'
1767
+ };
1768
+ const linkProps = openInNewTab ? {
1769
+ ...restProps,
1770
+ ...newTabProps
1771
+ } : {
1772
+ ...restProps
1773
+ };
1774
+ const linkStyles = props.ellipsis && openInNewTab ? [getLinkStyles$1(theme, classNamePrefix), getEllipsisNewTabLinkStyles()] : getLinkStyles$1(theme, classNamePrefix);
1775
+ const iconStyles = props.ellipsis ? [getIconStyles(theme), getEllipsisIconStyles()] : getIconStyles(theme);
1776
+ return jsx(DesignSystemAntDConfigProvider, {
1777
+ children: jsxs(Typography$1.Link, {
1778
+ "aria-disabled": linkProps.disabled,
1779
+ css: linkStyles,
1780
+ ref: ref,
1781
+ ...linkProps,
1782
+ ...dangerouslySetAntdProps,
1783
+ children: [children, openInNewTab ? jsx(NewWindowIcon$1, {
1784
+ css: iconStyles,
1785
+ ...newTabProps
1786
+ }) : null]
1787
+ })
1876
1788
  });
1877
- }
1878
-
1879
- // Use Symbol to correctly handled null/undefined as stable values
1880
- const NOT_INITIALIZED = Symbol('NOT_INITIALIZED');
1789
+ });
1881
1790
 
1882
- /**
1883
- * Use to keep a stable value on the first mount of a component
1884
- * that cannot change.
1885
- */
1886
- function useStable(valueCallback) {
1887
- const ref = useRef(NOT_INITIALIZED);
1888
- if (ref.current === NOT_INITIALIZED) {
1889
- const val = valueCallback();
1890
- ref.current = val;
1891
- return val;
1892
- }
1893
- return ref.current;
1791
+ const {
1792
+ Paragraph: AntDParagraph
1793
+ } = Typography$1;
1794
+ function getParagraphEmotionStyles(theme, props) {
1795
+ return /*#__PURE__*/css({
1796
+ '&&': {
1797
+ fontSize: theme.typography.fontSizeBase,
1798
+ fontWeight: theme.typography.typographyRegularFontWeight,
1799
+ lineHeight: theme.typography.lineHeightBase,
1800
+ color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
1801
+ },
1802
+ '& .anticon': {
1803
+ verticalAlign: 'text-bottom'
1804
+ }
1805
+ }, props.disabled && {
1806
+ '&&': {
1807
+ color: theme.colors.actionDisabledText
1808
+ }
1809
+ }, props.withoutMargins && {
1810
+ '&&': {
1811
+ marginTop: 0,
1812
+ marginBottom: 0
1813
+ }
1814
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getParagraphEmotionStyles;");
1894
1815
  }
1895
- let sequentialCounter = 0;
1896
- function useStableUid() {
1897
- return useStable(() => sequentialCounter++);
1816
+ function Paragraph(userProps) {
1817
+ const {
1818
+ dangerouslySetAntdProps,
1819
+ withoutMargins,
1820
+ color,
1821
+ ...props
1822
+ } = userProps;
1823
+ const {
1824
+ theme
1825
+ } = useDesignSystemTheme();
1826
+ return jsx(DesignSystemAntDConfigProvider, {
1827
+ children: jsx(AntDParagraph, {
1828
+ ...props,
1829
+ className: props.className,
1830
+ css: getParagraphEmotionStyles(theme, userProps),
1831
+ ...dangerouslySetAntdProps
1832
+ })
1833
+ });
1898
1834
  }
1899
1835
 
1900
- /** Props for UI components that support a "loading" state. */
1901
-
1902
- /**
1903
- * A handler for integrating UI components with external latency instrumentation.
1904
- * If provided via `LoadingStateContext`, hooks will be called whenever child
1905
- * components in a "loading" state are mounted and unmounted.
1906
- */
1907
-
1908
- const LoadingStateContext = /*#__PURE__*/createContext(null);
1909
- /**
1910
- * Indicates that the containing component is in a "loading" state, i.e. that the UI
1911
- * displayed to the user is semantically equivalent to them seeing a spinner or a
1912
- * loading indicator. This means that the UI is not in its final settled state yet.
1913
- *
1914
- * All components that are in a "loading" state should render a `<LoadingState>`
1915
- * component, preferrably with an appropriate description.
1916
- *
1917
- * By itself, `<LoadingState>` doesn't do anything, but if used within `LoadingStateContext`,
1918
- * it will call the provided `startLoading()`/`endLoading()` hooks when the component
1919
- * is mounted/unmounted, which can be used to integrate existing latency instrumentation.
1920
- */
1921
- const LoadingState = _ref => {
1922
- let {
1923
- description = 'Generic UI loading state'
1924
- } = _ref;
1925
- const uid = useStableUid();
1926
- const loadingStateContext = useContext(LoadingStateContext);
1927
- useLayoutEffect(() => {
1928
- // mount
1929
- if (loadingStateContext) {
1930
- loadingStateContext.startLoading(uid, description);
1836
+ const {
1837
+ Text: AntDText
1838
+ } = Typography$1;
1839
+ function getTextEmotionStyles(theme, props) {
1840
+ return /*#__PURE__*/css({
1841
+ '&&': {
1842
+ fontSize: theme.typography.fontSizeBase,
1843
+ fontWeight: theme.typography.typographyRegularFontWeight,
1844
+ lineHeight: theme.typography.lineHeightBase,
1845
+ color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
1931
1846
  }
1932
- return () => {
1933
- // unmount
1934
- if (loadingStateContext) {
1935
- loadingStateContext.endLoading(uid);
1936
- }
1937
- };
1938
- }, [uid, description, loadingStateContext]);
1939
- return null;
1940
- };
1941
-
1942
- const rotate = keyframes({
1943
- '0%': {
1944
- transform: 'rotate(0deg) translate3d(0, 0, 0)'
1945
- },
1946
- '100%': {
1947
- transform: 'rotate(360deg) translate3d(0, 0, 0)'
1948
- }
1949
- });
1950
- const cssSpinner = function (theme) {
1951
- let frameRate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
1952
- let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1953
- let animationDuration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1954
- let inheritColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1955
- const styles = {
1956
- animation: `${rotate} ${animationDuration}s steps(${frameRate}, end) infinite`,
1957
- ...(inheritColor ? {
1958
- color: 'inherit'
1959
- } : {
1960
- color: theme.colors.textSecondary
1961
- }),
1962
- animationDelay: `${delay}s`,
1963
- '@media only percy': {
1964
- animation: 'none'
1847
+ }, props.disabled && {
1848
+ '&&': {
1849
+ color: theme.colors.actionDisabledText
1965
1850
  }
1966
- };
1967
- return /*#__PURE__*/css(importantify(styles), process.env.NODE_ENV === "production" ? "" : ";label:cssSpinner;");
1968
- };
1969
- const Spinner = _ref => {
1970
- let {
1971
- frameRate,
1972
- size = 'default',
1973
- delay,
1974
- className: propClass,
1975
- label,
1976
- animationDuration,
1977
- inheritColor,
1978
- loading = true,
1979
- loadingDescription = 'Spinner',
1851
+ }, props.hint && {
1852
+ '&&': {
1853
+ fontSize: theme.typography.fontSizeSm,
1854
+ lineHeight: theme.typography.lineHeightSm
1855
+ }
1856
+ }, props.bold && {
1857
+ '&&': {
1858
+ fontSize: theme.typography.fontSizeBase,
1859
+ fontWeight: theme.typography.typographyBoldFontWeight,
1860
+ lineHeight: theme.typography.lineHeightBase
1861
+ }
1862
+ }, props.code && {
1863
+ '&& > code': {
1864
+ color: theme.colors.textPrimary,
1865
+ fontSize: theme.typography.fontSizeBase,
1866
+ lineHeight: theme.typography.lineHeightBase,
1867
+ background: theme.colors.typographyCodeBg,
1868
+ fontFamily: 'monospace',
1869
+ borderRadius: theme.borders.borderRadiusMd,
1870
+ padding: '2px 4px',
1871
+ border: 'unset',
1872
+ margin: 0
1873
+ }
1874
+ }, props.size && {
1875
+ '&&': (() => {
1876
+ switch (props.size) {
1877
+ case 'xxl':
1878
+ return {
1879
+ fontSize: theme.typography.fontSizeXxl,
1880
+ lineHeight: theme.typography.lineHeightXxl,
1881
+ '& .anticon': {
1882
+ lineHeight: theme.typography.lineHeightXxl,
1883
+ verticalAlign: 'middle'
1884
+ }
1885
+ };
1886
+ case 'xl':
1887
+ return {
1888
+ fontSize: theme.typography.fontSizeXl,
1889
+ lineHeight: theme.typography.lineHeightXl,
1890
+ '& .anticon': {
1891
+ lineHeight: theme.typography.lineHeightXl,
1892
+ verticalAlign: 'middle'
1893
+ }
1894
+ };
1895
+ case 'lg':
1896
+ return {
1897
+ fontSize: theme.typography.fontSizeLg,
1898
+ lineHeight: theme.typography.lineHeightLg,
1899
+ '& .anticon': {
1900
+ lineHeight: theme.typography.lineHeightLg,
1901
+ verticalAlign: 'middle'
1902
+ }
1903
+ };
1904
+ case 'sm':
1905
+ return {
1906
+ fontSize: theme.typography.fontSizeSm,
1907
+ lineHeight: theme.typography.lineHeightSm,
1908
+ '& .anticon': {
1909
+ verticalAlign: '-0.219em'
1910
+ }
1911
+ };
1912
+ default:
1913
+ return {};
1914
+ }
1915
+ })()
1916
+ }, props.withoutMargins && {
1917
+ '&&': {
1918
+ marginTop: 0,
1919
+ marginBottom: 0
1920
+ }
1921
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
1922
+ }
1923
+ function Text(userProps) {
1924
+ // Omit props that are not supported by `antd`
1925
+ const {
1926
+ dangerouslySetAntdProps,
1927
+ bold,
1928
+ hint,
1929
+ withoutMargins,
1930
+ color,
1980
1931
  ...props
1981
- } = _ref;
1932
+ } = userProps;
1982
1933
  const {
1983
- classNamePrefix,
1984
1934
  theme
1985
1935
  } = useDesignSystemTheme();
1986
-
1987
- // We use Antd classes to keep styling unchanged
1988
- // TODO(FEINF-1407): We want to move away from Antd classes and use Emotion for styling in the future
1989
- const sizeSuffix = size === 'small' ? '-sm' : size === 'large' ? '-lg' : '';
1990
- const sizeClass = sizeSuffix ? `${classNamePrefix}-spin${sizeSuffix}` : '';
1991
- const wrapperClass = `${propClass || ''} ${classNamePrefix}-spin ${sizeClass} ${classNamePrefix}-spin-spinning ${DU_BOIS_ENABLE_ANIMATION_CLASSNAME}`.trim();
1992
- const className = `${classNamePrefix}-spin-dot ${DU_BOIS_ENABLE_ANIMATION_CLASSNAME}`.trim();
1993
- return (
1994
- // className has to follow {...props}, otherwise is `css` prop is passed down it will overwrite our className
1995
- jsxs("div", {
1936
+ return jsx(DesignSystemAntDConfigProvider, {
1937
+ children: jsx(AntDText, {
1996
1938
  ...props,
1997
- className: wrapperClass,
1998
- children: [loading && jsx(LoadingState, {
1999
- description: loadingDescription
2000
- }), jsx(AccessibleContainer, {
2001
- label: label,
2002
- children: jsx(LoadingIcon$1, {
2003
- "aria-hidden": "false",
2004
- css: cssSpinner(theme, frameRate, delay, animationDuration, inheritColor),
2005
- className: className
2006
- })
2007
- })]
1939
+ className: props.className,
1940
+ css: getTextEmotionStyles(theme, userProps),
1941
+ ...dangerouslySetAntdProps
2008
1942
  })
2009
- );
2010
- };
1943
+ });
1944
+ }
2011
1945
 
2012
- /**
2013
- * Provides access to http://go/safex flags from the frontend. Note that this is a temporary
2014
- * workaround until direct `safex` imports are available.
2015
- * @param flag The name of the flag to check
2016
- * @param defaultValue The default value to return if the flag is not set
2017
- * @returns
2018
- */
2019
- const safex = (flag, defaultValue) => {
2020
- // Catching errors here, because we don't have type-safety to ensure
2021
- // that `__debug__safex`'s API hasn't changed.
2022
- try {
2023
- const globalSafex = window.__debug__safex;
2024
- return globalSafex ? globalSafex(flag, defaultValue) : defaultValue;
2025
- } catch (e) {
2026
- return defaultValue;
1946
+ const {
1947
+ Title: AntDTitle
1948
+ } = Typography$1;
1949
+ function getLevelStyles(theme, props) {
1950
+ switch (props.level) {
1951
+ case 1:
1952
+ return /*#__PURE__*/css({
1953
+ '&&': {
1954
+ fontSize: theme.typography.fontSizeXxl,
1955
+ lineHeight: theme.typography.lineHeightXxl,
1956
+ fontWeight: theme.typography.typographyBoldFontWeight
1957
+ },
1958
+ '& > .anticon': {
1959
+ lineHeight: theme.typography.lineHeightXxl
1960
+ }
1961
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1962
+ case 2:
1963
+ return /*#__PURE__*/css({
1964
+ '&&': {
1965
+ fontSize: theme.typography.fontSizeXl,
1966
+ lineHeight: theme.typography.lineHeightXl,
1967
+ fontWeight: theme.typography.typographyBoldFontWeight
1968
+ },
1969
+ '& > .anticon': {
1970
+ lineHeight: theme.typography.lineHeightXl
1971
+ }
1972
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1973
+ case 3:
1974
+ return /*#__PURE__*/css({
1975
+ '&&': {
1976
+ fontSize: theme.typography.fontSizeLg,
1977
+ lineHeight: theme.typography.lineHeightLg,
1978
+ fontWeight: theme.typography.typographyBoldFontWeight
1979
+ },
1980
+ '& > .anticon': {
1981
+ lineHeight: theme.typography.lineHeightLg
1982
+ }
1983
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1984
+ case 4:
1985
+ default:
1986
+ return /*#__PURE__*/css({
1987
+ '&&': {
1988
+ fontSize: theme.typography.fontSizeMd,
1989
+ lineHeight: theme.typography.lineHeightMd,
1990
+ fontWeight: theme.typography.typographyBoldFontWeight
1991
+ },
1992
+ '& > .anticon': {
1993
+ lineHeight: theme.typography.lineHeightMd
1994
+ }
1995
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
2027
1996
  }
2028
- };
2029
-
2030
- function getEndIconClsName(theme) {
2031
- return `${theme.general.iconfontCssPrefix}-btn-end-icon`;
2032
1997
  }
2033
- const getButtonEmotionStyles = _ref => {
2034
- let {
2035
- theme,
2036
- classNamePrefix,
2037
- loading,
2038
- withIcon,
2039
- onlyIcon,
2040
- isAnchor,
2041
- enableAnimation,
2042
- size,
2043
- type,
2044
- isFlex,
2045
- useFocusPseudoClass,
2046
- forceIconStyles
2047
- } = _ref;
2048
- const clsIcon = `.${theme.general.iconfontCssPrefix}`;
2049
- const clsEndIcon = `.${getEndIconClsName(theme)}`;
2050
- const clsLoadingIcon = `.${classNamePrefix}-btn-loading-icon`;
2051
- const clsIconOnly = `.${classNamePrefix}-btn-icon-only`;
2052
- const classPrimary = `.${classNamePrefix}-btn-primary`;
2053
- const classLink = `.${classNamePrefix}-btn-link`;
2054
- const classDangerous = `.${classNamePrefix}-btn-dangerous`;
2055
- const SMALL_BUTTON_HEIGHT = 24;
2056
- const tertiaryColors = {
2057
- background: theme.colors.actionTertiaryBackgroundDefault,
2058
- color: theme.colors.actionTertiaryTextDefault,
2059
- '&:hover': {
2060
- background: theme.colors.actionTertiaryBackgroundHover,
2061
- color: theme.colors.actionTertiaryTextHover
1998
+ function getTitleEmotionStyles(theme, props) {
1999
+ return /*#__PURE__*/css(getLevelStyles(theme, props), {
2000
+ '&&': {
2001
+ color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
2062
2002
  },
2063
- '&:active': {
2064
- background: theme.colors.actionTertiaryBackgroundPress,
2065
- color: theme.colors.actionTertiaryTextPress
2003
+ '& > .anticon': {
2004
+ verticalAlign: 'middle'
2066
2005
  }
2067
- };
2068
- const iconCss = {
2069
- fontSize: theme.general.iconFontSize,
2070
- ...(!isFlex && {
2071
- // verticalAlign used by AntD to move icon and label to center
2072
- // TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
2073
- // behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
2074
- verticalAlign: -4,
2075
- ...(onlyIcon && {
2076
- verticalAlign: -3
2077
- }),
2078
- // verticalAlign used by AntD to move icon and label to center
2079
- // TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
2080
- // behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
2081
- // Need to make sure not to apply this to regular buttons as it will offset the icons
2082
- ...(!onlyIcon && {
2083
- verticalAlign: -3
2084
- })
2085
- }),
2086
- lineHeight: 0,
2087
- ...(size === 'small' && {
2088
- lineHeight: theme.typography.lineHeightSm,
2089
- ...((onlyIcon || forceIconStyles) && {
2090
- fontSize: 16,
2091
- ...(isFlex && {
2092
- height: 16
2093
- })
2094
- })
2006
+ }, props.withoutMargins && {
2007
+ '&&': {
2008
+ marginTop: '0 !important',
2009
+ // override general styling
2010
+ marginBottom: '0 !important' // override general styling
2011
+ }
2012
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getTitleEmotionStyles;");
2013
+ }
2014
+ function Title(userProps) {
2015
+ const {
2016
+ dangerouslySetAntdProps,
2017
+ withoutMargins,
2018
+ color,
2019
+ ...props
2020
+ } = userProps;
2021
+ const {
2022
+ theme
2023
+ } = useDesignSystemTheme();
2024
+ return jsx(DesignSystemAntDConfigProvider, {
2025
+ children: jsx(AntDTitle, {
2026
+ ...props,
2027
+ className: props.className,
2028
+ css: getTitleEmotionStyles(theme, userProps),
2029
+ ...dangerouslySetAntdProps
2095
2030
  })
2031
+ });
2032
+ }
2033
+
2034
+ const Typography = /* #__PURE__ */(() => {
2035
+ function Typography(_ref) {
2036
+ let {
2037
+ dangerouslySetAntdProps,
2038
+ ...props
2039
+ } = _ref;
2040
+ return jsx(DesignSystemAntDConfigProvider, {
2041
+ children: jsx(Typography$1, {
2042
+ ...props,
2043
+ ...dangerouslySetAntdProps
2044
+ })
2045
+ });
2046
+ }
2047
+ Typography.Text = Text;
2048
+ Typography.Title = Title;
2049
+ Typography.Paragraph = Paragraph;
2050
+ Typography.Link = Link;
2051
+ Typography.Hint = Hint;
2052
+ return Typography;
2053
+ })();
2054
+
2055
+ function getDefaultStyles(theme) {
2056
+ let loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2057
+ const defaultStyles = {
2058
+ backgroundColor: theme.colors.actionDefaultBackgroundDefault,
2059
+ borderColor: theme.colors.actionDefaultBorderDefault,
2060
+ color: theme.colors.actionDefaultTextDefault
2096
2061
  };
2097
- const inactiveIconCss = {
2098
- color: theme.colors.textSecondary
2099
- };
2100
- const endIconCssSelector = `span > ${clsEndIcon} > ${clsIcon}`;
2101
- const styles = {
2062
+ return {
2063
+ ...defaultStyles,
2102
2064
  lineHeight: theme.typography.lineHeightBase,
2103
- boxShadow: 'none',
2104
- height: theme.general.heightSm,
2105
- ...(isFlex && {
2106
- display: 'inline-flex',
2107
- alignItems: 'center',
2108
- justifyContent: 'center',
2109
- verticalAlign: 'middle'
2110
- }),
2111
- ...(!onlyIcon && !forceIconStyles && {
2112
- '&&': {
2113
- padding: '4px 12px',
2114
- ...(size === 'small' && {
2115
- padding: '0 8px'
2116
- })
2117
- }
2118
- }),
2119
- ...((onlyIcon || forceIconStyles) && {
2120
- width: theme.general.heightSm
2121
- }),
2122
- ...(size === 'small' && {
2123
- height: SMALL_BUTTON_HEIGHT,
2124
- lineHeight: theme.typography.lineHeightBase,
2125
- ...((onlyIcon || forceIconStyles) && {
2126
- width: SMALL_BUTTON_HEIGHT,
2127
- paddingTop: 0,
2128
- paddingBottom: 0,
2129
- verticalAlign: 'middle'
2130
- })
2131
- }),
2132
- '&:focus-visible': {
2133
- outlineStyle: 'solid',
2134
- outlineWidth: '2px',
2135
- outlineOffset: '1px',
2136
- outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
2065
+ textDecoration: 'none',
2066
+ '&:hover': {
2067
+ backgroundColor: theme.colors.actionDefaultBackgroundHover,
2068
+ borderColor: theme.colors.actionDefaultBorderHover,
2069
+ color: theme.colors.actionDefaultTextHover
2137
2070
  },
2138
- ...getDefaultStyles(theme, loading),
2139
- [`&${classPrimary}`]: {
2140
- ...getPrimaryStyles(theme)
2071
+ '&:active': {
2072
+ backgroundColor: loading ? theme.colors.actionDefaultBackgroundDefault : theme.colors.actionDefaultBackgroundPress,
2073
+ borderColor: theme.colors.actionDefaultBorderPress,
2074
+ color: theme.colors.actionDefaultTextPress
2075
+ }
2076
+ };
2077
+ }
2078
+ function getPrimaryStyles(theme) {
2079
+ const defaultStyles = {
2080
+ backgroundColor: theme.colors.actionPrimaryBackgroundDefault,
2081
+ borderColor: 'transparent',
2082
+ color: theme.colors.actionPrimaryTextDefault
2083
+ };
2084
+ return {
2085
+ ...defaultStyles,
2086
+ textShadow: 'none',
2087
+ '&:hover': {
2088
+ backgroundColor: theme.colors.actionPrimaryBackgroundHover,
2089
+ borderColor: 'transparent',
2090
+ color: theme.colors.actionPrimaryTextHover
2141
2091
  },
2142
- [`&${classLink}`]: {
2143
- ...getLinkStyles$1(theme),
2144
- ...(type === 'link' && {
2145
- padding: 'unset',
2146
- height: 'auto',
2147
- border: 'none',
2148
- boxShadow: 'none',
2149
- '&[disabled],&:hover': {
2150
- background: 'none'
2151
- }
2152
- })
2092
+ '&:active': {
2093
+ backgroundColor: theme.colors.actionPrimaryBackgroundPress,
2094
+ borderColor: 'transparent',
2095
+ color: theme.colors.actionPrimaryTextPress
2096
+ }
2097
+ };
2098
+ }
2099
+ function getLinkStyles(theme) {
2100
+ const defaultStyles = {
2101
+ backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
2102
+ borderColor: theme.colors.actionTertiaryBackgroundDefault,
2103
+ color: theme.colors.actionTertiaryTextDefault
2104
+ };
2105
+ return {
2106
+ ...defaultStyles,
2107
+ '&:hover': {
2108
+ backgroundColor: theme.colors.actionTertiaryBackgroundHover,
2109
+ borderColor: 'transparent',
2110
+ color: theme.colors.actionTertiaryTextHover
2153
2111
  },
2154
- [`&${classDangerous}${classPrimary}`]: {
2155
- ...getPrimaryDangerStyles(theme)
2112
+ '&:active': {
2113
+ backgroundColor: theme.colors.actionTertiaryBackgroundPress,
2114
+ borderColor: 'transparent',
2115
+ color: theme.colors.actionTertiaryTextPress
2156
2116
  },
2157
- [`&${classDangerous}`]: {
2158
- ...getSecondaryDangerStyles(theme)
2117
+ '&[disabled]:hover': {
2118
+ background: 'none',
2119
+ color: theme.colors.actionDisabledText
2120
+ }
2121
+ };
2122
+ }
2123
+ function getPrimaryDangerStyles(theme) {
2124
+ const defaultStyles = {
2125
+ backgroundColor: theme.colors.actionDangerPrimaryBackgroundDefault,
2126
+ borderColor: 'transparent',
2127
+ color: theme.colors.actionPrimaryTextDefault
2128
+ };
2129
+ return {
2130
+ ...defaultStyles,
2131
+ '&:hover': {
2132
+ backgroundColor: theme.colors.actionDangerPrimaryBackgroundHover,
2133
+ borderColor: 'transparent',
2134
+ color: theme.colors.actionPrimaryTextHover
2159
2135
  },
2160
- [`&[disabled], &${classDangerous}:disabled`]: {
2161
- ...getDisabledStyles(theme),
2162
- ...((onlyIcon || forceIconStyles) && {
2163
- backgroundColor: 'transparent',
2164
- '&:hover': {
2165
- backgroundColor: 'transparent'
2166
- },
2167
- '&:active': {
2168
- backgroundColor: 'transparent'
2169
- }
2170
- })
2136
+ '&:active': {
2137
+ backgroundColor: theme.colors.actionDangerPrimaryBackgroundPress,
2138
+ borderColor: 'transparent',
2139
+ color: theme.colors.actionPrimaryTextPress
2171
2140
  },
2172
- [clsLoadingIcon]: {
2173
- display: 'none'
2141
+ '&:focus-visible': {
2142
+ outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
2143
+ }
2144
+ };
2145
+ }
2146
+ function getSecondaryDangerStyles(theme) {
2147
+ const defaultStyles = {
2148
+ backgroundColor: theme.colors.actionDangerDefaultBackgroundDefault,
2149
+ borderColor: theme.colors.actionDangerDefaultBorderDefault,
2150
+ color: theme.colors.actionDangerDefaultTextDefault
2151
+ };
2152
+ return {
2153
+ ...defaultStyles,
2154
+ '&:hover': {
2155
+ backgroundColor: theme.colors.actionDangerDefaultBackgroundHover,
2156
+ borderColor: theme.colors.actionDangerDefaultBorderHover,
2157
+ color: theme.colors.actionDangerDefaultTextHover
2174
2158
  },
2175
- // Loading styles
2176
- ...(loading && {
2177
- '::before': {
2178
- opacity: 0
2179
- },
2180
- cursor: 'default',
2181
- [`${clsLoadingIcon}`]: {
2182
- ...(onlyIcon ? {
2183
- // In case of only icon, the icon is already centered but vertically not aligned, this fixes that
2184
- verticalAlign: 'middle'
2185
- } : {
2186
- // Position loading indicator in center
2187
- // This would break vertical centering of loading circle when onlyIcon is true
2188
- position: 'absolute'
2189
- }),
2190
- ...(!isFlex && !forceIconStyles && {
2191
- // Normally we'd do `transform: translateX(-50%)` but `antd` crushes that with injected inline `style`.
2192
- left: 'calc(50% - 7px)'
2193
- }),
2194
- // Re-enable animation for the loading spinner, since it can be disabled by the global animation CSS.
2195
- svg: {
2196
- animationDuration: '1s !important'
2197
- }
2198
- },
2199
- [`& > ${clsLoadingIcon} .anticon`]: {
2200
- paddingRight: 0 // to horizontally center icon
2201
- },
2202
-
2203
- [`> :not(${clsLoadingIcon})`]: {
2204
- // Hide all content except loading icon
2205
- opacity: 0,
2206
- visibility: 'hidden',
2207
- // Add horizontal space for icon
2208
- ...(withIcon && {
2209
- paddingLeft: theme.general.iconFontSize + theme.spacing.xs
2210
- })
2211
- }
2212
- }),
2213
- // Icon styles
2214
- [`> ${clsIcon} + span, > span + ${clsIcon}`]: {
2215
- marginRight: 0,
2216
- marginLeft: theme.spacing.xs
2159
+ '&:active': {
2160
+ backgroundColor: theme.colors.actionDangerDefaultBackgroundPress,
2161
+ borderColor: theme.colors.actionDangerDefaultBorderPress,
2162
+ color: theme.colors.actionDangerDefaultTextPress
2217
2163
  },
2218
- [`> ${clsIcon}`]: iconCss,
2219
- [`> ${endIconCssSelector}`]: {
2220
- ...iconCss,
2221
- marginLeft: theme.spacing.sm
2164
+ '&:focus-visible': {
2165
+ outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
2166
+ }
2167
+ };
2168
+ }
2169
+ function getDisabledStyles(theme) {
2170
+ const defaultStyles = {
2171
+ backgroundColor: theme.colors.actionDisabledBackground,
2172
+ borderColor: 'transparent',
2173
+ color: theme.colors.actionDisabledText
2174
+ };
2175
+ return {
2176
+ ...defaultStyles,
2177
+ '&:hover': {
2178
+ backgroundColor: theme.colors.actionDisabledBackground,
2179
+ borderColor: 'transparent',
2180
+ color: theme.colors.actionDisabledText
2222
2181
  },
2223
- ...(!type && {
2224
- [`&:enabled:not(:hover):not(:active) > ${clsIcon}`]: inactiveIconCss
2225
- }),
2226
- ...(!type && {
2227
- [`&:enabled:not(:hover):not(:active) > ${endIconCssSelector}`]: inactiveIconCss
2228
- }),
2229
- // Disable animations
2230
- [`&[${classNamePrefix}-click-animating-without-extra-node='true']::after`]: {
2231
- display: 'none'
2182
+ '&:active': {
2183
+ backgroundColor: theme.colors.actionDisabledBackground,
2184
+ borderColor: 'transparent',
2185
+ color: theme.colors.actionDisabledText
2186
+ }
2187
+ };
2188
+ }
2189
+ function getDisabledTertiaryStyles(theme) {
2190
+ const defaultStyles = {
2191
+ backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
2192
+ borderColor: 'transparent',
2193
+ color: theme.colors.actionDisabledText
2194
+ };
2195
+ return {
2196
+ ...defaultStyles,
2197
+ '&:hover': {
2198
+ backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
2199
+ borderColor: 'transparent',
2200
+ color: theme.colors.actionDisabledText
2232
2201
  },
2233
- [`&${clsIconOnly}`]: {
2234
- border: 'none',
2235
- [`&:enabled:not(${classLink})`]: {
2236
- ...tertiaryColors,
2237
- color: theme.colors.textSecondary,
2238
- '&:hover > .anticon': {
2239
- color: tertiaryColors['&:hover'].color
2240
- },
2241
- '&:active > .anticon': {
2242
- color: tertiaryColors['&:active'].color
2243
- },
2244
- ...(loading && {
2245
- '&&, &:hover, &:active': {
2246
- backgroundColor: 'transparent'
2247
- }
2248
- })
2249
- },
2250
- [`&:enabled:not(${classLink}) > .anticon`]: {
2251
- color: theme.colors.textSecondary
2252
- },
2253
- ...(isAnchor && {
2254
- lineHeight: `${theme.general.heightSm}px`,
2255
- ...getLinkStyles$1(theme),
2256
- '&:disabled': {
2257
- color: theme.colors.actionDisabledText
2258
- }
2259
- }),
2260
- ...(loading && {
2261
- '&&, &:hover, &:active': {
2262
- backgroundColor: 'transparent'
2202
+ '&:active': {
2203
+ backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
2204
+ borderColor: 'transparent',
2205
+ color: theme.colors.actionDisabledText
2206
+ }
2207
+ };
2208
+ }
2209
+
2210
+ let DesignSystemEventProviderComponentTypes = /*#__PURE__*/function (DesignSystemEventProviderComponentTypes) {
2211
+ DesignSystemEventProviderComponentTypes["Banner"] = "banner";
2212
+ DesignSystemEventProviderComponentTypes["Button"] = "button";
2213
+ DesignSystemEventProviderComponentTypes["Input"] = "input";
2214
+ DesignSystemEventProviderComponentTypes["Modal"] = "modal";
2215
+ return DesignSystemEventProviderComponentTypes;
2216
+ }({});
2217
+ let DesignSystemEventProviderAnalyticsEventTypes = /*#__PURE__*/function (DesignSystemEventProviderAnalyticsEventTypes) {
2218
+ DesignSystemEventProviderAnalyticsEventTypes["OnClick"] = "onClick";
2219
+ DesignSystemEventProviderAnalyticsEventTypes["OnView"] = "onView";
2220
+ DesignSystemEventProviderAnalyticsEventTypes["OnValueChange"] = "onValueChange";
2221
+ return DesignSystemEventProviderAnalyticsEventTypes;
2222
+ }({});
2223
+ const shouldTriggerCallback = (eventType, analyticsEvents) => {
2224
+ return analyticsEvents.includes(eventType);
2225
+ };
2226
+ const DefaultEmptyCallbacks = {
2227
+ callback: () => {}
2228
+ };
2229
+ const DesignSystemEventProviderContext = /*#__PURE__*/React__default.createContext(DefaultEmptyCallbacks);
2230
+
2231
+ /**
2232
+ * This gets the event provider, which is used to pass callbacks to the design system for events such as onClick, onView, and onValueChange.
2233
+ * If the value is undefined, then the expected behavior is to not emit any events.
2234
+ *
2235
+ * @returns DesignSystemEventProviderContextType
2236
+ */
2237
+ const useDesignSystemEventProviderContext = () => {
2238
+ return useContext(DesignSystemEventProviderContext);
2239
+ };
2240
+
2241
+ /**
2242
+ * NOTE: This is not suggested for direct usage from engineers, and should emit your own events.
2243
+ * See https://databricks.atlassian.net/wiki/spaces/UN/pages/2533556277/Usage+Logging+in+UI#Send-usage-logging-from-UI for more details.
2244
+ *
2245
+ * This gets the event provider component event type callbacks.
2246
+ * If context & componentId are not undefined, then it will check if the event is in analyticsEvents or the default analyticsEvents for that component.
2247
+ * If the context or componentId are undefined, then the expected behavior is to not emit any events.
2248
+ *
2249
+ * @returns Object of event callbacks
2250
+ */
2251
+ const useDesignSystemEventComponentCallbacks = _ref => {
2252
+ let {
2253
+ componentType,
2254
+ componentId,
2255
+ analyticsEvents
2256
+ } = _ref;
2257
+ const context = useDesignSystemEventProviderContext();
2258
+ const callbacks = useMemo(() => {
2259
+ if (context === DefaultEmptyCallbacks || componentId === undefined) {
2260
+ return {
2261
+ onClick: () => {},
2262
+ onValueChange: () => {},
2263
+ onView: () => {}
2264
+ };
2265
+ }
2266
+ return {
2267
+ onClick: () => {
2268
+ if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnClick, analyticsEvents)) {
2269
+ context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnClick, componentType, componentId);
2263
2270
  }
2264
- }),
2265
- '&[disabled]:hover': {
2266
- backgroundColor: 'transparent'
2267
- }
2268
- },
2269
- [`&:focus`]: {
2270
- ...(useFocusPseudoClass && {
2271
- outlineStyle: 'solid',
2272
- outlineWidth: '2px',
2273
- outlineOffset: '1px',
2274
- outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
2275
- }),
2276
- [`${clsLoadingIcon}`]: {
2277
- ...(onlyIcon && {
2278
- // Mitigate wrong left offset for loading state with onlyIcon
2279
- left: 0
2280
- })
2281
- }
2282
- },
2283
- ...(forceIconStyles && {
2284
- padding: '0 6px',
2285
- lineHeight: theme.typography.lineHeightSm,
2286
- color: theme.colors.textSecondary,
2287
- ...(loading && {
2288
- '&&, &:hover, &:active': {
2289
- backgroundColor: 'transparent',
2290
- borderColor: theme.colors.actionDefaultBorderDefault
2291
- },
2292
- '&[disabled], &[disabled]:hover, &[disabled]:active': {
2293
- backgroundColor: 'transparent',
2294
- borderColor: 'transparent'
2271
+ },
2272
+ onValueChange: () => {
2273
+ if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnValueChange, analyticsEvents)) {
2274
+ context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnValueChange, componentType, componentId);
2295
2275
  }
2296
- }),
2297
- '& > span': {
2298
- verticalAlign: -1,
2299
- height: theme.general.heightSm / 2,
2300
- width: theme.general.heightSm / 2
2301
2276
  },
2302
- [`& > ${clsLoadingIcon} .anticon`]: {
2303
- // left: `calc(50% - 6px)!important`,
2304
- height: theme.general.heightSm / 2,
2305
- width: theme.general.heightSm / 2,
2306
- padding: 0
2307
- }
2308
- }),
2309
- ...getAnimationCss(enableAnimation)
2310
- };
2311
-
2312
- // Moved outside main style object because state & selector matching in the already existing object keys can create bugs and unwanted overwrites
2313
- const typeStyles = {
2314
- ...(type === 'tertiary' && {
2315
- [`&:enabled:not(${clsIconOnly})`]: tertiaryColors,
2316
- [`&${classLink}[disabled]`]: {
2317
- ...getDisabledTertiaryStyles(theme)
2277
+ onView: () => {
2278
+ if (shouldTriggerCallback(DesignSystemEventProviderAnalyticsEventTypes.OnView, analyticsEvents)) {
2279
+ context.callback(DesignSystemEventProviderAnalyticsEventTypes.OnView, componentType, componentId);
2280
+ }
2318
2281
  }
2319
- })
2320
- };
2321
- const importantStyles = importantify(styles);
2322
- const importantTypeStyles = importantify(typeStyles);
2323
- return /*#__PURE__*/css(importantStyles, importantTypeStyles, process.env.NODE_ENV === "production" ? "" : ";label:getButtonEmotionStyles;");
2282
+ };
2283
+ }, [context, componentType, componentId, analyticsEvents]);
2284
+ return callbacks;
2324
2285
  };
2325
- const Button = /* #__PURE__ */(() => {
2326
- const Button = /*#__PURE__*/forwardRef(function Button( // Keep size out of props passed to AntD to make deprecation and eventual removal have 0 impact
2327
- _ref2, ref) {
2328
- let {
2329
- dangerouslySetAntdProps,
2330
- children,
2331
- size,
2332
- type,
2333
- loading,
2334
- loadingDescription = 'Button',
2335
- endIcon,
2336
- onClick,
2337
- dangerouslySetForceIconStyles,
2338
- dangerouslyUseFocusPseudoClass,
2339
- dangerouslyAppendWrapperCss,
2340
- componentId,
2341
- analyticsEvents,
2342
- ...props
2343
- } = _ref2;
2344
- const {
2345
- theme,
2346
- classNamePrefix
2347
- } = useDesignSystemTheme();
2348
- const {
2349
- USE_FLEX_BUTTON: flexOverride
2350
- } = useDesignSystemFlags();
2351
- const eventContext = useDesignSystemEventComponentCallbacks({
2352
- componentType: DesignSystemEventProviderComponentTypes.Button,
2353
- componentId,
2354
- analyticsEvents: analyticsEvents !== null && analyticsEvents !== void 0 ? analyticsEvents : [DesignSystemEventProviderAnalyticsEventTypes.OnClick]
2355
- });
2356
- const flexSafex = safex('databricks.fe.designsystem.useFlexButtonStyles', false);
2357
- const isFlex = flexOverride || flexSafex;
2358
- const clsEndIcon = getEndIconClsName(theme);
2359
- const loadingCls = `${classNamePrefix}-btn-loading-icon`;
2360
- const buttonRef = useRef(null);
2361
- useImperativeHandle(ref, () => buttonRef.current);
2362
2286
 
2363
- // Needed to keep backwards compatibility and support existing unit tests
2364
- useEffect(() => {
2365
- if (buttonRef.current) {
2366
- if (loading) {
2367
- buttonRef.current.setAttribute('loading', 'true');
2368
- buttonRef.current.classList.add(`${classNamePrefix}-btn-loading`);
2369
- } else {
2370
- buttonRef.current.setAttribute('loading', 'false');
2371
- buttonRef.current.classList.remove(`${classNamePrefix}-btn-loading`);
2372
- }
2373
- }
2374
- }, [loading, classNamePrefix]);
2375
- const iconOnly = Boolean((props.icon || endIcon) && !children);
2376
- const handleClick = event => {
2377
- if (loading) {
2378
- return;
2379
- }
2380
- eventContext.onClick();
2381
- onClick === null || onClick === void 0 || onClick(event);
2287
+ /**
2288
+ * NOTE: This is not suggested for direct usage from engineers, and should use RecordEventContext instead.
2289
+ * See https://databricks.atlassian.net/wiki/spaces/UN/pages/2533556277/Usage+Logging+in+UI#Send-usage-logging-from-UI for more details.
2290
+ *
2291
+ * This is the Design System Event Context Provider, and is only used to pass callbacks to the design system for events such as onClick, onView, and onValueChange.
2292
+ *
2293
+ * @param children Children react elements
2294
+ * @param callback The event callback function
2295
+ * @returns Design System Event Context Provider with the children inside
2296
+ */
2297
+ function DesignSystemEventProvider(_ref2) {
2298
+ let {
2299
+ children,
2300
+ callback
2301
+ } = _ref2;
2302
+ const contextValue = useMemo(() => {
2303
+ return {
2304
+ callback
2382
2305
  };
2383
- const loadingSpinner = jsx(Spinner, {
2384
- className: loadingCls,
2385
- animationDuration: 8,
2386
- inheritColor: true,
2387
- label: "loading",
2388
- "aria-label": "loading",
2389
- loadingDescription: loadingDescription,
2390
- css: /*#__PURE__*/css({
2391
- color: 'inherit !important',
2392
- pointerEvents: 'none',
2393
- ...(!iconOnly && !dangerouslySetForceIconStyles && {
2394
- '.anticon': {
2395
- verticalAlign: '-0.2em'
2396
- }
2397
- }),
2398
- '[aria-hidden="true"]': {
2399
- display: 'inline'
2400
- }
2401
- }, process.env.NODE_ENV === "production" ? "" : ";label:loadingSpinner;")
2402
- });
2403
- return jsx(DesignSystemAntDConfigProvider, {
2404
- children: jsx(Button$1, {
2405
- ...props,
2406
- css: getButtonEmotionStyles({
2407
- theme,
2408
- classNamePrefix,
2409
- loading: Boolean(loading),
2410
- withIcon: Boolean(props.icon),
2411
- onlyIcon: iconOnly,
2412
- isAnchor: Boolean(props.href && !type),
2413
- danger: Boolean(props.danger),
2414
- enableAnimation: theme.options.enableAnimation,
2415
- size: size || 'middle',
2416
- type,
2417
- isFlex,
2418
- forceIconStyles: Boolean(dangerouslySetForceIconStyles),
2419
- useFocusPseudoClass: Boolean(dangerouslyUseFocusPseudoClass)
2420
- }),
2421
- href: props.disabled ? undefined : props.href,
2422
- ...dangerouslySetAntdProps,
2423
- onClick: handleClick,
2424
- icon: loading ? loadingSpinner : props.icon,
2425
- ref: buttonRef,
2426
- type: type === 'tertiary' ? 'link' : type,
2427
- children: children && jsxs("span", {
2428
- style: {
2429
- visibility: loading ? 'hidden' : 'visible',
2430
- ...(isFlex && {
2431
- display: 'inline-flex',
2432
- alignItems: 'center'
2433
- }),
2434
- ...dangerouslyAppendWrapperCss
2435
- },
2436
- children: [children, endIcon && jsx("span", {
2437
- className: clsEndIcon,
2438
- style: {
2439
- ...(isFlex && {
2440
- display: 'inline-flex',
2441
- alignItems: 'center'
2442
- })
2443
- },
2444
- children: endIcon
2445
- })]
2446
- })
2447
- })
2448
- });
2306
+ }, [callback]);
2307
+ return jsx(DesignSystemEventProviderContext.Provider, {
2308
+ value: contextValue,
2309
+ children: children
2449
2310
  });
2311
+ }
2450
2312
 
2451
- // This is needed for other Ant components that wrap Button, such as Tooltip, to correctly
2452
- // identify it as an Ant button.
2453
- // This should be removed if the component is rewritten to no longer be a wrapper around Ant.
2454
- // See: https://github.com/ant-design/ant-design/blob/6dd39c1f89b4d6632e6ed022ff1bc275ca1e0f1f/components/button/button.tsx#L291
2455
- Button.__ANT_BUTTON = true;
2456
- return Button;
2457
- })();
2313
+ // Use Symbol to correctly handled null/undefined as stable values
2314
+ const NOT_INITIALIZED = Symbol('NOT_INITIALIZED');
2458
2315
 
2459
- const {
2460
- Text: AntDText$1
2461
- } = Typography$1;
2462
- function getTextEmotionStyles$1(theme, props) {
2463
- return /*#__PURE__*/css({
2464
- '&&': {
2465
- display: 'block',
2466
- fontSize: theme.typography.fontSizeSm,
2467
- lineHeight: theme.typography.lineHeightSm,
2468
- color: theme.colors.textSecondary,
2469
- ...(props.withoutMargins && {
2470
- '&&': {
2471
- marginTop: 0,
2472
- marginBottom: 0
2473
- }
2474
- })
2475
- }
2476
- }, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
2316
+ /**
2317
+ * Use to keep a stable value on the first mount of a component
2318
+ * that cannot change.
2319
+ */
2320
+ function useStable(valueCallback) {
2321
+ const ref = useRef(NOT_INITIALIZED);
2322
+ if (ref.current === NOT_INITIALIZED) {
2323
+ const val = valueCallback();
2324
+ ref.current = val;
2325
+ return val;
2326
+ }
2327
+ return ref.current;
2477
2328
  }
2478
- function Hint(userProps) {
2479
- const {
2480
- dangerouslySetAntdProps,
2481
- bold,
2482
- withoutMargins,
2483
- color,
2484
- ...props
2485
- } = userProps;
2486
- const {
2487
- theme
2488
- } = useDesignSystemTheme();
2489
- return jsx(DesignSystemAntDConfigProvider, {
2490
- children: jsx(AntDText$1, {
2491
- ...props,
2492
- css: getTextEmotionStyles$1(theme, userProps),
2493
- ...dangerouslySetAntdProps
2494
- })
2495
- });
2329
+ let sequentialCounter = 0;
2330
+ function useStableUid() {
2331
+ return useStable(() => sequentialCounter++);
2496
2332
  }
2497
2333
 
2498
- const getLinkStyles = (theme, clsPrefix) => {
2499
- const classTypography = `.${clsPrefix}-typography`;
2500
- const styles = {
2501
- [`&${classTypography}, &${classTypography}:focus`]: {
2502
- color: theme.colors.actionTertiaryTextDefault
2503
- },
2504
- [`&${classTypography}:hover, &${classTypography}:hover .anticon`]: {
2505
- color: theme.colors.actionTertiaryTextHover,
2506
- textDecoration: 'underline'
2507
- },
2508
- [`&${classTypography}:active, &${classTypography}:active .anticon`]: {
2509
- color: theme.colors.actionTertiaryTextPress,
2510
- textDecoration: 'underline'
2511
- },
2512
- [`&${classTypography}:focus-visible`]: {
2513
- textDecoration: 'underline'
2514
- },
2515
- '.anticon': {
2516
- fontSize: 12,
2517
- verticalAlign: 'baseline'
2334
+ /** Props for UI components that support a "loading" state. */
2335
+
2336
+ /**
2337
+ * A handler for integrating UI components with external latency instrumentation.
2338
+ * If provided via `LoadingStateContext`, hooks will be called whenever child
2339
+ * components in a "loading" state are mounted and unmounted.
2340
+ */
2341
+
2342
+ const LoadingStateContext = /*#__PURE__*/createContext(null);
2343
+ /**
2344
+ * Indicates that the containing component is in a "loading" state, i.e. that the UI
2345
+ * displayed to the user is semantically equivalent to them seeing a spinner or a
2346
+ * loading indicator. This means that the UI is not in its final settled state yet.
2347
+ *
2348
+ * All components that are in a "loading" state should render a `<LoadingState>`
2349
+ * component, preferrably with an appropriate description.
2350
+ *
2351
+ * By itself, `<LoadingState>` doesn't do anything, but if used within `LoadingStateContext`,
2352
+ * it will call the provided `startLoading()`/`endLoading()` hooks when the component
2353
+ * is mounted/unmounted, which can be used to integrate existing latency instrumentation.
2354
+ */
2355
+ const LoadingState = _ref => {
2356
+ let {
2357
+ description = 'Generic UI loading state'
2358
+ } = _ref;
2359
+ const uid = useStableUid();
2360
+ const loadingStateContext = useContext(LoadingStateContext);
2361
+ useLayoutEffect(() => {
2362
+ // mount
2363
+ if (loadingStateContext) {
2364
+ loadingStateContext.startLoading(uid, description);
2518
2365
  }
2519
- };
2520
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getLinkStyles;");
2521
- };
2522
- const getEllipsisNewTabLinkStyles = () => {
2523
- const styles = {
2524
- paddingRight: 'calc(2px + 1em)',
2525
- // 1em for icon
2526
- position: 'relative'
2527
- };
2528
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisNewTabLinkStyles;");
2366
+ return () => {
2367
+ // unmount
2368
+ if (loadingStateContext) {
2369
+ loadingStateContext.endLoading(uid);
2370
+ }
2371
+ };
2372
+ }, [uid, description, loadingStateContext]);
2373
+ return null;
2529
2374
  };
2530
- const getIconStyles = theme => {
2531
- const styles = {
2532
- marginLeft: 2,
2533
- color: theme.colors.actionTertiaryTextDefault
2534
- };
2535
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getIconStyles;");
2536
- };
2537
- const getEllipsisIconStyles = useNewIcons => {
2375
+
2376
+ const rotate = keyframes({
2377
+ '0%': {
2378
+ transform: 'rotate(0deg) translate3d(0, 0, 0)'
2379
+ },
2380
+ '100%': {
2381
+ transform: 'rotate(360deg) translate3d(0, 0, 0)'
2382
+ }
2383
+ });
2384
+ const cssSpinner = function (theme) {
2385
+ let frameRate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
2386
+ let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2387
+ let animationDuration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
2388
+ let inheritColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2538
2389
  const styles = {
2539
- position: 'absolute',
2540
- right: 0,
2541
- bottom: 0,
2542
- top: 0,
2543
- display: 'flex',
2544
- alignItems: 'center',
2545
- ...(useNewIcons && {
2546
- fontSize: 12
2547
- })
2390
+ animation: `${rotate} ${animationDuration}s steps(${frameRate}, end) infinite`,
2391
+ ...(inheritColor ? {
2392
+ color: 'inherit'
2393
+ } : {
2394
+ color: theme.colors.textSecondary
2395
+ }),
2396
+ animationDelay: `${delay}s`,
2397
+ '@media only percy': {
2398
+ animation: 'none'
2399
+ }
2548
2400
  };
2549
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisIconStyles;");
2401
+ return /*#__PURE__*/css(importantify(styles), process.env.NODE_ENV === "production" ? "" : ";label:cssSpinner;");
2550
2402
  };
2551
- const Link = /*#__PURE__*/forwardRef(function Link(_ref, ref) {
2403
+ const Spinner = _ref => {
2552
2404
  let {
2553
- dangerouslySetAntdProps,
2405
+ frameRate,
2406
+ size = 'default',
2407
+ delay,
2408
+ className: propClass,
2409
+ label,
2410
+ animationDuration,
2411
+ inheritColor,
2412
+ loading = true,
2413
+ loadingDescription = 'Spinner',
2554
2414
  ...props
2555
2415
  } = _ref;
2556
2416
  const {
2557
- children,
2558
- openInNewTab,
2559
- ...restProps
2560
- } = props;
2561
- const {
2562
- theme,
2563
- classNamePrefix
2564
- } = useDesignSystemTheme();
2565
- const newTabProps = {
2566
- rel: 'noopener noreferrer',
2567
- target: '_blank'
2568
- };
2569
- const linkProps = openInNewTab ? {
2570
- ...restProps,
2571
- ...newTabProps
2572
- } : {
2573
- ...restProps
2574
- };
2575
- const linkStyles = props.ellipsis && openInNewTab ? [getLinkStyles(theme, classNamePrefix), getEllipsisNewTabLinkStyles()] : getLinkStyles(theme, classNamePrefix);
2576
- const iconStyles = props.ellipsis ? [getIconStyles(theme), getEllipsisIconStyles()] : getIconStyles(theme);
2577
- return jsx(DesignSystemAntDConfigProvider, {
2578
- children: jsxs(Typography$1.Link, {
2579
- "aria-disabled": linkProps.disabled,
2580
- css: linkStyles,
2581
- ref: ref,
2582
- ...linkProps,
2583
- ...dangerouslySetAntdProps,
2584
- children: [children, openInNewTab ? jsx(NewWindowIcon$1, {
2585
- css: iconStyles,
2586
- ...newTabProps
2587
- }) : null]
2588
- })
2589
- });
2590
- });
2591
-
2592
- const {
2593
- Paragraph: AntDParagraph
2594
- } = Typography$1;
2595
- function getParagraphEmotionStyles(theme, props) {
2596
- return /*#__PURE__*/css({
2597
- '&&': {
2598
- fontSize: theme.typography.fontSizeBase,
2599
- fontWeight: theme.typography.typographyRegularFontWeight,
2600
- lineHeight: theme.typography.lineHeightBase,
2601
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
2602
- },
2603
- '& .anticon': {
2604
- verticalAlign: 'text-bottom'
2605
- }
2606
- }, props.disabled && {
2607
- '&&': {
2608
- color: theme.colors.actionDisabledText
2609
- }
2610
- }, props.withoutMargins && {
2611
- '&&': {
2612
- marginTop: 0,
2613
- marginBottom: 0
2614
- }
2615
- }, process.env.NODE_ENV === "production" ? "" : ";label:getParagraphEmotionStyles;");
2616
- }
2617
- function Paragraph(userProps) {
2618
- const {
2619
- dangerouslySetAntdProps,
2620
- withoutMargins,
2621
- color,
2622
- ...props
2623
- } = userProps;
2624
- const {
2417
+ classNamePrefix,
2625
2418
  theme
2626
2419
  } = useDesignSystemTheme();
2627
- return jsx(DesignSystemAntDConfigProvider, {
2628
- children: jsx(AntDParagraph, {
2420
+
2421
+ // We use Antd classes to keep styling unchanged
2422
+ // TODO(FEINF-1407): We want to move away from Antd classes and use Emotion for styling in the future
2423
+ const sizeSuffix = size === 'small' ? '-sm' : size === 'large' ? '-lg' : '';
2424
+ const sizeClass = sizeSuffix ? `${classNamePrefix}-spin${sizeSuffix}` : '';
2425
+ const wrapperClass = `${propClass || ''} ${classNamePrefix}-spin ${sizeClass} ${classNamePrefix}-spin-spinning ${DU_BOIS_ENABLE_ANIMATION_CLASSNAME}`.trim();
2426
+ const className = `${classNamePrefix}-spin-dot ${DU_BOIS_ENABLE_ANIMATION_CLASSNAME}`.trim();
2427
+ return (
2428
+ // className has to follow {...props}, otherwise is `css` prop is passed down it will overwrite our className
2429
+ jsxs("div", {
2629
2430
  ...props,
2630
- className: props.className,
2631
- css: getParagraphEmotionStyles(theme, userProps),
2632
- ...dangerouslySetAntdProps
2431
+ className: wrapperClass,
2432
+ children: [loading && jsx(LoadingState, {
2433
+ description: loadingDescription
2434
+ }), jsx(AccessibleContainer, {
2435
+ label: label,
2436
+ children: jsx(LoadingIcon$1, {
2437
+ "aria-hidden": "false",
2438
+ css: cssSpinner(theme, frameRate, delay, animationDuration, inheritColor),
2439
+ className: className
2440
+ })
2441
+ })]
2633
2442
  })
2634
- });
2443
+ );
2444
+ };
2445
+
2446
+ /**
2447
+ * Provides access to http://go/safex flags from the frontend. Note that this is a temporary
2448
+ * workaround until direct `safex` imports are available.
2449
+ * @param flag The name of the flag to check
2450
+ * @param defaultValue The default value to return if the flag is not set
2451
+ * @returns
2452
+ */
2453
+ const safex = (flag, defaultValue) => {
2454
+ // Catching errors here, because we don't have type-safety to ensure
2455
+ // that `__debug__safex`'s API hasn't changed.
2456
+ try {
2457
+ const globalSafex = window.__debug__safex;
2458
+ return globalSafex ? globalSafex(flag, defaultValue) : defaultValue;
2459
+ } catch (e) {
2460
+ return defaultValue;
2461
+ }
2462
+ };
2463
+
2464
+ function addDebugOutlineIfEnabled() {
2465
+ return safex('databricks.fe.designsystem.showDebugOutline', false) ? {
2466
+ 'data-dubois-show-outline': true
2467
+ } : {};
2635
2468
  }
2636
2469
 
2637
- const {
2638
- Text: AntDText
2639
- } = Typography$1;
2640
- function getTextEmotionStyles(theme, props) {
2641
- return /*#__PURE__*/css({
2642
- '&&': {
2643
- fontSize: theme.typography.fontSizeBase,
2644
- fontWeight: theme.typography.typographyRegularFontWeight,
2645
- lineHeight: theme.typography.lineHeightBase,
2646
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
2647
- }
2648
- }, props.disabled && {
2649
- '&&': {
2650
- color: theme.colors.actionDisabledText
2651
- }
2652
- }, props.hint && {
2653
- '&&': {
2654
- fontSize: theme.typography.fontSizeSm,
2655
- lineHeight: theme.typography.lineHeightSm
2656
- }
2657
- }, props.bold && {
2658
- '&&': {
2659
- fontSize: theme.typography.fontSizeBase,
2660
- fontWeight: theme.typography.typographyBoldFontWeight,
2661
- lineHeight: theme.typography.lineHeightBase
2662
- }
2663
- }, props.code && {
2664
- '&& > code': {
2665
- color: theme.colors.textPrimary,
2666
- fontSize: theme.typography.fontSizeBase,
2667
- lineHeight: theme.typography.lineHeightBase,
2668
- background: theme.colors.typographyCodeBg,
2669
- fontFamily: 'monospace',
2670
- borderRadius: theme.borders.borderRadiusMd,
2671
- padding: '2px 4px',
2672
- border: 'unset',
2673
- margin: 0
2674
- }
2675
- }, props.size && {
2676
- '&&': (() => {
2677
- switch (props.size) {
2678
- case 'xxl':
2679
- return {
2680
- fontSize: theme.typography.fontSizeXxl,
2681
- lineHeight: theme.typography.lineHeightXxl,
2682
- '& .anticon': {
2683
- lineHeight: theme.typography.lineHeightXxl,
2684
- verticalAlign: 'middle'
2685
- }
2686
- };
2687
- case 'xl':
2688
- return {
2689
- fontSize: theme.typography.fontSizeXl,
2690
- lineHeight: theme.typography.lineHeightXl,
2691
- '& .anticon': {
2692
- lineHeight: theme.typography.lineHeightXl,
2693
- verticalAlign: 'middle'
2694
- }
2695
- };
2696
- case 'lg':
2697
- return {
2698
- fontSize: theme.typography.fontSizeLg,
2699
- lineHeight: theme.typography.lineHeightLg,
2700
- '& .anticon': {
2701
- lineHeight: theme.typography.lineHeightLg,
2702
- verticalAlign: 'middle'
2703
- }
2704
- };
2705
- case 'sm':
2706
- return {
2707
- fontSize: theme.typography.fontSizeSm,
2708
- lineHeight: theme.typography.lineHeightSm,
2709
- '& .anticon': {
2710
- verticalAlign: '-0.219em'
2711
- }
2712
- };
2713
- default:
2714
- return {};
2715
- }
2716
- })()
2717
- }, props.withoutMargins && {
2718
- '&&': {
2719
- marginTop: 0,
2720
- marginBottom: 0
2721
- }
2722
- }, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
2470
+ function getEndIconClsName(theme) {
2471
+ return `${theme.general.iconfontCssPrefix}-btn-end-icon`;
2723
2472
  }
2724
- function Text(userProps) {
2725
- // Omit props that are not supported by `antd`
2726
- const {
2727
- dangerouslySetAntdProps,
2728
- bold,
2729
- hint,
2730
- withoutMargins,
2731
- color,
2732
- ...props
2733
- } = userProps;
2734
- const {
2735
- theme
2736
- } = useDesignSystemTheme();
2737
- return jsx(DesignSystemAntDConfigProvider, {
2738
- children: jsx(AntDText, {
2739
- ...props,
2740
- className: props.className,
2741
- css: getTextEmotionStyles(theme, userProps),
2742
- ...dangerouslySetAntdProps
2473
+ const getButtonEmotionStyles = _ref => {
2474
+ let {
2475
+ theme,
2476
+ classNamePrefix,
2477
+ loading,
2478
+ withIcon,
2479
+ onlyIcon,
2480
+ isAnchor,
2481
+ enableAnimation,
2482
+ size,
2483
+ type,
2484
+ isFlex,
2485
+ useFocusPseudoClass,
2486
+ forceIconStyles,
2487
+ danger
2488
+ } = _ref;
2489
+ const clsIcon = `.${theme.general.iconfontCssPrefix}`;
2490
+ const clsEndIcon = `.${getEndIconClsName(theme)}`;
2491
+ const clsLoadingIcon = `.${classNamePrefix}-btn-loading-icon`;
2492
+ const clsIconOnly = `.${classNamePrefix}-btn-icon-only`;
2493
+ const classPrimary = `.${classNamePrefix}-btn-primary`;
2494
+ const classLink = `.${classNamePrefix}-btn-link`;
2495
+ const classDangerous = `.${classNamePrefix}-btn-dangerous`;
2496
+ const SMALL_BUTTON_HEIGHT = 24;
2497
+ const tertiaryColors = {
2498
+ background: theme.colors.actionTertiaryBackgroundDefault,
2499
+ color: theme.colors.actionTertiaryTextDefault,
2500
+ '&:hover': {
2501
+ background: theme.colors.actionTertiaryBackgroundHover,
2502
+ color: theme.colors.actionTertiaryTextHover
2503
+ },
2504
+ '&:active': {
2505
+ background: theme.colors.actionTertiaryBackgroundPress,
2506
+ color: theme.colors.actionTertiaryTextPress
2507
+ }
2508
+ };
2509
+ const iconCss = {
2510
+ fontSize: theme.general.iconFontSize,
2511
+ ...(!isFlex && {
2512
+ // verticalAlign used by AntD to move icon and label to center
2513
+ // TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
2514
+ // behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
2515
+ verticalAlign: -4,
2516
+ ...(onlyIcon && {
2517
+ verticalAlign: -3
2518
+ }),
2519
+ // verticalAlign used by AntD to move icon and label to center
2520
+ // TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
2521
+ // behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
2522
+ // Need to make sure not to apply this to regular buttons as it will offset the icons
2523
+ ...(!onlyIcon && {
2524
+ verticalAlign: -3
2525
+ })
2526
+ }),
2527
+ lineHeight: 0,
2528
+ ...(size === 'small' && {
2529
+ lineHeight: theme.typography.lineHeightSm,
2530
+ ...((onlyIcon || forceIconStyles) && {
2531
+ fontSize: 16,
2532
+ ...(isFlex && {
2533
+ height: 16
2534
+ })
2535
+ })
2743
2536
  })
2744
- });
2745
- }
2746
-
2747
- const {
2748
- Title: AntDTitle
2749
- } = Typography$1;
2750
- function getLevelStyles(theme, props) {
2751
- switch (props.level) {
2752
- case 1:
2753
- return /*#__PURE__*/css({
2754
- '&&': {
2755
- fontSize: theme.typography.fontSizeXxl,
2756
- lineHeight: theme.typography.lineHeightXxl,
2757
- fontWeight: theme.typography.typographyBoldFontWeight
2758
- },
2759
- '& > .anticon': {
2760
- lineHeight: theme.typography.lineHeightXxl
2537
+ };
2538
+ const inactiveIconCss = {
2539
+ color: theme.colors.textSecondary
2540
+ };
2541
+ const endIconCssSelector = `span > ${clsEndIcon} > ${clsIcon}`;
2542
+ const styles = {
2543
+ lineHeight: theme.typography.lineHeightBase,
2544
+ boxShadow: 'none',
2545
+ height: theme.general.heightSm,
2546
+ ...(isFlex && {
2547
+ display: 'inline-flex',
2548
+ alignItems: 'center',
2549
+ justifyContent: 'center',
2550
+ verticalAlign: 'middle'
2551
+ }),
2552
+ ...(!onlyIcon && !forceIconStyles && {
2553
+ '&&': {
2554
+ padding: '4px 12px',
2555
+ ...(size === 'small' && {
2556
+ padding: '0 8px'
2557
+ })
2558
+ }
2559
+ }),
2560
+ ...((onlyIcon || forceIconStyles) && {
2561
+ width: theme.general.heightSm
2562
+ }),
2563
+ ...(size === 'small' && {
2564
+ height: SMALL_BUTTON_HEIGHT,
2565
+ lineHeight: theme.typography.lineHeightBase,
2566
+ ...((onlyIcon || forceIconStyles) && {
2567
+ width: SMALL_BUTTON_HEIGHT,
2568
+ paddingTop: 0,
2569
+ paddingBottom: 0,
2570
+ verticalAlign: 'middle'
2571
+ })
2572
+ }),
2573
+ '&:focus-visible': {
2574
+ outlineStyle: 'solid',
2575
+ outlineWidth: '2px',
2576
+ outlineOffset: '1px',
2577
+ outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
2578
+ },
2579
+ ...getDefaultStyles(theme, loading),
2580
+ [`&${classPrimary}`]: {
2581
+ ...getPrimaryStyles(theme)
2582
+ },
2583
+ [`&${classLink}`]: {
2584
+ ...getLinkStyles(theme),
2585
+ ...(type === 'link' && {
2586
+ padding: 'unset',
2587
+ height: 'auto',
2588
+ border: 'none',
2589
+ boxShadow: 'none',
2590
+ '&[disabled],&:hover': {
2591
+ background: 'none'
2761
2592
  }
2762
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
2763
- case 2:
2764
- return /*#__PURE__*/css({
2765
- '&&': {
2766
- fontSize: theme.typography.fontSizeXl,
2767
- lineHeight: theme.typography.lineHeightXl,
2768
- fontWeight: theme.typography.typographyBoldFontWeight
2593
+ })
2594
+ },
2595
+ [`&${classDangerous}${classPrimary}`]: {
2596
+ ...getPrimaryDangerStyles(theme)
2597
+ },
2598
+ [`&${classDangerous}`]: {
2599
+ ...getSecondaryDangerStyles(theme)
2600
+ },
2601
+ [`&[disabled], &${classDangerous}:disabled`]: {
2602
+ ...getDisabledStyles(theme),
2603
+ ...((onlyIcon || forceIconStyles) && {
2604
+ backgroundColor: 'transparent',
2605
+ '&:hover': {
2606
+ backgroundColor: 'transparent'
2769
2607
  },
2770
- '& > .anticon': {
2771
- lineHeight: theme.typography.lineHeightXl
2608
+ '&:active': {
2609
+ backgroundColor: 'transparent'
2772
2610
  }
2773
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
2774
- case 3:
2775
- return /*#__PURE__*/css({
2776
- '&&': {
2777
- fontSize: theme.typography.fontSizeLg,
2778
- lineHeight: theme.typography.lineHeightLg,
2779
- fontWeight: theme.typography.typographyBoldFontWeight
2611
+ })
2612
+ },
2613
+ [clsLoadingIcon]: {
2614
+ display: 'none'
2615
+ },
2616
+ // Loading styles
2617
+ ...(loading && {
2618
+ '::before': {
2619
+ opacity: 0
2620
+ },
2621
+ cursor: 'default',
2622
+ [`${clsLoadingIcon}`]: {
2623
+ ...(onlyIcon ? {
2624
+ // In case of only icon, the icon is already centered but vertically not aligned, this fixes that
2625
+ verticalAlign: 'middle'
2626
+ } : {
2627
+ // Position loading indicator in center
2628
+ // This would break vertical centering of loading circle when onlyIcon is true
2629
+ position: 'absolute'
2630
+ }),
2631
+ ...(!isFlex && !forceIconStyles && {
2632
+ // Normally we'd do `transform: translateX(-50%)` but `antd` crushes that with injected inline `style`.
2633
+ left: 'calc(50% - 7px)'
2634
+ }),
2635
+ // Re-enable animation for the loading spinner, since it can be disabled by the global animation CSS.
2636
+ svg: {
2637
+ animationDuration: '1s !important'
2638
+ }
2639
+ },
2640
+ [`& > ${clsLoadingIcon} .anticon`]: {
2641
+ paddingRight: 0 // to horizontally center icon
2642
+ },
2643
+
2644
+ [`> :not(${clsLoadingIcon})`]: {
2645
+ // Hide all content except loading icon
2646
+ opacity: 0,
2647
+ visibility: 'hidden',
2648
+ // Add horizontal space for icon
2649
+ ...(withIcon && {
2650
+ paddingLeft: theme.general.iconFontSize + theme.spacing.xs
2651
+ })
2652
+ }
2653
+ }),
2654
+ // Icon styles
2655
+ [`> ${clsIcon} + span, > span + ${clsIcon}`]: {
2656
+ marginRight: 0,
2657
+ marginLeft: theme.spacing.xs
2658
+ },
2659
+ [`> ${clsIcon}`]: iconCss,
2660
+ [`> ${endIconCssSelector}`]: {
2661
+ ...iconCss,
2662
+ marginLeft: theme.spacing.sm
2663
+ },
2664
+ ...(!type && !danger && {
2665
+ [`&:enabled:not(:hover):not(:active) > ${clsIcon}`]: inactiveIconCss
2666
+ }),
2667
+ ...(!type && !danger && {
2668
+ [`&:enabled:not(:hover):not(:active) > ${endIconCssSelector}`]: inactiveIconCss
2669
+ }),
2670
+ // Disable animations
2671
+ [`&[${classNamePrefix}-click-animating-without-extra-node='true']::after`]: {
2672
+ display: 'none'
2673
+ },
2674
+ [`&${clsIconOnly}`]: {
2675
+ border: 'none',
2676
+ [`&:enabled:not(${classLink})`]: {
2677
+ ...tertiaryColors,
2678
+ color: theme.colors.textSecondary,
2679
+ '&:hover > .anticon': {
2680
+ color: tertiaryColors['&:hover'].color,
2681
+ ...(danger && {
2682
+ color: theme.colors.actionDangerDefaultTextHover
2683
+ })
2780
2684
  },
2781
- '& > .anticon': {
2782
- lineHeight: theme.typography.lineHeightLg
2685
+ '&:active > .anticon': {
2686
+ color: tertiaryColors['&:active'].color,
2687
+ ...(danger && {
2688
+ color: theme.colors.actionDangerDefaultTextPress
2689
+ })
2690
+ },
2691
+ ...(loading && {
2692
+ '&&, &:hover, &:active': {
2693
+ backgroundColor: 'transparent'
2694
+ }
2695
+ })
2696
+ },
2697
+ [`&:enabled:not(${classLink}) > .anticon`]: {
2698
+ color: theme.colors.textSecondary,
2699
+ ...(danger && {
2700
+ color: theme.colors.actionDangerDefaultTextDefault
2701
+ })
2702
+ },
2703
+ ...(isAnchor && {
2704
+ lineHeight: `${theme.general.heightSm}px`,
2705
+ ...getLinkStyles(theme),
2706
+ '&:disabled': {
2707
+ color: theme.colors.actionDisabledText
2783
2708
  }
2784
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
2785
- case 4:
2786
- default:
2787
- return /*#__PURE__*/css({
2788
- '&&': {
2789
- fontSize: theme.typography.fontSizeMd,
2790
- lineHeight: theme.typography.lineHeightMd,
2791
- fontWeight: theme.typography.typographyBoldFontWeight
2709
+ }),
2710
+ ...(loading && {
2711
+ '&&, &:hover, &:active': {
2712
+ backgroundColor: 'transparent'
2713
+ }
2714
+ }),
2715
+ '&[disabled]:hover': {
2716
+ backgroundColor: 'transparent'
2717
+ }
2718
+ },
2719
+ [`&:focus`]: {
2720
+ ...(useFocusPseudoClass && {
2721
+ outlineStyle: 'solid',
2722
+ outlineWidth: '2px',
2723
+ outlineOffset: '1px',
2724
+ outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
2725
+ }),
2726
+ [`${clsLoadingIcon}`]: {
2727
+ ...(onlyIcon && {
2728
+ // Mitigate wrong left offset for loading state with onlyIcon
2729
+ left: 0
2730
+ })
2731
+ }
2732
+ },
2733
+ ...(forceIconStyles && {
2734
+ padding: '0 6px',
2735
+ lineHeight: theme.typography.lineHeightSm,
2736
+ color: theme.colors.textSecondary,
2737
+ ...(loading && {
2738
+ '&&, &:hover, &:active': {
2739
+ backgroundColor: 'transparent',
2740
+ borderColor: theme.colors.actionDefaultBorderDefault
2792
2741
  },
2793
- '& > .anticon': {
2794
- lineHeight: theme.typography.lineHeightMd
2742
+ '&[disabled], &[disabled]:hover, &[disabled]:active': {
2743
+ backgroundColor: 'transparent',
2744
+ borderColor: 'transparent'
2795
2745
  }
2796
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
2797
- }
2798
- }
2799
- function getTitleEmotionStyles(theme, props) {
2800
- return /*#__PURE__*/css(getLevelStyles(theme, props), {
2801
- '&&': {
2802
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
2803
- },
2804
- '& > .anticon': {
2805
- verticalAlign: 'middle'
2806
- }
2807
- }, props.withoutMargins && {
2808
- '&&': {
2809
- marginTop: '0 !important',
2810
- // override general styling
2811
- marginBottom: '0 !important' // override general styling
2812
- }
2813
- }, process.env.NODE_ENV === "production" ? "" : ";label:getTitleEmotionStyles;");
2814
- }
2815
- function Title(userProps) {
2816
- const {
2817
- dangerouslySetAntdProps,
2818
- withoutMargins,
2819
- color,
2820
- ...props
2821
- } = userProps;
2822
- const {
2823
- theme
2824
- } = useDesignSystemTheme();
2825
- return jsx(DesignSystemAntDConfigProvider, {
2826
- children: jsx(AntDTitle, {
2827
- ...props,
2828
- className: props.className,
2829
- css: getTitleEmotionStyles(theme, userProps),
2830
- ...dangerouslySetAntdProps
2831
- })
2832
- });
2833
- }
2746
+ }),
2747
+ '& > span': {
2748
+ verticalAlign: -1,
2749
+ height: theme.general.heightSm / 2,
2750
+ width: theme.general.heightSm / 2
2751
+ },
2752
+ [`& > ${clsLoadingIcon} .anticon`]: {
2753
+ // left: `calc(50% - 6px)!important`,
2754
+ height: theme.general.heightSm / 2,
2755
+ width: theme.general.heightSm / 2,
2756
+ padding: 0
2757
+ }
2758
+ }),
2759
+ ...getAnimationCss(enableAnimation)
2760
+ };
2834
2761
 
2835
- const Typography = /* #__PURE__ */(() => {
2836
- function Typography(_ref) {
2762
+ // Moved outside main style object because state & selector matching in the already existing object keys can create bugs and unwanted overwrites
2763
+ const typeStyles = {
2764
+ ...(type === 'tertiary' && {
2765
+ [`&:enabled:not(${clsIconOnly})`]: tertiaryColors,
2766
+ [`&${classLink}[disabled]`]: {
2767
+ ...getDisabledTertiaryStyles(theme)
2768
+ }
2769
+ })
2770
+ };
2771
+ const importantStyles = importantify(styles);
2772
+ const importantTypeStyles = importantify(typeStyles);
2773
+ return /*#__PURE__*/css(importantStyles, importantTypeStyles, process.env.NODE_ENV === "production" ? "" : ";label:getButtonEmotionStyles;");
2774
+ };
2775
+ const Button = /* #__PURE__ */(() => {
2776
+ const Button = /*#__PURE__*/forwardRef(function Button( // Keep size out of props passed to AntD to make deprecation and eventual removal have 0 impact
2777
+ _ref2, ref) {
2837
2778
  let {
2838
2779
  dangerouslySetAntdProps,
2780
+ children,
2781
+ size,
2782
+ type,
2783
+ loading,
2784
+ loadingDescription = 'Button',
2785
+ endIcon,
2786
+ onClick,
2787
+ dangerouslySetForceIconStyles,
2788
+ dangerouslyUseFocusPseudoClass,
2789
+ dangerouslyAppendWrapperCss,
2790
+ componentId,
2791
+ analyticsEvents,
2839
2792
  ...props
2840
- } = _ref;
2793
+ } = _ref2;
2794
+ const {
2795
+ theme,
2796
+ classNamePrefix
2797
+ } = useDesignSystemTheme();
2798
+ const {
2799
+ USE_FLEX_BUTTON: flexOverride
2800
+ } = useDesignSystemFlags();
2801
+ const eventContext = useDesignSystemEventComponentCallbacks({
2802
+ componentType: DesignSystemEventProviderComponentTypes.Button,
2803
+ componentId,
2804
+ analyticsEvents: analyticsEvents !== null && analyticsEvents !== void 0 ? analyticsEvents : [DesignSystemEventProviderAnalyticsEventTypes.OnClick]
2805
+ });
2806
+ const flexSafex = safex('databricks.fe.designsystem.useFlexButtonStyles', false);
2807
+ const isFlex = flexOverride || flexSafex;
2808
+ const clsEndIcon = getEndIconClsName(theme);
2809
+ const loadingCls = `${classNamePrefix}-btn-loading-icon`;
2810
+ const buttonRef = useRef(null);
2811
+ useImperativeHandle(ref, () => buttonRef.current);
2812
+
2813
+ // Needed to keep backwards compatibility and support existing unit tests
2814
+ useEffect(() => {
2815
+ if (buttonRef.current) {
2816
+ if (loading) {
2817
+ buttonRef.current.setAttribute('loading', 'true');
2818
+ buttonRef.current.classList.add(`${classNamePrefix}-btn-loading`);
2819
+ } else {
2820
+ buttonRef.current.setAttribute('loading', 'false');
2821
+ buttonRef.current.classList.remove(`${classNamePrefix}-btn-loading`);
2822
+ }
2823
+ }
2824
+ }, [loading, classNamePrefix]);
2825
+ const iconOnly = Boolean((props.icon || endIcon) && !children);
2826
+ const handleClick = event => {
2827
+ if (loading) {
2828
+ return;
2829
+ }
2830
+ eventContext.onClick();
2831
+ onClick === null || onClick === void 0 || onClick(event);
2832
+ };
2833
+ const loadingSpinner = jsx(Spinner, {
2834
+ className: loadingCls,
2835
+ animationDuration: 8,
2836
+ inheritColor: true,
2837
+ label: "loading",
2838
+ "aria-label": "loading",
2839
+ loadingDescription: loadingDescription,
2840
+ css: /*#__PURE__*/css({
2841
+ color: 'inherit !important',
2842
+ pointerEvents: 'none',
2843
+ ...(!iconOnly && !dangerouslySetForceIconStyles && {
2844
+ '.anticon': {
2845
+ verticalAlign: '-0.2em'
2846
+ }
2847
+ }),
2848
+ '[aria-hidden="true"]': {
2849
+ display: 'inline'
2850
+ }
2851
+ }, process.env.NODE_ENV === "production" ? "" : ";label:loadingSpinner;")
2852
+ });
2841
2853
  return jsx(DesignSystemAntDConfigProvider, {
2842
- children: jsx(Typography$1, {
2854
+ children: jsx(Button$1, {
2855
+ ...addDebugOutlineIfEnabled(),
2843
2856
  ...props,
2844
- ...dangerouslySetAntdProps
2857
+ css: getButtonEmotionStyles({
2858
+ theme,
2859
+ classNamePrefix,
2860
+ loading: Boolean(loading),
2861
+ withIcon: Boolean(props.icon),
2862
+ onlyIcon: iconOnly,
2863
+ isAnchor: Boolean(props.href && !type),
2864
+ danger: Boolean(props.danger),
2865
+ enableAnimation: theme.options.enableAnimation,
2866
+ size: size || 'middle',
2867
+ type,
2868
+ isFlex,
2869
+ forceIconStyles: Boolean(dangerouslySetForceIconStyles),
2870
+ useFocusPseudoClass: Boolean(dangerouslyUseFocusPseudoClass)
2871
+ }),
2872
+ href: props.disabled ? undefined : props.href,
2873
+ ...dangerouslySetAntdProps,
2874
+ onClick: handleClick,
2875
+ icon: loading ? loadingSpinner : props.icon,
2876
+ ref: buttonRef,
2877
+ type: type === 'tertiary' ? 'link' : type,
2878
+ children: children && jsxs("span", {
2879
+ style: {
2880
+ visibility: loading ? 'hidden' : 'visible',
2881
+ ...(isFlex && {
2882
+ display: 'inline-flex',
2883
+ alignItems: 'center'
2884
+ }),
2885
+ ...dangerouslyAppendWrapperCss
2886
+ },
2887
+ children: [children, endIcon && jsx("span", {
2888
+ className: clsEndIcon,
2889
+ style: {
2890
+ ...(isFlex && {
2891
+ display: 'inline-flex',
2892
+ alignItems: 'center'
2893
+ })
2894
+ },
2895
+ children: endIcon
2896
+ })]
2897
+ })
2845
2898
  })
2846
2899
  });
2847
- }
2848
- Typography.Text = Text;
2849
- Typography.Title = Title;
2850
- Typography.Paragraph = Paragraph;
2851
- Typography.Link = Link;
2852
- Typography.Hint = Hint;
2853
- return Typography;
2854
- })();
2855
-
2856
- const Tooltip = _ref => {
2857
- let {
2858
- children,
2859
- title,
2860
- placement = 'top',
2861
- dataTestId,
2862
- dangerouslySetAntdProps,
2863
- silenceScreenReader = false,
2864
- useAsLabel = false,
2865
- ...props
2866
- } = _ref;
2867
- const {
2868
- theme
2869
- } = useDesignSystemTheme();
2870
- const id = useUniqueId('dubois-tooltip-component-');
2871
- if (!title) {
2872
- return jsx(React__default.Fragment, {
2873
- children: children
2874
- });
2875
- }
2876
- const titleProps = silenceScreenReader ? {} : {
2877
- 'aria-live': 'polite',
2878
- 'aria-relevant': 'additions'
2879
- };
2880
- if (dataTestId) {
2881
- // TODO FEINF-1337 - this should turn into data-testid
2882
- titleProps['data-test-id'] = dataTestId;
2883
- }
2884
- const liveTitle = title && /*#__PURE__*/React__default.isValidElement(title) ? /*#__PURE__*/React__default.cloneElement(title, titleProps) : jsx("span", {
2885
- ...titleProps,
2886
- children: title
2887
- });
2888
- const ariaProps = {
2889
- [useAsLabel ? 'aria-labelledby' : 'aria-describedby']: id,
2890
- 'aria-hidden': false
2891
- };
2892
- const childWithProps = /*#__PURE__*/React__default.isValidElement(children) ? /*#__PURE__*/React__default.cloneElement(children, {
2893
- ...ariaProps,
2894
- ...children.props
2895
- }) : _isNil(children) ? children : jsx("span", {
2896
- ...ariaProps,
2897
- children: children
2898
- });
2899
- const {
2900
- overlayInnerStyle,
2901
- overlayStyle,
2902
- ...delegatedDangerouslySetAntdProps
2903
- } = dangerouslySetAntdProps || {};
2904
- return jsx(DesignSystemAntDConfigProvider, {
2905
- children: jsx(Tooltip$1, {
2906
- id: id,
2907
- title: liveTitle,
2908
- placement: placement
2909
- // Always trigger on hover and focus
2910
- ,
2911
- trigger: ['hover', 'focus'],
2912
- overlayInnerStyle: {
2913
- backgroundColor: '#2F3941',
2914
- lineHeight: '22px',
2915
- padding: '4px 8px',
2916
- boxShadow: theme.general.shadowLow,
2917
- ...overlayInnerStyle,
2918
- ...getDarkModePortalStyles(theme)
2919
- },
2920
- overlayStyle: {
2921
- zIndex: theme.options.zIndexBase + 70,
2922
- ...overlayStyle
2923
- },
2924
- css: /*#__PURE__*/css({
2925
- ...getAnimationCss(theme.options.enableAnimation)
2926
- }, process.env.NODE_ENV === "production" ? "" : ";label:Tooltip;"),
2927
- ...delegatedDangerouslySetAntdProps,
2928
- ...props,
2929
- children: childWithProps
2930
- })
2931
2900
  });
2932
- };
2901
+
2902
+ // This is needed for other Ant components that wrap Button, such as Tooltip, to correctly
2903
+ // identify it as an Ant button.
2904
+ // This should be removed if the component is rewritten to no longer be a wrapper around Ant.
2905
+ // See: https://github.com/ant-design/ant-design/blob/6dd39c1f89b4d6632e6ed022ff1bc275ca1e0f1f/components/button/button.tsx#L291
2906
+ Button.__ANT_BUTTON = true;
2907
+ return Button;
2908
+ })();
2933
2909
 
2934
2910
  const getInputGroupStyling = (clsPrefix, theme) => {
2935
2911
  const inputClass = `.${clsPrefix}-input`;
@@ -2944,6 +2920,9 @@ const getInputGroupStyling = (clsPrefix, theme) => {
2944
2920
  '&:hover': {
2945
2921
  borderRight: `1px solid ${theme.colors.actionDisabledText} !important`
2946
2922
  }
2923
+ },
2924
+ '&[data-validation]': {
2925
+ marginRight: 0
2947
2926
  }
2948
2927
  },
2949
2928
  [`& > ${buttonClass} > span`]: {
@@ -2954,7 +2933,7 @@ const getInputGroupStyling = (clsPrefix, theme) => {
2954
2933
  }
2955
2934
  }, process.env.NODE_ENV === "production" ? "" : ";label:getInputGroupStyling;");
2956
2935
  };
2957
- const Group$1 = _ref => {
2936
+ const Group = _ref => {
2958
2937
  let {
2959
2938
  dangerouslySetAntdProps,
2960
2939
  dangerouslyAppendEmotionCSS,
@@ -2975,10 +2954,45 @@ const Group$1 = _ref => {
2975
2954
  });
2976
2955
  };
2977
2956
 
2978
- const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
2957
+ /**
2958
+ * A React custom hook that allows a callback function to be executed exactly once until it is explicitly reset.
2959
+ *
2960
+ * Usage:
2961
+ *
2962
+ * const originalCallback = () => { console.log('originalCallback'); }
2963
+ * const { callbackOnceUntilReset, reset } = useCallbackOnceUntilReset(originalCallback);
2964
+ *
2965
+ * // To execute the callback
2966
+ * callbackOnceUntilReset(); // Prints 'originalCallback'
2967
+ * callbackOnceUntilReset(); // No effect for further calls
2968
+ * reset();
2969
+ * callbackOnceUntilReset(); // Prints 'originalCallback' again
2970
+ */
2971
+ const useCallbackOnceUntilReset = callback => {
2972
+ const canTriggerRef = useRef(true);
2973
+ const reset = useCallback(() => {
2974
+ canTriggerRef.current = true;
2975
+ }, []);
2976
+ const callbackOnceUntilReset = useCallback(() => {
2977
+ if (canTriggerRef.current) {
2978
+ callback();
2979
+ canTriggerRef.current = false;
2980
+ }
2981
+ }, [callback]);
2982
+ return {
2983
+ callbackOnceUntilReset,
2984
+ reset
2985
+ };
2986
+ };
2987
+
2988
+ const getInputStyles = (clsPrefix, theme, _ref, _ref2) => {
2979
2989
  let {
2980
2990
  validationState
2981
2991
  } = _ref;
2992
+ let {
2993
+ useTransparent = false,
2994
+ useFocusWithin = false
2995
+ } = _ref2;
2982
2996
  const inputClass = `.${clsPrefix}-input`;
2983
2997
  const affixClass = `.${clsPrefix}-input-affix-wrapper`;
2984
2998
  const affixClassFocused = `.${clsPrefix}-input-affix-wrapper-focused`;
@@ -2986,6 +3000,7 @@ const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
2986
3000
  const prefixIcon = `.${clsPrefix}-input-prefix`;
2987
3001
  const suffixIcon = `.${clsPrefix}-input-suffix`;
2988
3002
  const validationColor = getValidationStateColor(theme, validationState);
3003
+ const focusSpecifier = useFocusWithin ? 'focus-within' : 'focus';
2989
3004
  const styles = {
2990
3005
  '&&': {
2991
3006
  lineHeight: theme.typography.lineHeightBase,
@@ -2996,7 +3011,7 @@ const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
2996
3011
  '&:hover': {
2997
3012
  borderColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundHover
2998
3013
  },
2999
- '&:focus': {
3014
+ [`&:${focusSpecifier}`]: {
3000
3015
  outlineColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundDefault,
3001
3016
  outlineWidth: 2,
3002
3017
  outlineOffset: -2,
@@ -3037,7 +3052,7 @@ const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
3037
3052
  },
3038
3053
  [`&${affixClassFocused}`]: {
3039
3054
  boxShadow: 'none',
3040
- '&&, &:focus': {
3055
+ [`&&, &:${focusSpecifier}`]: {
3041
3056
  outlineColor: theme.colors.actionPrimaryBackgroundDefault,
3042
3057
  outlineWidth: 2,
3043
3058
  outlineOffset: -2,
@@ -3059,9 +3074,20 @@ const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
3059
3074
  },
3060
3075
  ...getAnimationCss(theme.options.enableAnimation)
3061
3076
  };
3077
+ return styles;
3078
+ };
3079
+ const getInputEmotionStyles = (clsPrefix, theme, _ref3, useTransparent) => {
3080
+ let {
3081
+ validationState
3082
+ } = _ref3;
3083
+ const styles = getInputStyles(clsPrefix, theme, {
3084
+ validationState
3085
+ }, {
3086
+ useTransparent
3087
+ });
3062
3088
  return /*#__PURE__*/css(importantify(styles), process.env.NODE_ENV === "production" ? "" : ";label:getInputEmotionStyles;");
3063
3089
  };
3064
- const Input$1 = /*#__PURE__*/forwardRef(function Input(_ref2, ref) {
3090
+ const Input$1 = /*#__PURE__*/forwardRef(function Input(_ref4, ref) {
3065
3091
  let {
3066
3092
  validationState,
3067
3093
  autoComplete = 'off',
@@ -3069,14 +3095,29 @@ const Input$1 = /*#__PURE__*/forwardRef(function Input(_ref2, ref) {
3069
3095
  dangerouslyAppendEmotionCSS,
3070
3096
  onChange,
3071
3097
  onClear,
3098
+ onFocus,
3099
+ componentId,
3100
+ analyticsEvents,
3072
3101
  ...props
3073
- } = _ref2;
3102
+ } = _ref4;
3074
3103
  const {
3075
3104
  classNamePrefix,
3076
3105
  theme
3077
3106
  } = useDesignSystemTheme();
3078
3107
  const useTransparent = safex('databricks.fe.designsystem.useTransparentInput', false);
3108
+ const eventContext = useDesignSystemEventComponentCallbacks({
3109
+ componentType: DesignSystemEventProviderComponentTypes.Input,
3110
+ componentId,
3111
+ analyticsEvents: analyticsEvents !== null && analyticsEvents !== void 0 ? analyticsEvents : [DesignSystemEventProviderAnalyticsEventTypes.OnValueChange]
3112
+ });
3113
+
3114
+ // Prevents multiple onValueChange triggers until after a focus event resets it.
3115
+ const {
3116
+ callbackOnceUntilReset: sendAnalyticsEventOncePerFocus,
3117
+ reset: resetSendAnalyticsEventOnFocus
3118
+ } = useCallbackOnceUntilReset(eventContext.onValueChange);
3079
3119
  const handleChange = e => {
3120
+ sendAnalyticsEventOncePerFocus();
3080
3121
  // If the input is cleared, call the onClear handler, but only
3081
3122
  // if the event is not an input event -- which is the case when you click the
3082
3123
  // ant-provided (X) button.
@@ -3086,14 +3127,20 @@ const Input$1 = /*#__PURE__*/forwardRef(function Input(_ref2, ref) {
3086
3127
  onChange === null || onChange === void 0 || onChange(e);
3087
3128
  }
3088
3129
  };
3130
+ const handleFocus = e => {
3131
+ resetSendAnalyticsEventOnFocus();
3132
+ onFocus === null || onFocus === void 0 || onFocus(e);
3133
+ };
3089
3134
  return jsx(DesignSystemAntDConfigProvider, {
3090
3135
  children: jsx(Input$2, {
3091
3136
  autoComplete: autoComplete,
3137
+ "data-validation": validationState,
3092
3138
  ref: ref,
3093
3139
  css: [getInputEmotionStyles(classNamePrefix, theme, {
3094
3140
  validationState
3095
3141
  }, useTransparent), dangerouslyAppendEmotionCSS, process.env.NODE_ENV === "production" ? "" : ";label:Input;"],
3096
3142
  onChange: handleChange,
3143
+ onFocus: handleFocus,
3097
3144
  ...props,
3098
3145
  ...dangerouslySetAntdProps
3099
3146
  })
@@ -3157,483 +3204,331 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(_ref, ref) {
3157
3204
  const InputNamespace = /* #__PURE__ */Object.assign(Input$1, {
3158
3205
  TextArea,
3159
3206
  Password,
3160
- Group: Group$1
3207
+ Group
3161
3208
  });
3162
3209
  const Input = InputNamespace;
3163
3210
 
3164
- const Root = DropdownMenu$1.Root; // Behavioral component only
3165
-
3166
- const Content = /*#__PURE__*/forwardRef(function Content(_ref, ref) {
3211
+ function Stepper(_ref) {
3167
3212
  let {
3168
- children,
3169
- minWidth = 220,
3170
- isInsideModal,
3171
- onEscapeKeyDown,
3172
- onKeyDown,
3173
- ...props
3213
+ direction: requestedDirection,
3214
+ currentStepIndex: currentStep,
3215
+ steps,
3216
+ localizeStepNumber,
3217
+ responsive = true
3174
3218
  } = _ref;
3175
3219
  const {
3176
- getPopupContainer
3177
- } = useDesignSystemContext();
3178
- return jsx(DropdownMenu$1.Portal, {
3179
- container: getPopupContainer && getPopupContainer(),
3180
- children: jsx(DropdownMenu$1.Content, {
3181
- ref: ref,
3182
- loop: true,
3183
- css: [contentStyles, {
3184
- minWidth
3185
- }, process.env.NODE_ENV === "production" ? "" : ";label:Content;"],
3186
- sideOffset: 4,
3187
- align: "start",
3188
- onKeyDown: e => {
3189
- // This is a workaround for Radix's DropdownMenu.Content not receiving Escape key events
3190
- // when nested inside a modal. We need to stop propagation of the event so that the modal
3191
- // doesn't close when the DropdownMenu should.
3192
- if (e.key === 'Escape') {
3193
- if (isInsideModal) {
3194
- e.stopPropagation();
3195
- }
3196
- onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(e.nativeEvent);
3197
- }
3198
- onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
3199
- },
3200
- ...props,
3201
- children: children
3202
- })
3203
- });
3204
- });
3205
- const SubContent = /*#__PURE__*/forwardRef(function Content(_ref2, ref) {
3206
- let {
3207
- children,
3208
- minWidth = 220,
3209
- ...props
3210
- } = _ref2;
3220
+ theme
3221
+ } = useDesignSystemTheme();
3222
+ const ref = useRef(null);
3211
3223
  const {
3212
- getPopupContainer
3213
- } = useDesignSystemContext();
3214
- return jsx(DropdownMenu$1.Portal, {
3215
- container: getPopupContainer && getPopupContainer(),
3216
- children: jsx(DropdownMenu$1.SubContent, {
3217
- ref: ref,
3218
- loop: true,
3219
- css: [contentStyles, {
3220
- minWidth
3221
- }, process.env.NODE_ENV === "production" ? "" : ";label:SubContent;"],
3222
- sideOffset: -2,
3223
- alignOffset: -5,
3224
- ...props,
3225
- children: children
3226
- })
3227
- });
3228
- });
3229
- const Trigger = /*#__PURE__*/forwardRef(function Trigger(_ref3, ref) {
3230
- let {
3231
- children,
3232
- ...props
3233
- } = _ref3;
3234
- return jsx(DropdownMenu$1.Trigger, {
3235
- ref: ref,
3236
- ...props,
3237
- children: children
3238
- });
3239
- });
3240
- const Item = /*#__PURE__*/forwardRef(function Item(_ref4, ref) {
3241
- let {
3242
- children,
3243
- disabledReason,
3244
- danger,
3245
- onClick,
3246
- ...props
3247
- } = _ref4;
3248
- const itemRef = useRef(null);
3249
- useImperativeHandle(ref, () => itemRef.current);
3250
- return jsx(DropdownMenu$1.Item, {
3251
- css: theme => [dropdownItemStyles, danger && dangerItemStyles(theme)],
3252
- ref: itemRef,
3253
- onClick: e => {
3254
- if (props.disabled) {
3255
- e.preventDefault();
3256
- } else {
3257
- onClick === null || onClick === void 0 || onClick(e);
3258
- }
3259
- },
3260
- ...props,
3261
- children: getNewChildren(children, props, disabledReason, itemRef)
3262
- });
3263
- });
3264
- const Label = /*#__PURE__*/forwardRef(function Label(_ref5, ref) {
3265
- let {
3266
- children,
3267
- ...props
3268
- } = _ref5;
3269
- return jsx(DropdownMenu$1.Label, {
3270
- ref: ref,
3271
- css: [dropdownItemStyles, theme => ({
3272
- color: theme.colors.textSecondary,
3273
- '&:hover': {
3274
- cursor: 'default'
3275
- }
3276
- }), process.env.NODE_ENV === "production" ? "" : ";label:Label;"],
3277
- ...props,
3278
- children: children
3279
- });
3280
- });
3281
- const Separator = /*#__PURE__*/forwardRef(function Separator(_ref6, ref) {
3282
- let {
3283
- children,
3284
- ...props
3285
- } = _ref6;
3286
- return jsx(DropdownMenu$1.Separator, {
3224
+ direction
3225
+ } = useResponsiveDirection({
3226
+ ref,
3227
+ requestedDirection,
3228
+ responsive,
3229
+ enabled: steps.length > 0
3230
+ });
3231
+ if (steps.length === 0) {
3232
+ return null;
3233
+ }
3234
+ const isHorizontal = direction === 'horizontal';
3235
+ const currentStepIndex = currentStep ? Math.min(steps.length - 1, Math.max(0, currentStep)) : 0;
3236
+ return jsx("ol", {
3237
+ css: /*#__PURE__*/css(getStepsStyle(theme, isHorizontal), process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3287
3238
  ref: ref,
3288
- css: dropdownSeparatorStyles,
3289
- ...props,
3290
- children: children
3291
- });
3292
- });
3293
- const SubTrigger = /*#__PURE__*/forwardRef(function TriggerItem(_ref7, ref) {
3294
- let {
3295
- children,
3296
- disabledReason,
3297
- ...props
3298
- } = _ref7;
3299
- const subTriggerRef = useRef(null);
3300
- useImperativeHandle(ref, () => subTriggerRef.current);
3301
- return jsxs(DropdownMenu$1.SubTrigger, {
3302
- ref: subTriggerRef,
3303
- css: [dropdownItemStyles, theme => ({
3304
- '&[data-state="open"]': {
3305
- backgroundColor: theme.colors.actionTertiaryBackgroundHover
3306
- }
3307
- }), process.env.NODE_ENV === "production" ? "" : ";label:SubTrigger;"],
3308
- ...props,
3309
- children: [getNewChildren(children, props, disabledReason, subTriggerRef), jsx(HintColumn, {
3310
- css: theme => ({
3311
- margin: CONSTANTS.subMenuIconMargin(theme),
3312
- display: 'flex',
3313
- alignSelf: 'stretch',
3314
- alignItems: 'center'
3315
- }),
3316
- children: jsx(ChevronRightIcon$1, {
3317
- css: theme => ({
3318
- fontSize: CONSTANTS.subMenuIconSize(theme)
3239
+ children: steps.map((step, index) => {
3240
+ const isCurrentStep = index === currentStepIndex;
3241
+ const isLastStep = index === steps.length - 1;
3242
+ const displayEndingDivider = !isLastStep;
3243
+ const contentTitleLevel = isCurrentStep ? 3 : 4;
3244
+ const StepIcon = step.icon;
3245
+ const {
3246
+ icon,
3247
+ iconBackgroundColor,
3248
+ iconTextColor,
3249
+ titleTextColor,
3250
+ descriptionTextColor,
3251
+ hasStepItemIconBorder
3252
+ } = getStepContentStyleFields(theme, isCurrentStep, step.status, StepIcon);
3253
+ return jsx("li", {
3254
+ "aria-current": isCurrentStep,
3255
+ css: /*#__PURE__*/css(getStepItemStyle(theme, isHorizontal, isLastStep), process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3256
+ children: jsxs(StepContentGrid, {
3257
+ isHorizontal: isHorizontal,
3258
+ isCurrentStep: isCurrentStep,
3259
+ children: [jsx("div", {
3260
+ css: /*#__PURE__*/css(getStepItemIconParentStyle(theme, isCurrentStep, iconBackgroundColor, hasStepItemIconBorder), process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3261
+ children: StepIcon ? jsx(StepIcon, {
3262
+ statusColor: iconTextColor,
3263
+ status: step.status
3264
+ }) : icon ? jsx("span", {
3265
+ css: /*#__PURE__*/css({
3266
+ color: iconTextColor
3267
+ }, process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3268
+ children: icon
3269
+ }) : jsx(Typography.Title, {
3270
+ level: contentTitleLevel,
3271
+ css: /*#__PURE__*/css({
3272
+ color: `${iconTextColor} !important`
3273
+ }, process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3274
+ withoutMargins: true,
3275
+ children: localizeStepNumber(index + 1)
3276
+ })
3277
+ }), jsx(Typography.Title, {
3278
+ level: contentTitleLevel,
3279
+ withoutMargins: true,
3280
+ css: /*#__PURE__*/css({
3281
+ flexShrink: 0,
3282
+ color: `${titleTextColor} !important`
3283
+ }, process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3284
+ children: step.title
3285
+ }), displayEndingDivider && jsx("div", {
3286
+ css: /*#__PURE__*/css(getStepEndingDividerStyles(theme, isHorizontal, isCurrentStep), process.env.NODE_ENV === "production" ? "" : ";label:Stepper;")
3287
+ }), step.description && jsx(Typography.Text, {
3288
+ css: /*#__PURE__*/css(getStepDescriptionStyles(theme, isHorizontal, isLastStep, descriptionTextColor), process.env.NODE_ENV === "production" ? "" : ";label:Stepper;"),
3289
+ withoutMargins: true,
3290
+ size: "sm",
3291
+ children: step.description
3292
+ })]
3319
3293
  })
3320
- })
3321
- })]
3322
- });
3323
- });
3324
-
3325
- /**
3326
- * Deprecated. Use `SubTrigger` instead.
3327
- * @deprecated
3328
- */
3329
- const TriggerItem = SubTrigger;
3330
- const CheckboxItem = /*#__PURE__*/forwardRef(function CheckboxItem(_ref8, ref) {
3331
- let {
3332
- children,
3333
- disabledReason,
3334
- ...props
3335
- } = _ref8;
3336
- const checkboxItemRef = useRef(null);
3337
- useImperativeHandle(ref, () => checkboxItemRef.current);
3338
- return jsx(DropdownMenu$1.CheckboxItem, {
3339
- ref: checkboxItemRef,
3340
- css: theme => [dropdownItemStyles, checkboxItemStyles(theme)],
3341
- ...props,
3342
- children: getNewChildren(children, props, disabledReason, checkboxItemRef)
3343
- });
3344
- });
3345
- const ItemIndicator = /*#__PURE__*/forwardRef(function ItemIndicator(_ref9, ref) {
3346
- let {
3347
- children,
3348
- ...props
3349
- } = _ref9;
3350
- return jsx(DropdownMenu$1.ItemIndicator, {
3351
- ref: ref,
3352
- css: theme => ({
3353
- marginLeft: -(CONSTANTS.checkboxIconWidth(theme) + CONSTANTS.checkboxPaddingRight(theme)),
3354
- position: 'absolute',
3355
- fontSize: theme.general.iconFontSize
3356
- }),
3357
- ...props,
3358
- children: children !== null && children !== void 0 ? children : jsx(CheckIcon$1, {
3359
- css: theme => ({
3360
- color: theme.colors.textSecondary
3361
- })
3294
+ }, index);
3362
3295
  })
3363
3296
  });
3364
- });
3365
- const Arrow = /*#__PURE__*/forwardRef(function Arrow(_ref10, ref) {
3297
+ }
3298
+ function getStepsStyle(theme, isHorizontal) {
3299
+ return /*#__PURE__*/css({
3300
+ listStyle: 'none',
3301
+ display: 'flex',
3302
+ flexDirection: isHorizontal ? 'row' : 'column',
3303
+ flexWrap: 'wrap',
3304
+ alignItems: 'flex-start',
3305
+ gap: isHorizontal ? theme.spacing.md : theme.spacing.sm,
3306
+ width: '100%',
3307
+ margin: '0',
3308
+ padding: '0'
3309
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepsStyle;");
3310
+ }
3311
+ function getStepItemStyle(theme, isHorizontal, isLastStep) {
3312
+ return /*#__PURE__*/css({
3313
+ display: 'flex',
3314
+ flexDirection: 'column',
3315
+ alignItems: 'center',
3316
+ justifyContent: 'flex-start',
3317
+ flexGrow: isLastStep ? 0 : 1,
3318
+ marginRight: isLastStep ? theme.spacing.lg + theme.spacing.md : 0,
3319
+ width: isHorizontal ? undefined : '100%'
3320
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepItemStyle;");
3321
+ }
3322
+ function getStepContentStyleFields(theme, isCurrentStep, status, icon) {
3323
+ const fields = getStepContentStyleFieldsFromStatus(theme, isCurrentStep, status);
3324
+ if (icon) {
3325
+ return {
3326
+ ...fields,
3327
+ icon: undefined,
3328
+ iconBackgroundColor: undefined,
3329
+ iconTextColor: getCustomIconColor(theme, isCurrentStep, status),
3330
+ hasStepItemIconBorder: false
3331
+ };
3332
+ }
3333
+ return fields;
3334
+ }
3335
+ function getCustomIconColor(theme, isCurrentStep, status) {
3336
+ switch (status) {
3337
+ case 'completed':
3338
+ return theme.colors.actionDefaultBackgroundPress;
3339
+ case 'loading':
3340
+ return theme.colors.textPlaceholder;
3341
+ case 'error':
3342
+ return theme.colors.textValidationDanger;
3343
+ default:
3344
+ case 'upcoming':
3345
+ return isCurrentStep ? theme.colors.actionLinkDefault : theme.colors.textPlaceholder;
3346
+ }
3347
+ }
3348
+ function getStepContentStyleFieldsFromStatus(theme, isCurrentStep, status) {
3349
+ switch (status) {
3350
+ case 'completed':
3351
+ return {
3352
+ icon: jsx(CheckIcon$1, {}),
3353
+ iconBackgroundColor: theme.colors.actionDefaultBackgroundPress,
3354
+ iconTextColor: theme.colors.textPlaceholder,
3355
+ titleTextColor: theme.colors.textPrimary,
3356
+ descriptionTextColor: theme.colors.textSecondary,
3357
+ hasStepItemIconBorder: true
3358
+ };
3359
+ case 'loading':
3360
+ return {
3361
+ icon: jsx(LoadingIcon$1, {
3362
+ spin: true,
3363
+ css: /*#__PURE__*/css({
3364
+ fontSize: isCurrentStep ? theme.typography.fontSizeXl : theme.typography.fontSizeLg
3365
+ }, process.env.NODE_ENV === "production" ? "" : ";label:icon;")
3366
+ }),
3367
+ iconBackgroundColor: undefined,
3368
+ iconTextColor: theme.colors.textPlaceholder,
3369
+ titleTextColor: isCurrentStep ? theme.colors.textPrimary : theme.colors.textSecondary,
3370
+ descriptionTextColor: theme.colors.textSecondary,
3371
+ hasStepItemIconBorder: false
3372
+ };
3373
+ case 'error':
3374
+ return {
3375
+ icon: jsx(CloseIcon$1, {
3376
+ css: /*#__PURE__*/css({
3377
+ marginBottom: theme.spacing.sm /* center icon in icon circle */
3378
+ }, process.env.NODE_ENV === "production" ? "" : ";label:icon;")
3379
+ }),
3380
+ iconBackgroundColor: theme.colors.textValidationDanger,
3381
+ iconTextColor: 'white',
3382
+ titleTextColor: theme.colors.textValidationDanger,
3383
+ descriptionTextColor: theme.colors.textValidationDanger,
3384
+ hasStepItemIconBorder: false
3385
+ };
3386
+ default:
3387
+ case 'upcoming':
3388
+ if (isCurrentStep) {
3389
+ return {
3390
+ icon: undefined,
3391
+ iconBackgroundColor: theme.colors.actionLinkDefault,
3392
+ iconTextColor: 'white',
3393
+ titleTextColor: theme.colors.textPrimary,
3394
+ descriptionTextColor: theme.colors.textPrimary,
3395
+ hasStepItemIconBorder: false
3396
+ };
3397
+ }
3398
+ return {
3399
+ icon: undefined,
3400
+ iconBackgroundColor: undefined,
3401
+ iconTextColor: theme.colors.textPlaceholder,
3402
+ titleTextColor: theme.colors.textSecondary,
3403
+ descriptionTextColor: theme.colors.textSecondary,
3404
+ hasStepItemIconBorder: true
3405
+ };
3406
+ }
3407
+ }
3408
+ const MaxHorizontalStepDescriptionWidth = 140;
3409
+ const CurrentStepIconSize = DEFAULT_SPACING_UNIT * 4;
3410
+ const NonCurrentStepIconSize = DEFAULT_SPACING_UNIT * 3;
3411
+ function getStepItemIconParentStyle(theme, isCurrentStep, iconBackgroundColor, hasStepItemIconBorder) {
3412
+ return /*#__PURE__*/css({
3413
+ width: isCurrentStep ? CurrentStepIconSize : NonCurrentStepIconSize,
3414
+ height: isCurrentStep ? CurrentStepIconSize : NonCurrentStepIconSize,
3415
+ backgroundColor: iconBackgroundColor,
3416
+ borderRadius: '50%',
3417
+ display: 'flex',
3418
+ justifyContent: 'center',
3419
+ alignItems: 'center',
3420
+ fontSize: '20px',
3421
+ flexShrink: 0,
3422
+ border: hasStepItemIconBorder ? `1px solid ${theme.colors.textPlaceholder}` : undefined
3423
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepItemIconParentStyle;");
3424
+ }
3425
+ function getStepEndingDividerStyles(theme, isHorizontal, isCurrentStep) {
3426
+ const backgroundColor = isCurrentStep ? theme.colors.actionLinkDefault : theme.colors.border;
3427
+ if (isHorizontal) {
3428
+ return /*#__PURE__*/css({
3429
+ backgroundColor,
3430
+ height: '1px',
3431
+ width: '100%',
3432
+ minWidth: theme.spacing.md
3433
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepEndingDividerStyles;");
3434
+ }
3435
+ return /*#__PURE__*/css({
3436
+ backgroundColor,
3437
+ height: '100%',
3438
+ minHeight: theme.spacing.md,
3439
+ width: '1px',
3440
+ alignSelf: 'flex-start',
3441
+ marginLeft: theme.spacing.md
3442
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepEndingDividerStyles;");
3443
+ }
3444
+ function getStepDescriptionStyles(theme, isHorizontal, isLastStep, textColor) {
3445
+ return /*#__PURE__*/css({
3446
+ alignSelf: 'flex-start',
3447
+ width: '100%',
3448
+ gridColumn: isHorizontal || isLastStep ? '2 / span 2' : undefined,
3449
+ maxWidth: isHorizontal ? MaxHorizontalStepDescriptionWidth : undefined,
3450
+ paddingBottom: isHorizontal ? undefined : theme.spacing.sm,
3451
+ color: `${textColor} !important`
3452
+ }, process.env.NODE_ENV === "production" ? "" : ";label:getStepDescriptionStyles;");
3453
+ }
3454
+ function StepContentGrid(_ref2) {
3366
3455
  let {
3367
3456
  children,
3368
- ...props
3369
- } = _ref10;
3457
+ isHorizontal,
3458
+ isCurrentStep
3459
+ } = _ref2;
3370
3460
  const {
3371
3461
  theme
3372
3462
  } = useDesignSystemTheme();
3373
- return jsx(DropdownMenu$1.Arrow, {
3463
+ if (isHorizontal) {
3464
+ return jsx("div", {
3465
+ css: /*#__PURE__*/css({
3466
+ display: 'grid',
3467
+ gridTemplateColumns: `${isCurrentStep ? CurrentStepIconSize : NonCurrentStepIconSize}px fit-content(100%) 1fr`,
3468
+ gridTemplateRows: `${CurrentStepIconSize}px auto`,
3469
+ alignItems: 'center',
3470
+ justifyItems: 'flex-start',
3471
+ gridColumnGap: theme.spacing.sm,
3472
+ width: '100%'
3473
+ }, process.env.NODE_ENV === "production" ? "" : ";label:StepContentGrid;"),
3474
+ children: children
3475
+ });
3476
+ }
3477
+ return jsx("div", {
3374
3478
  css: /*#__PURE__*/css({
3375
- fill: theme.colors.backgroundPrimary,
3376
- stroke: theme.colors.borderDecorative,
3377
- strokeDashoffset: -CONSTANTS.arrowBottomLength(),
3378
- strokeDasharray: CONSTANTS.arrowBottomLength() + 2 * CONSTANTS.arrowSide(),
3379
- strokeWidth: CONSTANTS.arrowStrokeWidth(),
3380
- // TODO: This is a temporary fix for the alignment of the Arrow;
3381
- // Radix has changed the implementation for v1.0.0 (uses floating-ui)
3382
- // which has new behaviors for alignment that we don't want. Generally
3383
- // we need to fix the arrow to always be aligned to the left of the menu (with
3384
- // offset equal to border radius)
3385
- position: 'relative',
3386
- top: -1
3387
- }, process.env.NODE_ENV === "production" ? "" : ";label:Arrow;"),
3388
- ref: ref,
3389
- width: 12,
3390
- height: 6,
3391
- ...props,
3479
+ display: 'grid',
3480
+ gridTemplateColumns: `${CurrentStepIconSize}px auto`,
3481
+ alignItems: 'center',
3482
+ justifyItems: 'flex-start',
3483
+ gridColumnGap: theme.spacing.md,
3484
+ gridRowGap: theme.spacing.sm,
3485
+ width: '100%',
3486
+ '& > :first-child': {
3487
+ // horizontally center the first column (circle/icon)
3488
+ justifySelf: 'center'
3489
+ }
3490
+ }, process.env.NODE_ENV === "production" ? "" : ";label:StepContentGrid;"),
3392
3491
  children: children
3393
3492
  });
3394
- });
3395
- const RadioItem = /*#__PURE__*/forwardRef(function RadioItem(_ref11, ref) {
3396
- let {
3397
- children,
3398
- disabledReason,
3399
- ...props
3400
- } = _ref11;
3401
- const radioItemRef = useRef(null);
3402
- useImperativeHandle(ref, () => radioItemRef.current);
3403
- return jsx(DropdownMenu$1.RadioItem, {
3404
- ref: radioItemRef,
3405
- css: theme => [dropdownItemStyles, checkboxItemStyles(theme)],
3406
- ...props,
3407
- children: getNewChildren(children, props, disabledReason, radioItemRef)
3408
- });
3409
- });
3493
+ }
3410
3494
 
3411
- // UNWRAPPED RADIX-UI-COMPONENTS
3412
- const Group = DropdownMenu$1.Group;
3413
- const RadioGroup = DropdownMenu$1.RadioGroup;
3414
- const Sub = DropdownMenu$1.Sub;
3495
+ // Ant design uses the same value for their stepper and to works well for us as well.
3496
+ const MinimumHorizonalDirectionWidth = 532;
3415
3497
 
3416
- // EXTRA COMPONENTS
3417
- const HintColumn = /*#__PURE__*/forwardRef(function HintColumn(_ref12, ref) {
3418
- let {
3419
- children,
3420
- ...props
3421
- } = _ref12;
3422
- return jsx("div", {
3423
- ref: ref,
3424
- css: [metaTextStyles, "margin-left:auto;" + (process.env.NODE_ENV === "production" ? "" : ";label:HintColumn;")],
3425
- ...props,
3426
- children: children
3427
- });
3428
- });
3429
- const HintRow = /*#__PURE__*/forwardRef(function HintRow(_ref13, ref) {
3430
- let {
3431
- children,
3432
- ...props
3433
- } = _ref13;
3434
- return jsx("div", {
3435
- ref: ref,
3436
- css: [metaTextStyles, "min-width:100%;" + (process.env.NODE_ENV === "production" ? "" : ";label:HintRow;")],
3437
- ...props,
3438
- children: children
3439
- });
3440
- });
3441
- const IconWrapper = /*#__PURE__*/forwardRef(function IconWrapper(_ref14, ref) {
3498
+ // exported for unit test
3499
+ function useResponsiveDirection(_ref3) {
3442
3500
  let {
3443
- children,
3444
- ...props
3445
- } = _ref14;
3446
- return jsx("div", {
3447
- ref: ref,
3448
- css: theme => ({
3449
- fontSize: 16,
3450
- color: theme.colors.textSecondary,
3451
- paddingRight: theme.spacing.sm
3452
- }),
3453
- ...props,
3454
- children: children
3455
- });
3456
- });
3457
- const getNewChildren = (children, props, disabledReason, ref) => {
3458
- const childCount = Children.count(children);
3459
- const tooltip = jsx(Tooltip, {
3460
- title: disabledReason,
3461
- placement: "right",
3462
- dangerouslySetAntdProps: {
3463
- getPopupContainer: () => ref.current || document.body
3464
- },
3465
- children: jsx("span", {
3466
- css: theme => infoIconStyles(theme),
3467
- children: jsx(InfoIcon$1, {
3468
- role: "presentation",
3469
- alt: "Disabled state reason",
3470
- "aria-hidden": "false"
3471
- })
3472
- })
3473
- });
3474
- if (childCount === 1) {
3475
- return getChild(children, Boolean(props['disabled']), disabledReason, tooltip, 0, childCount);
3476
- }
3477
- return Children.map(children, (child, idx) => {
3478
- return getChild(child, Boolean(props['disabled']), disabledReason, tooltip, idx, childCount);
3479
- });
3480
- };
3481
- const getChild = (child, isDisabled, disabledReason, tooltip, index, siblingCount) => {
3482
- const HintColumnType = jsx(HintColumn, {}).type;
3483
- const isHintColumnType = Boolean(child && typeof child !== 'string' && typeof child !== 'number' && typeof child !== 'boolean' && 'type' in child && (child === null || child === void 0 ? void 0 : child.type) === HintColumnType);
3484
- if (isDisabled && disabledReason && child && isHintColumnType) {
3485
- return jsxs(Fragment, {
3486
- children: [tooltip, child]
3487
- });
3488
- } else if (index === siblingCount - 1 && isDisabled && disabledReason) {
3489
- return jsxs(Fragment, {
3490
- children: [child, tooltip]
3501
+ requestedDirection = 'horizontal',
3502
+ responsive,
3503
+ enabled,
3504
+ ref
3505
+ } = _ref3;
3506
+ const [direction, setDirection] = useState(requestedDirection);
3507
+ useEffect(() => {
3508
+ if (requestedDirection === 'vertical' || !enabled || !responsive || !ref.current) {
3509
+ return;
3510
+ }
3511
+ let timeoutId;
3512
+ const resizeObserver = new ResizeObserver(entries => {
3513
+ timeoutId = requestAnimationFrame(() => {
3514
+ if (entries.length === 1) {
3515
+ const width = entries[0].target.clientWidth || 0;
3516
+ setDirection(width < MinimumHorizonalDirectionWidth ? 'vertical' : 'horizontal');
3517
+ }
3518
+ });
3491
3519
  });
3492
- }
3493
- return child;
3494
- };
3495
-
3496
- // CONSTANTS
3497
- const CONSTANTS = {
3498
- itemPaddingVertical(theme) {
3499
- // The number from the mocks is the midpoint between constants
3500
- return 0.5 * theme.spacing.xs + 0.5 * theme.spacing.sm;
3501
- },
3502
- itemPaddingHorizontal(theme) {
3503
- return theme.spacing.sm;
3504
- },
3505
- checkboxIconWidth(theme) {
3506
- return theme.general.iconFontSize;
3507
- },
3508
- checkboxPaddingLeft(theme) {
3509
- return theme.spacing.sm + theme.spacing.xs;
3510
- },
3511
- checkboxPaddingRight(theme) {
3512
- return theme.spacing.sm;
3513
- },
3514
- subMenuIconMargin(theme) {
3515
- // Negative margin so the icons can be larger without increasing the overall item height
3516
- const iconMarginVertical = this.itemPaddingVertical(theme) / 2;
3517
- const iconMarginRight = -this.itemPaddingVertical(theme) + theme.spacing.sm * 1.5;
3518
- return `${-iconMarginVertical}px ${-iconMarginRight}px ${-iconMarginVertical}px auto`;
3519
- },
3520
- subMenuIconSize(theme) {
3521
- return theme.spacing.lg;
3522
- },
3523
- arrowBottomLength() {
3524
- // The built in arrow is a polygon: 0,0 30,0 15,10
3525
- return 30;
3526
- },
3527
- arrowHeight() {
3528
- return 10;
3529
- },
3530
- arrowSide() {
3531
- return 2 * (this.arrowHeight() ** 2 * 2) ** 0.5;
3532
- },
3533
- arrowStrokeWidth() {
3534
- // This is eyeballed b/c relative to the svg viewbox coordinate system
3535
- return 2;
3536
- }
3537
- };
3538
- const dropdownContentStyles = theme => ({
3539
- backgroundColor: theme.colors.backgroundPrimary,
3540
- color: theme.colors.textPrimary,
3541
- lineHeight: theme.typography.lineHeightBase,
3542
- border: `1px solid ${theme.colors.borderDecorative}`,
3543
- borderRadius: theme.borders.borderRadiusMd,
3544
- padding: `${theme.spacing.xs}px 0`,
3545
- boxShadow: theme.general.shadowLow,
3546
- userSelect: 'none',
3547
- ...getDarkModePortalStyles(theme),
3548
- // Ant Design uses 1000s for their zIndex space; this ensures Radix works with that, but
3549
- // we'll likely need to be sure that all Radix components are using the same zIndex going forward.
3550
- //
3551
- // Additionally, there is an issue where macOS overlay scrollbars in Chrome and Safari (sometimes!)
3552
- // overlap other elements with higher zIndex, because the scrollbars themselves have zIndex 9999,
3553
- // so we have to use a higher value than that: https://github.com/databricks/universe/pull/232825
3554
- zIndex: 10000,
3555
- a: importantify({
3556
- color: theme.colors.textPrimary,
3557
- '&:hover, &:focus': {
3558
- color: theme.colors.textPrimary,
3559
- textDecoration: 'none'
3520
+ if (ref.current) {
3521
+ resizeObserver.observe(ref.current);
3560
3522
  }
3561
- })
3562
- });
3563
- const contentStyles = theme => ({
3564
- ...dropdownContentStyles(theme)
3565
- });
3566
- const dropdownItemStyles = theme => ({
3567
- padding: `${CONSTANTS.itemPaddingVertical(theme)}px ${CONSTANTS.itemPaddingHorizontal(theme)}px`,
3568
- display: 'flex',
3569
- flexWrap: 'wrap',
3570
- alignItems: 'center',
3571
- outline: 'unset',
3572
- '&:hover': {
3573
- cursor: 'pointer'
3574
- },
3575
- '&:focus': {
3576
- backgroundColor: theme.colors.actionTertiaryBackgroundHover
3577
- },
3578
- '&[data-disabled]': {
3579
- pointerEvents: 'none',
3580
- color: theme.colors.actionDisabledText
3581
- }
3582
- });
3583
- const dangerItemStyles = theme => ({
3584
- color: theme.colors.textValidationDanger,
3585
- '&:hover, &:focus': {
3586
- backgroundColor: theme.colors.actionDangerDefaultBackgroundHover
3587
- }
3588
- });
3589
- const infoIconStyles = theme => ({
3590
- display: 'inline-flex',
3591
- paddingLeft: theme.spacing.xs,
3592
- color: theme.colors.textSecondary,
3593
- pointerEvents: 'all'
3594
- });
3595
- const checkboxItemStyles = theme => ({
3596
- position: 'relative',
3597
- paddingLeft: CONSTANTS.checkboxIconWidth(theme) + CONSTANTS.checkboxPaddingLeft(theme) + CONSTANTS.checkboxPaddingRight(theme)
3598
- });
3599
- const metaTextStyles = theme => ({
3600
- color: theme.colors.textSecondary,
3601
- fontSize: theme.typography.fontSizeSm,
3602
- '[data-disabled] &': {
3603
- color: theme.colors.actionDisabledText
3604
- }
3605
- });
3606
- const dropdownSeparatorStyles = theme => ({
3607
- height: 1,
3608
- margin: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
3609
- backgroundColor: theme.colors.borderDecorative
3610
- });
3611
-
3612
- var DropdownMenu = /*#__PURE__*/Object.freeze({
3613
- __proto__: null,
3614
- Arrow: Arrow,
3615
- CheckboxItem: CheckboxItem,
3616
- Content: Content,
3617
- Group: Group,
3618
- HintColumn: HintColumn,
3619
- HintRow: HintRow,
3620
- IconWrapper: IconWrapper,
3621
- Item: Item,
3622
- ItemIndicator: ItemIndicator,
3623
- Label: Label,
3624
- RadioGroup: RadioGroup,
3625
- RadioItem: RadioItem,
3626
- Root: Root,
3627
- Separator: Separator,
3628
- Sub: Sub,
3629
- SubContent: SubContent,
3630
- SubTrigger: SubTrigger,
3631
- Trigger: Trigger,
3632
- TriggerItem: TriggerItem,
3633
- dropdownContentStyles: dropdownContentStyles,
3634
- dropdownItemStyles: dropdownItemStyles,
3635
- dropdownSeparatorStyles: dropdownSeparatorStyles
3636
- });
3523
+ return () => {
3524
+ resizeObserver.disconnect();
3525
+ cancelAnimationFrame(timeoutId);
3526
+ };
3527
+ }, [requestedDirection, enabled, ref, responsive]);
3528
+ return {
3529
+ direction
3530
+ };
3531
+ }
3637
3532
 
3638
- export { FaceFrownIcon$1 as $, ApplyDesignSystemContextOverrides as A, Button as B, CloseIcon$1 as C, DesignSystemAntDConfigProvider as D, getPrimaryStyles as E, getDisabledStyles as F, useDesignSystemFlags as G, getButtonEmotionStyles as H, Icon as I, DesignSystemEventProviderComponentTypes as J, DesignSystemEventProviderAnalyticsEventTypes as K, LoadingState as L, useDesignSystemEventComponentCallbacks as M, DesignSystemEventProvider as N, DesignSystemThemeContext as O, DesignSystemContext as P, DesignSystemThemeProvider as Q, RestoreAntDDefaultClsPrefix as R, Spinner as S, Typography as T, DesignSystemProvider as U, ApplyDesignSystemFlags as V, WarningIcon$1 as W, useAntDConfigProviderContext as X, DropdownMenu as Y, WithDesignSystemThemeHoc as Z, CursorIcon$1 as _, getDarkModePortalStyles as a, FaceNeutralIcon$1 as a0, FaceSmileIcon$1 as a1, MegaphoneIcon$1 as a2, NewWindowIcon$1 as a3, LoadingStateContext as a4, getTypographyColor as a5, getBottomOnlyShadowScrollStyles as a6, ColorVars as a7, primitiveColors as a8, dropdownItemStyles as a9, dropdownSeparatorStyles as aa, ChevronRightIcon$1 as b, useDesignSystemContext as c, Tooltip as d, InfoIcon$1 as e, Input as f, getAnimationCss as g, CheckIcon$1 as h, importantify as i, getValidationStateColor as j, getShadowScrollStyles as k, DangerIcon$1 as l, LoadingIcon$1 as m, dropdownContentStyles as n, useUniqueId as o, Title as p, AccessibleContainer as q, ChevronLeftIcon$1 as r, safex as s, DU_BOIS_ENABLE_ANIMATION_CLASSNAME as t, useDesignSystemTheme as u, visuallyHidden as v, lightColorList as w, Root as x, Trigger as y, getDefaultStyles as z };
3639
- //# sourceMappingURL=DropdownMenu-dbeef1b7.js.map
3533
+ export { NewWindowIcon$1 as $, ApplyDesignSystemContextOverrides as A, Button as B, CloseIcon$1 as C, DesignSystemAntDConfigProvider as D, getDisabledStyles as E, useDesignSystemFlags as F, Stepper as G, getButtonEmotionStyles as H, Icon as I, DesignSystemEventProvider as J, DesignSystemThemeContext as K, LoadingState as L, DesignSystemContext as M, DesignSystemThemeProvider as N, DesignSystemProvider as O, ApplyDesignSystemFlags as P, useAntDConfigProviderContext as Q, RestoreAntDDefaultClsPrefix as R, Spinner as S, Typography as T, WithDesignSystemThemeHoc as U, CursorIcon$1 as V, WarningIcon$1 as W, FaceFrownIcon$1 as X, FaceNeutralIcon$1 as Y, FaceSmileIcon$1 as Z, MegaphoneIcon$1 as _, getDarkModePortalStyles as a, getInputStyles as a0, LoadingStateContext as a1, getTypographyColor as a2, getBottomOnlyShadowScrollStyles as a3, ColorVars as a4, primitiveColors as a5, ChevronRightIcon$1 as b, useUniqueId as c, useDesignSystemContext as d, CheckIcon$1 as e, Input as f, getAnimationCss as g, getValidationStateColor as h, importantify as i, getShadowScrollStyles as j, DangerIcon$1 as k, LoadingIcon$1 as l, Title as m, AccessibleContainer as n, ChevronLeftIcon$1 as o, useDesignSystemEventComponentCallbacks as p, DesignSystemEventProviderComponentTypes as q, DesignSystemEventProviderAnalyticsEventTypes as r, safex as s, useNotifyOnFirstView as t, useDesignSystemTheme as u, visuallyHidden as v, DU_BOIS_ENABLE_ANIMATION_CLASSNAME as w, lightColorList as x, getDefaultStyles as y, getPrimaryStyles as z };
3534
+ //# sourceMappingURL=Stepper-a0fb4d9b.js.map