@workday/canvas-kit-preview-react 8.0.0 → 8.0.2

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 (354) hide show
  1. package/color-picker/README.md +1 -1
  2. package/color-picker/index.ts +1 -1
  3. package/color-picker/lib/ColorPicker.tsx +2 -3
  4. package/dist/commonjs/color-picker/index.d.ts +1 -1
  5. package/dist/commonjs/color-picker/index.d.ts.map +1 -1
  6. package/dist/commonjs/color-picker/index.js +2 -6
  7. package/dist/commonjs/color-picker/lib/ColorPicker.d.ts +1 -2
  8. package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
  9. package/dist/commonjs/color-picker/lib/ColorPicker.js +5 -4
  10. package/dist/commonjs/form-field/lib/FormField.d.ts +2 -11
  11. package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
  12. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +1 -1
  13. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
  14. package/dist/commonjs/form-field/lib/FormFieldHint.js +2 -3
  15. package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +1 -1
  16. package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  17. package/dist/commonjs/form-field/lib/FormFieldLabel.js +3 -9
  18. package/dist/commonjs/index.d.ts +2 -1
  19. package/dist/commonjs/index.d.ts.map +1 -1
  20. package/dist/commonjs/index.js +2 -2
  21. package/dist/commonjs/menu/index.d.ts +1 -4
  22. package/dist/commonjs/menu/index.d.ts.map +1 -1
  23. package/dist/commonjs/menu/index.js +1 -9
  24. package/dist/commonjs/menu/lib/Menu.d.ts +37 -13
  25. package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
  26. package/dist/commonjs/menu/lib/Menu.js +43 -22
  27. package/dist/commonjs/menu/lib/MenuItem.d.ts +35 -14
  28. package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
  29. package/dist/commonjs/menu/lib/MenuItem.js +24 -9
  30. package/dist/commonjs/pill/lib/Pill.d.ts +0 -10
  31. package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
  32. package/dist/commonjs/segmented-control/index.d.ts +3 -0
  33. package/dist/commonjs/segmented-control/index.d.ts.map +1 -0
  34. package/dist/commonjs/{breadcrumbs → segmented-control}/index.js +2 -5
  35. package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +1004 -0
  36. package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
  37. package/dist/commonjs/segmented-control/lib/SegmentedControl.js +22 -0
  38. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts +103 -0
  39. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
  40. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +130 -0
  41. package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts +66 -0
  42. package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
  43. package/dist/commonjs/{breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js → segmented-control/lib/SegmentedControlList.js} +21 -28
  44. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +60 -0
  45. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
  46. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +23 -0
  47. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1052 -0
  48. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
  49. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +74 -0
  50. package/dist/commonjs/select/index.d.ts +0 -3
  51. package/dist/commonjs/select/index.d.ts.map +1 -1
  52. package/dist/commonjs/select/index.js +0 -7
  53. package/dist/commonjs/select/lib/Select.d.ts +0 -1
  54. package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
  55. package/dist/commonjs/select/lib/Select.js +2 -6
  56. package/dist/commonjs/select/lib/SelectBase.d.ts +2 -2
  57. package/dist/commonjs/select/lib/SelectBase.d.ts.map +1 -1
  58. package/dist/commonjs/select/lib/SelectBase.js +6 -9
  59. package/dist/commonjs/select/lib/SelectMenu.d.ts +2 -2
  60. package/dist/commonjs/select/lib/SelectMenu.d.ts.map +1 -1
  61. package/dist/commonjs/select/lib/SelectMenu.js +2 -2
  62. package/dist/commonjs/select/lib/SelectOption.d.ts +1 -2
  63. package/dist/commonjs/select/lib/SelectOption.d.ts.map +1 -1
  64. package/dist/commonjs/select/lib/SelectOption.js +2 -1
  65. package/dist/commonjs/side-panel/index.d.ts +0 -3
  66. package/dist/commonjs/side-panel/index.d.ts.map +1 -1
  67. package/dist/commonjs/side-panel/index.js +0 -7
  68. package/dist/commonjs/side-panel/lib/SidePanel.d.ts +1 -2
  69. package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -1
  70. package/dist/commonjs/side-panel/lib/SidePanel.js +3 -3
  71. package/dist/commonjs/status-indicator/index.d.ts +2 -0
  72. package/dist/commonjs/status-indicator/index.d.ts.map +1 -0
  73. package/dist/commonjs/status-indicator/index.js +13 -0
  74. package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +42 -0
  75. package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
  76. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +55 -0
  77. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts +73 -0
  78. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
  79. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +98 -0
  80. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
  81. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
  82. package/dist/commonjs/{breadcrumbs/lib/Breadcrumbs/List/index.js → status-indicator/lib/StatusIndicatorLabel.js} +6 -6
  83. package/dist/commonjs/status-indicator/lib/hooks/index.d.ts +2 -0
  84. package/dist/commonjs/status-indicator/lib/hooks/index.d.ts.map +1 -0
  85. package/dist/commonjs/status-indicator/lib/hooks/index.js +13 -0
  86. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
  87. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
  88. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +34 -0
  89. package/dist/commonjs/text-area/lib/TextArea.d.ts +2 -11
  90. package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
  91. package/dist/commonjs/text-area/lib/TextAreaField.d.ts +1 -1
  92. package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
  93. package/dist/commonjs/text-area/lib/TextAreaField.js +15 -7
  94. package/dist/commonjs/text-input/lib/TextInput.d.ts +2 -11
  95. package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
  96. package/dist/commonjs/text-input/lib/TextInputField.d.ts +1 -1
  97. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
  98. package/dist/commonjs/text-input/lib/TextInputField.js +14 -7
  99. package/dist/es6/color-picker/index.d.ts +1 -1
  100. package/dist/es6/color-picker/index.d.ts.map +1 -1
  101. package/dist/es6/color-picker/index.js +1 -1
  102. package/dist/es6/color-picker/lib/ColorPicker.d.ts +1 -2
  103. package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
  104. package/dist/es6/color-picker/lib/ColorPicker.js +2 -3
  105. package/dist/es6/form-field/lib/FormField.d.ts +2 -11
  106. package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
  107. package/dist/es6/form-field/lib/FormFieldHint.d.ts +1 -1
  108. package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
  109. package/dist/es6/form-field/lib/FormFieldHint.js +4 -5
  110. package/dist/es6/form-field/lib/FormFieldInput.d.ts +1 -1
  111. package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  112. package/dist/es6/form-field/lib/FormFieldLabel.js +5 -11
  113. package/dist/es6/index.d.ts +2 -1
  114. package/dist/es6/index.d.ts.map +1 -1
  115. package/dist/es6/index.js +2 -2
  116. package/dist/es6/menu/index.d.ts +1 -4
  117. package/dist/es6/menu/index.d.ts.map +1 -1
  118. package/dist/es6/menu/index.js +1 -4
  119. package/dist/es6/menu/lib/Menu.d.ts +37 -13
  120. package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
  121. package/dist/es6/menu/lib/Menu.js +42 -22
  122. package/dist/es6/menu/lib/MenuItem.d.ts +35 -14
  123. package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
  124. package/dist/es6/menu/lib/MenuItem.js +23 -9
  125. package/dist/es6/pill/lib/Pill.d.ts +6 -16
  126. package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
  127. package/dist/es6/pill/lib/PillAvatar.d.ts +1 -2
  128. package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -1
  129. package/dist/es6/pill/lib/PillIcon.d.ts +1 -2
  130. package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -1
  131. package/dist/es6/pill/lib/PillIconButton.d.ts +1 -2
  132. package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
  133. package/dist/es6/pill/lib/PillLabel.d.ts +1 -2
  134. package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -1
  135. package/dist/es6/pill/lib/usePillModel.d.ts +5 -5
  136. package/dist/es6/segmented-control/index.d.ts +3 -0
  137. package/dist/es6/segmented-control/index.d.ts.map +1 -0
  138. package/dist/es6/segmented-control/index.js +2 -0
  139. package/dist/es6/segmented-control/lib/SegmentedControl.d.ts +1004 -0
  140. package/dist/es6/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
  141. package/dist/es6/segmented-control/lib/SegmentedControl.js +16 -0
  142. package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts +103 -0
  143. package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
  144. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +108 -0
  145. package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts +66 -0
  146. package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
  147. package/dist/es6/segmented-control/lib/SegmentedControlList.js +44 -0
  148. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +60 -0
  149. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
  150. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +20 -0
  151. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1052 -0
  152. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
  153. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +68 -0
  154. package/dist/es6/select/index.d.ts +0 -3
  155. package/dist/es6/select/index.d.ts.map +1 -1
  156. package/dist/es6/select/index.js +0 -3
  157. package/dist/es6/select/lib/Select.d.ts +0 -1
  158. package/dist/es6/select/lib/Select.d.ts.map +1 -1
  159. package/dist/es6/select/lib/Select.js +1 -2
  160. package/dist/es6/select/lib/SelectBase.d.ts +2 -2
  161. package/dist/es6/select/lib/SelectBase.d.ts.map +1 -1
  162. package/dist/es6/select/lib/SelectBase.js +3 -4
  163. package/dist/es6/select/lib/SelectMenu.d.ts +2 -2
  164. package/dist/es6/select/lib/SelectMenu.d.ts.map +1 -1
  165. package/dist/es6/select/lib/SelectMenu.js +1 -2
  166. package/dist/es6/select/lib/SelectOption.d.ts +1 -2
  167. package/dist/es6/select/lib/SelectOption.d.ts.map +1 -1
  168. package/dist/es6/select/lib/SelectOption.js +1 -2
  169. package/dist/es6/side-panel/index.d.ts +0 -3
  170. package/dist/es6/side-panel/index.d.ts.map +1 -1
  171. package/dist/es6/side-panel/index.js +0 -3
  172. package/dist/es6/side-panel/lib/SidePanel.d.ts +1 -2
  173. package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
  174. package/dist/es6/side-panel/lib/SidePanel.js +1 -2
  175. package/dist/es6/status-indicator/index.d.ts +2 -0
  176. package/dist/es6/status-indicator/index.d.ts.map +1 -0
  177. package/dist/es6/status-indicator/index.js +1 -0
  178. package/dist/es6/status-indicator/lib/StatusIndicator.d.ts +42 -0
  179. package/dist/es6/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
  180. package/dist/es6/status-indicator/lib/StatusIndicator.js +49 -0
  181. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts +73 -0
  182. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
  183. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +92 -0
  184. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
  185. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
  186. package/dist/es6/{breadcrumbs/lib/Breadcrumbs/List/index.js → status-indicator/lib/StatusIndicatorLabel.js} +5 -5
  187. package/dist/es6/status-indicator/lib/hooks/index.d.ts +2 -0
  188. package/dist/es6/status-indicator/lib/hooks/index.d.ts.map +1 -0
  189. package/dist/es6/status-indicator/lib/hooks/index.js +1 -0
  190. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
  191. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
  192. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +31 -0
  193. package/dist/es6/text-area/lib/TextArea.d.ts +2 -11
  194. package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
  195. package/dist/es6/text-area/lib/TextAreaField.d.ts +1 -1
  196. package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
  197. package/dist/es6/text-area/lib/TextAreaField.js +15 -7
  198. package/dist/es6/text-input/lib/TextInput.d.ts +2 -11
  199. package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
  200. package/dist/es6/text-input/lib/TextInputField.d.ts +1 -1
  201. package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
  202. package/dist/es6/text-input/lib/TextInputField.js +14 -7
  203. package/form-field/lib/FormFieldHint.tsx +23 -30
  204. package/form-field/lib/FormFieldLabel.tsx +14 -24
  205. package/index.ts +2 -3
  206. package/menu/index.ts +1 -6
  207. package/menu/lib/Menu.tsx +74 -27
  208. package/menu/lib/MenuItem.tsx +51 -18
  209. package/package.json +7 -6
  210. package/segmented-control/LICENSE +126 -0
  211. package/segmented-control/README.md +6 -0
  212. package/segmented-control/index.ts +2 -0
  213. package/segmented-control/lib/SegmentedControl.tsx +21 -0
  214. package/segmented-control/lib/SegmentedControlItem.tsx +175 -0
  215. package/segmented-control/lib/SegmentedControlList.tsx +49 -0
  216. package/segmented-control/lib/hooks/useSegmentedControlItem.tsx +37 -0
  217. package/segmented-control/lib/hooks/useSegmentedControlModel.tsx +75 -0
  218. package/segmented-control/package.json +6 -0
  219. package/select/README.md +7 -7
  220. package/select/index.ts +0 -4
  221. package/select/lib/Select.tsx +1 -3
  222. package/select/lib/SelectBase.tsx +3 -5
  223. package/select/lib/SelectMenu.tsx +1 -3
  224. package/select/lib/SelectOption.tsx +1 -3
  225. package/side-panel/index.ts +0 -4
  226. package/side-panel/lib/SidePanel.tsx +1 -2
  227. package/{breadcrumbs → status-indicator}/LICENSE +1 -1
  228. package/status-indicator/README.md +12 -0
  229. package/status-indicator/index.ts +1 -0
  230. package/status-indicator/lib/StatusIndicator.tsx +49 -0
  231. package/status-indicator/lib/StatusIndicatorIcon.tsx +88 -0
  232. package/status-indicator/lib/StatusIndicatorLabel.tsx +28 -0
  233. package/status-indicator/lib/hooks/index.ts +1 -0
  234. package/status-indicator/lib/hooks/useStatusIndicatorModel.tsx +29 -0
  235. package/status-indicator/package.json +6 -0
  236. package/text-area/lib/TextAreaField.tsx +1 -1
  237. package/text-input/lib/TextInputField.tsx +1 -1
  238. package/breadcrumbs/README.md +0 -7
  239. package/breadcrumbs/index.ts +0 -5
  240. package/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.tsx +0 -85
  241. package/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.tsx +0 -152
  242. package/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.tsx +0 -63
  243. package/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.ts +0 -109
  244. package/breadcrumbs/lib/Breadcrumbs/Dropdown/index.tsx +0 -38
  245. package/breadcrumbs/lib/Breadcrumbs/List/Collapsible.tsx +0 -66
  246. package/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.tsx +0 -64
  247. package/breadcrumbs/lib/Breadcrumbs/List/Link.tsx +0 -88
  248. package/breadcrumbs/lib/Breadcrumbs/List/ListItem.tsx +0 -30
  249. package/breadcrumbs/lib/Breadcrumbs/List/hooks.ts +0 -114
  250. package/breadcrumbs/lib/Breadcrumbs/List/index.tsx +0 -28
  251. package/breadcrumbs/lib/Breadcrumbs/List/styles.ts +0 -12
  252. package/breadcrumbs/lib/Breadcrumbs/Nav.tsx +0 -14
  253. package/breadcrumbs/lib/Breadcrumbs/hooks.ts +0 -13
  254. package/breadcrumbs/lib/Breadcrumbs/index.tsx +0 -15
  255. package/breadcrumbs/lib/Breadcrumbs/types.ts +0 -7
  256. package/breadcrumbs/package.json +0 -6
  257. package/dist/commonjs/breadcrumbs/index.d.ts +0 -5
  258. package/dist/commonjs/breadcrumbs/index.d.ts.map +0 -1
  259. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
  260. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
  261. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -69
  262. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
  263. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
  264. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -94
  265. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
  266. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
  267. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
  268. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
  269. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -77
  270. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
  271. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
  272. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -37
  273. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
  274. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
  275. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -78
  276. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
  277. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
  278. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -49
  279. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
  280. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
  281. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -66
  282. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
  283. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
  284. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -43
  285. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
  286. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
  287. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -116
  288. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
  289. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
  290. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
  291. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
  292. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -16
  293. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
  294. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
  295. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -34
  296. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
  297. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
  298. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -12
  299. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
  300. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
  301. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.js +0 -17
  302. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
  303. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
  304. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.js +0 -2
  305. package/dist/es6/breadcrumbs/index.d.ts +0 -5
  306. package/dist/es6/breadcrumbs/index.d.ts.map +0 -1
  307. package/dist/es6/breadcrumbs/index.js +0 -4
  308. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
  309. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
  310. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -63
  311. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
  312. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
  313. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -87
  314. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
  315. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
  316. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +0 -51
  317. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
  318. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
  319. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -72
  320. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
  321. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
  322. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -30
  323. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
  324. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
  325. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -55
  326. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
  327. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
  328. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -42
  329. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
  330. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
  331. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -59
  332. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
  333. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
  334. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -36
  335. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
  336. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
  337. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -91
  338. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
  339. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
  340. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
  341. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
  342. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -12
  343. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
  344. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
  345. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -27
  346. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
  347. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
  348. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -8
  349. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
  350. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
  351. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.js +0 -14
  352. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
  353. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
  354. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.js +0 -1
