@openedx/paragon 21.12.0 → 21.12.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 (467) hide show
  1. package/dist/ActionRow/index.js +7 -8
  2. package/dist/ActionRow/index.js.map +1 -1
  3. package/dist/Alert/index.js +33 -25
  4. package/dist/Alert/index.js.map +1 -1
  5. package/dist/Annotation/index.js +7 -9
  6. package/dist/Annotation/index.js.map +1 -1
  7. package/dist/Avatar/index.js +5 -7
  8. package/dist/Avatar/index.js.map +1 -1
  9. package/dist/AvatarButton/index.js +10 -12
  10. package/dist/AvatarButton/index.js.map +1 -1
  11. package/dist/Badge/index.js +6 -4
  12. package/dist/Badge/index.js.map +1 -1
  13. package/dist/Breadcrumb/BreadcrumbLink.js +11 -14
  14. package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
  15. package/dist/Breadcrumb/index.js +29 -29
  16. package/dist/Breadcrumb/index.js.map +1 -1
  17. package/dist/Bubble/index.js +11 -13
  18. package/dist/Bubble/index.js.map +1 -1
  19. package/dist/Button/deprecated/index.js +87 -66
  20. package/dist/Button/deprecated/index.js.map +1 -1
  21. package/dist/Button/index.js +10 -11
  22. package/dist/Button/index.js.map +1 -1
  23. package/dist/Card/CardBody.js +4 -6
  24. package/dist/Card/CardBody.js.map +1 -1
  25. package/dist/Card/CardCarousel/CardCarousel.js +11 -13
  26. package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
  27. package/dist/Card/CardCarousel/CardCarouselControls.js +6 -7
  28. package/dist/Card/CardCarousel/CardCarouselControls.js.map +1 -1
  29. package/dist/Card/CardCarousel/CardCarouselHeader.js +9 -12
  30. package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
  31. package/dist/Card/CardCarousel/CardCarouselItems.js +6 -9
  32. package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
  33. package/dist/Card/CardCarousel/CardCarouselProvider.js +27 -28
  34. package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
  35. package/dist/Card/CardCarousel/CardCarouselSubtitle.js +4 -6
  36. package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
  37. package/dist/Card/CardCarousel/CardCarouselTitle.js +4 -6
  38. package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
  39. package/dist/Card/CardContext.js +8 -10
  40. package/dist/Card/CardContext.js.map +1 -1
  41. package/dist/Card/CardDeck.js +19 -17
  42. package/dist/Card/CardDeck.js.map +1 -1
  43. package/dist/Card/CardDivider.js +3 -5
  44. package/dist/Card/CardDivider.js.map +1 -1
  45. package/dist/Card/CardFooter.js +15 -18
  46. package/dist/Card/CardFooter.js.map +1 -1
  47. package/dist/Card/CardGrid.js +13 -11
  48. package/dist/Card/CardGrid.js.map +1 -1
  49. package/dist/Card/CardHeader.js +17 -22
  50. package/dist/Card/CardHeader.js.map +1 -1
  51. package/dist/Card/CardImageCap.js +48 -33
  52. package/dist/Card/CardImageCap.js.map +1 -1
  53. package/dist/Card/CardSection.js +11 -14
  54. package/dist/Card/CardSection.js.map +1 -1
  55. package/dist/Card/CardStatus.js +11 -14
  56. package/dist/Card/CardStatus.js.map +1 -1
  57. package/dist/Card/index.js +18 -20
  58. package/dist/Card/index.js.map +1 -1
  59. package/dist/Carousel/index.js +17 -11
  60. package/dist/Carousel/index.js.map +1 -1
  61. package/dist/CheckBox/index.js +66 -36
  62. package/dist/CheckBox/index.js.map +1 -1
  63. package/dist/Chip/index.js +14 -16
  64. package/dist/Chip/index.js.map +1 -1
  65. package/dist/ChipCarousel/index.js +29 -30
  66. package/dist/ChipCarousel/index.js.map +1 -1
  67. package/dist/Collapsible/CollapsibleAdvanced.js +82 -62
  68. package/dist/Collapsible/CollapsibleAdvanced.js.map +1 -1
  69. package/dist/Collapsible/CollapsibleBody.js +13 -15
  70. package/dist/Collapsible/CollapsibleBody.js.map +1 -1
  71. package/dist/Collapsible/CollapsibleTrigger.js +18 -20
  72. package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
  73. package/dist/Collapsible/CollapsibleVisible.js +6 -9
  74. package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
  75. package/dist/Collapsible/index.js +17 -18
  76. package/dist/Collapsible/index.js.map +1 -1
  77. package/dist/ColorPicker/index.js +58 -33
  78. package/dist/ColorPicker/index.js.map +1 -1
  79. package/dist/Container/index.js +14 -11
  80. package/dist/Container/index.js.map +1 -1
  81. package/dist/DataTable/ActionDisplay.js +8 -9
  82. package/dist/DataTable/ActionDisplay.js.map +1 -1
  83. package/dist/DataTable/BulkActions.js +23 -20
  84. package/dist/DataTable/BulkActions.js.map +1 -1
  85. package/dist/DataTable/CardView.js +46 -43
  86. package/dist/DataTable/CardView.js.map +1 -1
  87. package/dist/DataTable/CollapsibleButtonGroup.js +57 -39
  88. package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
  89. package/dist/DataTable/DataTableContext.js +1 -1
  90. package/dist/DataTable/DataTableContext.js.map +1 -1
  91. package/dist/DataTable/DataTableLayout.js +6 -9
  92. package/dist/DataTable/DataTableLayout.js.map +1 -1
  93. package/dist/DataTable/DataViewToggle.js +25 -20
  94. package/dist/DataTable/DataViewToggle.js.map +1 -1
  95. package/dist/DataTable/DropdownFilters.js +41 -28
  96. package/dist/DataTable/DropdownFilters.js.map +1 -1
  97. package/dist/DataTable/EmptyTable.js +6 -9
  98. package/dist/DataTable/EmptyTable.js.map +1 -1
  99. package/dist/DataTable/ExpandAll.js +2 -4
  100. package/dist/DataTable/ExpandAll.js.map +1 -1
  101. package/dist/DataTable/ExpandRow.js +2 -4
  102. package/dist/DataTable/ExpandRow.js.map +1 -1
  103. package/dist/DataTable/FilterStatus.js +18 -17
  104. package/dist/DataTable/FilterStatus.js.map +1 -1
  105. package/dist/DataTable/RowStatus.js +15 -18
  106. package/dist/DataTable/RowStatus.js.map +1 -1
  107. package/dist/DataTable/SidebarFilters.js +16 -13
  108. package/dist/DataTable/SidebarFilters.js.map +1 -1
  109. package/dist/DataTable/SmartStatus.js +14 -16
  110. package/dist/DataTable/SmartStatus.js.map +1 -1
  111. package/dist/DataTable/Table.js +17 -19
  112. package/dist/DataTable/Table.js.map +1 -1
  113. package/dist/DataTable/TableActions.js +11 -13
  114. package/dist/DataTable/TableActions.js.map +1 -1
  115. package/dist/DataTable/TableCell.js +6 -10
  116. package/dist/DataTable/TableCell.js.map +1 -1
  117. package/dist/DataTable/TableControlBar.js +7 -12
  118. package/dist/DataTable/TableControlBar.js.map +1 -1
  119. package/dist/DataTable/TableFilters.js +14 -12
  120. package/dist/DataTable/TableFilters.js.map +1 -1
  121. package/dist/DataTable/TableFooter.js +5 -8
  122. package/dist/DataTable/TableFooter.js.map +1 -1
  123. package/dist/DataTable/TableHeaderCell.js +11 -15
  124. package/dist/DataTable/TableHeaderCell.js.map +1 -1
  125. package/dist/DataTable/TableHeaderRow.js +6 -4
  126. package/dist/DataTable/TableHeaderRow.js.map +1 -1
  127. package/dist/DataTable/TablePagination.js +8 -7
  128. package/dist/DataTable/TablePagination.js.map +1 -1
  129. package/dist/DataTable/TablePaginationMinimal.js +9 -8
  130. package/dist/DataTable/TablePaginationMinimal.js.map +1 -1
  131. package/dist/DataTable/TableRow.js +15 -18
  132. package/dist/DataTable/TableRow.js.map +1 -1
  133. package/dist/DataTable/filters/CheckboxFilter.js +23 -22
  134. package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
  135. package/dist/DataTable/filters/DropdownFilter.js +14 -19
  136. package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
  137. package/dist/DataTable/filters/MultiSelectDropdownFilter.js +19 -20
  138. package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
  139. package/dist/DataTable/filters/TextFilter.js +10 -13
  140. package/dist/DataTable/filters/TextFilter.js.map +1 -1
  141. package/dist/DataTable/hooks.js +29 -25
  142. package/dist/DataTable/hooks.js.map +1 -1
  143. package/dist/DataTable/index.js +120 -104
  144. package/dist/DataTable/index.js.map +1 -1
  145. package/dist/DataTable/selection/BaseSelectionStatus.js +29 -31
  146. package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
  147. package/dist/DataTable/selection/ControlledSelect.js +13 -9
  148. package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
  149. package/dist/DataTable/selection/ControlledSelectHeader.js +19 -15
  150. package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
  151. package/dist/DataTable/selection/ControlledSelectionStatus.js +34 -24
  152. package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
  153. package/dist/DataTable/selection/SelectionStatus.js +23 -23
  154. package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
  155. package/dist/DataTable/utils/getVisibleColumns.js +36 -44
  156. package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
  157. package/dist/Dropdown/deprecated/DropdownButton.js +9 -13
  158. package/dist/Dropdown/deprecated/DropdownButton.js.map +1 -1
  159. package/dist/Dropdown/deprecated/DropdownItem.js +7 -8
  160. package/dist/Dropdown/deprecated/DropdownItem.js.map +1 -1
  161. package/dist/Dropdown/deprecated/DropdownMenu.js +8 -12
  162. package/dist/Dropdown/deprecated/DropdownMenu.js.map +1 -1
  163. package/dist/Dropdown/deprecated/index.js +136 -103
  164. package/dist/Dropdown/deprecated/index.js.map +1 -1
  165. package/dist/Dropdown/index.js +32 -29
  166. package/dist/Dropdown/index.js.map +1 -1
  167. package/dist/Dropzone/DefaultContent.js +13 -13
  168. package/dist/Dropzone/DefaultContent.js.map +1 -1
  169. package/dist/Dropzone/DragError.js +1 -3
  170. package/dist/Dropzone/DragError.js.map +1 -1
  171. package/dist/Dropzone/GenericError.js +7 -7
  172. package/dist/Dropzone/GenericError.js.map +1 -1
  173. package/dist/Dropzone/UploadProgress.js +6 -8
  174. package/dist/Dropzone/UploadProgress.js.map +1 -1
  175. package/dist/Dropzone/index.js +145 -86
  176. package/dist/Dropzone/index.js.map +1 -1
  177. package/dist/Fieldset/index.js +82 -57
  178. package/dist/Fieldset/index.js.map +1 -1
  179. package/dist/Form/FormAutosuggest.js +137 -95
  180. package/dist/Form/FormAutosuggest.js.map +1 -1
  181. package/dist/Form/FormAutosuggestOption.js +4 -6
  182. package/dist/Form/FormAutosuggestOption.js.map +1 -1
  183. package/dist/Form/FormCheckbox.js +35 -42
  184. package/dist/Form/FormCheckbox.js.map +1 -1
  185. package/dist/Form/FormCheckboxSet.js +13 -16
  186. package/dist/Form/FormCheckboxSet.js.map +1 -1
  187. package/dist/Form/FormCheckboxSetContext.js +39 -34
  188. package/dist/Form/FormCheckboxSetContext.js.map +1 -1
  189. package/dist/Form/FormControl.js +41 -35
  190. package/dist/Form/FormControl.js.map +1 -1
  191. package/dist/Form/FormControlDecorator.js +3 -5
  192. package/dist/Form/FormControlDecorator.js.map +1 -1
  193. package/dist/Form/FormControlDecoratorGroup.js +8 -10
  194. package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
  195. package/dist/Form/FormControlFeedback.js +12 -15
  196. package/dist/Form/FormControlFeedback.js.map +1 -1
  197. package/dist/Form/FormControlFloatingLabel.js +3 -6
  198. package/dist/Form/FormControlFloatingLabel.js.map +1 -1
  199. package/dist/Form/FormControlSet.js +8 -9
  200. package/dist/Form/FormControlSet.js.map +1 -1
  201. package/dist/Form/FormGroup.js +11 -12
  202. package/dist/Form/FormGroup.js.map +1 -1
  203. package/dist/Form/FormGroupContext.js +64 -39
  204. package/dist/Form/FormGroupContext.js.map +1 -1
  205. package/dist/Form/FormLabel.js +15 -17
  206. package/dist/Form/FormLabel.js.map +1 -1
  207. package/dist/Form/FormRadio.js +19 -22
  208. package/dist/Form/FormRadio.js.map +1 -1
  209. package/dist/Form/FormRadioSet.js +13 -16
  210. package/dist/Form/FormRadioSet.js.map +1 -1
  211. package/dist/Form/FormRadioSetContext.js +39 -34
  212. package/dist/Form/FormRadioSetContext.js.map +1 -1
  213. package/dist/Form/FormSwitch.js +19 -20
  214. package/dist/Form/FormSwitch.js.map +1 -1
  215. package/dist/Form/FormText.js +20 -29
  216. package/dist/Form/FormText.js.map +1 -1
  217. package/dist/Form/useCheckboxSetValues.js +46 -23
  218. package/dist/Form/useCheckboxSetValues.js.map +1 -1
  219. package/dist/Hyperlink/index.js +32 -31
  220. package/dist/Hyperlink/index.js.map +1 -1
  221. package/dist/Hyperlink/index.scss +2 -2
  222. package/dist/Icon/index.js +38 -30
  223. package/dist/Icon/index.js.map +1 -1
  224. package/dist/IconButton/index.js +31 -33
  225. package/dist/IconButton/index.js.map +1 -1
  226. package/dist/IconButtonToggle/index.js +16 -16
  227. package/dist/IconButtonToggle/index.js.map +1 -1
  228. package/dist/Input/index.js +122 -92
  229. package/dist/Input/index.js.map +1 -1
  230. package/dist/InputSelect/index.js +78 -51
  231. package/dist/InputSelect/index.js.map +1 -1
  232. package/dist/InputText/index.js +11 -9
  233. package/dist/InputText/index.js.map +1 -1
  234. package/dist/Layout/index.js +33 -29
  235. package/dist/Layout/index.js.map +1 -1
  236. package/dist/ListBox/index.js +112 -80
  237. package/dist/ListBox/index.js.map +1 -1
  238. package/dist/ListBoxOption/index.js +68 -45
  239. package/dist/ListBoxOption/index.js.map +1 -1
  240. package/dist/MailtoLink/index.js +37 -34
  241. package/dist/MailtoLink/index.js.map +1 -1
  242. package/dist/Menu/MenuItem.js +13 -14
  243. package/dist/Menu/MenuItem.js.map +1 -1
  244. package/dist/Menu/SelectMenu.js +68 -44
  245. package/dist/Menu/SelectMenu.js.map +1 -1
  246. package/dist/Menu/index.js +10 -11
  247. package/dist/Menu/index.js.map +1 -1
  248. package/dist/Modal/AlertModal.js +5 -7
  249. package/dist/Modal/AlertModal.js.map +1 -1
  250. package/dist/Modal/FullscreenModal.js +6 -8
  251. package/dist/Modal/FullscreenModal.js.map +1 -1
  252. package/dist/Modal/MarketingModal.js +8 -10
  253. package/dist/Modal/MarketingModal.js.map +1 -1
  254. package/dist/Modal/ModalCloseButton.js +13 -15
  255. package/dist/Modal/ModalCloseButton.js.map +1 -1
  256. package/dist/Modal/ModalContext.js +13 -13
  257. package/dist/Modal/ModalContext.js.map +1 -1
  258. package/dist/Modal/ModalDialog.js +25 -23
  259. package/dist/Modal/ModalDialog.js.map +1 -1
  260. package/dist/Modal/ModalDialogBody.js +22 -11
  261. package/dist/Modal/ModalDialogBody.js.map +1 -1
  262. package/dist/Modal/ModalDialogFooter.js +6 -7
  263. package/dist/Modal/ModalDialogFooter.js.map +1 -1
  264. package/dist/Modal/ModalDialogHeader.js +6 -7
  265. package/dist/Modal/ModalDialogHeader.js.map +1 -1
  266. package/dist/Modal/ModalDialogHero.js +6 -7
  267. package/dist/Modal/ModalDialogHero.js.map +1 -1
  268. package/dist/Modal/ModalDialogHeroBackground.js +8 -9
  269. package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
  270. package/dist/Modal/ModalDialogHeroContent.js +6 -7
  271. package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
  272. package/dist/Modal/ModalDialogTitle.js +6 -7
  273. package/dist/Modal/ModalDialogTitle.js.map +1 -1
  274. package/dist/Modal/ModalLayer.js +11 -17
  275. package/dist/Modal/ModalLayer.js.map +1 -1
  276. package/dist/Modal/ModalPopup.js +17 -17
  277. package/dist/Modal/ModalPopup.js.map +1 -1
  278. package/dist/Modal/PopperElement.js +25 -18
  279. package/dist/Modal/PopperElement.js.map +1 -1
  280. package/dist/Modal/Portal.js +40 -18
  281. package/dist/Modal/Portal.js.map +1 -1
  282. package/dist/Modal/StandardModal.js +6 -8
  283. package/dist/Modal/StandardModal.js.map +1 -1
  284. package/dist/Modal/index.js +226 -193
  285. package/dist/Modal/index.js.map +1 -1
  286. package/dist/Nav/index.js +3 -2
  287. package/dist/Nav/index.js.map +1 -1
  288. package/dist/Navbar/index.js +7 -6
  289. package/dist/Navbar/index.js.map +1 -1
  290. package/dist/OverflowScroll/OverflowScroll.js +45 -37
  291. package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
  292. package/dist/OverflowScroll/OverflowScrollContext.js +1 -1
  293. package/dist/OverflowScroll/OverflowScrollContext.js.map +1 -1
  294. package/dist/OverflowScroll/OverflowScrollItems.js +2 -4
  295. package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
  296. package/dist/Overlay/index.js +4 -4
  297. package/dist/Overlay/index.js.map +1 -1
  298. package/dist/PageBanner/index.js +11 -13
  299. package/dist/PageBanner/index.js.map +1 -1
  300. package/dist/Pagination/index.js +331 -296
  301. package/dist/Pagination/index.js.map +1 -1
  302. package/dist/Popover/index.js +18 -21
  303. package/dist/Popover/index.js.map +1 -1
  304. package/dist/ProductTour/Checkpoint.js +39 -30
  305. package/dist/ProductTour/Checkpoint.js.map +1 -1
  306. package/dist/ProductTour/CheckpointActionRow.js +18 -16
  307. package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
  308. package/dist/ProductTour/CheckpointBody.js +2 -4
  309. package/dist/ProductTour/CheckpointBody.js.map +1 -1
  310. package/dist/ProductTour/CheckpointBreadcrumbs.js +16 -16
  311. package/dist/ProductTour/CheckpointBreadcrumbs.js.map +1 -1
  312. package/dist/ProductTour/CheckpointTitle.js +2 -4
  313. package/dist/ProductTour/CheckpointTitle.js.map +1 -1
  314. package/dist/ProductTour/index.js +66 -47
  315. package/dist/ProductTour/index.js.map +1 -1
  316. package/dist/ProductTour/messages.js +16 -0
  317. package/dist/ProgressBar/index.js +37 -35
  318. package/dist/ProgressBar/index.js.map +1 -1
  319. package/dist/RadioButtonGroup/index.js +133 -102
  320. package/dist/RadioButtonGroup/index.js.map +1 -1
  321. package/dist/Scrollable/index.js +30 -15
  322. package/dist/Scrollable/index.js.map +1 -1
  323. package/dist/SearchField/SearchFieldAdvanced.js +66 -51
  324. package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
  325. package/dist/SearchField/SearchFieldClearButton.js +7 -8
  326. package/dist/SearchField/SearchFieldClearButton.js.map +1 -1
  327. package/dist/SearchField/SearchFieldInput.js +8 -9
  328. package/dist/SearchField/SearchFieldInput.js.map +1 -1
  329. package/dist/SearchField/SearchFieldLabel.js +8 -11
  330. package/dist/SearchField/SearchFieldLabel.js.map +1 -1
  331. package/dist/SearchField/SearchFieldSubmitButton.js +12 -15
  332. package/dist/SearchField/SearchFieldSubmitButton.js.map +1 -1
  333. package/dist/SearchField/index.js +22 -23
  334. package/dist/SearchField/index.js.map +1 -1
  335. package/dist/SelectableBox/SelectableBoxSet.js +25 -26
  336. package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
  337. package/dist/SelectableBox/index.js +42 -38
  338. package/dist/SelectableBox/index.js.map +1 -1
  339. package/dist/Sheet/SheetContainer.js +38 -16
  340. package/dist/Sheet/SheetContainer.js.map +1 -1
  341. package/dist/Sheet/index.js +65 -43
  342. package/dist/Sheet/index.js.map +1 -1
  343. package/dist/Spinner/index.js +8 -9
  344. package/dist/Spinner/index.js.map +1 -1
  345. package/dist/Stack/index.js +9 -11
  346. package/dist/Stack/index.js.map +1 -1
  347. package/dist/StatefulButton/index.js +15 -17
  348. package/dist/StatefulButton/index.js.map +1 -1
  349. package/dist/StatusAlert/index.js +120 -82
  350. package/dist/StatusAlert/index.js.map +1 -1
  351. package/dist/Stepper/Stepper.js +2 -4
  352. package/dist/Stepper/Stepper.js.map +1 -1
  353. package/dist/Stepper/StepperActionRow.js +7 -10
  354. package/dist/Stepper/StepperActionRow.js.map +1 -1
  355. package/dist/Stepper/StepperContext.js +64 -32
  356. package/dist/Stepper/StepperContext.js.map +1 -1
  357. package/dist/Stepper/StepperHeader.js +23 -30
  358. package/dist/Stepper/StepperHeader.js.map +1 -1
  359. package/dist/Stepper/StepperHeaderStep.js +14 -17
  360. package/dist/Stepper/StepperHeaderStep.js.map +1 -1
  361. package/dist/Stepper/StepperStep.js +23 -24
  362. package/dist/Stepper/StepperStep.js.map +1 -1
  363. package/dist/Sticky/index.js +30 -22
  364. package/dist/Sticky/index.js.map +1 -1
  365. package/dist/Table/index.js +178 -109
  366. package/dist/Table/index.js.map +1 -1
  367. package/dist/Tabs/deprecated/index.js +99 -66
  368. package/dist/Tabs/deprecated/index.js.map +1 -1
  369. package/dist/Tabs/index.js +72 -56
  370. package/dist/Tabs/index.js.map +1 -1
  371. package/dist/TextArea/index.js +10 -8
  372. package/dist/TextArea/index.js.map +1 -1
  373. package/dist/Toast/ToastContainer.js +38 -16
  374. package/dist/Toast/ToastContainer.js.map +1 -1
  375. package/dist/Toast/index.js +33 -18
  376. package/dist/Toast/index.js.map +1 -1
  377. package/dist/Tooltip/index.js +8 -9
  378. package/dist/Tooltip/index.js.map +1 -1
  379. package/dist/TransitionReplace/DemoTransitionReplace.js +12 -3
  380. package/dist/TransitionReplace/DemoTransitionReplace.js.map +1 -1
  381. package/dist/TransitionReplace/index.js +136 -100
  382. package/dist/TransitionReplace/index.js.map +1 -1
  383. package/dist/Truncate/index.js +30 -24
  384. package/dist/Truncate/index.js.map +1 -1
  385. package/dist/ValidationFormGroup/index.js +38 -37
  386. package/dist/ValidationFormGroup/index.js.map +1 -1
  387. package/dist/ValidationMessage/index.js +76 -51
  388. package/dist/ValidationMessage/index.js.map +1 -1
  389. package/dist/asInput/index.js +251 -202
  390. package/dist/asInput/index.js.map +1 -1
  391. package/dist/hooks/useArrowKeyNavigation.js +46 -43
  392. package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
  393. package/dist/hooks/useIndexOfLastVisibleChild.js +50 -41
  394. package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
  395. package/dist/hooks/useIsVisible.js +20 -13
  396. package/dist/hooks/useIsVisible.js.map +1 -1
  397. package/dist/hooks/useToggle.js +18 -11
  398. package/dist/hooks/useToggle.js.map +1 -1
  399. package/dist/hooks/useWindowSize.js +17 -6
  400. package/dist/hooks/useWindowSize.js.map +1 -1
  401. package/dist/i18n/messages/ar.json +2 -1
  402. package/dist/i18n/messages/ca.json +2 -1
  403. package/dist/i18n/messages/es_419.json +2 -1
  404. package/dist/i18n/messages/es_AR.json +2 -1
  405. package/dist/i18n/messages/es_ES.json +2 -1
  406. package/dist/i18n/messages/fr.json +2 -1
  407. package/dist/i18n/messages/he.json +2 -1
  408. package/dist/i18n/messages/id.json +2 -1
  409. package/dist/i18n/messages/it_IT.json +2 -1
  410. package/dist/i18n/messages/ko_KR.json +2 -1
  411. package/dist/i18n/messages/pl.json +2 -1
  412. package/dist/i18n/messages/pt_BR.json +2 -1
  413. package/dist/i18n/messages/pt_PT.json +2 -1
  414. package/dist/i18n/messages/ru.json +2 -1
  415. package/dist/i18n/messages/th.json +2 -1
  416. package/dist/i18n/messages/tr_TR.json +2 -1
  417. package/dist/i18n/messages/uk.json +2 -1
  418. package/dist/i18n/messages/zh_CN.json +2 -1
  419. package/dist/paragon.css +1 -1
  420. package/dist/withDeprecatedProps.js +79 -58
  421. package/dist/withDeprecatedProps.js.map +1 -1
  422. package/package.json +1 -5
  423. package/src/Button/index.jsx +2 -2
  424. package/src/Container/index.jsx +4 -0
  425. package/src/Dropdown/index.jsx +4 -0
  426. package/src/Dropzone/index.jsx +1 -1
  427. package/src/Form/FormSwitch.jsx +3 -0
  428. package/src/Hyperlink/index.jsx +7 -6
  429. package/src/Hyperlink/index.scss +2 -2
  430. package/src/Icon/index.jsx +18 -11
  431. package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +12 -10
  432. package/src/IconButton/index.jsx +2 -2
  433. package/src/Layout/index.jsx +1 -4
  434. package/src/Menu/MenuItem.jsx +2 -2
  435. package/src/Modal/ModalDialog.jsx +3 -0
  436. package/src/Modal/index.jsx +11 -6
  437. package/src/Overlay/README.md +1 -1
  438. package/src/Overlay/index.jsx +1 -1
  439. package/src/Popover/README.md +0 -1
  440. package/src/Popover/index.jsx +11 -11
  441. package/src/ProductTour/Checkpoint.jsx +9 -6
  442. package/src/ProductTour/messages.js +16 -0
  443. package/src/SearchField/SearchFieldAdvanced.jsx +12 -7
  444. package/src/SearchField/SearchFieldLabel.jsx +3 -3
  445. package/src/SearchField/index.jsx +0 -1
  446. package/src/Tabs/index.jsx +19 -13
  447. package/src/hooks/tests/useIndexOfLastVisibleChild.test.jsx +3 -3
  448. package/src/hooks/useIndexOfLastVisibleChild.jsx +36 -38
  449. package/src/hooks/useIndexOfLastVisibleChild.mdx +3 -3
  450. package/src/i18n/messages/ar.json +2 -1
  451. package/src/i18n/messages/ca.json +2 -1
  452. package/src/i18n/messages/es_419.json +2 -1
  453. package/src/i18n/messages/es_AR.json +2 -1
  454. package/src/i18n/messages/es_ES.json +2 -1
  455. package/src/i18n/messages/fr.json +2 -1
  456. package/src/i18n/messages/he.json +2 -1
  457. package/src/i18n/messages/id.json +2 -1
  458. package/src/i18n/messages/it_IT.json +2 -1
  459. package/src/i18n/messages/ko_KR.json +2 -1
  460. package/src/i18n/messages/pl.json +2 -1
  461. package/src/i18n/messages/pt_BR.json +2 -1
  462. package/src/i18n/messages/pt_PT.json +2 -1
  463. package/src/i18n/messages/ru.json +2 -1
  464. package/src/i18n/messages/th.json +2 -1
  465. package/src/i18n/messages/tr_TR.json +2 -1
  466. package/src/i18n/messages/uk.json +2 -1
  467. package/src/i18n/messages/zh_CN.json +2 -1
