@lumx/react 2.2.15 → 2.2.18-alpha-hooks.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/{_rollupPluginBabelHelpers.js → _rolluppluginbabelhelpers.53.js} +1 -1
- package/esm/_internal/_rolluppluginbabelhelpers.53.js.map +1 -0
- package/esm/_internal/alert-dialog.js +19 -19
- package/esm/_internal/{AlertDialog.js → alertdialog.1.js} +8 -8
- package/esm/_internal/alertdialog.1.js.map +1 -0
- package/esm/_internal/autocomplete.js +21 -20
- package/esm/_internal/autocomplete.js.map +1 -1
- package/esm/_internal/{AutocompleteMultiple.js → autocompletemultiple.2.js} +9 -9
- package/esm/_internal/autocompletemultiple.2.js.map +1 -0
- package/esm/_internal/{Avatar2.js → avatar.3.js} +4 -4
- package/esm/_internal/avatar.3.js.map +1 -0
- package/esm/_internal/avatar.js +6 -6
- package/esm/_internal/{Badge2.js → badge.4.js} +3 -3
- package/esm/_internal/badge.4.js.map +1 -0
- package/esm/_internal/badge.js +3 -3
- package/esm/_internal/{Button2.js → button.5.js} +5 -5
- package/esm/_internal/button.5.js.map +1 -0
- package/esm/_internal/button.js +15 -14
- package/esm/_internal/button.js.map +1 -1
- package/esm/_internal/{ButtonGroup.js → buttongroup.7.js} +3 -3
- package/esm/_internal/buttongroup.7.js.map +1 -0
- package/esm/_internal/{ButtonRoot.js → buttonroot.57.js} +4 -4
- package/esm/_internal/buttonroot.57.js.map +1 -0
- package/esm/_internal/{Checkbox2.js → checkbox.8.js} +7 -7
- package/esm/_internal/checkbox.8.js.map +1 -0
- package/esm/_internal/checkbox.js +7 -7
- package/esm/_internal/{Chip2.js → chip.9.js} +3 -3
- package/esm/_internal/chip.9.js.map +1 -0
- package/esm/_internal/chip.js +4 -4
- package/esm/_internal/{ChipGroup.js → chipgroup.10.js} +3 -3
- package/esm/_internal/chipgroup.10.js.map +1 -0
- package/esm/_internal/{ClickAwayProvider.js → clickawayprovider.60.js} +4 -4
- package/esm/_internal/clickawayprovider.60.js.map +1 -0
- package/esm/_internal/comment-block.js +13 -12
- package/esm/_internal/comment-block.js.map +1 -1
- package/esm/_internal/{CommentBlock.js → commentblock.11.js} +5 -5
- package/esm/_internal/commentblock.11.js.map +1 -0
- package/esm/_internal/components.js +2 -1
- package/esm/_internal/components.js.map +1 -1
- package/esm/_internal/{constants.js → constants.59.js} +1 -1
- package/esm/_internal/constants.59.js.map +1 -0
- package/esm/_internal/date-picker.js +19 -18
- package/esm/_internal/date-picker.js.map +1 -1
- package/esm/_internal/{DatePickerField.js → datepickerfield.12.js} +9 -9
- package/esm/_internal/datepickerfield.12.js.map +1 -0
- package/esm/_internal/{Dialog2.js → dialog.13.js} +12 -12
- package/esm/_internal/dialog.13.js.map +1 -0
- package/esm/_internal/dialog.js +12 -12
- package/esm/_internal/{Divider2.js → divider.14.js} +3 -3
- package/esm/_internal/divider.14.js.map +1 -0
- package/esm/_internal/divider.js +3 -3
- package/esm/_internal/drag-handle.js +4 -4
- package/esm/_internal/{DragHandle.js → draghandle.15.js} +4 -4
- package/esm/_internal/draghandle.15.js.map +1 -0
- package/esm/_internal/{Dropdown2.js → dropdown.16.js} +6 -6
- package/esm/_internal/dropdown.16.js.map +1 -0
- package/esm/_internal/dropdown.js +11 -10
- package/esm/_internal/dropdown.js.map +1 -1
- package/esm/_internal/expansion-panel.js +17 -16
- package/esm/_internal/expansion-panel.js.map +1 -1
- package/esm/_internal/{ExpansionPanel.js → expansionpanel.17.js} +8 -8
- package/esm/_internal/expansionpanel.17.js.map +1 -0
- package/esm/_internal/{Flag2.js → flag.18.js} +4 -4
- package/esm/_internal/flag.18.js.map +1 -0
- package/esm/_internal/flag.js +4 -4
- package/esm/_internal/flex-box.js +3 -3
- package/esm/_internal/{FlexBox.js → flexbox.19.js} +3 -3
- package/esm/_internal/flexbox.19.js.map +1 -0
- package/esm/_internal/{getRootClassName.js → getrootclassname.54.js} +2 -2
- package/esm/_internal/getrootclassname.54.js.map +1 -0
- package/esm/_internal/grid.js +3 -3
- package/esm/_internal/{GridItem.js → griditem.20.js} +3 -3
- package/esm/_internal/griditem.20.js.map +1 -0
- package/esm/_internal/{Icon2.js → icon.21.js} +3 -3
- package/esm/_internal/icon.21.js.map +1 -0
- package/esm/_internal/icon.js +3 -3
- package/esm/_internal/{IconButton.js → iconbutton.6.js} +6 -6
- package/esm/_internal/iconbutton.6.js.map +1 -0
- package/esm/_internal/image-block.js +6 -6
- package/esm/_internal/{ImageBlock.js → imageblock.22.js} +4 -4
- package/esm/_internal/imageblock.22.js.map +1 -0
- package/esm/{index2.js → _internal/index.55.js} +1 -1
- package/esm/_internal/index.55.js.map +1 -0
- package/esm/_internal/input-helper.js +3 -3
- package/esm/_internal/input-label.js +3 -3
- package/esm/_internal/{InputHelper.js → inputhelper.23.js} +3 -3
- package/esm/_internal/inputhelper.23.js.map +1 -0
- package/esm/_internal/{InputLabel.js → inputlabel.24.js} +3 -3
- package/esm/_internal/inputlabel.24.js.map +1 -0
- package/esm/_internal/{Lightbox2.js → lightbox.25.js} +11 -11
- package/esm/_internal/lightbox.25.js.map +1 -0
- package/esm/_internal/lightbox.js +17 -16
- package/esm/_internal/lightbox.js.map +1 -1
- package/esm/_internal/link-preview.js +8 -8
- package/esm/_internal/{Link2.js → link.26.js} +5 -5
- package/esm/_internal/link.26.js.map +1 -0
- package/esm/_internal/link.js +5 -5
- package/esm/_internal/{LinkPreview.js → linkpreview.27.js} +5 -5
- package/esm/_internal/linkpreview.27.js.map +1 -0
- package/esm/_internal/{List2.js → list.28.js} +6 -6
- package/esm/_internal/list.28.js.map +1 -0
- package/esm/_internal/list.js +7 -7
- package/esm/_internal/{ListSubheader.js → listsubheader.29.js} +3 -3
- package/esm/_internal/listsubheader.29.js.map +1 -0
- package/esm/_internal/{mergeRefs.js → mergerefs.56.js} +1 -1
- package/esm/_internal/mergerefs.56.js.map +1 -0
- package/esm/_internal/{Message2.js → message.30.js} +4 -4
- package/esm/_internal/message.30.js.map +1 -0
- package/esm/_internal/message.js +4 -4
- package/esm/_internal/{Mosaic2.js → mosaic.31.js} +4 -4
- package/esm/_internal/mosaic.31.js.map +1 -0
- package/esm/_internal/mosaic.js +6 -6
- package/esm/_internal/{Notification2.js → notification.32.js} +7 -7
- package/esm/_internal/notification.32.js.map +1 -0
- package/esm/_internal/notification.js +9 -9
- package/esm/_internal/{partitionMulti.js → partitionmulti.62.js} +1 -1
- package/esm/_internal/partitionmulti.62.js.map +1 -0
- package/esm/_internal/{Popover2.js → popover.33.js} +8 -31
- package/esm/_internal/popover.33.js.map +1 -0
- package/esm/_internal/popover.js +7 -6
- package/esm/_internal/popover.js.map +1 -1
- package/esm/_internal/post-block.js +7 -7
- package/esm/_internal/{PostBlock.js → postblock.34.js} +5 -5
- package/esm/_internal/postblock.34.js.map +1 -0
- package/esm/_internal/progress-tracker.js +9 -9
- package/esm/_internal/{Progress2.js → progress.35.js} +3 -3
- package/esm/_internal/progress.35.js.map +1 -0
- package/esm/_internal/progress.js +3 -3
- package/esm/_internal/{ProgressTrackerStepPanel.js → progresstrackersteppanel.36.js} +8 -8
- package/esm/_internal/progresstrackersteppanel.36.js.map +1 -0
- package/esm/_internal/radio-button.js +6 -6
- package/esm/_internal/{RadioGroup.js → radiogroup.37.js} +6 -6
- package/esm/_internal/radiogroup.37.js.map +1 -0
- package/esm/_internal/{renderLink.js → renderlink.65.js} +2 -2
- package/esm/_internal/renderlink.65.js.map +1 -0
- package/esm/_internal/select.js +20 -19
- package/esm/_internal/select.js.map +1 -1
- package/esm/_internal/{SelectMultiple.js → selectmultiple.38.js} +19 -17
- package/esm/_internal/selectmultiple.38.js.map +1 -0
- package/esm/_internal/side-navigation.js +15 -14
- package/esm/_internal/side-navigation.js.map +1 -1
- package/esm/_internal/{SideNavigationItem.js → sidenavigationitem.39.js} +7 -7
- package/esm/_internal/sidenavigationitem.39.js.map +1 -0
- package/esm/_internal/skeleton.js +3 -3
- package/esm/_internal/{SkeletonTypography.js → skeletontypography.40.js} +3 -3
- package/esm/_internal/skeletontypography.40.js.map +1 -0
- package/esm/_internal/{Slider2.js → slider.41.js} +6 -6
- package/esm/_internal/slider.41.js.map +1 -0
- package/esm/_internal/slider.js +6 -6
- package/esm/_internal/{Slides.js → slides.42.js} +8 -8
- package/esm/_internal/slides.42.js.map +1 -0
- package/esm/_internal/slideshow.js +14 -13
- package/esm/_internal/slideshow.js.map +1 -1
- package/esm/_internal/{Switch2.js → switch.43.js} +6 -6
- package/esm/_internal/switch.43.js.map +1 -0
- package/esm/_internal/switch.js +6 -6
- package/esm/_internal/table.js +4 -4
- package/esm/_internal/{TableRow.js → tablerow.44.js} +4 -4
- package/esm/_internal/tablerow.44.js.map +1 -0
- package/esm/_internal/{TabPanel.js → tabpanel.45.js} +6 -6
- package/esm/_internal/tabpanel.45.js.map +1 -0
- package/esm/_internal/tabs.js +7 -7
- package/esm/_internal/text-field.js +16 -15
- package/esm/_internal/text-field.js.map +1 -1
- package/esm/_internal/{TextField.js → textfield.46.js} +9 -9
- package/esm/_internal/textfield.46.js.map +1 -0
- package/esm/_internal/{Thumbnail2.js → thumbnail.47.js} +6 -6
- package/esm/_internal/thumbnail.47.js.map +1 -0
- package/esm/_internal/thumbnail.js +6 -6
- package/esm/_internal/{Toolbar2.js → toolbar.49.js} +3 -3
- package/esm/_internal/toolbar.49.js.map +1 -0
- package/esm/_internal/toolbar.js +3 -3
- package/esm/_internal/{Tooltip2.js → tooltip.50.js} +7 -7
- package/esm/_internal/tooltip.50.js.map +1 -0
- package/esm/_internal/tooltip.js +9 -8
- package/esm/_internal/tooltip.js.map +1 -1
- package/esm/_internal/{type.js → type.64.js} +1 -1
- package/esm/_internal/type.64.js.map +1 -0
- package/esm/_internal/{types.js → types.48.js} +2 -3
- package/esm/_internal/types.48.js.map +1 -0
- package/esm/_internal/{Uploader2.js → uploader.51.js} +4 -4
- package/esm/_internal/uploader.51.js.map +1 -0
- package/esm/_internal/uploader.js +4 -4
- package/esm/_internal/{useDelayedVisibility.js → usedelayedvisibility.63.js} +2 -2
- package/esm/_internal/usedelayedvisibility.63.js.map +1 -0
- package/esm/_internal/{useDisableBodyScroll.js → usedisablebodyscroll.61.js} +1 -1
- package/esm/_internal/usedisablebodyscroll.61.js.map +1 -0
- package/esm/_internal/{useFocusTrap.js → usefocustrap.58.js} +20 -14
- package/esm/_internal/usefocustrap.58.js.map +1 -0
- package/esm/_internal/user-block.js +9 -9
- package/esm/_internal/{UserBlock.js → userblock.52.js} +5 -5
- package/esm/_internal/userblock.52.js.map +1 -0
- package/esm/_internal/{useRovingTabIndex.js → userovingtabindex.66.js} +3 -3
- package/esm/_internal/userovingtabindex.66.js.map +1 -0
- package/hooks/useFocusWithin.d.ts +16 -0
- package/hooks/useFocusWithin.js +28 -0
- package/hooks/useFocusWithin.js.map +1 -0
- package/{types.d.ts → index.d.ts} +7 -7
- package/index.js +90 -0
- package/{esm/index.js.map → index.js.map} +1 -1
- package/package.json +11 -8
- package/src/components/dialog/Dialog.stories.tsx +3 -1
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +10 -0
- package/src/components/flex-box/FlexBox.stories.tsx +28 -2
- package/src/components/flex-box/FlexBox.tsx +1 -1
- package/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +80 -0
- package/src/components/index.ts +1 -0
- package/src/components/select/SelectMultiple.test.tsx +25 -0
- package/src/components/select/SelectMultiple.tsx +3 -0
- package/src/components/thumbnail/index.ts +0 -1
- package/src/hooks/useFocusTrap.ts +32 -12
- package/esm/_internal/AlertDialog.js.map +0 -1
- package/esm/_internal/AutocompleteMultiple.js.map +0 -1
- package/esm/_internal/Avatar2.js.map +0 -1
- package/esm/_internal/Badge2.js.map +0 -1
- package/esm/_internal/Button2.js.map +0 -1
- package/esm/_internal/ButtonGroup.js.map +0 -1
- package/esm/_internal/ButtonRoot.js.map +0 -1
- package/esm/_internal/Checkbox2.js.map +0 -1
- package/esm/_internal/Chip2.js.map +0 -1
- package/esm/_internal/ChipGroup.js.map +0 -1
- package/esm/_internal/ClickAwayProvider.js.map +0 -1
- package/esm/_internal/CommentBlock.js.map +0 -1
- package/esm/_internal/DatePickerField.js.map +0 -1
- package/esm/_internal/Dialog2.js.map +0 -1
- package/esm/_internal/Divider2.js.map +0 -1
- package/esm/_internal/DragHandle.js.map +0 -1
- package/esm/_internal/Dropdown2.js.map +0 -1
- package/esm/_internal/ExpansionPanel.js.map +0 -1
- package/esm/_internal/Flag2.js.map +0 -1
- package/esm/_internal/FlexBox.js.map +0 -1
- package/esm/_internal/GridItem.js.map +0 -1
- package/esm/_internal/Icon2.js.map +0 -1
- package/esm/_internal/IconButton.js.map +0 -1
- package/esm/_internal/ImageBlock.js.map +0 -1
- package/esm/_internal/InputHelper.js.map +0 -1
- package/esm/_internal/InputLabel.js.map +0 -1
- package/esm/_internal/Lightbox2.js.map +0 -1
- package/esm/_internal/Link2.js.map +0 -1
- package/esm/_internal/LinkPreview.js.map +0 -1
- package/esm/_internal/List2.js.map +0 -1
- package/esm/_internal/ListSubheader.js.map +0 -1
- package/esm/_internal/Message2.js.map +0 -1
- package/esm/_internal/Mosaic2.js.map +0 -1
- package/esm/_internal/Notification2.js.map +0 -1
- package/esm/_internal/Popover2.js.map +0 -1
- package/esm/_internal/PostBlock.js.map +0 -1
- package/esm/_internal/Progress2.js.map +0 -1
- package/esm/_internal/ProgressTrackerStepPanel.js.map +0 -1
- package/esm/_internal/RadioGroup.js.map +0 -1
- package/esm/_internal/SelectMultiple.js.map +0 -1
- package/esm/_internal/SideNavigationItem.js.map +0 -1
- package/esm/_internal/SkeletonTypography.js.map +0 -1
- package/esm/_internal/Slider2.js.map +0 -1
- package/esm/_internal/Slides.js.map +0 -1
- package/esm/_internal/Switch2.js.map +0 -1
- package/esm/_internal/TabPanel.js.map +0 -1
- package/esm/_internal/TableRow.js.map +0 -1
- package/esm/_internal/TextField.js.map +0 -1
- package/esm/_internal/Thumbnail2.js.map +0 -1
- package/esm/_internal/Toolbar2.js.map +0 -1
- package/esm/_internal/Tooltip2.js.map +0 -1
- package/esm/_internal/Uploader2.js.map +0 -1
- package/esm/_internal/UserBlock.js.map +0 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js.map +0 -1
- package/esm/_internal/constants.js.map +0 -1
- package/esm/_internal/getRootClassName.js.map +0 -1
- package/esm/_internal/mergeRefs.js.map +0 -1
- package/esm/_internal/partitionMulti.js.map +0 -1
- package/esm/_internal/renderLink.js.map +0 -1
- package/esm/_internal/type.js.map +0 -1
- package/esm/_internal/types.js.map +0 -1
- package/esm/_internal/useDelayedVisibility.js.map +0 -1
- package/esm/_internal/useDisableBodyScroll.js.map +0 -1
- package/esm/_internal/useFocusTrap.js.map +0 -1
- package/esm/_internal/useRovingTabIndex.js.map +0 -1
- package/esm/index.js +0 -89
- package/esm/index2.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './_rolluppluginbabelhelpers.53.js';
|
|
2
2
|
import './components.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import './
|
|
5
|
-
import './
|
|
4
|
+
import './getrootclassname.54.js';
|
|
5
|
+
import './icon.21.js';
|
|
6
6
|
import 'lodash/isBoolean';
|
|
7
7
|
import 'lodash/isEmpty';
|
|
8
8
|
import 'lodash/kebabCase';
|
|
9
9
|
import 'lodash/noop';
|
|
10
|
-
import './
|
|
11
|
-
import './
|
|
12
|
-
import './
|
|
13
|
-
import './
|
|
14
|
-
import './
|
|
15
|
-
export { U as UserBlock } from './
|
|
10
|
+
import './mergerefs.56.js';
|
|
11
|
+
import './avatar.3.js';
|
|
12
|
+
import './renderlink.65.js';
|
|
13
|
+
import './link.26.js';
|
|
14
|
+
import './thumbnail.47.js';
|
|
15
|
+
export { U as UserBlock } from './userblock.52.js';
|
|
16
16
|
//# sourceMappingURL=user-block.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { b as _objectWithoutProperties, _ as _objectSpread2, c as _extends } from './
|
|
1
|
+
import { b as _objectWithoutProperties, _ as _objectSpread2, c as _extends } from './_rolluppluginbabelhelpers.53.js';
|
|
2
2
|
import { Size, Orientation, Theme, ColorPalette } from './components.js';
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
|
-
import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './
|
|
4
|
+
import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getrootclassname.54.js';
|
|
5
5
|
import isEmpty from 'lodash/isEmpty';
|
|
6
|
-
import { A as Avatar } from './
|
|
7
|
-
import { L as Link } from './
|
|
6
|
+
import { A as Avatar } from './avatar.3.js';
|
|
7
|
+
import { L as Link } from './link.26.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Component display name.
|
|
@@ -122,4 +122,4 @@ UserBlock.className = CLASSNAME;
|
|
|
122
122
|
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
123
123
|
|
|
124
124
|
export { UserBlock as U };
|
|
125
|
-
//# sourceMappingURL=
|
|
125
|
+
//# sourceMappingURL=userblock.52.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userblock.52.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\nimport isEmpty from 'lodash/isEmpty';\nimport classNames from 'classnames';\n\nimport { Avatar, ColorPalette, Link, Orientation, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** Props to pass to the link wrapping the avatar thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** User name. */\n name?: string;\n /** Props to pass to the name block. */\n nameProps?: GenericProps;\n /** Orientation. */\n orientation?: Orientation;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\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<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n linkProps,\n linkAs,\n multipleActions,\n name,\n nameProps,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const isLink = Boolean(linkProps?.href || linkAs);\n const isClickable = !!onClick || isLink;\n\n const nameBlock: ReactNode = React.useMemo(() => {\n if (isEmpty(name)) {\n return null;\n }\n let NameComponent: any = 'span';\n const nProps: any = {\n ...nameProps,\n className: classNames(`${CLASSNAME}__name`, linkProps?.className, nameProps?.className),\n };\n if (isClickable) {\n NameComponent = Link;\n Object.assign(nProps, {\n ...linkProps,\n onClick,\n linkAs,\n color: ColorPalette.dark,\n });\n }\n return <NameComponent {...nProps}>{name}</NameComponent>;\n }, [isClickable, linkAs, linkProps, name, nameProps, onClick]);\n\n const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((field: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {field}\n </span>\n ))}\n </div>\n );\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({ prefix: CLASSNAME, orientation, size: componentSize, theme, isClickable }),\n )}\n onMouseLeave={onMouseLeave}\n onMouseEnter={onMouseEnter}\n >\n {avatarProps && (\n <Avatar\n linkAs={linkAs}\n linkProps={linkProps}\n {...avatarProps}\n className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}\n size={componentSize}\n onClick={onClick}\n theme={theme}\n />\n )}\n {(fields || name) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {nameBlock}\n {fieldsBlock}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n </div>\n );\n});\nUserBlock.displayName = COMPONENT_NAME;\nUserBlock.className = CLASSNAME;\nUserBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","size","Size","m","theme","Theme","light","UserBlock","forwardRef","props","ref","avatarProps","className","fields","linkProps","linkAs","multipleActions","name","nameProps","onClick","onMouseEnter","onMouseLeave","simpleAction","forwardedProps","componentSize","vertical","l","shouldDisplayActions","isLink","Boolean","href","isClickable","nameBlock","React","useMemo","isEmpty","NameComponent","nProps","classNames","Link","Object","assign","color","ColorPalette","dark","fieldsBlock","s","map","field","idx","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;;;;AAgDA;;;AAGA,IAAMA,cAAc,GAAG,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qB,eAA1C,CA7BR,CADJ;AAkCH,CAhGwE;AAiGzET,SAAS,CAAC6C,WAAV,GAAwB1D,cAAxB;AACAa,SAAS,CAACK,SAAV,GAAsBjB,SAAtB;AACAY,SAAS,CAAC8C,YAAV,GAAyBxD,aAAzB;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as _toConsumableArray, _ as _objectSpread2, a as _defineProperty, d as _slicedToArray } from './
|
|
1
|
+
import { e as _toConsumableArray, _ as _objectSpread2, a as _defineProperty, d as _slicedToArray } from './_rolluppluginbabelhelpers.53.js';
|
|
2
2
|
import { createContext, useContext, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
-
import { u as uid } from '
|
|
3
|
+
import { u as uid } from './index.55.js';
|
|
4
4
|
|
|
5
5
|
var INIT_STATE = {
|
|
6
6
|
isLazy: true,
|
|
@@ -219,4 +219,4 @@ var useRovingTabIndex = function useRovingTabIndex(_ref) {
|
|
|
219
219
|
};
|
|
220
220
|
|
|
221
221
|
export { INIT_STATE as I, TabProviderContext as T, useTabProviderContextState as a, useTabProviderContext as b, reducer as r, useRovingTabIndex as u };
|
|
222
|
-
//# sourceMappingURL=
|
|
222
|
+
//# sourceMappingURL=userovingtabindex.66.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userovingtabindex.66.js","sources":["../../../src/components/tabs/state.ts","../../../src/hooks/useRovingTabIndex.tsx"],"sourcesContent":["import { Dispatch, createContext, useCallback, useContext, useEffect, useMemo } from 'react';\nimport { uid } from 'uid';\n\ntype TabType = 'tab' | 'tabPanel';\n\nexport interface State {\n isLazy: boolean;\n shouldActivateOnFocus: boolean;\n activeTabIndex: number;\n ids: Record<TabType, string[]>;\n}\n\nexport const INIT_STATE: State = {\n isLazy: true,\n shouldActivateOnFocus: false,\n activeTabIndex: 0,\n ids: { tab: [], tabPanel: [] },\n};\n\nexport type Action =\n | { type: 'update'; payload: Partial<State> }\n | { type: 'setActiveTabIndex'; payload: number }\n | { type: 'register'; payload: { type: TabType; id: string } }\n | { type: 'unregister'; payload: { type: TabType; id: string } };\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case 'update':\n return { ...state, ...action.payload };\n case 'setActiveTabIndex': {\n if (state.activeTabIndex === action.payload) {\n return state;\n }\n // Change active tab index.\n return { ...state, activeTabIndex: action.payload };\n }\n case 'register': {\n const { type, id } = action.payload;\n // Append tab/tabPanel id in state.\n return { ...state, ids: { ...state.ids, [type]: [...state.ids[type], id] } };\n }\n case 'unregister': {\n const { type, id } = action.payload;\n const index = state.ids[type].indexOf(id);\n if (index === -1) return state;\n // Remove tab & tab panel at index.\n const tabIds = [...state.ids.tab];\n tabIds.splice(index, 1);\n const tabPanelIds = [...state.ids.tabPanel];\n tabPanelIds.splice(index, 1);\n return {\n ...state,\n ids: { tab: tabIds, tabPanel: tabPanelIds },\n };\n }\n default:\n return state;\n }\n};\n\nexport const TabProviderContext = createContext<[State, Dispatch<Action>] | null>(null);\n\nexport type TabState = Pick<Required<State>, 'isLazy' | 'shouldActivateOnFocus'> & {\n isActive: boolean;\n tabId: string;\n tabPanelId: string;\n changeToTab(): void;\n};\n\n/* eslint-disable react-hooks/rules-of-hooks */\nexport const useTabProviderContext = (type: TabType, originalId?: string): undefined | TabState => {\n const context = useContext(TabProviderContext);\n if (!context) {\n return undefined;\n }\n const [state, dispatch] = context;\n\n // Current tab or tab panel id.\n const id = useMemo(\n () => originalId || `${type}-${uid()}`,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n useEffect(\n () => {\n // On mount: register tab or tab panel id.\n dispatch({ type: 'register', payload: { type, id } });\n return () => {\n // On unmount: unregister tab or tab panel id.\n dispatch({ type: 'unregister', payload: { type, id } });\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Find tab/tabPanel index using it's id.\n const index = useMemo(() => state.ids[type].indexOf(id), [state.ids, type, id]);\n const tabId = useMemo(() => state.ids.tab[index] || '', [state, index]);\n const tabPanelId = useMemo(() => state.ids.tabPanel[index] || '', [state, index]);\n const isActive = useMemo(() => state.activeTabIndex === index, [state, index]);\n const changeToTab = useCallback(() => dispatch({ type: 'setActiveTabIndex', payload: index }), [dispatch, index]);\n return {\n isLazy: state.isLazy,\n shouldActivateOnFocus: state.shouldActivateOnFocus,\n tabId,\n tabPanelId,\n isActive,\n changeToTab,\n };\n};\n\nexport const useTabProviderContextState = (): State | undefined => {\n const context = useContext(TabProviderContext);\n return context?.[0];\n};\n","import { RefObject, useEffect } from 'react';\n\ninterface UseRovingTabIndexOptions {\n parentRef: RefObject<HTMLElement>;\n elementSelector: string;\n keepTabIndex?: boolean;\n /** List of values to be used as extra dependencies of the useEffect */\n extraDependencies?: any[];\n}\n\nexport const useRovingTabIndex = ({\n parentRef,\n elementSelector,\n keepTabIndex,\n extraDependencies = [],\n}: UseRovingTabIndexOptions): void => {\n useEffect(\n () => {\n const parent = parentRef?.current;\n if (!parent) {\n return undefined;\n }\n\n const elements = parent.querySelectorAll(elementSelector) as NodeListOf<HTMLElement>;\n const initialFocusableElement = parent?.querySelector(`${elementSelector}[tabindex=\"0\"]`);\n\n const handleKeyDown = (index: number) => (evt: KeyboardEvent) => {\n let newTabFocus = index;\n if (!(evt.key === 'ArrowRight' || evt.key === 'ArrowLeft')) {\n return;\n }\n\n if (evt.key === 'ArrowRight') {\n // Move right\n newTabFocus += 1;\n // If we're at the end, go to the start\n if (newTabFocus >= elements.length) {\n newTabFocus = 0;\n }\n } else if (evt.key === 'ArrowLeft') {\n // Move left\n newTabFocus -= 1;\n if (newTabFocus < 0) {\n // If we're at the start, move to the end\n newTabFocus = elements.length - 1;\n }\n }\n const newElement = elements[newTabFocus];\n newElement?.focus();\n if (keepTabIndex) {\n (evt.currentTarget as HTMLElement).setAttribute('tabindex', '-1');\n newElement?.setAttribute('tabindex', '0');\n }\n };\n\n if (elements?.length > 0) {\n elements.forEach((el, key) => {\n // if no element has tabindex set to 0, set the first element as focusable\n if (!initialFocusableElement && key === 0) {\n el.setAttribute('tabindex', '0');\n // set all other to -1\n } else if (initialFocusableElement !== el) {\n el.setAttribute('tabindex', '-1');\n }\n // add event listener\n el.addEventListener('keydown', handleKeyDown(key) as EventListener);\n });\n }\n\n // Cleanup listeners\n return () => {\n if (elements?.length > 0) {\n elements.forEach((el, key) => {\n el.removeEventListener('keydown', handleKeyDown(key) as EventListener);\n });\n }\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentRef, ...extraDependencies],\n );\n};\n"],"names":["INIT_STATE","isLazy","shouldActivateOnFocus","activeTabIndex","ids","tab","tabPanel","reducer","state","action","type","payload","id","index","indexOf","tabIds","splice","tabPanelIds","TabProviderContext","createContext","useTabProviderContext","originalId","context","useContext","undefined","dispatch","useMemo","uid","useEffect","tabId","tabPanelId","isActive","changeToTab","useCallback","useTabProviderContextState","useRovingTabIndex","parentRef","elementSelector","keepTabIndex","extraDependencies","parent","current","elements","querySelectorAll","initialFocusableElement","querySelector","handleKeyDown","evt","newTabFocus","key","length","newElement","focus","currentTarget","setAttribute","forEach","el","addEventListener","removeEventListener"],"mappings":";;;;IAYaA,UAAiB,GAAG;AAC7BC,EAAAA,MAAM,EAAE,IADqB;AAE7BC,EAAAA,qBAAqB,EAAE,KAFM;AAG7BC,EAAAA,cAAc,EAAE,CAHa;AAI7BC,EAAAA,GAAG,EAAE;AAAEC,IAAAA,GAAG,EAAE,EAAP;AAAWC,IAAAA,QAAQ,EAAE;AAArB;AAJwB;IAapBC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAeC,MAAf,EAAyC;AAC5D,UAAQA,MAAM,CAACC,IAAf;AACI,SAAK,QAAL;AACI,gCAAYF,KAAZ,MAAsBC,MAAM,CAACE,OAA7B;;AACJ,SAAK,mBAAL;AAA0B;AACtB,YAAIH,KAAK,CAACL,cAAN,KAAyBM,MAAM,CAACE,OAApC,EAA6C;AACzC,iBAAOH,KAAP;AACH,SAHqB;;;AAKtB,kCAAYA,KAAZ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A,QAAQ,CAACa,OAAT,CAAiB,UAACC,EAAD,EAAKP,GAAL,EAAa;AAC1B;AACA,YAAI,CAACL,uBAAD,IAA4BK,GAAG,KAAK,CAAxC,EAA2C;AACvCO,UAAAA,EAAE,CAACF,YAAH,CAAgB,UAAhB,EAA4B,GAA5B,EADuC;AAG1C,SAHD,MAGO,IAAIV,uBAAuB,KAAKY,EAAhC,EAAoC;AACvCA,UAAAA,EAAE,CAACF,YAAH,CAAgB,UAAhB,EAA4B,IAA5B;AACH,SAPyB;;;AAS1BE,QAAAA,EAAE,CAACC,gBAAH,CAAoB,SAApB,EAA+BX,aAAa,CAACG,GAAD,CAA5C;AACH,OAVD;AAWH,KAlDC;;;AAqDF,WAAO,YAAM;AACT,UAAI,CAAAP,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEQ,MAAV,IAAmB,CAAvB,EAA0B;AACtBR,QAAAA,QAAQ,CAACa,OAAT,CAAiB,UAACC,EAAD,EAAKP,GAAL,EAAa;AAC1BO,UAAAA,EAAE,CAACE,mBAAH,CAAuB,SAAvB,EAAkCZ,aAAa,CAACG,GAAD,CAA/C;AACH,SAFD;AAGH;AACJ,KAND;AAOH,GA7DI;AAAA,GA8DJb,SA9DI,4BA8DUG,iBA9DV,GAAT;AAgEH;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UseFocusWithinOptions {
|
|
2
|
+
/** element to add the focus within to */
|
|
3
|
+
element: HTMLElement | null;
|
|
4
|
+
/** callback to be executed on focus in */
|
|
5
|
+
onFocusIn: (ev: FocusEvent) => void;
|
|
6
|
+
/** callback to be executed on focus out */
|
|
7
|
+
onFocusOut: (ev: FocusEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook that allows to control when there is a focus event within a given element, meaning
|
|
11
|
+
* that any element within the given target will trigger the focus in and focus out events.
|
|
12
|
+
* @param options - UseFocusWithinOptions
|
|
13
|
+
*/
|
|
14
|
+
declare const useFocusWithin: ({ element, onFocusIn, onFocusOut }: UseFocusWithinOptions) => void;
|
|
15
|
+
|
|
16
|
+
export { UseFocusWithinOptions, useFocusWithin };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that allows to control when there is a focus event within a given element, meaning
|
|
5
|
+
* that any element within the given target will trigger the focus in and focus out events.
|
|
6
|
+
* @param options - UseFocusWithinOptions
|
|
7
|
+
*/
|
|
8
|
+
var useFocusWithin = function useFocusWithin(_ref) {
|
|
9
|
+
var element = _ref.element,
|
|
10
|
+
onFocusIn = _ref.onFocusIn,
|
|
11
|
+
onFocusOut = _ref.onFocusOut;
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (element) {
|
|
14
|
+
element.addEventListener('focusin', onFocusIn);
|
|
15
|
+
element.addEventListener('focusout', onFocusOut);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return function () {
|
|
19
|
+
if (element) {
|
|
20
|
+
element.removeEventListener('focusin', onFocusIn);
|
|
21
|
+
element.removeEventListener('focusout', onFocusOut);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, [onFocusIn, element, onFocusOut]);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useFocusWithin };
|
|
28
|
+
//# sourceMappingURL=useFocusWithin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusWithin.js","sources":["../../src/hooks/useFocusWithin.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nexport interface UseFocusWithinOptions {\n /** element to add the focus within to */\n element: HTMLElement | null;\n /** callback to be executed on focus in */\n onFocusIn: (ev: FocusEvent) => void;\n /** callback to be executed on focus out */\n onFocusOut: (ev: FocusEvent) => void;\n}\n\n/**\n * Hook that allows to control when there is a focus event within a given element, meaning\n * that any element within the given target will trigger the focus in and focus out events.\n * @param options - UseFocusWithinOptions\n */\nexport const useFocusWithin = ({ element, onFocusIn, onFocusOut }: UseFocusWithinOptions) => {\n useEffect(() => {\n if (element) {\n element.addEventListener('focusin', onFocusIn);\n\n element.addEventListener('focusout', onFocusOut);\n }\n\n return () => {\n if (element) {\n element.removeEventListener('focusin', onFocusIn);\n\n element.removeEventListener('focusout', onFocusOut);\n }\n };\n }, [onFocusIn, element, onFocusOut]);\n};\n"],"names":["useFocusWithin","element","onFocusIn","onFocusOut","useEffect","addEventListener","removeEventListener"],"mappings":";;AAWA;;;;;IAKaA,cAAc,GAAG,SAAjBA,cAAiB,OAA+D;AAAA,MAA5DC,OAA4D,QAA5DA,OAA4D;AAAA,MAAnDC,SAAmD,QAAnDA,SAAmD;AAAA,MAAxCC,UAAwC,QAAxCA,UAAwC;AACzFC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIH,OAAJ,EAAa;AACTA,MAAAA,OAAO,CAACI,gBAAR,CAAyB,SAAzB,EAAoCH,SAApC;AAEAD,MAAAA,OAAO,CAACI,gBAAR,CAAyB,UAAzB,EAAqCF,UAArC;AACH;;AAED,WAAO,YAAM;AACT,UAAIF,OAAJ,EAAa;AACTA,QAAAA,OAAO,CAACK,mBAAR,CAA4B,SAA5B,EAAuCJ,SAAvC;AAEAD,QAAAA,OAAO,CAACK,mBAAR,CAA4B,UAA5B,EAAwCH,UAAxC;AACH;AACJ,KAND;AAOH,GAdQ,EAcN,CAACD,SAAD,EAAYD,OAAZ,EAAqBE,UAArB,CAdM,CAAT;AAeH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v5.
|
|
1
|
+
// Generated by dts-bundle-generator v5.9.0
|
|
2
2
|
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
|
|
@@ -95,6 +95,7 @@ export declare const Size: {
|
|
|
95
95
|
readonly xxl: "xxl";
|
|
96
96
|
readonly tiny: "tiny";
|
|
97
97
|
readonly regular: "regular";
|
|
98
|
+
readonly medium: "medium";
|
|
98
99
|
readonly big: "big";
|
|
99
100
|
readonly huge: "huge";
|
|
100
101
|
};
|
|
@@ -670,7 +671,7 @@ export interface ChipGroupProps extends GenericProps {
|
|
|
670
671
|
children: ReactNode;
|
|
671
672
|
}
|
|
672
673
|
export declare const ChipGroup: Comp<ChipGroupProps, HTMLDivElement> & {
|
|
673
|
-
useChipGroupNavigation: import("
|
|
674
|
+
useChipGroupNavigation: import("@lumx/react/hooks/useChipGroupNavigation").useChipGroupNavigationType<any>;
|
|
674
675
|
};
|
|
675
676
|
/**
|
|
676
677
|
* Comment block variants.
|
|
@@ -1091,7 +1092,7 @@ export interface FlagProps extends GenericProps {
|
|
|
1091
1092
|
*/
|
|
1092
1093
|
export declare const Flag: Comp<FlagProps, HTMLDivElement>;
|
|
1093
1094
|
export declare type MarginAutoAlignment = Extract<Alignment, "top" | "bottom" | "right" | "left">;
|
|
1094
|
-
export declare type GapSize = Extract<Size, "regular" | "big" | "huge">;
|
|
1095
|
+
export declare type GapSize = Extract<Size, "regular" | "medium" | "big" | "huge">;
|
|
1095
1096
|
/**
|
|
1096
1097
|
* Defines the props of the component.
|
|
1097
1098
|
*/
|
|
@@ -1494,7 +1495,7 @@ export interface ListProps extends GenericProps {
|
|
|
1494
1495
|
onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;
|
|
1495
1496
|
}
|
|
1496
1497
|
export declare const List: Comp<ListProps, HTMLUListElement> & {
|
|
1497
|
-
useKeyboardListNavigation: import("
|
|
1498
|
+
useKeyboardListNavigation: import("@lumx/react/hooks/useKeyboardListNavigation").useKeyboardListNavigationType;
|
|
1498
1499
|
};
|
|
1499
1500
|
export declare type ListItemSize = Extract<Size, "tiny" | "regular" | "big" | "huge">;
|
|
1500
1501
|
/**
|
|
@@ -2219,8 +2220,8 @@ export interface SlideshowControlsProps extends GenericProps {
|
|
|
2219
2220
|
playButtonProps?: Pick<IconButtonProps, "label"> & Omit<IconButtonProps, "label" | "onClick" | "icon" | "emphasis" | "color">;
|
|
2220
2221
|
}
|
|
2221
2222
|
export declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> & {
|
|
2222
|
-
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("
|
|
2223
|
-
useSlideshowControlsDefaultOptions: Partial<import("
|
|
2223
|
+
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControlsOptions) => import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControls;
|
|
2224
|
+
useSlideshowControlsDefaultOptions: Partial<import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControlsOptions>;
|
|
2224
2225
|
};
|
|
2225
2226
|
export interface SlidesProps extends GenericProps {
|
|
2226
2227
|
/** current slide active */
|
|
@@ -2546,7 +2547,6 @@ export interface TextFieldProps extends GenericProps {
|
|
|
2546
2547
|
* @return React element.
|
|
2547
2548
|
*/
|
|
2548
2549
|
export declare const TextField: Comp<TextFieldProps, HTMLDivElement>;
|
|
2549
|
-
export declare const useFocusPointStyle: ({ image, aspectRatio, focusPoint, imgProps: { width, height } }: ThumbnailProps, element: HTMLImageElement | undefined, isLoaded: boolean) => CSSProperties;
|
|
2550
2550
|
/**
|
|
2551
2551
|
* Defines the props of the component.
|
|
2552
2552
|
*/
|
package/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import './esm/_internal/_rolluppluginbabelhelpers.53.js';
|
|
2
|
+
export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyInterface, TypographyTitleCustom } from './esm/_internal/components.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './esm/_internal/getrootclassname.54.js';
|
|
5
|
+
export { I as Icon } from './esm/_internal/icon.21.js';
|
|
6
|
+
import './esm/_internal/index.55.js';
|
|
7
|
+
import 'lodash/isBoolean';
|
|
8
|
+
import 'lodash/isEmpty';
|
|
9
|
+
import 'lodash/kebabCase';
|
|
10
|
+
import 'lodash/noop';
|
|
11
|
+
import './esm/_internal/constants.59.js';
|
|
12
|
+
import 'lodash/concat';
|
|
13
|
+
import 'lodash/dropRight';
|
|
14
|
+
import 'lodash/last';
|
|
15
|
+
import 'lodash/partition';
|
|
16
|
+
import 'lodash/reduce';
|
|
17
|
+
import './esm/_internal/partitionmulti.62.js';
|
|
18
|
+
import 'lodash/get';
|
|
19
|
+
import './esm/_internal/type.64.js';
|
|
20
|
+
export { A as AlertDialog } from './esm/_internal/alertdialog.1.js';
|
|
21
|
+
export { P as Placement, a as Popover } from './esm/_internal/popover.33.js';
|
|
22
|
+
import './esm/_internal/mergerefs.56.js';
|
|
23
|
+
export { A as Autocomplete, a as AutocompleteMultiple } from './esm/_internal/autocompletemultiple.2.js';
|
|
24
|
+
export { A as Avatar } from './esm/_internal/avatar.3.js';
|
|
25
|
+
export { B as Badge } from './esm/_internal/badge.4.js';
|
|
26
|
+
import './esm/_internal/renderlink.65.js';
|
|
27
|
+
import './esm/_internal/buttonroot.57.js';
|
|
28
|
+
export { a as Button, B as ButtonEmphasis } from './esm/_internal/button.5.js';
|
|
29
|
+
export { I as IconButton } from './esm/_internal/iconbutton.6.js';
|
|
30
|
+
export { B as ButtonGroup } from './esm/_internal/buttongroup.7.js';
|
|
31
|
+
export { C as Checkbox } from './esm/_internal/checkbox.8.js';
|
|
32
|
+
import 'lodash/isFunction';
|
|
33
|
+
export { C as Chip } from './esm/_internal/chip.9.js';
|
|
34
|
+
export { C as ChipGroup } from './esm/_internal/chipgroup.10.js';
|
|
35
|
+
export { a as CommentBlock, C as CommentBlockVariant } from './esm/_internal/commentblock.11.js';
|
|
36
|
+
import 'moment';
|
|
37
|
+
export { D as DatePicker, a as DatePickerControlled, b as DatePickerField } from './esm/_internal/datepickerfield.12.js';
|
|
38
|
+
import 'lodash/range';
|
|
39
|
+
import 'moment-range';
|
|
40
|
+
import './esm/_internal/usefocustrap.58.js';
|
|
41
|
+
import 'react-dom';
|
|
42
|
+
import './esm/_internal/clickawayprovider.60.js';
|
|
43
|
+
export { D as Dialog } from './esm/_internal/dialog.13.js';
|
|
44
|
+
import 'lodash/pull';
|
|
45
|
+
import './esm/_internal/usedelayedvisibility.63.js';
|
|
46
|
+
import './esm/_internal/usedisablebodyscroll.61.js';
|
|
47
|
+
export { D as DEFAULT_PROPS, a as Divider } from './esm/_internal/divider.14.js';
|
|
48
|
+
export { D as DragHandle } from './esm/_internal/draghandle.15.js';
|
|
49
|
+
export { L as List, a as ListItem, i as isClickable } from './esm/_internal/list.28.js';
|
|
50
|
+
import './hooks/useFocusWithin.js';
|
|
51
|
+
export { D as Dropdown } from './esm/_internal/dropdown.16.js';
|
|
52
|
+
export { E as ExpansionPanel } from './esm/_internal/expansionpanel.17.js';
|
|
53
|
+
export { F as Flag } from './esm/_internal/flag.18.js';
|
|
54
|
+
import 'lodash/castArray';
|
|
55
|
+
export { F as FlexBox } from './esm/_internal/flexbox.19.js';
|
|
56
|
+
export { G as Grid, a as GridItem } from './esm/_internal/griditem.20.js';
|
|
57
|
+
import 'lodash/isObject';
|
|
58
|
+
export { a as ImageBlock, I as ImageBlockCaptionPosition } from './esm/_internal/imageblock.22.js';
|
|
59
|
+
export { I as InputHelper } from './esm/_internal/inputhelper.23.js';
|
|
60
|
+
export { I as InputLabel } from './esm/_internal/inputlabel.24.js';
|
|
61
|
+
export { L as Lightbox } from './esm/_internal/lightbox.25.js';
|
|
62
|
+
export { L as Link } from './esm/_internal/link.26.js';
|
|
63
|
+
export { L as LinkPreview } from './esm/_internal/linkpreview.27.js';
|
|
64
|
+
export { L as ListDivider, a as ListSubheader } from './esm/_internal/listsubheader.29.js';
|
|
65
|
+
export { M as Message } from './esm/_internal/message.30.js';
|
|
66
|
+
import 'lodash/take';
|
|
67
|
+
export { M as Mosaic } from './esm/_internal/mosaic.31.js';
|
|
68
|
+
export { N as Notification } from './esm/_internal/notification.32.js';
|
|
69
|
+
export { P as PostBlock } from './esm/_internal/postblock.34.js';
|
|
70
|
+
export { a as Progress, P as ProgressVariant } from './esm/_internal/progress.35.js';
|
|
71
|
+
import './esm/_internal/userovingtabindex.66.js';
|
|
72
|
+
export { a as ProgressTracker, P as ProgressTrackerProvider, b as ProgressTrackerStep, c as ProgressTrackerStepPanel } from './esm/_internal/progresstrackersteppanel.36.js';
|
|
73
|
+
export { R as RadioButton, a as RadioGroup } from './esm/_internal/radiogroup.37.js';
|
|
74
|
+
export { a as Select, c as SelectMultiple, b as SelectMultipleField, S as SelectVariant } from './esm/_internal/selectmultiple.38.js';
|
|
75
|
+
export { S as SideNavigation, a as SideNavigationItem } from './esm/_internal/sidenavigationitem.39.js';
|
|
76
|
+
export { S as SkeletonCircle, b as SkeletonRectangle, a as SkeletonRectangleVariant, c as SkeletonTypography } from './esm/_internal/skeletontypography.40.js';
|
|
77
|
+
export { S as Slider, c as clamp } from './esm/_internal/slider.41.js';
|
|
78
|
+
export { c as Slides, S as Slideshow, b as SlideshowControls, a as SlideshowItem } from './esm/_internal/slides.42.js';
|
|
79
|
+
import 'lodash/uniqueId';
|
|
80
|
+
export { S as Switch } from './esm/_internal/switch.43.js';
|
|
81
|
+
export { T as Table, a as TableBody, d as TableCell, c as TableCellVariant, e as TableHeader, f as TableRow, b as ThOrder } from './esm/_internal/tablerow.44.js';
|
|
82
|
+
export { c as Tab, b as TabList, a as TabListLayout, d as TabPanel, T as TabProvider } from './esm/_internal/tabpanel.45.js';
|
|
83
|
+
export { T as TextField } from './esm/_internal/textfield.46.js';
|
|
84
|
+
export { T as Thumbnail } from './esm/_internal/thumbnail.47.js';
|
|
85
|
+
export { T as ThumbnailAspectRatio, a as ThumbnailVariant } from './esm/_internal/types.48.js';
|
|
86
|
+
export { T as Toolbar } from './esm/_internal/toolbar.49.js';
|
|
87
|
+
export { T as Tooltip } from './esm/_internal/tooltip.50.js';
|
|
88
|
+
export { a as Uploader, U as UploaderVariant } from './esm/_internal/uploader.51.js';
|
|
89
|
+
export { U as UserBlock } from './esm/_internal/userblock.52.js';
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.2.
|
|
11
|
-
"@lumx/icons": "^2.2.
|
|
10
|
+
"@lumx/core": "^2.2.18-alpha-hooks.1",
|
|
11
|
+
"@lumx/icons": "^2.2.18-alpha-hooks.1",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"rollup-plugin-babel": "^4.4.0",
|
|
68
68
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
69
69
|
"rollup-plugin-copy": "^3.3.0",
|
|
70
|
+
"rollup-plugin-dts": "^4.1.0",
|
|
70
71
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
71
72
|
"rollup-plugin-ts-paths-resolve": "^1.3.0",
|
|
72
73
|
"rollup-plugin-typescript-paths": "^1.2.2",
|
|
@@ -98,10 +99,12 @@
|
|
|
98
99
|
"React"
|
|
99
100
|
],
|
|
100
101
|
"license": "MIT",
|
|
101
|
-
"
|
|
102
|
-
"main": "esm/index.js",
|
|
103
|
-
"types": "types.d.ts",
|
|
102
|
+
"type": "module",
|
|
104
103
|
"name": "@lumx/react",
|
|
104
|
+
"exports": {
|
|
105
|
+
".": "./index.js",
|
|
106
|
+
"./hooks/*": "./hooks/*.js"
|
|
107
|
+
},
|
|
105
108
|
"publishConfig": {
|
|
106
109
|
"directory": "dist"
|
|
107
110
|
},
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
},
|
|
112
115
|
"scripts": {
|
|
113
116
|
"build": "rollup -c && yarn generate:types",
|
|
114
|
-
"generate:types": "dts-bundle-generator --no-check --external-types=react --external-imports=moment -o dist/
|
|
117
|
+
"generate:types": "dts-bundle-generator --no-check --external-types=react --external-imports=moment -o dist/index.d.ts src/index.ts",
|
|
115
118
|
"prepare": "install-peers || exit 0",
|
|
116
119
|
"prepublishOnly": "yarn build",
|
|
117
120
|
"test": "jest --config jest/index.js --coverage --notify --passWithNoTests --detectOpenHandles --runInBand",
|
|
@@ -120,6 +123,6 @@
|
|
|
120
123
|
"build:storybook": "cd storybook && ./build"
|
|
121
124
|
},
|
|
122
125
|
"sideEffects": false,
|
|
123
|
-
"version": "2.2.
|
|
124
|
-
"gitHead": "
|
|
126
|
+
"version": "2.2.18-alpha-hooks.1",
|
|
127
|
+
"gitHead": "280df99a48535a25a827bbd48575cd8af836b3fa"
|
|
125
128
|
}
|
|
@@ -333,7 +333,7 @@ export const DialogWithFocusableElements = ({ theme }: any) => {
|
|
|
333
333
|
label="Checkbox input"
|
|
334
334
|
/>
|
|
335
335
|
|
|
336
|
-
<FlexBox orientation="horizontal">
|
|
336
|
+
<FlexBox orientation="horizontal" hAlign="bottom" gap="regular">
|
|
337
337
|
<DatePickerField
|
|
338
338
|
locale="fr"
|
|
339
339
|
label="Start date"
|
|
@@ -366,6 +366,8 @@ export const DialogWithFocusableElements = ({ theme }: any) => {
|
|
|
366
366
|
))}
|
|
367
367
|
</List>
|
|
368
368
|
</Select>
|
|
369
|
+
|
|
370
|
+
<Button isDisabled>Disabled button (focus ignored)</Button>
|
|
369
371
|
</FlexBox>
|
|
370
372
|
|
|
371
373
|
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}
|
|
@@ -152,6 +152,8 @@ exports[`<Dialog> Snapshots and structure should render story DialogWithFocusabl
|
|
|
152
152
|
theme="light"
|
|
153
153
|
/>
|
|
154
154
|
<FlexBox
|
|
155
|
+
gap="regular"
|
|
156
|
+
hAlign="bottom"
|
|
155
157
|
orientation="horizontal"
|
|
156
158
|
>
|
|
157
159
|
<DatePickerField
|
|
@@ -210,6 +212,14 @@ exports[`<Dialog> Snapshots and structure should render story DialogWithFocusabl
|
|
|
210
212
|
</ListItem>
|
|
211
213
|
</List>
|
|
212
214
|
</Select>
|
|
215
|
+
<Button
|
|
216
|
+
emphasis="high"
|
|
217
|
+
isDisabled={true}
|
|
218
|
+
size="m"
|
|
219
|
+
theme="light"
|
|
220
|
+
>
|
|
221
|
+
Disabled button (focus ignored)
|
|
222
|
+
</Button>
|
|
213
223
|
</FlexBox>
|
|
214
224
|
<div
|
|
215
225
|
tabIndex={0}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mdiPencil } from '@lumx/icons';
|
|
2
|
-
import { Alignment, Button, Icon, Orientation } from '@lumx/react';
|
|
2
|
+
import { Alignment, Button, Icon, Orientation, Size } from '@lumx/react';
|
|
3
3
|
import { boolean, number, select, text } from '@storybook/addon-knobs';
|
|
4
4
|
import fromPairs from 'lodash/fromPairs';
|
|
5
5
|
import React from 'react';
|
|
@@ -18,6 +18,7 @@ const flexViewKnobConfigs: Array<
|
|
|
18
18
|
['fillSpace', boolean],
|
|
19
19
|
['noShrink', boolean],
|
|
20
20
|
['wrap', boolean],
|
|
21
|
+
['gap', select, [DEFAULT_PROPS.gap, Size.regular, Size.medium, Size.big, Size.huge]],
|
|
21
22
|
['hAlign', select, [DEFAULT_PROPS.hAlign, Alignment.center, Alignment.top, Alignment.bottom]],
|
|
22
23
|
['vAlign', select, [DEFAULT_PROPS.vAlign, Alignment.center, Alignment.right, Alignment.left]],
|
|
23
24
|
['orientation', select, [undefined, Orientation.horizontal, Orientation.vertical]],
|
|
@@ -52,7 +53,7 @@ const setupFlexBoxKnobs = (group: string, knobs: FlexBoxPropName[] = []) =>
|
|
|
52
53
|
const flexChildKnobs: FlexBoxPropName[] = ['fillSpace', 'noShrink', 'marginAuto'];
|
|
53
54
|
|
|
54
55
|
export const Flex = () => (
|
|
55
|
-
<FlexBox {...setupFlexBoxKnobs('-flex container', ['orientation', 'hAlign', 'vAlign', 'wrap'])}>
|
|
56
|
+
<FlexBox {...setupFlexBoxKnobs('-flex container', ['orientation', 'hAlign', 'vAlign', 'wrap', 'gap'])}>
|
|
56
57
|
<FlexBox {...setupFlexBoxKnobs('start', flexChildKnobs)}>
|
|
57
58
|
<Icon icon={mdiPencil} />
|
|
58
59
|
</FlexBox>
|
|
@@ -78,6 +79,16 @@ const vAlign = (prefix?: string) =>
|
|
|
78
79
|
Alignment.center,
|
|
79
80
|
);
|
|
80
81
|
|
|
82
|
+
const orientation = (prefix?: string) =>
|
|
83
|
+
select(
|
|
84
|
+
`${prefix ? `${prefix}: ` : ''}Set orientation`,
|
|
85
|
+
[Orientation.vertical, Orientation.horizontal],
|
|
86
|
+
Orientation.vertical,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const gapSize = (prefix?: string) =>
|
|
90
|
+
select(`${prefix ? `${prefix}: ` : ''}Gap size`, [Size.regular, Size.medium, Size.big, Size.huge], Size.regular);
|
|
91
|
+
|
|
81
92
|
export const HorizontalFlex = () => (
|
|
82
93
|
<FlexBox
|
|
83
94
|
orientation={Orientation.horizontal}
|
|
@@ -122,6 +133,21 @@ export const VerticalFlex = () => (
|
|
|
122
133
|
</FlexBox>
|
|
123
134
|
);
|
|
124
135
|
|
|
136
|
+
export const GapSizeFlex = () => (
|
|
137
|
+
<FlexBox orientation={orientation()} gap={gapSize()}>
|
|
138
|
+
<Button>Item 1</Button>
|
|
139
|
+
<FlexBox vAlign={Alignment.left}>
|
|
140
|
+
<Button>Item 2</Button>
|
|
141
|
+
</FlexBox>
|
|
142
|
+
<FlexBox>
|
|
143
|
+
<Button>Item 3</Button>
|
|
144
|
+
</FlexBox>
|
|
145
|
+
<FlexBox vAlign={Alignment.right}>
|
|
146
|
+
<Button>Item 4</Button>
|
|
147
|
+
</FlexBox>
|
|
148
|
+
</FlexBox>
|
|
149
|
+
);
|
|
150
|
+
|
|
125
151
|
export const WrapFlex = () => (
|
|
126
152
|
<FlexBox
|
|
127
153
|
orientation={Orientation.horizontal}
|
|
@@ -6,7 +6,7 @@ import React, { forwardRef, ReactNode } from 'react';
|
|
|
6
6
|
import { Size } from '..';
|
|
7
7
|
|
|
8
8
|
export type MarginAutoAlignment = Extract<Alignment, 'top' | 'bottom' | 'right' | 'left'>;
|
|
9
|
-
export type GapSize = Extract<Size, 'regular' | 'big' | 'huge'>;
|
|
9
|
+
export type GapSize = Extract<Size, 'regular' | 'medium' | 'big' | 'huge'>;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Defines the props of the component.
|
|
@@ -89,6 +89,86 @@ Array [
|
|
|
89
89
|
]
|
|
90
90
|
`;
|
|
91
91
|
|
|
92
|
+
exports[`<FlexBox> Snapshots and structure should render story 'GapSizeFlex' 1`] = `
|
|
93
|
+
Array [
|
|
94
|
+
<div
|
|
95
|
+
className="lumx-flex-box lumx-flex-box--orientation-vertical lumx-flex-box--gap-regular"
|
|
96
|
+
>
|
|
97
|
+
<Button
|
|
98
|
+
emphasis="high"
|
|
99
|
+
size="m"
|
|
100
|
+
theme="light"
|
|
101
|
+
>
|
|
102
|
+
Item 1
|
|
103
|
+
</Button>
|
|
104
|
+
<FlexBox
|
|
105
|
+
vAlign="left"
|
|
106
|
+
>
|
|
107
|
+
<Button
|
|
108
|
+
emphasis="high"
|
|
109
|
+
size="m"
|
|
110
|
+
theme="light"
|
|
111
|
+
>
|
|
112
|
+
Item 2
|
|
113
|
+
</Button>
|
|
114
|
+
</FlexBox>
|
|
115
|
+
<FlexBox>
|
|
116
|
+
<Button
|
|
117
|
+
emphasis="high"
|
|
118
|
+
size="m"
|
|
119
|
+
theme="light"
|
|
120
|
+
>
|
|
121
|
+
Item 3
|
|
122
|
+
</Button>
|
|
123
|
+
</FlexBox>
|
|
124
|
+
<FlexBox
|
|
125
|
+
vAlign="right"
|
|
126
|
+
>
|
|
127
|
+
<Button
|
|
128
|
+
emphasis="high"
|
|
129
|
+
size="m"
|
|
130
|
+
theme="light"
|
|
131
|
+
>
|
|
132
|
+
Item 4
|
|
133
|
+
</Button>
|
|
134
|
+
</FlexBox>
|
|
135
|
+
</div>,
|
|
136
|
+
<div
|
|
137
|
+
className="lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left"
|
|
138
|
+
>
|
|
139
|
+
<Button
|
|
140
|
+
emphasis="high"
|
|
141
|
+
size="m"
|
|
142
|
+
theme="light"
|
|
143
|
+
>
|
|
144
|
+
Item 2
|
|
145
|
+
</Button>
|
|
146
|
+
</div>,
|
|
147
|
+
<div
|
|
148
|
+
className="lumx-flex-box"
|
|
149
|
+
>
|
|
150
|
+
<Button
|
|
151
|
+
emphasis="high"
|
|
152
|
+
size="m"
|
|
153
|
+
theme="light"
|
|
154
|
+
>
|
|
155
|
+
Item 3
|
|
156
|
+
</Button>
|
|
157
|
+
</div>,
|
|
158
|
+
<div
|
|
159
|
+
className="lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-right"
|
|
160
|
+
>
|
|
161
|
+
<Button
|
|
162
|
+
emphasis="high"
|
|
163
|
+
size="m"
|
|
164
|
+
theme="light"
|
|
165
|
+
>
|
|
166
|
+
Item 4
|
|
167
|
+
</Button>
|
|
168
|
+
</div>,
|
|
169
|
+
]
|
|
170
|
+
`;
|
|
171
|
+
|
|
92
172
|
exports[`<FlexBox> Snapshots and structure should render story 'HorizontalFlex' 1`] = `
|
|
93
173
|
Array [
|
|
94
174
|
<div
|
package/src/components/index.ts
CHANGED
|
@@ -46,6 +46,8 @@ const setup = (props: SetupProps = {}, shallowRendering = true) => {
|
|
|
46
46
|
(n: ShallowWrapper | ReactWrapper) => n.name() === 'InputHelper' && n.prop('kind') === Kind.info,
|
|
47
47
|
),
|
|
48
48
|
input: wrapper.find('#select-uid:not(SelectMultipleField)').first(),
|
|
49
|
+
chip: wrapper.find('Chip'),
|
|
50
|
+
inputWrapper: wrapper.find('.lumx-select__wrapper'),
|
|
49
51
|
props,
|
|
50
52
|
wrapper,
|
|
51
53
|
};
|
|
@@ -188,6 +190,29 @@ describe(`<SelectMultiple>`, () => {
|
|
|
188
190
|
expect(error).toExist();
|
|
189
191
|
expect(helper).toExist();
|
|
190
192
|
});
|
|
193
|
+
|
|
194
|
+
it('should have a data-id as prop', () => {
|
|
195
|
+
const { inputWrapper } = setup(
|
|
196
|
+
{
|
|
197
|
+
'data-id': 'select',
|
|
198
|
+
},
|
|
199
|
+
false,
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
expect(inputWrapper.prop('data-id')).toEqual('select');
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('should have a data-id as prop with Chip variant', () => {
|
|
206
|
+
const { chip } = setup(
|
|
207
|
+
{
|
|
208
|
+
'data-id': 'select',
|
|
209
|
+
variant: SelectVariant.chip,
|
|
210
|
+
},
|
|
211
|
+
false,
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
expect(chip.prop('data-id')).toEqual('select');
|
|
215
|
+
});
|
|
191
216
|
});
|
|
192
217
|
|
|
193
218
|
// 3. Test events.
|