@workday/canvas-kit-preview-react 7.1.4 → 7.2.0-427-next.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 (541) 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 +3 -4
  4. package/color-picker/package.json +2 -1
  5. package/dist/commonjs/color-picker/index.d.ts +1 -1
  6. package/dist/commonjs/color-picker/index.d.ts.map +1 -1
  7. package/dist/commonjs/color-picker/index.js +2 -6
  8. package/dist/commonjs/color-picker/lib/ColorPicker.d.ts +1 -2
  9. package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
  10. package/dist/commonjs/color-picker/lib/ColorPicker.js +28 -50
  11. package/dist/commonjs/color-picker/lib/parts/ColorReset.js +32 -23
  12. package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +26 -39
  13. package/dist/commonjs/form-field/lib/FormField.d.ts +4 -19
  14. package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
  15. package/dist/commonjs/form-field/lib/FormField.js +10 -33
  16. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +1 -1
  17. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
  18. package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -32
  19. package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +1 -1
  20. package/dist/commonjs/form-field/lib/FormFieldInput.js +6 -17
  21. package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +2 -8
  22. package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  23. package/dist/commonjs/form-field/lib/FormFieldLabel.js +10 -39
  24. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +3 -5
  25. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
  26. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +4 -5
  27. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +3 -5
  28. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
  29. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +5 -6
  30. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +3 -5
  31. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
  32. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +4 -5
  33. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +2 -12
  34. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
  35. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +9 -19
  36. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +4 -4
  37. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
  38. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +5 -5
  39. package/dist/commonjs/index.d.ts +2 -1
  40. package/dist/commonjs/index.d.ts.map +1 -1
  41. package/dist/commonjs/index.js +2 -2
  42. package/dist/commonjs/menu/index.d.ts +1 -4
  43. package/dist/commonjs/menu/index.d.ts.map +1 -1
  44. package/dist/commonjs/menu/index.js +1 -9
  45. package/dist/commonjs/menu/lib/Menu.d.ts +44 -13
  46. package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
  47. package/dist/commonjs/menu/lib/Menu.js +127 -130
  48. package/dist/commonjs/menu/lib/MenuItem.d.ts +45 -14
  49. package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
  50. package/dist/commonjs/menu/lib/MenuItem.js +118 -106
  51. package/dist/commonjs/pill/lib/Pill.d.ts +101 -13
  52. package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
  53. package/dist/commonjs/pill/lib/Pill.js +158 -64
  54. package/dist/commonjs/pill/lib/PillAvatar.js +6 -17
  55. package/dist/commonjs/pill/lib/PillCount.js +7 -30
  56. package/dist/commonjs/pill/lib/PillIcon.js +8 -31
  57. package/dist/commonjs/pill/lib/PillIconButton.js +13 -36
  58. package/dist/commonjs/pill/lib/PillLabel.js +10 -33
  59. package/dist/commonjs/pill/lib/usePillModel.js +8 -16
  60. package/dist/commonjs/segmented-control/index.d.ts +5 -0
  61. package/dist/commonjs/segmented-control/index.d.ts.map +1 -0
  62. package/dist/commonjs/segmented-control/index.js +18 -0
  63. package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +1189 -0
  64. package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
  65. package/dist/commonjs/segmented-control/lib/SegmentedControl.js +57 -0
  66. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts +107 -0
  67. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
  68. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +105 -0
  69. package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts +135 -0
  70. package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
  71. package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +41 -0
  72. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +79 -0
  73. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
  74. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +21 -0
  75. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1202 -0
  76. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
  77. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +75 -0
  78. package/dist/commonjs/select/index.d.ts +0 -3
  79. package/dist/commonjs/select/index.d.ts.map +1 -1
  80. package/dist/commonjs/select/index.js +0 -7
  81. package/dist/commonjs/select/lib/Select.d.ts +0 -1
  82. package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
  83. package/dist/commonjs/select/lib/Select.js +147 -191
  84. package/dist/commonjs/select/lib/SelectBase.d.ts +2 -2
  85. package/dist/commonjs/select/lib/SelectBase.d.ts.map +1 -1
  86. package/dist/commonjs/select/lib/SelectBase.js +109 -107
  87. package/dist/commonjs/select/lib/SelectMenu.d.ts +2 -2
  88. package/dist/commonjs/select/lib/SelectMenu.d.ts.map +1 -1
  89. package/dist/commonjs/select/lib/SelectMenu.js +55 -86
  90. package/dist/commonjs/select/lib/SelectOption.d.ts +1 -2
  91. package/dist/commonjs/select/lib/SelectOption.d.ts.map +1 -1
  92. package/dist/commonjs/select/lib/SelectOption.js +35 -48
  93. package/dist/commonjs/select/lib/scrolling.js +6 -7
  94. package/dist/commonjs/select/lib/utils.js +4 -4
  95. package/dist/commonjs/side-panel/index.d.ts +0 -3
  96. package/dist/commonjs/side-panel/index.d.ts.map +1 -1
  97. package/dist/commonjs/side-panel/index.js +0 -7
  98. package/dist/commonjs/side-panel/lib/SidePanel.d.ts +13 -27
  99. package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -1
  100. package/dist/commonjs/side-panel/lib/SidePanel.js +95 -133
  101. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts +17 -0
  102. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
  103. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +65 -0
  104. package/dist/commonjs/side-panel/lib/hooks.d.ts +20 -0
  105. package/dist/commonjs/side-panel/lib/hooks.d.ts.map +1 -1
  106. package/dist/commonjs/side-panel/lib/hooks.js +40 -21
  107. package/dist/commonjs/status-indicator/index.d.ts +4 -0
  108. package/dist/commonjs/status-indicator/index.d.ts.map +1 -0
  109. package/dist/commonjs/status-indicator/index.js +17 -0
  110. package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +66 -0
  111. package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
  112. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +57 -0
  113. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts +83 -0
  114. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
  115. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +86 -0
  116. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
  117. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
  118. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +15 -0
  119. package/dist/commonjs/status-indicator/lib/hooks/index.d.ts +2 -0
  120. package/dist/commonjs/status-indicator/lib/hooks/index.d.ts.map +1 -0
  121. package/dist/commonjs/{breadcrumbs → status-indicator/lib/hooks}/index.js +1 -5
  122. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
  123. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
  124. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +25 -0
  125. package/dist/commonjs/table/index.d.ts +2 -0
  126. package/dist/commonjs/table/index.d.ts.map +1 -0
  127. package/dist/commonjs/{text-area/lib/hooks → table}/index.js +1 -1
  128. package/dist/commonjs/table/lib/Table.d.ts +207 -0
  129. package/dist/commonjs/table/lib/Table.d.ts.map +1 -0
  130. package/dist/commonjs/table/lib/Table.js +229 -0
  131. package/dist/commonjs/table/lib/TableBody.d.ts +2 -0
  132. package/dist/commonjs/table/lib/TableBody.d.ts.map +1 -0
  133. package/dist/commonjs/table/lib/TableBody.js +35 -0
  134. package/dist/commonjs/table/lib/TableCaption.d.ts +2 -0
  135. package/dist/commonjs/table/lib/TableCaption.d.ts.map +1 -0
  136. package/dist/commonjs/table/lib/TableCaption.js +16 -0
  137. package/dist/commonjs/table/lib/TableCell.d.ts +2 -0
  138. package/dist/commonjs/table/lib/TableCell.d.ts.map +1 -0
  139. package/dist/commonjs/table/lib/TableCell.js +16 -0
  140. package/dist/commonjs/table/lib/TableFooter.d.ts +2 -0
  141. package/dist/commonjs/table/lib/TableFooter.d.ts.map +1 -0
  142. package/dist/commonjs/table/lib/TableFooter.js +15 -0
  143. package/dist/commonjs/table/lib/TableHead.d.ts +2 -0
  144. package/dist/commonjs/table/lib/TableHead.d.ts.map +1 -0
  145. package/dist/commonjs/table/lib/TableHead.js +23 -0
  146. package/dist/commonjs/table/lib/TableHeader.d.ts +2 -0
  147. package/dist/commonjs/table/lib/TableHeader.d.ts.map +1 -0
  148. package/dist/commonjs/table/lib/TableHeader.js +16 -0
  149. package/dist/commonjs/table/lib/TableRow.d.ts +2 -0
  150. package/dist/commonjs/table/lib/TableRow.d.ts.map +1 -0
  151. package/dist/commonjs/table/lib/TableRow.js +19 -0
  152. package/dist/commonjs/text-area/lib/TextArea.d.ts +3 -12
  153. package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
  154. package/dist/commonjs/text-area/lib/TextArea.js +9 -33
  155. package/dist/commonjs/text-area/lib/TextAreaField.d.ts +2 -2
  156. package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
  157. package/dist/commonjs/text-area/lib/TextAreaField.js +25 -41
  158. package/dist/commonjs/text-input/lib/TextInput.d.ts +5 -14
  159. package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
  160. package/dist/commonjs/text-input/lib/TextInput.js +9 -33
  161. package/dist/commonjs/text-input/lib/TextInputField.d.ts +2 -2
  162. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
  163. package/dist/commonjs/text-input/lib/TextInputField.js +25 -30
  164. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +3 -5
  165. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
  166. package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -3
  167. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +1 -0
  168. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
  169. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +2 -1
  170. package/dist/es6/color-picker/index.d.ts +1 -1
  171. package/dist/es6/color-picker/index.d.ts.map +1 -1
  172. package/dist/es6/color-picker/index.js +1 -1
  173. package/dist/es6/color-picker/lib/ColorPicker.d.ts +1 -2
  174. package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
  175. package/dist/es6/color-picker/lib/ColorPicker.js +17 -41
  176. package/dist/es6/color-picker/lib/parts/ColorReset.js +27 -18
  177. package/dist/es6/color-picker/lib/parts/SwatchBook.js +21 -34
  178. package/dist/es6/form-field/lib/FormField.d.ts +4 -19
  179. package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
  180. package/dist/es6/form-field/lib/FormField.js +5 -28
  181. package/dist/es6/form-field/lib/FormFieldHint.d.ts +1 -1
  182. package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
  183. package/dist/es6/form-field/lib/FormFieldHint.js +7 -31
  184. package/dist/es6/form-field/lib/FormFieldInput.d.ts +1 -1
  185. package/dist/es6/form-field/lib/FormFieldInput.js +3 -14
  186. package/dist/es6/form-field/lib/FormFieldLabel.d.ts +2 -8
  187. package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  188. package/dist/es6/form-field/lib/FormFieldLabel.js +9 -38
  189. package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +3 -5
  190. package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
  191. package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +2 -3
  192. package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +3 -5
  193. package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
  194. package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -4
  195. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +3 -5
  196. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
  197. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +2 -3
  198. package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +2 -12
  199. package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
  200. package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +9 -19
  201. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +4 -4
  202. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
  203. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +4 -4
  204. package/dist/es6/index.d.ts +2 -1
  205. package/dist/es6/index.d.ts.map +1 -1
  206. package/dist/es6/index.js +2 -2
  207. package/dist/es6/menu/index.d.ts +1 -4
  208. package/dist/es6/menu/index.d.ts.map +1 -1
  209. package/dist/es6/menu/index.js +1 -4
  210. package/dist/es6/menu/lib/Menu.d.ts +44 -13
  211. package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
  212. package/dist/es6/menu/lib/Menu.js +120 -125
  213. package/dist/es6/menu/lib/MenuItem.d.ts +45 -14
  214. package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
  215. package/dist/es6/menu/lib/MenuItem.js +112 -102
  216. package/dist/es6/pill/lib/Pill.d.ts +107 -19
  217. package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
  218. package/dist/es6/pill/lib/Pill.js +149 -55
  219. package/dist/es6/pill/lib/PillAvatar.d.ts +1 -2
  220. package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -1
  221. package/dist/es6/pill/lib/PillAvatar.js +3 -14
  222. package/dist/es6/pill/lib/PillCount.js +4 -27
  223. package/dist/es6/pill/lib/PillIcon.d.ts +1 -2
  224. package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -1
  225. package/dist/es6/pill/lib/PillIcon.js +3 -26
  226. package/dist/es6/pill/lib/PillIconButton.d.ts +1 -2
  227. package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
  228. package/dist/es6/pill/lib/PillIconButton.js +7 -30
  229. package/dist/es6/pill/lib/PillLabel.d.ts +1 -2
  230. package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -1
  231. package/dist/es6/pill/lib/PillLabel.js +5 -28
  232. package/dist/es6/pill/lib/usePillModel.d.ts +5 -5
  233. package/dist/es6/pill/lib/usePillModel.js +8 -16
  234. package/dist/es6/segmented-control/index.d.ts +5 -0
  235. package/dist/es6/segmented-control/index.d.ts.map +1 -0
  236. package/dist/es6/segmented-control/index.js +4 -0
  237. package/dist/es6/segmented-control/lib/SegmentedControl.d.ts +1189 -0
  238. package/dist/es6/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
  239. package/dist/es6/segmented-control/lib/SegmentedControl.js +51 -0
  240. package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts +107 -0
  241. package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
  242. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +83 -0
  243. package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts +135 -0
  244. package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
  245. package/dist/es6/segmented-control/lib/SegmentedControlList.js +19 -0
  246. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +79 -0
  247. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
  248. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +18 -0
  249. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1202 -0
  250. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
  251. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +69 -0
  252. package/dist/es6/select/index.d.ts +0 -3
  253. package/dist/es6/select/index.d.ts.map +1 -1
  254. package/dist/es6/select/index.js +0 -3
  255. package/dist/es6/select/lib/Select.d.ts +0 -1
  256. package/dist/es6/select/lib/Select.d.ts.map +1 -1
  257. package/dist/es6/select/lib/Select.js +145 -186
  258. package/dist/es6/select/lib/SelectBase.d.ts +2 -2
  259. package/dist/es6/select/lib/SelectBase.d.ts.map +1 -1
  260. package/dist/es6/select/lib/SelectBase.js +101 -97
  261. package/dist/es6/select/lib/SelectMenu.d.ts +2 -2
  262. package/dist/es6/select/lib/SelectMenu.d.ts.map +1 -1
  263. package/dist/es6/select/lib/SelectMenu.js +49 -81
  264. package/dist/es6/select/lib/SelectOption.d.ts +1 -2
  265. package/dist/es6/select/lib/SelectOption.d.ts.map +1 -1
  266. package/dist/es6/select/lib/SelectOption.js +30 -45
  267. package/dist/es6/select/lib/scrolling.js +6 -7
  268. package/dist/es6/select/lib/utils.js +4 -4
  269. package/dist/es6/side-panel/index.d.ts +0 -3
  270. package/dist/es6/side-panel/index.d.ts.map +1 -1
  271. package/dist/es6/side-panel/index.js +0 -3
  272. package/dist/es6/side-panel/lib/SidePanel.d.ts +13 -27
  273. package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
  274. package/dist/es6/side-panel/lib/SidePanel.js +93 -131
  275. package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts +17 -0
  276. package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
  277. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +43 -0
  278. package/dist/es6/side-panel/lib/hooks.d.ts +20 -0
  279. package/dist/es6/side-panel/lib/hooks.d.ts.map +1 -1
  280. package/dist/es6/side-panel/lib/hooks.js +37 -18
  281. package/dist/es6/status-indicator/index.d.ts +4 -0
  282. package/dist/es6/status-indicator/index.d.ts.map +1 -0
  283. package/dist/es6/status-indicator/index.js +3 -0
  284. package/dist/es6/status-indicator/lib/StatusIndicator.d.ts +66 -0
  285. package/dist/es6/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
  286. package/dist/es6/status-indicator/lib/StatusIndicator.js +51 -0
  287. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts +83 -0
  288. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
  289. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +80 -0
  290. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
  291. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
  292. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +9 -0
  293. package/dist/es6/status-indicator/lib/hooks/index.d.ts +2 -0
  294. package/dist/es6/status-indicator/lib/hooks/index.d.ts.map +1 -0
  295. package/dist/es6/status-indicator/lib/hooks/index.js +1 -0
  296. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
  297. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
  298. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +22 -0
  299. package/dist/es6/table/index.d.ts +2 -0
  300. package/dist/es6/table/index.d.ts.map +1 -0
  301. package/dist/es6/table/index.js +1 -0
  302. package/dist/es6/table/lib/Table.d.ts +207 -0
  303. package/dist/es6/table/lib/Table.d.ts.map +1 -0
  304. package/dist/es6/table/lib/Table.js +223 -0
  305. package/dist/es6/table/lib/TableBody.d.ts +2 -0
  306. package/dist/es6/table/lib/TableBody.d.ts.map +1 -0
  307. package/dist/es6/table/lib/TableBody.js +29 -0
  308. package/dist/es6/table/lib/TableCaption.d.ts +2 -0
  309. package/dist/es6/table/lib/TableCaption.d.ts.map +1 -0
  310. package/dist/es6/table/lib/TableCaption.js +10 -0
  311. package/dist/es6/table/lib/TableCell.d.ts +2 -0
  312. package/dist/es6/table/lib/TableCell.d.ts.map +1 -0
  313. package/dist/es6/table/lib/TableCell.js +10 -0
  314. package/dist/es6/table/lib/TableFooter.d.ts +2 -0
  315. package/dist/es6/table/lib/TableFooter.d.ts.map +1 -0
  316. package/dist/es6/table/lib/TableFooter.js +9 -0
  317. package/dist/es6/table/lib/TableHead.d.ts +2 -0
  318. package/dist/es6/table/lib/TableHead.d.ts.map +1 -0
  319. package/dist/es6/table/lib/TableHead.js +17 -0
  320. package/dist/es6/table/lib/TableHeader.d.ts +2 -0
  321. package/dist/es6/table/lib/TableHeader.d.ts.map +1 -0
  322. package/dist/es6/table/lib/TableHeader.js +10 -0
  323. package/dist/es6/table/lib/TableRow.d.ts +2 -0
  324. package/dist/es6/table/lib/TableRow.d.ts.map +1 -0
  325. package/dist/es6/table/lib/TableRow.js +13 -0
  326. package/dist/es6/text-area/lib/TextArea.d.ts +3 -12
  327. package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
  328. package/dist/es6/text-area/lib/TextArea.js +7 -31
  329. package/dist/es6/text-area/lib/TextAreaField.d.ts +2 -2
  330. package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
  331. package/dist/es6/text-area/lib/TextAreaField.js +22 -38
  332. package/dist/es6/text-input/lib/TextInput.d.ts +5 -14
  333. package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
  334. package/dist/es6/text-input/lib/TextInput.js +7 -31
  335. package/dist/es6/text-input/lib/TextInputField.d.ts +2 -2
  336. package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
  337. package/dist/es6/text-input/lib/TextInputField.js +24 -29
  338. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +3 -5
  339. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
  340. package/dist/es6/text-input/lib/hooks/useTextInputField.js +1 -1
  341. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +1 -0
  342. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
  343. package/dist/es6/text-input/lib/hooks/useTextInputModel.js +2 -1
  344. package/form-field/lib/FormField.tsx +5 -10
  345. package/form-field/lib/FormFieldHint.tsx +23 -30
  346. package/form-field/lib/FormFieldLabel.tsx +18 -33
  347. package/form-field/lib/hooks/useFormFieldModel.tsx +1 -3
  348. package/form-field/lib/hooks/useFormFieldOrientation.tsx +6 -6
  349. package/form-field/package.json +2 -1
  350. package/index.ts +2 -3
  351. package/menu/index.ts +1 -6
  352. package/menu/lib/Menu.tsx +81 -27
  353. package/menu/lib/MenuItem.tsx +63 -19
  354. package/menu/package.json +2 -1
  355. package/package.json +6 -6
  356. package/pill/lib/Pill.tsx +109 -10
  357. package/pill/lib/PillCount.tsx +1 -1
  358. package/pill/lib/PillIcon.tsx +1 -1
  359. package/pill/package.json +2 -1
  360. package/segmented-control/LICENSE +126 -0
  361. package/segmented-control/README.md +6 -0
  362. package/segmented-control/index.ts +4 -0
  363. package/segmented-control/lib/SegmentedControl.tsx +57 -0
  364. package/segmented-control/lib/SegmentedControlItem.tsx +175 -0
  365. package/segmented-control/lib/SegmentedControlList.tsx +49 -0
  366. package/segmented-control/lib/hooks/useSegmentedControlItem.tsx +33 -0
  367. package/segmented-control/lib/hooks/useSegmentedControlModel.tsx +75 -0
  368. package/segmented-control/package.json +6 -0
  369. package/select/README.md +7 -7
  370. package/select/index.ts +0 -4
  371. package/select/lib/Select.tsx +1 -3
  372. package/select/lib/SelectBase.tsx +3 -5
  373. package/select/lib/SelectMenu.tsx +1 -3
  374. package/select/lib/SelectOption.tsx +1 -3
  375. package/select/package.json +2 -1
  376. package/side-panel/index.ts +0 -4
  377. package/side-panel/lib/SidePanel.tsx +119 -170
  378. package/side-panel/lib/SidePanelToggleButton.tsx +78 -0
  379. package/side-panel/lib/hooks.ts +20 -0
  380. package/side-panel/package.json +2 -1
  381. package/status-indicator/LICENSE +52 -0
  382. package/status-indicator/README.md +12 -0
  383. package/status-indicator/index.ts +3 -0
  384. package/status-indicator/lib/StatusIndicator.tsx +75 -0
  385. package/status-indicator/lib/StatusIndicatorIcon.tsx +88 -0
  386. package/status-indicator/lib/StatusIndicatorLabel.tsx +28 -0
  387. package/status-indicator/lib/hooks/index.ts +1 -0
  388. package/status-indicator/lib/hooks/useStatusIndicatorModel.tsx +29 -0
  389. package/status-indicator/package.json +6 -0
  390. package/{breadcrumbs → table}/LICENSE +0 -1
  391. package/table/README.md +5 -0
  392. package/table/index.ts +1 -0
  393. package/table/lib/Table.tsx +236 -0
  394. package/table/lib/TableBody.tsx +35 -0
  395. package/table/lib/TableCaption.tsx +22 -0
  396. package/table/lib/TableCell.tsx +27 -0
  397. package/table/lib/TableFooter.tsx +14 -0
  398. package/table/lib/TableHead.tsx +23 -0
  399. package/table/lib/TableHeader.tsx +28 -0
  400. package/table/lib/TableRow.tsx +26 -0
  401. package/table/package.json +6 -0
  402. package/text-area/lib/TextArea.tsx +9 -6
  403. package/text-area/lib/TextAreaField.tsx +7 -3
  404. package/text-area/package.json +2 -1
  405. package/text-input/lib/TextInput.tsx +9 -6
  406. package/text-input/lib/TextInputField.tsx +10 -6
  407. package/text-input/lib/hooks/useTextInputModel.ts +1 -0
  408. package/text-input/package.json +2 -1
  409. package/breadcrumbs/README.md +0 -7
  410. package/breadcrumbs/index.ts +0 -5
  411. package/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.tsx +0 -85
  412. package/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.tsx +0 -152
  413. package/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.tsx +0 -63
  414. package/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.ts +0 -109
  415. package/breadcrumbs/lib/Breadcrumbs/Dropdown/index.tsx +0 -38
  416. package/breadcrumbs/lib/Breadcrumbs/List/Collapsible.tsx +0 -66
  417. package/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.tsx +0 -64
  418. package/breadcrumbs/lib/Breadcrumbs/List/Link.tsx +0 -88
  419. package/breadcrumbs/lib/Breadcrumbs/List/ListItem.tsx +0 -30
  420. package/breadcrumbs/lib/Breadcrumbs/List/hooks.ts +0 -114
  421. package/breadcrumbs/lib/Breadcrumbs/List/index.tsx +0 -28
  422. package/breadcrumbs/lib/Breadcrumbs/List/styles.ts +0 -12
  423. package/breadcrumbs/lib/Breadcrumbs/Nav.tsx +0 -14
  424. package/breadcrumbs/lib/Breadcrumbs/hooks.ts +0 -13
  425. package/breadcrumbs/lib/Breadcrumbs/index.tsx +0 -15
  426. package/breadcrumbs/lib/Breadcrumbs/types.ts +0 -7
  427. package/breadcrumbs/package.json +0 -5
  428. package/dist/commonjs/breadcrumbs/index.d.ts +0 -5
  429. package/dist/commonjs/breadcrumbs/index.d.ts.map +0 -1
  430. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
  431. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
  432. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -69
  433. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
  434. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
  435. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -94
  436. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
  437. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
  438. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +0 -73
  439. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
  440. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
  441. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -77
  442. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
  443. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
  444. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -37
  445. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
  446. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
  447. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -78
  448. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
  449. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
  450. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -49
  451. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
  452. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
  453. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -66
  454. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
  455. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
  456. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -43
  457. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
  458. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
  459. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -116
  460. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
  461. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
  462. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.js +0 -38
  463. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
  464. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
  465. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -16
  466. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
  467. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
  468. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -34
  469. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
  470. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
  471. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -12
  472. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
  473. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
  474. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.js +0 -17
  475. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
  476. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
  477. package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.js +0 -2
  478. package/dist/commonjs/text-area/lib/hooks/index.d.ts +0 -2
  479. package/dist/commonjs/text-area/lib/hooks/index.d.ts.map +0 -1
  480. package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +0 -28
  481. package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts.map +0 -1
  482. package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.js +0 -5
  483. package/dist/es6/breadcrumbs/index.d.ts +0 -5
  484. package/dist/es6/breadcrumbs/index.d.ts.map +0 -1
  485. package/dist/es6/breadcrumbs/index.js +0 -4
  486. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
  487. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
  488. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -63
  489. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
  490. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
  491. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -87
  492. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
  493. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
  494. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +0 -51
  495. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
  496. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
  497. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -72
  498. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
  499. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
  500. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -30
  501. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
  502. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
  503. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -55
  504. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
  505. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
  506. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -42
  507. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
  508. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
  509. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -59
  510. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
  511. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
  512. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -36
  513. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
  514. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
  515. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -91
  516. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
  517. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
  518. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.js +0 -32
  519. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
  520. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
  521. package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -12
  522. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
  523. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
  524. package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -27
  525. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
  526. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
  527. package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -8
  528. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
  529. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
  530. package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.js +0 -14
  531. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
  532. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
  533. package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.js +0 -1
  534. package/dist/es6/text-area/lib/hooks/index.d.ts +0 -2
  535. package/dist/es6/text-area/lib/hooks/index.d.ts.map +0 -1
  536. package/dist/es6/text-area/lib/hooks/index.js +0 -1
  537. package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +0 -28
  538. package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts.map +0 -1
  539. package/dist/es6/text-area/lib/hooks/useTextAreaModel.js +0 -2
  540. package/text-area/lib/hooks/index.ts +0 -1
  541. package/text-area/lib/hooks/useTextAreaModel.ts +0 -3
