@lumx/react 3.8.2-alpha.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +55 -41
- package/index.js.map +1 -1
- package/package.json +4 -5
- package/src/components/alert-dialog/AlertDialog.test.tsx +1 -1
- package/src/components/alert-dialog/AlertDialog.tsx +3 -2
- package/src/components/checkbox/Checkbox.tsx +4 -3
- package/src/components/date-picker/DatePickerControlled.tsx +2 -3
- package/src/components/image-lightbox/ImageLightbox.test.tsx +10 -18
- package/src/components/image-lightbox/internal/ImageSlide.tsx +2 -2
- package/src/components/message/Message.tsx +1 -1
- package/src/components/navigation/NavigationSection.tsx +4 -3
- package/src/components/notification/constants.ts +1 -1
- package/src/components/radio-button/RadioButton.tsx +4 -3
- package/src/components/select/Select.test.tsx +1 -1
- package/src/components/select/SelectMultiple.test.tsx +1 -1
- package/src/components/select/WithSelectContext.tsx +4 -3
- package/src/components/side-navigation/SideNavigationItem.test.tsx +1 -1
- package/src/components/side-navigation/SideNavigationItem.tsx +2 -2
- package/src/components/slider/Slider.test.tsx +1 -1
- package/src/components/slider/Slider.tsx +3 -2
- package/src/components/switch/Switch.test.tsx +1 -1
- package/src/components/switch/Switch.tsx +4 -3
- package/src/components/tabs/state.ts +4 -6
- package/src/components/text-field/TextField.tsx +6 -15
- package/src/components/tooltip/Tooltip.test.tsx +1 -1
- package/src/components/tooltip/Tooltip.tsx +4 -4
- package/src/components/uploader/Uploader.tsx +3 -2
- package/src/components/user-block/UserBlock.stories.tsx +1 -1
- package/src/components/user-block/UserBlock.tsx +2 -2
- package/src/hooks/useId.test.tsx +23 -0
- package/src/hooks/useId.ts +15 -0
- package/src/hooks/{useElementSizeDependentOfWindowSize.ts → useSizeOnWindowResize.ts} +1 -3
- package/src/hooks/useSlideshowControls.ts +7 -4
- package/src/stories/generated/UserBlock/Demos.stories.tsx +1 -0
- package/src/utils/date/formatDayNumber.test.ts +12 -0
- package/src/utils/date/formatDayNumber.ts +5 -0
- package/src/utils/unref.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect
|
|
1
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useInterval } from '@lumx/react/hooks/useInterval';
|
|
4
|
-
import uniqueId from 'lodash/uniqueId';
|
|
5
4
|
import { AUTOPLAY_DEFAULT_INTERVAL } from '@lumx/react/components/slideshow/constants';
|
|
5
|
+
import { useId } from '@lumx/react/hooks/useId';
|
|
6
6
|
|
|
7
7
|
export interface UseSlideshowControlsOptions {
|
|
8
8
|
/** default active index to be displayed */
|
|
@@ -193,8 +193,11 @@ export const useSlideshowControls = ({
|
|
|
193
193
|
onChange(currentIndex);
|
|
194
194
|
}, [currentIndex, onChange]);
|
|
195
195
|
|
|
196
|
-
const
|
|
197
|
-
const
|
|
196
|
+
const generatedSlideshowId = useId();
|
|
197
|
+
const slideshowId = id || generatedSlideshowId;
|
|
198
|
+
|
|
199
|
+
const generatedSlidesId = useId();
|
|
200
|
+
const slideshowSlidesId = slidesId || generatedSlidesId;
|
|
198
201
|
|
|
199
202
|
const toggleAutoPlay = () => {
|
|
200
203
|
if (isSlideshowAutoPlaying) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { formatDayNumber } from '@lumx/react/utils/date/formatDayNumber';
|
|
2
|
+
|
|
3
|
+
describe(formatDayNumber, () => {
|
|
4
|
+
it('should format ', () => {
|
|
5
|
+
// Standard numerical formatting.
|
|
6
|
+
expect(formatDayNumber('en', new Date('2024-05-11'))).toEqual('11');
|
|
7
|
+
// Keep only the numerical part (if any). Raw formatted day number here is '11日'.
|
|
8
|
+
expect(formatDayNumber('ja', new Date('2024-05-11'))).toEqual('11');
|
|
9
|
+
// Else Keep the non-numerical formatting
|
|
10
|
+
expect(formatDayNumber('ar-eg', new Date('2024-05-11'))).toEqual('١١');
|
|
11
|
+
});
|
|
12
|
+
});
|
package/src/utils/unref.ts
DELETED
|
File without changes
|