@loadsmart/loadsmart-ui 5.10.1 → 5.11.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/dist/components/Calendar/Calendar.stories.d.ts +2 -7
- package/dist/components/Calendar/Date.helper.d.ts +47 -12
- package/dist/components/Dropdown/Dropdown.stories.d.ts +4 -1
- package/dist/components/Loaders/LoadingBar.stories.d.ts +1 -1
- package/dist/index.js +64 -64
- package/dist/index.js.map +1 -1
- package/dist/tests/generator.d.ts +35 -0
- package/dist/tests/renderer.d.ts +10 -0
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +1 -1
- package/src/components/Accordion/Accordion.test.tsx +2 -2
- package/src/components/Banner/Banner.test.tsx +2 -2
- package/src/components/Breadcrumbs/Breadbrumbs.test.tsx +2 -2
- package/src/components/Button/Button.test.tsx +2 -2
- package/src/components/Calendar/Calendar.stories.tsx +4 -2
- package/src/components/Calendar/Calendar.test.tsx +3 -3
- package/src/components/Calendar/Date.helper.test.ts +463 -15
- package/src/components/Calendar/Date.helper.ts +106 -45
- package/src/components/Calendar/Pickers/DayPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/MonthPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/YearPicker.test.tsx +9 -7
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/Card.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/DatePicker/DatePicker.test.tsx +2 -2
- package/src/components/DatePicker/DateRangePicker.stories.tsx +6 -1
- package/src/components/DatePicker/DateRangePicker.test.tsx +2 -2
- package/src/components/Dialog/Dialog.test.tsx +2 -2
- package/src/components/DragDropFile/components/DropZone.test.tsx +1 -1
- package/src/components/Drawer/Drawer.test.tsx +1 -1
- package/src/components/Dropdown/Dropdown.stories.tsx +10 -5
- package/src/components/Dropdown/Dropdown.test.tsx +14 -16
- package/src/components/EmptyState/EmptyState.test.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.test.tsx +1 -1
- package/src/components/IconFactory/IconFactory.test.tsx +2 -2
- package/src/components/Label/Label.test.tsx +2 -2
- package/src/components/Link/Link.test.tsx +2 -2
- package/src/components/Loaders/LoadingBar.stories.tsx +2 -2
- package/src/components/Loaders/LoadingBar.test.tsx +1 -1
- package/src/components/Loaders/LoadingDots.test.tsx +1 -1
- package/src/components/Loaders/Spinner.test.tsx +2 -2
- package/src/components/Modal/Modal.test.tsx +2 -2
- package/src/components/Pagination/Pagination.test.tsx +1 -1
- package/src/components/Popover/Popover.test.tsx +2 -2
- package/src/components/ProgressBar/ProgressBar.test.tsx +1 -1
- package/src/components/Radio/Radio.test.tsx +2 -2
- package/src/components/Section/Section.test.tsx +2 -2
- package/src/components/Section/Sections.stories.tsx +1 -1
- package/src/components/Select/Select.fixtures.ts +1 -1
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.test.tsx +12 -5
- package/src/components/Select/useSelect.helpers.test.ts +1 -1
- package/src/components/SideNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/SideNavigation/Menu/Menu.test.tsx +2 -2
- package/src/components/SideNavigation/Separator/Separator.test.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.test.tsx +2 -2
- package/src/components/Steps/Steps.fixtures.ts +1 -1
- package/src/components/Steps/Steps.test.tsx +2 -2
- package/src/components/Steps/useStep.test.tsx +1 -1
- package/src/components/Switch/Switch.test.tsx +1 -1
- package/src/components/Table/Table.fixtures.ts +1 -1
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/TablePagination/TablePagination.test.tsx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.test.tsx +2 -2
- package/src/components/Text/Text.test.tsx +2 -2
- package/src/components/TextField/TextField.test.tsx +1 -1
- package/src/components/Textarea/Textarea.test.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +2 -2
- package/src/components/ToggleGroup/Toggle.test.tsx +2 -2
- package/src/components/ToggleGroup/ToggleGroup.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.test.tsx +2 -2
- package/src/components/TopNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/TopNavigation/Menu/Menu.test.tsx +1 -1
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +1 -1
- package/src/hooks/useClickOutside/useClickOutside.test.tsx +1 -1
- package/src/hooks/useDidMount/useDidMount.test.tsx +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.test.tsx +1 -1
- package/src/hooks/useFocusWithin/useFocusWithin.test.tsx +1 -1
- package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.test.tsx +1 -1
- package/src/hooks/useSelectable/SelectableStrategy.test.ts +1 -1
- package/src/hooks/useSelectable/useSelectable.test.ts +1 -1
- package/src/testing/SelectEvent/SelectEvent.test.tsx +2 -2
- package/src/tests/generator.ts +127 -0
- package/src/tests/renderer.tsx +39 -0
- package/src/tools/conditional.test.ts +1 -1
- package/src/utils/toolset/interleave.test.ts +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="chance" />
|
|
2
|
+
interface DataGenerator {
|
|
3
|
+
animal: () => string;
|
|
4
|
+
array: <T>(template: ({ index }: {
|
|
5
|
+
index: number;
|
|
6
|
+
}) => T, amount?: number) => Array<T>;
|
|
7
|
+
boolean: () => boolean;
|
|
8
|
+
company: () => string;
|
|
9
|
+
date: () => string;
|
|
10
|
+
float: (opts?: Chance.Options) => number;
|
|
11
|
+
id: () => string;
|
|
12
|
+
name: (opts?: Chance.Options) => string;
|
|
13
|
+
natural: (opts?: Chance.Options) => number;
|
|
14
|
+
paragraph: (opts?: Chance.Options) => string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use pickone or pickset
|
|
17
|
+
*/
|
|
18
|
+
pick: <T>(array: Array<T>, options?: {
|
|
19
|
+
amount: number;
|
|
20
|
+
allowRepeat?: boolean;
|
|
21
|
+
}) => T | Array<T>;
|
|
22
|
+
pickone<T>(arr: T[]): T;
|
|
23
|
+
pickset<T>(arr: T[], count?: number): T[];
|
|
24
|
+
profession: () => string;
|
|
25
|
+
sentence: (opts?: Chance.Options) => string;
|
|
26
|
+
state: (opts?: Chance.Options) => string;
|
|
27
|
+
time: (opts?: Chance.Options) => string;
|
|
28
|
+
token: () => string;
|
|
29
|
+
url: () => string;
|
|
30
|
+
username: () => string;
|
|
31
|
+
word: (opts?: Chance.Options) => string;
|
|
32
|
+
dollar: () => string;
|
|
33
|
+
}
|
|
34
|
+
declare const generators: DataGenerator;
|
|
35
|
+
export default generators;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { fireEvent, RenderOptions, within, waitFor, waitForElementToBeRemoved, act, screen, queries } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
declare class Renderer {
|
|
5
|
+
result: React.ReactElement;
|
|
6
|
+
constructor(children: React.ReactElement);
|
|
7
|
+
render(options?: Omit<RenderOptions, 'queries'>): import("@testing-library/react").RenderResult<typeof queries, HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export default function customRenderer(children: React.ReactElement): Renderer;
|
|
10
|
+
export { act, fireEvent as fire, queries, screen, userEvent as user, waitFor, waitForElementToBeRemoved, within, };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import userEvent from '@testing-library/user-event'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer, { fire, screen } from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer, { fire, screen } from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Accordion from './Accordion'
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import userEvent from '@testing-library/user-event'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer, { screen } from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Banner from './Banner'
|
|
8
8
|
import { BannerAction } from './Banner'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import Breadcrumbs from './Breadcrumbs'
|
|
3
3
|
import { fireEvent, screen } from '@testing-library/react'
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
const setup = ({ ...overrides }) => renderer(<Breadcrumbs entries={[]} {...overrides} />).render()
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { screen } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Button from './Button'
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type { Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Story, Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
|
|
4
4
|
import { TODAY } from './Date.helper'
|
|
5
5
|
import Calendar from './Calendar'
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
},
|
|
42
42
|
} as Meta
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const Template: Story<CalendarProps> = (args): JSX.Element => {
|
|
45
45
|
return (
|
|
46
46
|
<div className="flex flex-col">
|
|
47
47
|
<Calendar {...args} />
|
|
@@ -49,6 +49,8 @@ export function Playground(args: CalendarProps): JSX.Element {
|
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
export const Playground = Template.bind({})
|
|
53
|
+
|
|
52
54
|
Playground.args = {
|
|
53
55
|
mode: 'single',
|
|
54
56
|
}
|
|
@@ -7,9 +7,9 @@ import { TODAY } from './Date.helper'
|
|
|
7
7
|
import * as stories from './Calendar.stories'
|
|
8
8
|
import DateFormatHelper from './DateFormat.helper'
|
|
9
9
|
import DateHelper from './Date.helper'
|
|
10
|
-
import generator from '
|
|
10
|
+
import generator from '../../tests/generator'
|
|
11
11
|
import MonthHelper, { MONTH_BY_NAME } from './Month.helper'
|
|
12
|
-
import renderer, { screen, fire } from '
|
|
12
|
+
import renderer, { screen, fire } from '../../tests/renderer'
|
|
13
13
|
|
|
14
14
|
import type { CalendarConstraint } from './Date.helper'
|
|
15
15
|
import type { CalendarMonthAlias } from './Month.helper'
|
|
@@ -209,7 +209,7 @@ describe('Calendar', () => {
|
|
|
209
209
|
const startDate = DateHelper(Date.UTC(year, startMonth, startDay))
|
|
210
210
|
const endDate = DateHelper(Date.UTC(year, endMonth, endDay))
|
|
211
211
|
|
|
212
|
-
const props = {
|
|
212
|
+
const props: Partial<CalendarProps> = {
|
|
213
213
|
mode: 'range',
|
|
214
214
|
month: startMonth,
|
|
215
215
|
year,
|