@lumx/react 2.2.18-alpha-hooks.1 → 2.2.20-alpha.xss.datatable
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.60.js → ClickAwayProvider.js} +4 -4
- 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} +9 -9
- package/esm/_internal/DatePickerField.js.map +1 -0
- package/esm/_internal/{dialog.13.js → Dialog2.js} +12 -12
- 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/{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} +11 -11
- 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} +5 -5
- 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} +31 -8
- 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} +12 -12
- 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 +19 -19
- package/esm/_internal/autocomplete.js +20 -21
- package/esm/_internal/autocomplete.js.map +1 -1
- package/esm/_internal/avatar.js +6 -6
- package/esm/_internal/badge.js +3 -3
- package/esm/_internal/button.js +14 -15
- package/esm/_internal/button.js.map +1 -1
- package/esm/_internal/checkbox.js +7 -7
- package/esm/_internal/chip.js +4 -4
- package/esm/_internal/comment-block.js +12 -13
- package/esm/_internal/comment-block.js.map +1 -1
- 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 +18 -19
- package/esm/_internal/date-picker.js.map +1 -1
- package/esm/_internal/dialog.js +12 -12
- package/esm/_internal/divider.js +3 -3
- package/esm/_internal/drag-handle.js +4 -4
- package/esm/_internal/dropdown.js +10 -11
- package/esm/_internal/dropdown.js.map +1 -1
- package/esm/_internal/expansion-panel.js +16 -17
- 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/{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 +16 -17
- package/esm/_internal/lightbox.js.map +1 -1
- 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 +6 -7
- package/esm/_internal/popover.js.map +1 -1
- 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 +19 -20
- package/esm/_internal/select.js.map +1 -1
- package/esm/_internal/side-navigation.js +14 -15
- package/esm/_internal/side-navigation.js.map +1 -1
- package/esm/_internal/skeleton.js +3 -3
- package/esm/_internal/slider.js +6 -6
- package/esm/_internal/slideshow.js +13 -14
- package/esm/_internal/slideshow.js.map +1 -1
- 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 +15 -16
- package/esm/_internal/text-field.js.map +1 -1
- package/esm/_internal/thumbnail.js +6 -6
- package/esm/_internal/toolbar.js +3 -3
- package/esm/_internal/tooltip.js +8 -9
- package/esm/_internal/tooltip.js.map +1 -1
- 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.58.js → useFocusTrap.js} +24 -15
- 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 +90 -0
- package/{index.js.map → esm/index.js.map} +0 -0
- 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/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/dialog/Dialog.stories.tsx +4 -1
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +85 -77
- 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/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/useFocusTrap.ts +2 -28
- package/src/stories/generated/Dialog/Demos.stories.tsx +1 -0
- package/src/utils/focus/getFirstAndLastFocusable.test.ts +128 -0
- package/src/utils/focus/getFirstAndLastFocusable.ts +27 -0
- package/{index.d.ts → types.d.ts} +13 -9
- 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.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.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
|
@@ -65,12 +65,9 @@ const ARROW_SIZE = 8;
|
|
|
65
65
|
* @return React element.
|
|
66
66
|
*/
|
|
67
67
|
export const Tooltip: Comp<TooltipProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
68
|
-
if (!DOCUMENT) {
|
|
69
|
-
// Can't render in SSR.
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
68
|
const { label, children, className, delay, placement, forceOpen, ...forwardedProps } = props;
|
|
73
|
-
|
|
69
|
+
// Disable in SSR or without a label.
|
|
70
|
+
if (!DOCUMENT || !label) {
|
|
74
71
|
return <>{children}</>;
|
|
75
72
|
}
|
|
76
73
|
|
|
@@ -95,13 +95,16 @@ export function useTooltipOpen(delay: number | undefined, anchorElement: HTMLEle
|
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
// Attach events
|
|
98
|
-
for (const [node, eventType,
|
|
99
|
-
node.addEventListener(eventType,
|
|
98
|
+
for (const [node, eventType, eventHandler] of events) {
|
|
99
|
+
node.addEventListener(eventType, eventHandler);
|
|
100
100
|
}
|
|
101
101
|
return () => {
|
|
102
|
+
// Clear pending timers.
|
|
103
|
+
if (timer) clearTimeout(timer);
|
|
104
|
+
|
|
102
105
|
// Detach events.
|
|
103
|
-
for (const [node, eventType,
|
|
104
|
-
node.removeEventListener(eventType,
|
|
106
|
+
for (const [node, eventType, eventHandler] of events) {
|
|
107
|
+
node.removeEventListener(eventType, eventHandler);
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
110
|
}, [anchorElement, delay]);
|
|
@@ -17,7 +17,7 @@ export const Default = ({ theme }: any) => (
|
|
|
17
17
|
theme={theme}
|
|
18
18
|
name="Emmitt O. Lum"
|
|
19
19
|
fields={['Creative developer', 'Denpasar']}
|
|
20
|
-
avatarProps={{ image: avatarImageKnob()
|
|
20
|
+
avatarProps={{ image: avatarImageKnob() }}
|
|
21
21
|
onMouseEnter={logAction('Mouse entered')}
|
|
22
22
|
onMouseLeave={logAction('Mouse left')}
|
|
23
23
|
/>
|
|
@@ -30,7 +30,7 @@ export const Sizes = ({ theme }: any) =>
|
|
|
30
30
|
theme={theme}
|
|
31
31
|
name="Emmitt O. Lum"
|
|
32
32
|
fields={['Creative developer', 'Denpasar']}
|
|
33
|
-
avatarProps={{ image: avatarImageKnob()
|
|
33
|
+
avatarProps={{ image: avatarImageKnob() }}
|
|
34
34
|
size={size}
|
|
35
35
|
onMouseEnter={logAction('Mouse entered')}
|
|
36
36
|
onMouseLeave={logAction('Mouse left')}
|
|
@@ -41,8 +41,9 @@ export const Clickable = ({ theme }: any) => {
|
|
|
41
41
|
const baseProps = {
|
|
42
42
|
theme,
|
|
43
43
|
name: 'Emmitt O. Lum',
|
|
44
|
+
nameProps: { 'aria-label': 'Emmitt O. Lum - open user profile' },
|
|
44
45
|
fields: ['Creative developer', 'Denpasar'],
|
|
45
|
-
avatarProps: { image: avatarImageKnob()
|
|
46
|
+
avatarProps: { image: avatarImageKnob() },
|
|
46
47
|
} as any;
|
|
47
48
|
return (
|
|
48
49
|
<>
|
|
@@ -65,7 +66,6 @@ export const WithBadge = ({ theme }: any) => (
|
|
|
65
66
|
fields={['Creative developer', 'Denpasar']}
|
|
66
67
|
avatarProps={{
|
|
67
68
|
image: avatarImageKnob(),
|
|
68
|
-
alt: 'Avatar',
|
|
69
69
|
badge: (
|
|
70
70
|
<Badge color={ColorPalette.blue}>
|
|
71
71
|
<Icon icon={mdiStar} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, ReactNode } from 'react';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import set from 'lodash/set';
|
|
4
5
|
|
|
5
6
|
import { Avatar, ColorPalette, Link, Orientation, Size, Theme } from '@lumx/react';
|
|
6
7
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
@@ -17,7 +18,7 @@ export type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;
|
|
|
17
18
|
*/
|
|
18
19
|
export interface UserBlockProps extends GenericProps {
|
|
19
20
|
/** Props to pass to the avatar. */
|
|
20
|
-
avatarProps?: AvatarProps
|
|
21
|
+
avatarProps?: Omit<AvatarProps, 'alt'>;
|
|
21
22
|
/** Additional fields used to describe the user. */
|
|
22
23
|
fields?: string[];
|
|
23
24
|
/** Props to pass to the link wrapping the avatar thumbnail. */
|
|
@@ -121,8 +122,12 @@ export const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props
|
|
|
121
122
|
color: ColorPalette.dark,
|
|
122
123
|
});
|
|
123
124
|
}
|
|
125
|
+
// Disable avatar focus since the name block is the same link / same button.
|
|
126
|
+
if (avatarProps) {
|
|
127
|
+
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
128
|
+
}
|
|
124
129
|
return <NameComponent {...nProps}>{name}</NameComponent>;
|
|
125
|
-
}, [isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
130
|
+
}, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
126
131
|
|
|
127
132
|
const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (
|
|
128
133
|
<div className={`${CLASSNAME}__fields`}>
|
|
@@ -149,7 +154,8 @@ export const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props
|
|
|
149
154
|
<Avatar
|
|
150
155
|
linkAs={linkAs}
|
|
151
156
|
linkProps={linkProps}
|
|
152
|
-
|
|
157
|
+
alt=""
|
|
158
|
+
{...(avatarProps as any)}
|
|
153
159
|
className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}
|
|
154
160
|
size={componentSize}
|
|
155
161
|
onClick={onClick}
|
|
@@ -6,17 +6,23 @@ Array [
|
|
|
6
6
|
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
7
7
|
>
|
|
8
8
|
<Avatar
|
|
9
|
-
alt="
|
|
9
|
+
alt=""
|
|
10
10
|
className="lumx-user-block__avatar"
|
|
11
11
|
image="/demo-assets/avatar1.jpg"
|
|
12
12
|
onClick={[Function]}
|
|
13
13
|
size="m"
|
|
14
14
|
theme="light"
|
|
15
|
+
thumbnailProps={
|
|
16
|
+
Object {
|
|
17
|
+
"tabIndex": -1,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
15
20
|
/>
|
|
16
21
|
<div
|
|
17
22
|
className="lumx-user-block__wrapper"
|
|
18
23
|
>
|
|
19
24
|
<Link
|
|
25
|
+
aria-label="Emmitt O. Lum - open user profile"
|
|
20
26
|
className="lumx-user-block__name"
|
|
21
27
|
color="dark"
|
|
22
28
|
onClick={[Function]}
|
|
@@ -45,7 +51,7 @@ Array [
|
|
|
45
51
|
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
46
52
|
>
|
|
47
53
|
<Avatar
|
|
48
|
-
alt="
|
|
54
|
+
alt=""
|
|
49
55
|
className="lumx-user-block__avatar"
|
|
50
56
|
image="/demo-assets/avatar1.jpg"
|
|
51
57
|
linkProps={
|
|
@@ -55,11 +61,17 @@ Array [
|
|
|
55
61
|
}
|
|
56
62
|
size="m"
|
|
57
63
|
theme="light"
|
|
64
|
+
thumbnailProps={
|
|
65
|
+
Object {
|
|
66
|
+
"tabIndex": -1,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
58
69
|
/>
|
|
59
70
|
<div
|
|
60
71
|
className="lumx-user-block__wrapper"
|
|
61
72
|
>
|
|
62
73
|
<Link
|
|
74
|
+
aria-label="Emmitt O. Lum - open user profile"
|
|
63
75
|
className="lumx-user-block__name"
|
|
64
76
|
color="dark"
|
|
65
77
|
href="https://example.com"
|
|
@@ -88,17 +100,23 @@ Array [
|
|
|
88
100
|
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
89
101
|
>
|
|
90
102
|
<Avatar
|
|
91
|
-
alt="
|
|
103
|
+
alt=""
|
|
92
104
|
className="lumx-user-block__avatar"
|
|
93
105
|
image="/demo-assets/avatar1.jpg"
|
|
94
106
|
linkAs={[Function]}
|
|
95
107
|
size="m"
|
|
96
108
|
theme="light"
|
|
109
|
+
thumbnailProps={
|
|
110
|
+
Object {
|
|
111
|
+
"tabIndex": -1,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
97
114
|
/>
|
|
98
115
|
<div
|
|
99
116
|
className="lumx-user-block__wrapper"
|
|
100
117
|
>
|
|
101
118
|
<Link
|
|
119
|
+
aria-label="Emmitt O. Lum - open user profile"
|
|
102
120
|
className="lumx-user-block__name"
|
|
103
121
|
color="dark"
|
|
104
122
|
linkAs={[Function]}
|
|
@@ -133,11 +151,16 @@ exports[`<UserBlock> Snapshots and structure should render story 'Default' 1`] =
|
|
|
133
151
|
onMouseLeave={[Function]}
|
|
134
152
|
>
|
|
135
153
|
<Avatar
|
|
136
|
-
alt="
|
|
154
|
+
alt=""
|
|
137
155
|
className="lumx-user-block__avatar"
|
|
138
156
|
image="/demo-assets/avatar1.jpg"
|
|
139
157
|
size="m"
|
|
140
158
|
theme="light"
|
|
159
|
+
thumbnailProps={
|
|
160
|
+
Object {
|
|
161
|
+
"tabIndex": -1,
|
|
162
|
+
}
|
|
163
|
+
}
|
|
141
164
|
/>
|
|
142
165
|
<div
|
|
143
166
|
className="lumx-user-block__wrapper"
|
|
@@ -175,11 +198,16 @@ Array [
|
|
|
175
198
|
onMouseLeave={[Function]}
|
|
176
199
|
>
|
|
177
200
|
<Avatar
|
|
178
|
-
alt="
|
|
201
|
+
alt=""
|
|
179
202
|
className="lumx-user-block__avatar"
|
|
180
203
|
image="/demo-assets/avatar1.jpg"
|
|
181
204
|
size="s"
|
|
182
205
|
theme="light"
|
|
206
|
+
thumbnailProps={
|
|
207
|
+
Object {
|
|
208
|
+
"tabIndex": -1,
|
|
209
|
+
}
|
|
210
|
+
}
|
|
183
211
|
/>
|
|
184
212
|
<div
|
|
185
213
|
className="lumx-user-block__wrapper"
|
|
@@ -197,11 +225,16 @@ Array [
|
|
|
197
225
|
onMouseLeave={[Function]}
|
|
198
226
|
>
|
|
199
227
|
<Avatar
|
|
200
|
-
alt="
|
|
228
|
+
alt=""
|
|
201
229
|
className="lumx-user-block__avatar"
|
|
202
230
|
image="/demo-assets/avatar1.jpg"
|
|
203
231
|
size="m"
|
|
204
232
|
theme="light"
|
|
233
|
+
thumbnailProps={
|
|
234
|
+
Object {
|
|
235
|
+
"tabIndex": -1,
|
|
236
|
+
}
|
|
237
|
+
}
|
|
205
238
|
/>
|
|
206
239
|
<div
|
|
207
240
|
className="lumx-user-block__wrapper"
|
|
@@ -235,11 +268,16 @@ Array [
|
|
|
235
268
|
onMouseLeave={[Function]}
|
|
236
269
|
>
|
|
237
270
|
<Avatar
|
|
238
|
-
alt="
|
|
271
|
+
alt=""
|
|
239
272
|
className="lumx-user-block__avatar"
|
|
240
273
|
image="/demo-assets/avatar1.jpg"
|
|
241
274
|
size="l"
|
|
242
275
|
theme="light"
|
|
276
|
+
thumbnailProps={
|
|
277
|
+
Object {
|
|
278
|
+
"tabIndex": -1,
|
|
279
|
+
}
|
|
280
|
+
}
|
|
243
281
|
/>
|
|
244
282
|
<div
|
|
245
283
|
className="lumx-user-block__wrapper"
|
|
@@ -275,7 +313,7 @@ exports[`<UserBlock> Snapshots and structure should render story 'WithBadge' 1`]
|
|
|
275
313
|
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
276
314
|
>
|
|
277
315
|
<Avatar
|
|
278
|
-
alt="
|
|
316
|
+
alt=""
|
|
279
317
|
badge={
|
|
280
318
|
<Badge
|
|
281
319
|
color="blue"
|
|
@@ -289,6 +327,11 @@ exports[`<UserBlock> Snapshots and structure should render story 'WithBadge' 1`]
|
|
|
289
327
|
image="/demo-assets/avatar1.jpg"
|
|
290
328
|
size="m"
|
|
291
329
|
theme="light"
|
|
330
|
+
thumbnailProps={
|
|
331
|
+
Object {
|
|
332
|
+
"tabIndex": -1,
|
|
333
|
+
}
|
|
334
|
+
}
|
|
292
335
|
/>
|
|
293
336
|
<div
|
|
294
337
|
className="lumx-user-block__wrapper"
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
export const useBooleanState = (defaultValue: boolean): [boolean, () => void, () => void, () => void] => {
|
|
4
4
|
const [booleanValue, setBoolean] = useState<boolean>(defaultValue);
|
|
5
5
|
|
|
6
|
-
const setToFalse = () =>
|
|
7
|
-
setBoolean(false);
|
|
8
|
-
};
|
|
6
|
+
const setToFalse = useCallback(() => setBoolean(false), []);
|
|
9
7
|
|
|
10
|
-
const setToTrue = () =>
|
|
11
|
-
setBoolean(true);
|
|
12
|
-
};
|
|
8
|
+
const setToTrue = useCallback(() => setBoolean(true), []);
|
|
13
9
|
|
|
14
|
-
const toggleBoolean = () =>
|
|
15
|
-
setBoolean(!booleanValue);
|
|
16
|
-
};
|
|
10
|
+
const toggleBoolean = useCallback(() => setBoolean((previousValue) => !previousValue), []);
|
|
17
11
|
|
|
18
12
|
return [booleanValue, setToFalse, setToTrue, toggleBoolean];
|
|
19
13
|
};
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { DOCUMENT } from '@lumx/react/constants';
|
|
4
|
-
|
|
5
|
-
/** CSS selector listing all tabbable elements. */
|
|
6
|
-
const TABBABLE_ELEMENTS_SELECTOR = `a[href]:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
7
|
-
button:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
8
|
-
textarea:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
9
|
-
input[type="text"]:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
10
|
-
input[type="radio"]:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
11
|
-
input[type="checkbox"]:not([tabindex="-1"], [disabled], [aria-disabled]),
|
|
12
|
-
[tabindex]:not([tabindex="-1"], [disabled], [aria-disabled])`;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Get first and last elements focusable in an element.
|
|
16
|
-
*
|
|
17
|
-
* @param parentElement The element in which to search focusable elements.
|
|
18
|
-
* @return first and last focusable elements
|
|
19
|
-
*/
|
|
20
|
-
function getFocusable(parentElement: HTMLElement) {
|
|
21
|
-
const focusableElements = parentElement.querySelectorAll<HTMLElement>(TABBABLE_ELEMENTS_SELECTOR);
|
|
22
|
-
|
|
23
|
-
if (focusableElements.length <= 0) {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const first = focusableElements[0];
|
|
28
|
-
const last = focusableElements[focusableElements.length - 1];
|
|
29
|
-
return { first, last };
|
|
30
|
-
}
|
|
4
|
+
import { getFirstAndLastFocusable } from '@lumx/react/utils/focus/getFirstAndLastFocusable';
|
|
31
5
|
|
|
32
6
|
/**
|
|
33
7
|
* Add a key down event handler to the given root element (document.body by default) to trap the move of focus
|
|
@@ -55,7 +29,7 @@ export function useFocusTrap(
|
|
|
55
29
|
if (key !== 'Tab') {
|
|
56
30
|
return;
|
|
57
31
|
}
|
|
58
|
-
const focusable =
|
|
32
|
+
const focusable = getFirstAndLastFocusable(focusZoneElement);
|
|
59
33
|
|
|
60
34
|
// Prevent focus switch if no focusable available.
|
|
61
35
|
if (!focusable.first) {
|
|
@@ -6,4 +6,5 @@ export default { title: 'LumX components/dialog/Dialog Demos' };
|
|
|
6
6
|
export { App as Alert } from './alert';
|
|
7
7
|
export { App as Confirm } from './confirm';
|
|
8
8
|
export { App as Default } from './default';
|
|
9
|
+
export { App as Isloading } from './isloading';
|
|
9
10
|
export { App as Sizes } from './sizes';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { getFirstAndLastFocusable } from '@lumx/react/utils/focus/getFirstAndLastFocusable';
|
|
2
|
+
|
|
3
|
+
function htmlToElement(html: string): any {
|
|
4
|
+
const template = document.createElement('template');
|
|
5
|
+
template.innerHTML = html.trim();
|
|
6
|
+
return template.content.firstChild;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe(getFirstAndLastFocusable.name, () => {
|
|
10
|
+
it('should get empty', () => {
|
|
11
|
+
const element = htmlToElement(`<div></div>`);
|
|
12
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
13
|
+
expect(focusable).toEqual({});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should get single item', () => {
|
|
17
|
+
const element = htmlToElement(`<div><button /></div>`);
|
|
18
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
19
|
+
expect(focusable.last).toBe(focusable.first);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should get first and last', () => {
|
|
23
|
+
const element = htmlToElement(`
|
|
24
|
+
<div>
|
|
25
|
+
<div>Non focusable div</div>
|
|
26
|
+
<button>Simple button</button>
|
|
27
|
+
<div>Non focusable div</div>
|
|
28
|
+
<input />
|
|
29
|
+
<div>Non focusable div</div>
|
|
30
|
+
</div>
|
|
31
|
+
`);
|
|
32
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
33
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
34
|
+
<button>
|
|
35
|
+
Simple button
|
|
36
|
+
</button>
|
|
37
|
+
`);
|
|
38
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
39
|
+
<button>
|
|
40
|
+
Simple button
|
|
41
|
+
</button>
|
|
42
|
+
`);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('match focusable elements', () => {
|
|
46
|
+
it('should match input element', () => {
|
|
47
|
+
const element = htmlToElement(`<div><input /></div>`);
|
|
48
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
49
|
+
expect(focusable.first).toMatchInlineSnapshot(`<input />`);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should match link element', () => {
|
|
53
|
+
const element = htmlToElement(`<div><a href="#" /></div>`);
|
|
54
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
55
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
56
|
+
<a
|
|
57
|
+
href="#"
|
|
58
|
+
/>
|
|
59
|
+
`);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should match textarea element', () => {
|
|
63
|
+
const element = htmlToElement(`<div><textarea /></div>`);
|
|
64
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
65
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
66
|
+
<textarea>
|
|
67
|
+
</div>
|
|
68
|
+
</textarea>
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should match element with tabindex', () => {
|
|
73
|
+
const element = htmlToElement(`<div><span tabindex="0" /></div>`);
|
|
74
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
75
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
76
|
+
<span
|
|
77
|
+
tabindex="0"
|
|
78
|
+
/>
|
|
79
|
+
`);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should keep disabled=false', () => {
|
|
83
|
+
const element = htmlToElement(`<div><button disabled="false" /><button /></div>`);
|
|
84
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
85
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
86
|
+
<button
|
|
87
|
+
disabled="false"
|
|
88
|
+
/>
|
|
89
|
+
`);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should keep aria-disabled=false', () => {
|
|
93
|
+
const element = htmlToElement(`<div><button aria-disabled="false" /><button /></div>`);
|
|
94
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
95
|
+
expect(focusable.first).toMatchInlineSnapshot(`
|
|
96
|
+
<button
|
|
97
|
+
aria-disabled="false"
|
|
98
|
+
/>
|
|
99
|
+
`);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('skip disabled elements', () => {
|
|
104
|
+
it('should skip disabled', () => {
|
|
105
|
+
const element = htmlToElement(`<div><button disabled /><button /></div>`);
|
|
106
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
107
|
+
expect(focusable.first).toMatchInlineSnapshot(`<button />`);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should skip aria-disabled', () => {
|
|
111
|
+
const element = htmlToElement(`<div><button aria-disabled /><button /></div>`);
|
|
112
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
113
|
+
expect(focusable.first).toMatchInlineSnapshot(`<button />`);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should skip tabindex=-1', () => {
|
|
117
|
+
const element = htmlToElement(`<div><button tabindex="-1" /><button /></div>`);
|
|
118
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
119
|
+
expect(focusable.first).toMatchInlineSnapshot(`<button />`);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should skip input type hidden', () => {
|
|
123
|
+
const element = htmlToElement(`<div><input type="hidden" /><button /></div>`);
|
|
124
|
+
const focusable = getFirstAndLastFocusable(element);
|
|
125
|
+
expect(focusable.first).toMatchInlineSnapshot(`<button />`);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** CSS selector listing all tabbable elements. */
|
|
2
|
+
const TABBABLE_ELEMENTS_SELECTOR = `a[href], button, textarea, input:not([type="hidden"]), [tabindex]`;
|
|
3
|
+
|
|
4
|
+
/** CSS selector matching element that are disabled (should not receive focus). */
|
|
5
|
+
const DISABLED_SELECTOR = `[tabindex="-1"], [disabled]:not([disabled="false"]), [aria-disabled]:not([aria-disabled="false"])`;
|
|
6
|
+
|
|
7
|
+
const isNotDisabled = (element: HTMLElement) => !element.matches(DISABLED_SELECTOR);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get first and last elements focusable in an element.
|
|
11
|
+
*
|
|
12
|
+
* @param parentElement The element in which to search focusable elements.
|
|
13
|
+
* @return first and last focusable elements
|
|
14
|
+
*/
|
|
15
|
+
export function getFirstAndLastFocusable(parentElement: HTMLElement) {
|
|
16
|
+
const focusableElements = Array.from(parentElement.querySelectorAll<HTMLElement>(TABBABLE_ELEMENTS_SELECTOR));
|
|
17
|
+
|
|
18
|
+
// First non disabled element.
|
|
19
|
+
const first = focusableElements.find(isNotDisabled);
|
|
20
|
+
// Last non disabled element.
|
|
21
|
+
const last = focusableElements.reverse().find(isNotDisabled);
|
|
22
|
+
|
|
23
|
+
if (last && first) {
|
|
24
|
+
return { first, last };
|
|
25
|
+
}
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v5.
|
|
1
|
+
// Generated by dts-bundle-generator v5.6.0
|
|
2
2
|
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
|
|
@@ -476,9 +476,7 @@ export declare type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTM
|
|
|
476
476
|
* Button size definition.
|
|
477
477
|
*/
|
|
478
478
|
export declare type ButtonSize = Extract<Size, "s" | "m">;
|
|
479
|
-
export interface BaseButtonProps extends GenericProps {
|
|
480
|
-
/** ARIA button label. */
|
|
481
|
-
["aria-label"]?: string;
|
|
479
|
+
export interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, "aria-expanded" | "aria-haspopup" | "aria-pressed" | "aria-label"> {
|
|
482
480
|
/** Color variant. */
|
|
483
481
|
color?: Color;
|
|
484
482
|
/** Emphasis variant. */
|
|
@@ -671,7 +669,7 @@ export interface ChipGroupProps extends GenericProps {
|
|
|
671
669
|
children: ReactNode;
|
|
672
670
|
}
|
|
673
671
|
export declare const ChipGroup: Comp<ChipGroupProps, HTMLDivElement> & {
|
|
674
|
-
useChipGroupNavigation: import("
|
|
672
|
+
useChipGroupNavigation: import("../../hooks/useChipGroupNavigation").useChipGroupNavigationType<any>;
|
|
675
673
|
};
|
|
676
674
|
/**
|
|
677
675
|
* Comment block variants.
|
|
@@ -1495,7 +1493,7 @@ export interface ListProps extends GenericProps {
|
|
|
1495
1493
|
onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;
|
|
1496
1494
|
}
|
|
1497
1495
|
export declare const List: Comp<ListProps, HTMLUListElement> & {
|
|
1498
|
-
useKeyboardListNavigation: import("
|
|
1496
|
+
useKeyboardListNavigation: import("../../hooks/useKeyboardListNavigation").useKeyboardListNavigationType;
|
|
1499
1497
|
};
|
|
1500
1498
|
export declare type ListItemSize = Extract<Size, "tiny" | "regular" | "big" | "huge">;
|
|
1501
1499
|
/**
|
|
@@ -1957,6 +1955,11 @@ export interface SideNavigationItemProps extends GenericProps {
|
|
|
1957
1955
|
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
1958
1956
|
/** Props to pass to the toggle button (minus those already set by the SideNavigationItem props). */
|
|
1959
1957
|
toggleButtonProps: Pick<IconButtonProps, "label"> & Omit<IconButtonProps, "label" | "onClick" | "icon" | "emphasis" | "color" | "size">;
|
|
1958
|
+
/**
|
|
1959
|
+
* Choose how the children are hidden when closed
|
|
1960
|
+
* ('hide' keeps the children in DOM but hide them, 'unmount' remove the children from the DOM).
|
|
1961
|
+
*/
|
|
1962
|
+
closeMode?: "hide" | "unmount";
|
|
1960
1963
|
/** On action button click callback. */
|
|
1961
1964
|
onActionClick?(evt: React.MouseEvent): void;
|
|
1962
1965
|
/** On click callback. */
|
|
@@ -2220,8 +2223,8 @@ export interface SlideshowControlsProps extends GenericProps {
|
|
|
2220
2223
|
playButtonProps?: Pick<IconButtonProps, "label"> & Omit<IconButtonProps, "label" | "onClick" | "icon" | "emphasis" | "color">;
|
|
2221
2224
|
}
|
|
2222
2225
|
export declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> & {
|
|
2223
|
-
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("
|
|
2224
|
-
useSlideshowControlsDefaultOptions: Partial<import("
|
|
2226
|
+
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("../../hooks/useSlideshowControls").UseSlideshowControlsOptions) => import("../../hooks/useSlideshowControls").UseSlideshowControls;
|
|
2227
|
+
useSlideshowControlsDefaultOptions: Partial<import("../../hooks/useSlideshowControls").UseSlideshowControlsOptions>;
|
|
2225
2228
|
};
|
|
2226
2229
|
export interface SlidesProps extends GenericProps {
|
|
2227
2230
|
/** current slide active */
|
|
@@ -2547,6 +2550,7 @@ export interface TextFieldProps extends GenericProps {
|
|
|
2547
2550
|
* @return React element.
|
|
2548
2551
|
*/
|
|
2549
2552
|
export declare const TextField: Comp<TextFieldProps, HTMLDivElement>;
|
|
2553
|
+
export declare const useFocusPointStyle: ({ image, aspectRatio, focusPoint, imgProps: { width, height } }: ThumbnailProps, element: HTMLImageElement | undefined, isLoaded: boolean) => CSSProperties;
|
|
2550
2554
|
/**
|
|
2551
2555
|
* Defines the props of the component.
|
|
2552
2556
|
*/
|
|
@@ -2640,7 +2644,7 @@ export declare type UserBlockSize = Extract<Size, "s" | "m" | "l">;
|
|
|
2640
2644
|
*/
|
|
2641
2645
|
export interface UserBlockProps extends GenericProps {
|
|
2642
2646
|
/** Props to pass to the avatar. */
|
|
2643
|
-
avatarProps?: AvatarProps
|
|
2647
|
+
avatarProps?: Omit<AvatarProps, "alt">;
|
|
2644
2648
|
/** Additional fields used to describe the user. */
|
|
2645
2649
|
fields?: string[];
|
|
2646
2650
|
/** Props to pass to the link wrapping the avatar thumbnail. */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rolluppluginbabelhelpers.53.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alertdialog.1.js","sources":["../../../src/components/alert-dialog/AlertDialog.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n DialogProps,\n Dialog,\n Button,\n Emphasis,\n ColorPalette,\n Icon,\n Size,\n Kind,\n Toolbar,\n ButtonProps,\n} from '@lumx/react';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons/';\nimport { uid } from 'uid';\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {\n /** Message variant. */\n kind?: Kind;\n /** Dialog title. */\n title?: string;\n /** Props forwarded to the confirm button */\n confirmProps: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Props forwarded to the cancel button.\n * Will not render a cancel button if undefined.\n */\n cancelProps?: ButtonProps & {\n onClick(): void;\n label: string;\n };\n}\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.blue, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AlertDialog';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<DialogProps> = {\n size: Size.tiny,\n kind: Kind.info,\n};\n\n/**\n * AlertDialog component.\n *\n * An alert dialog is a modal dialog that interrupts the user's workflow to\n * communicate an important message and acquire a response.\n *\n * It should not have a complex content.\n * Children of this component should only be strings, paragraphs or links.\n */\nexport const AlertDialog: Comp<AlertDialogProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n id,\n title,\n className,\n cancelProps,\n confirmProps,\n kind,\n size,\n dialogProps,\n children,\n ...forwardedProps\n } = props;\n\n const cancelButtonRef = React.useRef(null);\n const confirmationButtonRef = React.useRef(null);\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n // Define a unique ID to target title and description for aria attributes.\n const uniqueId = React.useMemo(() => id || uid(), [id]);\n const titleId = `${uniqueId}-title`;\n const descriptionId = `${uniqueId}-description`;\n\n // If content is a string, set in a paragraph.\n const DescriptionElement = typeof children === 'string' ? 'p' : 'div';\n\n const { label: confirmLabel, onClick: confirmOnClick, ...forwardedConfirmProps } = confirmProps;\n const { label: cancelLabel, onClick: cancelOnClick, ...forwardedCancelProps } = cancelProps || {};\n\n return (\n <Dialog\n ref={ref}\n focusElement={cancelProps ? cancelButtonRef : confirmationButtonRef}\n size={size}\n dialogProps={{\n id: uniqueId,\n role: 'alertdialog',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n ...dialogProps,\n }}\n className={classNames(\n className,\n handleBasicClasses({\n kind,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n <header>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n before={<Icon icon={icon} size={Size.s} color={color} />}\n label={\n <h2 id={titleId} className=\"lumx-typography-title\">\n {title}\n </h2>\n }\n />\n </header>\n\n {children && (\n <DescriptionElement\n id={descriptionId}\n className=\"lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge\"\n >\n {children}\n </DescriptionElement>\n )}\n\n <footer>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n after={\n <>\n {cancelProps && (\n <Button\n {...forwardedCancelProps}\n ref={cancelButtonRef}\n emphasis={Emphasis.medium}\n onClick={cancelOnClick}\n >\n {cancelLabel}\n </Button>\n )}\n <Button\n {...forwardedConfirmProps}\n ref={confirmationButtonRef}\n color={color}\n className=\"lumx-spacing-margin-left-regular\"\n onClick={confirmOnClick}\n >\n {confirmLabel}\n </Button>\n </>\n }\n />\n </footer>\n </Dialog>\n );\n});\n\nAlertDialog.displayName = COMPONENT_NAME;\nAlertDialog.className = CLASSNAME;\nAlertDialog.defaultProps = DEFAULT_PROPS;\n"],"names":["CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","blue","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","tiny","kind","AlertDialog","forwardRef","props","ref","id","title","className","cancelProps","confirmProps","dialogProps","children","forwardedProps","cancelButtonRef","React","useRef","confirmationButtonRef","uniqueId","useMemo","uid","titleId","descriptionId","DescriptionElement","confirmLabel","label","confirmOnClick","onClick","forwardedConfirmProps","cancelLabel","cancelOnClick","forwardedCancelProps","role","classNames","handleBasicClasses","prefix","s","Emphasis","medium","displayName","defaultProps"],"mappings":"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"}
|