@loadsmart/loadsmart-ui 5.13.1 → 5.14.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/Select/useSelect.helpers.d.ts +2 -1
- package/dist/components/Select/useSelect.test.d.ts +1 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/index.js +58 -46
- package/dist/index.js.map +1 -1
- package/dist/miranda-compatibility.theme-bb0cbfb2.js +2 -0
- package/dist/miranda-compatibility.theme-bb0cbfb2.js.map +1 -0
- package/dist/prop-73352de5.js +2 -0
- package/dist/{prop-0f94ff83.js.map → prop-73352de5.js.map} +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/theming/index.js +1 -1
- package/dist/theming/index.js.map +1 -1
- package/dist/theming/themes/alice.theme.d.ts +171 -9
- package/dist/theming/themes/index.d.ts +1 -0
- package/dist/theming/themes/loadsmart.theme.d.ts +83 -9
- package/dist/theming/themes/miranda-compatibility.theme.d.ts +745 -0
- package/dist/theming/theming.helpers.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/package.json +4 -2
- package/src/addons/Theme/register.js +2 -1
- package/src/components/Dropdown/DropdownMenu.tsx +1 -1
- package/src/components/Dropdown/DropdownTrigger.tsx +6 -4
- package/src/components/Select/SelectOption.tsx +4 -7
- package/src/components/Select/useSelect.helpers.test.ts +63 -1
- package/src/components/Select/useSelect.helpers.ts +9 -2
- package/src/components/Select/useSelect.test.ts +207 -0
- package/src/components/Select/useSelect.ts +8 -2
- package/src/components/SideNavigation/Menu/Menu.tsx +4 -3
- package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +1 -1
- package/src/components/SideNavigation/Menu/MenuLink.tsx +4 -5
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
- package/src/components/Steps/ProgressSteps/ProgressStep.tsx +9 -7
- package/src/components/ToggleGroup/Toggle.tsx +58 -33
- package/src/components/ToggleGroup/ToggleGroup.tsx +32 -19
- package/src/theming/themes/alice.theme.ts +111 -20
- package/src/theming/themes/index.ts +1 -0
- package/src/theming/themes/loadsmart.theme.ts +100 -9
- package/src/theming/themes/miranda-compatibility.theme.ts +900 -0
- package/src/theming/theming.helpers.ts +6 -0
- package/dist/loadsmart.theme-63c13988.js +0 -2
- package/dist/loadsmart.theme-63c13988.js.map +0 -1
- package/dist/prop-0f94ff83.js +0 -2
|
@@ -18,4 +18,5 @@ export declare function generateBorderGetters({ radiuses, widths, }: {
|
|
|
18
18
|
radiuses: VariableMap;
|
|
19
19
|
widths: VariableMap;
|
|
20
20
|
}): Record<string, (name: string) => VariableValue>;
|
|
21
|
+
export declare function generateHeightGetter(heights: VariableMap): (name: string) => VariableValue;
|
|
21
22
|
export {};
|
package/dist/tools/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../prop-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../prop-73352de5.js");require("../toArray-b56541b4.js"),require("../miranda-compatibility.theme-bb0cbfb2.js"),require("@loadsmart/miranda-tokens"),require("../theming/index.js"),exports.conditional=e.conditional,exports.prop=e.prop,exports.whenProps=e.whenProps;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadsmart/loadsmart-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.0",
|
|
4
4
|
"description": "Miranda UI, a React UI library",
|
|
5
5
|
"main": "dist",
|
|
6
6
|
"files": [
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@babel/preset-typescript": "7.13.0",
|
|
79
79
|
"@commitlint/cli": "16.0.2",
|
|
80
80
|
"@commitlint/config-conventional": "16.0.0",
|
|
81
|
+
"@loadsmart/miranda-tokens": "1.3.0",
|
|
81
82
|
"@loadsmart/stylelint-config": "0.0.3",
|
|
82
83
|
"@rollup/plugin-babel": "5.3.0",
|
|
83
84
|
"@rollup/plugin-commonjs": "19.0.0",
|
|
@@ -172,11 +173,12 @@
|
|
|
172
173
|
"typescript-plugin-styled-components": "1.5.0"
|
|
173
174
|
},
|
|
174
175
|
"peerDependencies": {
|
|
176
|
+
"@loadsmart/miranda-tokens": "1.3.0",
|
|
175
177
|
"@testing-library/dom": ">=5.12.0",
|
|
176
178
|
"@testing-library/react": ">=11.2.6",
|
|
177
179
|
"prop-types": ">=15.7.2",
|
|
178
|
-
"react": ">=16.8.0",
|
|
179
180
|
"react-dom": ">=16.8.0",
|
|
181
|
+
"react": ">=16.8.0",
|
|
180
182
|
"styled-components": ">=5.3.0"
|
|
181
183
|
},
|
|
182
184
|
"dependencies": {
|
|
@@ -18,8 +18,9 @@ import loadsmart, {
|
|
|
18
18
|
SHADOWS,
|
|
19
19
|
SPACINGS,
|
|
20
20
|
} from '../../theming/themes/loadsmart.theme'
|
|
21
|
+
import miranda from '../../theming/themes/miranda-compatibility.theme'
|
|
21
22
|
|
|
22
|
-
const THEMES = { alice, loadsmart }
|
|
23
|
+
const THEMES = { alice, loadsmart, miranda }
|
|
23
24
|
|
|
24
25
|
const TOKEN_PARAM_KEY = 'tokenPrefix'
|
|
25
26
|
|
|
@@ -26,7 +26,7 @@ import conditional, { whenProps } from 'tools/conditional'
|
|
|
26
26
|
|
|
27
27
|
const Popover = styled(DefaultPopover)<{ $align: 'start' | 'end' }>`
|
|
28
28
|
position: absolute;
|
|
29
|
-
top: calc(
|
|
29
|
+
top: calc(${token('dropdown-trigger-height')} + ${token('space-xs')});
|
|
30
30
|
|
|
31
31
|
${conditional({
|
|
32
32
|
'left: 0;': whenProps({ $align: 'start' }),
|
|
@@ -37,7 +37,7 @@ type TriggerButtonProps = ButtonProps & {
|
|
|
37
37
|
|
|
38
38
|
const dropdownExpandedStyle = css`
|
|
39
39
|
&[aria-expanded='true'] {
|
|
40
|
-
color: ${token('color
|
|
40
|
+
color: ${token('dropdown-trigger-expanded-color')};
|
|
41
41
|
}
|
|
42
42
|
`
|
|
43
43
|
|
|
@@ -120,8 +120,8 @@ const TriggerButton = styled(
|
|
|
120
120
|
|
|
121
121
|
visibility: hidden;
|
|
122
122
|
|
|
123
|
-
/* @REVIEW: since this is a span descendant of a button
|
|
124
|
-
I'm using the direct value of children the solution inside Link
|
|
123
|
+
/* @REVIEW: since this is a span descendant of a button
|
|
124
|
+
I'm using the direct value of children the solution inside Link
|
|
125
125
|
relies on data-text attribute */
|
|
126
126
|
|
|
127
127
|
content: '${children}';
|
|
@@ -163,7 +163,9 @@ const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
|
|
|
163
163
|
|
|
164
164
|
color: ${token('color-neutral-darker')};
|
|
165
165
|
|
|
166
|
-
height:
|
|
166
|
+
height: ${token('dropdown-trigger-height')};
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
|
|
167
169
|
flex: 1;
|
|
168
170
|
|
|
169
171
|
${hoverable`
|
|
@@ -22,17 +22,14 @@ const Group = styled(DefaultGroup).attrs({
|
|
|
22
22
|
`
|
|
23
23
|
|
|
24
24
|
const Icon = styled(DefaultIcon)`
|
|
25
|
-
color: ${token('color
|
|
25
|
+
color: ${token('select-selected-option-check-color')};
|
|
26
26
|
`
|
|
27
27
|
|
|
28
28
|
const DefaultSelectOption = styled(Dropdown.Item)<DropdownMenuItemProps>`
|
|
29
29
|
background: ${conditional({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'33': whenProps({ 'aria-selected': true }),
|
|
34
|
-
ff: whenProps({ 'aria-selected': false }),
|
|
35
|
-
})};
|
|
30
|
+
'select-selected-option-background-color': whenProps({ 'aria-selected': true }),
|
|
31
|
+
'color-neutral-white': whenProps({ 'aria-selected': false }),
|
|
32
|
+
})};
|
|
36
33
|
`
|
|
37
34
|
|
|
38
35
|
function SelectOption({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDisplayValue, getValue } from './useSelect.helpers'
|
|
1
|
+
import { getDisplayValue, getValue, toSelection } from './useSelect.helpers'
|
|
2
2
|
import generator from '../../tests/generator'
|
|
3
3
|
|
|
4
4
|
import type { SelectAdapter, SelectValue, Option } from './Select.types'
|
|
@@ -60,6 +60,15 @@ describe('useSelect helpers', () => {
|
|
|
60
60
|
|
|
61
61
|
expect(getDisplayValue(adapters, selection, multiple)).toEqual(adapter.getLabel(item))
|
|
62
62
|
})
|
|
63
|
+
|
|
64
|
+
it('returns empty string as display value when selection label is undefined', () => {
|
|
65
|
+
const selection: SelectValue = new Map().set(undefined, {
|
|
66
|
+
label: undefined,
|
|
67
|
+
value: undefined,
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
expect(getDisplayValue(adapters, selection, multiple)).toEqual('')
|
|
71
|
+
})
|
|
63
72
|
})
|
|
64
73
|
|
|
65
74
|
describe('multiple selection', () => {
|
|
@@ -118,5 +127,58 @@ describe('useSelect helpers', () => {
|
|
|
118
127
|
|
|
119
128
|
expect(getDisplayValue(adapters, selection, multiple)).toEqual('')
|
|
120
129
|
})
|
|
130
|
+
|
|
131
|
+
it('returns empty string as display value when selection label is undefined', () => {
|
|
132
|
+
const selection: SelectValue = new Map().set(undefined, {
|
|
133
|
+
label: undefined,
|
|
134
|
+
value: undefined,
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
expect(getDisplayValue(adapters, selection, multiple)).toEqual('')
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
describe('getSelection', () => {
|
|
142
|
+
it('initializes correctly when a null value is provided', () => {
|
|
143
|
+
expect(toSelection(null)).toEqual([])
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('initializes correctly when an undefined value is provided', () => {
|
|
147
|
+
expect(toSelection(undefined)).toEqual([])
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('initializes correctly when a valid value is provided', () => {
|
|
151
|
+
expect(
|
|
152
|
+
toSelection({
|
|
153
|
+
value: 'some-value',
|
|
154
|
+
label: 'Some label',
|
|
155
|
+
} as Option)
|
|
156
|
+
).toEqual([
|
|
157
|
+
{
|
|
158
|
+
value: 'some-value',
|
|
159
|
+
label: 'Some label',
|
|
160
|
+
},
|
|
161
|
+
])
|
|
162
|
+
|
|
163
|
+
expect(
|
|
164
|
+
toSelection([
|
|
165
|
+
{
|
|
166
|
+
value: 'some-value-1',
|
|
167
|
+
label: 'Some label 1',
|
|
168
|
+
} as Option,
|
|
169
|
+
])
|
|
170
|
+
).toEqual([
|
|
171
|
+
{
|
|
172
|
+
value: 'some-value-1',
|
|
173
|
+
label: 'Some label 1',
|
|
174
|
+
},
|
|
175
|
+
])
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
it('initializes correctly when an empty value is provided', () => {
|
|
179
|
+
expect(toSelection([])).toEqual([])
|
|
180
|
+
expect(toSelection({})).toEqual([])
|
|
181
|
+
expect(toSelection([{}])).toEqual([])
|
|
182
|
+
})
|
|
121
183
|
})
|
|
122
184
|
})
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { GenericAdapter } from './Select.constants'
|
|
3
3
|
import isEmpty from 'utils/toolset/isEmpty'
|
|
4
|
+
import toArray from 'utils/toolset/toArray'
|
|
4
5
|
|
|
5
|
-
import type { SelectAdapter, SelectValue, Option, Adapters } from './Select.types'
|
|
6
|
+
import type { SelectAdapter, SelectValue, Option, Adapters, SelectProps } from './Select.types'
|
|
6
7
|
|
|
7
8
|
export function getAdapter(adapters: Adapters, type?: string): SelectAdapter<any> {
|
|
8
9
|
if (type == null) {
|
|
@@ -32,6 +33,12 @@ export function getValue(selection: SelectValue, multiple?: boolean): Option | O
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
export function toSelection(value: SelectProps['value']): Option[] {
|
|
37
|
+
const safeValue = toArray(value || [])
|
|
38
|
+
|
|
39
|
+
return safeValue.filter((option) => !isEmpty(option))
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
export function getDisplayValue(
|
|
36
43
|
adapters: Adapters,
|
|
37
44
|
selection: SelectValue,
|
|
@@ -46,7 +53,7 @@ export function getDisplayValue(
|
|
|
46
53
|
} else {
|
|
47
54
|
const value = getValue(selection, multiple)
|
|
48
55
|
const adapter = getAdapter(adapters, (value as Option)._type)
|
|
49
|
-
return adapter.getLabel(value)
|
|
56
|
+
return adapter.getLabel(value) ?? ''
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react-hooks'
|
|
2
|
+
|
|
3
|
+
import useSelect from './useSelect'
|
|
4
|
+
import type { SelectProps, Option } from './Select.types'
|
|
5
|
+
|
|
6
|
+
describe('useSelect', () => {
|
|
7
|
+
describe('single selection', () => {
|
|
8
|
+
it('initializes correctly when no value is provided', () => {
|
|
9
|
+
const props: SelectProps = {
|
|
10
|
+
multiple: false,
|
|
11
|
+
name: 'anything',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { result } = renderHook(() => useSelect(props))
|
|
15
|
+
const expectedSelected = new Map()
|
|
16
|
+
|
|
17
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
18
|
+
expect(result.current.query).toBe('')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('initializes correctly when a null value is provided', () => {
|
|
22
|
+
const props: SelectProps = {
|
|
23
|
+
multiple: false,
|
|
24
|
+
name: 'anything',
|
|
25
|
+
value: null,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { result } = renderHook(() => useSelect(props))
|
|
29
|
+
const expectedSelected = new Map()
|
|
30
|
+
|
|
31
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
32
|
+
expect(result.current.query).toBe('')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('initializes correctly when an undefined value is provided', () => {
|
|
36
|
+
const props: SelectProps = {
|
|
37
|
+
multiple: false,
|
|
38
|
+
name: 'anything',
|
|
39
|
+
value: undefined,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const { result } = renderHook(() => useSelect(props))
|
|
43
|
+
const expectedSelected = new Map()
|
|
44
|
+
|
|
45
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
46
|
+
expect(result.current.query).toBe('')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('initializes correctly when a valid value is provided', () => {
|
|
50
|
+
const props: SelectProps = {
|
|
51
|
+
multiple: false,
|
|
52
|
+
name: 'anything',
|
|
53
|
+
value: {
|
|
54
|
+
value: 'some-value',
|
|
55
|
+
label: 'Some label',
|
|
56
|
+
} as Option,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { result } = renderHook(() => useSelect(props))
|
|
60
|
+
const expectedSelected = new Map().set('some-value', {
|
|
61
|
+
value: 'some-value',
|
|
62
|
+
label: 'Some label',
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
66
|
+
expect(result.current.query).toBe('Some label')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('initializes correctly when an invalid value is provided', () => {
|
|
70
|
+
const props: SelectProps = {
|
|
71
|
+
multiple: false,
|
|
72
|
+
name: 'anything',
|
|
73
|
+
value: {
|
|
74
|
+
label: undefined,
|
|
75
|
+
value: undefined,
|
|
76
|
+
} as Option,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const { result } = renderHook(() => useSelect(props))
|
|
80
|
+
const expectedSelected = new Map().set(undefined, {
|
|
81
|
+
label: undefined,
|
|
82
|
+
value: undefined,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
86
|
+
expect(result.current.query).toBe('')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('initializes correctly when an empty value is provided', () => {
|
|
90
|
+
const props: SelectProps = {
|
|
91
|
+
multiple: false,
|
|
92
|
+
name: 'anything',
|
|
93
|
+
value: {},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const { result } = renderHook(() => useSelect(props))
|
|
97
|
+
const expectedSelected = new Map()
|
|
98
|
+
|
|
99
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
100
|
+
expect(result.current.query).toBe('')
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
describe('multiple selection', () => {
|
|
105
|
+
it('initializes correctly when no value is provided', () => {
|
|
106
|
+
const props: SelectProps = {
|
|
107
|
+
multiple: true,
|
|
108
|
+
name: 'anything',
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const { result } = renderHook(() => useSelect(props))
|
|
112
|
+
const expectedSelected = new Map()
|
|
113
|
+
|
|
114
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
115
|
+
expect(result.current.query).toBe('')
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('initializes correctly when a null value is provided', () => {
|
|
119
|
+
const props: SelectProps = {
|
|
120
|
+
multiple: true,
|
|
121
|
+
name: 'anything',
|
|
122
|
+
value: null,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const { result } = renderHook(() => useSelect(props))
|
|
126
|
+
const expectedSelected = new Map()
|
|
127
|
+
|
|
128
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
129
|
+
expect(result.current.query).toBe('')
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('initializes correctly when an undefined value is provided', () => {
|
|
133
|
+
const props: SelectProps = {
|
|
134
|
+
multiple: true,
|
|
135
|
+
name: 'anything',
|
|
136
|
+
value: undefined,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const { result } = renderHook(() => useSelect(props))
|
|
140
|
+
|
|
141
|
+
const expectedSelected = new Map()
|
|
142
|
+
|
|
143
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
144
|
+
expect(result.current.query).toBe('')
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('initializes correctly when a valid value is provided', () => {
|
|
148
|
+
const props: SelectProps = {
|
|
149
|
+
multiple: true,
|
|
150
|
+
name: 'anything',
|
|
151
|
+
value: [
|
|
152
|
+
{
|
|
153
|
+
value: 'some-value',
|
|
154
|
+
label: 'Some label',
|
|
155
|
+
} as Option,
|
|
156
|
+
],
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const { result } = renderHook(() => useSelect(props))
|
|
160
|
+
|
|
161
|
+
const expectedSelected = new Map().set('some-value', {
|
|
162
|
+
value: 'some-value',
|
|
163
|
+
label: 'Some label',
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
167
|
+
expect(result.current.query).toBe('')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('initializes correctly when an invalid value is provided', () => {
|
|
171
|
+
const props: SelectProps = {
|
|
172
|
+
multiple: true,
|
|
173
|
+
name: 'anything',
|
|
174
|
+
value: [
|
|
175
|
+
{
|
|
176
|
+
label: undefined,
|
|
177
|
+
value: undefined,
|
|
178
|
+
} as Option,
|
|
179
|
+
],
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const { result } = renderHook(() => useSelect(props))
|
|
183
|
+
const expectedSelected = new Map().set(undefined, {
|
|
184
|
+
label: undefined,
|
|
185
|
+
value: undefined,
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
189
|
+
expect(result.current.query).toBe('')
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
it('initializes correctly when an empty value is provided', () => {
|
|
193
|
+
const props: SelectProps = {
|
|
194
|
+
multiple: true,
|
|
195
|
+
name: 'anything',
|
|
196
|
+
value: [{}],
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const { result } = renderHook(() => useSelect(props))
|
|
200
|
+
|
|
201
|
+
const expectedSelected = new Map()
|
|
202
|
+
|
|
203
|
+
expect(result.current.selectable.selected).toEqual(expectedSelected)
|
|
204
|
+
expect(result.current.query).toBe('')
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
})
|
|
@@ -13,7 +13,13 @@ import { isThenable } from 'utils/toolset/isThenable'
|
|
|
13
13
|
import toArray from 'utils/toolset/toArray'
|
|
14
14
|
import { GenericAdapter } from './Select.constants'
|
|
15
15
|
import { useSelectable } from './Select.context'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
escapeRegExp,
|
|
18
|
+
getAdapter,
|
|
19
|
+
getDisplayValue,
|
|
20
|
+
getValue,
|
|
21
|
+
toSelection,
|
|
22
|
+
} from './useSelect.helpers'
|
|
17
23
|
|
|
18
24
|
import type { ChangeEvent, FocusEvent } from 'react'
|
|
19
25
|
import type {
|
|
@@ -213,7 +219,7 @@ function useSelect(props: SelectProps): useSelectReturn {
|
|
|
213
219
|
const adapters = useMemo<Adapters>(() => extractAdapters(datasources), [datasources])
|
|
214
220
|
|
|
215
221
|
const selectable = useSelectable({
|
|
216
|
-
selected:
|
|
222
|
+
selected: toSelection(props.value),
|
|
217
223
|
multiple,
|
|
218
224
|
adapters,
|
|
219
225
|
onChange: useCallback(
|
|
@@ -15,9 +15,10 @@ const MenuTitle = styled.div`
|
|
|
15
15
|
padding-left: ${token('space-l')};
|
|
16
16
|
|
|
17
17
|
color: ${token('color-neutral')};
|
|
18
|
-
|
|
19
|
-
font-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
font-weight: ${token('side-navigation-menu-title-font-weight')};
|
|
20
|
+
font-size: ${token('side-navigation-menu-title-font-size')};
|
|
21
|
+
line-height: ${token('side-navigation-menu-title-line-height')};
|
|
21
22
|
text-transform: uppercase;
|
|
22
23
|
`
|
|
23
24
|
|
|
@@ -8,16 +8,15 @@ import MenuBaseItem from './MenuBaseItem'
|
|
|
8
8
|
|
|
9
9
|
const StyledMenuItem = styled((props) => <MenuBaseItem as="a" {...props} />)`
|
|
10
10
|
${hoverable`
|
|
11
|
-
color: ${token('color
|
|
11
|
+
color: ${token('side-navigation-menu-link-color--hover')};
|
|
12
12
|
`}
|
|
13
13
|
|
|
14
14
|
${({ active }) =>
|
|
15
15
|
active
|
|
16
16
|
? css`
|
|
17
|
-
color: ${token('color
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
box-shadow: inset ${token('space-xs')} 0px ${token('color-primary')};
|
|
17
|
+
background-color: ${token('side-navigation-menu-link-background-color--active')};
|
|
18
|
+
box-shadow: inset ${token('space-xs')} 0
|
|
19
|
+
${token('side-navigation-menu-link-box-shadow-color--active')};
|
|
21
20
|
`
|
|
22
21
|
: ''}
|
|
23
22
|
`
|
|
@@ -31,8 +31,8 @@ const StepConnector = styled.span<{ complete: boolean }>`
|
|
|
31
31
|
})};
|
|
32
32
|
|
|
33
33
|
background: ${conditional({
|
|
34
|
-
'color
|
|
35
|
-
'color
|
|
34
|
+
'steps-progress-step-background-color': whenProps({ complete: false }),
|
|
35
|
+
'steps-progress-step-background-color--complete': whenProps({ complete: true }),
|
|
36
36
|
})};
|
|
37
37
|
`
|
|
38
38
|
|
|
@@ -79,16 +79,18 @@ const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
|
|
|
79
79
|
border-width: 2px;
|
|
80
80
|
border-style: solid;
|
|
81
81
|
border-color: ${conditional({
|
|
82
|
-
'color
|
|
82
|
+
'steps-progress-step-background-color--complete': whenProps([
|
|
83
83
|
{ current: true, complete: [true, false] },
|
|
84
84
|
{ current: false, complete: true },
|
|
85
85
|
]),
|
|
86
|
-
'color
|
|
86
|
+
'steps-progress-step-background-color': whenProps({ current: false, complete: false }),
|
|
87
87
|
})};
|
|
88
88
|
border-radius: ${token('border-radius-circle')};
|
|
89
89
|
|
|
90
90
|
background: ${conditional({
|
|
91
|
-
'color
|
|
91
|
+
'steps-progress-step-background-color--complete': whenProps([
|
|
92
|
+
{ current: false, complete: true },
|
|
93
|
+
]),
|
|
92
94
|
'color-neutral-white': whenProps([
|
|
93
95
|
{ current: true, complete: [true, false] },
|
|
94
96
|
{ current: false, complete: false },
|
|
@@ -96,9 +98,9 @@ const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
|
|
|
96
98
|
})};
|
|
97
99
|
|
|
98
100
|
color: ${conditional({
|
|
99
|
-
'color
|
|
101
|
+
'steps-progress-step-background-color': whenProps({ current: false, complete: false }),
|
|
100
102
|
'color-neutral-white': whenProps({ current: false, complete: true }),
|
|
101
|
-
'color
|
|
103
|
+
'steps-progress-step-background-color--complete': whenProps({ current: true }),
|
|
102
104
|
})};
|
|
103
105
|
`
|
|
104
106
|
|