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

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
@@ -0,0 +1 @@
1
+ export * from './useStatusIndicatorModel';
@@ -0,0 +1,29 @@
1
+ import {createModelHook} from '@workday/canvas-kit-react/common';
2
+
3
+ export type StatusIndicatorVariant = 'gray' | 'orange' | 'blue' | 'green' | 'red' | 'transparent';
4
+
5
+ export type StatusIndicatorEmphasis = 'high' | 'low';
6
+
7
+ export const useStatusIndicatorModel = createModelHook({
8
+ defaultConfig: {
9
+ /**
10
+ * Defines the emphasis of the `StatusIndicator`.
11
+ * `high` emphasis will create more contrast between the background and text colors.
12
+ * `low` emphasis will create less contrast between the background and text colors.
13
+ * @default 'low'
14
+ */
15
+
16
+ emphasis: 'low' as StatusIndicatorEmphasis,
17
+ /**
18
+ * Defines the color of the `StatusIndicator`.
19
+ * @default 'gray'
20
+ */
21
+ variant: 'gray' as StatusIndicatorVariant,
22
+ },
23
+ })(config => {
24
+ const state = {
25
+ ...config,
26
+ };
27
+
28
+ return {state, events: {}};
29
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../dist/commonjs/status-indicator",
3
+ "module": "../dist/es6/status-indicator",
4
+ "sideEffects": false,
5
+ "types": "../dist/es6/status-indicator"
6
+ }
@@ -15,7 +15,6 @@ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
15
15
  import {useTextInputModel} from '@workday/canvas-kit-preview-react/text-input';
16
16
 
17
17
  const baseStyles: CSSProperties = {
18
- ...type.levels.subtext.large,
19
18
  transition: '0.2s box-shadow, 0.2s border-color',
20
19
  resize: 'both',
21
20
  '&::webkit-resizer': {
@@ -59,6 +58,7 @@ export const TextAreaField = createSubcomponent('textarea')({
59
58
  return (
60
59
  <FormField.Input
61
60
  as={Element}
61
+ {...type.levels.subtext.large}
62
62
  css={[baseStyles, focusStyles]}
63
63
  {...elemProps}
64
64
  border={`1px solid ${inputColors.border}`}
@@ -16,7 +16,6 @@ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
16
16
  import {useTextInputField, useTextInputModel} from './hooks';
17
17
 
18
18
  const baseStyles: CSSProperties = {
19
- ...type.levels.subtext.large,
20
19
  transition: '0.2s box-shadow, 0.2s border-color',
21
20
  '&::placeholder': {
22
21
  color: inputColors.placeholder,
@@ -60,6 +59,7 @@ export const TextInputField = createSubcomponent('input')({
60
59
  return (
61
60
  <FormField.Input
62
61
  as="input"
62
+ {...type.levels.subtext.large}
63
63
  css={[baseStyles, focusStyles]}
64
64
  padding={space.xxs}
65
65
  margin={0}
@@ -1,7 +0,0 @@
1
- # Canvas Kit Breadcrumbs
2
-
3
- View the
4
- [documentation for Breadcrumbs](https://workday.github.io/canvas-kit/?path=/docs/preview-breadcrumbs-react--page)
5
- on Storybook.
6
-
7
- [> Workday Design Reference](https://design.workday.com/components/navigation/breadcrumbs)
@@ -1,5 +0,0 @@
1
- import {Breadcrumbs} from './lib/Breadcrumbs';
2
-
3
- export default Breadcrumbs;
4
- export {Breadcrumbs};
5
- export * from './lib/Breadcrumbs';
@@ -1,85 +0,0 @@
1
- import React from 'react';
2
- import {BaseButton} from '@workday/canvas-kit-react/button';
3
- import {relatedActionsIcon} from '@workday/canvas-system-icons-web';
4
- import {CanvasSystemIcon} from '@workday/design-assets-types';
5
- import {createComponent, EmotionCanvasTheme, useTheme} from '@workday/canvas-kit-react/common';
6
- import {colors, space} from '@workday/canvas-kit-react/tokens';
7
-
8
- export interface DropdownButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
9
- /**
10
- * The accessibility label for the button
11
- */
12
- 'aria-label': string;
13
- /**
14
- * The Canvas System Icon for the button
15
- *
16
- * @default relatedActionsIcon
17
- */
18
- buttonIcon?: CanvasSystemIcon;
19
- /**
20
- * The boolean to determine whether the button should be in a 'toggled' state
21
- */
22
- toggled: boolean;
23
- }
24
-
25
- export const DropdownButton = createComponent('button')({
26
- displayName: 'DropdownButton',
27
- Component: (
28
- {buttonIcon = relatedActionsIcon, toggled, ...elemProps}: DropdownButtonProps,
29
- ref,
30
- Element
31
- ) => {
32
- const theme = useTheme();
33
- return (
34
- <BaseButton
35
- as={Element}
36
- ref={ref}
37
- aria-pressed={undefined} // removing aria-pressed from button and opting for aria-expanded
38
- aria-expanded={toggled}
39
- aria-haspopup
40
- aria-controls="menu"
41
- size="small"
42
- height={space.l}
43
- width={space.l}
44
- padding={space.zero}
45
- colors={getDropdownColors(toggled, theme)}
46
- {...elemProps}
47
- >
48
- <BaseButton.Icon icon={buttonIcon} />
49
- </BaseButton>
50
- );
51
- },
52
- });
53
-
54
- const getDropdownColors = (toggled: boolean, theme: EmotionCanvasTheme) => {
55
- const {
56
- canvas: {
57
- palette: {primary: themePrimary},
58
- },
59
- } = theme;
60
-
61
- return {
62
- default: {
63
- icon: toggled ? themePrimary.main : colors.blackPepper400,
64
- label: themePrimary.main,
65
- },
66
- hover: {
67
- background: colors.soap200,
68
- icon: toggled ? themePrimary.dark : colors.blackPepper500,
69
- label: themePrimary.dark,
70
- },
71
- active: {
72
- background: colors.soap300,
73
- icon: toggled ? themePrimary.dark : colors.blackPepper500,
74
- label: themePrimary.dark,
75
- },
76
- focus: {
77
- icon: toggled ? themePrimary.main : colors.blackPepper500,
78
- label: themePrimary.main,
79
- },
80
- disabled: {
81
- icon: toggled ? themePrimary.main : colors.blackPepper400,
82
- label: themePrimary.main,
83
- },
84
- };
85
- };
@@ -1,152 +0,0 @@
1
- import React from 'react';
2
- import {styled} from '@workday/canvas-kit-react/common';
3
- import {
4
- borderRadius,
5
- colors,
6
- commonColors,
7
- depth,
8
- space,
9
- type,
10
- } from '@workday/canvas-kit-react/tokens';
11
-
12
- // types
13
- import {Breadcrumb} from '../types';
14
- // local components
15
- import {DropdownMenuItemLink} from './MenuItemLink';
16
- import {Box, BoxProps} from '@workday/canvas-kit-react/layout';
17
-
18
- export interface DropdownMenuProps {
19
- /**
20
- * The active dropdown item in the menu
21
- */
22
- activeDropdownItem: Breadcrumb;
23
- /**
24
- * The HTML `id` of the element that labels the Menu. It should match the id of the menu button.
25
- */
26
- 'aria-labelledby': string;
27
- /**
28
- * An array of Breadcrumb items to render in the dropdown menu
29
- */
30
- dropdownItems: Breadcrumb[];
31
- /**
32
- * A function to set the active dropdown item
33
- */
34
- setActiveDropdownItem: React.Dispatch<React.SetStateAction<Breadcrumb>>;
35
- /**
36
- * The ref of the rendered HTMLAnchorElement
37
- */
38
- activeDropdownItemRef: React.RefObject<HTMLAnchorElement>;
39
- /**
40
- * A function to return the focus to the dropdown button
41
- */
42
- resetFocus: () => void;
43
- /**
44
- * A function to toggle the focus to the previous list item
45
- */
46
- toggleActiveItemUp: () => void;
47
- /**
48
- * A function to toggle the focus to the next list item
49
- */
50
- toggleActiveItemDown: () => void;
51
- }
52
-
53
- const StyledDropdownMenu = styled(Box)<BoxProps>({
54
- ...type.levels.subtext.large,
55
- ...depth[3],
56
- backgroundColor: commonColors.background,
57
- border: `1px solid ${colors.soap500}`,
58
- borderRadius: borderRadius.m,
59
- boxSizing: 'border-box',
60
- display: 'inline-block',
61
- marginTop: space.xxxs,
62
- maxHeight: 200,
63
- outline: 'none',
64
- overflowY: 'auto',
65
- position: 'relative',
66
- width: 'max-content',
67
- });
68
-
69
- const StyledMenuList = styled('ul')({
70
- boxSizing: 'border-box',
71
- listStyle: 'none',
72
- margin: `${space.xxs} 0`,
73
- padding: 0,
74
- width: 280,
75
- wordBreak: 'break-word',
76
- wordWrap: 'break-word', // Needed for IE11
77
- });
78
-
79
- const MenuList = (elemProps: React.HTMLAttributes<HTMLUListElement>) => {
80
- return <StyledMenuList role="menu" {...elemProps} />;
81
- };
82
-
83
- export const DropdownMenu = ({
84
- activeDropdownItemRef,
85
- activeDropdownItem,
86
- dropdownItems = [],
87
- resetFocus,
88
- setActiveDropdownItem,
89
- toggleActiveItemDown,
90
- toggleActiveItemUp,
91
- ...elemProps
92
- }: DropdownMenuProps) => {
93
- const handleItemKeyUp = (event: React.KeyboardEvent<HTMLLIElement>) => {
94
- switch (event.key) {
95
- case 'ArrowUp':
96
- case 'Up': // IE/Edge specific value
97
- case 'ArrowLeft':
98
- case 'Left': // IE/Edge specific value
99
- toggleActiveItemUp();
100
- break;
101
- case 'ArrowDown':
102
- case 'Down': // IE/Edge specific value
103
- case 'ArrowRight':
104
- case 'Right': // IE/Edge specific value
105
- toggleActiveItemDown();
106
- break;
107
- default:
108
- break;
109
- }
110
- };
111
-
112
- const handleItemKeyDown = (event: React.KeyboardEvent<HTMLLIElement>, item: Breadcrumb) => {
113
- switch (event.key) {
114
- case 'Tab':
115
- event.preventDefault();
116
- break;
117
- case 'Enter':
118
- event.preventDefault();
119
- if (item.onAction) {
120
- item.onAction(item.link);
121
- resetFocus();
122
- break;
123
- }
124
- window.location.href = item.link;
125
- break;
126
- default:
127
- break;
128
- }
129
- };
130
-
131
- return (
132
- <StyledDropdownMenu>
133
- <MenuList {...elemProps}>
134
- {dropdownItems.map((item, i) => {
135
- const {index, link, text, ...elemProps} = item;
136
- const isFocused = index === activeDropdownItem.index;
137
- return (
138
- <li onKeyUp={handleItemKeyUp} onKeyDown={e => handleItemKeyDown(e, item)} key={i}>
139
- <DropdownMenuItemLink
140
- ref={isFocused ? activeDropdownItemRef : null}
141
- href={link}
142
- {...elemProps}
143
- >
144
- {text}
145
- </DropdownMenuItemLink>
146
- </li>
147
- );
148
- })}
149
- </MenuList>
150
- </StyledDropdownMenu>
151
- );
152
- };
@@ -1,63 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import {styled} from '@workday/canvas-kit-react/common';
3
- import {colors, commonColors, type, typeColors, space} from '@workday/canvas-kit-react/tokens';
4
-
5
- interface DropdownMenuItemLinkProps extends React.HTMLAttributes<HTMLAnchorElement> {
6
- /**
7
- * The href url of the anchor tag
8
- */
9
- href: string;
10
- /**
11
- * A handler function for overriding hard-redirects with links
12
- */
13
- onAction?: (href: string) => void;
14
- }
15
-
16
- const MenuItemLink = styled('a')({
17
- ...type.levels.subtext.large,
18
- boxSizing: 'border-box',
19
- textAlign: 'left',
20
- color: colors.blackPepper300,
21
- cursor: 'pointer',
22
- display: 'block',
23
- outline: 'none',
24
- padding: `${space.xxs} ${space.s}`,
25
- textDecoration: 'none',
26
- transition: 'background-color color 80ms',
27
- '&:hover': {
28
- backgroundColor: commonColors.hoverBackground,
29
- },
30
- '&:focus': {
31
- backgroundColor: commonColors.focusBackground,
32
- color: typeColors.inverse,
33
- outline: 'none',
34
- },
35
- });
36
-
37
- export const DropdownMenuItemLink = forwardRef(
38
- (
39
- {children, href, onAction, onClick, ...elemProps}: DropdownMenuItemLinkProps,
40
- ref: React.Ref<HTMLAnchorElement>
41
- ) => {
42
- const handleClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
43
- event.preventDefault();
44
- // allow an override to the hard redirect
45
- if (onAction) {
46
- onAction(href);
47
- } else {
48
- // default to hard redirecting
49
- window.location.href = href;
50
- }
51
- // don't block the onClick event if it's provided
52
- if (onClick) {
53
- onClick(event);
54
- }
55
- };
56
-
57
- return (
58
- <MenuItemLink ref={ref} href={href} role="menuitem" onClick={handleClick} {...elemProps}>
59
- {children}
60
- </MenuItemLink>
61
- );
62
- }
63
- );
@@ -1,109 +0,0 @@
1
- import {useState, useLayoutEffect} from 'react';
2
- import {useUniqueId, changeFocus} from '@workday/canvas-kit-react/common';
3
- import {
4
- useCloseOnOutsideClick,
5
- useCloseOnEscape,
6
- usePopupModel,
7
- useReturnFocus,
8
- usePopupTarget,
9
- usePopupPopper,
10
- } from '@workday/canvas-kit-react/popup';
11
-
12
- import {DropdownButtonProps} from './Button';
13
- import {DropdownMenuProps} from './Menu';
14
- import {Breadcrumb} from '../types';
15
-
16
- export const useFocusActiveItemElement = <E extends HTMLElement>(
17
- activeDropdownItemRef: React.RefObject<E>
18
- ) => {
19
- useLayoutEffect(() => {
20
- if (activeDropdownItemRef.current) {
21
- return activeDropdownItemRef.current.focus();
22
- }
23
- });
24
- };
25
-
26
- const initialActiveItem = {
27
- index: 0,
28
- link: '',
29
- text: '',
30
- width: 0,
31
- } as Breadcrumb;
32
-
33
- interface UseDropdown {
34
- dropdownButtonProps: Omit<DropdownButtonProps, 'aria-label'>;
35
- dropdownMenuProps: DropdownMenuProps;
36
- popperProps: ReturnType<typeof usePopupPopper>;
37
- }
38
-
39
- export const useDropdown = (
40
- activeDropdownItemRef: React.RefObject<HTMLAnchorElement>,
41
- items: Breadcrumb[],
42
- buttonId?: string
43
- ): UseDropdown => {
44
- // state
45
- const [activeDropdownItem, setActiveDropdownItem] = useState(initialActiveItem);
46
- // behaviors
47
- const model = usePopupModel({
48
- initialFocusRef: activeDropdownItemRef,
49
- });
50
-
51
- useCloseOnOutsideClick(model);
52
- useCloseOnEscape(model);
53
- useReturnFocus(model);
54
- useFocusActiveItemElement(activeDropdownItemRef);
55
-
56
- const handleButtonKeyUp = (e: React.KeyboardEvent<HTMLButtonElement>) => {
57
- if (e.key === 'Enter') {
58
- setActiveDropdownItem(items[0]);
59
- }
60
- };
61
-
62
- const resetMenuFocus = () => {
63
- model.events.hide();
64
- changeFocus(model.state.targetRef.current);
65
- };
66
-
67
- const findActiveDropdownItemByIndex = (index: number) => {
68
- return items.filter(item => item.index === index)[0];
69
- };
70
-
71
- const toggleActiveItemUp = () => {
72
- const previousItem = findActiveDropdownItemByIndex(activeDropdownItem.index - 1);
73
- if (!previousItem) {
74
- return resetMenuFocus();
75
- }
76
- return setActiveDropdownItem(previousItem);
77
- };
78
-
79
- const toggleActiveItemDown = () => {
80
- const nextItem = findActiveDropdownItemByIndex(activeDropdownItem.index + 1);
81
- if (!nextItem) {
82
- return setActiveDropdownItem(items[0]);
83
- }
84
- return setActiveDropdownItem(nextItem);
85
- };
86
-
87
- const uniqueButtonId = useUniqueId(buttonId);
88
-
89
- const dropdownButtonProps = usePopupTarget(model, {
90
- id: uniqueButtonId,
91
- toggled: model.state.visibility !== 'hidden',
92
- onKeyUp: handleButtonKeyUp,
93
- });
94
-
95
- const dropdownMenuProps = {
96
- 'aria-labelledby': uniqueButtonId,
97
- dropdownItems: items,
98
- activeDropdownItem,
99
- activeDropdownItemRef,
100
- setActiveDropdownItem,
101
- resetFocus: resetMenuFocus,
102
- toggleActiveItemUp,
103
- toggleActiveItemDown,
104
- };
105
-
106
- const popperProps = usePopupPopper(model);
107
-
108
- return {dropdownButtonProps, dropdownMenuProps, popperProps};
109
- };
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import {Breadcrumb} from '../types';
3
- import {Popper} from '@workday/canvas-kit-react/popup';
4
-
5
- import {useRTL} from '../hooks';
6
- import {useDropdown} from './hooks';
7
- import {DropdownButton, DropdownButtonProps} from './Button';
8
- import {DropdownMenu} from './Menu';
9
-
10
- export interface DropdownProps extends Pick<DropdownButtonProps, 'buttonIcon'> {
11
- buttonAriaLabel: string;
12
- items?: Breadcrumb[];
13
- }
14
-
15
- export const Dropdown = ({buttonAriaLabel, buttonIcon, items = []}: DropdownProps) => {
16
- // refs
17
- const activeDropdownItemRef = React.useRef<HTMLAnchorElement>(null);
18
- // behaviors
19
- const {dropdownButtonProps, dropdownMenuProps, popperProps} = useDropdown(
20
- activeDropdownItemRef,
21
- items
22
- );
23
- const {shouldUseRTL} = useRTL();
24
- const placement = shouldUseRTL ? 'bottom-end' : 'bottom-start';
25
-
26
- return (
27
- <>
28
- <DropdownButton
29
- aria-label={buttonAriaLabel}
30
- buttonIcon={buttonIcon}
31
- {...dropdownButtonProps}
32
- />
33
- <Popper placement={placement} {...popperProps}>
34
- <DropdownMenu {...dropdownMenuProps} />
35
- </Popper>
36
- </>
37
- );
38
- };
@@ -1,66 +0,0 @@
1
- import React, {Children, useRef} from 'react';
2
- // local components
3
- import {Dropdown} from '../Dropdown';
4
- import {BreadcrumbsListItem} from './ListItem';
5
- import {BreadcrumbsList} from './index';
6
- // hooks
7
- import {useBuildCollapsedList, useCollapse} from './hooks';
8
- import {DropdownButtonProps} from '../Dropdown/Button';
9
-
10
- const parseListItems = (children: React.ReactNode) => {
11
- const childArray = Children.toArray(children);
12
- const {0: rootItem, length, [length - 1]: currentItem} = childArray;
13
- const collapsibleItems = childArray.slice(1, -1);
14
- return {rootItem, collapsibleItems, currentItem};
15
- };
16
-
17
- export interface CollapsibleListProps
18
- extends React.HTMLAttributes<HTMLUListElement>,
19
- Pick<DropdownButtonProps, 'buttonIcon'> {
20
- /**
21
- * The accessibility label for the dropdown menu button.
22
- *
23
- * Suggested value: "more links"
24
- */
25
- buttonAriaLabel: string;
26
- /**
27
- * The max-width before the list should collapse and render a dropdown menu
28
- */
29
- maxWidth: number;
30
- }
31
-
32
- export const CollapsibleList = ({
33
- children,
34
- buttonIcon,
35
- buttonAriaLabel,
36
- maxWidth,
37
- ...props
38
- }: CollapsibleListProps) => {
39
- // refs
40
- const listRef = useRef<HTMLUListElement>(null);
41
- // behaviors
42
- const {shouldCollapseList} = useCollapse(listRef, maxWidth);
43
- const {collapsedItems, collapsedItemIndices} = useBuildCollapsedList(listRef, children, maxWidth);
44
- const {rootItem, collapsibleItems, currentItem} = parseListItems(children);
45
- return (
46
- <BreadcrumbsList ref={listRef} {...props}>
47
- {rootItem}
48
- {shouldCollapseList && (
49
- <BreadcrumbsListItem>
50
- <Dropdown
51
- buttonAriaLabel={buttonAriaLabel}
52
- buttonIcon={buttonIcon}
53
- items={collapsedItems}
54
- />
55
- </BreadcrumbsListItem>
56
- )}
57
- {collapsibleItems.map((item, i) => {
58
- if (collapsedItemIndices.indexOf(i + 1) !== -1) {
59
- return;
60
- }
61
- return item;
62
- })}
63
- {currentItem}
64
- </BreadcrumbsList>
65
- );
66
- };
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import {styled} from '@workday/canvas-kit-react/common';
3
- import {type} from '@workday/canvas-kit-react/tokens';
4
- import {TooltipContainer} from '@workday/canvas-kit-react/tooltip';
5
- import {Popper} from '@workday/canvas-kit-react/popup';
6
-
7
- import {useTruncateTooltip} from './hooks';
8
- import {truncateStyles} from './styles';
9
-
10
- export interface CurrentItemProps extends React.HTMLAttributes<HTMLLIElement> {
11
- /**
12
- * The max-width of the text
13
- *
14
- * @default 350px
15
- */
16
- maxWidth?: number;
17
- }
18
-
19
- const ListItem = styled('li')(
20
- {
21
- display: 'flex',
22
- alignItems: 'center',
23
- flexDirection: 'column',
24
- textAlign: 'left',
25
- ...type.levels.subtext.large,
26
- fontWeight: 500,
27
- },
28
-
29
- ({maxWidth}: CurrentItemProps) => ({
30
- ...truncateStyles(maxWidth),
31
- })
32
- );
33
-
34
- export const CurrentItem = ({children, maxWidth, ...elemProps}: CurrentItemProps) => {
35
- const ref = React.useRef<HTMLLIElement>(null);
36
-
37
- const {
38
- isTooltipOpen,
39
- openTooltip,
40
- closeTooltip,
41
- shouldShowTooltip,
42
- tooltipProps,
43
- } = useTruncateTooltip(ref);
44
-
45
- return (
46
- <>
47
- <ListItem
48
- ref={ref}
49
- maxWidth={maxWidth}
50
- onMouseEnter={openTooltip}
51
- onMouseLeave={closeTooltip}
52
- onFocus={openTooltip}
53
- onBlur={closeTooltip}
54
- {...(shouldShowTooltip && {tabIndex: 0})}
55
- {...elemProps}
56
- >
57
- {children}
58
- </ListItem>
59
- <Popper open={isTooltipOpen} anchorElement={ref} placement="top">
60
- <TooltipContainer {...tooltipProps}>{children}</TooltipContainer>
61
- </Popper>
62
- </>
63
- );
64
- };