@databricks/design-system 1.9.1 → 1.9.3

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 (234) hide show
  1. package/dist/{Typography-84a00e02.js → Spinner-140f57ac.js} +1135 -75
  2. package/dist/Spinner-140f57ac.js.map +1 -0
  3. package/dist/common-3ab0e300.js +15 -0
  4. package/dist/common-3ab0e300.js.map +1 -0
  5. package/dist/design-system/AutoComplete/AutoComplete.d.ts.map +1 -1
  6. package/dist/design-system/Button/Button.d.ts +5 -1
  7. package/dist/design-system/Button/Button.d.ts.map +1 -1
  8. package/dist/design-system/Button/styles.d.ts.map +1 -1
  9. package/dist/design-system/Checkbox/Checkbox.d.ts.map +1 -1
  10. package/dist/design-system/DatePicker/DatePicker.d.ts +18 -14
  11. package/dist/design-system/DatePicker/DatePicker.d.ts.map +1 -1
  12. package/dist/design-system/DesignSystemProvider/DesignSystemProvider.d.ts +3 -1
  13. package/dist/design-system/DesignSystemProvider/DesignSystemProvider.d.ts.map +1 -1
  14. package/dist/design-system/Drawer/Drawer.d.ts +12 -1
  15. package/dist/design-system/Drawer/Drawer.d.ts.map +1 -1
  16. package/dist/design-system/FormMessage/FormMessage.d.ts.map +1 -1
  17. package/dist/design-system/FormV2/RHFAdapters.d.ts +7 -7
  18. package/dist/design-system/FormV2/RHFAdapters.d.ts.map +1 -1
  19. package/dist/design-system/Hooks/useDesignSystemTheme.d.ts.map +1 -1
  20. package/dist/design-system/Icon/__generated/icons/BracketsXIcon.v2.d.ts +4 -0
  21. package/dist/design-system/Icon/__generated/icons/BracketsXIcon.v2.d.ts.map +1 -0
  22. package/dist/design-system/Icon/__generated/icons/CloudModelIcon.v2.d.ts +4 -0
  23. package/dist/design-system/Icon/__generated/icons/CloudModelIcon.v2.d.ts.map +1 -0
  24. package/dist/design-system/Icon/__generated/icons/CursorIcon.v2.d.ts +4 -0
  25. package/dist/design-system/Icon/__generated/icons/CursorIcon.v2.d.ts.map +1 -0
  26. package/dist/design-system/Icon/__generated/icons/DagIcon.v2.d.ts +4 -0
  27. package/dist/design-system/Icon/__generated/icons/DagIcon.v2.d.ts.map +1 -0
  28. package/dist/design-system/Icon/__generated/icons/DecimalIcon.v2.d.ts +4 -0
  29. package/dist/design-system/Icon/__generated/icons/DecimalIcon.v2.d.ts.map +1 -0
  30. package/dist/design-system/Icon/__generated/icons/DotsCircleIcon.v2.d.ts +4 -0
  31. package/dist/design-system/Icon/__generated/icons/DotsCircleIcon.v2.d.ts.map +1 -0
  32. package/dist/design-system/Icon/__generated/icons/LettersIcon.v2.d.ts +4 -0
  33. package/dist/design-system/Icon/__generated/icons/LettersIcon.v2.d.ts.map +1 -0
  34. package/dist/design-system/Icon/__generated/icons/NumbersIcon.v2.d.ts +4 -0
  35. package/dist/design-system/Icon/__generated/icons/NumbersIcon.v2.d.ts.map +1 -0
  36. package/dist/design-system/Icon/__generated/icons/index.d.ts +8 -1
  37. package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
  38. package/dist/design-system/LegacyTable/LegacyTable.d.ts +100 -0
  39. package/dist/design-system/LegacyTable/LegacyTable.d.ts.map +1 -0
  40. package/dist/design-system/LegacyTable/index.d.ts +2 -0
  41. package/dist/design-system/LegacyTable/index.d.ts.map +1 -0
  42. package/dist/design-system/Modal/Modal.d.ts +3 -1
  43. package/dist/design-system/Modal/Modal.d.ts.map +1 -1
  44. package/dist/design-system/Notification/Notification.d.ts.map +1 -1
  45. package/dist/design-system/PageWrapper/PageWrapper.d.ts.map +1 -1
  46. package/dist/design-system/Popover/Popover.d.ts +2 -1
  47. package/dist/design-system/Popover/Popover.d.ts.map +1 -1
  48. package/dist/design-system/PopoverV2/PopoverV2.d.ts +1 -0
  49. package/dist/design-system/PopoverV2/PopoverV2.d.ts.map +1 -1
  50. package/dist/design-system/Radio/Radio.d.ts.map +1 -1
  51. package/dist/design-system/SegmentedControl/SegmentedControl.d.ts +0 -2
  52. package/dist/design-system/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  53. package/dist/design-system/Select/Select.d.ts.map +1 -1
  54. package/dist/design-system/Sidebar/Sidebar.d.ts +1 -1
  55. package/dist/design-system/Sidebar/Sidebar.d.ts.map +1 -1
  56. package/dist/design-system/SplitButton/Dropdown/DropdownButton.d.ts.map +1 -1
  57. package/dist/design-system/Table/index.d.ts +1 -1
  58. package/dist/design-system/ToggleButton/ToggleButton.d.ts.map +1 -1
  59. package/dist/design-system/ToggleButton/index.d.ts +2 -0
  60. package/dist/design-system/ToggleButton/index.d.ts.map +1 -0
  61. package/dist/design-system/Tooltip/Tooltip.d.ts.map +1 -1
  62. package/dist/design-system/index.d.ts +2 -1
  63. package/dist/design-system/index.d.ts.map +1 -1
  64. package/dist/development/Filter/Filter.d.ts +10 -0
  65. package/dist/development/Filter/Filter.d.ts.map +1 -0
  66. package/dist/development/Filter/Filter.test.d.ts +2 -0
  67. package/dist/development/Filter/Filter.test.d.ts.map +1 -0
  68. package/dist/development/Filter/FilterButtonContainer.d.ts +2 -0
  69. package/dist/development/Filter/FilterButtonContainer.d.ts.map +1 -0
  70. package/dist/development/Filter/FilterContent.d.ts +14 -0
  71. package/dist/development/Filter/FilterContent.d.ts.map +1 -0
  72. package/dist/development/Filter/FilterCountBadge.d.ts +2 -0
  73. package/dist/development/Filter/FilterCountBadge.d.ts.map +1 -0
  74. package/dist/development/Filter/FilterLoadingSpinner.d.ts +2 -0
  75. package/dist/development/Filter/FilterLoadingSpinner.d.ts.map +1 -0
  76. package/dist/development/Filter/FilterOptionControlledList.d.ts +9 -0
  77. package/dist/development/Filter/FilterOptionControlledList.d.ts.map +1 -0
  78. package/dist/development/Filter/FilterOptionList.d.ts +10 -0
  79. package/dist/development/Filter/FilterOptionList.d.ts.map +1 -0
  80. package/dist/development/Filter/FilterOptionListCheckboxItem.d.ts +11 -0
  81. package/dist/development/Filter/FilterOptionListCheckboxItem.d.ts.map +1 -0
  82. package/dist/development/Filter/FilterOptionListSearch.d.ts +7 -0
  83. package/dist/development/Filter/FilterOptionListSearch.d.ts.map +1 -0
  84. package/dist/development/Filter/FilterOptionListSelectItem.d.ts +10 -0
  85. package/dist/development/Filter/FilterOptionListSelectItem.d.ts.map +1 -0
  86. package/dist/development/Filter/FilterSectionHeader.d.ts +2 -0
  87. package/dist/development/Filter/FilterSectionHeader.d.ts.map +1 -0
  88. package/dist/development/Filter/FilterSeparator.d.ts +2 -0
  89. package/dist/development/Filter/FilterSeparator.d.ts.map +1 -0
  90. package/dist/development/Filter/FilterTrigger.d.ts +15 -0
  91. package/dist/development/Filter/FilterTrigger.d.ts.map +1 -0
  92. package/dist/development/Filter/hooks/useFilterContext.d.ts +2 -0
  93. package/dist/development/Filter/hooks/useFilterContext.d.ts.map +1 -0
  94. package/dist/development/Filter/hooks/useFilterOptionListContext.d.ts +2 -0
  95. package/dist/development/Filter/hooks/useFilterOptionListContext.d.ts.map +1 -0
  96. package/dist/development/Filter/index.d.ts +14 -0
  97. package/dist/development/Filter/index.d.ts.map +1 -0
  98. package/dist/development/Filter/providers/FilterContext.d.ts +15 -0
  99. package/dist/development/Filter/providers/FilterContext.d.ts.map +1 -0
  100. package/dist/development/Filter/providers/FilterOptionListContext.d.ts +10 -0
  101. package/dist/development/Filter/providers/FilterOptionListContext.d.ts.map +1 -0
  102. package/dist/development/Filter/shared.d.ts +3 -0
  103. package/dist/development/Filter/shared.d.ts.map +1 -0
  104. package/dist/development/ListPagePattern/index.d.ts +1 -0
  105. package/dist/development/ListPagePattern/index.d.ts.map +1 -0
  106. package/dist/development/Slider/Slider.d.ts.map +1 -1
  107. package/dist/development/TableUI/index.d.ts +33 -0
  108. package/dist/development/TableUI/index.d.ts.map +1 -1
  109. package/dist/development/index.d.ts +1 -0
  110. package/dist/development/index.d.ts.map +1 -1
  111. package/dist/development.js +1101 -472
  112. package/dist/development.js.map +1 -1
  113. package/dist/index-dark.css +1 -0
  114. package/dist/index-mfe-dark.css +1 -0
  115. package/dist/index-mfe.css +1 -0
  116. package/dist/index.css +1 -0
  117. package/dist/index.js +886 -1543
  118. package/dist/index.js.map +1 -1
  119. package/dist/test-utils/common.d.ts +11 -0
  120. package/dist/test-utils/common.d.ts.map +1 -0
  121. package/dist/test-utils/enzyme/index.d.ts +1 -0
  122. package/dist/test-utils/enzyme/index.d.ts.map +1 -1
  123. package/dist/test-utils/enzyme/selectEvent.d.ts +42 -0
  124. package/dist/test-utils/enzyme/selectEvent.d.ts.map +1 -0
  125. package/dist/test-utils/enzyme/selectEvent.test.d.ts +2 -0
  126. package/dist/test-utils/enzyme/selectEvent.test.d.ts.map +1 -0
  127. package/dist/test-utils/enzyme/utils.d.ts +33 -0
  128. package/dist/test-utils/enzyme/utils.d.ts.map +1 -0
  129. package/dist/test-utils/enzyme.js +258 -1
  130. package/dist/test-utils/enzyme.js.map +1 -1
  131. package/dist/test-utils/rtl/index.d.ts +1 -0
  132. package/dist/test-utils/rtl/index.d.ts.map +1 -1
  133. package/dist/test-utils/rtl/selectEvent.d.ts +41 -0
  134. package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -0
  135. package/dist/test-utils/rtl/selectEvent.test.d.ts +2 -0
  136. package/dist/test-utils/rtl/selectEvent.test.d.ts.map +1 -0
  137. package/dist/test-utils/rtl.js +135 -1
  138. package/dist/test-utils/rtl.js.map +1 -1
  139. package/dist/test-utils/types.d.ts +1 -14
  140. package/dist/test-utils/types.d.ts.map +1 -1
  141. package/dist/theme/colorList.d.ts +7 -8
  142. package/dist/theme/colorList.d.ts.map +1 -1
  143. package/dist/theme/colors.d.ts +9 -11
  144. package/dist/theme/colors.d.ts.map +1 -1
  145. package/dist/theme/convertToLessVars.d.ts +3 -4
  146. package/dist/theme/convertToLessVars.d.ts.map +1 -1
  147. package/dist/theme/generalVariables.d.ts +4 -0
  148. package/dist/theme/generalVariables.d.ts.map +1 -1
  149. package/dist/theme/index.d.ts +7 -3
  150. package/dist/theme/index.d.ts.map +1 -1
  151. package/package.json +6 -5
  152. package/dist/Typography-52abe0b7.js +0 -1142
  153. package/dist/Typography-52abe0b7.js.map +0 -1
  154. package/dist/Typography-84a00e02.js.map +0 -1
  155. package/dist/design-system/Icon/__generated/icons/ArrayIcon.v2.d.ts +0 -4
  156. package/dist/design-system/Icon/__generated/icons/ArrayIcon.v2.d.ts.map +0 -1
  157. package/dist/design-system/Icon/__generated/icons/BookmarkBorderIcon.d.ts +0 -4
  158. package/dist/design-system/Icon/__generated/icons/BookmarkBorderIcon.d.ts.map +0 -1
  159. package/dist/design-system/Icon/__generated/icons/BracketsIcon.v2.d.ts +0 -4
  160. package/dist/design-system/Icon/__generated/icons/BracketsIcon.v2.d.ts.map +0 -1
  161. package/dist/design-system/Icon/__generated/icons/CheckCircleBorderIcon.d.ts +0 -4
  162. package/dist/design-system/Icon/__generated/icons/CheckCircleBorderIcon.d.ts.map +0 -1
  163. package/dist/design-system/Icon/__generated/icons/ClusterIcon.d.ts +0 -4
  164. package/dist/design-system/Icon/__generated/icons/ClusterIcon.d.ts.map +0 -1
  165. package/dist/design-system/Icon/__generated/icons/ClustersIcon.d.ts +0 -4
  166. package/dist/design-system/Icon/__generated/icons/ClustersIcon.d.ts.map +0 -1
  167. package/dist/design-system/Icon/__generated/icons/DataMarketplace.v2.d.ts +0 -4
  168. package/dist/design-system/Icon/__generated/icons/DataMarketplace.v2.d.ts.map +0 -1
  169. package/dist/design-system/Icon/__generated/icons/ErrorBorderIcon.d.ts +0 -4
  170. package/dist/design-system/Icon/__generated/icons/ErrorBorderIcon.d.ts.map +0 -1
  171. package/dist/design-system/Icon/__generated/icons/ErrorFillIcon.d.ts +0 -4
  172. package/dist/design-system/Icon/__generated/icons/ErrorFillIcon.d.ts.map +0 -1
  173. package/dist/design-system/Icon/__generated/icons/ExperimentIcon.d.ts +0 -4
  174. package/dist/design-system/Icon/__generated/icons/ExperimentIcon.d.ts.map +0 -1
  175. package/dist/design-system/Icon/__generated/icons/Folder1Icon.d.ts +0 -4
  176. package/dist/design-system/Icon/__generated/icons/Folder1Icon.d.ts.map +0 -1
  177. package/dist/design-system/Icon/__generated/icons/Gear1Icon.d.ts +0 -4
  178. package/dist/design-system/Icon/__generated/icons/Gear1Icon.d.ts.map +0 -1
  179. package/dist/design-system/Icon/__generated/icons/InfoBorderIcon.d.ts +0 -4
  180. package/dist/design-system/Icon/__generated/icons/InfoBorderIcon.d.ts.map +0 -1
  181. package/dist/design-system/Icon/__generated/icons/LifesaverIcon.d.ts +0 -4
  182. package/dist/design-system/Icon/__generated/icons/LifesaverIcon.d.ts.map +0 -1
  183. package/dist/design-system/Icon/__generated/icons/LinkRemoveIcon.d.ts +0 -4
  184. package/dist/design-system/Icon/__generated/icons/LinkRemoveIcon.d.ts.map +0 -1
  185. package/dist/design-system/Icon/__generated/icons/LockBorderIcon.d.ts +0 -4
  186. package/dist/design-system/Icon/__generated/icons/LockBorderIcon.d.ts.map +0 -1
  187. package/dist/design-system/Icon/__generated/icons/MinusCircleBorderIcon.d.ts +0 -4
  188. package/dist/design-system/Icon/__generated/icons/MinusCircleBorderIcon.d.ts.map +0 -1
  189. package/dist/design-system/Icon/__generated/icons/NotificationsOffIcon.v2.d.ts +0 -4
  190. package/dist/design-system/Icon/__generated/icons/NotificationsOffIcon.v2.d.ts.map +0 -1
  191. package/dist/design-system/Icon/__generated/icons/PinBorderIcon.d.ts +0 -4
  192. package/dist/design-system/Icon/__generated/icons/PinBorderIcon.d.ts.map +0 -1
  193. package/dist/design-system/Icon/__generated/icons/PlayCircleBorderIcon.d.ts +0 -4
  194. package/dist/design-system/Icon/__generated/icons/PlayCircleBorderIcon.d.ts.map +0 -1
  195. package/dist/design-system/Icon/__generated/icons/PlusCircleBorderIcon.d.ts +0 -4
  196. package/dist/design-system/Icon/__generated/icons/PlusCircleBorderIcon.d.ts.map +0 -1
  197. package/dist/design-system/Icon/__generated/icons/QueryListViewIcon.d.ts +0 -4
  198. package/dist/design-system/Icon/__generated/icons/QueryListViewIcon.d.ts.map +0 -1
  199. package/dist/design-system/Icon/__generated/icons/QueryNavIcon.d.ts +0 -4
  200. package/dist/design-system/Icon/__generated/icons/QueryNavIcon.d.ts.map +0 -1
  201. package/dist/design-system/Icon/__generated/icons/QuestionMarkBorderIcon.d.ts +0 -4
  202. package/dist/design-system/Icon/__generated/icons/QuestionMarkBorderIcon.d.ts.map +0 -1
  203. package/dist/design-system/Icon/__generated/icons/Redo.d.ts +0 -4
  204. package/dist/design-system/Icon/__generated/icons/Redo.d.ts.map +0 -1
  205. package/dist/design-system/Icon/__generated/icons/RedoIcon.v2.d.ts +0 -4
  206. package/dist/design-system/Icon/__generated/icons/RedoIcon.v2.d.ts.map +0 -1
  207. package/dist/design-system/Icon/__generated/icons/Refresh.d.ts +0 -4
  208. package/dist/design-system/Icon/__generated/icons/Refresh.d.ts.map +0 -1
  209. package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts +0 -4
  210. package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts.map +0 -1
  211. package/dist/design-system/Icon/__generated/icons/RefreshIcon.v2.d.ts +0 -4
  212. package/dist/design-system/Icon/__generated/icons/RefreshIcon.v2.d.ts.map +0 -1
  213. package/dist/design-system/Icon/__generated/icons/Search1Icon.d.ts +0 -4
  214. package/dist/design-system/Icon/__generated/icons/Search1Icon.d.ts.map +0 -1
  215. package/dist/design-system/Icon/__generated/icons/StarBorderIcon.d.ts +0 -4
  216. package/dist/design-system/Icon/__generated/icons/StarBorderIcon.d.ts.map +0 -1
  217. package/dist/design-system/Icon/__generated/icons/StopCircleBorderIcon.d.ts +0 -4
  218. package/dist/design-system/Icon/__generated/icons/StopCircleBorderIcon.d.ts.map +0 -1
  219. package/dist/design-system/Icon/__generated/icons/StopCricleFillIcon.d.ts +0 -4
  220. package/dist/design-system/Icon/__generated/icons/StopCricleFillIcon.d.ts.map +0 -1
  221. package/dist/design-system/Icon/__generated/icons/Undo.d.ts +0 -4
  222. package/dist/design-system/Icon/__generated/icons/Undo.d.ts.map +0 -1
  223. package/dist/design-system/Icon/__generated/icons/Visible.d.ts +0 -4
  224. package/dist/design-system/Icon/__generated/icons/Visible.d.ts.map +0 -1
  225. package/dist/design-system/Icon/__generated/icons/VisibleOff.d.ts +0 -4
  226. package/dist/design-system/Icon/__generated/icons/VisibleOff.d.ts.map +0 -1
  227. package/dist/design-system/Icon/__generated/icons/WarningBorderIcon.d.ts +0 -4
  228. package/dist/design-system/Icon/__generated/icons/WarningBorderIcon.d.ts.map +0 -1
  229. package/dist/design-system/Icon/__generated/icons/XCircleBorderIcon.d.ts +0 -4
  230. package/dist/design-system/Icon/__generated/icons/XCircleBorderIcon.d.ts.map +0 -1
  231. package/dist/test-utils/enzyme.d.ts +0 -8
  232. package/dist/test-utils/enzyme.d.ts.map +0 -1
  233. package/dist/test-utils/rtl.d.ts +0 -7
  234. package/dist/test-utils/rtl.d.ts.map +0 -1