@@ -1,9 +1,10 @@
1
- const _excluded = ["children"];
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["children"];
2
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
10
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -11,42 +12,45 @@ import React from 'react';
11
12
  import Col from 'react-bootstrap/Col';
12
13
  import Row from 'react-bootstrap/Row';
13
14
  import PropTypes from 'prop-types';
14
- const COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];
15
- const SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];
16
- const LayoutElement = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("div", _extends({
17
- ref: ref
18
- }, props)));
19
- const Layout = /*#__PURE__*/React.forwardRef((_ref, ref) => {
20
- let {
21
- children
22
- } = _ref,
15
+ var COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];
16
+ var SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];
17
+ var LayoutElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
18
+ return /*#__PURE__*/React.createElement("div", _extends({
19
+ ref: ref
20
+ }, props));
21
+ });
22
+ var Layout = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
23
+ var children = _ref.children,
23
24
  props = _objectWithoutProperties(_ref, _excluded);
24
- const childrenLength = children.length;
25
- const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;
26
- const errors = {};
27
- const layout = React.Children.map(children, (child, index) => {
28
- const newProps = _objectSpread({}, child.props);
29
- SIZES.forEach(size => {
30
- const sizeProps = props[size];
31
- const {
32
- span = 0,
33
- offset = 0
34
- } = sizeProps && sizeProps[index] || {};
25
+ var childrenLength = children.length;
26
+ var isValidDimensions = function isValidDimensions(dataList, validLength) {
27
+ return !dataList || dataList.length === validLength;
28
+ };
29
+ var errors = {};
30
+ var layout = React.Children.map(children, function (child, index) {
31
+ var newProps = _objectSpread({}, child.props);
32
+ SIZES.forEach(function (size) {
33
+ var sizeProps = props[size];
34
+ var _ref2 = sizeProps && sizeProps[index] || {},
35
+ _ref2$span = _ref2.span,
36
+ span = _ref2$span === void 0 ? 0 : _ref2$span,
37
+ _ref2$offset = _ref2.offset,
38
+ offset = _ref2$offset === void 0 ? 0 : _ref2$offset;
35
39
  if (errors[size] === undefined) {
36
40
  errors[size] = false;
37
41
  if (!isValidDimensions(sizeProps, childrenLength)) {
38
- errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;
42
+ errors[size] = "".concat(size, " prop accepts array which length must be equal to the number of children.");
39
43
  }
40
44
  }
41
45
  newProps[size] = {
42
- span,
43
- offset
46
+ span: span,
47
+ offset: offset
44
48
  };
45
49
  });
46
50
  newProps.ref = child.ref;
47
51
  return /*#__PURE__*/React.createElement(Col, newProps, child.props.children);
48
52
  });
49
- Object.keys(errors).forEach(breakpoint => {
53
+ Object.keys(errors).forEach(function (breakpoint) {
50
54
  if (errors[breakpoint]) {
51
55
  // eslint-disable-next-line no-console
52
56
  console.error(errors[breakpoint]);
@@ -86,11 +90,11 @@ Layout.propTypes = {
86
90
  offset: PropTypes.oneOf(COL_VALUES)
87
91
  }))
88
92
  };
89
- const sizeDefaultProps = {
93
+ var sizeDefaultProps = {
90
94
  span: [],
91
95
  offset: []
92
96
  };
93
- SIZES.forEach(size => {
97
+ SIZES.forEach(function (size) {
94
98
  // eslint-disable-next-line react/default-props-match-prop-types
95
99
  Layout.defaultProps[size] = sizeDefaultProps;
96
100
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","_extends","Layout","_ref","children","_objectWithoutProperties","_excluded","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","_objectSpread","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport {\n Col,\n Row,\n};\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC;AACrE,MAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE5C,MAAMC,aAAa,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAAKT,KAAA,CAAAU,aAAA,QAAAC,QAAA;EAAKF,GAAG,EAAEA;AAAI,GAAKD,KAAK,CAAG,CAAC,CAAC;AAEpF,MAAMI,MAAM,gBAAGZ,KAAK,CAACO,UAAU,CAAC,CAAAM,IAAA,EAAyBJ,GAAG,KAAK;EAAA,IAAhC;MAAEK;IAAmB,CAAC,GAAAD,IAAA;IAAPL,KAAK,GAAAO,wBAAA,CAAAF,IAAA,EAAAG,SAAA;EACnD,MAAMC,cAAc,GAAGH,QAAQ,CAACI,MAAM;EAEtC,MAAMC,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,WAAW,KAAK,CAACD,QAAQ,IAAIA,QAAQ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C,CAAC;EACH0C,EAAE,EAAE3C,SAAS,CAAC+C,OAAO,CAAC/C,SAAS,CAACgD,KAAK,CAAC;IACpClB,IAAI,EAAE9B,SAAS,CAACiD,KAAK,CAAChD,UAAU,CAAC,CAAC6C,UAAU;IAC5Cf,MAAM,EAAE/B,SAAS,CAACiD,KAAK,CAAChD,UAAU;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,MAAMiD,gBAAgB,GAAG;EAAEpB,IAAI,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAEjD7B,KAAK,CAACyB,OAAO,CAACC,IAAI,IAAI;EACpB;EACAnB,MAAM,CAAC6B,YAAY,CAACV,IAAI,CAAC,GAAGsB,gBAAgB;AAC9C,CAAC,CAAC;AAEF,SACEpD,GAAG,EACHC,GAAG;AAELU,MAAM,CAAC0C,OAAO,GAAGhD,aAAa;AAC9B,eAAeM,MAAM"}
1
+ {"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","_extends","Layout","_ref","children","_objectWithoutProperties","_excluded","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","_objectSpread","forEach","size","sizeProps","_ref2","_ref2$span","span","_ref2$offset","offset","undefined","concat","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport { Col, Row };\nLayout.Element = LayoutElement;\nex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AAK,CAAC;IACpCpB,IAAI,EAAEhC,SAAS,CAACqD,KAAK,CAACpD,UAAU,CAAC,CAACiD,UAAU;IAC5ChB,MAAM,EAAElC,SAAS,CAACqD,KAAK,CAACpD,UAAU;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,IAAMqD,gBAAgB,GAAG;EAAEtB,IAAI,EAAE,EAAE;EAAEE,MAAM,EAAE;AAAG,CAAC;AAEjDhC,KAAK,CAACyB,OAAO,CAAC,UAAAC,IAAI,EAAI;EACpB;EACAnB,MAAM,CAACiC,YAAY,CAACd,IAAI,CAAC,GAAG0B,gBAAgB;AAC9C,CAAC,CAAC;AAEF,SAASxD,GAAG,EAAEC,GAAG;AACjBU,MAAM,CAAC8C,OAAO,GAAGpD,aAAa;AAC9B,eAAeM,MAAM"}
@@ -1,102 +1,134 @@
1
- const _excluded = ["children", "className", "selectedOptionIndex", "tag"];
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["children", "className", "selectedOptionIndex", "tag"];
2
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
9
20
  /* eslint-disable max-len */
10
21
  import classNames from 'classnames';
11
22
  import PropTypes from 'prop-types';
12
23
  import React from 'react';
13
24
  import { nonNegativeInteger } from '../utils/propTypes';
14
- export default class ListBox extends React.Component {
15
- constructor(props) {
16
- super(props);
17
- this.onFocus = this.onFocus.bind(this);
18
- this.onKeyDown = this.onKeyDown.bind(this);
19
- this.state = {
25
+ var ListBox = /*#__PURE__*/function (_React$Component) {
26
+ _inherits(ListBox, _React$Component);
27
+ var _super = _createSuper(ListBox);
28
+ function ListBox(props) {
29
+ var _this;
30
+ _classCallCheck(this, ListBox);
31
+ _this = _super.call(this, props);
32
+ _this.onFocus = _this.onFocus.bind(_assertThisInitialized(_this));
33
+ _this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this));
34
+ _this.state = {
20
35
  selectedOptionIndex: null
21
36
  };
37
+ return _this;
22
38
  }
23
- static getDerivedStateFromProps(nextProps, prevState) {
24
- const {
25
- selectedOptionIndex
26
- } = nextProps;
27
- if (selectedOptionIndex !== prevState.selectedOptionIndex && selectedOptionIndex !== undefined) {
28
- return {
29
- selectedOptionIndex
30
- };
31
- }
32
- return null;
33
- }
34
- onFocus() {
35
- // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus
36
- if (!this.state.selectedOptionIndex) {
37
- this.setState({
38
- selectedOptionIndex: 0
39
- });
39
+ _createClass(ListBox, [{
40
+ key: "onFocus",
41
+ value: function onFocus() {
42
+ // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus
43
+ if (!this.state.selectedOptionIndex) {
44
+ this.setState({
45
+ selectedOptionIndex: 0
46
+ });
47
+ }
40
48
  }
41
- }
42
- onKeyDown(e) {
43
- switch (e.key) {
44
- case 'ArrowDown':
45
- {
46
- // prevent scrolling entire modal body with arrow keys
47
- e.preventDefault();
48
- if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {
49
- this.setState(state => ({
50
- selectedOptionIndex: state.selectedOptionIndex + 1
51
- }));
49
+ }, {
50
+ key: "onKeyDown",
51
+ value: function onKeyDown(e) {
52
+ switch (e.key) {
53
+ case 'ArrowDown':
54
+ {
55
+ // prevent scrolling entire modal body with arrow keys
56
+ e.preventDefault();
57
+ if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {
58
+ this.setState(function (state) {
59
+ return {
60
+ selectedOptionIndex: state.selectedOptionIndex + 1
61
+ };
62
+ });
63
+ }
64
+ break;
52
65
  }
53
- break;
54
- }
55
- case 'ArrowUp':
56
- {
57
- // prevent scrolling entire modal body with arrow keys
58
- e.preventDefault();
59
- if (this.state.selectedOptionIndex > 0) {
60
- this.setState(state => ({
61
- selectedOptionIndex: state.selectedOptionIndex - 1
62
- }));
66
+ case 'ArrowUp':
67
+ {
68
+ // prevent scrolling entire modal body with arrow keys
69
+ e.preventDefault();
70
+ if (this.state.selectedOptionIndex > 0) {
71
+ this.setState(function (state) {
72
+ return {
73
+ selectedOptionIndex: state.selectedOptionIndex - 1
74
+ };
75
+ });
76
+ }
77
+ break;
63
78
  }
64
- break;
65
- }
66
- default:
79
+ default:
80
+ }
67
81
  }
68
- }
69
- renderChildren() {
70
- return React.Children.map(this.props.children, (child, index) => /*#__PURE__*/React.cloneElement(child, {
71
- index,
72
- isSelected: index === this.state.selectedOptionIndex,
73
- onSelect: () => {
74
- this.setState({
75
- selectedOptionIndex: index
82
+ }, {
83
+ key: "renderChildren",
84
+ value: function renderChildren() {
85
+ var _this2 = this;
86
+ return React.Children.map(this.props.children, function (child, index) {
87
+ return /*#__PURE__*/React.cloneElement(child, {
88
+ index: index,
89
+ isSelected: index === _this2.state.selectedOptionIndex,
90
+ onSelect: function onSelect() {
91
+ _this2.setState({
92
+ selectedOptionIndex: index
93
+ });
94
+ child.props.onSelect();
95
+ }
76
96
  });
77
- child.props.onSelect();
97
+ });
98
+ }
99
+ }, {
100
+ key: "render",
101
+ value: function render() {
102
+ var _this$props = this.props,
103
+ children = _this$props.children,
104
+ className = _this$props.className,
105
+ selectedOptionIndex = _this$props.selectedOptionIndex,
106
+ tag = _this$props.tag,
107
+ other = _objectWithoutProperties(_this$props, _excluded);
108
+ return /*#__PURE__*/React.createElement(this.props.tag, _objectSpread({
109
+ 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : "list-box-option-".concat(this.state.selectedOptionIndex),
110
+ className: classNames(['list-group', this.props.className]),
111
+ onFocus: this.onFocus,
112
+ onKeyDown: this.onKeyDown,
113
+ role: 'listbox',
114
+ tabIndex: 0
115
+ }, other), this.renderChildren());
116
+ }
117
+ }], [{
118
+ key: "getDerivedStateFromProps",
119
+ value: function getDerivedStateFromProps(nextProps, prevState) {
120
+ var selectedOptionIndex = nextProps.selectedOptionIndex;
121
+ if (selectedOptionIndex !== prevState.selectedOptionIndex && selectedOptionIndex !== undefined) {
122
+ return {
123
+ selectedOptionIndex: selectedOptionIndex
124
+ };
78
125
  }
79
- }));
80
- }
81
- render() {
82
- const _this$props = this.props,
83
- {
84
- children,
85
- className,
86
- selectedOptionIndex,
87
- tag
88
- } = _this$props,
89
- other = _objectWithoutProperties(_this$props, _excluded);
90
- return /*#__PURE__*/React.createElement(this.props.tag, _objectSpread({
91
- 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : `list-box-option-${this.state.selectedOptionIndex}`,
92
- className: classNames(['list-group', this.props.className]),
93
- onFocus: this.onFocus,
94
- onKeyDown: this.onKeyDown,
95
- role: 'listbox',
96
- tabIndex: 0
97
- }, other), this.renderChildren());
98
- }
99
- }
126
+ return null;
127
+ }
128
+ }]);
129
+ return ListBox;
130
+ }(React.Component);
131
+ export { ListBox as default };
100
132
  ListBox.propTypes = {
101
133
  /** specifies the ListBoxOption component(s) that will be displayed within the ListBox element. You can pass in one or more ListBoxOption components.
102
134
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["classNames","PropTypes","React","nonNegativeInteger","ListBox","Component","constructor","props","onFocus","bind","onKeyDown","state","selectedOptionIndex","getDerivedStateFromProps","nextProps","prevState","undefined","setState","e","key","preventDefault","Children","count","children","renderChildren","map","child","index","cloneElement","isSelected","onSelect","render","_this$props","className","tag","other","_objectWithoutProperties","_excluded","createElement","_objectSpread","role","tabIndex","propTypes","node","isRequired","string","defaultProps"],"sources":["../../src/ListBox/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { nonNegativeInteger } from '../utils/propTypes';\n\nexport default class ListBox extends React.Component {\n constructor(props) {\n super(props);\n\n this.onFocus = this.onFocus.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n this.state = {\n selectedOptionIndex: null,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { selectedOptionIndex } = nextProps;\n\n if (selectedOptionIndex !== prevState.selectedOptionIndex\n && selectedOptionIndex !== undefined) {\n return { selectedOptionIndex };\n }\n\n return null;\n }\n\n onFocus() {\n // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus\n if (!this.state.selectedOptionIndex) {\n this.setState({\n selectedOptionIndex: 0,\n });\n }\n }\n\n onKeyDown(e) {\n switch (e.key) {\n case 'ArrowDown': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex + 1,\n }));\n }\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n\n if (this.state.selectedOptionIndex > 0) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex - 1,\n }));\n }\n break;\n }\n default:\n }\n }\n\n renderChildren() {\n return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, {\n index,\n isSelected: index === this.state.selectedOptionIndex,\n onSelect: () => { this.setState({ selectedOptionIndex: index }); child.props.onSelect(); },\n }));\n }\n\n render() {\n const {\n children,\n className,\n selectedOptionIndex,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : `list-box-option-${this.state.selectedOptionIndex}`,\n className: classNames(['list-group', this.props.className]),\n onFocus: this.onFocus,\n onKeyDown: this.onKeyDown,\n role: 'listbox',\n tabIndex: 0,\n ...other,\n },\n this.renderChildren(),\n );\n }\n}\n\nListBox.propTypes = {\n /** specifies the ListBoxOption component(s) that will be displayed within the ListBox element. You can pass in one or more ListBoxOption components.\n */\n children: PropTypes.node.isRequired,\n /** specifies Bootstrap class names to apply to the ListBox component. The default is an empty string. */\n className: PropTypes.string,\n /** Although the ListBox component keeps track of which ListBoxOption is selected, `selectedOptionIndex` provides a mechanism for an override, if necessary. An example would be to clear the selectedOption when moving between views. Note that override is not permanent and that clicking on a ListBoxOption or interacting with the ListBox with the keyboard will change the selected ListBoxOption relative to the original override. The default is undefined. */\n selectedOptionIndex: nonNegativeInteger,\n /** used to specify the element type of the rendered ListBox component. The default is div. Example alternatives include ol, ul, span, etc. */\n tag: PropTypes.string,\n};\n\nListBox.defaultProps = {\n className: undefined,\n selectedOptionIndex: undefined,\n tag: 'div',\n};\n"],"mappings":";;;;;;;;AAAA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB,QAAQ,oBAAoB;AAEvD,eAAe,MAAMC,OAAO,SAASF,KAAK,CAACG,SAAS,CAAC;EACnDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;IACtC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACA,SAAS,CAACD,IAAI,CAAC,IAAI,CAAC;IAE1C,IAAI,CAACE,KAAK,GAAG;MACXC,mBAAmB,EAAE;IACvB,CAAC;EACH;EAEA,OAAOC,wBAAwBA,CAACC,SAAS,EAAEC,SAAS,EAAE;IACpD,MAAM;MAAEH;IAAoB,CA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ACrBb,SAAS,EAAEjB,SAAS;EACpBJ,mBAAmB,EAAEI,SAAS;EAC9BkB,GAAG,EAAE;AACP,CAAC"}
1
+ {"version":3,"file":"index.js","names":["classNames","PropTypes","React","nonNegativeInteger","ListBox","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","onFocus","bind","_assertThisInitialized","onKeyDown","state","selectedOptionIndex","_createClass","key","value","setState","e","preventDefault","Children","count","children","renderChildren","_this2","map","child","index","cloneElement","isSelected","onSelect","render","_this$props","className","tag","other","_objectWithoutProperties","_excluded","createElement","_objectSpread","concat","role","tabIndex","getDerivedStateFromProps","nextProps","prevState","undefined","Component","default","propTypes","node","isRequired","string","defaultProps"],"sources":["../../src/ListBox/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { nonNegativeInteger } from '../utils/propTypes';\n\nexport default class ListBox extends React.Component {\n constructor(props) {\n super(props);\n\n this.onFocus = this.onFocus.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n this.state = {\n selectedOptionIndex: null,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { selectedOptionIndex } = nextProps;\n\n if (selectedOptionIndex !== prevState.selectedOptionIndex\n && selectedOptionIndex !== undefined) {\n return { selectedOptionIndex };\n }\n\n return null;\n }\n\n onFocus() {\n // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus\n if (!this.state.selectedOptionIndex) {\n this.setState({\n selectedOptionIndex: 0,\n });\n }\n }\n\n onKeyDown(e) {\n switch (e.key) {\n case 'ArrowDown': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex + 1,\n }));\n }\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n\n if (this.state.selectedOptionIndex > 0) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex - 1,\n }));\n }\n break;\n }\n default:\n }\n }\n\n renderChildren() {\n return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, {\n index,\n isSelected: index === this.state.selectedOptionIndex,\n onSelect: () => { this.setState({ selectedOptionIndex: index }); child.props.onSelect(); },\n }));\n }\n\n render() {\n const {\n children,\n className,\n selectedOptionIndex,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : `list-box-option-${this.state.selectedOptionIndex}`,\n className: classNames(['list-group', this.props.className]),\n onFocus: this.onFocus,\n onKeyDown: this.onKeyDown,\n role: 'listbox',\n tabIndex: 0,\n ...other,\n },\n this.renderChildren(),\n );\n }\n}\n\nListBox.propTypes = {\n /** specifies the ListBoxOption component(s) that will be displayed within the ListBox element. You can pass in one or more ListBoxOption components.\n */\n children: PropTypes.node.isRequired,\n /** specifies Bootstrap class names to apply to the ListBox component. The default is an empty string. */\n className: PropTypes.string,\n /** Although the ListBox component keeps track of which ListBoxOption is selected, `selectedOptionIndex` provides a mechanism for an override, if necessary. An example would be to clear the selectedOption when moving between views. Note that override is not permanent and that clicking on a ListBoxOption or interacting with the ListBox with the keyboard will change the selected ListBoxOption relative to the original override. The default is undefined. */\n selectedOptionIndex: nonNegativeInteger,\n /** used to specify the element type of the rendered ListBox component. The default is div. Example alternatives include ol, ul, span, etc. */\n tag: PropTypes.string,\n};\n\nListBox.defaultProps = {\n className: undefined,\n selectedOptionIndex: undefined,\n tag: 'div',\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB,QAAQ,oBAAoB;AAAC,IAEnCC,OAAO,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,OAAA,EAAAC,gBAAA;EAAA,IAAA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K,IAAI,GAAG,IAAI,sBAAA2B,MAAA,CAAsB,IAAI,CAAC5B,KAAK,CAACC,mBAAmB,CAAE;QAC7HoB,SAAS,EAAEtC,UAAU,CAAC,CAAC,YAAY,EAAE,IAAI,CAACS,KAAK,CAAC6B,SAAS,CAAC,CAAC;QAC3DzB,OAAO,EAAE,IAAI,CAACA,OAAO;QACrBG,SAAS,EAAE,IAAI,CAACA,SAAS;QACzB8B,IAAI,EAAE,SAAS;QACfC,QAAQ,EAAE;MAAC,GACRP,KAAK,GAEV,IAAI,CAACZ,cAAc,CAAC,CACtB,CAAC;IACH;EAAC;IAAAR,GAAA;IAAAC,KAAA,EA7ED,SAAA2B,yBAAgCC,SAAS,EAAEC,SAAS,EAAE;MACpD,IAAQhC,mBAAmB,GAAK+B,SAAS,CAAjC/B,mBAAmB;MAE3B,IAAIA,mBAAmB,KAAKgC,SAAS,CAAChC,mBAAmB,IACpDA,mBAAmB,KAAKiC,SAAS,EAAE;QACtC,OAAO;UAAEjC,mBAAmB,EAAnBA;QAAoB,CAAC;MAChC;MAEA,OAAO,IAAI;IACb;EAAC;EAAA,OAAAd,OAAA;AAAA,EArBkCF,KAAK,CAACkD,SAAS;AAAA,SAA/BhD,OAAO,IAAAiD,OAAA;AA4F5BjD,OAAO,CAACkD,SAAS,GAAG;EAClB;AACF;EACE3B,QAAQ,EAAE1B,SAAS,CAACsD,IAAI,CAACC,UAAU;EACnC;EACAlB,SAAS,EAAErC,SAAS,CAACwD,MAAM;EAC3B;EACAvC,mBAAmB,EAAEf,kBAAkB;EACvC;EACAoC,GAAG,EAAEtC,SAAS,CAACwD;AACjB,CAAC;AAEDrD,OAAO,CAACsD,YAAY,GAAG;EACrBpB,SAAS,EAAEa,SAAS;EACpBjC,mBAAmB,EAAEiC,SAAS;EAC9BZ,GAAG,EAAE;AACP,CAAC"}
@@ -1,58 +1,81 @@
1
- const _excluded = ["children", "className", "index", "isSelected", "tag"];
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["children", "className", "index", "isSelected", "tag"];
2
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
9
20
  import React from 'react';
10
21
  import classNames from 'classnames';
11
22
  import PropTypes from 'prop-types';
12
- export default class ListBoxOption extends React.Component {
13
- constructor(props) {
14
- super(props);
15
- this.onMouseDown = this.onMouseDown.bind(this);
23
+ var ListBoxOption = /*#__PURE__*/function (_React$Component) {
24
+ _inherits(ListBoxOption, _React$Component);
25
+ var _super = _createSuper(ListBoxOption);
26
+ function ListBoxOption(props) {
27
+ var _this;
28
+ _classCallCheck(this, ListBoxOption);
29
+ _this = _super.call(this, props);
30
+ _this.onMouseDown = _this.onMouseDown.bind(_assertThisInitialized(_this));
31
+ return _this;
16
32
  }
17
- componentDidUpdate(prevProps) {
18
- if (this.props.isSelected && !prevProps.isSelected) {
19
- this.props.onSelect();
33
+ _createClass(ListBoxOption, [{
34
+ key: "componentDidUpdate",
35
+ value: function componentDidUpdate(prevProps) {
36
+ if (this.props.isSelected && !prevProps.isSelected) {
37
+ this.props.onSelect();
38
+ }
20
39
  }
21
- }
22
40
 
23
- /**
24
- * onMouseDown is used instead of onClick because onClick triggers the focus
25
- * event before click event. This focus event bubbles up to the parent
26
- * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.
27
- * This function will select the first ListBoxOption if one is not selected, and this
28
- * causes the user to see the first option selected before their desired option is selected
29
- * when the click event is fired shortly thereafter. The mouseDown event occurs before the
30
- * focus event, which prevents this behavior.
31
- */
32
- onMouseDown() {
33
- this.props.onSelect();
34
- }
35
- render() {
36
- const _this$props = this.props,
37
- {
38
- children,
39
- className,
40
- index,
41
- isSelected,
42
- tag
43
- } = _this$props,
44
- other = _objectWithoutProperties(_this$props, _excluded);
45
- return /*#__PURE__*/React.createElement(this.props.tag, _objectSpread({
46
- 'aria-selected': isSelected,
47
- className: classNames('list-group-item', 'list-group-item-action', {
48
- active: this.props.isSelected
49
- }, className),
50
- id: index === undefined ? null : `list-box-option-${index}`,
51
- onMouseDown: this.onMouseDown,
52
- role: 'option'
53
- }, other), children);
54
- }
55
- }
41
+ /**
42
+ * onMouseDown is used instead of onClick because onClick triggers the focus
43
+ * event before click event. This focus event bubbles up to the parent
44
+ * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.
45
+ * This function will select the first ListBoxOption if one is not selected, and this
46
+ * causes the user to see the first option selected before their desired option is selected
47
+ * when the click event is fired shortly thereafter. The mouseDown event occurs before the
48
+ * focus event, which prevents this behavior.
49
+ */
50
+ }, {
51
+ key: "onMouseDown",
52
+ value: function onMouseDown() {
53
+ this.props.onSelect();
54
+ }
55
+ }, {
56
+ key: "render",
57
+ value: function render() {
58
+ var _this$props = this.props,
59
+ children = _this$props.children,
60
+ className = _this$props.className,
61
+ index = _this$props.index,
62
+ isSelected = _this$props.isSelected,
63
+ tag = _this$props.tag,
64
+ other = _objectWithoutProperties(_this$props, _excluded);
65
+ return /*#__PURE__*/React.createElement(this.props.tag, _objectSpread({
66
+ 'aria-selected': isSelected,
67
+ className: classNames('list-group-item', 'list-group-item-action', {
68
+ active: this.props.isSelected
69
+ }, className),
70
+ id: index === undefined ? null : "list-box-option-".concat(index),
71
+ onMouseDown: this.onMouseDown,
72
+ role: 'option'
73
+ }, other), children);
74
+ }
75
+ }]);
76
+ return ListBoxOption;
77
+ }(React.Component);
78
+ export { ListBoxOption as default };
56
79
  ListBoxOption.propTypes = {
57
80
  children: PropTypes.node.isRequired,
58
81
  className: PropTypes.string,
@@ -66,6 +89,6 @@ ListBoxOption.defaultProps = {
66
89
  index: undefined,
67
90
  isSelected: false,
68
91
  tag: 'div',
69
- onSelect: () => {}
92
+ onSelect: function onSelect() {}
70
93
  };
71
94
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","classNames","PropTypes","ListBoxOption","Component","constructor","props","onMouseDown","bind","componentDidUpdate","prevProps","isSelected","onSelect","render","_this$props","children","className","index","tag","other","_objectWithoutProperties","_excluded","createElement","_objectSpread","active","id","undefined","role","propTypes","node","isRequired","string","number","bool","func","defaultProps"],"sources":["../../src/ListBoxOption/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nexport default class ListBoxOption extends React.Component {\n constructor(props) {\n super(props);\n\n this.onMouseDown = this.onMouseDown.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.isSelected && !prevProps.isSelected) {\n this.props.onSelect();\n }\n }\n\n /**\n * onMouseDown is used instead of onClick because onClick triggers the focus\n * event before click event. This focus event bubbles up to the parent\n * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.\n * This function will select the first ListBoxOption if one is not selected, and this\n * causes the user to see the first option selected before their desired option is selected\n * when the click event is fired shortly thereafter. The mouseDown event occurs before the\n * focus event, which prevents this behavior.\n */\n onMouseDown() {\n this.props.onSelect();\n }\n\n render() {\n const {\n children,\n className,\n index,\n isSelected,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-selected': isSelected,\n className: classNames(\n 'list-group-item',\n 'list-group-item-action',\n {\n active: this.props.isSelected,\n },\n className,\n ),\n id: index === undefined ? null : `list-box-option-${index}`,\n onMouseDown: this.onMouseDown,\n role: 'option',\n ...other,\n },\n children,\n );\n }\n}\n\nListBoxOption.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n index: PropTypes.number,\n isSelected: PropTypes.bool,\n tag: PropTypes.string,\n onSelect: PropTypes.func,\n};\n\nListBoxOption.defaultProps = {\n className: undefined,\n index: undefined,\n isSelected: false,\n tag: 'div',\n onSelect: () => { },\n};\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,eAAe,MAAMC,aAAa,SAASH,KAAK,CAACI,SAAS,CAAC;EACzDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC;EAChD;EAEAC,kBAAkBA,CAACC,SAAS,EAAE;IAC5B,IAAI,IAAI,CAACJ,KAAK,CAACK,UAAU,IAAI,CAACD,SAAS,CAACC,UAAU,EAAE;MAClD,IAAI,CAACL,KAAK,CAACM,QAAQ,CAAC,CAAC;IACvB;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEL,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACD,KAAK,CAACM,QAAQ,CAAC,CAAC;EACvB;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAAC,WAAA,GAOI,IAAI,CAACR,KAAK;MAPR;QACJS,QAAQ;QACRC,SAAS;QACTC,KAAK;QACLN,UAAU;QACVO;MAEF,CAAC,GAAAJ,WAAA;MADIK,KAAK,GAAAC,wBAAA,CAAAN,WAAA,EAAAO,SAAA;IAGV,oBAAOrB,KAAK,CAACsB,aAAa,CACxB,IAAI,CAAChB,KAAK,CAACY,GAAG,EAAAK,aAAA;MAEZ,eAAe,EAAEZ,UAAU;MAC3BK,SAAS,EAAEf,UAAU,CACnB,iBAAiB,EACjB,wBAAwB,EACxB;QACEuB,MAAM,EAAE,IAAI,CAAClB,KAAK,CAACK;MACrB,CAAC,EACDK,SACF,CAAC;MACDS,EAAE,EAAER,KAAK,KAAKS,SAAS,GAAG,IAAI,GAAI,mBAAkBT,KAAM,EAAC;MAC3DV,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BoB,IAAI,EAAE;IAAQ,GACXR,KAAK,GAEVJ,QACF,CAAC;EACH;AACF;AAEAZ,aAAa,CAACyB,SAAS,GAAG;EACxBb,QAAQ,EAAEb,SAAS,CAAC2B,IAAI,CAACC,UAAU;EACnCd,SAAS,EAAEd,SAAS,CAAC6B,MAAM;EAC3Bd,KAAK,EAAEf,SAAS,CAAC8B,MAAM;EACvBrB,UAAU,EAAET,SAAS,CAAC+B,IAAI;EAC1Bf,GAAG,EAAEhB,SAAS,CAAC6B,MAAM;EACrBnB,QAAQ,EAAEV,SAAS,CAACgC;AACtB,CAAC;AAED/B,aAAa,CAACgC,YAAY,GAAG;EAC3BnB,SAAS,EAAEU,SAAS;EACpBT,KAAK,EAAES,SAAS;EAChBf,UAAU,EAAE,KAAK;EACjBO,GAAG,EAAE,KAAK;EACVN,QAAQ,EAAEA,CAAA,KAAM,CAAE;AACpB,CAAC"}
1
+ {"version":3,"file":"index.js","names":["React","classNames","PropTypes","ListBoxOption","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","onMouseDown","bind","_assertThisInitialized","_createClass","key","value","componentDidUpdate","prevProps","isSelected","onSelect","render","_this$props","children","className","index","tag","other","_objectWithoutProperties","_excluded","createElement","_objectSpread","active","id","undefined","concat","role","Component","default","propTypes","node","isRequired","string","number","bool","func","defaultProps"],"sources":["../../src/ListBoxOption/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nexport default class ListBoxOption extends React.Component {\n constructor(props) {\n super(props);\n\n this.onMouseDown = this.onMouseDown.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.isSelected && !prevProps.isSelected) {\n this.props.onSelect();\n }\n }\n\n /**\n * onMouseDown is used instead of onClick because onClick triggers the focus\n * event before click event. This focus event bubbles up to the parent\n * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.\n * This function will select the first ListBoxOption if one is not selected, and this\n * causes the user to see the first option selected before their desired option is selected\n * when the click event is fired shortly thereafter. The mouseDown event occurs before the\n * focus event, which prevents this behavior.\n */\n onMouseDown() {\n this.props.onSelect();\n }\n\n render() {\n const {\n children,\n className,\n index,\n isSelected,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-selected': isSelected,\n className: classNames(\n 'list-group-item',\n 'list-group-item-action',\n {\n active: this.props.isSelected,\n },\n className,\n ),\n id: index === undefined ? null : `list-box-option-${index}`,\n onMouseDown: this.onMouseDown,\n role: 'option',\n ...other,\n },\n children,\n );\n }\n}\n\nListBoxOption.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n index: PropTypes.number,\n isSelected: PropTypes.bool,\n tag: PropTypes.string,\n onSelect: PropTypes.func,\n};\n\nListBoxOption.defaultProps = {\n className: undefined,\n index: undefined,\n isSelected: false,\n tag: 'div',\n onSelect: () => { },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAAC,IAEdC,aAAa,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,aAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,aAAA;EAChC,SAAAA,cAAYK,KAAK,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAP,aAAA;IACjBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,KAAK;IAEXC,KAAA,CAAKG,WAA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