@lumx/react 3.10.1-alpha.2 → 3.10.1-alpha.4
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.
- package/_internal/{8d67e1e3.d.ts → index.d.ts} +1 -1
- package/_internal/index.js +99 -0
- package/_internal/index.js.map +1 -0
- package/index.d.ts +3000 -66
- package/index.js +14561 -64
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/button/Button.tsx +4 -5
- package/src/components/button/ButtonRoot.tsx +1 -3
- package/src/components/chip/Chip.tsx +7 -11
- package/src/components/date-picker/DatePickerControlled.tsx +1 -1
- package/src/components/dialog/Dialog.tsx +1 -1
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +2 -2
- package/src/components/expansion-panel/ExpansionPanel.tsx +14 -18
- package/src/components/flex-box/FlexBox.tsx +1 -1
- package/src/components/generic-block/GenericBlock.tsx +6 -7
- package/src/components/generic-block/constants.ts +9 -4
- package/src/components/grid-column/GridColumn.tsx +1 -2
- package/src/components/image-lightbox/internal/ImageSlide.tsx +2 -2
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +4 -8
- package/src/components/image-lightbox/useImageLightbox.tsx +3 -4
- package/src/components/link/Link.tsx +3 -5
- package/src/components/list/ListItem.tsx +2 -3
- package/src/components/list/useInteractiveList.tsx +1 -2
- package/src/components/mosaic/Mosaic.test.tsx +3 -3
- package/src/components/mosaic/Mosaic.tsx +2 -3
- package/src/components/navigation/Navigation.tsx +42 -37
- package/src/components/navigation/NavigationSection.tsx +76 -79
- package/src/components/notification/Notification.tsx +1 -5
- package/src/components/popover/usePopoverStyle.tsx +3 -1
- package/src/components/popover/useRestoreFocusOnClose.tsx +1 -1
- package/src/components/popover-dialog/PopoverDialog.test.tsx +1 -1
- package/src/components/post-block/PostBlock.tsx +4 -8
- package/src/components/progress-tracker/ProgressTracker.stories.tsx +11 -11
- package/src/components/select/Select.stories.tsx +14 -5
- package/src/components/select/Select.test.tsx +2 -2
- package/src/components/select/Select.tsx +1 -2
- package/src/components/select/SelectMultiple.stories.tsx +12 -10
- package/src/components/side-navigation/SideNavigationItem.tsx +1 -1
- package/src/components/slideshow/Slides.tsx +1 -1
- package/src/components/slideshow/SlideshowControls.tsx +1 -1
- package/src/components/slideshow/useSlideFocusManagement.tsx +1 -1
- package/src/components/switch/Switch.tsx +1 -2
- package/src/components/tabs/Tabs.stories.tsx +3 -4
- package/src/components/text-field/TextField.test.tsx +4 -4
- package/src/components/text-field/TextField.tsx +2 -3
- package/src/components/tooltip/Tooltip.test.tsx +2 -2
- package/src/components/tooltip/useTooltipOpen.tsx +3 -3
- package/src/components/user-block/UserBlock.tsx +7 -9
- package/src/hooks/useCallbackOnEscape.ts +1 -1
- package/src/hooks/useClickAway.tsx +1 -2
- package/src/hooks/useFocusTrap.ts +1 -1
- package/src/hooks/useInterval.tsx +1 -4
- package/src/hooks/useKeyboardListNavigation.tsx +2 -4
- package/src/hooks/useSizeOnWindowResize.ts +14 -10
- package/src/hooks/useStopPropagation.ts +1 -2
- package/src/hooks/useTransitionVisibility.ts +2 -2
- package/src/stories/decorators/withCombinations.tsx +1 -1
- package/src/testing/utils/commonTestsSuiteRTL.tsx +2 -2
- package/src/utils/{DOM → browser/DOM}/startViewTransition.ts +3 -3
- package/src/utils/{focus → browser/focus}/getFirstAndLastFocusable.test.ts +1 -1
- package/src/utils/{focus → browser/focus}/getFocusableElements.test.ts +1 -1
- package/src/utils/{browserDoesNotSupportHover.test.js → browser/isHoverNotSupported.test.js} +5 -5
- package/src/utils/browser/isHoverNotSupported.ts +2 -0
- package/src/utils/browser/{getPrefersReducedMotion.ts → isReducedMotion.ts} +1 -1
- package/src/utils/className/getFontColorClassName.ts +9 -0
- package/src/utils/{className.ts → className/getRootClassName.ts} +1 -21
- package/src/utils/className/getTypographyClassName.ts +9 -0
- package/src/utils/className/index.ts +4 -0
- package/src/utils/collection/castArray.test.ts +15 -0
- package/src/utils/collection/castArray.ts +3 -0
- package/src/utils/collection/chunk.test.ts +15 -0
- package/src/utils/collection/chunk.ts +6 -0
- package/src/utils/collection/isEmpty.test.js +20 -0
- package/src/utils/collection/isEmpty.ts +4 -0
- package/src/utils/collection/last.ts +2 -0
- package/src/utils/collection/partitionMulti.test.ts +35 -0
- package/src/utils/{partitionMulti.ts → collection/partitionMulti.ts} +13 -12
- package/src/utils/collection/pull.test.ts +17 -0
- package/src/utils/collection/pull.ts +7 -0
- package/src/utils/collection/range.test.js +9 -0
- package/src/utils/collection/range.ts +2 -0
- package/src/utils/date/getMonthCalendar.ts +3 -4
- package/src/utils/flattenChildren.ts +2 -3
- package/src/utils/function/memoize.test.ts +36 -0
- package/src/utils/function/memoize.ts +13 -0
- package/src/utils/makeListenerTowerContext.ts +2 -2
- package/src/utils/partitionMulti.test.ts +27 -0
- package/src/utils/react/forwardRef.ts +3 -2
- package/src/utils/react/forwardRefPolymorphic.ts +1 -2
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -96
- package/utils/index.js.map +1 -1
- package/_internal/17c3ea1d.js +0 -137
- package/_internal/17c3ea1d.js.map +0 -1
- package/_internal/1da25128.js +0 -411
- package/_internal/1da25128.js.map +0 -1
- package/_internal/230173a8.js +0 -13
- package/_internal/230173a8.js.map +0 -1
- package/_internal/23bdba2d.js +0 -71
- package/_internal/23bdba2d.js.map +0 -1
- package/_internal/26926e5c.d.ts +0 -36
- package/_internal/2a3d237c.js +0 -12
- package/_internal/2a3d237c.js.map +0 -1
- package/_internal/2c5dbb03.js +0 -26
- package/_internal/2c5dbb03.js.map +0 -1
- package/_internal/2e2abe51.js +0 -2154
- package/_internal/2e2abe51.js.map +0 -1
- package/_internal/31490c59.d.ts +0 -167
- package/_internal/3181f000.js +0 -14
- package/_internal/3181f000.js.map +0 -1
- package/_internal/35f100be.d.ts +0 -104
- package/_internal/36bd7352.js +0 -219
- package/_internal/36bd7352.js.map +0 -1
- package/_internal/3a1facc0.js +0 -18
- package/_internal/3a1facc0.js.map +0 -1
- package/_internal/4c20d932.js +0 -89
- package/_internal/4c20d932.js.map +0 -1
- package/_internal/4c28d012.js +0 -305
- package/_internal/4c28d012.js.map +0 -1
- package/_internal/4cd0bf32.js +0 -160
- package/_internal/4cd0bf32.js.map +0 -1
- package/_internal/4daccdd5.js +0 -25
- package/_internal/4daccdd5.js.map +0 -1
- package/_internal/524b1d04.js +0 -64
- package/_internal/524b1d04.js.map +0 -1
- package/_internal/53c94227.js +0 -123
- package/_internal/53c94227.js.map +0 -1
- package/_internal/54d9ded5.js +0 -418
- package/_internal/54d9ded5.js.map +0 -1
- package/_internal/56aec41b.js +0 -652
- package/_internal/56aec41b.js.map +0 -1
- package/_internal/5720caf5.js +0 -124
- package/_internal/5720caf5.js.map +0 -1
- package/_internal/646f0db6.js +0 -113
- package/_internal/646f0db6.js.map +0 -1
- package/_internal/6cc8dca8.d.ts +0 -22
- package/_internal/7f022f8c.d.ts +0 -34
- package/_internal/b8f2948d.js +0 -691
- package/_internal/b8f2948d.js.map +0 -1
- package/_internal/bc28d510.js +0 -784
- package/_internal/bc28d510.js.map +0 -1
- package/_internal/c68d24e4.js +0 -145
- package/_internal/c68d24e4.js.map +0 -1
- package/_internal/c6c99f76.js +0 -105
- package/_internal/c6c99f76.js.map +0 -1
- package/_internal/cae46566.js +0 -65
- package/_internal/cae46566.js.map +0 -1
- package/_internal/components/alert-dialog/index.ts-623b1ed3.d.ts +0 -37
- package/_internal/components/alert-dialog/index.ts-f83bd6ef.js +0 -148
- package/_internal/components/alert-dialog/index.ts-f83bd6ef.js.map +0 -1
- package/_internal/components/autocomplete/index.ts-3f8f125c.js +0 -264
- package/_internal/components/autocomplete/index.ts-3f8f125c.js.map +0 -1
- package/_internal/components/autocomplete/index.ts-8d6b123f.d.ts +0 -201
- package/_internal/components/avatar/index.ts-93ee0ea9.js +0 -89
- package/_internal/components/avatar/index.ts-93ee0ea9.js.map +0 -1
- package/_internal/components/avatar/index.ts-f92852b4.d.ts +0 -43
- package/_internal/components/badge/index.ts-2d7700ef.d.ts +0 -30
- package/_internal/components/badge/index.ts-6753d67f.js +0 -88
- package/_internal/components/badge/index.ts-6753d67f.js.map +0 -1
- package/_internal/components/button/index.ts-031307ce.js +0 -51
- package/_internal/components/button/index.ts-031307ce.js.map +0 -1
- package/_internal/components/button/index.ts-b29e26a4.d.ts +0 -22
- package/_internal/components/checkbox/index.ts-a33166d7.js +0 -127
- package/_internal/components/checkbox/index.ts-a33166d7.js.map +0 -1
- package/_internal/components/checkbox/index.ts-f82358ff.d.ts +0 -38
- package/_internal/components/chip/index.ts-4a91f1a7.d.ts +0 -68
- package/_internal/components/chip/index.ts-a2b5b771.js +0 -110
- package/_internal/components/chip/index.ts-a2b5b771.js.map +0 -1
- package/_internal/components/comment-block/index.ts-58fa051a.js +0 -121
- package/_internal/components/comment-block/index.ts-58fa051a.js.map +0 -1
- package/_internal/components/comment-block/index.ts-8cfa5af0.d.ts +0 -67
- package/_internal/components/date-picker/index.ts-145262d5.js +0 -2
- package/_internal/components/date-picker/index.ts-145262d5.js.map +0 -1
- package/_internal/components/date-picker/index.ts-70a34fa7.d.ts +0 -95
- package/_internal/components/dialog/index.ts-ea044db2.js +0 -224
- package/_internal/components/dialog/index.ts-ea044db2.js.map +0 -1
- package/_internal/components/dialog/index.ts-eca28654.d.ts +0 -55
- package/_internal/components/divider/index.ts-4a56db75.js +0 -55
- package/_internal/components/divider/index.ts-4a56db75.js.map +0 -1
- package/_internal/components/divider/index.ts-b011d8ca.d.ts +0 -18
- package/_internal/components/drag-handle/index.ts-0aebf92f.js +0 -54
- package/_internal/components/drag-handle/index.ts-0aebf92f.js.map +0 -1
- package/_internal/components/drag-handle/index.ts-3ab31dd1.d.ts +0 -18
- package/_internal/components/dropdown/index.ts-2a17db51.js +0 -154
- package/_internal/components/dropdown/index.ts-2a17db51.js.map +0 -1
- package/_internal/components/dropdown/index.ts-b648a15c.d.ts +0 -87
- package/_internal/components/expansion-panel/index.ts-69f09f5b.d.ts +0 -38
- package/_internal/components/expansion-panel/index.ts-fae3762e.js +0 -143
- package/_internal/components/expansion-panel/index.ts-fae3762e.js.map +0 -1
- package/_internal/components/flag/index.ts-8dcd685b.js +0 -56
- package/_internal/components/flag/index.ts-8dcd685b.js.map +0 -1
- package/_internal/components/flag/index.ts-fda89adb.d.ts +0 -23
- package/_internal/components/flex-box/index.ts-87f2b58d.d.ts +0 -43
- package/_internal/components/flex-box/index.ts-c216e957.js +0 -60
- package/_internal/components/flex-box/index.ts-c216e957.js.map +0 -1
- package/_internal/components/generic-block/index.ts-999a62a4.js +0 -115
- package/_internal/components/generic-block/index.ts-999a62a4.js.map +0 -1
- package/_internal/components/generic-block/index.ts-cd3b0e21.d.ts +0 -106
- package/_internal/components/grid/index.ts-67e0694f.d.ts +0 -50
- package/_internal/components/grid/index.ts-fdf1b306.js +0 -113
- package/_internal/components/grid/index.ts-fdf1b306.js.map +0 -1
- package/_internal/components/grid-column/index.ts-97c61cbe.js +0 -64
- package/_internal/components/grid-column/index.ts-97c61cbe.js.map +0 -1
- package/_internal/components/grid-column/index.ts-c89e1c18.d.ts +0 -31
- package/_internal/components/heading/index.ts-0179e9a9.js +0 -112
- package/_internal/components/heading/index.ts-0179e9a9.js.map +0 -1
- package/_internal/components/heading/index.ts-587579e8.d.ts +0 -37
- package/_internal/components/icon/index.ts-740ca1de.js +0 -2
- package/_internal/components/icon/index.ts-740ca1de.js.map +0 -1
- package/_internal/components/icon/index.ts-b3fa5e15.d.ts +0 -34
- package/_internal/components/image-block/index.ts-36b3828f.d.ts +0 -49
- package/_internal/components/image-block/index.ts-ef5e2e7d.js +0 -111
- package/_internal/components/image-block/index.ts-ef5e2e7d.js.map +0 -1
- package/_internal/components/image-lightbox/index.ts-137f85a8.js +0 -765
- package/_internal/components/image-lightbox/index.ts-137f85a8.js.map +0 -1
- package/_internal/components/image-lightbox/index.ts-2cb92d18.d.ts +0 -75
- package/_internal/components/inline-list/index.ts-033dd358.js +0 -76
- package/_internal/components/inline-list/index.ts-033dd358.js.map +0 -1
- package/_internal/components/inline-list/index.ts-e1c8a3ff.d.ts +0 -34
- package/_internal/components/input-helper/index.ts-32a9ca90.d.ts +0 -22
- package/_internal/components/input-helper/index.ts-ab3a1ef5.js +0 -75
- package/_internal/components/input-helper/index.ts-ab3a1ef5.js.map +0 -1
- package/_internal/components/input-label/index.ts-86f2ea41.d.ts +0 -24
- package/_internal/components/input-label/index.ts-d6ca5569.js +0 -60
- package/_internal/components/input-label/index.ts-d6ca5569.js.map +0 -1
- package/_internal/components/lightbox/index.ts-5370e8e6.d.ts +0 -36
- package/_internal/components/lightbox/index.ts-7a16cdc7.js +0 -149
- package/_internal/components/lightbox/index.ts-7a16cdc7.js.map +0 -1
- package/_internal/components/link/index.ts-26435006.d.ts +0 -37
- package/_internal/components/link/index.ts-d04f4e53.js +0 -120
- package/_internal/components/link/index.ts-d04f4e53.js.map +0 -1
- package/_internal/components/link-preview/index.ts-e560a274.d.ts +0 -36
- package/_internal/components/link-preview/index.ts-fee89f66.js +0 -109
- package/_internal/components/link-preview/index.ts-fee89f66.js.map +0 -1
- package/_internal/components/list/index.ts-ab57902e.d.ts +0 -118
- package/_internal/components/list/index.ts-f3101625.js +0 -86
- package/_internal/components/list/index.ts-f3101625.js.map +0 -1
- package/_internal/components/message/index.ts-041cf0cb.js +0 -97
- package/_internal/components/message/index.ts-041cf0cb.js.map +0 -1
- package/_internal/components/message/index.ts-2d38e0ea.d.ts +0 -37
- package/_internal/components/mosaic/index.ts-232d5aed.d.ts +0 -23
- package/_internal/components/mosaic/index.ts-d2128cd3.js +0 -94
- package/_internal/components/mosaic/index.ts-d2128cd3.js.map +0 -1
- package/_internal/components/navigation/index.ts-6d8bea53.d.ts +0 -58
- package/_internal/components/navigation/index.ts-e8dc0a7f.js +0 -222
- package/_internal/components/navigation/index.ts-e8dc0a7f.js.map +0 -1
- package/_internal/components/notification/index.ts-235fd340.js +0 -140
- package/_internal/components/notification/index.ts-235fd340.js.map +0 -1
- package/_internal/components/notification/index.ts-bb3f03f6.d.ts +0 -34
- package/_internal/components/popover/index.ts-2f17a9b6.js +0 -3
- package/_internal/components/popover/index.ts-2f17a9b6.js.map +0 -1
- package/_internal/components/popover/index.ts-e3b4ff19.d.ts +0 -66
- package/_internal/components/post-block/index.ts-0acb9bb4.js +0 -101
- package/_internal/components/post-block/index.ts-0acb9bb4.js.map +0 -1
- package/_internal/components/post-block/index.ts-9b8ff90b.d.ts +0 -41
- package/_internal/components/progress/index.ts-2a713859.js +0 -189
- package/_internal/components/progress/index.ts-2a713859.js.map +0 -1
- package/_internal/components/progress/index.ts-dfdfa5fb.d.ts +0 -60
- package/_internal/components/progress-tracker/index.ts-2649f756.js +0 -312
- package/_internal/components/progress-tracker/index.ts-2649f756.js.map +0 -1
- package/_internal/components/progress-tracker/index.ts-95320f32.d.ts +0 -101
- package/_internal/components/radio-button/index.ts-5eaab4cf.d.ts +0 -54
- package/_internal/components/radio-button/index.ts-b4dfb2a0.js +0 -150
- package/_internal/components/radio-button/index.ts-b4dfb2a0.js.map +0 -1
- package/_internal/components/select/index.ts-a65e3507.d.ts +0 -91
- package/_internal/components/select/index.ts-e8fad28b.js +0 -257
- package/_internal/components/select/index.ts-e8fad28b.js.map +0 -1
- package/_internal/components/side-navigation/index.ts-3f5f3785.d.ts +0 -60
- package/_internal/components/side-navigation/index.ts-c9a5fc3e.js +0 -184
- package/_internal/components/side-navigation/index.ts-c9a5fc3e.js.map +0 -1
- package/_internal/components/skeleton/index.ts-a7daefac.d.ts +0 -75
- package/_internal/components/skeleton/index.ts-ffc995af.js +0 -179
- package/_internal/components/skeleton/index.ts-ffc995af.js.map +0 -1
- package/_internal/components/slider/index.ts-24a0d598.d.ts +0 -52
- package/_internal/components/slider/index.ts-72aadf4c.js +0 -308
- package/_internal/components/slider/index.ts-72aadf4c.js.map +0 -1
- package/_internal/components/slideshow/index.ts-c99f2892.js +0 -151
- package/_internal/components/slideshow/index.ts-c99f2892.js.map +0 -1
- package/_internal/components/slideshow/index.ts-e49462c6.d.ts +0 -25
- package/_internal/components/switch/index.ts-207ba52b.d.ts +0 -34
- package/_internal/components/switch/index.ts-542e6eaf.js +0 -115
- package/_internal/components/switch/index.ts-542e6eaf.js.map +0 -1
- package/_internal/components/table/index.ts-905ce390.js +0 -310
- package/_internal/components/table/index.ts-905ce390.js.map +0 -1
- package/_internal/components/table/index.ts-c4f39b2d.d.ts +0 -108
- package/_internal/components/tabs/index.ts-713119f4.js +0 -289
- package/_internal/components/tabs/index.ts-713119f4.js.map +0 -1
- package/_internal/components/tabs/index.ts-dbfc48d9.d.ts +0 -106
- package/_internal/components/text/index.ts-6afbe8cd.js +0 -2
- package/_internal/components/text/index.ts-6afbe8cd.js.map +0 -1
- package/_internal/components/text/index.ts-8a812048.d.ts +0 -53
- package/_internal/components/text-field/index.ts-92e6b3b3.d.ts +0 -77
- package/_internal/components/text-field/index.ts-c3be8563.js +0 -341
- package/_internal/components/text-field/index.ts-c3be8563.js.map +0 -1
- package/_internal/components/thumbnail/index.ts-16d7b403.js +0 -40
- package/_internal/components/thumbnail/index.ts-16d7b403.js.map +0 -1
- package/_internal/components/thumbnail/index.ts-1b6c0b48.d.ts +0 -8
- package/_internal/components/toolbar/index.ts-813b902e.js +0 -63
- package/_internal/components/toolbar/index.ts-813b902e.js.map +0 -1
- package/_internal/components/toolbar/index.ts-9f5129d1.d.ts +0 -24
- package/_internal/components/tooltip/index.ts-905c847c.js +0 -322
- package/_internal/components/tooltip/index.ts-905c847c.js.map +0 -1
- package/_internal/components/tooltip/index.ts-c6931e9e.d.ts +0 -35
- package/_internal/components/uploader/index.ts-31f21c2a.js +0 -132
- package/_internal/components/uploader/index.ts-31f21c2a.js.map +0 -1
- package/_internal/components/uploader/index.ts-c3ccba98.d.ts +0 -51
- package/_internal/components/user-block/index.ts-18c58e19.d.ts +0 -50
- package/_internal/components/user-block/index.ts-d43e5f3c.js +0 -136
- package/_internal/components/user-block/index.ts-d43e5f3c.js.map +0 -1
- package/_internal/dc3e28c8.d.ts +0 -38
- package/_internal/f39a1ba4.js +0 -73
- package/_internal/f39a1ba4.js.map +0 -1
- package/_internal/f3e77e3e.js +0 -22
- package/_internal/f3e77e3e.js.map +0 -1
- package/_internal/f502ab30.js +0 -78
- package/_internal/f502ab30.js.map +0 -1
- package/_internal/f52adbae.js +0 -36
- package/_internal/f52adbae.js.map +0 -1
- package/_internal/f57e1239.js +0 -205
- package/_internal/f57e1239.js.map +0 -1
- package/_internal/f5ff1aa4.d.ts +0 -47
- package/_internal/fb975afe.js +0 -52
- package/_internal/fb975afe.js.map +0 -1
- package/src/utils/browserDoesNotSupportHover.ts +0 -2
- package/src/utils/isInternetExplorer.ts +0 -15
- package/src/utils/userHasReducedMotion.ts +0 -7
- package/src/utils/utils.test.ts +0 -48
- /package/src/utils/{DOM → browser/DOM}/findImage.tsx +0 -0
- /package/src/utils/{event.ts → browser/event.ts} +0 -0
- /package/src/utils/{focus → browser/focus}/constants.ts +0 -0
- /package/src/utils/{focus → browser/focus}/getFirstAndLastFocusable.ts +0 -0
- /package/src/utils/{focus → browser/focus}/getFocusableElements.ts +0 -0
- /package/src/utils/{isFocusVisible.ts → browser/isFocusVisible.ts} +0 -0
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.10.1-alpha.
|
|
10
|
-
"@lumx/icons": "^3.10.1-alpha.
|
|
9
|
+
"@lumx/core": "^3.10.1-alpha.4",
|
|
10
|
+
"@lumx/icons": "^3.10.1-alpha.4",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.10.1-alpha.
|
|
113
|
+
"version": "3.10.1-alpha.4"
|
|
114
114
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
|
|
6
5
|
import { Emphasis, Icon, Size, Theme, Text } from '@lumx/react';
|
|
7
6
|
import { isComponent } from '@lumx/react/utils/type';
|
|
@@ -62,8 +61,8 @@ export const Button = forwardRef<ButtonProps, HTMLButtonElement | HTMLAnchorElem
|
|
|
62
61
|
|
|
63
62
|
const buttonClassName = classNames(
|
|
64
63
|
className,
|
|
65
|
-
getBasicClass({ prefix: CLASSNAME, type: 'hasLeftIcon', value:
|
|
66
|
-
getBasicClass({ prefix: CLASSNAME, type: 'hasRightIcon', value:
|
|
64
|
+
getBasicClass({ prefix: CLASSNAME, type: 'hasLeftIcon', value: !!leftIcon }),
|
|
65
|
+
getBasicClass({ prefix: CLASSNAME, type: 'hasRightIcon', value: !!rightIcon }),
|
|
67
66
|
);
|
|
68
67
|
|
|
69
68
|
return (
|
|
@@ -73,9 +72,9 @@ export const Button = forwardRef<ButtonProps, HTMLButtonElement | HTMLAnchorElem
|
|
|
73
72
|
className={buttonClassName}
|
|
74
73
|
variant="button"
|
|
75
74
|
>
|
|
76
|
-
{leftIcon &&
|
|
75
|
+
{leftIcon && <Icon icon={leftIcon} />}
|
|
77
76
|
{children && (isComponent(Text)(children) ? children : <span>{children}</span>)}
|
|
78
|
-
{rightIcon &&
|
|
77
|
+
{rightIcon && <Icon icon={rightIcon} />}
|
|
79
78
|
</ButtonRoot>
|
|
80
79
|
);
|
|
81
80
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, RefObject } from 'react';
|
|
2
2
|
|
|
3
|
-
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
|
|
7
5
|
import { ColorPalette, Emphasis, Size, Theme } from '@lumx/react';
|
|
@@ -155,7 +153,7 @@ export const ButtonRoot = forwardRef<ButtonRootProps, HTMLButtonElement | HTMLAn
|
|
|
155
153
|
*
|
|
156
154
|
* However, in any case, if the component is disabled, we returned a <button> since disabled is not compatible with <a>.
|
|
157
155
|
*/
|
|
158
|
-
if ((linkAs ||
|
|
156
|
+
if ((linkAs || props.href) && !isDisabled) {
|
|
159
157
|
return renderLink(
|
|
160
158
|
{
|
|
161
159
|
linkAs,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React, { MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isFunction from 'lodash/isFunction';
|
|
5
4
|
|
|
6
5
|
import { ColorPalette, Size, Theme } from '@lumx/react';
|
|
7
6
|
import { useStopPropagation } from '@lumx/react/hooks/useStopPropagation';
|
|
8
7
|
|
|
9
8
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
10
9
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
11
|
-
import { onEnterPressed } from '@lumx/react/utils/event';
|
|
10
|
+
import { onEnterPressed } from '@lumx/react/utils/browser/event';
|
|
12
11
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
13
12
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
14
13
|
|
|
@@ -89,11 +88,8 @@ export const Chip = forwardRef<ChipProps, HTMLAnchorElement>((props, ref) => {
|
|
|
89
88
|
onKeyDown,
|
|
90
89
|
...forwardedProps
|
|
91
90
|
} = props;
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
const hasOnClick = isFunction(onClick);
|
|
95
|
-
const isButton = hasOnClick && !href;
|
|
96
|
-
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
91
|
+
const isButton = onClick && !href;
|
|
92
|
+
const isClickable = Boolean(onClick) || Boolean(href) || propIsClickable;
|
|
97
93
|
|
|
98
94
|
// Adapt color to the theme.
|
|
99
95
|
const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
@@ -102,7 +98,7 @@ export const Chip = forwardRef<ChipProps, HTMLAnchorElement>((props, ref) => {
|
|
|
102
98
|
const handleOnAfterClick = useStopPropagation(onAfterClick);
|
|
103
99
|
const handleKeyDown = (evt: React.KeyboardEvent) => {
|
|
104
100
|
onKeyDown?.(evt);
|
|
105
|
-
if (
|
|
101
|
+
if (onClick) {
|
|
106
102
|
onEnterPressed(onClick)(evt);
|
|
107
103
|
}
|
|
108
104
|
};
|
|
@@ -131,14 +127,14 @@ export const Chip = forwardRef<ChipProps, HTMLAnchorElement>((props, ref) => {
|
|
|
131
127
|
}),
|
|
132
128
|
)}
|
|
133
129
|
aria-disabled={(isClickable && isDisabled) || undefined}
|
|
134
|
-
onClick={
|
|
130
|
+
onClick={onClick || undefined}
|
|
135
131
|
onKeyDown={handleKeyDown}
|
|
136
132
|
>
|
|
137
133
|
{before && (
|
|
138
134
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
139
135
|
<div
|
|
140
136
|
className={classNames(`${CLASSNAME}__before`, {
|
|
141
|
-
[`${CLASSNAME}__before--is-clickable`]:
|
|
137
|
+
[`${CLASSNAME}__before--is-clickable`]: !!onBeforeClick,
|
|
142
138
|
})}
|
|
143
139
|
onClick={handleOnBeforeClick}
|
|
144
140
|
>
|
|
@@ -150,7 +146,7 @@ export const Chip = forwardRef<ChipProps, HTMLAnchorElement>((props, ref) => {
|
|
|
150
146
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
151
147
|
<div
|
|
152
148
|
className={classNames(`${CLASSNAME}__after`, {
|
|
153
|
-
[`${CLASSNAME}__after--is-clickable`]:
|
|
149
|
+
[`${CLASSNAME}__after--is-clickable`]: !!onAfterClick,
|
|
154
150
|
})}
|
|
155
151
|
onClick={handleOnAfterClick}
|
|
156
152
|
>
|
|
@@ -21,7 +21,7 @@ import { parseLocale } from '@lumx/react/utils/locale/parseLocale';
|
|
|
21
21
|
import { Locale } from '@lumx/react/utils/locale/types';
|
|
22
22
|
import { usePreviousValue } from '@lumx/react/hooks/usePreviousValue';
|
|
23
23
|
import { getYearDisplayName } from '@lumx/react/utils/date/getYearDisplayName';
|
|
24
|
-
import { onEnterPressed } from '@lumx/react/utils/event';
|
|
24
|
+
import { onEnterPressed } from '@lumx/react/utils/browser/event';
|
|
25
25
|
import { addMonthResetDay } from '@lumx/react/utils/date/addMonthResetDay';
|
|
26
26
|
import { formatDayNumber } from '@lumx/react/utils/date/formatDayNumber';
|
|
27
27
|
import { VISUALLY_HIDDEN } from '@lumx/react/constants';
|
|
@@ -11,7 +11,7 @@ import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
|
11
11
|
import { useIntersectionObserver } from '@lumx/react/hooks/useIntersectionObserver';
|
|
12
12
|
|
|
13
13
|
import { GenericProps, isComponent } from '@lumx/react/utils/type';
|
|
14
|
-
import { partitionMulti } from '@lumx/react/utils/partitionMulti';
|
|
14
|
+
import { partitionMulti } from '@lumx/react/utils/collection/partitionMulti';
|
|
15
15
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
16
16
|
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
17
17
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
@@ -4,14 +4,14 @@ import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/uti
|
|
|
4
4
|
import { queryByRole, render, screen } from '@testing-library/react';
|
|
5
5
|
import { getByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
|
|
6
6
|
import userEvent from '@testing-library/user-event';
|
|
7
|
-
import { isFocusVisible } from '@lumx/react/utils/isFocusVisible';
|
|
7
|
+
import { isFocusVisible } from '@lumx/react/utils/browser/isFocusVisible';
|
|
8
8
|
|
|
9
9
|
import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
|
|
10
10
|
import { ExpansionPanel, ExpansionPanelProps } from '.';
|
|
11
11
|
|
|
12
12
|
const CLASSNAME = ExpansionPanel.className as string;
|
|
13
13
|
|
|
14
|
-
jest.mock('@lumx/react/utils/isFocusVisible');
|
|
14
|
+
jest.mock('@lumx/react/utils/browser/isFocusVisible');
|
|
15
15
|
|
|
16
16
|
const mockChildrenContent = 'children content';
|
|
17
17
|
|
|
@@ -4,18 +4,15 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { mdiChevronDown, mdiChevronUp } from '@lumx/icons';
|
|
6
6
|
|
|
7
|
-
import get from 'lodash/get';
|
|
8
|
-
import isEmpty from 'lodash/isEmpty';
|
|
9
|
-
import isFunction from 'lodash/isFunction';
|
|
10
|
-
|
|
11
7
|
import { ColorPalette, DragHandle, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';
|
|
12
8
|
import { GenericProps, HasTheme, isComponent } from '@lumx/react/utils/type';
|
|
13
9
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
14
|
-
import { partitionMulti } from '@lumx/react/utils/partitionMulti';
|
|
10
|
+
import { partitionMulti } from '@lumx/react/utils/collection/partitionMulti';
|
|
15
11
|
import { useTransitionVisibility } from '@lumx/react/hooks/useTransitionVisibility';
|
|
16
12
|
import { EXPANSION_PANEL_TRANSITION_DURATION } from '@lumx/core/js/constants';
|
|
17
13
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
18
14
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
15
|
+
import { isEmpty } from '@lumx/react/utils/collection/isEmpty';
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* Defines the props of the component.
|
|
@@ -90,24 +87,23 @@ export const ExpansionPanel = forwardRef<ExpansionPanelProps, HTMLDivElement>((p
|
|
|
90
87
|
|
|
91
88
|
// Either take the header in children or create one with the label.
|
|
92
89
|
const headerProps: PropsWithChildren<any> = React.isValidElement(header) ? header.props : {};
|
|
93
|
-
const headerContent =
|
|
94
|
-
headerProps.children
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
const headerContent =
|
|
91
|
+
React.Children.count(headerProps.children) > 0 ? (
|
|
92
|
+
headerProps.children
|
|
93
|
+
) : (
|
|
94
|
+
<span className={`${CLASSNAME}__label`}>{label}</span>
|
|
95
|
+
);
|
|
98
96
|
|
|
99
97
|
const toggleOpen = (event: React.MouseEvent) => {
|
|
100
98
|
const shouldOpen = !isOpen;
|
|
101
99
|
|
|
102
|
-
if (
|
|
103
|
-
onOpen(event);
|
|
104
|
-
}
|
|
105
|
-
if (isFunction(onClose) && !shouldOpen) {
|
|
106
|
-
onClose(event);
|
|
100
|
+
if (shouldOpen) {
|
|
101
|
+
onOpen?.(event);
|
|
107
102
|
}
|
|
108
|
-
if (
|
|
109
|
-
|
|
103
|
+
if (!shouldOpen) {
|
|
104
|
+
onClose?.(event);
|
|
110
105
|
}
|
|
106
|
+
onToggleOpen?.(shouldOpen, event);
|
|
111
107
|
};
|
|
112
108
|
|
|
113
109
|
const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
|
|
@@ -134,7 +130,7 @@ export const ExpansionPanel = forwardRef<ExpansionPanelProps, HTMLDivElement>((p
|
|
|
134
130
|
// Switch max height on/off to activate the CSS transition (updates when children changes).
|
|
135
131
|
const [maxHeight, setMaxHeight] = useState('0');
|
|
136
132
|
useEffect(() => {
|
|
137
|
-
const height = isOpen ?
|
|
133
|
+
const height = isOpen ? wrapperRef.current?.offsetHeight ?? 0 : 0;
|
|
138
134
|
setMaxHeight(`${height}px`);
|
|
139
135
|
}, [children, isOpen]);
|
|
140
136
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import castArray from 'lodash/castArray';
|
|
5
4
|
|
|
6
5
|
import { Alignment, Orientation } from '@lumx/react';
|
|
6
|
+
import { castArray } from '@lumx/react/utils/collection/castArray';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
8
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { Children, ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
|
-
import noop from 'lodash/noop';
|
|
6
4
|
|
|
7
5
|
import { Comp, isComponentType } from '@lumx/react/utils/type';
|
|
8
6
|
import { getRootClassName } from '@lumx/react/utils/className';
|
|
9
|
-
import { partitionMulti } from '@lumx/react/utils/partitionMulti';
|
|
7
|
+
import { partitionMulti } from '@lumx/react/utils/collection/partitionMulti';
|
|
10
8
|
import { Orientation, Size, FlexBox, FlexBoxProps } from '@lumx/react';
|
|
11
9
|
import { GenericBlockGapSize } from '@lumx/react/components/generic-block/constants';
|
|
12
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -101,13 +99,13 @@ interface GenericBlock extends BaseGenericBlock {
|
|
|
101
99
|
Actions: Comp<GenericBlockSectionProps>;
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
const Figure =
|
|
102
|
+
const Figure = (() => {}) as unknown as Comp<FlexBoxProps>;
|
|
105
103
|
const isFigure = isComponentType(Figure);
|
|
106
104
|
|
|
107
|
-
const Content =
|
|
105
|
+
const Content = (() => {}) as unknown as Comp<FlexBoxProps>;
|
|
108
106
|
const isContent = isComponentType(Content);
|
|
109
107
|
|
|
110
|
-
const Actions =
|
|
108
|
+
const Actions = (() => {}) as unknown as Comp<FlexBoxProps>;
|
|
111
109
|
const isActions = isComponentType(Actions);
|
|
112
110
|
|
|
113
111
|
/**
|
|
@@ -148,7 +146,8 @@ const BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
148
146
|
contentChildProps: (contentChild as ReactElement)?.props,
|
|
149
147
|
actionsChild,
|
|
150
148
|
actionsChildProps: (actionsChild as ReactElement)?.props,
|
|
151
|
-
|
|
149
|
+
// TODO: check this is working
|
|
150
|
+
otherChildren: otherChildren.filter((child) => React.Children.count(child) > 0),
|
|
152
151
|
};
|
|
153
152
|
}, [children]);
|
|
154
153
|
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import pick from 'lodash/pick';
|
|
2
1
|
import { Size } from '@lumx/react';
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export type GenericBlockGapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Accepted gap sizes for the generic block.
|
|
7
7
|
*/
|
|
8
|
-
export const GenericBlockGapSize
|
|
9
|
-
|
|
8
|
+
export const GenericBlockGapSize: { [S in GenericBlockGapSize]: S } = {
|
|
9
|
+
tiny: Size.tiny,
|
|
10
|
+
regular: Size.regular,
|
|
11
|
+
medium: Size.medium,
|
|
12
|
+
big: Size.big,
|
|
13
|
+
huge: Size.huge,
|
|
14
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import isInteger from 'lodash/isInteger';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
6
5
|
import { Size } from '@lumx/react';
|
|
@@ -74,7 +73,7 @@ export const GridColumn = forwardRef<GridColumnProps>((props, ref): ReactElement
|
|
|
74
73
|
)}
|
|
75
74
|
style={{
|
|
76
75
|
...style,
|
|
77
|
-
['--lumx-grid-column-item-min-width' as any]: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
76
|
+
['--lumx-grid-column-item-min-width' as any]: Number.isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
78
77
|
['--lumx-grid-column-columns' as any]: maxColumns,
|
|
79
78
|
['--lumx-grid-column-gap' as any]: gap && `var(--lumx-spacing-unit-${gap})`,
|
|
80
79
|
}}
|
|
@@ -4,7 +4,7 @@ import { SlideshowItem, Thumbnail } from '@lumx/react';
|
|
|
4
4
|
import { useMergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
5
5
|
import { useSizeOnWindowResize } from '@lumx/react/hooks/useSizeOnWindowResize';
|
|
6
6
|
import { useImageSize } from '@lumx/react/hooks/useImageSize';
|
|
7
|
-
import {
|
|
7
|
+
import { isReducedMotion } from '@lumx/react/utils/browser/isReducedMotion';
|
|
8
8
|
import { isEqual } from '@lumx/react/utils/object/isEqual';
|
|
9
9
|
|
|
10
10
|
import { CLASSNAME } from '../constants';
|
|
@@ -97,7 +97,7 @@ export const ImageSlide = React.memo((props: ImageSlideProps) => {
|
|
|
97
97
|
maxWidth: scrollAreaSize?.width,
|
|
98
98
|
}),
|
|
99
99
|
// Only animate when scale is set, and we are not pointer zooming and the user does not prefer reduced motion
|
|
100
|
-
transition: scale && !isPointerZooming && !
|
|
100
|
+
transition: scale && !isPointerZooming && !isReducedMotion() ? 'all 250ms' : undefined,
|
|
101
101
|
},
|
|
102
102
|
}}
|
|
103
103
|
loadingPlaceholderImageRef={loadingPlaceholderImageRef}
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { mdiMagnifyMinusOutline, mdiMagnifyPlusOutline } from '@lumx/icons';
|
|
4
4
|
import { FlexBox, IconButton, Slides, SlideshowControls } from '@lumx/react';
|
|
5
5
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
6
|
+
import { memoize } from '@lumx/react/utils/function/memoize';
|
|
6
7
|
|
|
7
|
-
import memoize from 'lodash/memoize';
|
|
8
8
|
import { ImageCaption } from '../../image-block/ImageCaption';
|
|
9
9
|
import { CLASSNAME } from '../constants';
|
|
10
10
|
import type { ImagesProps, InheritedSlideShowProps, ZoomButtonProps } from '../types';
|
|
@@ -113,13 +113,9 @@ export const ImageSlideshow: React.FC<ImageSlideshowProps> = ({
|
|
|
113
113
|
|
|
114
114
|
const getImgRef = React.useMemo(
|
|
115
115
|
() =>
|
|
116
|
-
memoize(
|
|
117
|
-
(index
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
// memoize based on both arguments
|
|
121
|
-
(...args) => args.join(),
|
|
122
|
-
),
|
|
116
|
+
memoize((index: number, isActive: boolean) => {
|
|
117
|
+
return mergeRefs(images?.[index].imgRef, isActive ? activeImageRef : undefined);
|
|
118
|
+
}),
|
|
123
119
|
[images, activeImageRef],
|
|
124
120
|
);
|
|
125
121
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { findImage } from '@lumx/react/utils/DOM/findImage';
|
|
3
|
+
import { startViewTransition } from '@lumx/react/utils/browser/DOM/startViewTransition';
|
|
4
|
+
import { findImage } from '@lumx/react/utils/browser/DOM/findImage';
|
|
5
|
+
import { memoize } from '@lumx/react/utils/function/memoize';
|
|
7
6
|
|
|
8
7
|
import type { ImageLightboxProps } from './types';
|
|
9
8
|
import { CLASSNAME } from './constants';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { RefObject, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
|
|
7
5
|
import { ColorPalette, ColorVariant, Icon, Size, Typography } from '@lumx/react';
|
|
@@ -102,7 +100,7 @@ export const Link = forwardRef<LinkProps, HTMLAnchorElement | HTMLButtonElement>
|
|
|
102
100
|
const renderedChildren = useMemo(
|
|
103
101
|
() => (
|
|
104
102
|
<>
|
|
105
|
-
{leftIcon &&
|
|
103
|
+
{leftIcon && (
|
|
106
104
|
<Icon icon={leftIcon} className={`${CLASSNAME}__left-icon`} size={getIconSize(typography)} />
|
|
107
105
|
)}
|
|
108
106
|
|
|
@@ -116,7 +114,7 @@ export const Link = forwardRef<LinkProps, HTMLAnchorElement | HTMLButtonElement>
|
|
|
116
114
|
</span>
|
|
117
115
|
)}
|
|
118
116
|
|
|
119
|
-
{rightIcon &&
|
|
117
|
+
{rightIcon && (
|
|
120
118
|
<Icon icon={rightIcon} className={`${CLASSNAME}__right-icon`} size={getIconSize(typography)} />
|
|
121
119
|
)}
|
|
122
120
|
</>
|
|
@@ -128,7 +126,7 @@ export const Link = forwardRef<LinkProps, HTMLAnchorElement | HTMLButtonElement>
|
|
|
128
126
|
* If there is no linkAs prop and no href, we returned a <button> instead of a <a>.
|
|
129
127
|
* If the component is disabled, we also returned a <button> since disabled is not compatible with <a>.
|
|
130
128
|
*/
|
|
131
|
-
if ((!linkAs &&
|
|
129
|
+
if ((!linkAs && href) || isDisabled) {
|
|
132
130
|
return (
|
|
133
131
|
<button
|
|
134
132
|
type="button"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { ReactNode, Ref, SyntheticEvent, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
|
|
6
5
|
import { ListProps, Size } from '@lumx/react';
|
|
7
6
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import { onEnterPressed, onButtonPressed } from '@lumx/react/utils/event';
|
|
7
|
+
import { onEnterPressed, onButtonPressed } from '@lumx/react/utils/browser/event';
|
|
9
8
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
10
9
|
import { renderLink } from '@lumx/react/utils/renderLink';
|
|
11
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -65,7 +64,7 @@ const DEFAULT_PROPS: Partial<ListProps> = {
|
|
|
65
64
|
* @return `true` if the list item is clickable; `false` otherwise.
|
|
66
65
|
*/
|
|
67
66
|
export function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean {
|
|
68
|
-
return
|
|
67
|
+
return !!linkProps?.href || !!onItemSelected;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
/**
|
|
@@ -4,7 +4,6 @@ import { isClickable } from '@lumx/react/components/list/ListItem';
|
|
|
4
4
|
import { isComponent } from '@lumx/react/utils/type';
|
|
5
5
|
import { flattenChildren } from '@lumx/react/utils/flattenChildren';
|
|
6
6
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
7
|
-
import get from 'lodash/get';
|
|
8
7
|
import {
|
|
9
8
|
cloneElement,
|
|
10
9
|
Key,
|
|
@@ -147,7 +146,7 @@ export const useInteractiveList: useInteractiveList = (options) => {
|
|
|
147
146
|
setActiveItemIndex(nextIndex);
|
|
148
147
|
evt.preventDefault();
|
|
149
148
|
evt.stopPropagation();
|
|
150
|
-
onListItemNavigated?.(nextIndex,
|
|
149
|
+
onListItemNavigated?.(nextIndex, (items[nextIndex] as ReactElement)?.key);
|
|
151
150
|
};
|
|
152
151
|
|
|
153
152
|
/**
|
|
@@ -5,8 +5,8 @@ import { render, screen, within } from '@testing-library/react';
|
|
|
5
5
|
import { getByClassName, queryAllByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
|
|
6
6
|
import { Thumbnail } from '@lumx/react';
|
|
7
7
|
import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
|
|
8
|
-
import range from 'lodash/range';
|
|
9
8
|
import userEvent from '@testing-library/user-event';
|
|
9
|
+
import { range } from '@lumx/react/utils/collection/range';
|
|
10
10
|
|
|
11
11
|
const CLASSNAME = Mosaic.className as string;
|
|
12
12
|
|
|
@@ -19,8 +19,8 @@ const setup = (props: Partial<MosaicProps> = {}, { wrapper }: SetupRenderOptions
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const generateThumbnails = (count: number) =>
|
|
22
|
-
range(
|
|
23
|
-
image: `https://example.com/image${i}.png`,
|
|
22
|
+
range(count).map((i) => ({
|
|
23
|
+
image: `https://example.com/image${i + 1}.png`,
|
|
24
24
|
alt: '',
|
|
25
25
|
}));
|
|
26
26
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { MouseEventHandler, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import take from 'lodash/take';
|
|
5
|
-
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
6
4
|
|
|
5
|
+
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
7
6
|
import { Alignment, AspectRatio, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';
|
|
8
7
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
9
8
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
@@ -66,7 +65,7 @@ export const Mosaic = forwardRef<MosaicProps, HTMLDivElement>((props, ref) => {
|
|
|
66
65
|
})}
|
|
67
66
|
>
|
|
68
67
|
<div className={`${CLASSNAME}__wrapper`}>
|
|
69
|
-
{
|
|
68
|
+
{thumbnails.slice(-4).map((thumbnail: any, index: number) => {
|
|
70
69
|
const { image, onClick, align, ...thumbnailProps } = thumbnail;
|
|
71
70
|
|
|
72
71
|
return (
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
import classNames from 'classnames';
|
|
4
|
+
|
|
3
5
|
import { HasAriaLabelOrLabelledBy, HasClassName, HasTheme } from '@lumx/react/utils/type';
|
|
4
6
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
5
7
|
import { Orientation, Theme } from '@lumx/react';
|
|
6
8
|
import { ThemeProvider, useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
|
+
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
|
+
|
|
7
11
|
import { NavigationSection } from './NavigationSection';
|
|
8
12
|
import { NavigationItem } from './NavigationItem';
|
|
9
13
|
import { NavigationContext } from './context';
|
|
@@ -12,7 +16,7 @@ export type NavigationProps = React.ComponentProps<'nav'> &
|
|
|
12
16
|
HasClassName &
|
|
13
17
|
HasTheme & {
|
|
14
18
|
/** Content of the navigation. These components should be of type NavigationItem to be rendered */
|
|
15
|
-
children?: ReactNode;
|
|
19
|
+
children?: React.ReactNode;
|
|
16
20
|
orientation?: Orientation;
|
|
17
21
|
} & HasAriaLabelOrLabelledBy;
|
|
18
22
|
|
|
@@ -33,38 +37,39 @@ const DEFAULT_PROPS = {
|
|
|
33
37
|
orientation: Orientation.vertical,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
type SubComponents = {
|
|
41
|
+
Section: typeof NavigationSection;
|
|
42
|
+
Item: typeof NavigationItem;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Navigation = forwardRef<NavigationProps, HTMLElement, SubComponents>((props, ref) => {
|
|
46
|
+
const defaultTheme = useTheme() || Theme.light;
|
|
47
|
+
const { children, className, theme = defaultTheme, orientation, ...forwardedProps } = props;
|
|
48
|
+
return (
|
|
49
|
+
<ThemeProvider value={theme}>
|
|
50
|
+
<nav
|
|
51
|
+
className={classNames(
|
|
52
|
+
className,
|
|
53
|
+
handleBasicClasses({
|
|
54
|
+
prefix: CLASSNAME,
|
|
55
|
+
theme,
|
|
56
|
+
orientation,
|
|
57
|
+
}),
|
|
58
|
+
)}
|
|
59
|
+
ref={ref}
|
|
60
|
+
{...forwardedProps}
|
|
61
|
+
>
|
|
62
|
+
<NavigationContext.Provider value={{ orientation }}>
|
|
63
|
+
<ul className={`${CLASSNAME}__list`}>{children}</ul>
|
|
64
|
+
</NavigationContext.Provider>
|
|
65
|
+
</nav>
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
Navigation.displayName = COMPONENT_NAME;
|
|
70
|
+
Navigation.className = CLASSNAME;
|
|
71
|
+
Navigation.defaultProps = DEFAULT_PROPS;
|
|
72
|
+
|
|
73
|
+
// Sub components
|
|
74
|
+
Navigation.Section = NavigationSection;
|
|
75
|
+
Navigation.Item = NavigationItem;
|