package/pill/lib/Pill.tsx CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  styled,
10
10
  StyledType,
11
11
  } from '@workday/canvas-kit-react/common';
12
- import {BoxProps, boxStyleFn, HStack, Stack} from '@workday/canvas-kit-react/layout';
12
+ import {BoxProps, boxStyleFn, Flex} from '@workday/canvas-kit-react/layout';
13
13
  import {borderRadius, colors, space, type} from '@workday/canvas-kit-react/tokens';
14
14
 
15
15
  import {usePillModel} from './usePillModel';
@@ -160,14 +160,113 @@ const StyledNonInteractivePill = styled(StyledBasePill)<StyledType>({
160
160
  position: 'relative',
161
161
  });
162
162
 
163
+ /**
164
+ * By default, a `Pill` renders an interactive element that accepts subcomponents. By "interactive"
165
+ * we mean that the Pill container is a focusable element (a `<button>`). All leading elements
166
+ * (icons or avatars) are intended to be descriptive, helping support the label. They should not
167
+ * receive focus.
168
+ *
169
+ * `Pill` is the container component. It also provides a React context model for its subcomponents.
170
+ * Based on the `variant` prop this component will render different styled `Pill`s.
171
+ *
172
+ * Example of read only:
173
+ *
174
+ * ```tsx
175
+ * <Pill variant="readOnly">This is a read only</Pill>
176
+ * ```
177
+ *
178
+ * Example of interactive:
179
+ *
180
+ * ```tsx
181
+ * <Pill onClick={() => console.log('clicked')}>
182
+ * <Pill.Avatar /> Regina Skeltor
183
+ * </Pill>
184
+ * ```
185
+ *
186
+ * Example of removable:
187
+ *
188
+ * ```tsx
189
+ * <Pill variant="removable">
190
+ * <Pill.Avatar /> Regina Skeltor
191
+ * <Pill.IconButton onClick={() => console.log('clicked')} />
192
+ * </Pill>
193
+ * ```
194
+ *
195
+ * If you set the `Pill` `variant` to `removable`, it will render a `<span>` element. You can then
196
+ * provide a `Pill.IconButton` that acts as the focus target. This creates a smaller, more
197
+ * intentional click target that prevents users from accidentally deleting an item.
198
+ *
199
+ * ```tsx
200
+ * <Pill variant="removable">
201
+ * Shoes
202
+ * <Pill.IconButton onClick={() => console.log('handle remove')} />
203
+ * </Pill>
204
+ * ```
205
+ */
163
206
  export const Pill = createContainer('button')({
207
+ displayName: 'Pill',
164
208
  modelHook: usePillModel,
165
209
  subComponents: {
166
- Icon: PillIcon,
210
+ /**
211
+ * This component renders an avatar. It supports all props of the `Avatar` component.
212
+ *
213
+ * ```tsx
214
+ * <Pill variant="removable">
215
+ * <Pill.Avatar url={avatarUrl} />
216
+ * Regina Skeltor
217
+ * <Pill.IconButton onClick={() => console.log('handle remove')} />
218
+ * </Pill>
219
+ * ```
220
+ */
167
221
  Avatar: PillAvatar,
222
+ /**
223
+ * This component renders its `children` as the count.
224
+ *
225
+ * ```tsx
226
+ * <Pill onClick={() => console.warn('clicked')}>
227
+ * Shoes
228
+ * <Pill.Count>30</Pill.Count>
229
+ * </Pill>
230
+ * ```
231
+ */
168
232
  Count: PillCount,
169
- Label: PillLabel,
233
+ /**
234
+ * This component renders an `icon`. It not be used with the `default` styling – not `readOnly`
235
+ * or `removable` variants. By default it renders a `plusIcon` but it can be overridden by
236
+ * providing an icon to the `icon` prop.
237
+ *
238
+ * ```tsx
239
+ * <Pill onClick={() => console.warn('clicked')}>
240
+ * <Pill.Icon />
241
+ * <Pill.Label>Regina Skeltor</Pill.Label>
242
+ * </Pill>
243
+ * ```
244
+ */
245
+ Icon: PillIcon,
246
+ /**
247
+ * This component renders a custom icon button. It is only intended to be used with the
248
+ * `removable` variant. By default, it renders a `xSmallIcon` but can be overridden by providing
249
+ * an icon to the `icon` prop.
250
+ *
251
+ * ```tsx
252
+ * <Pill variant="removable">
253
+ * Pink Shirts
254
+ * <Pill.IconButton onClick={() => console.warn('clicked')} />
255
+ * </Pill>
256
+ * ```
257
+ */
170
258
  IconButton: PillIconButton,
259
+ /**
260
+ * This component renders a `<span>` that automatically handles overflow by rendering a tooltip.
261
+ * There's no need to use this component directly since the overflow is handled for you automatically.
262
+ *
263
+ * ```tsx
264
+ * <Pill variant="readOnly">
265
+ * <Pill.Label>Read-only</Pill.Label>
266
+ * </Pill>
267
+ * ```
268
+ */
269
+ Label: PillLabel,
171
270
  },
172
271
  })<PillProps>(({variant = 'default', maxWidth, ...elemProps}, Element, model) => {
173
272
  return (
@@ -190,18 +289,18 @@ export const Pill = createContainer('button')({
190
289
  {...elemProps}
191
290
  disabled={model.state.disabled}
192
291
  >
193
- <HStack spacing="xxxs" display="inline-flex" alignItems="center">
292
+ <Flex gap="xxxs" display="inline-flex" alignItems="center">
194
293
  {React.Children.map(elemProps.children, (child, index) => {
195
294
  if (typeof child === 'string') {
196
295
  return <PillLabel key={index}>{child}</PillLabel>;
197
296
  }
198
297
  return (
199
- <Stack.Item key={index} display="inline-flex">
298
+ <Flex.Item key={index} display="inline-flex">
200
299
  {child}
201
- </Stack.Item>
300
+ </Flex.Item>
202
301
  );
203
302
  })}
204
- </HStack>
303
+ </Flex>
205
304
  </StyledBasePill>
206
305
  )}
207
306
  {variant === 'removable' && (
@@ -211,14 +310,14 @@ export const Pill = createContainer('button')({
211
310
  variant={variant}
212
311
  {...elemProps}
213
312
  >
214
- <HStack spacing="xxxs" display="inline-flex" alignItems="center" justifyContent="center">
313
+ <Flex gap="xxxs" display="inline-flex" alignItems="center" justifyContent="center">
215
314
  {React.Children.map(elemProps.children, (child, index) => {
216
315
  if (typeof child === 'string') {
217
316
  return <PillLabel key={index}>{child}</PillLabel>;
218
317
  }
219
- return <Stack.Item key={index}>{child}</Stack.Item>;
318
+ return <Flex.Item key={index}>{child}</Flex.Item>;
220
319
  })}
221
- </HStack>
320
+ </Flex>
222
321
  </StyledNonInteractivePill>
223
322
  )}
224
323
  </>
@@ -25,7 +25,7 @@ export const PillCount = createComponent('span')({
25
25
  height={22}
26
26
  minWidth={22}
27
27
  padding={`0 ${space.xxxs}`}
28
- marginInlineEnd={`-${space.xxs}`} // Remove padding from HStack on the right side
28
+ marginInlineEnd={`-${space.xxs}`} // Remove excess margin at the end
29
29
  marginInlineStart={`${space.xxxs}`}
30
30
  backgroundColor={colors.soap500}
31
31
  data-count="ck-pill-count"
@@ -21,7 +21,7 @@ export const PillIcon = createSubcomponent('span')({
21
21
  })<PillIconProps>(({size, icon, ...elemProps}, Element) => {
22
22
  return (
23
23
  <SystemIcon
24
- marginInlineStart={`-${space.xxxs}`} // remove padding on the left from HStack
24
+ marginInlineStart={`-${space.xxxs}`} // remove excess margin from the start
25
25
  display="flex"
26
26
  as={Element}
27
27
  size={20}
package/pill/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../dist/commonjs/pill",
3
3
  "module": "../dist/es6/pill",
4
- "sideEffects": false
4
+ "sideEffects": false,
5
+ "types": "../dist/es6/pill"
5
6
  }
@@ -0,0 +1,126 @@
1
+ Apache License, Version 2.0 Apache License Version 2.0, January 2004
2
+
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and
8
+ distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the
9
+ copyright owner or entity authorized by the copyright owner that is granting the License. "Legal
10
+ Entity" shall mean the union of the acting entity and all other entities that control, are
11
+ controlled by, or are under common control with that entity. For the purposes of this definition,
12
+ "control" means (i) the power, direct or indirect, to cause the direction or management of such
13
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
14
+ outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an
15
+ individual or Legal Entity exercising permissions granted by this License. "Source" form shall
16
+ mean the preferred form for making modifications, including but not limited to software source
17
+ code, documentation source, and configuration files. "Object" form shall mean any form resulting
18
+ from mechanical transformation or translation of a Source form, including but not limited to
19
+ compiled object code, generated documentation, and conversions to other media types. "Work" shall
20
+ mean the work of authorship, whether in Source or Object form, made available under the License,
21
+ as indicated by a copyright notice that is included in or attached to the work (an example is
22
+ provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or
23
+ Object form, that is based on (or derived from) the Work and for which the editorial revisions,
24
+ annotations, elaborations, or other modifications represent, as a whole, an original work of
25
+ authorship. For the purposes of this License, Derivative Works shall not include works that
26
+ remain separable from, or merely link (or bind by name) to the interfaces of, the Work and
27
+ Derivative Works thereof. "Contribution" shall mean any work of authorship, including the
28
+ original version of the Work and any modifications or additions to that Work or Derivative Works
29
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright
30
+ owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
31
+ For the purposes of this definition, "submitted" means any form of electronic, verbal, or written
32
+ communication sent to the Licensor or its representatives, including but not limited to
33
+ communication on electronic mailing lists, source code control systems, and issue tracking
34
+ systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and
35
+ improving the Work, but excluding communication that is conspicuously marked or otherwise
36
+ designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean
37
+ Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by
38
+ Licensor and subsequently incorporated within the Work.
39
+
40
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor
41
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
42
+ copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform,
43
+ sublicense, and distribute the Work and such Derivative Works in Source or Object form.
44
+
45
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor
46
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
47
+ (except as stated in this section) patent license to make, have made, use, offer to sell, sell,
48
+ import, and otherwise transfer the Work, where such license applies only to those patent claims
49
+ licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or
50
+ by combination of their Contribution(s) with the Work to which such Contribution(s) was
51
+ submitted. If You institute patent litigation against any entity (including a cross-claim or
52
+ counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
53
+ constitutes direct or contributory patent infringement, then any patent licenses granted to You
54
+ under this License for that Work shall terminate as of the date such litigation is filed.
55
+
56
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof
57
+ in any medium, with or without modifications, and in Source or Object form, provided that You
58
+ meet the following conditions: You must give any other recipients of the Work or Derivative Works
59
+ a copy of this License; and You must cause any modified files to carry prominent notices stating
60
+ that You changed the files; and You must retain, in the Source form of any Derivative Works that
61
+ You distribute, all copyright, patent, trademark, and attribution notices from the Source form of
62
+ the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If
63
+ the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
64
+ that You distribute must include a readable copy of the attribution notices contained within such
65
+ NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
66
+ at least one of the following places: within a NOTICE text file distributed as part of the
67
+ Derivative Works; within the Source form or documentation, if provided along with the Derivative
68
+ Works; or, within a display generated by the Derivative Works, if and wherever such third-party
69
+ notices normally appear. The contents of the NOTICE file are for informational purposes only and
70
+ do not modify the License. You may add Your own attribution notices within Derivative Works that
71
+ You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
72
+ additional attribution notices cannot be construed as modifying the License. You may add Your own
73
+ copyright statement to Your modifications and may provide additional or different license terms
74
+ and conditions for use, reproduction, or distribution of Your modifications, or for any such
75
+ Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work
76
+ otherwise complies with the conditions stated in this License.
77
+
78
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution
79
+ intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms
80
+ and conditions of this License, without any additional terms or conditions. Notwithstanding the
81
+ above, nothing herein shall supersede or modify the terms of any separate license agreement you
82
+ may have executed with Licensor regarding such Contributions.
83
+
84
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service
85
+ marks, or product names of the Licensor, except as required for reasonable and customary use in
86
+ describing the origin of the Work and reproducing the content of the NOTICE file.
87
+
88
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor
89
+ provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
90
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
91
+ any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
92
+ PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or
93
+ redistributing the Work and assume any risks associated with Your exercise of permissions under
94
+ this License.
95
+
96
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including
97
+ negligence), contract, or otherwise, unless required by applicable law (such as deliberate and
98
+ grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for
99
+ damages, including any direct, indirect, special, incidental, or consequential damages of any
100
+ character arising as a result of this License or out of the use or inability to use the Work
101
+ (including but not limited to damages for loss of goodwill, work stoppage, computer failure or
102
+ malfunction, or any and all other commercial damages or losses), even if such Contributor has
103
+ been advised of the possibility of such damages.
104
+
105
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works
106
+ thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty,
107
+ indemnity, or other liability obligations and/or rights consistent with this License. However, in
108
+ accepting such obligations, You may act only on Your own behalf and on Your sole responsibility,
109
+ not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each
110
+ Contributor harmless for any liability incurred by, or claims asserted against, such Contributor
111
+ by reason of your accepting any such warranty or additional liability.
112
+
113
+ END OF TERMS AND CONDITIONS
114
+
115
+ ©2022 Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of
116
+ Workday, Inc. All other brand and product names are trademarks or registered trademarks of their
117
+ respective holders.
118
+
119
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
120
+ compliance with the License. You may obtain a copy of the License at
121
+ http://www.apache.org/licenses/LICENSE-2.0
122
+
123
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
124
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
125
+ implied. See the License for the specific language governing permissions and limitations under the
126
+ License.
@@ -0,0 +1,6 @@
1
+ # Canvas Kit React Segmented Control
2
+
3
+ `SegmentedControl` contains primary and secondary actions related to a page or task.
4
+
5
+ For more detailed information on this component, please refer to the
6
+ [storybook documentation](https://workday.github.io/canvas-kit/?path=/docs/preview-segmented-control-react--basic)
@@ -0,0 +1,4 @@
1
+ export * from './lib/SegmentedControl';
2
+ export * from './lib/hooks/useSegmentedControlModel';
3
+ export * from './lib/hooks/useSegmentedControlItem';
4
+ export {useSegmentedControlList} from './lib/SegmentedControlList';
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import {createContainer} from '@workday/canvas-kit-react/common';
3
+
4
+ import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
5
+ import {SegmentedControlList} from './SegmentedControlList';
6
+ import {SegmentedControlItem} from './SegmentedControlItem';
7
+
8
+ export interface SegmentedControlProps {
9
+ children: React.ReactNode;
10
+ }
11
+
12
+ /**
13
+ * `SegmentedControl` is a container component that is responsible for creating a
14
+ * {@link SegmentedControlModel} and sharing it with its subcomponents using React context. It does
15
+ * not represent a real element.
16
+ *
17
+ * ```tsx
18
+ * <SegmentedControl items={[]}>{Child components}</SegmentedControl>
19
+ * ```
20
+ *
21
+ * Alternatively, you may pass in a model using the [hoisted model
22
+ * pattern](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
23
+ *
24
+ * ```tsx
25
+ * const model = useSegmentedControlModel({
26
+ * items: [],
27
+ * });
28
+ *
29
+ * <SegmentedControl model={model}>{Child components}</SegmentedControl>;
30
+ * ```
31
+ */
32
+ export const SegmentedControl = createContainer()({
33
+ displayName: 'SegmentedControl',
34
+ modelHook: useSegmentedControlModel,
35
+ subComponents: {
36
+ /**
37
+ * `SegmentedControl.List` renders {@link Grid} under the hood. It is a container for
38
+ * {@link SegmentedControlItem SegmentedControl.Item} subcomponents.
39
+ *
40
+ * ```tsx
41
+ * <SegmentedControl.List>{SegmentedControl.Items}</SegmentedControl.List>
42
+ * ```
43
+ */
44
+ List: SegmentedControlList,
45
+ /**
46
+ * `SegmentedControl.Item` is a `button` element built on `BaseButton`. `SegmentedControl.Item`
47
+ * has a `data-id` prop to handle `onSelect` properly.
48
+ *
49
+ * ```tsx
50
+ * <SegmentedControl.Item data-id="table">Table</SegmentedControl.Item>
51
+ * ```
52
+ */
53
+ Item: SegmentedControlItem,
54
+ },
55
+ })<SegmentedControlProps>(({children}) => {
56
+ return <>{children}</>;
57
+ });
@@ -0,0 +1,175 @@
1
+ import * as React from 'react';
2
+
3
+ import {colors, type, space} from '@workday/canvas-kit-react/tokens';
4
+ import {createSubcomponent, useIsRTL} from '@workday/canvas-kit-react/common';
5
+ import {Tooltip, TooltipProps} from '@workday/canvas-kit-react/tooltip';
6
+ import {
7
+ BaseButton,
8
+ ButtonContainerProps,
9
+ ButtonColors,
10
+ ButtonSizes,
11
+ getMinWidthStyles,
12
+ } from '@workday/canvas-kit-react/button';
13
+ import {CanvasSystemIcon} from '@workday/design-assets-types';
14
+ import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
15
+ import {Text} from '@workday/canvas-kit-react/text';
16
+ import {useSegmentedControlItem} from './hooks/useSegmentedControlItem';
17
+
18
+ export interface ItemProps extends ButtonContainerProps {
19
+ /**
20
+ * Optionally pass index to the item. This should be done if `SegmentedControl.Item` components were created
21
+ * via a `[Array::map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)` function. This index will ensure keyboard navigation works even if items are
22
+ * inserted out of order.
23
+ */
24
+ index?: number;
25
+ /**
26
+ * The contents of the item. This is text used as the accessible name of the button for screen readers.
27
+ */
28
+ children?: React.ReactNode;
29
+ /**
30
+ * The identifier of the item. This identifier will be used in change events and for `initialTab`.
31
+ * If this property is not provided, it will default to a string representation
32
+ * of the the zero-based index of the item when it was initialized.
33
+ */
34
+ 'data-id'?: string;
35
+ /**
36
+ * Optional id. If not set, it will inherit the ID passed to the `SegmentedControl` component and append the
37
+ * index at the end. Only set this for advanced cases.
38
+ */
39
+ id?: string;
40
+ /**
41
+ * Part of the ARIA specification for buttons. Lets screen readers know which button is active. This
42
+ * should either be `true` or `false`. This is automatically set by the
43
+ * component and should only be used in advanced cases.
44
+ */
45
+ 'aria-pressed'?: boolean;
46
+ /**
47
+ * The icon of the button.
48
+ */
49
+ icon?: CanvasSystemIcon;
50
+ /**
51
+ * Tooltip Props
52
+ */
53
+ tooltipProps?: Omit<TooltipProps, 'children'>;
54
+ }
55
+
56
+ const getButtonSize = (size: ButtonContainerProps['size']) => {
57
+ switch (size) {
58
+ case 'large':
59
+ return 'medium';
60
+ case 'medium':
61
+ return 'small';
62
+ case 'small':
63
+ return 'extraSmall';
64
+ default:
65
+ return 'medium';
66
+ }
67
+ };
68
+
69
+ const getIconButtonColors = (toggled?: boolean): ButtonColors => {
70
+ return {
71
+ default: {
72
+ background: toggled ? colors.frenchVanilla100 : colors.soap200,
73
+ border: toggled ? colors.licorice200 : 'transparent',
74
+ icon: toggled ? colors.blackPepper400 : colors.licorice400,
75
+ label: toggled ? colors.blackPepper400 : colors.licorice400,
76
+ },
77
+ hover: {
78
+ background: toggled ? colors.frenchVanilla100 : colors.soap400,
79
+ icon: colors.licorice400,
80
+ label: colors.licorice400,
81
+ },
82
+ active: {
83
+ background: toggled ? colors.frenchVanilla100 : colors.soap400,
84
+ icon: colors.licorice400,
85
+ label: colors.licorice400,
86
+ },
87
+ focus: {},
88
+ disabled: {
89
+ background: colors.soap200,
90
+ opacity: '1',
91
+ },
92
+ };
93
+ };
94
+
95
+ const getPaddingStyles = (
96
+ children: React.ReactNode,
97
+ size: ButtonContainerProps['size'],
98
+ icon: CanvasSystemIcon | undefined
99
+ ) => {
100
+ if (!children) {
101
+ return 0;
102
+ }
103
+
104
+ switch (size) {
105
+ case 'large':
106
+ return icon ? `0 ${space.m} 0 20px` : `0 ${space.m}`;
107
+
108
+ case 'medium':
109
+ return icon ? `0 20px 0 ${space.s}` : `0 ${space.s}`;
110
+
111
+ case 'small':
112
+ return icon ? `0 ${space.xs} 0 ${space.xxs}` : `0 ${space.xs}`;
113
+
114
+ default:
115
+ return icon ? `0 20px 0 ${space.s}` : `0 ${space.s}`;
116
+ }
117
+ };
118
+
119
+ const geButtonStyles = (size: ButtonSizes, children: React.ReactNode, icon?: CanvasSystemIcon) => {
120
+ const buttonSize = getButtonSize(size);
121
+ const minWidthValue = getMinWidthStyles(children, children ? size : buttonSize);
122
+
123
+ return {
124
+ height: getMinWidthStyles(false, buttonSize),
125
+ minWidth: minWidthValue,
126
+ padding: getPaddingStyles(children, size, icon),
127
+ };
128
+ };
129
+
130
+ const Container = ({
131
+ tooltipProps,
132
+ children,
133
+ }: {
134
+ tooltipProps?: Omit<TooltipProps, 'children'>;
135
+ children: React.ReactElement;
136
+ }) => {
137
+ return tooltipProps ? (
138
+ <Tooltip {...tooltipProps}>{children}</Tooltip>
139
+ ) : (
140
+ <React.Fragment>{children}</React.Fragment>
141
+ );
142
+ };
143
+
144
+ export const SegmentedControlItem = createSubcomponent('button')({
145
+ displayName: 'SegmentedControl.Item',
146
+ modelHook: useSegmentedControlModel,
147
+ elemPropsHook: useSegmentedControlItem,
148
+ })<ItemProps>(({children, icon, tooltipProps, ...elemProps}, Element, {state: {size}}) => {
149
+ const {color, ...textStyles} = type.levels.subtext[size === 'small' ? 'medium' : 'large'];
150
+
151
+ return (
152
+ <Container tooltipProps={tooltipProps}>
153
+ <BaseButton
154
+ as={Element}
155
+ borderRadius="m"
156
+ colors={getIconButtonColors(elemProps['aria-pressed'])}
157
+ {...geButtonStyles(size, children, icon)}
158
+ {...elemProps}
159
+ >
160
+ {icon && (
161
+ <BaseButton.Icon
162
+ size={size === 'small' ? 'extraSmall' : 'medium'}
163
+ icon={icon}
164
+ shouldMirrorIcon={useIsRTL()}
165
+ />
166
+ )}
167
+ {children && (
168
+ <Text {...textStyles} fontWeight="bold" textAlign="left">
169
+ {children}
170
+ </Text>
171
+ )}
172
+ </BaseButton>
173
+ </Container>
174
+ );
175
+ });
@@ -0,0 +1,49 @@
1
+ import * as React from 'react';
2
+
3
+ import {
4
+ createSubcomponent,
5
+ ExtractProps,
6
+ createElemPropsHook,
7
+ } from '@workday/canvas-kit-react/common';
8
+ import {Grid} from '@workday/canvas-kit-react/layout';
9
+ import {useListRenderItems} from '@workday/canvas-kit-react/collection';
10
+ import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
11
+
12
+ export interface SegmentedControlListProps<T = any>
13
+ extends Omit<Partial<ExtractProps<typeof Grid, never>>, 'children'> {
14
+ 'aria-label': string;
15
+ children: ((item: T) => React.ReactNode) | React.ReactNode;
16
+ }
17
+
18
+ export const useSegmentedControlList = createElemPropsHook(useSegmentedControlModel)(
19
+ ({state: {orientation, disabled, items}}) => {
20
+ const directionName = orientation === 'vertical' ? 'Row' : 'Column';
21
+ return {
22
+ [`gridTemplate${directionName}s`]: `repeat(${items.length}, 1fr)`,
23
+ opacity: disabled ? 0.4 : undefined,
24
+ };
25
+ }
26
+ );
27
+
28
+ export const SegmentedControlList = createSubcomponent('div')({
29
+ displayName: 'SegmentedControl.List',
30
+ modelHook: useSegmentedControlModel,
31
+ elemPropsHook: useSegmentedControlList,
32
+ })<SegmentedControlListProps>(({children, ...elemProps}, Element, model) => {
33
+ return (
34
+ <Grid
35
+ as={Element}
36
+ display="inline-grid"
37
+ role="group"
38
+ backgroundColor="soap200"
39
+ border="1px solid transparent"
40
+ borderColor="licorice200"
41
+ borderRadius="l"
42
+ padding="3px"
43
+ gridGap="xxs"
44
+ {...elemProps}
45
+ >
46
+ {useListRenderItems(model, children)}
47
+ </Grid>
48
+ );
49
+ });
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+
3
+ import {createElemPropsHook, composeHooks} from '@workday/canvas-kit-react/common';
4
+ import {
5
+ useListItemRegister,
6
+ isSelected,
7
+ useListItemSelect,
8
+ } from '@workday/canvas-kit-react/collection';
9
+ import {useSegmentedControlModel} from './useSegmentedControlModel';
10
+
11
+ export const useSegmentedControlItem = composeHooks(
12
+ useListItemSelect,
13
+ createElemPropsHook(useSegmentedControlModel)(
14
+ (model, _, elemProps: {'data-id'?: string; children?: React.ReactNode} = {}) => {
15
+ const name = elemProps['data-id'] || '';
16
+ const selected = !!name && isSelected(name, model.state);
17
+
18
+ return {
19
+ id: `${model.state.id}-${name}`,
20
+ 'aria-pressed': selected,
21
+ };
22
+ }
23
+ ),
24
+ useListItemRegister,
25
+ createElemPropsHook(useSegmentedControlModel)(({state}) => {
26
+ return {
27
+ // override the default disabled functionality of `useListItemRegister`
28
+ // it shouldn't allow to set disabled state only for one button
29
+ // state prop will disable the whole container
30
+ disabled: state.disabled ? true : undefined,
31
+ };
32
+ })
33
+ );