@@ -1,88 +0,0 @@
1
- import React from 'react';
2
- import {styled} from '@workday/canvas-kit-react/common';
3
- import {Hyperlink} from '@workday/canvas-kit-react/button';
4
- import {type} from '@workday/canvas-kit-react/tokens';
5
- import {TooltipContainer} from '@workday/canvas-kit-react/tooltip';
6
- import {Popper} from '@workday/canvas-kit-react/popup';
7
-
8
- import {useTruncateTooltip} from './hooks';
9
- import {truncateStyles} from './styles';
10
-
11
- export interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
12
- /**
13
- * The href url of the anchor tag
14
- */
15
- href: string;
16
- /**
17
- * The max-width of the link text
18
- *
19
- * @default 350px
20
- */
21
- maxWidth?: number;
22
- /**
23
- * A handler function for overriding hard-redirects with links
24
- */
25
- onAction?: (href: string) => void;
26
- }
27
-
28
- type StyledLinkProps = Pick<BreadcrumbLinkProps, 'maxWidth' | 'href'>;
29
-
30
- const {color, ...subtextLargeStyles} = type.levels.subtext.large;
31
-
32
- const StyledLink = styled(Hyperlink)(
33
- {
34
- ...subtextLargeStyles,
35
- },
36
- ({maxWidth}: StyledLinkProps) => ({
37
- ...truncateStyles(maxWidth),
38
- })
39
- );
40
-
41
- export const BreadcrumbLink = ({
42
- maxWidth,
43
- onAction,
44
- onClick,
45
- href,
46
- children,
47
- ...props
48
- }: BreadcrumbLinkProps) => {
49
- const ref = React.useRef<HTMLAnchorElement>(null);
50
- const {isTooltipOpen, openTooltip, closeTooltip, tooltipProps} = useTruncateTooltip(ref);
51
-
52
- const handleClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
53
- event.preventDefault();
54
- // allow an override to the hard redirect
55
- if (onAction) {
56
- onAction(href);
57
- } else {
58
- // default to hard redirecting
59
- window.location.href = href;
60
- }
61
- // don't block the onClick event if it's provided
62
- if (onClick) {
63
- onClick(event);
64
- }
65
- };
66
-
67
- return (
68
- <React.Fragment>
69
- <StyledLink
70
- ref={ref}
71
- maxWidth={maxWidth}
72
- onMouseEnter={openTooltip}
73
- onMouseLeave={closeTooltip}
74
- onFocus={openTooltip}
75
- onBlur={closeTooltip}
76
- href={href}
77
- role="link"
78
- onClick={handleClick}
79
- {...props}
80
- >
81
- {children}
82
- </StyledLink>
83
- <Popper open={isTooltipOpen} anchorElement={ref} placement="top">
84
- <TooltipContainer {...tooltipProps}>{children}</TooltipContainer>
85
- </Popper>
86
- </React.Fragment>
87
- );
88
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import {SystemIcon} from '@workday/canvas-kit-react/icon';
3
- import {chevronLeftSmallIcon, chevronRightSmallIcon} from '@workday/canvas-system-icons-web';
4
- import {colors} from '@workday/canvas-kit-react/tokens';
5
-
6
- import {useRTL} from '../hooks';
7
- import {Flex} from '@workday/canvas-kit-react/layout';
8
-
9
- export type ListItemProps = React.HTMLAttributes<HTMLLIElement>;
10
-
11
- export const BreadcrumbsListItem = ({children, ...props}: ListItemProps) => {
12
- const {shouldUseRTL} = useRTL();
13
- const icon = shouldUseRTL ? chevronLeftSmallIcon : chevronRightSmallIcon;
14
-
15
- return (
16
- <Flex as="li" alignItems="center" {...props}>
17
- {children}
18
- <SystemIcon
19
- icon={icon}
20
- color={colors.licorice200}
21
- colorHover={colors.licorice200}
22
- size={20}
23
- height={32}
24
- width={32}
25
- styles={{justifyContent: 'center', alignItems: 'center', display: 'inline-flex'}}
26
- aria-hidden
27
- />
28
- </Flex>
29
- );
30
- };
@@ -1,114 +0,0 @@
1
- import React, {Children, useLayoutEffect, useState, useEffect} from 'react';
2
-
3
- import {BreadcrumbLink} from './Link';
4
- import {Breadcrumb} from '../types';
5
-
6
- export const useCollapse = <E extends HTMLElement>(listEl: React.RefObject<E>, maxWidth = 0) => {
7
- const [shouldCollapseList, setShouldCollapseList] = useState<boolean>(false);
8
-
9
- useLayoutEffect(() => {
10
- const listWidth = listEl.current?.clientWidth || 0;
11
- setShouldCollapseList(listWidth > maxWidth);
12
- }, [listEl, maxWidth]);
13
-
14
- return {shouldCollapseList};
15
- };
16
-
17
- const getBreadcrumbLink = (breadcrumb: React.ReactElement) => {
18
- return Children.toArray(breadcrumb.props.children).filter(child => {
19
- return React.isValidElement(child) && child.type === BreadcrumbLink;
20
- })[0] as React.ReactElement;
21
- };
22
-
23
- const buildCollapsedList = (
24
- list: Breadcrumb[],
25
- containerWidth: number,
26
- maxWidth: number,
27
- collapsedList: Breadcrumb[] = []
28
- ): Breadcrumb[] => {
29
- // TODO: Calculate expander width dynamically
30
- const EXPANDER_WIDTH = 66;
31
- // recurse over the breadcrumb items until the containerWidth is less than or equal to the maxWidth
32
- if (!list.length || containerWidth + EXPANDER_WIDTH <= maxWidth) {
33
- return collapsedList;
34
- }
35
-
36
- const [firstCrumb, ...restList] = list;
37
- const updatedCollapsedList = collapsedList.concat(firstCrumb);
38
- const adjustedWidth = containerWidth - firstCrumb.width;
39
- return buildCollapsedList(restList, adjustedWidth, maxWidth, updatedCollapsedList);
40
- };
41
-
42
- export const useBuildCollapsedList = <E extends HTMLElement>(
43
- listEl: React.RefObject<E>,
44
- children: React.ReactNode,
45
- maxWidth: number
46
- ) => {
47
- const [collapsedItems, setCollapsedItems] = useState<Breadcrumb[]>([]);
48
-
49
- useLayoutEffect(() => {
50
- const listItemNodes = listEl.current ? listEl.current.querySelectorAll('li') : [];
51
- const containerWidth = listEl.current ? listEl.current.clientWidth : 0;
52
- const listItems: Breadcrumb[] = [];
53
- Children.forEach(children, (child, index) => {
54
- if (!React.isValidElement(child)) {
55
- return;
56
- }
57
- const breadcrumbLink = getBreadcrumbLink(child);
58
- // We should make this match work better
59
- const listItemNode = listItemNodes[index];
60
-
61
- // We might need to allow folks to spread more props from the link
62
- listItems.push({
63
- index: index, // TODO: use unique identifiers instead of indices
64
- link: breadcrumbLink?.props?.href || '',
65
- text: listItemNode ? listItemNode.innerText : '',
66
- width: listItemNode ? listItemNode.clientWidth : 0,
67
- onAction: breadcrumbLink?.props?.onAction,
68
- } as Breadcrumb);
69
- });
70
-
71
- // don't collapse the root breadcrumb
72
- const collapsibleListItems = listItems.slice(1);
73
- const collapsedList = buildCollapsedList(collapsibleListItems, containerWidth, maxWidth);
74
- setCollapsedItems(collapsedList);
75
- // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [maxWidth]);
77
-
78
- const collapsedItemIndices = collapsedItems.map(child => child.index);
79
- return {collapsedItems, collapsedItemIndices};
80
- };
81
-
82
- export const useTruncateTooltip = (ref?: React.RefObject<HTMLSpanElement>) => {
83
- const [isTooltipOpen, setIsTooltipOpen] = useState(false);
84
- const [shouldShowTooltip, setShouldShowTooltip] = useState(false);
85
- useEffect(() => {
86
- if (ref?.current) {
87
- setShouldShowTooltip(ref.current.scrollWidth > ref.current.clientWidth);
88
- }
89
- }, [ref]);
90
-
91
- const openTooltip = (event: React.MouseEvent | React.FocusEvent) => {
92
- const {currentTarget} = event;
93
- // if the target is truncated, show the tooltip
94
- if (currentTarget.scrollWidth > currentTarget.clientWidth) {
95
- setIsTooltipOpen(true);
96
- }
97
- };
98
-
99
- const closeTooltip = () => {
100
- setIsTooltipOpen(false);
101
- };
102
-
103
- const tooltipProps = {
104
- role: 'tooltip',
105
- };
106
-
107
- return {
108
- isTooltipOpen,
109
- openTooltip,
110
- closeTooltip,
111
- shouldShowTooltip,
112
- tooltipProps,
113
- };
114
- };
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import {createComponent} from '@workday/canvas-kit-react/common';
3
- import {Flex} from '@workday/canvas-kit-react/layout';
4
-
5
- export type BreadcrumbsListProps = React.HTMLAttributes<HTMLUListElement>;
6
-
7
- export const BreadcrumbsList = createComponent('ul')({
8
- displayName: 'BreadcrumbsList',
9
- Component: ({children, ...elemProps}: BreadcrumbsListProps, ref) => {
10
- return (
11
- <Flex
12
- padding="zero"
13
- margin="zero"
14
- display="inline-flex"
15
- alignItems="center"
16
- minHeight={40}
17
- listStyle="none"
18
- style={{boxSizing: 'border-box'}}
19
- as="ul"
20
- role="list"
21
- ref={ref}
22
- {...elemProps}
23
- >
24
- {children}
25
- </Flex>
26
- );
27
- },
28
- });
@@ -1,12 +0,0 @@
1
- import {CSSObject} from '@emotion/styled';
2
-
3
- // default max-width for truncating text
4
- const DEFAULT_MAX_WIDTH = 350;
5
-
6
- export const truncateStyles = (maxWidth: number = DEFAULT_MAX_WIDTH): CSSObject => ({
7
- display: 'inline-block',
8
- maxWidth,
9
- overflow: 'hidden',
10
- textOverflow: 'ellipsis',
11
- whiteSpace: 'nowrap',
12
- });
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
-
3
- export interface BreadcrumbsNavProps extends React.HTMLAttributes<HTMLElement> {
4
- /**
5
- * The accessibility label to indicate the type of navigation.
6
- *
7
- * Suggested value: "breadcrumb"
8
- */
9
- 'aria-label': string;
10
- }
11
-
12
- export const BreadcrumbsNav = ({'aria-label': ariaLabel, ...elemProps}: BreadcrumbsNavProps) => {
13
- return <nav role="navigation" aria-label={ariaLabel} {...elemProps} />;
14
- };
@@ -1,13 +0,0 @@
1
- import {
2
- useTheme,
3
- PartialEmotionCanvasTheme,
4
- ContentDirection,
5
- } from '@workday/canvas-kit-react/common';
6
-
7
- export const useRTL = (partialTheme?: PartialEmotionCanvasTheme) => {
8
- const theme = useTheme(partialTheme);
9
- const shouldUseRTL = theme.canvas.direction === ContentDirection.RTL;
10
- return {
11
- shouldUseRTL,
12
- };
13
- };
@@ -1,15 +0,0 @@
1
- import {CurrentItem} from './List/CurrentItem';
2
- import {BreadcrumbLink} from './List/Link';
3
- import {BreadcrumbsNav} from './Nav';
4
- import {CollapsibleList} from './List/Collapsible';
5
- import {BreadcrumbsListItem} from './List/ListItem';
6
- import {BreadcrumbsList} from './List';
7
-
8
- export const Breadcrumbs = {
9
- Nav: BreadcrumbsNav,
10
- CollapsibleList,
11
- List: BreadcrumbsList,
12
- ListItem: BreadcrumbsListItem,
13
- Link: BreadcrumbLink,
14
- CurrentItem,
15
- };
@@ -1,7 +0,0 @@
1
- export interface Breadcrumb extends React.HTMLAttributes<HTMLAnchorElement> {
2
- index: number;
3
- link: string;
4
- text: string;
5
- width: number;
6
- onAction?: (href: string) => void;
7
- }
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../dist/commonjs/breadcrumbs",
3
- "module": "../dist/es6/breadcrumbs",
4
- "sideEffects": false,
5
- "types": "../dist/es6/breadcrumbs"
6
- }
@@ -1,5 +0,0 @@
1
- import { Breadcrumbs } from './lib/Breadcrumbs';
2
- export default Breadcrumbs;
3
- export { Breadcrumbs };
4
- export * from './lib/Breadcrumbs';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../breadcrumbs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAC,WAAW,EAAC,CAAC;AACrB,cAAc,mBAAmB,CAAC"}
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { CanvasSystemIcon } from '@workday/design-assets-types';
3
- export interface DropdownButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
4
- /**
5
- * The accessibility label for the button
6
- */
7
- 'aria-label': string;
8
- /**
9
- * The Canvas System Icon for the button
10
- *
11
- * @default relatedActionsIcon
12
- */
13
- buttonIcon?: CanvasSystemIcon;
14
- /**
15
- * The boolean to determine whether the button should be in a 'toggled' state
16
- */
17
- toggled: boolean;
18
- }
19
- export declare const DropdownButton: import("@workday/canvas-kit-react/common").ElementComponent<"button", DropdownButtonProps>;
20
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../../breadcrumbs/lib/Breadcrumbs/Dropdown/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IAClF;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,4FA2BzB,CAAC"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.DropdownButton = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var button_1 = require("@workday/canvas-kit-react/button");
31
- var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
32
- var common_1 = require("@workday/canvas-kit-react/common");
33
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
34
- exports.DropdownButton = common_1.createComponent('button')({
35
- displayName: 'DropdownButton',
36
- Component: function (_a, ref, Element) {
37
- var _b = _a.buttonIcon, buttonIcon = _b === void 0 ? canvas_system_icons_web_1.relatedActionsIcon : _b, toggled = _a.toggled, elemProps = __rest(_a, ["buttonIcon", "toggled"]);
38
- var theme = common_1.useTheme();
39
- return (react_1.default.createElement(button_1.BaseButton, __assign({ as: Element, ref: ref, "aria-pressed": undefined, "aria-expanded": toggled, "aria-haspopup": true, "aria-controls": "menu", size: "small", height: tokens_1.space.l, width: tokens_1.space.l, padding: tokens_1.space.zero, colors: getDropdownColors(toggled, theme) }, elemProps),
40
- react_1.default.createElement(button_1.BaseButton.Icon, { icon: buttonIcon })));
41
- },
42
- });
43
- var getDropdownColors = function (toggled, theme) {
44
- var themePrimary = theme.canvas.palette.primary;
45
- return {
46
- default: {
47
- icon: toggled ? themePrimary.main : tokens_1.colors.blackPepper400,
48
- label: themePrimary.main,
49
- },
50
- hover: {
51
- background: tokens_1.colors.soap200,
52
- icon: toggled ? themePrimary.dark : tokens_1.colors.blackPepper500,
53
- label: themePrimary.dark,
54
- },
55
- active: {
56
- background: tokens_1.colors.soap300,
57
- icon: toggled ? themePrimary.dark : tokens_1.colors.blackPepper500,
58
- label: themePrimary.dark,
59
- },
60
- focus: {
61
- icon: toggled ? themePrimary.main : tokens_1.colors.blackPepper500,
62
- label: themePrimary.main,
63
- },
64
- disabled: {
65
- icon: toggled ? themePrimary.main : tokens_1.colors.blackPepper400,
66
- label: themePrimary.main,
67
- },
68
- };
69
- };
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { Breadcrumb } from '../types';
3
- export interface DropdownMenuProps {
4
- /**
5
- * The active dropdown item in the menu
6
- */
7
- activeDropdownItem: Breadcrumb;
8
- /**
9
- * The HTML `id` of the element that labels the Menu. It should match the id of the menu button.
10
- */
11
- 'aria-labelledby': string;
12
- /**
13
- * An array of Breadcrumb items to render in the dropdown menu
14
- */
15
- dropdownItems: Breadcrumb[];
16
- /**
17
- * A function to set the active dropdown item
18
- */
19
- setActiveDropdownItem: React.Dispatch<React.SetStateAction<Breadcrumb>>;
20
- /**
21
- * The ref of the rendered HTMLAnchorElement
22
- */
23
- activeDropdownItemRef: React.RefObject<HTMLAnchorElement>;
24
- /**
25
- * A function to return the focus to the dropdown button
26
- */
27
- resetFocus: () => void;
28
- /**
29
- * A function to toggle the focus to the previous list item
30
- */
31
- toggleActiveItemUp: () => void;
32
- /**
33
- * A function to toggle the focus to the next list item
34
- */
35
- toggleActiveItemDown: () => void;
36
- }
37
- export declare const DropdownMenu: ({ activeDropdownItemRef, activeDropdownItem, dropdownItems, resetFocus, setActiveDropdownItem, toggleActiveItemDown, toggleActiveItemUp, ...elemProps }: DropdownMenuProps) => JSX.Element;
38
- //# sourceMappingURL=Menu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../../../breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC;IAC/B;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B;;OAEG;IACH,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE;;OAEG;IACH,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC1D;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAgCD,eAAO,MAAM,YAAY,4JAStB,iBAAiB,gBA4DnB,CAAC"}
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.DropdownMenu = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var common_1 = require("@workday/canvas-kit-react/common");
31
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
32
- // local components
33
- var MenuItemLink_1 = require("./MenuItemLink");
34
- var layout_1 = require("@workday/canvas-kit-react/layout");
35
- var StyledDropdownMenu = common_1.styled(layout_1.Box)(__assign(__assign(__assign({}, tokens_1.type.levels.subtext.large), tokens_1.depth[3]), { backgroundColor: tokens_1.commonColors.background, border: "1px solid " + tokens_1.colors.soap500, borderRadius: tokens_1.borderRadius.m, boxSizing: 'border-box', display: 'inline-block', marginTop: tokens_1.space.xxxs, maxHeight: 200, outline: 'none', overflowY: 'auto', position: 'relative', width: 'max-content' }));
36
- var StyledMenuList = common_1.styled('ul')({
37
- boxSizing: 'border-box',
38
- listStyle: 'none',
39
- margin: tokens_1.space.xxs + " 0",
40
- padding: 0,
41
- width: 280,
42
- wordBreak: 'break-word',
43
- wordWrap: 'break-word',
44
- });
45
- var MenuList = function (elemProps) {
46
- return react_1.default.createElement(StyledMenuList, __assign({ role: "menu" }, elemProps));
47
- };
48
- var DropdownMenu = function (_a) {
49
- var activeDropdownItemRef = _a.activeDropdownItemRef, activeDropdownItem = _a.activeDropdownItem, _b = _a.dropdownItems, dropdownItems = _b === void 0 ? [] : _b, resetFocus = _a.resetFocus, setActiveDropdownItem = _a.setActiveDropdownItem, toggleActiveItemDown = _a.toggleActiveItemDown, toggleActiveItemUp = _a.toggleActiveItemUp, elemProps = __rest(_a, ["activeDropdownItemRef", "activeDropdownItem", "dropdownItems", "resetFocus", "setActiveDropdownItem", "toggleActiveItemDown", "toggleActiveItemUp"]);
50
- var handleItemKeyUp = function (event) {
51
- switch (event.key) {
52
- case 'ArrowUp':
53
- case 'Up': // IE/Edge specific value
54
- case 'ArrowLeft':
55
- case 'Left': // IE/Edge specific value
56
- toggleActiveItemUp();
57
- break;
58
- case 'ArrowDown':
59
- case 'Down': // IE/Edge specific value
60
- case 'ArrowRight':
61
- case 'Right': // IE/Edge specific value
62
- toggleActiveItemDown();
63
- break;
64
- default:
65
- break;
66
- }
67
- };
68
- var handleItemKeyDown = function (event, item) {
69
- switch (event.key) {
70
- case 'Tab':
71
- event.preventDefault();
72
- break;
73
- case 'Enter':
74
- event.preventDefault();
75
- if (item.onAction) {
76
- item.onAction(item.link);
77
- resetFocus();
78
- break;
79
- }
80
- window.location.href = item.link;
81
- break;
82
- default:
83
- break;
84
- }
85
- };
86
- return (react_1.default.createElement(StyledDropdownMenu, null,
87
- react_1.default.createElement(MenuList, __assign({}, elemProps), dropdownItems.map(function (item, i) {
88
- var index = item.index, link = item.link, text = item.text, elemProps = __rest(item, ["index", "link", "text"]);
89
- var isFocused = index === activeDropdownItem.index;
90
- return (react_1.default.createElement("li", { onKeyUp: handleItemKeyUp, onKeyDown: function (e) { return handleItemKeyDown(e, item); }, key: i },
91
- react_1.default.createElement(MenuItemLink_1.DropdownMenuItemLink, __assign({ ref: isFocused ? activeDropdownItemRef : null, href: link }, elemProps), text)));
92
- }))));
93
- };
94
- exports.DropdownMenu = DropdownMenu;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- interface DropdownMenuItemLinkProps extends React.HTMLAttributes<HTMLAnchorElement> {
3
- /**
4
- * The href url of the anchor tag
5
- */
6
- href: string;
7
- /**
8
- * A handler function for overriding hard-redirects with links
9
- */
10
- onAction?: (href: string) => void;
11
- }
12
- export declare const DropdownMenuItemLink: React.ForwardRefExoticComponent<DropdownMenuItemLinkProps & React.RefAttributes<HTMLAnchorElement>>;
13
- export {};
14
- //# sourceMappingURL=MenuItemLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MenuItemLink.d.ts","sourceRoot":"","sources":["../../../../../../breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,UAAU,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IACjF;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAuBD,eAAO,MAAM,oBAAoB,qGA0BhC,CAAC"}
@@ -1,13 +0,0 @@
1
- import { usePopupPopper } from '@workday/canvas-kit-react/popup';
2
- import { DropdownButtonProps } from './Button';
3
- import { DropdownMenuProps } from './Menu';
4
- import { Breadcrumb } from '../types';
5
- export declare const useFocusActiveItemElement: <E extends HTMLElement>(activeDropdownItemRef: import("react").RefObject<E>) => void;
6
- interface UseDropdown {
7
- dropdownButtonProps: Omit<DropdownButtonProps, 'aria-label'>;
8
- dropdownMenuProps: DropdownMenuProps;
9
- popperProps: ReturnType<typeof usePopupPopper>;
10
- }
11
- export declare const useDropdown: (activeDropdownItemRef: React.RefObject<HTMLAnchorElement>, items: Breadcrumb[], buttonId?: string | undefined) => UseDropdown;
12
- export {};
13
- //# sourceMappingURL=hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../../breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,cAAc,EACf,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,yBAAyB,sFAQrC,CAAC;AASF,UAAU,WAAW;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IAC7D,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,WAAW,0BACC,MAAM,SAAS,CAAC,iBAAiB,CAAC,SAClD,UAAU,EAAE,oCAElB,WAkEF,CAAC"}