@lumx/react 3.10.1-alpha.2 → 3.10.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/{8d67e1e3.d.ts → index.d.ts} +1 -1
- package/_internal/index.js +99 -0
- package/_internal/index.js.map +1 -0
- package/index.d.ts +3000 -66
- package/index.js +14554 -64
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/button/Button.tsx +4 -5
- package/src/components/button/ButtonRoot.tsx +1 -3
- package/src/components/chip/Chip.tsx +6 -10
- package/src/components/dialog/Dialog.tsx +1 -1
- package/src/components/expansion-panel/ExpansionPanel.tsx +14 -18
- package/src/components/flex-box/FlexBox.tsx +1 -1
- package/src/components/generic-block/GenericBlock.tsx +6 -7
- package/src/components/generic-block/constants.ts +9 -4
- package/src/components/grid-column/GridColumn.tsx +1 -2
- package/src/components/link/Link.tsx +3 -5
- package/src/components/list/ListItem.tsx +1 -2
- package/src/components/list/useInteractiveList.tsx +1 -2
- package/src/components/mosaic/Mosaic.test.tsx +3 -3
- package/src/components/mosaic/Mosaic.tsx +2 -3
- package/src/components/navigation/Navigation.tsx +42 -37
- package/src/components/navigation/NavigationSection.tsx +76 -79
- package/src/components/notification/Notification.tsx +1 -5
- package/src/components/post-block/PostBlock.tsx +4 -8
- package/src/components/progress-tracker/ProgressTracker.stories.tsx +11 -11
- package/src/components/select/Select.stories.tsx +14 -5
- package/src/components/select/Select.tsx +1 -2
- package/src/components/select/SelectMultiple.stories.tsx +12 -10
- package/src/components/side-navigation/SideNavigationItem.tsx +1 -1
- package/src/components/slideshow/Slides.tsx +1 -1
- package/src/components/slideshow/SlideshowControls.tsx +1 -1
- package/src/components/switch/Switch.tsx +1 -2
- package/src/components/tabs/Tabs.stories.tsx +3 -4
- package/src/components/text-field/TextField.test.tsx +2 -2
- package/src/components/text-field/TextField.tsx +2 -3
- package/src/components/user-block/UserBlock.tsx +7 -9
- package/src/hooks/useClickAway.tsx +1 -2
- package/src/hooks/useInterval.tsx +1 -4
- package/src/hooks/useKeyboardListNavigation.tsx +2 -4
- package/src/hooks/useStopPropagation.ts +1 -2
- package/src/stories/decorators/withCombinations.tsx +1 -1
- package/src/testing/utils/commonTestsSuiteRTL.tsx +2 -2
- package/src/utils/collection/castArray.test.ts +15 -0
- package/src/utils/collection/castArray.ts +3 -0
- package/src/utils/collection/chunk.test.ts +15 -0
- package/src/utils/collection/chunk.ts +6 -0
- package/src/utils/collection/isEmpty.test.js +20 -0
- package/src/utils/collection/isEmpty.ts +4 -0
- package/src/utils/collection/last.ts +2 -0
- package/src/utils/collection/partitionMulti.test.ts +35 -0
- package/src/utils/{partitionMulti.ts → collection/partitionMulti.ts} +13 -12
- package/src/utils/collection/pull.test.ts +17 -0
- package/src/utils/collection/pull.ts +7 -0
- package/src/utils/collection/range.test.js +9 -0
- package/src/utils/collection/range.ts +2 -0
- package/src/utils/date/getMonthCalendar.ts +3 -4
- package/src/utils/flattenChildren.ts +2 -3
- package/src/utils/makeListenerTowerContext.ts +2 -2
- package/src/utils/react/forwardRef.ts +3 -2
- package/src/utils/react/forwardRefPolymorphic.ts +1 -2
- package/src/utils/utils.test.ts +0 -27
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -96
- package/utils/index.js.map +1 -1
- package/_internal/17c3ea1d.js +0 -137
- package/_internal/17c3ea1d.js.map +0 -1
- package/_internal/1da25128.js +0 -411
- package/_internal/1da25128.js.map +0 -1
- package/_internal/230173a8.js +0 -13
- package/_internal/230173a8.js.map +0 -1
- package/_internal/23bdba2d.js +0 -71
- package/_internal/23bdba2d.js.map +0 -1
- package/_internal/26926e5c.d.ts +0 -36
- package/_internal/2a3d237c.js +0 -12
- package/_internal/2a3d237c.js.map +0 -1
- package/_internal/2c5dbb03.js +0 -26
- package/_internal/2c5dbb03.js.map +0 -1
- package/_internal/2e2abe51.js +0 -2154
- package/_internal/2e2abe51.js.map +0 -1
- package/_internal/31490c59.d.ts +0 -167
- package/_internal/3181f000.js +0 -14
- package/_internal/3181f000.js.map +0 -1
- package/_internal/35f100be.d.ts +0 -104
- package/_internal/36bd7352.js +0 -219
- package/_internal/36bd7352.js.map +0 -1
- package/_internal/3a1facc0.js +0 -18
- package/_internal/3a1facc0.js.map +0 -1
- package/_internal/4c20d932.js +0 -89
- package/_internal/4c20d932.js.map +0 -1
- package/_internal/4c28d012.js +0 -305
- package/_internal/4c28d012.js.map +0 -1
- package/_internal/4cd0bf32.js +0 -160
- package/_internal/4cd0bf32.js.map +0 -1
- package/_internal/4daccdd5.js +0 -25
- package/_internal/4daccdd5.js.map +0 -1
- package/_internal/524b1d04.js +0 -64
- package/_internal/524b1d04.js.map +0 -1
- package/_internal/53c94227.js +0 -123
- package/_internal/53c94227.js.map +0 -1
- package/_internal/54d9ded5.js +0 -418
- package/_internal/54d9ded5.js.map +0 -1
- package/_internal/56aec41b.js +0 -652
- package/_internal/56aec41b.js.map +0 -1
- package/_internal/5720caf5.js +0 -124
- package/_internal/5720caf5.js.map +0 -1
- package/_internal/646f0db6.js +0 -113
- package/_internal/646f0db6.js.map +0 -1
- package/_internal/6cc8dca8.d.ts +0 -22
- package/_internal/7f022f8c.d.ts +0 -34
- package/_internal/b8f2948d.js +0 -691
- package/_internal/b8f2948d.js.map +0 -1
- package/_internal/bc28d510.js +0 -784
- package/_internal/bc28d510.js.map +0 -1
- package/_internal/c68d24e4.js +0 -145
- package/_internal/c68d24e4.js.map +0 -1
- package/_internal/c6c99f76.js +0 -105
- package/_internal/c6c99f76.js.map +0 -1
- package/_internal/cae46566.js +0 -65
- package/_internal/cae46566.js.map +0 -1
- package/_internal/components/alert-dialog/index.ts-623b1ed3.d.ts +0 -37
- package/_internal/components/alert-dialog/index.ts-f83bd6ef.js +0 -148
- package/_internal/components/alert-dialog/index.ts-f83bd6ef.js.map +0 -1
- package/_internal/components/autocomplete/index.ts-3f8f125c.js +0 -264
- package/_internal/components/autocomplete/index.ts-3f8f125c.js.map +0 -1
- package/_internal/components/autocomplete/index.ts-8d6b123f.d.ts +0 -201
- package/_internal/components/avatar/index.ts-93ee0ea9.js +0 -89
- package/_internal/components/avatar/index.ts-93ee0ea9.js.map +0 -1
- package/_internal/components/avatar/index.ts-f92852b4.d.ts +0 -43
- package/_internal/components/badge/index.ts-2d7700ef.d.ts +0 -30
- package/_internal/components/badge/index.ts-6753d67f.js +0 -88
- package/_internal/components/badge/index.ts-6753d67f.js.map +0 -1
- package/_internal/components/button/index.ts-031307ce.js +0 -51
- package/_internal/components/button/index.ts-031307ce.js.map +0 -1
- package/_internal/components/button/index.ts-b29e26a4.d.ts +0 -22
- package/_internal/components/checkbox/index.ts-a33166d7.js +0 -127
- package/_internal/components/checkbox/index.ts-a33166d7.js.map +0 -1
- package/_internal/components/checkbox/index.ts-f82358ff.d.ts +0 -38
- package/_internal/components/chip/index.ts-4a91f1a7.d.ts +0 -68
- package/_internal/components/chip/index.ts-a2b5b771.js +0 -110
- package/_internal/components/chip/index.ts-a2b5b771.js.map +0 -1
- package/_internal/components/comment-block/index.ts-58fa051a.js +0 -121
- package/_internal/components/comment-block/index.ts-58fa051a.js.map +0 -1
- package/_internal/components/comment-block/index.ts-8cfa5af0.d.ts +0 -67
- package/_internal/components/date-picker/index.ts-145262d5.js +0 -2
- package/_internal/components/date-picker/index.ts-145262d5.js.map +0 -1
- package/_internal/components/date-picker/index.ts-70a34fa7.d.ts +0 -95
- package/_internal/components/dialog/index.ts-ea044db2.js +0 -224
- package/_internal/components/dialog/index.ts-ea044db2.js.map +0 -1
- package/_internal/components/dialog/index.ts-eca28654.d.ts +0 -55
- package/_internal/components/divider/index.ts-4a56db75.js +0 -55
- package/_internal/components/divider/index.ts-4a56db75.js.map +0 -1
- package/_internal/components/divider/index.ts-b011d8ca.d.ts +0 -18
- package/_internal/components/drag-handle/index.ts-0aebf92f.js +0 -54
- package/_internal/components/drag-handle/index.ts-0aebf92f.js.map +0 -1
- package/_internal/components/drag-handle/index.ts-3ab31dd1.d.ts +0 -18
- package/_internal/components/dropdown/index.ts-2a17db51.js +0 -154
- package/_internal/components/dropdown/index.ts-2a17db51.js.map +0 -1
- package/_internal/components/dropdown/index.ts-b648a15c.d.ts +0 -87
- package/_internal/components/expansion-panel/index.ts-69f09f5b.d.ts +0 -38
- package/_internal/components/expansion-panel/index.ts-fae3762e.js +0 -143
- package/_internal/components/expansion-panel/index.ts-fae3762e.js.map +0 -1
- package/_internal/components/flag/index.ts-8dcd685b.js +0 -56
- package/_internal/components/flag/index.ts-8dcd685b.js.map +0 -1
- package/_internal/components/flag/index.ts-fda89adb.d.ts +0 -23
- package/_internal/components/flex-box/index.ts-87f2b58d.d.ts +0 -43
- package/_internal/components/flex-box/index.ts-c216e957.js +0 -60
- package/_internal/components/flex-box/index.ts-c216e957.js.map +0 -1
- package/_internal/components/generic-block/index.ts-999a62a4.js +0 -115
- package/_internal/components/generic-block/index.ts-999a62a4.js.map +0 -1
- package/_internal/components/generic-block/index.ts-cd3b0e21.d.ts +0 -106
- package/_internal/components/grid/index.ts-67e0694f.d.ts +0 -50
- package/_internal/components/grid/index.ts-fdf1b306.js +0 -113
- package/_internal/components/grid/index.ts-fdf1b306.js.map +0 -1
- package/_internal/components/grid-column/index.ts-97c61cbe.js +0 -64
- package/_internal/components/grid-column/index.ts-97c61cbe.js.map +0 -1
- package/_internal/components/grid-column/index.ts-c89e1c18.d.ts +0 -31
- package/_internal/components/heading/index.ts-0179e9a9.js +0 -112
- package/_internal/components/heading/index.ts-0179e9a9.js.map +0 -1
- package/_internal/components/heading/index.ts-587579e8.d.ts +0 -37
- package/_internal/components/icon/index.ts-740ca1de.js +0 -2
- package/_internal/components/icon/index.ts-740ca1de.js.map +0 -1
- package/_internal/components/icon/index.ts-b3fa5e15.d.ts +0 -34
- package/_internal/components/image-block/index.ts-36b3828f.d.ts +0 -49
- package/_internal/components/image-block/index.ts-ef5e2e7d.js +0 -111
- package/_internal/components/image-block/index.ts-ef5e2e7d.js.map +0 -1
- package/_internal/components/image-lightbox/index.ts-137f85a8.js +0 -765
- package/_internal/components/image-lightbox/index.ts-137f85a8.js.map +0 -1
- package/_internal/components/image-lightbox/index.ts-2cb92d18.d.ts +0 -75
- package/_internal/components/inline-list/index.ts-033dd358.js +0 -76
- package/_internal/components/inline-list/index.ts-033dd358.js.map +0 -1
- package/_internal/components/inline-list/index.ts-e1c8a3ff.d.ts +0 -34
- package/_internal/components/input-helper/index.ts-32a9ca90.d.ts +0 -22
- package/_internal/components/input-helper/index.ts-ab3a1ef5.js +0 -75
- package/_internal/components/input-helper/index.ts-ab3a1ef5.js.map +0 -1
- package/_internal/components/input-label/index.ts-86f2ea41.d.ts +0 -24
- package/_internal/components/input-label/index.ts-d6ca5569.js +0 -60
- package/_internal/components/input-label/index.ts-d6ca5569.js.map +0 -1
- package/_internal/components/lightbox/index.ts-5370e8e6.d.ts +0 -36
- package/_internal/components/lightbox/index.ts-7a16cdc7.js +0 -149
- package/_internal/components/lightbox/index.ts-7a16cdc7.js.map +0 -1
- package/_internal/components/link/index.ts-26435006.d.ts +0 -37
- package/_internal/components/link/index.ts-d04f4e53.js +0 -120
- package/_internal/components/link/index.ts-d04f4e53.js.map +0 -1
- package/_internal/components/link-preview/index.ts-e560a274.d.ts +0 -36
- package/_internal/components/link-preview/index.ts-fee89f66.js +0 -109
- package/_internal/components/link-preview/index.ts-fee89f66.js.map +0 -1
- package/_internal/components/list/index.ts-ab57902e.d.ts +0 -118
- package/_internal/components/list/index.ts-f3101625.js +0 -86
- package/_internal/components/list/index.ts-f3101625.js.map +0 -1
- package/_internal/components/message/index.ts-041cf0cb.js +0 -97
- package/_internal/components/message/index.ts-041cf0cb.js.map +0 -1
- package/_internal/components/message/index.ts-2d38e0ea.d.ts +0 -37
- package/_internal/components/mosaic/index.ts-232d5aed.d.ts +0 -23
- package/_internal/components/mosaic/index.ts-d2128cd3.js +0 -94
- package/_internal/components/mosaic/index.ts-d2128cd3.js.map +0 -1
- package/_internal/components/navigation/index.ts-6d8bea53.d.ts +0 -58
- package/_internal/components/navigation/index.ts-e8dc0a7f.js +0 -222
- package/_internal/components/navigation/index.ts-e8dc0a7f.js.map +0 -1
- package/_internal/components/notification/index.ts-235fd340.js +0 -140
- package/_internal/components/notification/index.ts-235fd340.js.map +0 -1
- package/_internal/components/notification/index.ts-bb3f03f6.d.ts +0 -34
- package/_internal/components/popover/index.ts-2f17a9b6.js +0 -3
- package/_internal/components/popover/index.ts-2f17a9b6.js.map +0 -1
- package/_internal/components/popover/index.ts-e3b4ff19.d.ts +0 -66
- package/_internal/components/post-block/index.ts-0acb9bb4.js +0 -101
- package/_internal/components/post-block/index.ts-0acb9bb4.js.map +0 -1
- package/_internal/components/post-block/index.ts-9b8ff90b.d.ts +0 -41
- package/_internal/components/progress/index.ts-2a713859.js +0 -189
- package/_internal/components/progress/index.ts-2a713859.js.map +0 -1
- package/_internal/components/progress/index.ts-dfdfa5fb.d.ts +0 -60
- package/_internal/components/progress-tracker/index.ts-2649f756.js +0 -312
- package/_internal/components/progress-tracker/index.ts-2649f756.js.map +0 -1
- package/_internal/components/progress-tracker/index.ts-95320f32.d.ts +0 -101
- package/_internal/components/radio-button/index.ts-5eaab4cf.d.ts +0 -54
- package/_internal/components/radio-button/index.ts-b4dfb2a0.js +0 -150
- package/_internal/components/radio-button/index.ts-b4dfb2a0.js.map +0 -1
- package/_internal/components/select/index.ts-a65e3507.d.ts +0 -91
- package/_internal/components/select/index.ts-e8fad28b.js +0 -257
- package/_internal/components/select/index.ts-e8fad28b.js.map +0 -1
- package/_internal/components/side-navigation/index.ts-3f5f3785.d.ts +0 -60
- package/_internal/components/side-navigation/index.ts-c9a5fc3e.js +0 -184
- package/_internal/components/side-navigation/index.ts-c9a5fc3e.js.map +0 -1
- package/_internal/components/skeleton/index.ts-a7daefac.d.ts +0 -75
- package/_internal/components/skeleton/index.ts-ffc995af.js +0 -179
- package/_internal/components/skeleton/index.ts-ffc995af.js.map +0 -1
- package/_internal/components/slider/index.ts-24a0d598.d.ts +0 -52
- package/_internal/components/slider/index.ts-72aadf4c.js +0 -308
- package/_internal/components/slider/index.ts-72aadf4c.js.map +0 -1
- package/_internal/components/slideshow/index.ts-c99f2892.js +0 -151
- package/_internal/components/slideshow/index.ts-c99f2892.js.map +0 -1
- package/_internal/components/slideshow/index.ts-e49462c6.d.ts +0 -25
- package/_internal/components/switch/index.ts-207ba52b.d.ts +0 -34
- package/_internal/components/switch/index.ts-542e6eaf.js +0 -115
- package/_internal/components/switch/index.ts-542e6eaf.js.map +0 -1
- package/_internal/components/table/index.ts-905ce390.js +0 -310
- package/_internal/components/table/index.ts-905ce390.js.map +0 -1
- package/_internal/components/table/index.ts-c4f39b2d.d.ts +0 -108
- package/_internal/components/tabs/index.ts-713119f4.js +0 -289
- package/_internal/components/tabs/index.ts-713119f4.js.map +0 -1
- package/_internal/components/tabs/index.ts-dbfc48d9.d.ts +0 -106
- package/_internal/components/text/index.ts-6afbe8cd.js +0 -2
- package/_internal/components/text/index.ts-6afbe8cd.js.map +0 -1
- package/_internal/components/text/index.ts-8a812048.d.ts +0 -53
- package/_internal/components/text-field/index.ts-92e6b3b3.d.ts +0 -77
- package/_internal/components/text-field/index.ts-c3be8563.js +0 -341
- package/_internal/components/text-field/index.ts-c3be8563.js.map +0 -1
- package/_internal/components/thumbnail/index.ts-16d7b403.js +0 -40
- package/_internal/components/thumbnail/index.ts-16d7b403.js.map +0 -1
- package/_internal/components/thumbnail/index.ts-1b6c0b48.d.ts +0 -8
- package/_internal/components/toolbar/index.ts-813b902e.js +0 -63
- package/_internal/components/toolbar/index.ts-813b902e.js.map +0 -1
- package/_internal/components/toolbar/index.ts-9f5129d1.d.ts +0 -24
- package/_internal/components/tooltip/index.ts-905c847c.js +0 -322
- package/_internal/components/tooltip/index.ts-905c847c.js.map +0 -1
- package/_internal/components/tooltip/index.ts-c6931e9e.d.ts +0 -35
- package/_internal/components/uploader/index.ts-31f21c2a.js +0 -132
- package/_internal/components/uploader/index.ts-31f21c2a.js.map +0 -1
- package/_internal/components/uploader/index.ts-c3ccba98.d.ts +0 -51
- package/_internal/components/user-block/index.ts-18c58e19.d.ts +0 -50
- package/_internal/components/user-block/index.ts-d43e5f3c.js +0 -136
- package/_internal/components/user-block/index.ts-d43e5f3c.js.map +0 -1
- package/_internal/dc3e28c8.d.ts +0 -38
- package/_internal/f39a1ba4.js +0 -73
- package/_internal/f39a1ba4.js.map +0 -1
- package/_internal/f3e77e3e.js +0 -22
- package/_internal/f3e77e3e.js.map +0 -1
- package/_internal/f502ab30.js +0 -78
- package/_internal/f502ab30.js.map +0 -1
- package/_internal/f52adbae.js +0 -36
- package/_internal/f52adbae.js.map +0 -1
- package/_internal/f57e1239.js +0 -205
- package/_internal/f57e1239.js.map +0 -1
- package/_internal/f5ff1aa4.d.ts +0 -47
- package/_internal/fb975afe.js +0 -52
- package/_internal/fb975afe.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef, useState, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
import { mdiChevronDown, mdiChevronUp } from '@lumx/icons';
|
|
4
4
|
import { Icon, Size, Text, Orientation, Popover, Placement, Theme } from '@lumx/react';
|
|
@@ -7,17 +7,18 @@ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/classNam
|
|
|
7
7
|
import { HasClassName } from '@lumx/react/utils/type';
|
|
8
8
|
import { ThemeProvider, useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { useId } from '@lumx/react/hooks/useId';
|
|
10
|
+
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
11
|
|
|
11
12
|
import { CLASSNAME as ITEM_CLASSNAME } from './NavigationItem';
|
|
12
13
|
import { NavigationContext } from './context';
|
|
13
14
|
|
|
14
15
|
export interface NavigationSectionProps extends React.ComponentPropsWithoutRef<'button'>, HasClassName {
|
|
15
16
|
/** Items inside the section */
|
|
16
|
-
children: ReactNode;
|
|
17
|
+
children: React.ReactNode;
|
|
17
18
|
/** Icon (SVG path). */
|
|
18
19
|
icon?: string;
|
|
19
20
|
/** Label content. */
|
|
20
|
-
label: string | ReactNode;
|
|
21
|
+
label: string | React.ReactNode;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -30,81 +31,77 @@ const COMPONENT_NAME = 'NavigationSection';
|
|
|
30
31
|
*/
|
|
31
32
|
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
32
33
|
|
|
33
|
-
export const NavigationSection =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
export const NavigationSection = forwardRef<NavigationSectionProps, HTMLLIElement>((props, ref) => {
|
|
35
|
+
const { children, className, label, icon, ...forwardedProps } = props;
|
|
36
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
37
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
38
|
+
const sectionId = useId();
|
|
39
|
+
const { orientation } = useContext(NavigationContext) || {};
|
|
40
|
+
const theme = useTheme();
|
|
41
|
+
const isDropdown = orientation === Orientation.horizontal;
|
|
42
|
+
return (
|
|
43
|
+
<li
|
|
44
|
+
className={classNames(
|
|
45
|
+
className,
|
|
46
|
+
CLASSNAME,
|
|
47
|
+
ITEM_CLASSNAME,
|
|
48
|
+
handleBasicClasses({
|
|
49
|
+
prefix: ITEM_CLASSNAME,
|
|
50
|
+
theme,
|
|
51
|
+
}),
|
|
52
|
+
)}
|
|
53
|
+
ref={ref}
|
|
54
|
+
>
|
|
55
|
+
<button
|
|
56
|
+
{...forwardedProps}
|
|
57
|
+
aria-controls={sectionId}
|
|
58
|
+
aria-expanded={isOpen}
|
|
59
|
+
className={classNames(`${ITEM_CLASSNAME}__link`)}
|
|
60
|
+
ref={buttonRef}
|
|
61
|
+
onClick={(event) => {
|
|
62
|
+
setIsOpen(!isOpen);
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
}}
|
|
65
|
+
type="button"
|
|
54
66
|
>
|
|
55
|
-
<
|
|
56
|
-
{...forwardedProps}
|
|
57
|
-
aria-controls={sectionId}
|
|
58
|
-
aria-expanded={isOpen}
|
|
59
|
-
className={classNames(`${ITEM_CLASSNAME}__link`)}
|
|
60
|
-
ref={buttonRef}
|
|
61
|
-
onClick={(event) => {
|
|
62
|
-
setIsOpen(!isOpen);
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
}}
|
|
65
|
-
type="button"
|
|
66
|
-
>
|
|
67
|
-
{icon ? <Icon className={`${ITEM_CLASSNAME}__icon`} icon={icon} size={Size.xs} /> : null}
|
|
67
|
+
{icon ? <Icon className={`${ITEM_CLASSNAME}__icon`} icon={icon} size={Size.xs} /> : null}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
className: CLASSNAME,
|
|
109
|
-
},
|
|
110
|
-
);
|
|
69
|
+
<Text as="span" truncate className={`${ITEM_CLASSNAME}__label`} ref={ref}>
|
|
70
|
+
{label}
|
|
71
|
+
</Text>
|
|
72
|
+
<Icon
|
|
73
|
+
className={classNames(`${ITEM_CLASSNAME}__icon`, `${CLASSNAME}__chevron`)}
|
|
74
|
+
icon={isOpen ? mdiChevronUp : mdiChevronDown}
|
|
75
|
+
/>
|
|
76
|
+
</button>
|
|
77
|
+
{isOpen &&
|
|
78
|
+
(isDropdown ? (
|
|
79
|
+
<Popover
|
|
80
|
+
anchorRef={buttonRef}
|
|
81
|
+
isOpen={isOpen}
|
|
82
|
+
placement={Placement.BOTTOM_START}
|
|
83
|
+
usePortal={false}
|
|
84
|
+
closeOnClickAway
|
|
85
|
+
closeOnEscape
|
|
86
|
+
onClick={() => setIsOpen(false)}
|
|
87
|
+
onClose={() => setIsOpen(false)}
|
|
88
|
+
zIndex={996}
|
|
89
|
+
>
|
|
90
|
+
<ThemeProvider value={Theme.light}>
|
|
91
|
+
<ul className={`${CLASSNAME}__drawer--popover`} id={sectionId}>
|
|
92
|
+
<NavigationContext.Provider value={{ orientation: Orientation.vertical }}>
|
|
93
|
+
{children}
|
|
94
|
+
</NavigationContext.Provider>
|
|
95
|
+
</ul>
|
|
96
|
+
</ThemeProvider>
|
|
97
|
+
</Popover>
|
|
98
|
+
) : (
|
|
99
|
+
<ul className={`${CLASSNAME}__drawer`} id={sectionId}>
|
|
100
|
+
{children}
|
|
101
|
+
</ul>
|
|
102
|
+
))}
|
|
103
|
+
</li>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
NavigationSection.displayName = COMPONENT_NAME;
|
|
107
|
+
NavigationSection.className = CLASSNAME;
|
|
@@ -2,8 +2,6 @@ import React, { useRef } from 'react';
|
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import isFunction from 'lodash/isFunction';
|
|
6
|
-
|
|
7
5
|
import { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';
|
|
8
6
|
import { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constants';
|
|
9
7
|
import { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';
|
|
@@ -88,9 +86,7 @@ export const Notification = forwardRef<NotificationProps, HTMLDivElement>((props
|
|
|
88
86
|
const hasAction: boolean = Boolean(onActionClick) && Boolean(actionLabel);
|
|
89
87
|
|
|
90
88
|
const handleCallback = (evt: React.MouseEvent) => {
|
|
91
|
-
|
|
92
|
-
onActionClick();
|
|
93
|
-
}
|
|
89
|
+
onActionClick?.();
|
|
94
90
|
evt.stopPropagation();
|
|
95
91
|
};
|
|
96
92
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isObject from 'lodash/isObject';
|
|
5
|
-
|
|
6
4
|
import { Orientation, Theme, Thumbnail, ThumbnailProps, ThumbnailVariant } from '@lumx/react';
|
|
7
5
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
6
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
@@ -77,6 +75,9 @@ export const PostBlock = forwardRef<PostBlockProps, HTMLDivElement>((props, ref)
|
|
|
77
75
|
...forwardedProps
|
|
78
76
|
} = props;
|
|
79
77
|
|
|
78
|
+
// Display text as string or HTML
|
|
79
|
+
const textContent = typeof text === 'string' ? { children: text } : { dangerouslySetInnerHTML: text };
|
|
80
|
+
|
|
80
81
|
return (
|
|
81
82
|
<div
|
|
82
83
|
ref={ref}
|
|
@@ -99,12 +100,7 @@ export const PostBlock = forwardRef<PostBlockProps, HTMLDivElement>((props, ref)
|
|
|
99
100
|
|
|
100
101
|
{meta && <span className={`${CLASSNAME}__meta`}>{meta}</span>}
|
|
101
102
|
|
|
102
|
-
{
|
|
103
|
-
// eslint-disable-next-line react/no-danger
|
|
104
|
-
<p dangerouslySetInnerHTML={text} className={`${CLASSNAME}__text`} />
|
|
105
|
-
) : (
|
|
106
|
-
<p className={`${CLASSNAME}__text`}>{text}</p>
|
|
107
|
-
)}
|
|
103
|
+
<p className={`${CLASSNAME}__text`} {...textContent} />
|
|
108
104
|
|
|
109
105
|
{attachments && <div className={`${CLASSNAME}__attachments`}>{attachments}</div>}
|
|
110
106
|
{(tags || actions) && (
|
|
@@ -8,8 +8,6 @@ import {
|
|
|
8
8
|
ProgressTrackerStep,
|
|
9
9
|
ProgressTrackerStepPanel,
|
|
10
10
|
} from '@lumx/react';
|
|
11
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
12
|
-
import set from 'lodash/set';
|
|
13
11
|
import React, { useState } from 'react';
|
|
14
12
|
|
|
15
13
|
export default { title: 'LumX components/progress-tracker/Progress Tracker' };
|
|
@@ -52,24 +50,26 @@ export const Controlled = () => {
|
|
|
52
50
|
]);
|
|
53
51
|
|
|
54
52
|
const toggleError = (index: number) => () => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const newSteps = [...steps];
|
|
54
|
+
const step = steps[index];
|
|
55
|
+
const newStep = { ...step, hasError: !step?.hasError, isComplete: false };
|
|
56
|
+
newSteps[index] = newStep;
|
|
57
|
+
setSteps(newSteps);
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
const previous = (index: number) => () => setActiveStep(index - 1);
|
|
62
61
|
|
|
63
62
|
const next = (index: number) => () => {
|
|
64
63
|
const isLast = index === steps.length - 1;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const step = steps[index];
|
|
65
|
+
const newSteps = [...steps];
|
|
66
|
+
const newStep = { ...step, hasError: false, isComplete: true };
|
|
68
67
|
if (!isLast) {
|
|
69
|
-
|
|
68
|
+
newSteps[index + 1].isDisabled = false;
|
|
70
69
|
setActiveStep(index + 1);
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
newSteps[index] = newStep;
|
|
72
|
+
setSteps(newSteps);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
return (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { mdiBullhornOutline } from '@lumx/icons';
|
|
2
2
|
import { List, ListItem, Select, Size, TextField } from '@lumx/react';
|
|
3
3
|
import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
|
|
4
|
-
import noop from 'lodash/noop';
|
|
5
4
|
import range from 'lodash/range';
|
|
6
5
|
import React, { SyntheticEvent, useState } from 'react';
|
|
7
6
|
import { SelectVariant } from './constants';
|
|
@@ -9,6 +8,10 @@ import { SelectVariant } from './constants';
|
|
|
9
8
|
export default {
|
|
10
9
|
title: 'LumX components/select/Select',
|
|
11
10
|
component: Select,
|
|
11
|
+
argTypes: {
|
|
12
|
+
onInputClick: { action: true },
|
|
13
|
+
onDropdownClose: { action: true },
|
|
14
|
+
},
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
const CHOICES = ['First item', 'Second item', 'Third item'];
|
|
@@ -109,7 +112,7 @@ export const SimpleSelectWithInfiniteScroll = ({ theme }: any) => {
|
|
|
109
112
|
);
|
|
110
113
|
};
|
|
111
114
|
|
|
112
|
-
export const DisabledSelect = ({ theme }: any) => {
|
|
115
|
+
export const DisabledSelect = ({ theme, onInputClick, onDropdownClose }: any) => {
|
|
113
116
|
return (
|
|
114
117
|
<Select
|
|
115
118
|
isOpen={false}
|
|
@@ -117,8 +120,8 @@ export const DisabledSelect = ({ theme }: any) => {
|
|
|
117
120
|
label="My select"
|
|
118
121
|
placeholder="Placeholder"
|
|
119
122
|
theme={theme}
|
|
120
|
-
onInputClick={
|
|
121
|
-
onDropdownClose={
|
|
123
|
+
onInputClick={onInputClick}
|
|
124
|
+
onDropdownClose={onDropdownClose}
|
|
122
125
|
isDisabled
|
|
123
126
|
>
|
|
124
127
|
<List theme={theme} isClickable>
|
|
@@ -206,7 +209,13 @@ export const SelectWithAnotherField = ({ theme }: any) => {
|
|
|
206
209
|
|
|
207
210
|
return (
|
|
208
211
|
<>
|
|
209
|
-
<TextField
|
|
212
|
+
<TextField
|
|
213
|
+
value="myvalue"
|
|
214
|
+
label="I am the label"
|
|
215
|
+
placeholder="ex: A value"
|
|
216
|
+
theme={theme}
|
|
217
|
+
onChange={() => {}}
|
|
218
|
+
/>
|
|
210
219
|
<Select
|
|
211
220
|
style={{ width: '100%' }}
|
|
212
221
|
isOpen={isOpen}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import lodashIsEmpty from 'lodash/isEmpty';
|
|
5
4
|
|
|
6
5
|
import { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle, mdiMenuDown } from '@lumx/icons';
|
|
7
6
|
import { Emphasis, Size, Theme } from '@lumx/react/components';
|
|
@@ -170,7 +169,7 @@ const SelectField: React.FC<SelectProps> = (props) => {
|
|
|
170
169
|
* @return React element.
|
|
171
170
|
*/
|
|
172
171
|
export const Select = forwardRef<SelectProps, HTMLDivElement>((props, ref) => {
|
|
173
|
-
const isEmpty =
|
|
172
|
+
const isEmpty = !props.value;
|
|
174
173
|
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty;
|
|
175
174
|
|
|
176
175
|
return WithSelectContext(
|
|
@@ -13,11 +13,13 @@ import {
|
|
|
13
13
|
Toolbar,
|
|
14
14
|
} from '@lumx/react';
|
|
15
15
|
import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
|
|
16
|
-
import noop from 'lodash/noop';
|
|
17
16
|
import React, { MouseEventHandler, SyntheticEvent, useRef, useState } from 'react';
|
|
18
17
|
import { SelectVariant } from './constants';
|
|
19
18
|
|
|
20
|
-
export default {
|
|
19
|
+
export default {
|
|
20
|
+
title: 'LumX components/select/Select Multiple',
|
|
21
|
+
argTypes: { onClear: { action: true }, onInputClick: { action: true }, onDropdownClose: { action: true } },
|
|
22
|
+
};
|
|
21
23
|
|
|
22
24
|
const PLACEHOLDER = 'Select values';
|
|
23
25
|
const LABEL = 'Select label';
|
|
@@ -76,18 +78,18 @@ export const DefaultSelectMultiple = ({ theme }: any) => {
|
|
|
76
78
|
);
|
|
77
79
|
};
|
|
78
80
|
|
|
79
|
-
export const SelectMultipleWithNoData = ({ theme }: any) => {
|
|
81
|
+
export const SelectMultipleWithNoData = ({ theme, onClear, onInputClick, onDropdownClose }: any) => {
|
|
80
82
|
return (
|
|
81
83
|
<SelectMultiple
|
|
82
84
|
isOpen
|
|
83
85
|
value={[]}
|
|
84
|
-
onClear={
|
|
86
|
+
onClear={onClear}
|
|
85
87
|
clearButtonProps={{ label: 'Clear' }}
|
|
86
88
|
label="Select label"
|
|
87
89
|
placeholder="Select values"
|
|
88
90
|
theme={theme}
|
|
89
|
-
onInputClick={
|
|
90
|
-
onDropdownClose={
|
|
91
|
+
onInputClick={onInputClick}
|
|
92
|
+
onDropdownClose={onDropdownClose}
|
|
91
93
|
>
|
|
92
94
|
<List isClickable>
|
|
93
95
|
<ListItem key={0} size={Size.tiny}>
|
|
@@ -98,18 +100,18 @@ export const SelectMultipleWithNoData = ({ theme }: any) => {
|
|
|
98
100
|
);
|
|
99
101
|
};
|
|
100
102
|
|
|
101
|
-
export const DisabledSelectMultiple = ({ theme }: any) => {
|
|
103
|
+
export const DisabledSelectMultiple = ({ theme, onClear, onInputClick, onDropdownClose }: any) => {
|
|
102
104
|
return (
|
|
103
105
|
<SelectMultiple
|
|
104
106
|
isOpen
|
|
105
107
|
value={[]}
|
|
106
|
-
onClear={
|
|
108
|
+
onClear={onClear}
|
|
107
109
|
clearButtonProps={{ label: 'Clear' }}
|
|
108
110
|
label="Select label"
|
|
109
111
|
placeholder="Select values"
|
|
110
112
|
theme={theme}
|
|
111
|
-
onInputClick={
|
|
112
|
-
onDropdownClose={
|
|
113
|
+
onInputClick={onInputClick}
|
|
114
|
+
onDropdownClose={onDropdownClose}
|
|
113
115
|
isDisabled
|
|
114
116
|
/>
|
|
115
117
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Children, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
|
|
6
5
|
import { mdiChevronDown, mdiChevronUp } from '@lumx/icons';
|
|
7
6
|
import { Emphasis, Icon, Size, IconButton, IconButtonProps } from '@lumx/react';
|
|
@@ -11,6 +10,7 @@ import { renderLink } from '@lumx/react/utils/renderLink';
|
|
|
11
10
|
import { renderButtonOrLink } from '@lumx/react/utils/renderButtonOrLink';
|
|
12
11
|
import { useId } from '@lumx/react/hooks/useId';
|
|
13
12
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
13
|
+
import { isEmpty } from '@lumx/react/utils/collection/isEmpty';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Defines the props of the component.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { Children, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
|
-
import chunk from 'lodash/chunk';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
6
5
|
import { FULL_WIDTH_PERCENT } from '@lumx/react/components/slideshow/constants';
|
|
@@ -8,6 +7,7 @@ import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
|
8
7
|
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
10
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
|
+
import { chunk } from '@lumx/react/utils/collection/chunk';
|
|
11
11
|
|
|
12
12
|
import { buildSlideShowGroupId, SlideshowItemGroup } from './SlideshowItemGroup';
|
|
13
13
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { RefObject, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import range from 'lodash/range';
|
|
5
4
|
|
|
6
5
|
import { mdiChevronLeft, mdiChevronRight, mdiPlayCircleOutline, mdiPauseCircleOutline } from '@lumx/icons';
|
|
7
6
|
import { Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';
|
|
@@ -16,6 +15,7 @@ import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
|
16
15
|
import { useSwipeNavigate } from './useSwipeNavigate';
|
|
17
16
|
import { PAGINATION_ITEM_SIZE, PAGINATION_ITEMS_MAX } from './constants';
|
|
18
17
|
import { usePaginationVisibleRange } from './usePaginationVisibleRange';
|
|
18
|
+
import { range } from '@lumx/react/utils/collection/range';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Defines the props of the component.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Children, InputHTMLAttributes, SyntheticEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
|
|
6
5
|
import { Alignment, InputHelper, InputLabel, Theme } from '@lumx/react';
|
|
7
6
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
@@ -127,7 +126,7 @@ export const Switch = forwardRef<SwitchProps, HTMLDivElement>((props, ref) => {
|
|
|
127
126
|
<InputLabel htmlFor={inputId} theme={theme} className={`${CLASSNAME}__label`}>
|
|
128
127
|
{children}
|
|
129
128
|
</InputLabel>
|
|
130
|
-
{
|
|
129
|
+
{helper && (
|
|
131
130
|
<InputHelper id={`${inputId}-helper`} theme={theme} className={`${CLASSNAME}__helper`}>
|
|
132
131
|
{helper}
|
|
133
132
|
</InputHelper>
|
|
@@ -6,7 +6,6 @@ import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
|
6
6
|
import { withNestedProps } from '@lumx/react/stories/decorators/withNestedProps';
|
|
7
7
|
import { toFlattenProps } from '@lumx/react/stories/utils/toFlattenProps';
|
|
8
8
|
import { withCategory } from '@lumx/react/stories/utils/withCategory';
|
|
9
|
-
import get from 'lodash/get';
|
|
10
9
|
import times from 'lodash/times';
|
|
11
10
|
import React, { useState } from 'react';
|
|
12
11
|
|
|
@@ -63,13 +62,13 @@ export const Default = {
|
|
|
63
62
|
export const Controlled = {
|
|
64
63
|
render({ theme }: any) {
|
|
65
64
|
const [activeTab, setActiveTab] = useState(1);
|
|
66
|
-
const changeActiveTabIndex = (evt: any) => setActiveTab(parseInt(
|
|
65
|
+
const changeActiveTabIndex = (evt: any) => setActiveTab(parseInt(evt.target.value || 0, 10));
|
|
67
66
|
|
|
68
67
|
const [isLazy, setIsLazy] = useState(true);
|
|
69
|
-
const changeIsLazy = (evt: any) => setIsLazy(
|
|
68
|
+
const changeIsLazy = (evt: any) => setIsLazy(evt.target.checked);
|
|
70
69
|
|
|
71
70
|
const [shouldActivateOnFocus, setShouldActivateOnFocus] = useState(true);
|
|
72
|
-
const changeShouldActivateOnFocus = (evt: any) => setShouldActivateOnFocus(
|
|
71
|
+
const changeShouldActivateOnFocus = (evt: any) => setShouldActivateOnFocus(evt.target.checked);
|
|
73
72
|
|
|
74
73
|
return (
|
|
75
74
|
<>
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
queryByClassName,
|
|
13
13
|
queryByTagName,
|
|
14
14
|
} from '@lumx/react/testing/utils/queries';
|
|
15
|
-
import partition from 'lodash/partition';
|
|
16
15
|
import userEvent from '@testing-library/user-event';
|
|
17
16
|
|
|
18
17
|
import { isFocusVisible } from '@lumx/react/utils/isFocusVisible';
|
|
18
|
+
import { partitionMulti } from '@lumx/react/utils/collection/partitionMulti';
|
|
19
19
|
import { TextField, TextFieldProps } from './TextField';
|
|
20
20
|
|
|
21
21
|
const CLASSNAME = TextField.className as string;
|
|
@@ -34,7 +34,7 @@ const setup = (propsOverride: Partial<TextFieldProps> = {}, { wrapper }: SetupRe
|
|
|
34
34
|
| HTMLTextAreaElement
|
|
35
35
|
| HTMLInputElement;
|
|
36
36
|
const helpers = queryAllByClassName(container, 'lumx-text-field__helper');
|
|
37
|
-
const [[helper], [error]] =
|
|
37
|
+
const [[helper], [error]] = partitionMulti(helpers, [(h) => !h.className.includes('lumx-input-helper--color-red')]);
|
|
38
38
|
const clearButton = queryByClassName(container, 'lumx-text-field__input-clear');
|
|
39
39
|
|
|
40
40
|
return {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, Ref, RefObject, SyntheticEvent, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import get from 'lodash/get';
|
|
5
4
|
|
|
6
5
|
import { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle } from '@lumx/icons';
|
|
7
6
|
import {
|
|
@@ -217,8 +216,8 @@ const renderInputNative: React.FC<InputNativeProps> = (props) => {
|
|
|
217
216
|
setFocus(false);
|
|
218
217
|
};
|
|
219
218
|
|
|
220
|
-
const handleChange = (event: React.ChangeEvent) => {
|
|
221
|
-
onChange(
|
|
219
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
220
|
+
onChange(event.target.value, name, event);
|
|
222
221
|
};
|
|
223
222
|
|
|
224
223
|
const Component = multiline ? 'textarea' : 'input';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
|
-
import set from 'lodash/set';
|
|
6
3
|
|
|
7
4
|
import { Avatar, ColorPalette, Link, Orientation, Size, Theme } from '@lumx/react';
|
|
8
5
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
@@ -107,7 +104,7 @@ export const UserBlock = forwardRef<UserBlockProps, HTMLDivElement>((props, ref)
|
|
|
107
104
|
const isClickable = !!onClick || isLink;
|
|
108
105
|
|
|
109
106
|
const nameBlock: ReactNode = React.useMemo(() => {
|
|
110
|
-
if (
|
|
107
|
+
if (!name) {
|
|
111
108
|
return null;
|
|
112
109
|
}
|
|
113
110
|
let NameComponent: any = 'span';
|
|
@@ -124,12 +121,8 @@ export const UserBlock = forwardRef<UserBlockProps, HTMLDivElement>((props, ref)
|
|
|
124
121
|
color: ColorPalette.dark,
|
|
125
122
|
});
|
|
126
123
|
}
|
|
127
|
-
// Disable avatar focus since the name block is the same link / same button.
|
|
128
|
-
if (avatarProps) {
|
|
129
|
-
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
130
|
-
}
|
|
131
124
|
return <NameComponent {...nProps}>{name}</NameComponent>;
|
|
132
|
-
}, [
|
|
125
|
+
}, [isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
133
126
|
|
|
134
127
|
const fieldsBlock: ReactNode = fields && componentSize !== Size.s && componentSize !== Size.xs && (
|
|
135
128
|
<div className={`${CLASSNAME}__fields`}>
|
|
@@ -162,6 +155,11 @@ export const UserBlock = forwardRef<UserBlockProps, HTMLDivElement>((props, ref)
|
|
|
162
155
|
size={componentSize}
|
|
163
156
|
onClick={onClick}
|
|
164
157
|
theme={theme}
|
|
158
|
+
thumbnailProps={{
|
|
159
|
+
...avatarProps?.thumbnailProps,
|
|
160
|
+
// Disable avatar focus since the name block is the same link / same button.
|
|
161
|
+
tabIndex: avatarProps ? -1 : undefined,
|
|
162
|
+
}}
|
|
165
163
|
/>
|
|
166
164
|
)}
|
|
167
165
|
{(fields || name) && (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import isFunction from 'lodash/isFunction';
|
|
4
3
|
import { Callback } from '@lumx/react/utils/type';
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -21,9 +20,7 @@ export function useInterval(callback: Callback, delay: number | null): void {
|
|
|
21
20
|
if (delay === null) return undefined;
|
|
22
21
|
|
|
23
22
|
function tick() {
|
|
24
|
-
|
|
25
|
-
savedCallback.current();
|
|
26
|
-
}
|
|
23
|
+
savedCallback.current?.();
|
|
27
24
|
}
|
|
28
25
|
const id = setInterval(tick, delay);
|
|
29
26
|
return () => clearInterval(id);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { RefObject, SetStateAction, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
|
|
5
3
|
type Listener = (evt: KeyboardEvent) => void;
|
|
6
4
|
|
|
7
5
|
interface UseKeyboardListNavigationType {
|
|
@@ -135,7 +133,7 @@ export const useKeyboardListNavigation: useKeyboardListNavigationType = (
|
|
|
135
133
|
onListItemSelected(selectedItem);
|
|
136
134
|
resetActiveIndex();
|
|
137
135
|
} else if (activeItemIndex === initialIndex && onEnterPressed) {
|
|
138
|
-
const value =
|
|
136
|
+
const value = (evt.target as any)?.value;
|
|
139
137
|
onEnterPressed(value);
|
|
140
138
|
resetActiveIndex();
|
|
141
139
|
}
|
|
@@ -146,7 +144,7 @@ export const useKeyboardListNavigation: useKeyboardListNavigationType = (
|
|
|
146
144
|
* @param evt - key pressed event
|
|
147
145
|
*/
|
|
148
146
|
const onTabKeyPressed: Listener = (evt) => {
|
|
149
|
-
const value =
|
|
147
|
+
const value = (evt.target as any)?.value;
|
|
150
148
|
|
|
151
149
|
if (preventTabOnEnteredValue && value && value.length > 0) {
|
|
152
150
|
preventDefaultAndStopPropagation(evt);
|