@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
|
@@ -14,6 +14,13 @@ import ToggleGroupContext, { SelectableContext } from './ToggleGroupContext'
|
|
|
14
14
|
import type { ToggleGroupOptionProps, ToggleGroupType } from './ToggleGroup.types'
|
|
15
15
|
|
|
16
16
|
const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
|
|
17
|
+
padding: ${token('space-xs')} ${token('space-s')};
|
|
18
|
+
|
|
19
|
+
color: ${conditional({
|
|
20
|
+
'color-neutral-darker': whenProps({ 'aria-checked': false }),
|
|
21
|
+
'color-neutral-white': whenProps({ 'aria-checked': true }),
|
|
22
|
+
})};
|
|
23
|
+
|
|
17
24
|
background: ${conditional({
|
|
18
25
|
'color-transparent': whenProps({ 'aria-checked': false }),
|
|
19
26
|
'color-neutral-darkest': whenProps({ 'aria-checked': true }),
|
|
@@ -27,13 +34,6 @@ const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
|
|
|
27
34
|
'color-transparent': whenProps({ $type: 'single', 'aria-checked': false }),
|
|
28
35
|
})};
|
|
29
36
|
|
|
30
|
-
color: ${conditional({
|
|
31
|
-
'color-neutral-darker': whenProps({ 'aria-checked': false }),
|
|
32
|
-
'color-neutral-white': whenProps({ 'aria-checked': true }),
|
|
33
|
-
})};
|
|
34
|
-
|
|
35
|
-
padding: ${token('space-xs')} ${token('space-s')};
|
|
36
|
-
|
|
37
37
|
${hoverable`
|
|
38
38
|
border-color: ${conditional({
|
|
39
39
|
'color-neutral-dark': whenProps({ $type: 'multiple' }),
|
|
@@ -3,8 +3,8 @@ import { composeStories } from '@storybook/testing-react'
|
|
|
3
3
|
|
|
4
4
|
import { OPTIONS } from './ToggleGroup.constants'
|
|
5
5
|
import * as stories from './ToggleGroup.stories'
|
|
6
|
-
import generator from '
|
|
7
|
-
import renderer, { screen, fire } from '
|
|
6
|
+
import generator from '../../tests/generator'
|
|
7
|
+
import renderer, { screen, fire } from '../../tests/renderer'
|
|
8
8
|
|
|
9
9
|
import type { ToggleGroupProps, ToggleGroupOptionProps } from './ToggleGroup.types'
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import Tooltip, { TooltipAlign, TooltipPosition, TooltipProps } from './Tooltip'
|
|
3
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
+
import type { Meta } from '@storybook/react/types-6-0'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Components/Tooltip',
|
|
@@ -3,8 +3,8 @@ import { screen } from '@testing-library/react'
|
|
|
3
3
|
import userEvent from '@testing-library/user-event'
|
|
4
4
|
|
|
5
5
|
import Tooltip from './Tooltip'
|
|
6
|
-
import generator from '
|
|
7
|
-
import renderer from '
|
|
6
|
+
import generator from '../../tests/generator'
|
|
7
|
+
import renderer from '../../tests/renderer'
|
|
8
8
|
|
|
9
9
|
const setup = ({ ...overrides }) => renderer(<Tooltip message="" {...overrides} />).render()
|
|
10
10
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { HTMLAttributes,
|
|
1
|
+
import React, { HTMLAttributes, ReactNode, useCallback, useState } from 'react'
|
|
2
|
+
import type { PropsWithChildren } from 'react'
|
|
2
3
|
import styled, { css } from 'styled-components'
|
|
3
4
|
|
|
4
|
-
import ColorScheme from 'utils/types/ColorScheme'
|
|
5
|
+
import type ColorScheme from 'utils/types/ColorScheme'
|
|
5
6
|
import focusable from 'styles/focusable'
|
|
6
7
|
import transition from 'styles/transition'
|
|
7
8
|
import font from 'styles/font'
|
|
@@ -31,10 +32,10 @@ export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
31
32
|
type ContainerProps = Pick<TooltipProps, 'scheme'>
|
|
32
33
|
|
|
33
34
|
const Container = styled.div<ContainerProps>`
|
|
34
|
-
display: inline-block;
|
|
35
|
-
|
|
36
35
|
position: relative;
|
|
37
36
|
|
|
37
|
+
display: inline-block;
|
|
38
|
+
|
|
38
39
|
cursor: help;
|
|
39
40
|
|
|
40
41
|
${focusable`
|
|
@@ -48,31 +49,22 @@ const Container = styled.div<ContainerProps>`
|
|
|
48
49
|
type BubbleProps = Pick<TooltipProps, 'position' | 'align'>
|
|
49
50
|
|
|
50
51
|
const Bubble = styled.span<BubbleProps>`
|
|
51
|
-
${font({
|
|
52
|
-
weight: 'font-weight-medium',
|
|
53
|
-
height: 'font-height-3',
|
|
54
|
-
})}
|
|
55
|
-
|
|
56
|
-
${transition()}
|
|
57
|
-
|
|
58
|
-
white-space: initial;
|
|
59
|
-
|
|
60
|
-
min-width: ${token('tooltip-min-width')};
|
|
61
|
-
max-width: ${token('tooltip-max-width')};
|
|
62
|
-
width: max-content;
|
|
63
|
-
|
|
64
52
|
position: absolute;
|
|
65
53
|
z-index: ${token('z-index-tooltip')};
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
width: max-content;
|
|
56
|
+
min-width: ${token('tooltip-min-width')};
|
|
57
|
+
max-width: ${token('tooltip-max-width')};
|
|
70
58
|
|
|
71
59
|
padding: ${token('tooltip-padding-y')} ${token('tooltip-padding-x')};
|
|
72
60
|
|
|
73
|
-
color: ${token('tooltip-color')};
|
|
74
61
|
font-size: ${token('tooltip-font-size')};
|
|
75
62
|
line-height: ${token('tooltip-font-height')};
|
|
63
|
+
color: ${token('tooltip-color')};
|
|
64
|
+
white-space: initial;
|
|
65
|
+
background: ${token('tooltip-background')};
|
|
66
|
+
border-radius: ${token('tooltip-border-radius')};
|
|
67
|
+
box-shadow: ${token('tooltip-shadow')};
|
|
76
68
|
|
|
77
69
|
${({ position }) =>
|
|
78
70
|
position === TooltipPosition.Top &&
|
|
@@ -117,19 +109,26 @@ const Bubble = styled.span<BubbleProps>`
|
|
|
117
109
|
|
|
118
110
|
transform: translate(100%, -50%);
|
|
119
111
|
`};
|
|
112
|
+
|
|
113
|
+
${font({
|
|
114
|
+
weight: 'font-weight-medium',
|
|
115
|
+
height: 'font-height-3',
|
|
116
|
+
})}
|
|
117
|
+
|
|
118
|
+
${transition()}
|
|
120
119
|
`
|
|
121
120
|
|
|
122
121
|
type ArrowProps = Pick<TooltipProps, 'position'>
|
|
123
122
|
const Arrow = styled.span<ArrowProps>`
|
|
123
|
+
position: absolute;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
|
|
124
126
|
width: 0;
|
|
125
127
|
height: 0;
|
|
126
128
|
|
|
127
129
|
background: transparent;
|
|
128
130
|
border-style: solid;
|
|
129
131
|
|
|
130
|
-
position: absolute;
|
|
131
|
-
z-index: 1;
|
|
132
|
-
|
|
133
132
|
${({ position }) =>
|
|
134
133
|
position === TooltipPosition.Top &&
|
|
135
134
|
css`
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { Logo } from './'
|
|
4
4
|
import type { LogoProps } from './Logo'
|
|
5
|
-
import renderer, { screen } from '
|
|
6
|
-
import generators from '
|
|
5
|
+
import renderer, { screen } from '../../../tests/renderer'
|
|
6
|
+
import generators from '../../../tests/generator'
|
|
7
7
|
|
|
8
8
|
function setup(props: LogoProps) {
|
|
9
9
|
return renderer(<Logo {...props} />).render()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ThemeProvider } from 'styled-components'
|
|
3
|
-
import renderer, { screen, user } from '
|
|
3
|
+
import renderer, { screen, user } from '../../../tests/renderer'
|
|
4
4
|
import { Menu } from './'
|
|
5
5
|
import type { MenuProps } from './Menu'
|
|
6
6
|
import { Alice } from '../../../theming/themes'
|
|
@@ -27,8 +27,8 @@ const MenuDropdownTrigger = styled(DropdownTrigger.Handle)`
|
|
|
27
27
|
export const MenuDropdownLabel = styled.label`
|
|
28
28
|
${transition()}
|
|
29
29
|
|
|
30
|
-
align-items: center;
|
|
31
30
|
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
32
|
|
|
33
33
|
${typography('body-bold', { color: 'top-navigation-item-color' })}
|
|
34
34
|
|
|
@@ -11,10 +11,10 @@ export type OpenSideNavButtonProps = {
|
|
|
11
11
|
|
|
12
12
|
const Container = styled.button`
|
|
13
13
|
margin-right: ${token('space-2xl')};
|
|
14
|
+
cursor: pointer;
|
|
14
15
|
|
|
15
16
|
background: none;
|
|
16
17
|
border: none;
|
|
17
|
-
cursor: pointer;
|
|
18
18
|
`
|
|
19
19
|
|
|
20
20
|
function OpenSideNavButton({ className, onClick }: OpenSideNavButtonProps): JSX.Element {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { screen } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import renderer from '
|
|
4
|
+
import renderer from '../../tests/renderer'
|
|
5
5
|
|
|
6
6
|
import hiddenStyle from 'styles/hidden'
|
|
7
7
|
import { VisuallyHidden } from './VisuallyHidden'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import renderer, { screen, fire, user } from '
|
|
2
|
+
import renderer, { screen, fire, user } from '../../tests/renderer'
|
|
3
3
|
import { composeStories } from '@storybook/testing-react'
|
|
4
4
|
|
|
5
5
|
import * as stories from './useFocusTrap.stories'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { act, waitFor } from '@testing-library/react'
|
|
2
2
|
import React, { useRef, useState } from 'react'
|
|
3
3
|
|
|
4
|
-
import renderer, { screen, fire, user } from '
|
|
4
|
+
import renderer, { screen, fire, user } from '../../tests/renderer'
|
|
5
5
|
|
|
6
6
|
import useHeightExpansionToggler from './useHeightExpansionToggler'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderHook, act } from '@testing-library/react-hooks'
|
|
2
2
|
|
|
3
3
|
import { createSelectable } from './useSelectable'
|
|
4
|
-
import generator from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
5
|
|
|
6
6
|
import type { Selectable, SelectableAdapter, SelectableKeyType } from './useSelectable.types'
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import interleave from 'utils/toolset/interleave'
|
|
3
|
-
import { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
3
|
+
import type { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Add basic CSS style wrapping block for `:active` state.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import interleave from 'utils/toolset/interleave'
|
|
3
|
-
import { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
3
|
+
import type { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Add basic CSS style wrapping block for `:disabled` state or `.is-disabled` class.
|
package/src/styles/focusable.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import interleave from 'utils/toolset/interleave'
|
|
3
|
-
import { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
3
|
+
import type { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
4
4
|
/**
|
|
5
5
|
* Add basic CSS style wrapping block for `:active` state.
|
|
6
6
|
* It returns an array to allow handling of nested interpolation
|
package/src/styles/font.tsx
CHANGED
|
@@ -26,11 +26,11 @@ function fontStyle({
|
|
|
26
26
|
transform = 'none',
|
|
27
27
|
}: FontStyleOptions): FlattenInterpolation<ThemedProps> {
|
|
28
28
|
return css`
|
|
29
|
-
color: ${getToken(color)};
|
|
30
|
-
font-weight: ${getToken(weight)};
|
|
31
|
-
font-size: ${getToken(size)};
|
|
32
29
|
font-family: ${getToken(family)};
|
|
30
|
+
font-size: ${getToken(size)};
|
|
31
|
+
font-weight: ${getToken(weight)};
|
|
33
32
|
line-height: ${getToken(height)};
|
|
33
|
+
color: ${getToken(color)};
|
|
34
34
|
text-transform: ${transform};
|
|
35
35
|
-webkit-font-smoothing: antialiased;
|
|
36
36
|
-moz-osx-font-smoothing: grayscale;
|
package/src/styles/hoverable.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import interleave from 'utils/toolset/interleave'
|
|
3
|
-
import { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
3
|
+
import type { InterpolatedStyle } from 'utils/types/InterpolatedStyle'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Add basic CSS style wrapping block for `:hover` state; it includes check for non-disabled (`:enabled` or not `.is-disabled`) elements.
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
useSyncFruits,
|
|
8
8
|
useAsyncUsers,
|
|
9
9
|
} from '../../components/Select/Select.fixtures'
|
|
10
|
-
import generator from '
|
|
11
|
-
import renderer, { screen } from '
|
|
10
|
+
import generator from '../../tests/generator'
|
|
11
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
12
12
|
import Select from '../../components/Select/Select'
|
|
13
13
|
|
|
14
14
|
import selectEvent from './SelectEvent'
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import Chance from 'chance'
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
|
+
|
|
4
|
+
const chance = new Chance()
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generates an array of `amount` (or random) length, based on the given
|
|
8
|
+
* template function.
|
|
9
|
+
* The template function receives as named parameter the current `index`.
|
|
10
|
+
* @param {Function} template Template function to generate one item
|
|
11
|
+
* @param {number} amount Amount of items to be generated. If none is provide,
|
|
12
|
+
* then a random amount is generated.
|
|
13
|
+
* @returns {Array} Returns an array of lenght `amount`, with items
|
|
14
|
+
* generated based on the provided `template`.
|
|
15
|
+
*/
|
|
16
|
+
function generateArray<T>(
|
|
17
|
+
template: ({ index }: { index: number }) => T,
|
|
18
|
+
amount?: number
|
|
19
|
+
): Array<T> {
|
|
20
|
+
const safeAmount = amount || chance.integer({ min: 5, max: 10 })
|
|
21
|
+
|
|
22
|
+
const data = []
|
|
23
|
+
for (let i = 0; i < safeAmount; i++) {
|
|
24
|
+
const item = template({ index: i })
|
|
25
|
+
data.push(item)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return data
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function generatePick<T>(
|
|
32
|
+
array: Array<T>,
|
|
33
|
+
options?: { amount: number; allowRepeat?: boolean }
|
|
34
|
+
): T | Array<T> {
|
|
35
|
+
const { amount = 1, allowRepeat = true } = options || {}
|
|
36
|
+
|
|
37
|
+
if (amount === 1) {
|
|
38
|
+
return chance.pickone(array)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let picked = chance.pickset(array, amount)
|
|
42
|
+
|
|
43
|
+
if (!allowRepeat) {
|
|
44
|
+
picked = Array.from(new Set(picked))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return picked
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function generateDate(overrides: { month?: number; day?: number; year?: number } = {}): string {
|
|
51
|
+
const month = String(overrides.month ?? chance.natural({ min: 1, max: 12 })).padStart(2, '0')
|
|
52
|
+
const day = String(overrides.day ?? chance.natural({ min: 1, max: 28 })).padStart(2, '0')
|
|
53
|
+
const year = overrides.year ?? new Date().getFullYear()
|
|
54
|
+
|
|
55
|
+
return `${month}/${day}/${year}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function generateTime(opts?: Chance.Options): string {
|
|
59
|
+
const hour = String(chance.hour({ twentyfour: true, ...opts })).padStart(2, '0')
|
|
60
|
+
const minute = String(chance.minute()).padStart(2, '0')
|
|
61
|
+
|
|
62
|
+
return `${hour}:${minute}`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function generateUsername(): string {
|
|
66
|
+
const name = chance.name()
|
|
67
|
+
return name.replace(/^\s+|\s+$/g, '').toLowerCase()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function generateID(): string {
|
|
71
|
+
return nanoid()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface DataGenerator {
|
|
75
|
+
animal: () => string
|
|
76
|
+
array: <T>(template: ({ index }: { index: number }) => T, amount?: number) => Array<T>
|
|
77
|
+
boolean: () => boolean
|
|
78
|
+
company: () => string
|
|
79
|
+
date: () => string
|
|
80
|
+
float: (opts?: Chance.Options) => number
|
|
81
|
+
id: () => string
|
|
82
|
+
name: (opts?: Chance.Options) => string
|
|
83
|
+
natural: (opts?: Chance.Options) => number
|
|
84
|
+
paragraph: (opts?: Chance.Options) => string
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Use pickone or pickset
|
|
87
|
+
*/
|
|
88
|
+
pick: <T>(array: Array<T>, options?: { amount: number; allowRepeat?: boolean }) => T | Array<T>
|
|
89
|
+
pickone<T>(arr: T[]): T
|
|
90
|
+
pickset<T>(arr: T[], count?: number): T[]
|
|
91
|
+
profession: () => string
|
|
92
|
+
sentence: (opts?: Chance.Options) => string
|
|
93
|
+
state: (opts?: Chance.Options) => string
|
|
94
|
+
time: (opts?: Chance.Options) => string
|
|
95
|
+
token: () => string
|
|
96
|
+
url: () => string
|
|
97
|
+
username: () => string
|
|
98
|
+
word: (opts?: Chance.Options) => string
|
|
99
|
+
dollar: () => string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const generators: DataGenerator = {
|
|
103
|
+
animal: chance.animal.bind(chance),
|
|
104
|
+
array: generateArray,
|
|
105
|
+
boolean: chance.bool.bind(chance),
|
|
106
|
+
company: chance.company.bind(chance),
|
|
107
|
+
date: generateDate,
|
|
108
|
+
float: chance.floating.bind(chance),
|
|
109
|
+
id: generateID,
|
|
110
|
+
name: chance.name.bind(chance),
|
|
111
|
+
natural: chance.natural.bind(chance),
|
|
112
|
+
paragraph: chance.paragraph.bind(chance),
|
|
113
|
+
pick: generatePick,
|
|
114
|
+
pickone: chance.pickone.bind(chance),
|
|
115
|
+
pickset: chance.pickset.bind(chance),
|
|
116
|
+
profession: chance.profession.bind(chance),
|
|
117
|
+
sentence: chance.sentence.bind(chance),
|
|
118
|
+
state: chance.state.bind(chance),
|
|
119
|
+
time: generateTime,
|
|
120
|
+
token: chance.animal.bind(chance),
|
|
121
|
+
url: chance.url.bind(chance),
|
|
122
|
+
username: generateUsername,
|
|
123
|
+
word: chance.word.bind(chance),
|
|
124
|
+
dollar: chance.dollar.bind(chance),
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default generators
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
render,
|
|
3
|
+
fireEvent,
|
|
4
|
+
RenderOptions,
|
|
5
|
+
within,
|
|
6
|
+
waitFor,
|
|
7
|
+
waitForElementToBeRemoved,
|
|
8
|
+
act,
|
|
9
|
+
screen,
|
|
10
|
+
queries,
|
|
11
|
+
} from '@testing-library/react'
|
|
12
|
+
import userEvent from '@testing-library/user-event'
|
|
13
|
+
|
|
14
|
+
class Renderer {
|
|
15
|
+
result: React.ReactElement
|
|
16
|
+
|
|
17
|
+
constructor(children: React.ReactElement) {
|
|
18
|
+
this.result = children
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render(options?: Omit<RenderOptions, 'queries'>) {
|
|
22
|
+
return render(this.result, options)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function customRenderer(children: React.ReactElement): Renderer {
|
|
27
|
+
return new Renderer(children)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
act,
|
|
32
|
+
fireEvent as fire,
|
|
33
|
+
queries,
|
|
34
|
+
screen,
|
|
35
|
+
userEvent as user,
|
|
36
|
+
waitFor,
|
|
37
|
+
waitForElementToBeRemoved,
|
|
38
|
+
within,
|
|
39
|
+
}
|
package/src/theming/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ThemeProps } from 'styled-components'
|
|
2
1
|
import { isFunction } from '@loadsmart/utils-function'
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
import type { ThemeProps } from 'styled-components'
|
|
4
|
+
import type ThemeAlice from './themes/alice.theme'
|
|
4
5
|
|
|
5
6
|
export type ThemeToken = keyof typeof ThemeAlice
|
|
6
7
|
export type ThemeTokenValue = string | number
|