@loadsmart/loadsmart-ui 5.10.0 → 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/common/SelectionWrapper.d.ts +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.stories.d.ts +1 -1
- package/dist/components/Banner/Banner.stories.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
- package/dist/components/Button/Button.stories.d.ts +1 -1
- package/dist/components/Calendar/Calendar.stories.d.ts +2 -7
- package/dist/components/Calendar/Date.helper.d.ts +47 -12
- package/dist/components/Card/Card.stories.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -1
- package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
- package/dist/components/DragDropFile/DragDropFile.stories.d.ts +1 -1
- package/dist/components/Drawer/Drawer.stories.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +5 -2
- package/dist/components/EmptyState/EmptyState.stories.d.ts +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +1 -1
- package/dist/components/HighlightMatch/HighlightMatch.stories.d.ts +1 -1
- package/dist/components/IconFactory/IconFactory.stories.d.ts +1 -1
- package/dist/components/Label/Label.d.ts +2 -2
- package/dist/components/Label/Label.stories.d.ts +1 -1
- package/dist/components/Layout/Box.d.ts +1 -1
- package/dist/components/Layout/Grid.d.ts +1 -1
- package/dist/components/Layout/Layout.stories.d.ts +1 -1
- package/dist/components/Layout/Sidebar.d.ts +1 -1
- package/dist/components/Layout/Switcher.d.ts +1 -1
- package/dist/components/Link/Link.stories.d.ts +1 -1
- package/dist/components/Link/useSafeLink.d.ts +1 -1
- package/dist/components/Loaders/LoadingBar.stories.d.ts +2 -2
- package/dist/components/Loaders/LoadingDots.stories.d.ts +1 -1
- package/dist/components/Loaders/Spinner.stories.d.ts +1 -1
- package/dist/components/Modal/Modal.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.types.d.ts +2 -2
- package/dist/components/Popover/Popover.stories.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.stories.d.ts +1 -1
- package/dist/components/Section/Sections.stories.d.ts +1 -1
- package/dist/components/Select/Select.fixtures.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +2 -2
- package/dist/components/Select/SelectCreatableOption.d.ts +1 -1
- package/dist/components/Select/SelectEmpty.d.ts +1 -1
- package/dist/components/Select/components.d.ts +1 -1
- package/dist/components/Select/useSelectExternal.d.ts +1 -1
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +1 -1
- package/dist/components/Steps/Steps.d.ts +1 -1
- package/dist/components/Steps/Steps.stories.d.ts +1 -1
- package/dist/components/Steps/StepsStep.d.ts +1 -1
- package/dist/components/Switch/Switch.stories.d.ts +1 -1
- package/dist/components/Table/Table.stories.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +3 -4
- package/dist/components/Table/TableSortHandle.d.ts +1 -1
- package/dist/components/TablePagination/RowsPerPage.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.stories.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.types.d.ts +1 -1
- package/dist/components/TablePagination/TablePaginationActions.d.ts +1 -1
- package/dist/components/Tag/Tag.stories.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/Text/Text.stories.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +1 -1
- package/dist/components/Toast/Toast.stories.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/hooks/useFocusTrap/useFocusTrap.stories.d.ts +1 -1
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +1 -1
- package/dist/index.js +339 -491
- package/dist/index.js.map +1 -1
- package/dist/styles/activatable.d.ts +1 -1
- package/dist/styles/disableable.d.ts +1 -1
- package/dist/styles/focusable.d.ts +1 -1
- package/dist/styles/hoverable.d.ts +1 -1
- package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/tests/generator.d.ts +35 -0
- package/dist/tests/renderer.d.ts +10 -0
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js.map +1 -1
- package/package.json +9 -10
- package/src/common/CloseButton/CloseButton.tsx +7 -11
- package/src/common/SelectionWrapper.tsx +8 -8
- package/src/components/Accordion/Accordion.stories.tsx +2 -2
- package/src/components/Accordion/Accordion.test.tsx +2 -2
- package/src/components/Accordion/Accordion.tsx +24 -29
- package/src/components/Banner/Banner.stories.tsx +1 -1
- package/src/components/Banner/Banner.test.tsx +2 -2
- package/src/components/Banner/Banner.tsx +2 -2
- package/src/components/Breadcrumbs/Breadbrumbs.test.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -4
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/Button.test.tsx +2 -2
- package/src/components/Button/Button.tsx +17 -20
- package/src/components/Calendar/Calendar.stories.tsx +4 -2
- package/src/components/Calendar/Calendar.test.tsx +3 -3
- package/src/components/Calendar/Calendar.tsx +4 -8
- package/src/components/Calendar/Date.helper.test.ts +463 -15
- package/src/components/Calendar/Date.helper.ts +106 -45
- package/src/components/Calendar/PickerModeToggle.tsx +3 -6
- package/src/components/Calendar/Pickers/DayPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/MonthPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/PickerButton.tsx +29 -39
- package/src/components/Calendar/Pickers/YearPicker.test.tsx +9 -7
- package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.test.tsx +2 -2
- package/src/components/Card/Card.tsx +6 -9
- package/src/components/Card/CardTitle.tsx +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +15 -27
- 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.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.test.tsx +2 -2
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/DragDropFile/DragDropFile.stories.tsx +1 -1
- package/src/components/DragDropFile/components/DropZone.test.tsx +1 -1
- package/src/components/DragDropFile/styles.tsx +6 -11
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/Drawer/Drawer.test.tsx +1 -1
- package/src/components/Drawer/Drawer.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -6
- package/src/components/Dropdown/Dropdown.test.tsx +14 -16
- package/src/components/Dropdown/DropdownMenu.tsx +15 -28
- package/src/components/Dropdown/DropdownTrigger.tsx +24 -34
- package/src/components/EmptyState/EmptyState.stories.tsx +1 -1
- package/src/components/EmptyState/EmptyState.test.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.stories.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.test.tsx +2 -2
- package/src/components/HighlightMatch/HighlightMatch.tsx +1 -1
- package/src/components/IconFactory/IconFactory.stories.tsx +1 -1
- package/src/components/IconFactory/IconFactory.test.tsx +2 -2
- package/src/components/Label/Label.stories.tsx +1 -1
- package/src/components/Label/Label.test.tsx +2 -2
- package/src/components/Label/Label.tsx +5 -5
- package/src/components/Layout/Box.tsx +1 -1
- package/src/components/Layout/Grid.tsx +1 -1
- package/src/components/Layout/Layout.stories.tsx +1 -1
- package/src/components/Layout/Sidebar.tsx +1 -1
- package/src/components/Layout/Switcher.tsx +1 -1
- package/src/components/Link/Link.stories.tsx +1 -1
- package/src/components/Link/Link.test.tsx +2 -2
- package/src/components/Link/Link.tsx +9 -13
- package/src/components/Link/useSafeLink.ts +1 -1
- package/src/components/Loaders/LoadingBar.stories.tsx +3 -3
- package/src/components/Loaders/LoadingBar.test.tsx +1 -1
- package/src/components/Loaders/LoadingBar.tsx +2 -2
- package/src/components/Loaders/LoadingDots.stories.tsx +1 -1
- package/src/components/Loaders/LoadingDots.test.tsx +1 -1
- package/src/components/Loaders/Spinner.stories.tsx +1 -1
- package/src/components/Loaders/Spinner.test.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +1 -1
- package/src/components/Modal/Modal.test.tsx +2 -2
- package/src/components/Modal/Modal.tsx +7 -12
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.test.tsx +2 -2
- package/src/components/Pagination/Pagination.types.ts +2 -2
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.test.tsx +2 -2
- package/src/components/ProgressBar/ProgressBar.stories.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.test.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +4 -6
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Radio/Radio.test.tsx +2 -2
- package/src/components/Radio/Radio.tsx +12 -20
- package/src/components/Section/Section.test.tsx +2 -2
- package/src/components/Section/Section.tsx +6 -8
- package/src/components/Section/Sections.stories.tsx +2 -2
- package/src/components/Select/Select.fixtures.ts +2 -2
- package/src/components/Select/Select.stories.tsx +3 -3
- package/src/components/Select/Select.test.tsx +12 -5
- package/src/components/Select/Select.types.ts +2 -2
- package/src/components/Select/SelectCreatableOption.tsx +1 -1
- package/src/components/Select/SelectEmpty.tsx +5 -6
- package/src/components/Select/SelectOption.test.tsx +1 -1
- package/src/components/Select/SelectTrigger.tsx +6 -11
- package/src/components/Select/components.tsx +1 -1
- package/src/components/Select/useSelect.helpers.test.ts +1 -1
- package/src/components/Select/useSelect.ts +1 -1
- package/src/components/Select/useSelectExternal.ts +1 -1
- package/src/components/SideNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/SideNavigation/Menu/Menu.test.tsx +3 -3
- package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
- package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +4 -5
- package/src/components/SideNavigation/Menu/MenuExpandable.tsx +2 -3
- package/src/components/SideNavigation/Separator/Separator.test.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.test.tsx +2 -2
- package/src/components/Steps/ProgressSteps/ProgressStep.tsx +31 -39
- package/src/components/Steps/Steps.fixtures.ts +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.test.tsx +2 -2
- package/src/components/Steps/Steps.tsx +2 -1
- package/src/components/Steps/StepsStep.tsx +2 -1
- package/src/components/Steps/useStep.test.tsx +1 -1
- package/src/components/Switch/Switch.stories.tsx +1 -1
- package/src/components/Switch/Switch.test.tsx +1 -1
- package/src/components/Switch/Switch.tsx +6 -18
- package/src/components/Table/Table.fixtures.ts +1 -1
- package/src/components/Table/Table.stories.tsx +1 -1
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Table/Table.types.ts +9 -4
- package/src/components/Table/TableSortHandle.tsx +1 -1
- package/src/components/TablePagination/RowsPerPage.tsx +2 -2
- package/src/components/TablePagination/TablePagination.stories.tsx +1 -1
- package/src/components/TablePagination/TablePagination.test.tsx +2 -2
- package/src/components/TablePagination/TablePagination.types.ts +1 -1
- package/src/components/TablePagination/TablePaginationActions.tsx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +26 -32
- package/src/components/Tag/Tag.stories.tsx +2 -2
- package/src/components/Tag/Tag.test.tsx +2 -2
- package/src/components/Tag/Tag.tsx +35 -44
- package/src/components/Text/Text.stories.tsx +1 -1
- package/src/components/Text/Text.test.tsx +2 -2
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/TextField/TextField.stories.tsx +1 -1
- package/src/components/TextField/TextField.test.tsx +1 -1
- package/src/components/TextField/TextField.tsx +16 -23
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.test.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +18 -23
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +2 -2
- package/src/components/Toast/Toast.tsx +3 -3
- package/src/components/ToggleGroup/Toggle.test.tsx +2 -2
- package/src/components/ToggleGroup/Toggle.tsx +7 -7
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +1 -1
- package/src/components/ToggleGroup/ToggleGroup.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +23 -24
- package/src/components/TopNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/TopNavigation/Menu/Menu.test.tsx +1 -1
- package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
- package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.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.stories.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/useHeightExpansionToggler/useHeightExpansionToggler.ts +1 -1
- package/src/hooks/useSelectable/SelectableStrategy.test.ts +1 -1
- package/src/hooks/useSelectable/useSelectable.test.ts +1 -1
- package/src/styles/activatable.tsx +1 -1
- package/src/styles/disableable.tsx +1 -1
- package/src/styles/focusable.tsx +1 -1
- package/src/styles/font.tsx +3 -3
- package/src/styles/hoverable.tsx +1 -1
- package/src/testing/SelectEvent/SelectEvent.test.tsx +2 -2
- package/src/testing/getInterpolatedStyles/getInterpolatedStyles.ts +1 -1
- package/src/tests/generator.ts +127 -0
- package/src/tests/renderer.tsx +39 -0
- package/src/theming/index.ts +3 -2
- package/src/tools/conditional.test.ts +1 -1
- package/src/utils/toolset/interleave.test.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SelectableKeyType } from 'hooks/useSelectable'
|
|
2
|
-
import generator from '
|
|
1
|
+
import type { SelectableKeyType } from 'hooks/useSelectable'
|
|
2
|
+
import generator from '../../tests/generator'
|
|
3
3
|
|
|
4
4
|
import type { SelectDatasource } from './Select.types'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react'
|
|
2
|
-
import { Story, Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Story, Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
import omit from 'lodash.omit'
|
|
4
4
|
|
|
5
5
|
import { Label } from 'components/Label'
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
SelectProps,
|
|
16
16
|
} from './Select.types'
|
|
17
17
|
import { useSelect } from '.'
|
|
18
|
-
import generators from '
|
|
18
|
+
import generators from '../../tests/generator'
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
21
|
title: 'Components/Select',
|
|
@@ -32,7 +32,7 @@ export const Playground: Story<SelectProps> = (args: SelectProps) => {
|
|
|
32
32
|
<div className="flex-1">
|
|
33
33
|
<Label htmlFor="select-playground">Select your favorite fruit</Label>
|
|
34
34
|
<Select
|
|
35
|
-
options={FRUITS}
|
|
35
|
+
options={[...FRUITS]}
|
|
36
36
|
placeholder="Select sync"
|
|
37
37
|
{...omit(args, OMITTED_PROPS)}
|
|
38
38
|
id="select-playground"
|
|
@@ -5,8 +5,8 @@ import { render } from '@testing-library/react'
|
|
|
5
5
|
|
|
6
6
|
import { SelectableKeyTypeOptions, Fruit, FRUITS, USERS } from './Select.fixtures'
|
|
7
7
|
import * as stories from './Select.stories'
|
|
8
|
-
import generator from '
|
|
9
|
-
import renderer, { screen, fire, waitFor } from '
|
|
8
|
+
import generator from '../../tests/generator'
|
|
9
|
+
import renderer, { screen, fire, waitFor } from '../../tests/renderer'
|
|
10
10
|
import selectEvent from '../../testing/SelectEvent'
|
|
11
11
|
|
|
12
12
|
import type { SelectProps, Option } from './Select.types'
|
|
@@ -322,7 +322,10 @@ describe('Select', () => {
|
|
|
322
322
|
const searchInput = screen.getByLabelText('Select your favorite fruit')
|
|
323
323
|
await selectEvent.select(firstOption.label, searchInput)
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
await waitFor(() => {
|
|
326
|
+
expect(screen.getByTestId('select-trigger-clear-counter')).toHaveTextContent('1')
|
|
327
|
+
})
|
|
328
|
+
|
|
326
329
|
expect(screen.getByTitle('1 selected option')).toBeInTheDocument()
|
|
327
330
|
|
|
328
331
|
await selectEvent.select(secondOption.label, searchInput)
|
|
@@ -346,7 +349,9 @@ describe('Select', () => {
|
|
|
346
349
|
const searchInput = screen.getByLabelText('Select your favorite fruit')
|
|
347
350
|
expect(await selectEvent.getSelectedOptions(searchInput)).toHaveLength(3)
|
|
348
351
|
|
|
349
|
-
|
|
352
|
+
await waitFor(() => {
|
|
353
|
+
expect(screen.getByTestId('select-trigger-clear-counter')).toHaveTextContent('3')
|
|
354
|
+
})
|
|
350
355
|
|
|
351
356
|
await selectEvent.unselect(secondOption.label, searchInput)
|
|
352
357
|
|
|
@@ -366,7 +371,9 @@ describe('Select', () => {
|
|
|
366
371
|
const searchInput = screen.getByLabelText('Select your favorite fruit')
|
|
367
372
|
expect(await selectEvent.getSelectedOptions(searchInput)).toHaveLength(3)
|
|
368
373
|
|
|
369
|
-
|
|
374
|
+
await waitFor(() => {
|
|
375
|
+
expect(screen.getByTestId('select-trigger-clear-counter')).toHaveTextContent('3')
|
|
376
|
+
})
|
|
370
377
|
|
|
371
378
|
await selectEvent.clear(searchInput)
|
|
372
379
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import EventLike from 'utils/types/EventLike'
|
|
2
|
+
import type EventLike from 'utils/types/EventLike'
|
|
3
3
|
|
|
4
4
|
import type { DropdownMenuItemProps, DropdownProps } from 'components/Dropdown'
|
|
5
5
|
import type { TextFieldProps } from 'components/TextField'
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
SelectableKeyType,
|
|
10
10
|
SelectableState,
|
|
11
11
|
} from 'hooks/useSelectable'
|
|
12
|
-
import { useSelectableReturn } from 'hooks/useSelectable/useSelectable.types'
|
|
12
|
+
import type { useSelectableReturn } from 'hooks/useSelectable/useSelectable.types'
|
|
13
13
|
import type { ChangeEvent, ComponentType, FocusEvent, HTMLAttributes } from 'react'
|
|
14
14
|
|
|
15
15
|
export type Option = Selectable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react'
|
|
2
2
|
import { Dropdown } from 'components/Dropdown'
|
|
3
3
|
import { SelectContext } from './Select.context'
|
|
4
|
-
import { SelectCreatableOptionProps } from './Select.types'
|
|
4
|
+
import type { SelectCreatableOptionProps } from './Select.types'
|
|
5
5
|
|
|
6
6
|
function SelectCreatableOption({ children, ...rest }: SelectCreatableOptionProps): JSX.Element {
|
|
7
7
|
const select =
|
|
@@ -2,23 +2,22 @@ import React from 'react'
|
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
|
|
4
4
|
import { getToken as token } from 'theming'
|
|
5
|
-
import { SelectEmptyProps } from './Select.types'
|
|
5
|
+
import type { SelectEmptyProps } from './Select.types'
|
|
6
6
|
|
|
7
7
|
const Wrapper = styled.div`
|
|
8
|
+
box-sizing: border-box;
|
|
8
9
|
display: flex;
|
|
9
10
|
flex-direction: column;
|
|
10
11
|
align-items: flex-start;
|
|
11
12
|
justify-content: center;
|
|
12
|
-
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
margin: 0 ${token('space-s')};
|
|
15
13
|
padding: ${token('space-s')};
|
|
16
|
-
|
|
17
|
-
color: ${token('color-neutral')};
|
|
14
|
+
margin: 0 ${token('space-s')};
|
|
18
15
|
|
|
19
16
|
font-size: 1em;
|
|
20
17
|
line-height: ${token('font-height-3')};
|
|
21
18
|
|
|
19
|
+
color: ${token('color-neutral')};
|
|
20
|
+
|
|
22
21
|
background: ${token('color-transparent')};
|
|
23
22
|
`
|
|
24
23
|
|
|
@@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react'
|
|
|
3
3
|
import SelectOption from './SelectOption'
|
|
4
4
|
import { SelectContext } from './Select.context'
|
|
5
5
|
import useSelect from './useSelect'
|
|
6
|
-
import { Option, SelectOptionProps, SelectProps, useSelectReturn } from './Select.types'
|
|
6
|
+
import type { Option, SelectOptionProps, SelectProps, useSelectReturn } from './Select.types'
|
|
7
7
|
|
|
8
8
|
type Props = {
|
|
9
9
|
optionProps: SelectOptionProps
|
|
@@ -13,19 +13,14 @@ const GenericSelectTrigger = styled(GenericDropdownTrigger)`
|
|
|
13
13
|
`
|
|
14
14
|
|
|
15
15
|
const SelectTriggerSearchField = styled(TextField)`
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`}
|
|
19
|
-
|
|
16
|
+
flex: 1;
|
|
17
|
+
height: 100%;
|
|
20
18
|
background-color: transparent;
|
|
21
|
-
|
|
22
19
|
border: none;
|
|
23
20
|
border-radius: ${token('border-radius-s')} 0 0 ${token('border-radius-s')};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
flex: 1;
|
|
28
|
-
|
|
21
|
+
${focusable`
|
|
22
|
+
box-shadow: none;
|
|
23
|
+
`}
|
|
29
24
|
${Trailing} {
|
|
30
25
|
margin: 0 ${token('space-xs')} 0 0;
|
|
31
26
|
}
|
|
@@ -37,8 +32,8 @@ const Separator = styled.span`
|
|
|
37
32
|
margin: 0;
|
|
38
33
|
|
|
39
34
|
border-right-color: ${token('color-neutral-light')};
|
|
40
|
-
border-right-width: 1px;
|
|
41
35
|
border-right-style: solid;
|
|
36
|
+
border-right-width: 1px;
|
|
42
37
|
`
|
|
43
38
|
|
|
44
39
|
const SelectTrigger = forwardRef<HTMLInputElement, SelectTriggerProps>(function SelectTrigger(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Components, CreatableOptionType } from './Select.types'
|
|
1
|
+
import type { Components, CreatableOptionType } from './Select.types'
|
|
2
2
|
import SelectCreatableOption from './SelectCreatableOption'
|
|
3
3
|
import SelectEmpty from './SelectEmpty'
|
|
4
4
|
import SelectOption from './SelectOption'
|
|
@@ -7,7 +7,7 @@ import isEmpty from 'utils/toolset/isEmpty'
|
|
|
7
7
|
import { useDropdown } from 'components/Dropdown'
|
|
8
8
|
import { useDidMount } from 'hooks/useDidMount'
|
|
9
9
|
import { useFocusTrap } from 'hooks/useFocusTrap'
|
|
10
|
-
import { SelectableKeyType } from 'hooks/useSelectable'
|
|
10
|
+
import type { SelectableKeyType } from 'hooks/useSelectable'
|
|
11
11
|
import to from 'utils/toolset/awaitTo'
|
|
12
12
|
import { isThenable } from 'utils/toolset/isThenable'
|
|
13
13
|
import toArray from 'utils/toolset/toArray'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useContext } from 'react'
|
|
2
2
|
|
|
3
3
|
import { SelectContext } from './Select.context'
|
|
4
|
-
import { Option, useSelectExternalReturn } from './Select.types'
|
|
4
|
+
import type { Option, useSelectExternalReturn } from './Select.types'
|
|
5
5
|
|
|
6
6
|
export function useSelectExternal(): useSelectExternalReturn {
|
|
7
7
|
const select =
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import { Logo } from './'
|
|
4
|
-
import renderer, { screen } from '
|
|
5
|
-
import generator from '
|
|
4
|
+
import renderer, { screen } from '../../../tests/renderer'
|
|
5
|
+
import generator from '../../../tests/generator'
|
|
6
6
|
import type { LogoProps } from './Logo'
|
|
7
7
|
|
|
8
8
|
const setup = ({ ...overrides }: LogoProps) => renderer(<Logo {...overrides} />).render()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import { Menu } from './'
|
|
4
|
-
import { MenuProps } from './Menu'
|
|
5
|
-
import renderer, { screen } from '
|
|
6
|
-
import generator from '
|
|
4
|
+
import type { MenuProps } from './Menu'
|
|
5
|
+
import renderer, { screen } from '../../../tests/renderer'
|
|
6
|
+
import generator from '../../../tests/generator'
|
|
7
7
|
import userEvent from '@testing-library/user-event'
|
|
8
8
|
|
|
9
9
|
function setup(props: MenuProps) {
|
|
@@ -13,11 +13,11 @@ import { styledCompounds } from 'utils/toolset/styledCompounds'
|
|
|
13
13
|
const MenuTitle = styled.div`
|
|
14
14
|
padding: ${token('space-s')} 0;
|
|
15
15
|
padding-left: ${token('space-l')};
|
|
16
|
-
|
|
17
|
-
color: ${token('color-neutral')};
|
|
18
|
-
font-weight: ${token('font-weight-bold')};
|
|
19
16
|
font-size: ${token('font-size-5')};
|
|
17
|
+
font-weight: ${token('font-weight-bold')};
|
|
20
18
|
line-height: ${token('font-height-3')};
|
|
19
|
+
|
|
20
|
+
color: ${token('color-neutral')};
|
|
21
21
|
text-transform: uppercase;
|
|
22
22
|
`
|
|
23
23
|
|
|
@@ -17,23 +17,22 @@ export type MenuBaseItemProps = HTMLAttributes<HTMLElement> & {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const StyledMenuItem = styled.button`
|
|
20
|
-
${transition({ duration: '0.25s' })};
|
|
21
|
-
|
|
22
20
|
display: flex;
|
|
23
|
-
width: 100%;
|
|
24
21
|
align-items: center;
|
|
25
22
|
justify-content: space-between;
|
|
23
|
+
width: 100%;
|
|
26
24
|
padding: ${token('space-s')} 0;
|
|
27
25
|
padding-right: ${rem('12px')};
|
|
28
26
|
padding-left: ${token('space-l')};
|
|
29
27
|
|
|
30
|
-
color: ${token('color-neutral-white')};
|
|
31
|
-
font-weight: ${token('font-weight-bold')};
|
|
32
28
|
font-size: ${token('font-size-4')};
|
|
29
|
+
font-weight: ${token('font-weight-bold')};
|
|
33
30
|
line-height: ${token('font-height-3')};
|
|
31
|
+
color: ${token('color-neutral-white')};
|
|
34
32
|
|
|
35
33
|
cursor: pointer;
|
|
36
34
|
|
|
35
|
+
${transition({ duration: '0.25s' })};
|
|
37
36
|
${focusable`
|
|
38
37
|
color: ${token('color-primary')};
|
|
39
38
|
`}
|
|
@@ -35,11 +35,10 @@ const StyledIcon = styled(Icon)<IExpandable>`
|
|
|
35
35
|
`
|
|
36
36
|
|
|
37
37
|
const ExpandableItems = styled.div<IExpandable>`
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
${transition({ property: 'height' })}
|
|
40
|
-
|
|
41
38
|
height: ${prop('$height', 0)}px;
|
|
39
|
+
overflow: hidden;
|
|
42
40
|
|
|
41
|
+
${transition({ property: 'height' })}
|
|
43
42
|
${MenuLink} {
|
|
44
43
|
padding-left: ${token('space-xl')};
|
|
45
44
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import { SideNavigation } from './'
|
|
4
|
-
import renderer from '
|
|
5
|
-
import generator from '
|
|
4
|
+
import renderer from '../../tests/renderer'
|
|
5
|
+
import generator from '../../tests/generator'
|
|
6
6
|
import type { SideNavigationProps } from './SideNavigation'
|
|
7
7
|
|
|
8
8
|
function setup(props: SideNavigationProps) {
|
|
@@ -60,32 +60,18 @@ const ProgressStepContainer = styled.div`
|
|
|
60
60
|
`
|
|
61
61
|
|
|
62
62
|
const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
|
|
63
|
-
${transition()}
|
|
64
|
-
|
|
65
|
-
${font({
|
|
66
|
-
weight: 'font-weight-bold',
|
|
67
|
-
height: 'steps-indicator-size',
|
|
68
|
-
})}
|
|
69
|
-
|
|
70
|
-
font-size: ${token('font-size-4')};
|
|
71
|
-
|
|
72
|
-
height: ${token('steps-indicator-size')};
|
|
73
|
-
width: ${token('steps-indicator-size')};
|
|
74
|
-
|
|
75
63
|
display: flex;
|
|
76
|
-
justify-content: center;
|
|
77
64
|
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
width: ${token('steps-indicator-size')};
|
|
67
|
+
height: ${token('steps-indicator-size')};
|
|
68
|
+
font-size: ${token('font-size-4')};
|
|
78
69
|
|
|
79
|
-
|
|
80
|
-
border-style: solid;
|
|
81
|
-
border-color: ${conditional({
|
|
82
|
-
'color-accent': whenProps([
|
|
83
|
-
{ current: true, complete: [true, false] },
|
|
84
|
-
{ current: false, complete: true },
|
|
85
|
-
]),
|
|
70
|
+
color: ${conditional({
|
|
86
71
|
'color-neutral': whenProps({ current: false, complete: false }),
|
|
72
|
+
'color-neutral-white': whenProps({ current: false, complete: true }),
|
|
73
|
+
'color-accent': whenProps({ current: true }),
|
|
87
74
|
})};
|
|
88
|
-
border-radius: ${token('border-radius-circle')};
|
|
89
75
|
|
|
90
76
|
background: ${conditional({
|
|
91
77
|
'color-accent': whenProps([{ current: false, complete: true }]),
|
|
@@ -95,41 +81,47 @@ const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
|
|
|
95
81
|
]),
|
|
96
82
|
})};
|
|
97
83
|
|
|
98
|
-
color: ${conditional({
|
|
84
|
+
border-color: ${conditional({
|
|
85
|
+
'color-accent': whenProps([
|
|
86
|
+
{ current: true, complete: [true, false] },
|
|
87
|
+
{ current: false, complete: true },
|
|
88
|
+
]),
|
|
99
89
|
'color-neutral': whenProps({ current: false, complete: false }),
|
|
100
|
-
'color-neutral-white': whenProps({ current: false, complete: true }),
|
|
101
|
-
'color-accent': whenProps({ current: true }),
|
|
102
90
|
})};
|
|
103
|
-
|
|
91
|
+
border-style: solid;
|
|
92
|
+
border-width: 2px;
|
|
93
|
+
border-radius: ${token('border-radius-circle')};
|
|
104
94
|
|
|
105
|
-
|
|
95
|
+
${transition()}
|
|
106
96
|
${font({
|
|
107
|
-
|
|
97
|
+
weight: 'font-weight-bold',
|
|
98
|
+
height: 'steps-indicator-size',
|
|
108
99
|
})}
|
|
100
|
+
`
|
|
109
101
|
|
|
102
|
+
const StepLabel = styled.span<{ current: boolean; complete: boolean }>`
|
|
110
103
|
position: relative;
|
|
111
104
|
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: row;
|
|
107
|
+
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
|
|
111
|
+
margin: ${token('space-xs')} 0 0 0;
|
|
112
|
+
font-size: ${token('font-size-4')};
|
|
112
113
|
font-weight: ${conditional({
|
|
113
114
|
'font-weight-medium': whenProps({ current: false }),
|
|
114
115
|
'font-weight-bold': whenProps({ current: true }),
|
|
115
116
|
})};
|
|
116
|
-
|
|
117
117
|
color: ${conditional({
|
|
118
118
|
'color-neutral-darker': whenProps([{ current: true }, { current: false, complete: true }]),
|
|
119
119
|
'color-neutral': whenProps({ current: false, complete: false }),
|
|
120
120
|
})};
|
|
121
|
-
|
|
122
|
-
font-size: ${token('font-size-4')};
|
|
123
|
-
|
|
124
|
-
display: flex;
|
|
125
|
-
flex-direction: row;
|
|
126
|
-
|
|
127
|
-
align-items: center;
|
|
128
|
-
justify-content: center;
|
|
129
|
-
|
|
130
121
|
text-align: center;
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
${font({
|
|
123
|
+
height: 'font-height-2',
|
|
124
|
+
})}
|
|
133
125
|
`
|
|
134
126
|
|
|
135
127
|
function ProgressStep(props: { step: Step; current: boolean; indicator: ReactNode }): JSX.Element {
|
|
@@ -2,9 +2,9 @@ import React from 'react'
|
|
|
2
2
|
import { composeStory } from '@storybook/testing-react'
|
|
3
3
|
|
|
4
4
|
import { STEPS, CONTENTS } from './Steps.fixtures'
|
|
5
|
-
import generator from '
|
|
5
|
+
import generator from '../../tests/generator'
|
|
6
6
|
import Meta, { Playground as PlaygroundStory } from './Steps.stories'
|
|
7
|
-
import renderer, { screen } from '
|
|
7
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
8
8
|
|
|
9
9
|
import type { StepsProps } from './Steps'
|
|
10
10
|
import type { Step } from './Steps.types'
|
|
@@ -3,7 +3,7 @@ import { composeStories } from '@storybook/testing-react'
|
|
|
3
3
|
import userEvent from '@testing-library/user-event'
|
|
4
4
|
|
|
5
5
|
import * as stories from './Switch.stories'
|
|
6
|
-
import renderer, { screen } from '
|
|
6
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
7
7
|
import type { SwitchProps } from './Switch'
|
|
8
8
|
|
|
9
9
|
const { Playground } = composeStories(stories)
|
|
@@ -24,19 +24,8 @@ export interface SwitchProps extends InputHTMLAttributes<HTMLInputElement>, With
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const SwitchWrapper = styled.label<WithAdditionalProps>`
|
|
27
|
-
${transition()}
|
|
28
|
-
|
|
29
|
-
${font({})};
|
|
30
|
-
|
|
31
|
-
user-select: none;
|
|
32
|
-
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
-webkit-tap-highlight-color: transparent;
|
|
35
|
-
|
|
36
27
|
position: relative;
|
|
37
|
-
|
|
38
28
|
display: inline-flex;
|
|
39
|
-
|
|
40
29
|
width: ${conditional({
|
|
41
30
|
'switch-width': whenProps({ scale: 'default' }),
|
|
42
31
|
'switch-large-width': whenProps({ scale: 'large' }),
|
|
@@ -45,28 +34,28 @@ const SwitchWrapper = styled.label<WithAdditionalProps>`
|
|
|
45
34
|
'switch-height': whenProps({ scale: 'default' }),
|
|
46
35
|
'switch-large-height': whenProps({ scale: 'large' }),
|
|
47
36
|
})};
|
|
48
|
-
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
user-select: none;
|
|
39
|
+
-webkit-tap-highlight-color: transparent;
|
|
49
40
|
background-color: ${conditional({
|
|
50
41
|
'switch-inactive-background-color': whenProps({ active: false }),
|
|
51
42
|
'switch-active-background-color': whenProps({ active: true }),
|
|
52
43
|
})};
|
|
53
|
-
|
|
54
44
|
border-radius: ${conditional({
|
|
55
45
|
'switch-border-radius': whenProps({ scale: 'default' }),
|
|
56
46
|
'switch-large-border-radius': whenProps({ scale: 'large' }),
|
|
57
47
|
})};
|
|
58
|
-
|
|
48
|
+
${transition()}
|
|
49
|
+
${font({})};
|
|
59
50
|
${hoverable`
|
|
60
51
|
background: ${conditional({
|
|
61
52
|
'switch-inactive-background-color--hover': whenProps({ active: false }),
|
|
62
53
|
'switch-active-background-color--hover': whenProps({ active: true }),
|
|
63
54
|
})};
|
|
64
55
|
`}
|
|
65
|
-
|
|
66
56
|
${focusable`
|
|
67
57
|
box-shadow: ${token('switch-outline')}
|
|
68
58
|
`}
|
|
69
|
-
|
|
70
59
|
${disableable``}
|
|
71
60
|
`
|
|
72
61
|
|
|
@@ -102,6 +91,7 @@ const Slider = styled.span<WithAdditionalProps>`
|
|
|
102
91
|
'switch-slider-large-size': whenProps({ scale: 'large' }),
|
|
103
92
|
})};
|
|
104
93
|
|
|
94
|
+
content: '';
|
|
105
95
|
background-color: ${token('switch-slider-background-color')};
|
|
106
96
|
border-radius: ${token('switch-slider-border-radius')};
|
|
107
97
|
|
|
@@ -109,8 +99,6 @@ const Slider = styled.span<WithAdditionalProps>`
|
|
|
109
99
|
timingFunction: 'ease-out',
|
|
110
100
|
duration: '150ms',
|
|
111
101
|
})}
|
|
112
|
-
|
|
113
|
-
content: '';
|
|
114
102
|
}
|
|
115
103
|
`
|
|
116
104
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
+
import type { Meta } from '@storybook/react/types-6-0'
|
|
4
4
|
|
|
5
5
|
import Table, { useSelection } from './Table'
|
|
6
6
|
import type { TableColumns, TableProps } from './Table.types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import renderer, { screen, user } from '
|
|
3
|
+
import renderer, { screen, user } from '../../tests/renderer'
|
|
4
4
|
|
|
5
5
|
import Table from './Table'
|
|
6
6
|
import type { TableProps } from './Table.types'
|
|
@@ -152,10 +152,10 @@ const StyledTable = styled.table<{ scale?: string }>`
|
|
|
152
152
|
|
|
153
153
|
white-space: nowrap;
|
|
154
154
|
|
|
155
|
-
background-color: ${token('color-neutral-white')};
|
|
156
|
-
|
|
157
155
|
border-collapse: collapse;
|
|
158
156
|
|
|
157
|
+
background-color: ${token('color-neutral-white')};
|
|
158
|
+
|
|
159
159
|
${StyledTableBody} ${StyledTableRow},
|
|
160
160
|
${StyledTableBody} ${StyledExpandableTableRow} {
|
|
161
161
|
height: ${conditional({
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { Selectable } from 'hooks/useSelectable'
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { Selectable } from 'hooks/useSelectable'
|
|
2
|
+
import type {
|
|
3
|
+
ComponentType,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
PropsWithChildren,
|
|
6
|
+
ReactNode,
|
|
7
|
+
ReactElement,
|
|
8
|
+
} from 'react'
|
|
4
9
|
import type { DropdownMenuItemProps, DropdownMenuProps } from 'components/Dropdown'
|
|
5
10
|
import type { DropdownTriggerButtonProps } from 'components/Dropdown/DropdownTrigger'
|
|
6
11
|
|
|
@@ -26,7 +31,7 @@ export interface TableSelectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
26
31
|
export interface SelectionCellProps<T extends Selectable = TableSelectableRow>
|
|
27
32
|
extends HTMLAttributes<HTMLTableCellElement> {
|
|
28
33
|
value?: T
|
|
29
|
-
children?: (props: { selected: boolean; toggle: () => void }) =>
|
|
34
|
+
children?: (props: { selected: boolean; toggle: () => void }) => ReactElement
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export interface TableSectionProps extends HTMLAttributes<HTMLTableSectionElement> {
|