@lumx/react 3.1.1 → 3.1.3-alpha.0
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/{dist/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
- package/{dist/LICENSE.md → LICENSE.md} +0 -0
- package/{dist/_internal → _internal}/ClickAwayProvider.js +0 -0
- package/{dist/_internal → _internal}/ClickAwayProvider.js.map +0 -0
- package/{dist/_internal → _internal}/types.d.ts +1 -1
- package/{dist/index.d.ts → index.d.ts} +5 -5
- package/{dist/index.js → index.js} +4 -4
- package/{dist/index.js.map → index.js.map} +1 -1
- package/package.json +3 -3
- package/src/components/expansion-panel/ExpansionPanel.stories.tsx +65 -0
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +2 -2
- package/src/components/expansion-panel/ExpansionPanel.tsx +8 -8
- package/{dist/utils → utils}/index.d.ts +0 -0
- package/{dist/utils → utils}/index.js +0 -0
- package/{dist/utils → utils}/index.js.map +0 -0
- package/dist/README.md +0 -38
- package/dist/package.json +0 -117
- package/dist/src/components/alert-dialog/AlertDialog.stories.tsx +0 -196
- package/dist/src/components/alert-dialog/AlertDialog.test.tsx +0 -43
- package/dist/src/components/alert-dialog/AlertDialog.tsx +0 -185
- package/dist/src/components/alert-dialog/__snapshots__/AlertDialog.test.tsx.snap +0 -551
- package/dist/src/components/alert-dialog/index.ts +0 -1
- package/dist/src/components/autocomplete/Autocomplete.stories.tsx +0 -70
- package/dist/src/components/autocomplete/Autocomplete.test.tsx +0 -181
- package/dist/src/components/autocomplete/Autocomplete.tsx +0 -292
- package/dist/src/components/autocomplete/AutocompleteMultiple.stories.tsx +0 -170
- package/dist/src/components/autocomplete/AutocompleteMultiple.test.tsx +0 -94
- package/dist/src/components/autocomplete/AutocompleteMultiple.tsx +0 -156
- package/dist/src/components/autocomplete/__mockData__/index.ts +0 -34
- package/dist/src/components/autocomplete/__snapshots__/Autocomplete.test.tsx.snap +0 -213
- package/dist/src/components/autocomplete/__snapshots__/AutocompleteMultiple.test.tsx.snap +0 -88
- package/dist/src/components/autocomplete/index.ts +0 -2
- package/dist/src/components/avatar/Avatar.stories.tsx +0 -92
- package/dist/src/components/avatar/Avatar.test.tsx +0 -39
- package/dist/src/components/avatar/Avatar.tsx +0 -112
- package/dist/src/components/avatar/__snapshots__/Avatar.test.tsx.snap +0 -681
- package/dist/src/components/avatar/index.ts +0 -1
- package/dist/src/components/badge/Badge.stories.tsx +0 -45
- package/dist/src/components/badge/Badge.test.tsx +0 -91
- package/dist/src/components/badge/Badge.tsx +0 -55
- package/dist/src/components/badge/__snapshots__/Badge.test.tsx.snap +0 -11
- package/dist/src/components/badge/index.ts +0 -1
- package/dist/src/components/button/Button.stories.tsx +0 -156
- package/dist/src/components/button/Button.test.tsx +0 -152
- package/dist/src/components/button/Button.tsx +0 -81
- package/dist/src/components/button/ButtonGroup.test.tsx +0 -66
- package/dist/src/components/button/ButtonGroup.tsx +0 -46
- package/dist/src/components/button/ButtonRoot.test.tsx +0 -203
- package/dist/src/components/button/ButtonRoot.tsx +0 -190
- package/dist/src/components/button/IconButton.test.tsx +0 -103
- package/dist/src/components/button/IconButton.tsx +0 -80
- package/dist/src/components/button/__snapshots__/Button.test.tsx.snap +0 -96
- package/dist/src/components/button/__snapshots__/ButtonGroup.test.tsx.snap +0 -22
- package/dist/src/components/button/__snapshots__/ButtonRoot.test.tsx.snap +0 -160
- package/dist/src/components/button/__snapshots__/IconButton.test.tsx.snap +0 -83
- package/dist/src/components/button/index.ts +0 -4
- package/dist/src/components/checkbox/Checkbox.stories.tsx +0 -37
- package/dist/src/components/checkbox/Checkbox.test.tsx +0 -114
- package/dist/src/components/checkbox/Checkbox.tsx +0 -145
- package/dist/src/components/checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -141
- package/dist/src/components/checkbox/index.ts +0 -1
- package/dist/src/components/chip/Chip.stories.tsx +0 -21
- package/dist/src/components/chip/Chip.test.tsx +0 -199
- package/dist/src/components/chip/Chip.tsx +0 -154
- package/dist/src/components/chip/ChipGroup.test.tsx +0 -29
- package/dist/src/components/chip/ChipGroup.tsx +0 -62
- package/dist/src/components/chip/__snapshots__/Chip.test.tsx.snap +0 -12
- package/dist/src/components/chip/__snapshots__/ChipGroup.test.tsx.snap +0 -29
- package/dist/src/components/chip/index.ts +0 -2
- package/dist/src/components/comment-block/CommentBlock.stories.tsx +0 -30
- package/dist/src/components/comment-block/CommentBlock.test.tsx +0 -28
- package/dist/src/components/comment-block/CommentBlock.tsx +0 -174
- package/dist/src/components/comment-block/__snapshots__/CommentBlock.test.tsx.snap +0 -92
- package/dist/src/components/comment-block/index.ts +0 -1
- package/dist/src/components/date-picker/DatePicker.test.tsx +0 -41
- package/dist/src/components/date-picker/DatePicker.tsx +0 -56
- package/dist/src/components/date-picker/DatePickerControlled.test.tsx +0 -44
- package/dist/src/components/date-picker/DatePickerControlled.tsx +0 -128
- package/dist/src/components/date-picker/DatePickerField.stories.tsx +0 -93
- package/dist/src/components/date-picker/DatePickerField.test.tsx +0 -47
- package/dist/src/components/date-picker/DatePickerField.tsx +0 -141
- package/dist/src/components/date-picker/__snapshots__/DatePicker.test.tsx.snap +0 -22
- package/dist/src/components/date-picker/__snapshots__/DatePickerControlled.test.tsx.snap +0 -597
- package/dist/src/components/date-picker/__snapshots__/DatePickerField.test.tsx.snap +0 -43
- package/dist/src/components/date-picker/constants.ts +0 -11
- package/dist/src/components/date-picker/index.ts +0 -4
- package/dist/src/components/date-picker/types.ts +0 -28
- package/dist/src/components/dialog/Dialog.stories.tsx +0 -426
- package/dist/src/components/dialog/Dialog.test.tsx +0 -93
- package/dist/src/components/dialog/Dialog.tsx +0 -263
- package/dist/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +0 -960
- package/dist/src/components/dialog/index.ts +0 -1
- package/dist/src/components/divider/Divider.test.tsx +0 -93
- package/dist/src/components/divider/Divider.tsx +0 -51
- package/dist/src/components/divider/__snapshots__/Divider.test.tsx.snap +0 -9
- package/dist/src/components/divider/index.ts +0 -1
- package/dist/src/components/drag-handle/DragHandle.tsx +0 -50
- package/dist/src/components/drag-handle/index.ts +0 -1
- package/dist/src/components/dropdown/Dropdown.stories.tsx +0 -216
- package/dist/src/components/dropdown/Dropdown.test.tsx +0 -97
- package/dist/src/components/dropdown/Dropdown.tsx +0 -184
- package/dist/src/components/dropdown/__snapshots__/Dropdown.test.tsx.snap +0 -35
- package/dist/src/components/dropdown/index.ts +0 -1
- package/dist/src/components/expansion-panel/ExpansionPanel.test.tsx +0 -116
- package/dist/src/components/expansion-panel/ExpansionPanel.tsx +0 -170
- package/dist/src/components/expansion-panel/index.ts +0 -1
- package/dist/src/components/flag/Flag.stories.tsx +0 -23
- package/dist/src/components/flag/Flag.test.tsx +0 -86
- package/dist/src/components/flag/Flag.tsx +0 -47
- package/dist/src/components/flag/__snapshots__/Flag.test.tsx.snap +0 -133
- package/dist/src/components/flag/index.ts +0 -1
- package/dist/src/components/flex-box/FlexBox.stories.tsx +0 -245
- package/dist/src/components/flex-box/FlexBox.test.tsx +0 -65
- package/dist/src/components/flex-box/FlexBox.tsx +0 -98
- package/dist/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +0 -492
- package/dist/src/components/flex-box/index.ts +0 -1
- package/dist/src/components/generic-block/GenericBlock.stories.jsx +0 -128
- package/dist/src/components/generic-block/GenericBlock.test.tsx +0 -152
- package/dist/src/components/generic-block/GenericBlock.tsx +0 -222
- package/dist/src/components/generic-block/constants.ts +0 -9
- package/dist/src/components/generic-block/index.ts +0 -2
- package/dist/src/components/grid/Grid.tsx +0 -73
- package/dist/src/components/grid/GridItem.tsx +0 -54
- package/dist/src/components/grid/index.ts +0 -2
- package/dist/src/components/grid-column/GridColumn.stories.jsx +0 -56
- package/dist/src/components/grid-column/GridColumn.test.jsx +0 -58
- package/dist/src/components/grid-column/GridColumn.tsx +0 -90
- package/dist/src/components/grid-column/index.ts +0 -1
- package/dist/src/components/heading/Heading.stories.tsx +0 -108
- package/dist/src/components/heading/Heading.test.tsx +0 -82
- package/dist/src/components/heading/Heading.tsx +0 -63
- package/dist/src/components/heading/HeadingLevelProvider.tsx +0 -30
- package/dist/src/components/heading/constants.ts +0 -16
- package/dist/src/components/heading/context.tsx +0 -13
- package/dist/src/components/heading/index.ts +0 -3
- package/dist/src/components/heading/useHeadingLevel.tsx +0 -8
- package/dist/src/components/icon/Icon.stories.tsx +0 -76
- package/dist/src/components/icon/Icon.test.tsx +0 -102
- package/dist/src/components/icon/Icon.tsx +0 -121
- package/dist/src/components/icon/__snapshots__/Icon.test.tsx.snap +0 -49
- package/dist/src/components/icon/index.ts +0 -1
- package/dist/src/components/image-block/ImageBlock.stories.tsx +0 -52
- package/dist/src/components/image-block/ImageBlock.test.tsx +0 -28
- package/dist/src/components/image-block/ImageBlock.tsx +0 -151
- package/dist/src/components/image-block/__snapshots__/ImageBlock.test.tsx.snap +0 -64
- package/dist/src/components/image-block/index.ts +0 -1
- package/dist/src/components/index.ts +0 -176
- package/dist/src/components/inline-list/InlineList.stories.tsx +0 -40
- package/dist/src/components/inline-list/InlineList.test.tsx +0 -41
- package/dist/src/components/inline-list/InlineList.tsx +0 -82
- package/dist/src/components/inline-list/index.ts +0 -1
- package/dist/src/components/input-helper/InputHelper.stories.tsx +0 -29
- package/dist/src/components/input-helper/InputHelper.test.tsx +0 -107
- package/dist/src/components/input-helper/InputHelper.tsx +0 -61
- package/dist/src/components/input-helper/__snapshots__/InputHelper.test.tsx.snap +0 -9
- package/dist/src/components/input-helper/constants.ts +0 -11
- package/dist/src/components/input-helper/index.ts +0 -1
- package/dist/src/components/input-label/InputLabel.stories.tsx +0 -15
- package/dist/src/components/input-label/InputLabel.test.tsx +0 -86
- package/dist/src/components/input-label/InputLabel.tsx +0 -59
- package/dist/src/components/input-label/__snapshots__/InputLabel.test.tsx.snap +0 -10
- package/dist/src/components/input-label/index.ts +0 -1
- package/dist/src/components/lightbox/Lightbox.stories.tsx +0 -83
- package/dist/src/components/lightbox/Lightbox.test.tsx +0 -30
- package/dist/src/components/lightbox/Lightbox.tsx +0 -153
- package/dist/src/components/lightbox/__snapshots__/Lightbox.test.tsx.snap +0 -194
- package/dist/src/components/lightbox/index.ts +0 -1
- package/dist/src/components/link/Link.stories.tsx +0 -141
- package/dist/src/components/link/Link.test.tsx +0 -60
- package/dist/src/components/link/Link.tsx +0 -156
- package/dist/src/components/link/__snapshots__/Link.test.tsx.snap +0 -29
- package/dist/src/components/link/index.ts +0 -1
- package/dist/src/components/link-preview/LinkPreview.stories.tsx +0 -88
- package/dist/src/components/link-preview/LinkPreview.test.tsx +0 -102
- package/dist/src/components/link-preview/LinkPreview.tsx +0 -158
- package/dist/src/components/link-preview/index.ts +0 -1
- package/dist/src/components/list/List.stories.tsx +0 -141
- package/dist/src/components/list/List.test.tsx +0 -29
- package/dist/src/components/list/List.tsx +0 -94
- package/dist/src/components/list/ListDivider.stories.tsx +0 -7
- package/dist/src/components/list/ListDivider.test.tsx +0 -29
- package/dist/src/components/list/ListDivider.tsx +0 -42
- package/dist/src/components/list/ListItem.stories.tsx +0 -62
- package/dist/src/components/list/ListItem.test.tsx +0 -29
- package/dist/src/components/list/ListItem.tsx +0 -154
- package/dist/src/components/list/ListSubheader.stories.tsx +0 -8
- package/dist/src/components/list/ListSubheader.test.tsx +0 -29
- package/dist/src/components/list/ListSubheader.tsx +0 -43
- package/dist/src/components/list/__snapshots__/List.test.tsx.snap +0 -360
- package/dist/src/components/list/__snapshots__/ListDivider.test.tsx.snap +0 -7
- package/dist/src/components/list/__snapshots__/ListItem.test.tsx.snap +0 -160
- package/dist/src/components/list/__snapshots__/ListSubheader.test.tsx.snap +0 -9
- package/dist/src/components/list/index.ts +0 -4
- package/dist/src/components/list/useInteractiveList.tsx +0 -202
- package/dist/src/components/message/Message.stories.tsx +0 -27
- package/dist/src/components/message/Message.test.tsx +0 -76
- package/dist/src/components/message/Message.tsx +0 -74
- package/dist/src/components/message/__snapshots__/Message.test.tsx.snap +0 -15
- package/dist/src/components/message/index.ts +0 -1
- package/dist/src/components/mosaic/Mosaic.stories.tsx +0 -85
- package/dist/src/components/mosaic/Mosaic.test.tsx +0 -120
- package/dist/src/components/mosaic/Mosaic.tsx +0 -95
- package/dist/src/components/mosaic/__snapshots__/Mosaic.test.tsx.snap +0 -357
- package/dist/src/components/mosaic/index.ts +0 -1
- package/dist/src/components/notification/Notification.test.tsx +0 -108
- package/dist/src/components/notification/Notification.tsx +0 -130
- package/dist/src/components/notification/Notifications.stories.tsx +0 -77
- package/dist/src/components/notification/__snapshots__/Notification.test.tsx.snap +0 -34
- package/dist/src/components/notification/constants.ts +0 -28
- package/dist/src/components/notification/index.ts +0 -1
- package/dist/src/components/popover/Popover.stories.tsx +0 -386
- package/dist/src/components/popover/Popover.test.tsx +0 -30
- package/dist/src/components/popover/Popover.tsx +0 -382
- package/dist/src/components/popover/__snapshots__/Popover.test.tsx.snap +0 -343
- package/dist/src/components/popover/index.ts +0 -1
- package/dist/src/components/popover-dialog/PopoverDialog.stories.tsx +0 -75
- package/dist/src/components/popover-dialog/PopoverDialog.test.tsx +0 -65
- package/dist/src/components/popover-dialog/PopoverDialog.tsx +0 -65
- package/dist/src/components/popover-dialog/index.tsx +0 -1
- package/dist/src/components/post-block/PostBlock.test.tsx +0 -28
- package/dist/src/components/post-block/PostBlock.tsx +0 -123
- package/dist/src/components/post-block/__snapshots__/PostBlock.test.tsx.snap +0 -139
- package/dist/src/components/post-block/index.ts +0 -1
- package/dist/src/components/progress/Progress.tsx +0 -68
- package/dist/src/components/progress/ProgressCircular.stories.tsx +0 -18
- package/dist/src/components/progress/ProgressCircular.test.tsx +0 -49
- package/dist/src/components/progress/ProgressCircular.tsx +0 -68
- package/dist/src/components/progress/ProgressLinear.stories.tsx +0 -8
- package/dist/src/components/progress/ProgressLinear.test.tsx +0 -37
- package/dist/src/components/progress/ProgressLinear.tsx +0 -52
- package/dist/src/components/progress/index.ts +0 -3
- package/dist/src/components/progress-tracker/ProgressTracker.stories.tsx +0 -145
- package/dist/src/components/progress-tracker/ProgressTracker.test.tsx +0 -57
- package/dist/src/components/progress-tracker/ProgressTracker.tsx +0 -89
- package/dist/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +0 -42
- package/dist/src/components/progress-tracker/ProgressTrackerProvider.tsx +0 -66
- package/dist/src/components/progress-tracker/ProgressTrackerStep.test.tsx +0 -128
- package/dist/src/components/progress-tracker/ProgressTrackerStep.tsx +0 -159
- package/dist/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +0 -73
- package/dist/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +0 -67
- package/dist/src/components/progress-tracker/__snapshots__/ProgressTracker.test.tsx.snap +0 -41
- package/dist/src/components/progress-tracker/__snapshots__/ProgressTrackerStep.test.tsx.snap +0 -141
- package/dist/src/components/progress-tracker/__snapshots__/ProgressTrackerStepPanel.test.tsx.snap +0 -25
- package/dist/src/components/progress-tracker/index.ts +0 -4
- package/dist/src/components/radio-button/RadioButton.stories.tsx +0 -28
- package/dist/src/components/radio-button/RadioButton.test.tsx +0 -123
- package/dist/src/components/radio-button/RadioButton.tsx +0 -141
- package/dist/src/components/radio-button/RadioGroup.stories.tsx +0 -42
- package/dist/src/components/radio-button/RadioGroup.test.tsx +0 -77
- package/dist/src/components/radio-button/RadioGroup.tsx +0 -52
- package/dist/src/components/radio-button/__snapshots__/RadioButton.test.tsx.snap +0 -113
- package/dist/src/components/radio-button/__snapshots__/RadioGroup.test.tsx.snap +0 -26
- package/dist/src/components/radio-button/index.ts +0 -2
- package/dist/src/components/select/Select.stories.tsx +0 -399
- package/dist/src/components/select/Select.test.tsx +0 -359
- package/dist/src/components/select/Select.tsx +0 -193
- package/dist/src/components/select/SelectMultiple.stories.tsx +0 -227
- package/dist/src/components/select/SelectMultiple.test.tsx +0 -405
- package/dist/src/components/select/SelectMultiple.tsx +0 -198
- package/dist/src/components/select/WithSelectContext.tsx +0 -143
- package/dist/src/components/select/__snapshots__/Select.test.tsx.snap +0 -43
- package/dist/src/components/select/__snapshots__/SelectMultiple.test.tsx.snap +0 -87
- package/dist/src/components/select/constants.ts +0 -53
- package/dist/src/components/select/index.ts +0 -2
- package/dist/src/components/side-navigation/SideNavigation.stories.tsx +0 -191
- package/dist/src/components/side-navigation/SideNavigation.test.tsx +0 -52
- package/dist/src/components/side-navigation/SideNavigation.tsx +0 -54
- package/dist/src/components/side-navigation/SideNavigationItem.test.tsx +0 -175
- package/dist/src/components/side-navigation/SideNavigationItem.tsx +0 -162
- package/dist/src/components/side-navigation/__snapshots__/SideNavigation.test.tsx.snap +0 -7
- package/dist/src/components/side-navigation/__snapshots__/SideNavigationItem.test.tsx.snap +0 -30
- package/dist/src/components/side-navigation/index.ts +0 -2
- package/dist/src/components/skeleton/SkeletonCircle.stories.tsx +0 -25
- package/dist/src/components/skeleton/SkeletonCircle.test.tsx +0 -28
- package/dist/src/components/skeleton/SkeletonCircle.tsx +0 -52
- package/dist/src/components/skeleton/SkeletonRectangle.stories.tsx +0 -107
- package/dist/src/components/skeleton/SkeletonRectangle.test.tsx +0 -28
- package/dist/src/components/skeleton/SkeletonRectangle.tsx +0 -78
- package/dist/src/components/skeleton/SkeletonTypography.stories.tsx +0 -26
- package/dist/src/components/skeleton/SkeletonTypography.test.tsx +0 -28
- package/dist/src/components/skeleton/SkeletonTypography.tsx +0 -57
- package/dist/src/components/skeleton/__snapshots__/SkeletonCircle.test.tsx.snap +0 -54
- package/dist/src/components/skeleton/__snapshots__/SkeletonRectangle.test.tsx.snap +0 -177
- package/dist/src/components/skeleton/__snapshots__/SkeletonTypography.test.tsx.snap +0 -174
- package/dist/src/components/skeleton/index.ts +0 -3
- package/dist/src/components/slider/Slider.stories.tsx +0 -29
- package/dist/src/components/slider/Slider.test.tsx +0 -31
- package/dist/src/components/slider/Slider.tsx +0 -299
- package/dist/src/components/slider/__snapshots__/Slider.test.tsx.snap +0 -122
- package/dist/src/components/slider/index.ts +0 -2
- package/dist/src/components/slideshow/Slides.tsx +0 -124
- package/dist/src/components/slideshow/Slideshow.stories.tsx +0 -212
- package/dist/src/components/slideshow/Slideshow.test.tsx +0 -39
- package/dist/src/components/slideshow/Slideshow.tsx +0 -170
- package/dist/src/components/slideshow/SlideshowControls.stories.tsx +0 -112
- package/dist/src/components/slideshow/SlideshowControls.tsx +0 -241
- package/dist/src/components/slideshow/SlideshowItem.tsx +0 -52
- package/dist/src/components/slideshow/SlideshowItemGroup.tsx +0 -64
- package/dist/src/components/slideshow/__snapshots__/Slideshow.test.tsx.snap +0 -157
- package/dist/src/components/slideshow/constants.ts +0 -24
- package/dist/src/components/slideshow/index.ts +0 -4
- package/dist/src/components/slideshow/useKeyNavigate.ts +0 -28
- package/dist/src/components/slideshow/usePaginationVisibleRange.ts +0 -37
- package/dist/src/components/slideshow/useSlideFocusManagement.tsx +0 -92
- package/dist/src/components/slideshow/useSwipeNavigate.ts +0 -18
- package/dist/src/components/switch/Switch.stories.tsx +0 -36
- package/dist/src/components/switch/Switch.test.tsx +0 -189
- package/dist/src/components/switch/Switch.tsx +0 -141
- package/dist/src/components/switch/__snapshots__/Switch.test.tsx.snap +0 -179
- package/dist/src/components/switch/index.ts +0 -1
- package/dist/src/components/table/Table.test.tsx +0 -28
- package/dist/src/components/table/Table.tsx +0 -59
- package/dist/src/components/table/TableBody.test.tsx +0 -22
- package/dist/src/components/table/TableBody.tsx +0 -44
- package/dist/src/components/table/TableCell.test.tsx +0 -23
- package/dist/src/components/table/TableCell.tsx +0 -125
- package/dist/src/components/table/TableHeader.test.tsx +0 -22
- package/dist/src/components/table/TableHeader.tsx +0 -50
- package/dist/src/components/table/TableRow.test.tsx +0 -22
- package/dist/src/components/table/TableRow.tsx +0 -68
- package/dist/src/components/table/__snapshots__/Table.test.tsx.snap +0 -263
- package/dist/src/components/table/index.ts +0 -5
- package/dist/src/components/tabs/Tab.test.tsx +0 -116
- package/dist/src/components/tabs/Tab.tsx +0 -120
- package/dist/src/components/tabs/TabList.test.tsx +0 -80
- package/dist/src/components/tabs/TabList.tsx +0 -82
- package/dist/src/components/tabs/TabPanel.test.tsx +0 -74
- package/dist/src/components/tabs/TabPanel.tsx +0 -65
- package/dist/src/components/tabs/TabProvider.test.tsx +0 -42
- package/dist/src/components/tabs/TabProvider.tsx +0 -59
- package/dist/src/components/tabs/Tabs.stories.tsx +0 -134
- package/dist/src/components/tabs/__snapshots__/Tab.test.tsx.snap +0 -62
- package/dist/src/components/tabs/__snapshots__/TabList.test.tsx.snap +0 -22
- package/dist/src/components/tabs/__snapshots__/TabPanel.test.tsx.snap +0 -25
- package/dist/src/components/tabs/index.ts +0 -4
- package/dist/src/components/tabs/state.ts +0 -116
- package/dist/src/components/tabs/test.mocks.ts +0 -33
- package/dist/src/components/text/Text.stories.jsx +0 -75
- package/dist/src/components/text/Text.test.tsx +0 -108
- package/dist/src/components/text/Text.tsx +0 -121
- package/dist/src/components/text/index.ts +0 -1
- package/dist/src/components/text-field/TextField.stories.tsx +0 -169
- package/dist/src/components/text-field/TextField.test.tsx +0 -171
- package/dist/src/components/text-field/TextField.tsx +0 -432
- package/dist/src/components/text-field/__snapshots__/TextField.test.tsx.snap +0 -42
- package/dist/src/components/text-field/index.ts +0 -1
- package/dist/src/components/thumbnail/Thumbnail.stories.tsx +0 -510
- package/dist/src/components/thumbnail/Thumbnail.test.tsx +0 -46
- package/dist/src/components/thumbnail/Thumbnail.tsx +0 -222
- package/dist/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +0 -130
- package/dist/src/components/thumbnail/index.ts +0 -3
- package/dist/src/components/thumbnail/types.ts +0 -39
- package/dist/src/components/thumbnail/useFocusPointStyle.test.ts +0 -92
- package/dist/src/components/thumbnail/useFocusPointStyle.tsx +0 -111
- package/dist/src/components/thumbnail/useImageLoad.ts +0 -40
- package/dist/src/components/toolbar/Toolbar.tsx +0 -67
- package/dist/src/components/toolbar/index.ts +0 -1
- package/dist/src/components/tooltip/Tooltip.stories.tsx +0 -172
- package/dist/src/components/tooltip/Tooltip.test.tsx +0 -105
- package/dist/src/components/tooltip/Tooltip.tsx +0 -122
- package/dist/src/components/tooltip/__snapshots__/Tooltip.test.tsx.snap +0 -233
- package/dist/src/components/tooltip/index.ts +0 -1
- package/dist/src/components/tooltip/useInjectTooltipRef.tsx +0 -44
- package/dist/src/components/tooltip/useTooltipOpen.tsx +0 -113
- package/dist/src/components/uploader/Uploader.test.tsx +0 -87
- package/dist/src/components/uploader/Uploader.tsx +0 -105
- package/dist/src/components/uploader/__snapshots__/Uploader.test.tsx.snap +0 -14
- package/dist/src/components/uploader/index.ts +0 -1
- package/dist/src/components/user-block/UserBlock.stories.tsx +0 -76
- package/dist/src/components/user-block/UserBlock.test.tsx +0 -38
- package/dist/src/components/user-block/UserBlock.tsx +0 -179
- package/dist/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +0 -362
- package/dist/src/components/user-block/index.ts +0 -1
- package/dist/src/constants.ts +0 -17
- package/dist/src/hooks/useBooleanState.tsx +0 -13
- package/dist/src/hooks/useCallbackOnEscape.ts +0 -34
- package/dist/src/hooks/useChipGroupNavigation.tsx +0 -75
- package/dist/src/hooks/useClickAway.tsx +0 -47
- package/dist/src/hooks/useDisableBodyScroll.ts +0 -28
- package/dist/src/hooks/useEventCallback.tsx +0 -17
- package/dist/src/hooks/useFocus.tsx +0 -21
- package/dist/src/hooks/useFocusTrap.ts +0 -85
- package/dist/src/hooks/useFocusWithin.ts +0 -33
- package/dist/src/hooks/useInfiniteScroll.tsx +0 -60
- package/dist/src/hooks/useIntersectionObserver.tsx +0 -43
- package/dist/src/hooks/useInterval.tsx +0 -31
- package/dist/src/hooks/useKeyboardListNavigation.tsx +0 -204
- package/dist/src/hooks/useListenFocus.tsx +0 -26
- package/dist/src/hooks/useOnResize.ts +0 -41
- package/dist/src/hooks/useRovingTabIndex.tsx +0 -90
- package/dist/src/hooks/useSlideshowControls.ts +0 -243
- package/dist/src/hooks/useStopPropagation.ts +0 -21
- package/dist/src/hooks/useTransitionVisibility.ts +0 -54
- package/dist/src/index.ts +0 -58
- package/dist/src/stories/chromaticForceScreenSize.tsx +0 -7
- package/dist/src/stories/generated/Autocomplete/Demos.stories.tsx +0 -7
- package/dist/src/stories/generated/Avatar/Demos.stories.tsx +0 -7
- package/dist/src/stories/generated/Badge/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Button/Demos.stories.tsx +0 -11
- package/dist/src/stories/generated/Checkbox/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Chip/Demos.stories.tsx +0 -11
- package/dist/src/stories/generated/CommentBlock/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/DatePicker/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/Dialog/Demos.stories.tsx +0 -10
- package/dist/src/stories/generated/Divider/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Dropdown/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/ExpansionPanel/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Flag/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/GenericBlock/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/Heading/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Icon/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/ImageBlock/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Lightbox/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Link/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/LinkPreview/Demos.stories.tsx +0 -7
- package/dist/src/stories/generated/List/Demos.stories.tsx +0 -11
- package/dist/src/stories/generated/Message/Demos.stories.tsx +0 -10
- package/dist/src/stories/generated/Mosaic/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Notification/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Popover/Demos.stories.tsx +0 -11
- package/dist/src/stories/generated/PopoverDialog/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/PostBlock/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Progress/Demos.stories.tsx +0 -7
- package/dist/src/stories/generated/ProgressTracker/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/RadioButton/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Select/Demos.stories.tsx +0 -14
- package/dist/src/stories/generated/SideNavigation/Demos.stories.tsx +0 -10
- package/dist/src/stories/generated/Skeleton/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Slider/Demos.stories.tsx +0 -9
- package/dist/src/stories/generated/Slideshow/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/Switch/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Table/Demos.stories.tsx +0 -6
- package/dist/src/stories/generated/Tabs/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/TextField/Demos.stories.tsx +0 -19
- package/dist/src/stories/generated/Thumbnail/Demos.stories.tsx +0 -12
- package/dist/src/stories/generated/Toolbar/Demos.stories.tsx +0 -10
- package/dist/src/stories/generated/Tooltip/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/Uploader/Demos.stories.tsx +0 -8
- package/dist/src/stories/generated/UserBlock/Demos.stories.tsx +0 -10
- package/dist/src/stories/knobs/buttonKnob.ts +0 -9
- package/dist/src/stories/knobs/emphasisKnob.ts +0 -8
- package/dist/src/stories/knobs/enumKnob.ts +0 -14
- package/dist/src/stories/knobs/focusKnob.ts +0 -3
- package/dist/src/stories/knobs/image.ts +0 -69
- package/dist/src/stories/knobs/lorem.ts +0 -59
- package/dist/src/stories/knobs/sizeKnob.ts +0 -5
- package/dist/src/stories/knobs/thumbnailsKnob.ts +0 -9
- package/dist/src/stories/utils/CustomLink.tsx +0 -7
- package/dist/src/stories/withResizableBox.tsx +0 -18
- package/dist/src/testing/utils/commonTestsSuite.ts +0 -71
- package/dist/src/testing/utils/commonTestsSuiteRTL.ts +0 -55
- package/dist/src/testing/utils/index.ts +0 -4
- package/dist/src/testing/utils/itShouldRenderStories.tsx +0 -103
- package/dist/src/testing/utils/queries.ts +0 -19
- package/dist/src/untypped-modules.d.ts +0 -7
- package/dist/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +0 -58
- package/dist/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +0 -65
- package/dist/src/utils/ClickAwayProvider/index.ts +0 -1
- package/dist/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +0 -54
- package/dist/src/utils/MaterialThemeSwitcher/index.ts +0 -1
- package/dist/src/utils/browserDoesNotSupportHover.test.js +0 -24
- package/dist/src/utils/browserDoesNotSupportHover.ts +0 -2
- package/dist/src/utils/clamp.ts +0 -17
- package/dist/src/utils/className.ts +0 -44
- package/dist/src/utils/event.ts +0 -1
- package/dist/src/utils/flattenChildren.test.tsx +0 -58
- package/dist/src/utils/flattenChildren.ts +0 -27
- package/dist/src/utils/focus/constants.ts +0 -5
- package/dist/src/utils/focus/getFirstAndLastFocusable.test.ts +0 -134
- package/dist/src/utils/focus/getFirstAndLastFocusable.ts +0 -21
- package/dist/src/utils/focus/getFocusableElements.test.ts +0 -151
- package/dist/src/utils/focus/getFocusableElements.ts +0 -7
- package/dist/src/utils/index.ts +0 -5
- package/dist/src/utils/isInternetExplorer.ts +0 -15
- package/dist/src/utils/makeListenerTowerContext.ts +0 -32
- package/dist/src/utils/mergeRefs.ts +0 -22
- package/dist/src/utils/partitionMulti.ts +0 -28
- package/dist/src/utils/renderLink.tsx +0 -17
- package/dist/src/utils/type.ts +0 -113
- package/dist/src/utils/userHasReducedMotion.ts +0 -7
- package/dist/src/utils/utils.test.ts +0 -48
- package/jest/__mocks__/@storybook/addon-actions.js +0 -3
- package/jest/__mocks__/@storybook/addon-knobs.js +0 -6
- package/jest/__mocks__/emptyFileMockTransformer.js +0 -8
- package/jest/__mocks__/emptyModuleMock.js +0 -1
- package/jest/configure.js +0 -6
- package/jest/index.js +0 -36
- package/jest/transform.js +0 -6
- package/rollup.config.js +0 -98
- package/storybook/build +0 -4
- package/storybook/generate-demo-stories.js +0 -59
- package/storybook/main.js +0 -67
- package/storybook/package.json +0 -13
- package/storybook/preview.js +0 -11
- package/storybook/start +0 -4
- package/storybook/story-block/StoryBlock.tsx +0 -49
- package/storybook/story-block/decorator.jsx +0 -7
- package/storybook/story-block/index.scss +0 -27
- package/storybook/yarn.lock +0 -13192
- package/tsconfig.json +0 -3
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { Children, CSSProperties, forwardRef } from 'react';
|
|
2
|
-
import chunk from 'lodash/chunk';
|
|
3
|
-
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
import { FULL_WIDTH_PERCENT } from '@lumx/react/components/slideshow/constants';
|
|
7
|
-
import { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
|
-
import { buildSlideShowGroupId, SlideshowItemGroup } from './SlideshowItemGroup';
|
|
10
|
-
|
|
11
|
-
export interface SlidesProps extends GenericProps, HasTheme {
|
|
12
|
-
/** current slide active */
|
|
13
|
-
activeIndex: number;
|
|
14
|
-
/** slides id to be added to the wrapper */
|
|
15
|
-
id?: string;
|
|
16
|
-
/** Whether the automatic rotation of the slideshow is enabled or not. */
|
|
17
|
-
autoPlay?: boolean;
|
|
18
|
-
/** Whether the image has to fill its container height or not. */
|
|
19
|
-
fillHeight?: boolean;
|
|
20
|
-
/** Number of slides to group together. */
|
|
21
|
-
groupBy?: number;
|
|
22
|
-
/** whether the slides are currently playing or not */
|
|
23
|
-
isAutoPlaying?: boolean;
|
|
24
|
-
/** id to be passed in into the slides */
|
|
25
|
-
slidesId?: string;
|
|
26
|
-
/** callback to change whether the slideshow is playing or not */
|
|
27
|
-
toggleAutoPlay: () => void;
|
|
28
|
-
/** component to be rendered after the slides */
|
|
29
|
-
afterSlides?: React.ReactNode;
|
|
30
|
-
/** Whether the slides have controls linked */
|
|
31
|
-
hasControls?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Accessible label to set on a slide group.
|
|
34
|
-
* Receives the group position starting from 1 and the total number of groups.
|
|
35
|
-
* */
|
|
36
|
-
slideGroupLabel?: (groupPosition: number, groupTotal: number) => string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Component display name.
|
|
41
|
-
*/
|
|
42
|
-
const COMPONENT_NAME = 'Slideshow';
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Component default class name and class prefix.
|
|
46
|
-
*/
|
|
47
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Slides component.
|
|
51
|
-
*
|
|
52
|
-
* @param props Component props.
|
|
53
|
-
* @param ref Component ref.
|
|
54
|
-
* @return React element.
|
|
55
|
-
*/
|
|
56
|
-
export const Slides: Comp<SlidesProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
57
|
-
const {
|
|
58
|
-
activeIndex,
|
|
59
|
-
id,
|
|
60
|
-
className,
|
|
61
|
-
theme,
|
|
62
|
-
fillHeight,
|
|
63
|
-
groupBy,
|
|
64
|
-
isAutoPlaying,
|
|
65
|
-
toggleAutoPlay,
|
|
66
|
-
slidesId,
|
|
67
|
-
children,
|
|
68
|
-
afterSlides,
|
|
69
|
-
hasControls,
|
|
70
|
-
slideGroupLabel,
|
|
71
|
-
...forwardedProps
|
|
72
|
-
} = props;
|
|
73
|
-
const wrapperRef = React.useRef<HTMLDivElement>(null);
|
|
74
|
-
const startIndexVisible = activeIndex;
|
|
75
|
-
const endIndexVisible = startIndexVisible + 1;
|
|
76
|
-
|
|
77
|
-
// Inline style of wrapper element.
|
|
78
|
-
const wrapperStyle: CSSProperties = { transform: `translateX(-${FULL_WIDTH_PERCENT * activeIndex}%)` };
|
|
79
|
-
|
|
80
|
-
const groups = React.useMemo(() => {
|
|
81
|
-
const childrenArray = Children.toArray(children);
|
|
82
|
-
return groupBy && groupBy > 1 ? chunk(childrenArray, groupBy) : childrenArray;
|
|
83
|
-
}, [children, groupBy]);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<section
|
|
87
|
-
id={id}
|
|
88
|
-
ref={ref}
|
|
89
|
-
{...forwardedProps}
|
|
90
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }), {
|
|
91
|
-
[`${CLASSNAME}--fill-height`]: fillHeight,
|
|
92
|
-
[`${CLASSNAME}--group-by-${groupBy}`]: Boolean(groupBy),
|
|
93
|
-
})}
|
|
94
|
-
aria-roledescription="carousel"
|
|
95
|
-
>
|
|
96
|
-
<div
|
|
97
|
-
id={slidesId}
|
|
98
|
-
className={`${CLASSNAME}__slides`}
|
|
99
|
-
onMouseEnter={toggleAutoPlay}
|
|
100
|
-
onMouseLeave={toggleAutoPlay}
|
|
101
|
-
aria-live={isAutoPlaying ? 'off' : 'polite'}
|
|
102
|
-
>
|
|
103
|
-
<div ref={wrapperRef} className={`${CLASSNAME}__wrapper`} style={wrapperStyle}>
|
|
104
|
-
{groups.map((group, index) => (
|
|
105
|
-
<SlideshowItemGroup
|
|
106
|
-
key={index}
|
|
107
|
-
id={slidesId && buildSlideShowGroupId(slidesId, index)}
|
|
108
|
-
role={hasControls ? 'tabpanel' : 'group'}
|
|
109
|
-
label={slideGroupLabel ? slideGroupLabel(index + 1, groups.length) : undefined}
|
|
110
|
-
isDisplayed={index >= startIndexVisible && index < endIndexVisible}
|
|
111
|
-
>
|
|
112
|
-
{group}
|
|
113
|
-
</SlideshowItemGroup>
|
|
114
|
-
))}
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
{afterSlides}
|
|
119
|
-
</section>
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
Slides.displayName = COMPONENT_NAME;
|
|
124
|
-
Slides.className = CLASSNAME;
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import range from 'lodash/range';
|
|
3
|
-
import { AspectRatio, Button, FlexBox, ImageBlock, Slideshow, SlideshowItem, Orientation } from '@lumx/react';
|
|
4
|
-
import { boolean, number } from '@storybook/addon-knobs';
|
|
5
|
-
import { thumbnailsKnob } from '@lumx/react/stories/knobs/thumbnailsKnob';
|
|
6
|
-
|
|
7
|
-
export default { title: 'LumX components/slideshow/Slideshow' };
|
|
8
|
-
|
|
9
|
-
export const Simple = ({ theme }: any) => {
|
|
10
|
-
const images = thumbnailsKnob(6);
|
|
11
|
-
const activeIndex = number('Active index', 0);
|
|
12
|
-
const groupBy = number('Group by', 1);
|
|
13
|
-
const autoPlay = boolean('Autoplay', false);
|
|
14
|
-
const interval = number('Autoplay interval (in milliseconds)', 1000);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Slideshow
|
|
18
|
-
aria-label="Simple carousel example"
|
|
19
|
-
activeIndex={activeIndex}
|
|
20
|
-
autoPlay={autoPlay}
|
|
21
|
-
interval={interval}
|
|
22
|
-
slideshowControlsProps={{
|
|
23
|
-
nextButtonProps: { label: 'Next' },
|
|
24
|
-
previousButtonProps: { label: 'Previous' },
|
|
25
|
-
}}
|
|
26
|
-
theme={theme}
|
|
27
|
-
groupBy={groupBy}
|
|
28
|
-
style={{ width: '50%' }}
|
|
29
|
-
slideGroupLabel={(currentGroup, totalGroup) => `${currentGroup} of ${totalGroup}`}
|
|
30
|
-
>
|
|
31
|
-
{images.map(({ image, alt }, index) => (
|
|
32
|
-
<SlideshowItem key={`${image}-${index}`}>
|
|
33
|
-
<ImageBlock
|
|
34
|
-
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
35
|
-
image={image}
|
|
36
|
-
alt={alt}
|
|
37
|
-
theme={theme}
|
|
38
|
-
/>
|
|
39
|
-
</SlideshowItem>
|
|
40
|
-
))}
|
|
41
|
-
</Slideshow>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const SimpleWithAutoPlay = ({ theme }: any) => {
|
|
46
|
-
const images = thumbnailsKnob(6);
|
|
47
|
-
const activeIndex = number('Active index', 0);
|
|
48
|
-
const groupBy = number('Group by', 1);
|
|
49
|
-
const interval = number('Autoplay interval (in milliseconds)', 1000);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Slideshow
|
|
53
|
-
aria-label="Simple with autoplay example"
|
|
54
|
-
activeIndex={activeIndex}
|
|
55
|
-
autoPlay
|
|
56
|
-
interval={interval}
|
|
57
|
-
slideshowControlsProps={{
|
|
58
|
-
nextButtonProps: { label: 'Next' },
|
|
59
|
-
previousButtonProps: { label: 'Previous' },
|
|
60
|
-
playButtonProps: { label: 'Play/Pause' },
|
|
61
|
-
}}
|
|
62
|
-
theme={theme}
|
|
63
|
-
groupBy={groupBy}
|
|
64
|
-
style={{ width: '50%' }}
|
|
65
|
-
slideGroupLabel={(currentGroup, totalGroup) => `${currentGroup} of ${totalGroup}`}
|
|
66
|
-
>
|
|
67
|
-
{images.map(({ image, alt }, index) => (
|
|
68
|
-
<SlideshowItem key={`${image}-${index}`}>
|
|
69
|
-
<ImageBlock
|
|
70
|
-
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
71
|
-
image={image}
|
|
72
|
-
alt={alt}
|
|
73
|
-
theme={theme}
|
|
74
|
-
/>
|
|
75
|
-
</SlideshowItem>
|
|
76
|
-
))}
|
|
77
|
-
</Slideshow>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const ResponsiveSlideShowSwipe = () => {
|
|
82
|
-
const slides = range(5);
|
|
83
|
-
return (
|
|
84
|
-
<>
|
|
85
|
-
In responsive mode
|
|
86
|
-
<ul>
|
|
87
|
-
<li>The slideshow is swipe-able (horizontal left/right)</li>
|
|
88
|
-
<li>The vertical scroll should still be possible</li>
|
|
89
|
-
<li>Clicking on elements inside a slide should work correctly</li>
|
|
90
|
-
</ul>
|
|
91
|
-
<FlexBox vAlign="center">
|
|
92
|
-
<Slideshow
|
|
93
|
-
aria-label="Responsive SlideShow Swipe"
|
|
94
|
-
activeIndex={0}
|
|
95
|
-
slideshowControlsProps={{
|
|
96
|
-
nextButtonProps: { label: 'Next' },
|
|
97
|
-
previousButtonProps: { label: 'Previous' },
|
|
98
|
-
}}
|
|
99
|
-
slideGroupLabel={(currentGroup, totalGroup) => `${currentGroup} of ${totalGroup}`}
|
|
100
|
-
>
|
|
101
|
-
{slides.map((slide) => (
|
|
102
|
-
<SlideshowItem key={`${slide}`}>
|
|
103
|
-
<FlexBox
|
|
104
|
-
style={{ border: '1px solid grey', maxWidth: 300, height: 300 }}
|
|
105
|
-
hAlign="center"
|
|
106
|
-
vAlign="center"
|
|
107
|
-
>
|
|
108
|
-
<Button onClick={() => alert(`Clicked button ${slide}`)}>Button {slide}</Button>
|
|
109
|
-
</FlexBox>
|
|
110
|
-
</SlideshowItem>
|
|
111
|
-
))}
|
|
112
|
-
</Slideshow>
|
|
113
|
-
</FlexBox>
|
|
114
|
-
{
|
|
115
|
-
/* Line padding to test the vertical scroll.*/
|
|
116
|
-
range(100).map((i) => (
|
|
117
|
-
<br key={i} />
|
|
118
|
-
))
|
|
119
|
-
}
|
|
120
|
-
</>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const slides = [
|
|
125
|
-
{
|
|
126
|
-
id: 0,
|
|
127
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/foyleswarslide__800x600.jpg',
|
|
128
|
-
alt: 'A man in a suit and fedora and a woman with coiffed hair look sternly into the camera.',
|
|
129
|
-
title: 'Foyle’s War Revisited',
|
|
130
|
-
subtitle: '8 pm Sunday, March 8, on TV: Sneak peek at the final season',
|
|
131
|
-
link: '#',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
id: 1,
|
|
135
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/britcomdavidslide__800x600.jpg',
|
|
136
|
-
alt: 'British flag with WILL-TV host David Thiel.',
|
|
137
|
-
title: 'Great Britain Vote: 7 pm Sat.',
|
|
138
|
-
link: '#',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
id: 2,
|
|
142
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/mag800-2__800x600.jpg',
|
|
143
|
-
alt: 'Mid-American Gardener panelists on the set.',
|
|
144
|
-
title: 'Mid-American Gardener: Thursdays at 7 pm',
|
|
145
|
-
subtitle: 'Watch the latest episode',
|
|
146
|
-
link: '#',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
id: 3,
|
|
150
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/foyleswarslide__800x600.jpg',
|
|
151
|
-
alt: 'A man in a suit and fedora and a woman with coiffed hair look sternly into the camera.',
|
|
152
|
-
title: 'Foyle’s War Revisited',
|
|
153
|
-
subtitle: '8 pm Sunday, March 8, on TV: Sneak peek at the final season',
|
|
154
|
-
link: '#',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
id: 4,
|
|
158
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/britcomdavidslide__800x600.jpg',
|
|
159
|
-
alt: 'British flag with WILL-TV host David Thiel.',
|
|
160
|
-
title: 'Great Britain Vote: 7 pm Sat.',
|
|
161
|
-
link: '#',
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: 5,
|
|
165
|
-
src: 'https://www.w3.org/WAI/ARIA/apg/example-index/carousel/images/mag800-2__800x600.jpg',
|
|
166
|
-
alt: 'Mid-American Gardener panelists on the set.',
|
|
167
|
-
title: 'Mid-American Gardener: Thursdays at 7 pm',
|
|
168
|
-
subtitle: 'Watch the latest episode',
|
|
169
|
-
link: '#',
|
|
170
|
-
},
|
|
171
|
-
];
|
|
172
|
-
export const WithComplexContent = () => (
|
|
173
|
-
<Slideshow
|
|
174
|
-
aria-label="Carousel with complex content"
|
|
175
|
-
activeIndex={0}
|
|
176
|
-
groupBy={2}
|
|
177
|
-
slideshowControlsProps={{
|
|
178
|
-
nextButtonProps: { label: 'Next' },
|
|
179
|
-
previousButtonProps: { label: 'Previous' },
|
|
180
|
-
playButtonProps: { label: 'Play/Pause' },
|
|
181
|
-
paginationItemProps: (index) => ({ label: `Slide ${index + 1}` }),
|
|
182
|
-
}}
|
|
183
|
-
slideGroupLabel={(currentGroup, totalGroup) => `${currentGroup} of ${totalGroup}`}
|
|
184
|
-
>
|
|
185
|
-
{range(number('Slides', 6)).map((nb) => {
|
|
186
|
-
const slide = slides[nb % slides.length];
|
|
187
|
-
|
|
188
|
-
return (
|
|
189
|
-
<SlideshowItem key={slide.id}>
|
|
190
|
-
<a href={slide.link}>
|
|
191
|
-
<ImageBlock
|
|
192
|
-
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
193
|
-
image={slide.src}
|
|
194
|
-
alt={slide.alt}
|
|
195
|
-
/>
|
|
196
|
-
</a>
|
|
197
|
-
<FlexBox orientation={Orientation.vertical}>
|
|
198
|
-
<h3>
|
|
199
|
-
<a href={slide.link}>{slide.title}</a>
|
|
200
|
-
{/* Add a non focusable element to test that it stays that way after a page change. */}
|
|
201
|
-
<button type="button" tabIndex={-1} aria-hidden="true">
|
|
202
|
-
Not focusable
|
|
203
|
-
</button>
|
|
204
|
-
<button type="button">Focusable</button>
|
|
205
|
-
</h3>
|
|
206
|
-
{slide.subtitle && <p>{slide.subtitle}</p>}
|
|
207
|
-
</FlexBox>
|
|
208
|
-
</SlideshowItem>
|
|
209
|
-
);
|
|
210
|
-
})}
|
|
211
|
-
</Slideshow>
|
|
212
|
-
);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import pick from 'lodash/pick';
|
|
3
|
-
|
|
4
|
-
import { mount, shallow } from 'enzyme';
|
|
5
|
-
import 'jest-enzyme';
|
|
6
|
-
|
|
7
|
-
import { commonTestsSuite, itShouldRenderStories, Wrapper } from '@lumx/react/testing/utils';
|
|
8
|
-
import { Slideshow, SlideshowProps } from './Slideshow';
|
|
9
|
-
import { SlideshowControls } from './SlideshowControls';
|
|
10
|
-
import * as stories from './Slideshow.stories';
|
|
11
|
-
|
|
12
|
-
const CLASSNAME = Slideshow.className as string;
|
|
13
|
-
|
|
14
|
-
const setup = ({ ...propsOverride }: Partial<SlideshowProps> = {}, shallowRendering = true) => {
|
|
15
|
-
const props: SlideshowProps = {
|
|
16
|
-
slideshowControlsProps: {
|
|
17
|
-
nextButtonProps: { label: 'Next' },
|
|
18
|
-
previousButtonProps: { label: 'Prev' },
|
|
19
|
-
},
|
|
20
|
-
...propsOverride,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const renderer: (el: ReactElement) => Wrapper = shallowRendering ? shallow : mount;
|
|
24
|
-
const wrapper: Wrapper = renderer(<Slideshow {...props} />);
|
|
25
|
-
|
|
26
|
-
return { props, wrapper };
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
describe(`<${Slideshow.displayName}>`, () => {
|
|
30
|
-
// 1. Test render via snapshot.
|
|
31
|
-
describe('Snapshots and structure', () => {
|
|
32
|
-
itShouldRenderStories(pick(stories, ['default', 'Simple']), {
|
|
33
|
-
or: [Slideshow, { path: [Slideshow, SlideshowControls] }],
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Common tests suite.
|
|
38
|
-
commonTestsSuite(setup, { prop: 'wrapper' }, { className: CLASSNAME });
|
|
39
|
-
});
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import { SlideshowControls, SlideshowControlsProps, Theme, Slides, SlidesProps } from '@lumx/react';
|
|
4
|
-
import { DEFAULT_OPTIONS } from '@lumx/react/hooks/useSlideshowControls';
|
|
5
|
-
import { Comp, GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { useFocusWithin } from '@lumx/react/hooks/useFocusWithin';
|
|
7
|
-
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
8
|
-
import { buildSlideShowGroupId } from './SlideshowItemGroup';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Defines the props of the component.
|
|
12
|
-
*/
|
|
13
|
-
export interface SlideshowProps
|
|
14
|
-
extends GenericProps,
|
|
15
|
-
Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel'> {
|
|
16
|
-
/** current slide active */
|
|
17
|
-
activeIndex?: SlidesProps['activeIndex'];
|
|
18
|
-
/** Interval between each slide when automatic rotation is enabled. */
|
|
19
|
-
interval?: number;
|
|
20
|
-
/** Props to pass to the slideshow controls (minus those already set by the Slideshow props). */
|
|
21
|
-
slideshowControlsProps?: Pick<
|
|
22
|
-
SlideshowControlsProps,
|
|
23
|
-
'nextButtonProps' | 'previousButtonProps' | 'paginationItemProps'
|
|
24
|
-
> &
|
|
25
|
-
Omit<
|
|
26
|
-
SlideshowControlsProps,
|
|
27
|
-
| 'activeIndex'
|
|
28
|
-
| 'onPaginationClick'
|
|
29
|
-
| 'onNextClick'
|
|
30
|
-
| 'onPreviousClick'
|
|
31
|
-
| 'slidesCount'
|
|
32
|
-
| 'parentRef'
|
|
33
|
-
| 'theme'
|
|
34
|
-
>;
|
|
35
|
-
/** Callback when slide changes */
|
|
36
|
-
onChange?(index: number): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Component default props.
|
|
41
|
-
*/
|
|
42
|
-
const DEFAULT_PROPS: Partial<SlideshowProps> = {
|
|
43
|
-
...DEFAULT_OPTIONS,
|
|
44
|
-
theme: Theme.light,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Slideshow component.
|
|
49
|
-
*
|
|
50
|
-
* @param props Component props.
|
|
51
|
-
* @param ref Component ref.
|
|
52
|
-
* @return React element.
|
|
53
|
-
*/
|
|
54
|
-
export const Slideshow: Comp<SlideshowProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
55
|
-
const {
|
|
56
|
-
activeIndex,
|
|
57
|
-
autoPlay,
|
|
58
|
-
children,
|
|
59
|
-
className,
|
|
60
|
-
fillHeight,
|
|
61
|
-
groupBy,
|
|
62
|
-
interval,
|
|
63
|
-
onChange,
|
|
64
|
-
slideshowControlsProps,
|
|
65
|
-
theme,
|
|
66
|
-
id,
|
|
67
|
-
slidesId,
|
|
68
|
-
slideGroupLabel,
|
|
69
|
-
...forwardedProps
|
|
70
|
-
} = props;
|
|
71
|
-
// Number of slideshow items.
|
|
72
|
-
const itemsCount = React.Children.count(children);
|
|
73
|
-
|
|
74
|
-
const {
|
|
75
|
-
activeIndex: currentIndex,
|
|
76
|
-
slideshowId,
|
|
77
|
-
setSlideshow,
|
|
78
|
-
isAutoPlaying,
|
|
79
|
-
slideshowSlidesId,
|
|
80
|
-
slidesCount,
|
|
81
|
-
onNextClick,
|
|
82
|
-
onPaginationClick,
|
|
83
|
-
onPreviousClick,
|
|
84
|
-
slideshow,
|
|
85
|
-
stopAutoPlay,
|
|
86
|
-
startAutoPlay,
|
|
87
|
-
toggleAutoPlay,
|
|
88
|
-
toggleForcePause,
|
|
89
|
-
} = SlideshowControls.useSlideshowControls({
|
|
90
|
-
activeIndex,
|
|
91
|
-
defaultActiveIndex: DEFAULT_PROPS.activeIndex as number,
|
|
92
|
-
autoPlay: Boolean(autoPlay),
|
|
93
|
-
itemsCount,
|
|
94
|
-
groupBy,
|
|
95
|
-
id,
|
|
96
|
-
interval,
|
|
97
|
-
onChange,
|
|
98
|
-
slidesId,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
useFocusWithin({
|
|
102
|
-
element: slideshow,
|
|
103
|
-
onFocusIn: stopAutoPlay,
|
|
104
|
-
onFocusOut: startAutoPlay,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const showControls = slideshowControlsProps && slidesCount > 1;
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<Slides
|
|
111
|
-
activeIndex={currentIndex}
|
|
112
|
-
id={slideshowId}
|
|
113
|
-
className={className}
|
|
114
|
-
theme={theme}
|
|
115
|
-
fillHeight={fillHeight}
|
|
116
|
-
groupBy={groupBy}
|
|
117
|
-
isAutoPlaying={isAutoPlaying}
|
|
118
|
-
autoPlay={autoPlay}
|
|
119
|
-
slidesId={slideshowSlidesId}
|
|
120
|
-
toggleAutoPlay={toggleAutoPlay}
|
|
121
|
-
ref={mergeRefs(ref, setSlideshow)}
|
|
122
|
-
hasControls={showControls}
|
|
123
|
-
slideGroupLabel={slideGroupLabel}
|
|
124
|
-
afterSlides={
|
|
125
|
-
slideshowControlsProps && slidesCount > 1 ? (
|
|
126
|
-
<div className={`${Slides.className}__controls`}>
|
|
127
|
-
<SlideshowControls
|
|
128
|
-
{...slideshowControlsProps}
|
|
129
|
-
activeIndex={currentIndex}
|
|
130
|
-
onPaginationClick={onPaginationClick}
|
|
131
|
-
onNextClick={onNextClick}
|
|
132
|
-
onPreviousClick={onPreviousClick}
|
|
133
|
-
slidesCount={slidesCount}
|
|
134
|
-
parentRef={slideshow}
|
|
135
|
-
theme={theme}
|
|
136
|
-
isAutoPlaying={isAutoPlaying}
|
|
137
|
-
nextButtonProps={{
|
|
138
|
-
'aria-controls': slideshowSlidesId,
|
|
139
|
-
...slideshowControlsProps.nextButtonProps,
|
|
140
|
-
}}
|
|
141
|
-
previousButtonProps={{
|
|
142
|
-
'aria-controls': slideshowSlidesId,
|
|
143
|
-
...slideshowControlsProps.previousButtonProps,
|
|
144
|
-
}}
|
|
145
|
-
playButtonProps={
|
|
146
|
-
autoPlay
|
|
147
|
-
? {
|
|
148
|
-
'aria-controls': slideshowSlidesId,
|
|
149
|
-
onClick: toggleForcePause,
|
|
150
|
-
...slideshowControlsProps.playButtonProps,
|
|
151
|
-
}
|
|
152
|
-
: undefined
|
|
153
|
-
}
|
|
154
|
-
paginationItemProps={(index) => ({
|
|
155
|
-
'aria-controls': buildSlideShowGroupId(slideshowSlidesId, index),
|
|
156
|
-
...slideshowControlsProps.paginationItemProps?.(index),
|
|
157
|
-
})}
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
|
-
) : undefined
|
|
161
|
-
}
|
|
162
|
-
{...forwardedProps}
|
|
163
|
-
>
|
|
164
|
-
{children}
|
|
165
|
-
</Slides>
|
|
166
|
-
);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
Slideshow.displayName = 'Slideshow';
|
|
170
|
-
Slideshow.defaultProps = DEFAULT_PROPS;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { AspectRatio, ImageBlock, Slides, SlideshowControls, SlideshowItem } from '@lumx/react';
|
|
4
|
-
import { thumbnailsKnob } from '@lumx/react/stories/knobs/thumbnailsKnob';
|
|
5
|
-
import { useFocusWithin } from '@lumx/react/hooks/useFocusWithin';
|
|
6
|
-
|
|
7
|
-
export default { title: 'LumX components/slideshow/Slideshow controls' };
|
|
8
|
-
|
|
9
|
-
export const Simple = () => {
|
|
10
|
-
const {
|
|
11
|
-
activeIndex,
|
|
12
|
-
slidesCount,
|
|
13
|
-
onNextClick,
|
|
14
|
-
onPreviousClick,
|
|
15
|
-
onPaginationClick,
|
|
16
|
-
} = SlideshowControls.useSlideshowControls({
|
|
17
|
-
itemsCount: 9,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<SlideshowControls
|
|
22
|
-
activeIndex={activeIndex}
|
|
23
|
-
slidesCount={slidesCount}
|
|
24
|
-
onNextClick={onNextClick}
|
|
25
|
-
onPreviousClick={onPreviousClick}
|
|
26
|
-
onPaginationClick={onPaginationClick}
|
|
27
|
-
nextButtonProps={{ label: 'Next' }}
|
|
28
|
-
previousButtonProps={{ label: 'Previous' }}
|
|
29
|
-
paginationItemLabel={(index) => `Slide ${index}`}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const ControllingSlideshow = ({ theme }: any) => {
|
|
35
|
-
const images = thumbnailsKnob(6);
|
|
36
|
-
|
|
37
|
-
const {
|
|
38
|
-
activeIndex: currentIndex,
|
|
39
|
-
slideshowId,
|
|
40
|
-
setSlideshow,
|
|
41
|
-
isAutoPlaying,
|
|
42
|
-
slideshowSlidesId,
|
|
43
|
-
slidesCount,
|
|
44
|
-
onNextClick,
|
|
45
|
-
onPaginationClick,
|
|
46
|
-
onPreviousClick,
|
|
47
|
-
slideshow,
|
|
48
|
-
stopAutoPlay,
|
|
49
|
-
startAutoPlay,
|
|
50
|
-
toggleAutoPlay,
|
|
51
|
-
toggleForcePause,
|
|
52
|
-
} = SlideshowControls.useSlideshowControls({
|
|
53
|
-
activeIndex: 0,
|
|
54
|
-
defaultActiveIndex: 0,
|
|
55
|
-
autoPlay: true,
|
|
56
|
-
itemsCount: 6,
|
|
57
|
-
groupBy: 1,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
useFocusWithin({
|
|
61
|
-
element: slideshow,
|
|
62
|
-
onFocusIn: stopAutoPlay,
|
|
63
|
-
onFocusOut: startAutoPlay,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Slides
|
|
68
|
-
activeIndex={currentIndex}
|
|
69
|
-
id={slideshowId}
|
|
70
|
-
ref={setSlideshow}
|
|
71
|
-
theme={theme}
|
|
72
|
-
isAutoPlaying={isAutoPlaying}
|
|
73
|
-
slidesId={slideshowSlidesId}
|
|
74
|
-
toggleAutoPlay={toggleAutoPlay}
|
|
75
|
-
groupBy={1}
|
|
76
|
-
style={{ width: '50%' }}
|
|
77
|
-
afterSlides={
|
|
78
|
-
<div className={`${Slides.className}__controls`}>
|
|
79
|
-
<SlideshowControls
|
|
80
|
-
activeIndex={currentIndex}
|
|
81
|
-
onPaginationClick={onPaginationClick}
|
|
82
|
-
onNextClick={onNextClick}
|
|
83
|
-
onPreviousClick={onPreviousClick}
|
|
84
|
-
slidesCount={slidesCount}
|
|
85
|
-
parentRef={slideshow}
|
|
86
|
-
theme={theme}
|
|
87
|
-
isAutoPlaying={isAutoPlaying}
|
|
88
|
-
nextButtonProps={{ label: 'Next', 'aria-controls': slideshowSlidesId }}
|
|
89
|
-
previousButtonProps={{ label: 'Previous', 'aria-controls': slideshowSlidesId }}
|
|
90
|
-
playButtonProps={{
|
|
91
|
-
label: 'Play/Pause',
|
|
92
|
-
'aria-controls': slideshowSlidesId,
|
|
93
|
-
onClick: toggleForcePause,
|
|
94
|
-
}}
|
|
95
|
-
paginationItemLabel={(index) => `Slide ${index}`}
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
}
|
|
99
|
-
>
|
|
100
|
-
{images.map(({ image, alt }, index) => (
|
|
101
|
-
<SlideshowItem key={`${image}-${index}`}>
|
|
102
|
-
<ImageBlock
|
|
103
|
-
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
104
|
-
image={image}
|
|
105
|
-
alt={alt}
|
|
106
|
-
theme={theme}
|
|
107
|
-
/>
|
|
108
|
-
</SlideshowItem>
|
|
109
|
-
))}
|
|
110
|
-
</Slides>
|
|
111
|
-
);
|
|
112
|
-
};
|