@@ -1,1142 +0,0 @@
1
- import { notification, ConfigProvider, Typography as Typography$1 } from 'antd';
2
- import { useTheme, ThemeProvider, css } from '@emotion/react';
3
- import { jsx, jsxs } from '@emotion/react/jsx-runtime';
4
- import React__default, { createContext, useMemo, useEffect, useContext } from 'react';
5
- import chroma from 'chroma-js';
6
- import AntDIcon from '@ant-design/icons';
7
- import _isNil from 'lodash/isNil';
8
- import _endsWith from 'lodash/endsWith';
9
- import _isBoolean from 'lodash/isBoolean';
10
- import _isNumber from 'lodash/isNumber';
11
- import _isString from 'lodash/isString';
12
- import _mapValues from 'lodash/mapValues';
13
- import unitless from '@emotion/unitless';
14
-
15
- // Border variables
16
- const borders = {
17
- borderRadiusMd: 4
18
- };
19
-
20
- // eslint-disable-next-line import/no-anonymous-default-export
21
- var borders$1 = {
22
- ...borders
23
- };
24
-
25
- // Exported from go/designsystem/colorsheet
26
- const colorPalettePrimary = {
27
- primary: '#2272B4',
28
- blue100: '#F0F8FF',
29
- blue200: '#D7EDFE',
30
- blue300: '#BAE1FC',
31
- blue400: '#8ACAFF',
32
- blue500: '#4299E0',
33
- blue600: '#2272B4',
34
- blue700: '#0E538B',
35
- blue800: '#04355D',
36
- green100: '#F3FCF6',
37
- green200: '#D4F7DF',
38
- green300: '#B1ECC5',
39
- green400: '#8DDDA8',
40
- green500: '#3CAA60',
41
- green600: '#277C43',
42
- green700: '#115026',
43
- green800: '#093919',
44
- white: '#FFFFFF',
45
- grey100: '#F2F5F7',
46
- grey200: '#E4ECF1',
47
- grey300: '#CDDAE5',
48
- grey400: '#BDCDDB',
49
- grey500: '#8196A7',
50
- grey600: '#5D7283',
51
- grey700: '#44535F',
52
- grey800: '#1F272D',
53
- red100: '#FFF5F7',
54
- red200: '#FDE2E8',
55
- red300: '#FBD0D8',
56
- red400: '#F792A6',
57
- red500: '#E65B77',
58
- red600: '#C82D4C',
59
- red700: '#9E102C',
60
- red800: '#630316',
61
- yellow100: '#FFF9EB',
62
- yellow200: '#FCEACA',
63
- yellow300: '#F8D4A5',
64
- yellow400: '#F2BE88',
65
- yellow500: '#DE7921',
66
- yellow600: '#BE501E',
67
- yellow700: '#93320B',
68
- yellow800: '#5F1B02'
69
- };
70
- const colorPaletteSecondary = {
71
- brown: '#A6630C',
72
- coral: '#C83243',
73
- charcoal: '#5D7283',
74
- indigo: '#434A93',
75
- lemon: '#FACB66',
76
- lime: '#308613',
77
- pink: '#B45091',
78
- purple: '#8A63BF',
79
- teal: '#04867D',
80
- turquoise: '#157CBC'
81
- };
82
-
83
- // Colors taken from figma designs but not part of official list (yet)
84
- const unstableColors = {
85
- textValidationInfo: '#64727D',
86
- backgroundValidationDanger: colorPalettePrimary.red100,
87
- backgroundValidationSuccess: colorPalettePrimary.blue100,
88
- backgroundValidationWarning: colorPalettePrimary.yellow100,
89
- borderValidationDanger: colorPalettePrimary.red300,
90
- borderValidationSuccess: colorPalettePrimary.blue300,
91
- borderValidationWarning: colorPalettePrimary.yellow300
92
- };
93
- const lightColorList = {
94
- backgroundPrimary: colorPalettePrimary.white,
95
- actionDangerPrimaryBackgroundDefault: colorPalettePrimary.red600,
96
- actionDangerPrimaryBackgroundHover: colorPalettePrimary.red700,
97
- actionDangerPrimaryBackgroundPress: colorPalettePrimary.red800,
98
- actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red600).alpha(0).hex(),
99
- actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red600).alpha(0.08).hex(),
100
- actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red600).alpha(0.16).hex(),
101
- actionDangerDefaultBorderDefault: colorPalettePrimary.red600,
102
- actionDangerDefaultBorderHover: colorPalettePrimary.red700,
103
- actionDangerDefaultBorderPress: colorPalettePrimary.red800,
104
- actionDangerDefaultTextDefault: colorPalettePrimary.red600,
105
- actionDangerDefaultTextHover: colorPalettePrimary.red700,
106
- actionDangerDefaultTextPress: colorPalettePrimary.red800,
107
- actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue800).alpha(0).hex(),
108
- actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
109
- actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
110
- actionDefaultBorderDefault: colorPalettePrimary.grey300,
111
- actionDefaultBorderFocus: colorPalettePrimary.blue600,
112
- actionDefaultBorderHover: colorPalettePrimary.blue700,
113
- actionDefaultBorderPress: colorPalettePrimary.blue800,
114
- actionDefaultTextDefault: colorPalettePrimary.grey800,
115
- actionDefaultTextHover: colorPalettePrimary.blue700,
116
- actionDefaultTextPress: colorPalettePrimary.blue800,
117
- actionDisabledBackground: colorPalettePrimary.grey200,
118
- actionDisabledText: colorPalettePrimary.grey400,
119
- actionPrimaryBackgroundDefault: colorPalettePrimary.blue600,
120
- actionPrimaryBackgroundHover: colorPalettePrimary.blue700,
121
- actionPrimaryBackgroundPress: colorPalettePrimary.blue800,
122
- actionPrimaryTextDefault: colorPalettePrimary.white,
123
- actionPrimaryTextHover: colorPalettePrimary.white,
124
- actionPrimaryTextPress: colorPalettePrimary.white,
125
- actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue600).alpha(0).hex(),
126
- actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
127
- actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
128
- actionTertiaryTextDefault: colorPalettePrimary.blue600,
129
- actionTertiaryTextHover: colorPalettePrimary.blue700,
130
- actionTertiaryTextPress: colorPalettePrimary.blue800,
131
- backgroundDanger: chroma(colorPalettePrimary.red100).alpha(0.08).hex(),
132
- backgroundSecondary: colorPalettePrimary.grey100,
133
- backgroundWarning: chroma(colorPalettePrimary.yellow100).alpha(0.08).hex(),
134
- border: colorPalettePrimary.grey300,
135
- borderDecorative: colorPalettePrimary.grey300,
136
- textPrimary: colorPalettePrimary.grey800,
137
- textSecondary: colorPalettePrimary.grey600,
138
- textPlaceholder: colorPalettePrimary.grey400,
139
- textValidationDanger: colorPalettePrimary.red600,
140
- textValidationSuccess: colorPalettePrimary.green600,
141
- textValidationWarning: colorPalettePrimary.yellow600,
142
- overlayOverlay: chroma(colorPalettePrimary.grey100).alpha(0.72).hex(),
143
- // Tags
144
- tagDefault: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
145
- tagBrown: colorPaletteSecondary.brown,
146
- tagCoral: colorPaletteSecondary.coral,
147
- tagCharcoal: colorPalettePrimary.grey600,
148
- tagIndigo: colorPaletteSecondary.indigo,
149
- tagLemon: colorPaletteSecondary.lemon,
150
- tagLime: colorPaletteSecondary.lime,
151
- tagPink: colorPaletteSecondary.pink,
152
- tagPurple: colorPaletteSecondary.purple,
153
- tagTeal: colorPaletteSecondary.teal,
154
- tagTurquoise: colorPaletteSecondary.turquoise,
155
- tagText: colorPalettePrimary.white,
156
- tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
157
- tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
158
- tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
159
- tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
160
- // Typography
161
- typographyCodeBg: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
162
- // Table
163
- tableBorder: colorPalettePrimary.grey200,
164
- tableRowHover: chroma(colorPalettePrimary.grey600).alpha(0.04).hex(),
165
- tooltipBackgroundTooltip: colorPalettePrimary.grey800,
166
- ...unstableColors
167
- };
168
- const darkColorList = {
169
- actionDangerPrimaryBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
170
- actionDangerPrimaryBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
171
- actionDangerPrimaryBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
172
- actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0).hex(),
173
- actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.08).hex(),
174
- actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.16).hex(),
175
- actionDangerDefaultBorderDefault: colorPalettePrimary.red400,
176
- actionDangerDefaultBorderHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
177
- actionDangerDefaultBorderPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
178
- actionDangerDefaultTextDefault: colorPalettePrimary.red400,
179
- actionDangerDefaultTextHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
180
- actionDangerDefaultTextPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
181
- actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
182
- actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
183
- actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
184
- actionDefaultBorderDefault: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
185
- actionDefaultBorderFocus: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
186
- actionDefaultBorderHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
187
- actionDefaultBorderPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
188
- actionDefaultTextDefault: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
189
- actionDefaultTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
190
- actionDefaultTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
191
- actionDisabledBackground: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
192
- actionDisabledText: chroma(colorPalettePrimary.white).alpha(0.4).hex(),
193
- actionPrimaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
194
- actionPrimaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
195
- actionPrimaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
196
- actionPrimaryTextDefault: colorPalettePrimary.grey800,
197
- actionPrimaryTextHover: colorPalettePrimary.grey800,
198
- actionPrimaryTextPress: colorPalettePrimary.grey800,
199
- actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
200
- actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
201
- actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
202
- actionTertiaryTextDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
203
- actionTertiaryTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
204
- actionTertiaryTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
205
- backgroundPrimary: colorPalettePrimary.grey800,
206
- backgroundSecondary: chroma(colorPalettePrimary.white).alpha(0.04).hex(),
207
- border: chroma(colorPalettePrimary.white).alpha(0.48).hex(),
208
- borderDecorative: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
209
- textPrimary: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
210
- textSecondary: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
211
- textPlaceholder: chroma(colorPalettePrimary.grey400).alpha(0.84).hex(),
212
- textValidationDanger: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
213
- textValidationSuccess: chroma(colorPalettePrimary.green400).alpha(0.84).hex(),
214
- textValidationWarning: chroma(colorPalettePrimary.yellow400).alpha(0.84).hex(),
215
- overlayOverlay: chroma(colorPalettePrimary.grey800).alpha(0.72).hex(),
216
- // Tags
217
- tagDefault: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
218
- tagBrown: chroma(colorPaletteSecondary.brown).alpha(0.84).hex(),
219
- tagCoral: chroma(colorPaletteSecondary.coral).alpha(0.84).hex(),
220
- tagCharcoal: chroma(colorPalettePrimary.grey600).alpha(0.84).hex(),
221
- tagIndigo: chroma(colorPaletteSecondary.indigo).alpha(0.84).hex(),
222
- tagLemon: chroma(colorPaletteSecondary.lemon).alpha(0.84).hex(),
223
- tagLime: chroma(colorPaletteSecondary.lime).alpha(0.84).hex(),
224
- tagPink: chroma(colorPaletteSecondary.pink).alpha(0.84).hex(),
225
- tagPurple: chroma(colorPaletteSecondary.purple).alpha(0.84).hex(),
226
- tagTeal: chroma(colorPaletteSecondary.teal).alpha(0.84).hex(),
227
- tagTurquoise: chroma(colorPaletteSecondary.turquoise).alpha(0.84).hex(),
228
- tagText: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
229
- tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
230
- tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
231
- tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
232
- tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
233
- // Typography
234
- typographyCodeBg: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
235
- // Table
236
- tableBorder: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
237
- tableRowHover: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
238
- tooltipBackgroundTooltip: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
239
- // Missing in list
240
- backgroundDanger: 'rgba(200,45,76,0.08)',
241
- backgroundWarning: 'rgba(222,121,33,0.08)',
242
- // Missing in light list
243
- // "background-validation-danger": "rgba(229,110,134,0)",
244
- // "background-validation-warning": "rgba(252,234,202,0)",
245
- ...unstableColors
246
- };
247
-
248
- const darkColors = {
249
- ...darkColorList,
250
- ...colorPalettePrimary,
251
- ...colorPaletteSecondary
252
- };
253
- const lightColors = {
254
- ...lightColorList,
255
- ...colorPalettePrimary,
256
- ...colorPaletteSecondary
257
- };
258
- function getSemanticColors(theme) {
259
- switch (theme) {
260
- case 'dark':
261
- return {
262
- ...darkColors
263
- };
264
- default:
265
- return {
266
- ...lightColors
267
- };
268
- }
269
- }
270
-
271
- // TODO (FEINF-1674): Remove when removing USE_NEW_RADIO_STYLES
272
- /*
273
- Colors that need to be replaced by semantic colors.
274
- */
275
- const deprecatedColors = {
276
- // Radio Colors
277
- radioInteractiveAvailable: colorPalettePrimary.primary,
278
- radioInteractiveHover: '#186099',
279
- radioInteractivePress: '#0D4F85',
280
- radioDisabled: '#A2AEB8',
281
- radioDefaultBorder: '#64727D',
282
- radioDefaultBackground: '#FFFFFF',
283
- radioInteractiveHoverSecondary: 'rgba(34, 115, 181, 0.08)',
284
- // Fade of Interactive Available
285
- radioInteractivePressSecondary: 'rgba(34, 115, 181, 0.16)' // Fade of Interactive Available
286
- };
287
-
288
- function getColors(theme) {
289
- return {
290
- ...deprecatedColors,
291
- ...getSemanticColors(theme)
292
- };
293
- }
294
-
295
- // eslint-disable-next-line import/no-anonymous-default-export
296
- var antdVars = {
297
- // IMPORTANT: Do not read this directly from components. Use `React.useContext`.
298
- 'ant-prefix': 'du-bois'
299
- };
300
-
301
- const DEFAULT_SPACING_UNIT = 8;
302
- const MODAL_PADDING = 40;
303
- const spacing = {
304
- xs: DEFAULT_SPACING_UNIT / 2,
305
- sm: DEFAULT_SPACING_UNIT,
306
- md: DEFAULT_SPACING_UNIT * 2,
307
- lg: DEFAULT_SPACING_UNIT * 3
308
- };
309
-
310
- // Less variables that are used by AntD
311
- ({
312
- defaultPaddingLg: spacing.lg,
313
- defaultPaddingMd: spacing.md,
314
- defaultPaddingSm: spacing.sm,
315
- defaultPaddingXs: spacing.sm,
316
- defaultPaddingXss: spacing.xs,
317
- paddingLg: spacing.md,
318
- // TODO: Check if there is a better alternative with team
319
- paddingMd: spacing.sm,
320
- paddingSm: spacing.sm,
321
- paddingXs: spacing.xs,
322
- paddingXss: 0,
323
- marginSm: 12,
324
- marginLg: spacing.lg,
325
- // Button
326
- btnPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 2,
327
- btnPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 2,
328
- btnPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 2,
329
- // Input
330
- inputPaddingHorizontal: DEFAULT_SPACING_UNIT * 1.5,
331
- inputPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 1.5,
332
- inputPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 1.5,
333
- inputPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 1.5,
334
- inputPaddingVertical: spacing.xs + 1,
335
- inputPaddingVerticalBase: spacing.xs + 1,
336
- inputPaddingVerticalSm: spacing.xs + 1,
337
- inputPaddingVerticalLg: spacing.xs + 1,
338
- // Modal
339
- modalPadding: MODAL_PADDING,
340
- modalLessPadding: MODAL_PADDING - 20,
341
- modalHeaderPadding: "".concat(MODAL_PADDING, "px ").concat(MODAL_PADDING, "px ").concat(MODAL_PADDING - 20, "px"),
342
- modalHeaderCloseSize: MODAL_PADDING * 2 + 22,
343
- modalHeaderBorderWidth: 0,
344
- modalBodyPadding: "0 ".concat(MODAL_PADDING, "px"),
345
- modalFooterPaddingVertical: 0,
346
- modalFooterPaddingHorizontal: 0,
347
- modalFooterBorderWidth: 0,
348
- // Switch
349
- switchPadding: 0,
350
- switchHeight: 16,
351
- switchMinWidth: 28,
352
- switchPinSize: 14
353
- });
354
- var spacing$1 = spacing;
355
-
356
- const heightBase = 40;
357
- const borderWidth = 1;
358
- const antdGeneralVariables = {
359
- classnamePrefix: antdVars['ant-prefix'],
360
- iconfontCssPrefix: 'anticon',
361
- borderRadiusBase: 4,
362
- borderWidth: borderWidth,
363
- heightSm: 32,
364
- heightBase: heightBase,
365
- iconSize: 24,
366
- // TODO (FEINF-1545): Update with icon overhaul to 16px
367
- iconFontSize: 13,
368
- iconFontSizeNew: 16,
369
- buttonHeight: heightBase,
370
- // Height available within button (for label and icon). Same for middle and small buttons.
371
- buttonInnerHeight: heightBase - spacing$1.sm * 2 - borderWidth * 2
372
- };
373
- var generalVariables = antdGeneralVariables;
374
-
375
- const FONT_SIZE_BASE = 13;
376
-
377
- // Less variables that are used by AntD
378
- const antdTypography = {
379
- fontSizeSm: 12,
380
- fontSizeBase: FONT_SIZE_BASE,
381
- fontSizeMd: FONT_SIZE_BASE,
382
- fontSizeLg: 18,
383
- fontSizeXl: 22,
384
- fontSizeXxl: 32,
385
- lineHeightSm: '16px',
386
- lineHeightBase: '20px',
387
- lineHeightMd: '20px',
388
- lineHeightLg: '24px',
389
- lineHeightXl: '28px',
390
- lineHeightXxl: '40px',
391
- typographyBoldFontWeight: 600
392
- };
393
-
394
- // eslint-disable-next-line import/no-anonymous-default-export
395
- var typography = {
396
- ...antdTypography
397
- };
398
-
399
- // TODO(giles): fix this
400
- // eslint-disable-next-line import/no-named-as-default
401
-
402
- const defaultOptions = {
403
- enableAnimation: false,
404
- zIndexBase: 1000
405
- };
406
-
407
- // Function to get variables for a certain theme.
408
- // End users should use useDesignSystemTheme instead.
409
- function getTheme(themeName) {
410
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
411
- return {
412
- colors: getColors(themeName),
413
- spacing: spacing$1,
414
- general: generalVariables,
415
- typography,
416
- borders: borders$1,
417
- themeName,
418
- options
419
- };
420
- }
421
-
422
- const themeNameToAntdName = {
423
- dark: 'dark',
424
- default: 'light'
425
- };
426
- function getClassNamePrefix(theme) {
427
- const antdThemeName = themeNameToAntdName[theme.themeName];
428
- return "".concat(theme.general.classnamePrefix, "-").concat(antdThemeName);
429
- }
430
- function getPrefixedClassNameFromTheme(theme, className) {
431
- return [getClassNamePrefix(theme), className].filter(Boolean).join('-');
432
- }
433
- function useDesignSystemTheme() {
434
- const emotionTheme = useTheme();
435
- // Graceful fallback to default theme in case a test or developer forgot context.
436
- const theme = emotionTheme && emotionTheme.general ? emotionTheme : getTheme('default');
437
- return {
438
- theme: theme,
439
- classNamePrefix: getClassNamePrefix(theme),
440
- getPrefixedClassName: className => getPrefixedClassNameFromTheme(theme, className)
441
- };
442
- }
443
- // This is a simple typed HOC wrapper around the useDesignSystemTheme hook, for use in older react components.
444
- function WithDesignSystemThemeHoc(Component) {
445
- return function WrappedWithDesignSystemTheme(props) {
446
- const themeValues = useDesignSystemTheme();
447
- return jsx(Component, {
448
- ...props,
449
- designSystemThemeApi: themeValues
450
- });
451
- };
452
- }
453
-
454
- const DuboisContextDefaults = {
455
- enableAnimation: false,
456
- theme: 'default',
457
- // Prefer to use useDesignSystemTheme.getPrefixedClassName instead
458
- getPrefixCls: suffix => suffix ? "du-bois-".concat(suffix) : 'du-bois',
459
- flags: {}
460
- };
461
- const DesignSystemContext = /*#__PURE__*/createContext(DuboisContextDefaults);
462
- const DU_BOIS_ENABLE_ANIMATION_CLASSNAME = 'du-bois-enable-animation';
463
- function getAnimationCss(enableAnimation) {
464
- const disableAnimationCss = {
465
- animationDuration: '0s !important',
466
- transition: 'none !important'
467
- };
468
- return enableAnimation ? {} : {
469
- // Apply to the current element
470
- ...disableAnimationCss,
471
- '&::before': disableAnimationCss,
472
- '&::after': disableAnimationCss,
473
- // Also apply to all child elements with a class that starts with our prefix
474
- ["[class*=du-bois]:not(.".concat(DU_BOIS_ENABLE_ANIMATION_CLASSNAME, ", .").concat(DU_BOIS_ENABLE_ANIMATION_CLASSNAME, " *)")]: {
475
- ...disableAnimationCss,
476
- // Also target any pseudo-elements associated with those elements, since these can also be animated.
477
- '&::before': disableAnimationCss,
478
- '&::after': disableAnimationCss
479
- }
480
- };
481
- }
482
- const DesignSystemProviderPropsContext = /*#__PURE__*/React__default.createContext(null);
483
- const AntDConfigProviderPropsContext = /*#__PURE__*/React__default.createContext(null);
484
- const DesignSystemProvider = _ref => {
485
- let {
486
- children,
487
- theme: themeName,
488
- enableAnimation = false,
489
- zIndexBase = 1000,
490
- getPopupContainer,
491
- flags = {}
492
- } = _ref;
493
- const theme = useMemo(() => getTheme(themeName || 'default', {
494
- enableAnimation,
495
- zIndexBase
496
- }),
497
- // TODO: revisit this
498
- // eslint-disable-next-line react-hooks/exhaustive-deps
499
- [themeName, zIndexBase]);
500
- const providerPropsContext = useMemo(() => ({
501
- theme: themeName,
502
- enableAnimation,
503
- zIndexBase,
504
- getPopupContainer,
505
- flags
506
- }), [themeName, enableAnimation, zIndexBase, getPopupContainer, flags]);
507
- const classNamePrefix = getClassNamePrefix(theme);
508
- const value = useMemo(() => {
509
- return {
510
- enableAnimation,
511
- theme: theme.themeName,
512
- getPrefixCls: suffix => getPrefixedClassNameFromTheme(theme, suffix),
513
- getPopupContainer,
514
- flags
515
- };
516
- }, [enableAnimation, theme, getPopupContainer, flags]);
517
- useEffect(() => {
518
- return () => {
519
- // when the design system context is unmounted, make sure the notification cache is also cleaned up
520
- notification.destroy();
521
- };
522
- }, []);
523
- return jsx(DesignSystemProviderPropsContext.Provider, {
524
- value: providerPropsContext,
525
- children: jsx(ThemeProvider, {
526
- theme: theme,
527
- children: jsx(AntDConfigProviderPropsContext.Provider, {
528
- value: {
529
- prefixCls: classNamePrefix,
530
- getPopupContainer
531
- },
532
- children: jsx(DesignSystemContext.Provider, {
533
- value: value,
534
- children: children
535
- })
536
- })
537
- })
538
- });
539
- };
540
- const ApplyDesignSystemContextOverrides = _ref2 => {
541
- let {
542
- theme,
543
- enableAnimation,
544
- zIndexBase,
545
- getPopupContainer,
546
- flags,
547
- children
548
- } = _ref2;
549
- const parentDesignSystemProviderProps = useContext(DesignSystemProviderPropsContext);
550
- if (parentDesignSystemProviderProps === null) {
551
- throw new Error("ApplyDesignSystemContextOverrides cannot be used standalone - DesignSystemProvider must exist in the React context");
552
- }
553
- const newProps = useMemo(() => ({
554
- ...parentDesignSystemProviderProps,
555
- theme: theme !== null && theme !== void 0 ? theme : parentDesignSystemProviderProps.theme,
556
- enableAnimation: enableAnimation !== null && enableAnimation !== void 0 ? enableAnimation : parentDesignSystemProviderProps.enableAnimation,
557
- zIndexBase: zIndexBase !== null && zIndexBase !== void 0 ? zIndexBase : parentDesignSystemProviderProps.zIndexBase,
558
- getPopupContainer: getPopupContainer !== null && getPopupContainer !== void 0 ? getPopupContainer : parentDesignSystemProviderProps.getPopupContainer,
559
- flags: {
560
- ...parentDesignSystemProviderProps.flags,
561
- ...flags
562
- }
563
- }), [parentDesignSystemProviderProps, theme, enableAnimation, zIndexBase, getPopupContainer, flags]);
564
- return jsx(DesignSystemProvider, {
565
- ...newProps,
566
- children: children
567
- });
568
- };
569
-
570
- // This is a more-specific version of `ApplyDesignSystemContextOverrides` that only allows overriding the flags.
571
- const ApplyDesignSystemFlags = _ref3 => {
572
- let {
573
- flags,
574
- children
575
- } = _ref3;
576
- const parentDesignSystemProviderProps = useContext(DesignSystemProviderPropsContext);
577
- if (parentDesignSystemProviderProps === null) {
578
- throw new Error("ApplyDesignSystemFlags cannot be used standalone - DesignSystemProvider must exist in the React context");
579
- }
580
- const newProps = useMemo(() => ({
581
- ...parentDesignSystemProviderProps,
582
- flags: {
583
- ...parentDesignSystemProviderProps.flags,
584
- ...flags
585
- }
586
- }), [parentDesignSystemProviderProps, flags]);
587
- return jsx(DesignSystemProvider, {
588
- ...newProps,
589
- children: children
590
- });
591
- };
592
- const DesignSystemAntDConfigProvider = _ref4 => {
593
- let {
594
- children
595
- } = _ref4;
596
- const antdContext = useAntDConfigProviderContext();
597
- return jsx(ConfigProvider, {
598
- ...antdContext,
599
- children: children
600
- });
601
- };
602
- const useAntDConfigProviderContext = () => {
603
- var _useContext;
604
- return (_useContext = useContext(AntDConfigProviderPropsContext)) !== null && _useContext !== void 0 ? _useContext : {
605
- prefixCls: undefined
606
- };
607
- };
608
-
609
- /**
610
- * When using AntD components inside Design System wrapper components (e.g. Modal, Collapse etc),
611
- * we don't want Design System's prefix class to override them.
612
- *
613
- * Since all Design System's components have are wrapped with DesignSystemAntDConfigProvider,
614
- * this won't affect their own prefixCls, but just allow nested antd components to keep their ant prefix.
615
- */
616
- const RestoreAntDDefaultClsPrefix = _ref5 => {
617
- let {
618
- children
619
- } = _ref5;
620
- return jsx(ConfigProvider, {
621
- prefixCls: "ant",
622
- children: children
623
- });
624
- };
625
-
626
- function useDesignSystemContext() {
627
- return useContext(DesignSystemContext);
628
- }
629
-
630
- function useDesignSystemFlags() {
631
- const context = useDesignSystemContext();
632
- return context.flags;
633
- }
634
-
635
- const getIconEmotionStyles = (theme, useNewIcons) => {
636
- return /*#__PURE__*/css({
637
- ...(useNewIcons && {
638
- fontSize: theme.general.iconFontSizeNew
639
- })
640
- }, process.env.NODE_ENV === "production" ? "" : ";label:getIconEmotionStyles;");
641
- };
642
- const getIconValidationColor = (theme, color) => {
643
- switch (color) {
644
- case 'success':
645
- return theme.colors.textValidationSuccess;
646
- case 'warning':
647
- return theme.colors.textValidationWarning;
648
- case 'danger':
649
- return theme.colors.textValidationDanger;
650
- default:
651
- return color;
652
- }
653
- };
654
- const Icon = props => {
655
- const {
656
- component: Component,
657
- dangerouslySetAntdProps,
658
- color,
659
- style,
660
- ...otherProps
661
- } = props;
662
- const {
663
- theme
664
- } = useDesignSystemTheme();
665
- const {
666
- USE_NEW_ICONS
667
- } = useDesignSystemFlags();
668
- const MemoizedComponent = useMemo(() => Component ? _ref => {
669
- let {
670
- fill,
671
- ...iconProps
672
- } = _ref;
673
- return (
674
- // We don't rely on top-level fills for our colors. Fills are specified
675
- // with "currentColor" on children of the top-most svg.
676
- jsx(Component, {
677
- fill: "none",
678
- ...iconProps
679
- })
680
- );
681
- } : undefined, [Component]);
682
- return jsx(DesignSystemAntDConfigProvider, {
683
- children: jsx(AntDIcon, {
684
- css: getIconEmotionStyles(theme, USE_NEW_ICONS),
685
- component: MemoizedComponent,
686
- style: {
687
- color: getIconValidationColor(theme, color),
688
- ...style
689
- },
690
- ...otherProps,
691
- ...dangerouslySetAntdProps
692
- })
693
- });
694
- };
695
-
696
- function SvgNewWindowIconV1(props) {
697
- return jsx("svg", {
698
- width: "1em",
699
- height: "1em",
700
- viewBox: "0 0 24 24",
701
- fill: "none",
702
- xmlns: "http://www.w3.org/2000/svg",
703
- ...props,
704
- children: jsx("path", {
705
- fillRule: "evenodd",
706
- clipRule: "evenodd",
707
- d: "M5 18c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-5c0-.55.45-1 1-1s1 .45 1 1v6c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5a2 2 0 012-2h6c.55 0 1 .45 1 1s-.45 1-1 1H6c-.55 0-1 .45-1 1v12zM15 5c-.55 0-1-.45-1-1s.45-1 1-1h5c.55 0 1 .45 1 1v5c0 .55-.45 1-1 1s-1-.45-1-1V6.41l-9.13 9.13a.996.996 0 11-1.41-1.41L17.59 5H15z",
708
- fill: "currentColor"
709
- })
710
- });
711
- }
712
- function SvgNewWindowIconV2(props) {
713
- return jsxs("svg", {
714
- width: "1em",
715
- height: "1em",
716
- viewBox: "0 0 16 16",
717
- fill: "none",
718
- xmlns: "http://www.w3.org/2000/svg",
719
- ...props,
720
- children: [jsx("path", {
721
- d: "M10 1h5v5h-1.5V3.56L8.53 8.53 7.47 7.47l4.97-4.97H10V1z",
722
- fill: "currentColor"
723
- }), jsx("path", {
724
- d: "M1 2.75A.75.75 0 011.75 2H8v1.5H2.5v10h10V8H14v6.25a.75.75 0 01-.75.75H1.75a.75.75 0 01-.75-.75V2.75z",
725
- fill: "currentColor"
726
- })]
727
- });
728
- }
729
- function NewWindowIcon(props) {
730
- const {
731
- USE_NEW_ICONS
732
- } = useDesignSystemFlags();
733
- const component = USE_NEW_ICONS ? SvgNewWindowIconV2 : SvgNewWindowIconV1;
734
- return jsx(Icon, {
735
- ...props,
736
- component: component
737
- });
738
- }
739
-
740
- const ColorVars = {
741
- primary: 'textPrimary',
742
- secondary: 'textSecondary',
743
- info: 'textValidationInfo',
744
- error: 'textValidationDanger',
745
- success: 'textValidationSuccess',
746
- warning: 'textValidationWarning'
747
- };
748
-
749
- /**
750
- * Recursively appends `!important` to all CSS properties in an Emotion `CSSObject`.
751
- * Used to ensure that we always override Ant styles, without worrying about selector precedence.
752
- */
753
- function importantify(obj) {
754
- return _mapValues(obj, (value, key) => {
755
- if (_isString(value) || _isNumber(value) || _isBoolean(value)) {
756
- // Make sure we don't double-append important
757
- if (_isString(value) && _endsWith(value, '!important')) {
758
- return value;
759
- }
760
- if (_isNumber(value)) {
761
- if (unitless[key]) {
762
- return "".concat(value, "!important");
763
- }
764
- return "".concat(value, "px!important");
765
- }
766
- return "".concat(value, "!important");
767
- }
768
- if (_isNil(value)) {
769
- return value;
770
- }
771
- return importantify(value);
772
- });
773
- }
774
-
775
- /**
776
- * Returns a text color, in case of invalid/missing key and missing fallback color it will return textPrimary
777
- * @param theme
778
- * @param key - key of TypographyColor
779
- * @param fallbackColor - color to return as fallback -- used to remove tertiary check inline
780
- */
781
- function getTypographyColor(theme, key, fallbackColor) {
782
- if (theme && key && Object(theme.colors).hasOwnProperty(ColorVars[key])) {
783
- return theme.colors[ColorVars[key]];
784
- }
785
- return fallbackColor !== null && fallbackColor !== void 0 ? fallbackColor : theme.colors.textPrimary;
786
- }
787
-
788
- /**
789
- * Returns validation color based on state, has default validation colors if params are not provided
790
- * @param theme
791
- * @param validationState
792
- * @param errorColor
793
- * @param warningColor
794
- * @param successColor
795
- */
796
- function getValidationStateColor(theme, validationState) {
797
- let {
798
- errorColor,
799
- warningColor,
800
- successColor
801
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
802
- switch (validationState) {
803
- case 'error':
804
- return errorColor || theme.colors.actionDangerPrimaryBackgroundDefault;
805
- case 'warning':
806
- return warningColor || theme.colors.textValidationWarning;
807
- case 'success':
808
- return successColor || theme.colors.textValidationSuccess;
809
- default:
810
- return undefined;
811
- }
812
- }
813
-
814
- const getLinkStyles = (theme, clsPrefix, useNewIcons) => {
815
- const classTypography = ".".concat(clsPrefix, "-typography");
816
- const styles = {
817
- ["&".concat(classTypography, ", &").concat(classTypography, ":focus")]: {
818
- color: theme.colors.actionTertiaryTextDefault
819
- },
820
- ["&".concat(classTypography, ":hover, &").concat(classTypography, ":hover .anticon")]: {
821
- color: theme.colors.actionTertiaryTextHover,
822
- textDecoration: 'underline'
823
- },
824
- ["&".concat(classTypography, ":active, &").concat(classTypography, ":active .anticon")]: {
825
- color: theme.colors.actionTertiaryTextPress,
826
- textDecoration: 'underline'
827
- },
828
- ["&".concat(classTypography, ":focus-visible")]: {
829
- textDecoration: 'underline'
830
- },
831
- ...(useNewIcons && {
832
- '.anticon': {
833
- fontSize: 12
834
- }
835
- })
836
- };
837
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getLinkStyles;");
838
- };
839
- const getEllipsisNewTabLinkStyles = () => {
840
- const styles = {
841
- paddingRight: 'calc(2px + 1em)',
842
- // 1em for icon
843
- position: 'relative'
844
- };
845
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisNewTabLinkStyles;");
846
- };
847
- const getIconStyles = theme => {
848
- const styles = {
849
- marginLeft: 2,
850
- color: theme.colors.actionTertiaryTextDefault
851
- };
852
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getIconStyles;");
853
- };
854
- const getEllipsisIconStyles = useNewIcons => {
855
- const styles = {
856
- position: 'absolute',
857
- right: 0,
858
- bottom: 0,
859
- top: 0,
860
- display: 'flex',
861
- alignItems: 'center',
862
- ...(useNewIcons && {
863
- fontSize: 12
864
- })
865
- };
866
- return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisIconStyles;");
867
- };
868
- function Link(_ref) {
869
- let {
870
- dangerouslySetAntdProps,
871
- ...props
872
- } = _ref;
873
- const {
874
- children,
875
- openInNewTab,
876
- ...restProps
877
- } = props;
878
- const {
879
- theme,
880
- classNamePrefix
881
- } = useDesignSystemTheme();
882
- const {
883
- USE_NEW_ICONS: useNewIcons
884
- } = useDesignSystemFlags();
885
- const newTabProps = {
886
- rel: 'noopener noreferrer',
887
- target: '_blank'
888
- };
889
- const linkProps = openInNewTab ? {
890
- ...restProps,
891
- ...newTabProps
892
- } : {
893
- ...restProps
894
- };
895
- const linkStyles = props.ellipsis && openInNewTab ? [getLinkStyles(theme, classNamePrefix, useNewIcons), getEllipsisNewTabLinkStyles()] : getLinkStyles(theme, classNamePrefix, useNewIcons);
896
- const iconStyles = props.ellipsis ? [getIconStyles(theme), getEllipsisIconStyles()] : getIconStyles(theme);
897
- return jsx(DesignSystemAntDConfigProvider, {
898
- children: jsxs(Typography$1.Link, {
899
- css: linkStyles,
900
- ...linkProps,
901
- ...dangerouslySetAntdProps,
902
- children: [children, openInNewTab ? jsx(NewWindowIcon, {
903
- css: iconStyles,
904
- ...newTabProps
905
- }) : null]
906
- })
907
- });
908
- }
909
-
910
- const {
911
- Paragraph: AntDParagraph
912
- } = Typography$1;
913
- function getParagraphEmotionStyles(theme, props) {
914
- return /*#__PURE__*/css({
915
- '&&': {
916
- fontSize: theme.typography.fontSizeBase,
917
- lineHeight: theme.typography.lineHeightBase,
918
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
919
- }
920
- }, props.disabled && {
921
- '&&': {
922
- color: theme.colors.actionDisabledText
923
- }
924
- }, props.withoutMargins && {
925
- '&&': {
926
- marginTop: 0,
927
- marginBottom: 0
928
- }
929
- }, process.env.NODE_ENV === "production" ? "" : ";label:getParagraphEmotionStyles;");
930
- }
931
- function Paragraph(userProps) {
932
- const {
933
- dangerouslySetAntdProps,
934
- withoutMargins,
935
- color,
936
- ...props
937
- } = userProps;
938
- const {
939
- theme
940
- } = useDesignSystemTheme();
941
- return jsx(DesignSystemAntDConfigProvider, {
942
- children: jsx(AntDParagraph, {
943
- ...props,
944
- className: props.className,
945
- css: getParagraphEmotionStyles(theme, userProps),
946
- ...dangerouslySetAntdProps
947
- })
948
- });
949
- }
950
-
951
- const {
952
- Text: AntDText
953
- } = Typography$1;
954
- function getTextEmotionStyles(theme, props) {
955
- return /*#__PURE__*/css({
956
- '&&': {
957
- fontSize: theme.typography.fontSizeBase,
958
- lineHeight: theme.typography.lineHeightBase,
959
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
960
- }
961
- }, props.disabled && {
962
- '&&': {
963
- color: theme.colors.actionDisabledText
964
- }
965
- }, props.hint && {
966
- '&&': {
967
- fontSize: theme.typography.fontSizeSm,
968
- lineHeight: theme.typography.lineHeightSm
969
- }
970
- }, props.bold && {
971
- '&&': {
972
- fontSize: theme.typography.fontSizeBase,
973
- fontWeight: theme.typography.typographyBoldFontWeight,
974
- lineHeight: theme.typography.lineHeightBase
975
- }
976
- }, props.code && {
977
- '&& > code': {
978
- fontSize: theme.typography.fontSizeBase,
979
- lineHeight: theme.typography.lineHeightBase,
980
- fontWeight: theme.typography.typographyBoldFontWeight,
981
- background: theme.colors.typographyCodeBg,
982
- fontFamily: 'monospace',
983
- borderRadius: theme.borders.borderRadiusMd,
984
- padding: '2px 4px',
985
- border: 'unset',
986
- margin: 0
987
- }
988
- }, props.size && {
989
- '&&': (() => {
990
- switch (props.size) {
991
- case 'xxl':
992
- return {
993
- fontSize: theme.typography.fontSizeXxl,
994
- lineHeight: theme.typography.lineHeightXxl
995
- };
996
- case 'xl':
997
- return {
998
- fontSize: theme.typography.fontSizeXl,
999
- lineHeight: theme.typography.lineHeightXl
1000
- };
1001
- case 'lg':
1002
- return {
1003
- fontSize: theme.typography.fontSizeLg,
1004
- lineHeight: theme.typography.lineHeightLg
1005
- };
1006
- case 'sm':
1007
- return {
1008
- fontSize: theme.typography.fontSizeSm,
1009
- lineHeight: theme.typography.lineHeightSm
1010
- };
1011
- default:
1012
- return {
1013
- fontSize: theme.typography.fontSizeMd,
1014
- lineHeight: theme.typography.lineHeightMd
1015
- };
1016
- }
1017
- })()
1018
- }, props.withoutMargins && {
1019
- '&&': {
1020
- marginTop: 0,
1021
- marginBottom: 0
1022
- }
1023
- }, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
1024
- }
1025
- function Text(userProps) {
1026
- // Omit props that are not supported by `antd`
1027
- const {
1028
- dangerouslySetAntdProps,
1029
- bold,
1030
- hint,
1031
- withoutMargins,
1032
- color,
1033
- ...props
1034
- } = userProps;
1035
- const {
1036
- theme
1037
- } = useDesignSystemTheme();
1038
- return jsx(DesignSystemAntDConfigProvider, {
1039
- children: jsx(AntDText, {
1040
- ...props,
1041
- className: props.className,
1042
- css: getTextEmotionStyles(theme, userProps),
1043
- ...dangerouslySetAntdProps
1044
- })
1045
- });
1046
- }
1047
-
1048
- const {
1049
- Title: AntDTitle
1050
- } = Typography$1;
1051
- function getLevelStyles(theme, props) {
1052
- switch (props.level) {
1053
- case 1:
1054
- return /*#__PURE__*/css({
1055
- '&&': {
1056
- fontSize: theme.typography.fontSizeXxl,
1057
- lineHeight: theme.typography.lineHeightXxl,
1058
- fontWeight: theme.typography.typographyBoldFontWeight
1059
- }
1060
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1061
- case 2:
1062
- return /*#__PURE__*/css({
1063
- '&&': {
1064
- fontSize: theme.typography.fontSizeXl,
1065
- lineHeight: theme.typography.lineHeightXl,
1066
- fontWeight: theme.typography.typographyBoldFontWeight
1067
- }
1068
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1069
- case 3:
1070
- return /*#__PURE__*/css({
1071
- '&&': {
1072
- fontSize: theme.typography.fontSizeLg,
1073
- lineHeight: theme.typography.lineHeightLg,
1074
- fontWeight: theme.typography.typographyBoldFontWeight
1075
- }
1076
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1077
- case 4:
1078
- default:
1079
- return /*#__PURE__*/css({
1080
- '&&': {
1081
- fontSize: theme.typography.fontSizeMd,
1082
- lineHeight: theme.typography.lineHeightMd,
1083
- fontWeight: theme.typography.typographyBoldFontWeight
1084
- }
1085
- }, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
1086
- }
1087
- }
1088
- function getTitleEmotionStyles(theme, props) {
1089
- return /*#__PURE__*/css(getLevelStyles(theme, props), {
1090
- '&&': {
1091
- color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
1092
- }
1093
- }, props.withoutMargins && {
1094
- '&&': {
1095
- marginTop: '0 !important',
1096
- // override general styling
1097
- marginBottom: '0 !important' // override general styling
1098
- }
1099
- }, process.env.NODE_ENV === "production" ? "" : ";label:getTitleEmotionStyles;");
1100
- }
1101
- function Title(userProps) {
1102
- const {
1103
- dangerouslySetAntdProps,
1104
- withoutMargins,
1105
- color,
1106
- ...props
1107
- } = userProps;
1108
- const {
1109
- theme
1110
- } = useDesignSystemTheme();
1111
- return jsx(DesignSystemAntDConfigProvider, {
1112
- children: jsx(AntDTitle, {
1113
- ...props,
1114
- className: props.className,
1115
- css: getTitleEmotionStyles(theme, userProps),
1116
- ...dangerouslySetAntdProps
1117
- })
1118
- });
1119
- }
1120
-
1121
- const Typography = /* #__PURE__ */(() => {
1122
- function Typography(_ref) {
1123
- let {
1124
- dangerouslySetAntdProps,
1125
- ...props
1126
- } = _ref;
1127
- return jsx(DesignSystemAntDConfigProvider, {
1128
- children: jsx(Typography$1, {
1129
- ...props,
1130
- ...dangerouslySetAntdProps
1131
- })
1132
- });
1133
- }
1134
- Typography.Text = Text;
1135
- Typography.Title = Title;
1136
- Typography.Paragraph = Paragraph;
1137
- Typography.Link = Link;
1138
- return Typography;
1139
- })();
1140
-
1141
- export { ApplyDesignSystemContextOverrides as A, DesignSystemAntDConfigProvider as D, Icon as I, NewWindowIcon as N, RestoreAntDDefaultClsPrefix as R, Typography as T, WithDesignSystemThemeHoc as W, useDesignSystemFlags as a, useDesignSystemContext as b, getValidationStateColor as c, Title as d, DU_BOIS_ENABLE_ANIMATION_CLASSNAME as e, DesignSystemContext as f, getAnimationCss as g, DesignSystemProvider as h, importantify as i, ApplyDesignSystemFlags as j, useAntDConfigProviderContext as k, lightColorList as l, useDesignSystemTheme as u };
1142
- //# sourceMappingURL=Typography-52abe0b7.js.map