@lumx/react 2.2.18-alpha-hooks.1 → 2.2.20-alpha-type.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/_internal/{alertdialog.1.js → AlertDialog.js} +8 -8
- package/esm/_internal/AlertDialog.js.map +1 -0
- package/esm/_internal/{autocompletemultiple.2.js → AutocompleteMultiple.js} +9 -9
- package/esm/_internal/AutocompleteMultiple.js.map +1 -0
- package/esm/_internal/{avatar.3.js → Avatar2.js} +4 -4
- package/esm/_internal/Avatar2.js.map +1 -0
- package/esm/_internal/{badge.4.js → Badge2.js} +3 -3
- package/esm/_internal/Badge2.js.map +1 -0
- package/esm/_internal/{button.5.js → Button2.js} +5 -5
- package/esm/_internal/Button2.js.map +1 -0
- package/esm/_internal/{buttongroup.7.js → ButtonGroup.js} +3 -3
- package/esm/_internal/ButtonGroup.js.map +1 -0
- package/esm/_internal/{buttonroot.57.js → ButtonRoot.js} +4 -4
- package/esm/_internal/ButtonRoot.js.map +1 -0
- package/esm/_internal/{checkbox.8.js → Checkbox2.js} +10 -8
- package/esm/_internal/Checkbox2.js.map +1 -0
- package/esm/_internal/{chip.9.js → Chip2.js} +3 -3
- package/esm/_internal/Chip2.js.map +1 -0
- package/esm/_internal/{chipgroup.10.js → ChipGroup.js} +3 -3
- package/esm/_internal/ChipGroup.js.map +1 -0
- package/esm/_internal/ClickAwayProvider.js +194 -0
- package/esm/_internal/ClickAwayProvider.js.map +1 -0
- package/esm/_internal/{commentblock.11.js → CommentBlock.js} +5 -5
- package/esm/_internal/CommentBlock.js.map +1 -0
- package/esm/_internal/{datepickerfield.12.js → DatePickerField.js} +27 -20
- package/esm/_internal/DatePickerField.js.map +1 -0
- package/esm/_internal/{dialog.13.js → Dialog2.js} +13 -13
- package/esm/_internal/Dialog2.js.map +1 -0
- package/esm/_internal/{divider.14.js → Divider2.js} +3 -3
- package/esm/_internal/Divider2.js.map +1 -0
- package/esm/_internal/{draghandle.15.js → DragHandle.js} +4 -4
- package/esm/_internal/DragHandle.js.map +1 -0
- package/esm/_internal/{dropdown.16.js → Dropdown2.js} +6 -6
- package/esm/_internal/Dropdown2.js.map +1 -0
- package/esm/_internal/{expansionpanel.17.js → ExpansionPanel.js} +8 -8
- package/esm/_internal/ExpansionPanel.js.map +1 -0
- package/esm/_internal/{flag.18.js → Flag2.js} +4 -4
- package/esm/_internal/Flag2.js.map +1 -0
- package/esm/_internal/{flexbox.19.js → FlexBox.js} +3 -3
- package/esm/_internal/FlexBox.js.map +1 -0
- package/esm/_internal/GenericBlock.js +90 -0
- package/esm/_internal/GenericBlock.js.map +1 -0
- package/esm/_internal/{griditem.20.js → GridItem.js} +3 -3
- package/esm/_internal/GridItem.js.map +1 -0
- package/esm/_internal/{icon.21.js → Icon2.js} +3 -3
- package/esm/_internal/Icon2.js.map +1 -0
- package/esm/_internal/{iconbutton.6.js → IconButton.js} +6 -6
- package/esm/_internal/IconButton.js.map +1 -0
- package/esm/_internal/{imageblock.22.js → ImageBlock.js} +4 -4
- package/esm/_internal/ImageBlock.js.map +1 -0
- package/esm/_internal/{inputhelper.23.js → InputHelper.js} +3 -3
- package/esm/_internal/InputHelper.js.map +1 -0
- package/esm/_internal/{inputlabel.24.js → InputLabel.js} +3 -3
- package/esm/_internal/InputLabel.js.map +1 -0
- package/esm/_internal/{lightbox.25.js → Lightbox2.js} +12 -12
- package/esm/_internal/Lightbox2.js.map +1 -0
- package/esm/_internal/{link.26.js → Link2.js} +5 -5
- package/esm/_internal/Link2.js.map +1 -0
- package/esm/_internal/{linkpreview.27.js → LinkPreview.js} +26 -16
- package/esm/_internal/LinkPreview.js.map +1 -0
- package/esm/_internal/{list.28.js → List2.js} +6 -6
- package/esm/_internal/List2.js.map +1 -0
- package/esm/_internal/{listsubheader.29.js → ListSubheader.js} +3 -3
- package/esm/_internal/ListSubheader.js.map +1 -0
- package/esm/_internal/{message.30.js → Message2.js} +4 -4
- package/esm/_internal/Message2.js.map +1 -0
- package/esm/_internal/{mosaic.31.js → Mosaic2.js} +4 -4
- package/esm/_internal/Mosaic2.js.map +1 -0
- package/esm/_internal/{notification.32.js → Notification2.js} +7 -7
- package/esm/_internal/Notification2.js.map +1 -0
- package/esm/_internal/{popover.33.js → Popover2.js} +51 -15
- package/esm/_internal/Popover2.js.map +1 -0
- package/esm/_internal/{postblock.34.js → PostBlock.js} +5 -5
- package/esm/_internal/PostBlock.js.map +1 -0
- package/esm/_internal/{progress.35.js → Progress2.js} +3 -3
- package/esm/_internal/Progress2.js.map +1 -0
- package/esm/_internal/{progresstrackersteppanel.36.js → ProgressTrackerStepPanel.js} +8 -8
- package/esm/_internal/ProgressTrackerStepPanel.js.map +1 -0
- package/esm/_internal/{radiogroup.37.js → RadioGroup.js} +6 -6
- package/esm/_internal/RadioGroup.js.map +1 -0
- package/esm/_internal/{selectmultiple.38.js → SelectMultiple.js} +28 -16
- package/esm/_internal/SelectMultiple.js.map +1 -0
- package/esm/_internal/{sidenavigationitem.39.js → SideNavigationItem.js} +15 -11
- package/esm/_internal/SideNavigationItem.js.map +1 -0
- package/esm/_internal/{skeletontypography.40.js → SkeletonTypography.js} +3 -3
- package/esm/_internal/SkeletonTypography.js.map +1 -0
- package/esm/_internal/{slider.41.js → Slider2.js} +6 -6
- package/esm/_internal/Slider2.js.map +1 -0
- package/esm/_internal/{slides.42.js → Slides.js} +8 -8
- package/esm/_internal/Slides.js.map +1 -0
- package/esm/_internal/{switch.43.js → Switch2.js} +6 -6
- package/esm/_internal/Switch2.js.map +1 -0
- package/esm/_internal/{tabpanel.45.js → TabPanel.js} +6 -6
- package/esm/_internal/TabPanel.js.map +1 -0
- package/esm/_internal/{tablerow.44.js → TableRow.js} +4 -4
- package/esm/_internal/TableRow.js.map +1 -0
- package/esm/_internal/{textfield.46.js → TextField.js} +9 -9
- package/esm/_internal/TextField.js.map +1 -0
- package/esm/_internal/{thumbnail.47.js → Thumbnail2.js} +6 -6
- package/esm/_internal/Thumbnail2.js.map +1 -0
- package/esm/_internal/{toolbar.49.js → Toolbar2.js} +3 -3
- package/esm/_internal/Toolbar2.js.map +1 -0
- package/esm/_internal/{tooltip.50.js → Tooltip2.js} +17 -19
- package/esm/_internal/Tooltip2.js.map +1 -0
- package/esm/_internal/{uploader.51.js → Uploader2.js} +4 -4
- package/esm/_internal/Uploader2.js.map +1 -0
- package/esm/_internal/{userblock.52.js → UserBlock.js} +14 -7
- package/esm/_internal/UserBlock.js.map +1 -0
- package/esm/_internal/{_rolluppluginbabelhelpers.53.js → _rollupPluginBabelHelpers.js} +1 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js.map +1 -0
- package/esm/_internal/alert-dialog.js +20 -20
- package/esm/_internal/autocomplete.js +22 -22
- package/esm/_internal/avatar.js +6 -6
- package/esm/_internal/badge.js +3 -3
- package/esm/_internal/button.js +16 -16
- package/esm/_internal/checkbox.js +7 -7
- package/esm/_internal/chip.js +4 -4
- package/esm/_internal/comment-block.js +14 -14
- package/esm/_internal/components.js +1 -1
- package/esm/_internal/{constants.59.js → constants.js} +1 -1
- package/esm/_internal/constants.js.map +1 -0
- package/esm/_internal/date-picker.js +20 -20
- package/esm/_internal/dialog.js +13 -13
- package/esm/_internal/divider.js +3 -3
- package/esm/_internal/drag-handle.js +4 -4
- package/esm/_internal/dropdown.js +12 -12
- package/esm/_internal/expansion-panel.js +17 -18
- package/esm/_internal/expansion-panel.js.map +1 -1
- package/esm/_internal/flag.js +4 -4
- package/esm/_internal/flex-box.js +3 -3
- package/esm/_internal/generic-block.js +12 -0
- package/esm/_internal/generic-block.js.map +1 -0
- package/esm/_internal/{getrootclassname.54.js → getRootClassName.js} +2 -2
- package/esm/_internal/getRootClassName.js.map +1 -0
- package/esm/_internal/grid.js +3 -3
- package/esm/_internal/icon.js +3 -3
- package/esm/_internal/image-block.js +6 -6
- package/esm/_internal/input-helper.js +3 -3
- package/esm/_internal/input-label.js +3 -3
- package/esm/_internal/lightbox.js +18 -18
- package/esm/_internal/link-preview.js +8 -8
- package/esm/_internal/link.js +5 -5
- package/esm/_internal/list.js +7 -7
- package/esm/_internal/{mergerefs.56.js → mergeRefs.js} +1 -1
- package/esm/_internal/mergeRefs.js.map +1 -0
- package/esm/_internal/message.js +4 -4
- package/esm/_internal/mosaic.js +6 -6
- package/esm/_internal/notification.js +9 -9
- package/esm/_internal/{partitionmulti.62.js → partitionMulti.js} +1 -1
- package/esm/_internal/partitionMulti.js.map +1 -0
- package/esm/_internal/popover.js +8 -8
- package/esm/_internal/post-block.js +7 -7
- package/esm/_internal/progress-tracker.js +9 -9
- package/esm/_internal/progress.js +3 -3
- package/esm/_internal/radio-button.js +6 -6
- package/esm/_internal/{renderlink.65.js → renderLink.js} +2 -2
- package/esm/_internal/renderLink.js.map +1 -0
- package/esm/_internal/select.js +21 -21
- package/esm/_internal/side-navigation.js +16 -16
- package/esm/_internal/skeleton.js +3 -3
- package/esm/_internal/slider.js +6 -6
- package/esm/_internal/slideshow.js +15 -15
- package/esm/_internal/switch.js +6 -6
- package/esm/_internal/table.js +4 -4
- package/esm/_internal/tabs.js +7 -7
- package/esm/_internal/text-field.js +17 -17
- package/esm/_internal/thumbnail.js +6 -6
- package/esm/_internal/toolbar.js +3 -3
- package/esm/_internal/tooltip.js +10 -10
- package/esm/_internal/{type.64.js → type.js} +1 -1
- package/esm/_internal/type.js.map +1 -0
- package/esm/_internal/{types.48.js → types.js} +3 -2
- package/esm/_internal/types.js.map +1 -0
- package/esm/_internal/uploader.js +4 -4
- package/esm/_internal/{usedelayedvisibility.63.js → useDelayedVisibility.js} +2 -2
- package/esm/_internal/useDelayedVisibility.js.map +1 -0
- package/esm/_internal/{usedisablebodyscroll.61.js → useDisableBodyScroll.js} +1 -1
- package/esm/_internal/useDisableBodyScroll.js.map +1 -0
- package/esm/_internal/useFocusTrap.js +86 -0
- package/esm/_internal/useFocusTrap.js.map +1 -0
- package/esm/_internal/{userovingtabindex.66.js → useRovingTabIndex.js} +3 -3
- package/esm/_internal/useRovingTabIndex.js.map +1 -0
- package/esm/_internal/user-block.js +10 -9
- package/esm/_internal/user-block.js.map +1 -1
- package/esm/index.js +91 -0
- package/{index.js.map → esm/index.js.map} +1 -1
- package/esm/{_internal/index.55.js → index2.js} +1 -1
- package/esm/index2.js.map +1 -0
- package/package.json +9 -12
- package/src/components/autocomplete/Autocomplete.tsx +4 -4
- package/src/components/button/Button.stories.tsx +1 -0
- package/src/components/button/ButtonRoot.tsx +4 -4
- package/src/components/checkbox/Checkbox.tsx +2 -1
- package/src/components/checkbox/__snapshots__/Checkbox.test.tsx.snap +4 -0
- package/src/components/date-picker/DatePickerField.tsx +15 -16
- package/src/components/date-picker/types.ts +2 -2
- package/src/components/dialog/Dialog.stories.tsx +61 -14
- package/src/components/dialog/Dialog.tsx +3 -3
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +167 -91
- package/src/components/dropdown/Dropdown.tsx +4 -3
- package/src/components/generic-block/GenericBlock.stories.tsx +149 -0
- package/src/components/generic-block/GenericBlock.test.tsx +28 -0
- package/src/components/generic-block/GenericBlock.tsx +120 -0
- package/src/components/generic-block/__snapshots__/GenericBlock.test.tsx.snap +92 -0
- package/src/components/generic-block/index.ts +1 -0
- package/src/components/lightbox/Lightbox.tsx +1 -1
- package/src/components/link-preview/LinkPreview.test.tsx +50 -55
- package/src/components/link-preview/LinkPreview.tsx +43 -16
- package/src/components/popover/Popover.tsx +20 -4
- package/src/components/select/Select.stories.tsx +2 -0
- package/src/components/select/Select.tsx +11 -1
- package/src/components/select/SelectMultiple.stories.tsx +2 -0
- package/src/components/select/SelectMultiple.tsx +11 -1
- package/src/components/select/constants.ts +2 -0
- package/src/components/side-navigation/SideNavigation.stories.tsx +26 -0
- package/src/components/side-navigation/SideNavigationItem.test.tsx +19 -2
- package/src/components/side-navigation/SideNavigationItem.tsx +10 -2
- package/src/components/side-navigation/__snapshots__/SideNavigationItem.test.tsx.snap +1 -1
- package/src/components/table/__snapshots__/Table.test.tsx.snap +5 -0
- package/src/components/text-field/TextField.tsx +4 -4
- package/src/components/thumbnail/Thumbnail.tsx +2 -2
- package/src/components/thumbnail/index.ts +1 -0
- package/src/components/tooltip/Tooltip.tsx +2 -5
- package/src/components/tooltip/useTooltipOpen.tsx +7 -4
- package/src/components/user-block/UserBlock.stories.tsx +4 -4
- package/src/components/user-block/UserBlock.tsx +9 -3
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +51 -8
- package/src/hooks/useBooleanState.tsx +4 -10
- package/src/hooks/useCallbackOnEscape.ts +21 -13
- package/src/hooks/useFocusTrap.ts +67 -76
- package/src/index.ts +1 -0
- package/src/stories/generated/Dialog/Demos.stories.tsx +1 -0
- package/src/stories/generated/GenericBlock/Demos.stories.tsx +6 -0
- package/src/utils/focus/getFirstAndLastFocusable.test.ts +134 -0
- package/src/utils/focus/getFirstAndLastFocusable.ts +27 -0
- package/src/utils/makeListenerTowerContext.ts +32 -0
- package/src/utils/type.ts +3 -0
- package/{index.d.ts → types.d.ts} +82 -22
- package/esm/_internal/_rolluppluginbabelhelpers.53.js.map +0 -1
- package/esm/_internal/alertdialog.1.js.map +0 -1
- package/esm/_internal/autocompletemultiple.2.js.map +0 -1
- package/esm/_internal/avatar.3.js.map +0 -1
- package/esm/_internal/badge.4.js.map +0 -1
- package/esm/_internal/button.5.js.map +0 -1
- package/esm/_internal/buttongroup.7.js.map +0 -1
- package/esm/_internal/buttonroot.57.js.map +0 -1
- package/esm/_internal/checkbox.8.js.map +0 -1
- package/esm/_internal/chip.9.js.map +0 -1
- package/esm/_internal/chipgroup.10.js.map +0 -1
- package/esm/_internal/clickawayprovider.60.js +0 -116
- package/esm/_internal/clickawayprovider.60.js.map +0 -1
- package/esm/_internal/commentblock.11.js.map +0 -1
- package/esm/_internal/constants.59.js.map +0 -1
- package/esm/_internal/datepickerfield.12.js.map +0 -1
- package/esm/_internal/dialog.13.js.map +0 -1
- package/esm/_internal/divider.14.js.map +0 -1
- package/esm/_internal/draghandle.15.js.map +0 -1
- package/esm/_internal/dropdown.16.js.map +0 -1
- package/esm/_internal/expansionpanel.17.js.map +0 -1
- package/esm/_internal/flag.18.js.map +0 -1
- package/esm/_internal/flexbox.19.js.map +0 -1
- package/esm/_internal/getrootclassname.54.js.map +0 -1
- package/esm/_internal/griditem.20.js.map +0 -1
- package/esm/_internal/icon.21.js.map +0 -1
- package/esm/_internal/iconbutton.6.js.map +0 -1
- package/esm/_internal/imageblock.22.js.map +0 -1
- package/esm/_internal/index.55.js.map +0 -1
- package/esm/_internal/inputhelper.23.js.map +0 -1
- package/esm/_internal/inputlabel.24.js.map +0 -1
- package/esm/_internal/lightbox.25.js.map +0 -1
- package/esm/_internal/link.26.js.map +0 -1
- package/esm/_internal/linkpreview.27.js.map +0 -1
- package/esm/_internal/list.28.js.map +0 -1
- package/esm/_internal/listsubheader.29.js.map +0 -1
- package/esm/_internal/mergerefs.56.js.map +0 -1
- package/esm/_internal/message.30.js.map +0 -1
- package/esm/_internal/mosaic.31.js.map +0 -1
- package/esm/_internal/notification.32.js.map +0 -1
- package/esm/_internal/partitionmulti.62.js.map +0 -1
- package/esm/_internal/popover.33.js.map +0 -1
- package/esm/_internal/postblock.34.js.map +0 -1
- package/esm/_internal/progress.35.js.map +0 -1
- package/esm/_internal/progresstrackersteppanel.36.js.map +0 -1
- package/esm/_internal/radiogroup.37.js.map +0 -1
- package/esm/_internal/renderlink.65.js.map +0 -1
- package/esm/_internal/selectmultiple.38.js.map +0 -1
- package/esm/_internal/sidenavigationitem.39.js.map +0 -1
- package/esm/_internal/skeletontypography.40.js.map +0 -1
- package/esm/_internal/slider.41.js.map +0 -1
- package/esm/_internal/slides.42.js.map +0 -1
- package/esm/_internal/switch.43.js.map +0 -1
- package/esm/_internal/tablerow.44.js.map +0 -1
- package/esm/_internal/tabpanel.45.js.map +0 -1
- package/esm/_internal/textfield.46.js.map +0 -1
- package/esm/_internal/thumbnail.47.js.map +0 -1
- package/esm/_internal/toolbar.49.js.map +0 -1
- package/esm/_internal/tooltip.50.js.map +0 -1
- package/esm/_internal/type.64.js.map +0 -1
- package/esm/_internal/types.48.js.map +0 -1
- package/esm/_internal/uploader.51.js.map +0 -1
- package/esm/_internal/usedelayedvisibility.63.js.map +0 -1
- package/esm/_internal/usedisablebodyscroll.61.js.map +0 -1
- package/esm/_internal/usefocustrap.58.js +0 -93
- package/esm/_internal/usefocustrap.58.js.map +0 -1
- package/esm/_internal/userblock.52.js.map +0 -1
- package/esm/_internal/userovingtabindex.66.js.map +0 -1
- package/hooks/useFocusWithin.d.ts +0 -16
- package/hooks/useFocusWithin.js +0 -28
- package/hooks/useFocusWithin.js.map +0 -1
- package/index.js +0 -90
- package/src/components/link-preview/__snapshots__/LinkPreview.test.tsx.snap +0 -51
|
@@ -1,82 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<Dialog> Snapshots and structure should render story
|
|
4
|
-
<Fragment>
|
|
5
|
-
<Button
|
|
6
|
-
emphasis="high"
|
|
7
|
-
onClick={[Function]}
|
|
8
|
-
size="m"
|
|
9
|
-
theme="light"
|
|
10
|
-
>
|
|
11
|
-
Open dialog
|
|
12
|
-
</Button>
|
|
13
|
-
<Dialog
|
|
14
|
-
isOpen={true}
|
|
15
|
-
onClose={[Function]}
|
|
16
|
-
parentElement={
|
|
17
|
-
Object {
|
|
18
|
-
"current": undefined,
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
size="big"
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
className="lumx-spacing-padding"
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
Nihil hic munitissimus habendi senatus locus, nihil horum? At nos hinc posthac, sitientis piros
|
|
28
|
-
Afros. Magna pars studiorum, prodita quaerimus. Integer legentibus erat a ante historiarum
|
|
29
|
-
dapibus. Praeterea iter est quasdam res quas ex communi. Ullamco laboris nisi ut aliquid ex ea
|
|
30
|
-
commodi consequat. Inmensae subtilitatis, obscuris et malesuada fames. Me non paenitet nullum
|
|
31
|
-
festiviorem excogitasse ad hoc. Cum ceteris in veneratione tui montes, nascetur mus. Etiam
|
|
32
|
-
habebis sem dicantur magna mollis euismod. Quis aute iure reprehenderit in voluptate velit esse.
|
|
33
|
-
Phasellus laoreet lorem vel dolor tempus vehicula. Ambitioni dedisse scripsisse iudicaretur.
|
|
34
|
-
Paullum deliquit, ponderibus modulisque suis ratio utitur. Ab illo tempore, ab est sed
|
|
35
|
-
immemorabili. Nec dubitamus multa iter quae et nos invenerat. Tu quoque, Brute, fili mi, nihil
|
|
36
|
-
timor populi, nihil! Morbi fringilla convallis sapien, id pulvinar odio volutpat. Cras mattis
|
|
37
|
-
iudicium purus sit amet fermentum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus.
|
|
38
|
-
Quisque ut dolor gravida, placerat libero vel, euismod. Unam incolunt Belgae, aliam Aquitani,
|
|
39
|
-
tertiam. Cras mattis iudicium purus sit amet fermentum
|
|
40
|
-
</div>
|
|
41
|
-
<footer>
|
|
42
|
-
<Toolbar
|
|
43
|
-
after={
|
|
44
|
-
<Button
|
|
45
|
-
emphasis="low"
|
|
46
|
-
onClick={[Function]}
|
|
47
|
-
size="m"
|
|
48
|
-
theme="light"
|
|
49
|
-
>
|
|
50
|
-
Close
|
|
51
|
-
</Button>
|
|
52
|
-
}
|
|
53
|
-
/>
|
|
54
|
-
</footer>
|
|
55
|
-
</Dialog>
|
|
56
|
-
<AlertDialog
|
|
57
|
-
confirmProps={
|
|
58
|
-
Object {
|
|
59
|
-
"label": "Confirm",
|
|
60
|
-
"onClick": [Function],
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
isOpen={false}
|
|
64
|
-
kind="info"
|
|
65
|
-
onClose={[Function]}
|
|
66
|
-
parentElement={
|
|
67
|
-
Object {
|
|
68
|
-
"current": undefined,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
size="tiny"
|
|
72
|
-
title="Default (info)"
|
|
73
|
-
>
|
|
74
|
-
Consequat deserunt officia aute laborum tempor anim sint est.
|
|
75
|
-
</AlertDialog>
|
|
76
|
-
</Fragment>
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
exports[`<Dialog> Snapshots and structure should render story DialogWithFocusableElements 1`] = `
|
|
3
|
+
exports[`<Dialog> Snapshots and structure should render story DialogFocusTrap 1`] = `
|
|
80
4
|
<Fragment>
|
|
81
5
|
<Button
|
|
82
6
|
emphasis="high"
|
|
@@ -125,6 +49,13 @@ exports[`<Dialog> Snapshots and structure should render story DialogWithFocusabl
|
|
|
125
49
|
<div
|
|
126
50
|
className="lumx-spacing-padding-horizontal-huge lumx-spacing-padding-bottom-huge"
|
|
127
51
|
>
|
|
52
|
+
<input
|
|
53
|
+
hidden={true}
|
|
54
|
+
type="file"
|
|
55
|
+
/>
|
|
56
|
+
<input
|
|
57
|
+
type="hidden"
|
|
58
|
+
/>
|
|
128
59
|
<div
|
|
129
60
|
className="lumx-spacing-margin-bottom-huge"
|
|
130
61
|
>
|
|
@@ -156,23 +87,84 @@ exports[`<Dialog> Snapshots and structure should render story DialogWithFocusabl
|
|
|
156
87
|
hAlign="bottom"
|
|
157
88
|
orientation="horizontal"
|
|
158
89
|
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
90
|
+
<Button
|
|
91
|
+
emphasis="high"
|
|
92
|
+
onClick={[Function]}
|
|
93
|
+
size="m"
|
|
94
|
+
theme="light"
|
|
95
|
+
>
|
|
96
|
+
Open date picker
|
|
97
|
+
</Button>
|
|
98
|
+
<Dialog
|
|
99
|
+
isOpen={false}
|
|
100
|
+
onClose={[Function]}
|
|
101
|
+
parentElement={
|
|
170
102
|
Object {
|
|
171
|
-
"
|
|
103
|
+
"current": null,
|
|
172
104
|
}
|
|
173
105
|
}
|
|
174
|
-
|
|
175
|
-
|
|
106
|
+
size="big"
|
|
107
|
+
>
|
|
108
|
+
<header>
|
|
109
|
+
<Toolbar
|
|
110
|
+
after={
|
|
111
|
+
<IconButton
|
|
112
|
+
emphasis="low"
|
|
113
|
+
icon="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
|
|
114
|
+
label="Close"
|
|
115
|
+
onClick={[Function]}
|
|
116
|
+
size="m"
|
|
117
|
+
theme="light"
|
|
118
|
+
/>
|
|
119
|
+
}
|
|
120
|
+
label={
|
|
121
|
+
<h1
|
|
122
|
+
className="lumx-typography-title"
|
|
123
|
+
>
|
|
124
|
+
Date picker
|
|
125
|
+
</h1>
|
|
126
|
+
}
|
|
127
|
+
/>
|
|
128
|
+
</header>
|
|
129
|
+
<div
|
|
130
|
+
className="lumx-spacing-padding"
|
|
131
|
+
>
|
|
132
|
+
<DatePickerField
|
|
133
|
+
label="Start date"
|
|
134
|
+
locale="fr"
|
|
135
|
+
nextButtonProps={
|
|
136
|
+
Object {
|
|
137
|
+
"label": "Next month",
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
onChange={[Function]}
|
|
141
|
+
placeholder="Pick a date"
|
|
142
|
+
previousButtonProps={
|
|
143
|
+
Object {
|
|
144
|
+
"label": "Previous month",
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
value={2020-05-18T00:00:00.000Z}
|
|
148
|
+
/>
|
|
149
|
+
<DatePickerField
|
|
150
|
+
defaultMonth={2020-05-18T00:00:00.000Z}
|
|
151
|
+
label="Start date"
|
|
152
|
+
locale="fr"
|
|
153
|
+
nextButtonProps={
|
|
154
|
+
Object {
|
|
155
|
+
"label": "Next month",
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
onChange={[Function]}
|
|
159
|
+
placeholder="Pick a date"
|
|
160
|
+
previousButtonProps={
|
|
161
|
+
Object {
|
|
162
|
+
"label": "Previous month",
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
</Dialog>
|
|
176
168
|
<Select
|
|
177
169
|
className="lumx-spacing-margin-left-huge"
|
|
178
170
|
isOpen={false}
|
|
@@ -226,8 +218,92 @@ exports[`<Dialog> Snapshots and structure should render story DialogWithFocusabl
|
|
|
226
218
|
>
|
|
227
219
|
Focus div
|
|
228
220
|
</div>
|
|
221
|
+
<Button
|
|
222
|
+
emphasis="high"
|
|
223
|
+
isDisabled={false}
|
|
224
|
+
size="m"
|
|
225
|
+
theme="light"
|
|
226
|
+
>
|
|
227
|
+
Button explicitly not disabled (should focus)
|
|
228
|
+
</Button>
|
|
229
|
+
</div>
|
|
230
|
+
</Dialog>
|
|
231
|
+
</Fragment>
|
|
232
|
+
`;
|
|
233
|
+
|
|
234
|
+
exports[`<Dialog> Snapshots and structure should render story DialogWithAlertDialog 1`] = `
|
|
235
|
+
<Fragment>
|
|
236
|
+
<Button
|
|
237
|
+
emphasis="high"
|
|
238
|
+
onClick={[Function]}
|
|
239
|
+
size="m"
|
|
240
|
+
theme="light"
|
|
241
|
+
>
|
|
242
|
+
Open dialog
|
|
243
|
+
</Button>
|
|
244
|
+
<Dialog
|
|
245
|
+
isOpen={true}
|
|
246
|
+
onClose={[Function]}
|
|
247
|
+
parentElement={
|
|
248
|
+
Object {
|
|
249
|
+
"current": undefined,
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
size="big"
|
|
253
|
+
>
|
|
254
|
+
<div
|
|
255
|
+
className="lumx-spacing-padding"
|
|
256
|
+
>
|
|
257
|
+
|
|
258
|
+
Nihil hic munitissimus habendi senatus locus, nihil horum? At nos hinc posthac, sitientis piros
|
|
259
|
+
Afros. Magna pars studiorum, prodita quaerimus. Integer legentibus erat a ante historiarum
|
|
260
|
+
dapibus. Praeterea iter est quasdam res quas ex communi. Ullamco laboris nisi ut aliquid ex ea
|
|
261
|
+
commodi consequat. Inmensae subtilitatis, obscuris et malesuada fames. Me non paenitet nullum
|
|
262
|
+
festiviorem excogitasse ad hoc. Cum ceteris in veneratione tui montes, nascetur mus. Etiam
|
|
263
|
+
habebis sem dicantur magna mollis euismod. Quis aute iure reprehenderit in voluptate velit esse.
|
|
264
|
+
Phasellus laoreet lorem vel dolor tempus vehicula. Ambitioni dedisse scripsisse iudicaretur.
|
|
265
|
+
Paullum deliquit, ponderibus modulisque suis ratio utitur. Ab illo tempore, ab est sed
|
|
266
|
+
immemorabili. Nec dubitamus multa iter quae et nos invenerat. Tu quoque, Brute, fili mi, nihil
|
|
267
|
+
timor populi, nihil! Morbi fringilla convallis sapien, id pulvinar odio volutpat. Cras mattis
|
|
268
|
+
iudicium purus sit amet fermentum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus.
|
|
269
|
+
Quisque ut dolor gravida, placerat libero vel, euismod. Unam incolunt Belgae, aliam Aquitani,
|
|
270
|
+
tertiam. Cras mattis iudicium purus sit amet fermentum
|
|
229
271
|
</div>
|
|
272
|
+
<footer>
|
|
273
|
+
<Toolbar
|
|
274
|
+
after={
|
|
275
|
+
<Button
|
|
276
|
+
emphasis="low"
|
|
277
|
+
onClick={[Function]}
|
|
278
|
+
size="m"
|
|
279
|
+
theme="light"
|
|
280
|
+
>
|
|
281
|
+
Close
|
|
282
|
+
</Button>
|
|
283
|
+
}
|
|
284
|
+
/>
|
|
285
|
+
</footer>
|
|
230
286
|
</Dialog>
|
|
287
|
+
<AlertDialog
|
|
288
|
+
confirmProps={
|
|
289
|
+
Object {
|
|
290
|
+
"label": "Confirm",
|
|
291
|
+
"onClick": [Function],
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
isOpen={false}
|
|
295
|
+
kind="info"
|
|
296
|
+
onClose={[Function]}
|
|
297
|
+
parentElement={
|
|
298
|
+
Object {
|
|
299
|
+
"current": undefined,
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
size="tiny"
|
|
303
|
+
title="Default (info)"
|
|
304
|
+
>
|
|
305
|
+
Consequat deserunt officia aute laborum tempor anim sint est.
|
|
306
|
+
</AlertDialog>
|
|
231
307
|
</Fragment>
|
|
232
308
|
`;
|
|
233
309
|
|
|
@@ -3,7 +3,7 @@ import React, { cloneElement, forwardRef, useMemo, useRef } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { List, ListProps } from '@lumx/react/components/list/List';
|
|
6
|
-
import { Offset, Placement, Popover } from '@lumx/react/components/popover/Popover';
|
|
6
|
+
import { Offset, Placement, Popover, PopoverProps } from '@lumx/react/components/popover/Popover';
|
|
7
7
|
import { useInfiniteScroll } from '@lumx/react/hooks/useInfiniteScroll';
|
|
8
8
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses, isComponent } from '@lumx/react/utils';
|
|
9
9
|
|
|
@@ -11,10 +11,11 @@ import { Comp, GenericProps, getRootClassName, handleBasicClasses, isComponent }
|
|
|
11
11
|
* Defines the props of the component.
|
|
12
12
|
*/
|
|
13
13
|
export interface DropdownProps extends GenericProps {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Reference to the element around which the dropdown is placed.
|
|
15
16
|
* @see {@link PopoverProps#anchorRef}
|
|
16
17
|
*/
|
|
17
|
-
anchorRef:
|
|
18
|
+
anchorRef: PopoverProps['anchorRef'];
|
|
18
19
|
/** Dropdown content. */
|
|
19
20
|
children: React.ReactNode;
|
|
20
21
|
/**
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mdiPencil } from '@lumx/icons';
|
|
3
|
+
import { GenericBlock, Button, Icon, Size, Orientation, Alignment } from '@lumx/react';
|
|
4
|
+
|
|
5
|
+
export default { title: 'LumX components/generic-block/GenericBlock' };
|
|
6
|
+
|
|
7
|
+
export const Horizontal = ({ theme }: any) => (
|
|
8
|
+
<GenericBlock
|
|
9
|
+
orientation={Orientation.horizontal}
|
|
10
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
11
|
+
actionsProps={{
|
|
12
|
+
style: { border: '1px solid red' },
|
|
13
|
+
}}
|
|
14
|
+
figureProps={{
|
|
15
|
+
style: { border: '1px solid red' },
|
|
16
|
+
}}
|
|
17
|
+
contentProps={{
|
|
18
|
+
style: { border: '1px solid red' },
|
|
19
|
+
}}
|
|
20
|
+
actions={<Button theme={theme}>Button</Button>}
|
|
21
|
+
>
|
|
22
|
+
Content
|
|
23
|
+
</GenericBlock>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const HorizontalWithAlignment = ({ theme }: any) => (
|
|
27
|
+
<GenericBlock
|
|
28
|
+
orientation={Orientation.horizontal}
|
|
29
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
30
|
+
actionsProps={{
|
|
31
|
+
fillSpace: true,
|
|
32
|
+
style: { border: '1px solid red' },
|
|
33
|
+
vAlign: 'center',
|
|
34
|
+
}}
|
|
35
|
+
figureProps={{
|
|
36
|
+
style: { border: '1px solid red' },
|
|
37
|
+
}}
|
|
38
|
+
contentProps={{
|
|
39
|
+
style: { border: '1px solid red' },
|
|
40
|
+
}}
|
|
41
|
+
actions={<Button theme={theme}>Centered button</Button>}
|
|
42
|
+
>
|
|
43
|
+
Content
|
|
44
|
+
</GenericBlock>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const HorizontalTop = ({ theme }: any) => (
|
|
48
|
+
<GenericBlock
|
|
49
|
+
orientation={Orientation.horizontal}
|
|
50
|
+
hAlign={Alignment.top}
|
|
51
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
52
|
+
actionsProps={{
|
|
53
|
+
style: { border: '1px solid red' },
|
|
54
|
+
}}
|
|
55
|
+
figureProps={{
|
|
56
|
+
style: { border: '1px solid red' },
|
|
57
|
+
}}
|
|
58
|
+
contentProps={{
|
|
59
|
+
style: { border: '1px solid red' },
|
|
60
|
+
}}
|
|
61
|
+
actions={<Button theme={theme}>Centered button</Button>}
|
|
62
|
+
>
|
|
63
|
+
Content
|
|
64
|
+
</GenericBlock>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const Vertical = ({ theme }: any) => (
|
|
68
|
+
<GenericBlock
|
|
69
|
+
orientation={Orientation.vertical}
|
|
70
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
71
|
+
actionsProps={{
|
|
72
|
+
fillSpace: true,
|
|
73
|
+
style: { border: '1px solid red' },
|
|
74
|
+
}}
|
|
75
|
+
figureProps={{
|
|
76
|
+
style: { border: '1px solid red' },
|
|
77
|
+
}}
|
|
78
|
+
contentProps={{
|
|
79
|
+
style: { border: '1px solid red' },
|
|
80
|
+
}}
|
|
81
|
+
actions={<Button theme={theme}>Button</Button>}
|
|
82
|
+
>
|
|
83
|
+
Content
|
|
84
|
+
</GenericBlock>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
export const GapSizes = ({ theme }: any) => (
|
|
88
|
+
<>
|
|
89
|
+
<GenericBlock
|
|
90
|
+
orientation={Orientation.vertical}
|
|
91
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
92
|
+
gap={Size.regular}
|
|
93
|
+
style={{ marginBottom: 40 }}
|
|
94
|
+
actionsProps={{
|
|
95
|
+
style: { border: '1px solid red' },
|
|
96
|
+
}}
|
|
97
|
+
figureProps={{
|
|
98
|
+
style: { border: '1px solid red' },
|
|
99
|
+
}}
|
|
100
|
+
contentProps={{
|
|
101
|
+
style: { border: '1px solid red' },
|
|
102
|
+
}}
|
|
103
|
+
actions={<Button theme={theme}>Button</Button>}
|
|
104
|
+
>
|
|
105
|
+
<h2>Small gap size</h2>
|
|
106
|
+
<p>For small blocks</p>
|
|
107
|
+
</GenericBlock>
|
|
108
|
+
|
|
109
|
+
<GenericBlock
|
|
110
|
+
orientation={Orientation.vertical}
|
|
111
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
112
|
+
gap={Size.big}
|
|
113
|
+
style={{ marginBottom: 40 }}
|
|
114
|
+
actionsProps={{
|
|
115
|
+
style: { border: '1px solid red' },
|
|
116
|
+
}}
|
|
117
|
+
figureProps={{
|
|
118
|
+
style: { border: '1px solid red' },
|
|
119
|
+
}}
|
|
120
|
+
contentProps={{
|
|
121
|
+
style: { border: '1px solid red' },
|
|
122
|
+
}}
|
|
123
|
+
actions={<Button theme={theme}>Button</Button>}
|
|
124
|
+
>
|
|
125
|
+
<h2>Medium gap size</h2>
|
|
126
|
+
<p>For medium blocks</p>
|
|
127
|
+
</GenericBlock>
|
|
128
|
+
|
|
129
|
+
<GenericBlock
|
|
130
|
+
orientation={Orientation.vertical}
|
|
131
|
+
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
132
|
+
gap={Size.huge}
|
|
133
|
+
style={{ marginBottom: 40 }}
|
|
134
|
+
actionsProps={{
|
|
135
|
+
style: { border: '1px solid red' },
|
|
136
|
+
}}
|
|
137
|
+
figureProps={{
|
|
138
|
+
style: { border: '1px solid red' },
|
|
139
|
+
}}
|
|
140
|
+
contentProps={{
|
|
141
|
+
style: { border: '1px solid red' },
|
|
142
|
+
}}
|
|
143
|
+
actions={<Button theme={theme}>Button</Button>}
|
|
144
|
+
>
|
|
145
|
+
<h2>Big gap size</h2>
|
|
146
|
+
<p>For large blocks</p>
|
|
147
|
+
</GenericBlock>
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount, shallow } from 'enzyme';
|
|
3
|
+
import 'jest-enzyme';
|
|
4
|
+
import { commonTestsSuite, itShouldRenderStories } from '@lumx/react/testing/utils';
|
|
5
|
+
|
|
6
|
+
import { GenericBlock, GenericBlockProps } from './GenericBlock';
|
|
7
|
+
import * as stories from '../../stories/generated/GenericBlock/Demos.stories';
|
|
8
|
+
|
|
9
|
+
const CLASSNAME = GenericBlock.className as string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Mounts the component and returns common DOM elements / data needed in multiple tests further down.
|
|
13
|
+
*/
|
|
14
|
+
const setup = (props: Partial<GenericBlockProps> = {}, shallowRendering = true) => {
|
|
15
|
+
const renderer: any = shallowRendering ? shallow : mount;
|
|
16
|
+
const wrapper: any = renderer(<GenericBlock {...(props as any)} />);
|
|
17
|
+
return { props, wrapper };
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe(`<${GenericBlock.displayName}>`, () => {
|
|
21
|
+
// 1. Test render via snapshot.
|
|
22
|
+
describe('Snapshots and structure', () => {
|
|
23
|
+
itShouldRenderStories(stories, GenericBlock);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Common tests suite.
|
|
27
|
+
commonTestsSuite(setup, { className: 'wrapper', prop: 'wrapper' }, { className: CLASSNAME });
|
|
28
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { forwardRef, ReactNode } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Comp, getRootClassName } from '@lumx/react/utils';
|
|
4
|
+
import { Orientation, Size, FlexBox, FlexBoxProps, Alignment, HorizontalAlignment } from '@lumx/react';
|
|
5
|
+
|
|
6
|
+
export interface GenericBlockProps extends FlexBoxProps {
|
|
7
|
+
/** Component to use as visual element. */
|
|
8
|
+
figure?: ReactNode;
|
|
9
|
+
/** Actions to set after the main content. */
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
/** Main content to display */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Orientation of the 3 sections */
|
|
14
|
+
orientation?: FlexBoxProps['orientation'];
|
|
15
|
+
/** Horizontal alignment. */
|
|
16
|
+
hAlign?: FlexBoxProps['hAlign'];
|
|
17
|
+
/** Vertical alignment. */
|
|
18
|
+
vAlign?: FlexBoxProps['vAlign'];
|
|
19
|
+
/**
|
|
20
|
+
* The props to forward to the content.
|
|
21
|
+
* By default, the content will have the same alignment as wrapper.
|
|
22
|
+
*/
|
|
23
|
+
contentProps?: Omit<FlexBoxProps, 'children'>;
|
|
24
|
+
/** props to forward to the actions element. */
|
|
25
|
+
actionsProps?: Omit<FlexBoxProps, 'children'>;
|
|
26
|
+
/** props to forward to the figure element. */
|
|
27
|
+
figureProps?: Omit<FlexBoxProps, 'children'>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Component display name.
|
|
32
|
+
*/
|
|
33
|
+
const COMPONENT_NAME = 'GenericBlock';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Component default class name and class prefix.
|
|
37
|
+
*/
|
|
38
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Component default props.
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_PROPS: Partial<GenericBlockProps> = {
|
|
44
|
+
gap: Size.regular,
|
|
45
|
+
orientation: Orientation.vertical,
|
|
46
|
+
hAlign: Alignment.center,
|
|
47
|
+
vAlign: Alignment.center,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The GenericBlock is a layout component made of 3 sections that can be
|
|
52
|
+
* displayed either horizontally of vertically with the same gap between each section.
|
|
53
|
+
*
|
|
54
|
+
* The sections are:
|
|
55
|
+
* * (Optional) `Figure` => A visual element to display before the main content.
|
|
56
|
+
* * (Required) `Content` => The main content displayed
|
|
57
|
+
* * (Optional) `Actions` => One or more actions to set after the element.
|
|
58
|
+
*
|
|
59
|
+
* @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
|
|
60
|
+
*/
|
|
61
|
+
export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
62
|
+
const {
|
|
63
|
+
className,
|
|
64
|
+
figure,
|
|
65
|
+
figureProps,
|
|
66
|
+
children,
|
|
67
|
+
actions,
|
|
68
|
+
actionsProps,
|
|
69
|
+
gap,
|
|
70
|
+
orientation,
|
|
71
|
+
contentProps,
|
|
72
|
+
...forwardedProps
|
|
73
|
+
} = props;
|
|
74
|
+
|
|
75
|
+
let actionsVAlign: HorizontalAlignment = Alignment.center;
|
|
76
|
+
if (orientation === Orientation.horizontal) {
|
|
77
|
+
actionsVAlign = Alignment.right;
|
|
78
|
+
}
|
|
79
|
+
let contentVAlign: HorizontalAlignment = Alignment.center;
|
|
80
|
+
if (orientation === Orientation.horizontal) {
|
|
81
|
+
contentVAlign = Alignment.left;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<FlexBox
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={classNames(className, CLASSNAME)}
|
|
88
|
+
gap={gap}
|
|
89
|
+
orientation={orientation}
|
|
90
|
+
{...forwardedProps}
|
|
91
|
+
>
|
|
92
|
+
<FlexBox {...figureProps} className={classNames(figureProps?.className, `${CLASSNAME}__figure`)}>
|
|
93
|
+
{figure}
|
|
94
|
+
</FlexBox>
|
|
95
|
+
|
|
96
|
+
{children && (
|
|
97
|
+
<FlexBox
|
|
98
|
+
orientation={Orientation.vertical}
|
|
99
|
+
fillSpace
|
|
100
|
+
vAlign={contentVAlign}
|
|
101
|
+
{...contentProps}
|
|
102
|
+
className={classNames(contentProps?.className, `${CLASSNAME}__content`)}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</FlexBox>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
<FlexBox
|
|
109
|
+
vAlign={actionsVAlign}
|
|
110
|
+
{...actionsProps}
|
|
111
|
+
className={classNames(actionsProps?.className, `${CLASSNAME}__actions`)}
|
|
112
|
+
>
|
|
113
|
+
{actions}
|
|
114
|
+
</FlexBox>
|
|
115
|
+
</FlexBox>
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
GenericBlock.displayName = COMPONENT_NAME;
|
|
119
|
+
GenericBlock.className = CLASSNAME;
|
|
120
|
+
GenericBlock.defaultProps = DEFAULT_PROPS;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<GenericBlock> Snapshots and structure should render story 'Default' 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
<FlexBox
|
|
6
|
+
className="lumx-generic-block"
|
|
7
|
+
gap="regular"
|
|
8
|
+
hAlign="center"
|
|
9
|
+
orientation="vertical"
|
|
10
|
+
vAlign="center"
|
|
11
|
+
>
|
|
12
|
+
<FlexBox
|
|
13
|
+
className="lumx-generic-block__figure"
|
|
14
|
+
>
|
|
15
|
+
<Avatar
|
|
16
|
+
alt=""
|
|
17
|
+
image="/demo-assets/persona.png"
|
|
18
|
+
size="m"
|
|
19
|
+
theme="light"
|
|
20
|
+
/>
|
|
21
|
+
</FlexBox>
|
|
22
|
+
<FlexBox
|
|
23
|
+
className="lumx-generic-block__content"
|
|
24
|
+
fillSpace={true}
|
|
25
|
+
orientation="vertical"
|
|
26
|
+
vAlign="center"
|
|
27
|
+
>
|
|
28
|
+
<h2>
|
|
29
|
+
Content title
|
|
30
|
+
</h2>
|
|
31
|
+
<p>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus libero aliquet pharetra luctus. Fusce nisl turpis, posuere ac tellus at, euismod vulputate libero...
|
|
33
|
+
</p>
|
|
34
|
+
</FlexBox>
|
|
35
|
+
<FlexBox
|
|
36
|
+
className="lumx-generic-block__actions"
|
|
37
|
+
vAlign="center"
|
|
38
|
+
>
|
|
39
|
+
<Button
|
|
40
|
+
emphasis="high"
|
|
41
|
+
size="m"
|
|
42
|
+
theme="light"
|
|
43
|
+
>
|
|
44
|
+
Actions
|
|
45
|
+
</Button>
|
|
46
|
+
</FlexBox>
|
|
47
|
+
</FlexBox>,
|
|
48
|
+
<FlexBox
|
|
49
|
+
className="lumx-generic-block"
|
|
50
|
+
gap="regular"
|
|
51
|
+
hAlign="center"
|
|
52
|
+
orientation="horizontal"
|
|
53
|
+
vAlign="center"
|
|
54
|
+
>
|
|
55
|
+
<FlexBox
|
|
56
|
+
className="lumx-generic-block__figure"
|
|
57
|
+
>
|
|
58
|
+
<Avatar
|
|
59
|
+
alt=""
|
|
60
|
+
image="/demo-assets/persona.png"
|
|
61
|
+
size="m"
|
|
62
|
+
theme="light"
|
|
63
|
+
/>
|
|
64
|
+
</FlexBox>
|
|
65
|
+
<FlexBox
|
|
66
|
+
className="lumx-generic-block__content"
|
|
67
|
+
fillSpace={true}
|
|
68
|
+
orientation="vertical"
|
|
69
|
+
vAlign="left"
|
|
70
|
+
>
|
|
71
|
+
<h2>
|
|
72
|
+
Content title
|
|
73
|
+
</h2>
|
|
74
|
+
<p>
|
|
75
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus libero aliquet pharetra luctus. Fusce nisl turpis, posuere ac tellus at, euismod vulputate libero...
|
|
76
|
+
</p>
|
|
77
|
+
</FlexBox>
|
|
78
|
+
<FlexBox
|
|
79
|
+
className="lumx-generic-block__actions"
|
|
80
|
+
vAlign="right"
|
|
81
|
+
>
|
|
82
|
+
<Button
|
|
83
|
+
emphasis="high"
|
|
84
|
+
size="m"
|
|
85
|
+
theme="light"
|
|
86
|
+
>
|
|
87
|
+
Actions
|
|
88
|
+
</Button>
|
|
89
|
+
</FlexBox>
|
|
90
|
+
</FlexBox>,
|
|
91
|
+
]
|
|
92
|
+
`;
|