@okta/odyssey-react-mui 1.14.8 → 1.15.9
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/CHANGELOG.md +54 -0
- package/README.md +4 -0
- package/dist/Autocomplete.js +84 -2
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Breadcrumbs.js +10 -1
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Button.js +2 -2
- package/dist/Button.js.map +1 -1
- package/dist/Callout.js.map +1 -1
- package/dist/Checkbox.js +8 -4
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/DataTable/DataTable.js +39 -10
- package/dist/DataTable/DataTable.js.map +1 -1
- package/dist/DataTable/index.js.map +1 -1
- package/dist/MenuButton.js.map +1 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/Select.js +34 -45
- package/dist/Select.js.map +1 -1
- package/dist/Tabs.js +21 -0
- package/dist/Tabs.js.map +1 -1
- package/dist/Tile.js +14 -18
- package/dist/Tile.js.map +1 -1
- package/dist/labs/DataFilters.js +98 -97
- package/dist/labs/DataFilters.js.map +1 -1
- package/dist/labs/index.js +0 -1
- package/dist/labs/index.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_cs.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_cs.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_da.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_da.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_de.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_de.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_el.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_el.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_es.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_es.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_fi.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_fi.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_fr.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_fr.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_hu.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_hu.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_id.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_id.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_it.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_it.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ja.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_ja.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ko.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_ko.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ms.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_ms.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_nb.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_nb.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_nl_NL.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ok_PL.js +34 -3
- package/dist/properties/ts/odyssey-react-mui_ok_PL.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ok_SK.js +34 -3
- package/dist/properties/ts/odyssey-react-mui_ok_SK.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_pl.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_pl.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_pt_BR.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ro.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_ro.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ru.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_ru.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_sv.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_sv.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_th.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_th.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_tr.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_tr.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_uk.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_uk.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_vi.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_vi.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_zh_CN.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_zh_TW.js +31 -3
- package/dist/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +7 -1
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/Button.d.ts +31 -15
- package/dist/src/Button.d.ts.map +1 -1
- package/dist/src/Callout.d.ts +1 -1
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +2 -3
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/DataTable/DataTable.d.ts +13 -6
- package/dist/src/DataTable/DataTable.d.ts.map +1 -1
- package/dist/src/DataTable/index.d.ts +2 -2
- package/dist/src/DataTable/index.d.ts.map +1 -1
- package/dist/src/MenuButton.d.ts +3 -4
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +3 -3
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/src/Tile.d.ts.map +1 -1
- package/dist/src/labs/DataFilters.d.ts +9 -1
- package/dist/src/labs/DataFilters.d.ts.map +1 -1
- package/dist/src/labs/index.d.ts +0 -1
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_da.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_de.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_el.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_es.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_id.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_it.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ok_PL.d.ts +33 -2
- package/dist/src/properties/ts/odyssey-react-mui_ok_PL.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ok_SK.d.ts +33 -2
- package/dist/src/properties/ts/odyssey-react-mui_ok_SK.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_th.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts +30 -2
- package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +25 -8
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +9 -7
- package/src/Autocomplete.tsx +124 -1
- package/src/Breadcrumbs.tsx +9 -1
- package/src/Button.tsx +32 -16
- package/src/Callout.tsx +1 -1
- package/src/Checkbox.tsx +4 -3
- package/src/CheckboxGroup.tsx +2 -5
- package/src/DataTable/DataTable.tsx +106 -26
- package/src/DataTable/index.tsx +1 -1
- package/src/MenuButton.tsx +11 -21
- package/src/RadioGroup.tsx +3 -3
- package/src/Select.tsx +84 -91
- package/src/Tabs.tsx +40 -1
- package/src/Tile.tsx +12 -14
- package/src/labs/DataFilters.tsx +211 -177
- package/src/labs/index.ts +0 -1
- package/src/properties/translations/odyssey-react-mui_cs.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_da.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_de.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_el.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_es.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_fi.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_fr.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_hu.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_id.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_it.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ja.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ko.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ms.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_nb.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_nl_NL.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ok_PL.properties +33 -2
- package/src/properties/translations/odyssey-react-mui_ok_SK.properties +33 -2
- package/src/properties/translations/odyssey-react-mui_pl.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_pt_BR.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ro.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_ru.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_sv.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_th.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_tr.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_uk.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_vi.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_zh_CN.properties +36 -3
- package/src/properties/translations/odyssey-react-mui_zh_TW.properties +36 -3
- package/src/properties/ts/odyssey-react-mui_cs.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_da.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_de.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_el.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_es.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_fi.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_fr.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_hu.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_id.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_it.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ja.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ko.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ms.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_nb.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_nl_NL.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ok_PL.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ok_SK.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_pl.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_pt_BR.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ro.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ru.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_sv.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_th.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_tr.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_uk.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_vi.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_zh_CN.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_zh_TW.ts +1 -1
- package/src/theme/components.tsx +28 -7
- package/dist/labs/VirtualizedAutocomplete.js +0 -134
- package/dist/labs/VirtualizedAutocomplete.js.map +0 -1
- package/dist/src/labs/VirtualizedAutocomplete.d.ts +0 -90
- package/dist/src/labs/VirtualizedAutocomplete.d.ts.map +0 -1
- package/src/labs/VirtualizedAutocomplete.tsx +0 -365
package/src/MenuButton.tsx
CHANGED
|
@@ -10,21 +10,17 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { memo, type ReactElement, useCallback, useMemo, useState } from "react";
|
|
14
13
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
MenuItem,
|
|
26
|
-
useUniqueId,
|
|
27
|
-
} from "./";
|
|
14
|
+
memo,
|
|
15
|
+
type ReactElement,
|
|
16
|
+
useCallback,
|
|
17
|
+
useMemo,
|
|
18
|
+
useState,
|
|
19
|
+
ReactNode,
|
|
20
|
+
} from "react";
|
|
21
|
+
import { Menu as MuiMenu, PopoverOrigin } from "@mui/material";
|
|
22
|
+
|
|
23
|
+
import { Button, buttonSizeValues, buttonVariantValues, useUniqueId } from "./";
|
|
28
24
|
import { ChevronDownIcon, MoreIcon } from "./icons.generated";
|
|
29
25
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
30
26
|
import { MenuContext, MenuContextType } from "./MenuContext";
|
|
@@ -45,13 +41,7 @@ export type MenuButtonProps = {
|
|
|
45
41
|
/**
|
|
46
42
|
* The <MenuItem> components within the Menu.
|
|
47
43
|
*/
|
|
48
|
-
children:
|
|
49
|
-
| ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>
|
|
50
|
-
| Array<
|
|
51
|
-
| ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>
|
|
52
|
-
| NullElement
|
|
53
|
-
>
|
|
54
|
-
| NullElement;
|
|
44
|
+
children: ReactNode | NullElement;
|
|
55
45
|
/**
|
|
56
46
|
* The end Icon on the trigggering Button
|
|
57
47
|
*/
|
package/src/RadioGroup.tsx
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
RadioGroup as MuiRadioGroup,
|
|
15
15
|
type RadioGroupProps as MuiRadioGroupProps,
|
|
16
16
|
} from "@mui/material";
|
|
17
|
-
import { memo,
|
|
17
|
+
import { memo, ReactNode, useCallback, useRef } from "react";
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { RadioProps } from "./Radio";
|
|
20
20
|
import { Field } from "./Field";
|
|
21
21
|
import {
|
|
22
22
|
FieldComponentProps,
|
|
@@ -29,7 +29,7 @@ export type RadioGroupProps = {
|
|
|
29
29
|
/**
|
|
30
30
|
* The Radio components within the group. Must include two or more.
|
|
31
31
|
*/
|
|
32
|
-
children:
|
|
32
|
+
children: ReactNode;
|
|
33
33
|
/**
|
|
34
34
|
* The text value of the Radio that should be selected by default
|
|
35
35
|
*/
|
package/src/Select.tsx
CHANGED
|
@@ -92,6 +92,7 @@ const NonInteractiveIcon = styled(CloseCircleFilledIcon, {
|
|
|
92
92
|
margin-inline-start: ${({ odysseyDesignTokens }) =>
|
|
93
93
|
odysseyDesignTokens.Spacing2};
|
|
94
94
|
margin-inline-end: -${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};
|
|
95
|
+
margin-block-end: -1px;
|
|
95
96
|
`;
|
|
96
97
|
|
|
97
98
|
const ChipsInnerContainer = styled(MuiBox, {
|
|
@@ -104,20 +105,9 @@ const ChipsInnerContainer = styled(MuiBox, {
|
|
|
104
105
|
display: flex;
|
|
105
106
|
flex-wrap: wrap;
|
|
106
107
|
gap: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};
|
|
107
|
-
pointer-events:
|
|
108
|
+
pointer-events: none;
|
|
108
109
|
opacity: ${({ isInteractive }) => (isInteractive ? 1 : 0)};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const ChipsSpacer = styled("div", {
|
|
112
|
-
shouldForwardProp: (prop) => prop !== "odysseyDesignTokens",
|
|
113
|
-
})<{
|
|
114
|
-
odysseyDesignTokens: DesignTokens;
|
|
115
|
-
}>`
|
|
116
|
-
display: inline-block;
|
|
117
|
-
border-color: transparent;
|
|
118
|
-
border-style: solid none;
|
|
119
|
-
border-width: 1px;
|
|
120
|
-
height: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing6};
|
|
110
|
+
min-height: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing6};
|
|
121
111
|
`;
|
|
122
112
|
|
|
123
113
|
export type SelectValueType<HasMultipleChoices> =
|
|
@@ -280,12 +270,14 @@ const Select = <
|
|
|
280
270
|
} = event;
|
|
281
271
|
if (controlledStateRef.current !== CONTROLLED) {
|
|
282
272
|
setInternalSelectedValues(
|
|
283
|
-
(typeof value === "string"
|
|
273
|
+
(typeof value === "string" && hasMultipleChoices
|
|
274
|
+
? value.split(",")
|
|
275
|
+
: value) as Value,
|
|
284
276
|
);
|
|
285
277
|
}
|
|
286
278
|
onChangeProp?.(event, child);
|
|
287
279
|
},
|
|
288
|
-
[onChangeProp],
|
|
280
|
+
[hasMultipleChoices, onChangeProp],
|
|
289
281
|
);
|
|
290
282
|
|
|
291
283
|
// Normalize the options array to accommodate the various
|
|
@@ -312,73 +304,74 @@ const Select = <
|
|
|
312
304
|
[options],
|
|
313
305
|
);
|
|
314
306
|
|
|
315
|
-
const
|
|
316
|
-
({
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
isInteractive: boolean;
|
|
322
|
-
}) => {
|
|
323
|
-
const removeSelection = (itemToRemove: string) => {
|
|
324
|
-
if (Array.isArray(internalSelectedValues)) {
|
|
325
|
-
const newValue = internalSelectedValues.filter(
|
|
326
|
-
(item: string) => item !== itemToRemove,
|
|
327
|
-
);
|
|
307
|
+
const removeSelectedValue = useCallback(
|
|
308
|
+
(selectedValue: string) => {
|
|
309
|
+
if (Array.isArray(internalSelectedValues)) {
|
|
310
|
+
const newValue = internalSelectedValues.filter(
|
|
311
|
+
(internalSelectedValue) => internalSelectedValue !== selectedValue,
|
|
312
|
+
);
|
|
328
313
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
314
|
+
const syntheticEvent = {
|
|
315
|
+
target: { value: newValue },
|
|
316
|
+
} as SelectChangeEvent<Value>;
|
|
332
317
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
318
|
+
onChange(syntheticEvent, null);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
[internalSelectedValues, onChange],
|
|
322
|
+
);
|
|
336
323
|
|
|
324
|
+
const Chips = useCallback(
|
|
325
|
+
({ isInteractive }: { isInteractive: boolean }) => {
|
|
337
326
|
const stopPropagation = (event: MouseEvent<SVGSVGElement>) =>
|
|
338
327
|
event.stopPropagation();
|
|
339
328
|
|
|
329
|
+
const hasNonInteractiveIcon =
|
|
330
|
+
!isInteractive &&
|
|
331
|
+
controlledStateRef.current === CONTROLLED &&
|
|
332
|
+
hasMultipleChoices;
|
|
333
|
+
|
|
340
334
|
return (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
controlledStateRef.current === CONTROLLED &&
|
|
356
|
-
hasMultipleChoices && (
|
|
335
|
+
Array.isArray(internalSelectedValues) && (
|
|
336
|
+
<ChipsInnerContainer
|
|
337
|
+
isInteractive={isInteractive}
|
|
338
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
339
|
+
>
|
|
340
|
+
{internalSelectedValues.map(
|
|
341
|
+
(item) =>
|
|
342
|
+
item?.length > 0 && (
|
|
343
|
+
<MuiChip
|
|
344
|
+
key={item}
|
|
345
|
+
label={
|
|
346
|
+
<>
|
|
347
|
+
{item}
|
|
348
|
+
{hasNonInteractiveIcon && (
|
|
357
349
|
<NonInteractiveIcon
|
|
358
350
|
odysseyDesignTokens={odysseyDesignTokens}
|
|
359
351
|
/>
|
|
360
352
|
)}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
353
|
+
</>
|
|
354
|
+
}
|
|
355
|
+
tabIndex={-1}
|
|
356
|
+
onDelete={
|
|
357
|
+
isInteractive && controlledStateRef.current === CONTROLLED
|
|
358
|
+
? () => removeSelectedValue(item)
|
|
359
|
+
: undefined
|
|
360
|
+
}
|
|
361
|
+
deleteIcon={
|
|
362
|
+
<CloseCircleFilledIcon
|
|
363
|
+
sx={{ pointerEvents: "auto" }}
|
|
364
|
+
// We need to stop event propagation on mouse down to prevent the deletion
|
|
365
|
+
// from being blocked by the Select list opening, and also ensure that
|
|
366
|
+
// the pointerEvent is registered even when the parent's are not
|
|
367
|
+
onMouseDown={stopPropagation}
|
|
368
|
+
/>
|
|
369
|
+
}
|
|
370
|
+
/>
|
|
371
|
+
),
|
|
372
|
+
)}
|
|
373
|
+
</ChipsInnerContainer>
|
|
374
|
+
)
|
|
382
375
|
);
|
|
383
376
|
},
|
|
384
377
|
[
|
|
@@ -386,13 +379,13 @@ const Select = <
|
|
|
386
379
|
hasMultipleChoices,
|
|
387
380
|
internalSelectedValues,
|
|
388
381
|
odysseyDesignTokens,
|
|
389
|
-
|
|
382
|
+
removeSelectedValue,
|
|
390
383
|
],
|
|
391
384
|
);
|
|
392
385
|
|
|
393
386
|
// Convert the options into the ReactNode children
|
|
394
387
|
// that will populate the <Select>
|
|
395
|
-
const
|
|
388
|
+
const renderedOptions = useMemo(
|
|
396
389
|
() =>
|
|
397
390
|
normalizedOptions.map((option, index) => {
|
|
398
391
|
if (option.type === "heading") {
|
|
@@ -413,22 +406,18 @@ const Select = <
|
|
|
413
406
|
>
|
|
414
407
|
{hasMultipleChoices && <MuiCheckbox checked={isSelected} />}
|
|
415
408
|
{option.text}
|
|
416
|
-
{!hasMultipleChoices &&
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
</ListItemSecondaryAction>
|
|
422
|
-
)}
|
|
409
|
+
{!hasMultipleChoices && internalSelectedValues === option.value && (
|
|
410
|
+
<ListItemSecondaryAction>
|
|
411
|
+
<CheckIcon />
|
|
412
|
+
</ListItemSecondaryAction>
|
|
413
|
+
)}
|
|
423
414
|
</MuiMenuItem>
|
|
424
415
|
);
|
|
425
416
|
}),
|
|
426
417
|
[hasMultipleChoices, normalizedOptions, internalSelectedValues],
|
|
427
418
|
);
|
|
428
|
-
|
|
429
419
|
const renderValue = useCallback(
|
|
430
|
-
(value: Value) =>
|
|
431
|
-
Array.isArray(value) && <Chips selection={value} isInteractive={false} />,
|
|
420
|
+
(value: Value) => Array.isArray(value) && <Chips isInteractive={false} />,
|
|
432
421
|
[Chips],
|
|
433
422
|
);
|
|
434
423
|
|
|
@@ -444,7 +433,6 @@ const Select = <
|
|
|
444
433
|
{...inputValues}
|
|
445
434
|
aria-describedby={ariaDescribedBy}
|
|
446
435
|
aria-errormessage={errorMessageElementId}
|
|
447
|
-
children={children}
|
|
448
436
|
id={id}
|
|
449
437
|
inputProps={{ "data-se": testId }}
|
|
450
438
|
inputRef={localInputRef}
|
|
@@ -456,16 +444,21 @@ const Select = <
|
|
|
456
444
|
onFocus={onFocus}
|
|
457
445
|
renderValue={hasMultipleChoices ? renderValue : undefined}
|
|
458
446
|
translate={translate}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
447
|
+
>
|
|
448
|
+
{renderedOptions}
|
|
449
|
+
</MuiSelect>
|
|
450
|
+
{hasMultipleChoices && (
|
|
451
|
+
<>
|
|
452
|
+
<ChipsPositioningContainer
|
|
453
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
454
|
+
>
|
|
455
|
+
<Chips isInteractive={true} />
|
|
456
|
+
</ChipsPositioningContainer>
|
|
457
|
+
</>
|
|
464
458
|
)}
|
|
465
459
|
</SelectContainer>
|
|
466
460
|
),
|
|
467
461
|
[
|
|
468
|
-
children,
|
|
469
462
|
Chips,
|
|
470
463
|
inputValues,
|
|
471
464
|
hasMultipleChoices,
|
|
@@ -474,10 +467,10 @@ const Select = <
|
|
|
474
467
|
onBlur,
|
|
475
468
|
onChange,
|
|
476
469
|
onFocus,
|
|
470
|
+
renderedOptions,
|
|
477
471
|
renderValue,
|
|
478
472
|
testId,
|
|
479
473
|
translate,
|
|
480
|
-
value,
|
|
481
474
|
],
|
|
482
475
|
);
|
|
483
476
|
|
package/src/Tabs.tsx
CHANGED
|
@@ -121,7 +121,15 @@ const Tabs = ({
|
|
|
121
121
|
onChange: onChangeProp,
|
|
122
122
|
}: TabsProps & Pick<HtmlProps, "ariaLabel">) => {
|
|
123
123
|
const [tabState, setTabState] = useState(initialValue ?? value ?? "0");
|
|
124
|
-
|
|
124
|
+
/*
|
|
125
|
+
The scrollButtons prop is initially set to `false`.
|
|
126
|
+
It's then reset to `auto` when the document is visible.
|
|
127
|
+
This prevents a rare bug where scroll buttons appear
|
|
128
|
+
when the component is rendered while hidden and the
|
|
129
|
+
screen is wide enough to not need scroll buttons.
|
|
130
|
+
*/
|
|
131
|
+
const [scrollButtons, setScrollButtons] =
|
|
132
|
+
useState<MuiTabListProps["scrollButtons"]>(false);
|
|
125
133
|
const onChange = useCallback<NonNullable<MuiTabListProps["onChange"]>>(
|
|
126
134
|
(event, value: string) => {
|
|
127
135
|
setTabState(value);
|
|
@@ -136,6 +144,36 @@ const Tabs = ({
|
|
|
136
144
|
}
|
|
137
145
|
}, [value]);
|
|
138
146
|
|
|
147
|
+
// listen for visibility change to reset scroll buttons override
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
// keep track of animation frame to cancel when needed
|
|
150
|
+
let animationFrame: number;
|
|
151
|
+
|
|
152
|
+
// called when unmounted or scroll buttons is reset
|
|
153
|
+
const cleanup = () => {
|
|
154
|
+
cancelAnimationFrame(animationFrame);
|
|
155
|
+
document.removeEventListener("visibilitychange", refreshScrollButtons);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Reset the scroll buttons override when the document becomes visible.
|
|
159
|
+
// If called, then the document is hidden because the event listener
|
|
160
|
+
// is only registered if the document is hidden
|
|
161
|
+
function refreshScrollButtons() {
|
|
162
|
+
animationFrame = requestAnimationFrame(() => {
|
|
163
|
+
cleanup();
|
|
164
|
+
setScrollButtons("auto");
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// don't override scroll buttons if it's already set to "auto"
|
|
169
|
+
if (scrollButtons !== "auto") {
|
|
170
|
+
document.addEventListener("visibilitychange", refreshScrollButtons);
|
|
171
|
+
}
|
|
172
|
+
return () => {
|
|
173
|
+
cleanup();
|
|
174
|
+
};
|
|
175
|
+
}, [scrollButtons]);
|
|
176
|
+
|
|
139
177
|
const renderTab = useCallback(
|
|
140
178
|
(tab: TabItemProps, index: number) => {
|
|
141
179
|
const {
|
|
@@ -177,6 +215,7 @@ const Tabs = ({
|
|
|
177
215
|
onChange={onChange}
|
|
178
216
|
aria-label={ariaLabel}
|
|
179
217
|
variant="scrollable"
|
|
218
|
+
scrollButtons={scrollButtons}
|
|
180
219
|
>
|
|
181
220
|
{tabs.map((tab, index) => renderTab(tab, index))}
|
|
182
221
|
</MuiTabList>
|
package/src/Tile.tsx
CHANGED
|
@@ -77,23 +77,21 @@ const ImageContainer = styled("div", {
|
|
|
77
77
|
})<{
|
|
78
78
|
odysseyDesignTokens: DesignTokens;
|
|
79
79
|
hasMenuButtonChildren: boolean;
|
|
80
|
-
}
|
|
81
|
-
display: flex
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
hasMenuButtonChildren ? odysseyDesignTokens.Spacing5 : 0};
|
|
88
|
-
`;
|
|
80
|
+
}>(({ odysseyDesignTokens, hasMenuButtonChildren }) => ({
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "flex-start",
|
|
83
|
+
maxHeight: `${TILE_IMAGE_HEIGHT}`,
|
|
84
|
+
marginBlockEnd: odysseyDesignTokens.Spacing5,
|
|
85
|
+
paddingRight: hasMenuButtonChildren ? odysseyDesignTokens.Spacing5 : 0,
|
|
86
|
+
}));
|
|
89
87
|
|
|
90
88
|
const MenuButtonContainer = styled("div", {
|
|
91
89
|
shouldForwardProp: (prop) => prop !== "odysseyDesignTokens",
|
|
92
|
-
})<{ odysseyDesignTokens: DesignTokens }
|
|
93
|
-
position: absolute
|
|
94
|
-
right:
|
|
95
|
-
top:
|
|
96
|
-
|
|
90
|
+
})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({
|
|
91
|
+
position: "absolute",
|
|
92
|
+
right: odysseyDesignTokens.Spacing3,
|
|
93
|
+
top: odysseyDesignTokens.Spacing3,
|
|
94
|
+
}));
|
|
97
95
|
|
|
98
96
|
const buttonProviderValue = { isFullWidth: true };
|
|
99
97
|
|