Skip to content

Commit 203b39b

Browse files
authored
Merge pull request #1169 from strapi/release/1.8.1
2 parents b65da9f + 53e2358 commit 203b39b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+916
-625
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"packages": ["packages/*", "docs"],
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"npmClient": "yarn",
55
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
66
}

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"vers": "lerna version --no-push --no-git-tag-version --no-private --force-publish"
3232
},
3333
"devDependencies": {
34-
"@babel/preset-react": "^7.22.3",
34+
"@babel/preset-react": "^7.22.5",
3535
"@juggle/resize-observer": "^3.4.0",
3636
"@rollup/plugin-typescript": "^11.1.1",
3737
"@strapi/eslint-config": "^0.1.2",
@@ -44,7 +44,7 @@
4444
"@types/jest": "^29.5.2",
4545
"@types/react": "18.2.7",
4646
"@types/react-dom": "18.2.4",
47-
"@typescript-eslint/eslint-plugin": "^5.59.1",
47+
"@typescript-eslint/eslint-plugin": "^5.60.0",
4848
"@typescript-eslint/parser": "^5.59.9",
4949
"@vitejs/plugin-react": "^4.0.0",
5050
"chokidar-cli": "^3.0.0",
@@ -62,7 +62,6 @@
6262
"eslint-plugin-react-hooks": "^4.6.0",
6363
"fs-extra": "^11.1.1",
6464
"husky": "8.0.3",
65-
"intl": "^1.2.5",
6665
"jest": "^29.5.0",
6766
"jest-environment-jsdom": "^29.5.0",
6867
"jest-styled-components": "^7.1.1",
@@ -71,7 +70,7 @@
7170
"prettier": "^2.8.8",
7271
"react": "^18.2.0",
7372
"react-dom": "^18.2.0",
74-
"rimraf": "^5.0.0",
73+
"rimraf": "^5.0.1",
7574
"tiny-glob": "^0.2.9",
7675
"typescript": "^5.1.3",
7776
"vite": "^4.3.9"

packages/primitives/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@strapi/ui-primitives",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"license": "MIT",
55
"type": "module",
66
"sideEffects": false,
@@ -29,12 +29,12 @@
2929
"@radix-ui/react-compose-refs": "^1.0.1",
3030
"@radix-ui/react-context": "^1.0.0",
3131
"@radix-ui/react-direction": "1.0.0",
32-
"@radix-ui/react-dismissable-layer": "^1.0.3",
32+
"@radix-ui/react-dismissable-layer": "^1.0.4",
3333
"@radix-ui/react-focus-guards": "1.0.1",
3434
"@radix-ui/react-focus-scope": "1.0.3",
3535
"@radix-ui/react-id": "^1.0.1",
3636
"@radix-ui/react-popper": "^1.1.2",
37-
"@radix-ui/react-portal": "^1.0.2",
37+
"@radix-ui/react-portal": "^1.0.3",
3838
"@radix-ui/react-primitive": "^1.0.3",
3939
"@radix-ui/react-slot": "^1.0.2",
4040
"@radix-ui/react-use-callback-ref": "^1.0.0",

packages/primitives/src/components/Collection/Collection.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name:
4343
listeners: new Set<Listener>(),
4444
});
4545

46-
const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {
46+
interface CollectionProviderProps {
47+
children?: React.ReactNode;
48+
scope: any;
49+
}
50+
51+
const CollectionProvider = (props: CollectionProviderProps) => {
4752
const { scope, children } = props;
4853
const ref = React.useRef<CollectionElement>(null);
4954
const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;

packages/primitives/src/components/Combobox/Combobox.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const ComboboxProviders = ({ children }: { children: React.ReactNode }) => (
117117
</PopperPrimitive.Root>
118118
);
119119

120-
const Combobox: React.FC<RootProps> = (props) => {
120+
const Combobox = (props: RootProps) => {
121121
const {
122122
allowCustomValue = false,
123123
autocomplete = 'none',
@@ -536,6 +536,10 @@ const ComboxboxTextInput = React.forwardRef<ComboboxInputElement, TextInputProps
536536
}
537537
})}
538538
onBlur={composeEventHandlers(props.onBlur, () => {
539+
if (context.open) {
540+
return;
541+
}
542+
539543
context.onVisuallyFocussedItemChange(null);
540544

541545
const [activeItem] = getItems().filter(
@@ -669,7 +673,7 @@ interface PortalProps extends Omit<IPortalProps, 'asChild'> {
669673
children?: React.ReactNode;
670674
}
671675

672-
const ComboboxPortal: React.FC<PortalProps> = (props) => {
676+
const ComboboxPortal = (props: PortalProps) => {
673677
return <PortalPrimitive asChild {...props} />;
674678
};
675679

packages/primitives/src/components/Select/Select.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ interface MultiSelectProps extends SharedSelectProps {
124124

125125
type SelectProps = SingleSelectProps | MultiSelectProps;
126126

127-
const Select: React.FC<SelectProps> = (props: ScopedProps<SelectProps>) => {
127+
const Select = (props: ScopedProps<SelectProps>) => {
128128
const {
129129
__scopeSelect,
130130
children,
@@ -499,7 +499,7 @@ interface SelectPortalProps extends Omit<PortalProps, 'asChild'> {
499499
children?: React.ReactNode;
500500
}
501501

502-
const SelectPortal: React.FC<SelectPortalProps> = (props: ScopedProps<SelectPortalProps>) => {
502+
const SelectPortal = (props: ScopedProps<SelectPortalProps>) => {
503503
return <PortalPrimitive asChild {...props} />;
504504
};
505505

packages/strapi-design-system/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@strapi/design-system",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"license": "MIT",
55
"type": "module",
66
"sideEffects": false,
@@ -22,10 +22,10 @@
2222
"@floating-ui/react-dom": "^1.3.0",
2323
"@internationalized/date": "^3.2.0",
2424
"@internationalized/number": "^3.2.0",
25-
"@radix-ui/react-dismissable-layer": "^1.0.3",
25+
"@radix-ui/react-dismissable-layer": "^1.0.4",
2626
"@radix-ui/react-dropdown-menu": "^2.0.5",
2727
"@radix-ui/react-focus-scope": "1.0.3",
28-
"@strapi/ui-primitives": "^1.8.0",
28+
"@strapi/ui-primitives": "^1.8.1",
2929
"@uiw/react-codemirror": "^4.21.3",
3030
"aria-hidden": "^1.2.3",
3131
"compute-scroll-into-view": "^3.0.3",
@@ -34,7 +34,7 @@
3434
},
3535
"devDependencies": {
3636
"@playwright/test": "1.33.0",
37-
"@strapi/icons": "^1.8.0",
37+
"@strapi/icons": "^1.8.1",
3838
"@types/react-router-dom": "^5.3.3",
3939
"@types/styled-components": "^5.1.26",
4040
"axe-playwright": "^1.2.3",
@@ -54,7 +54,7 @@
5454
"build": "yarn build:prod",
5555
"build:prod": "vite build",
5656
"clean": "rimraf dist node_modules",
57-
"generate:types": "tsc --noEmit false --emitDeclarationOnly --declarationDir dist",
57+
"generate:types": "tsc --noEmit false --declaration --emitDeclarationOnly --declarationDir dist",
5858
"lint": "eslint . --ext .js,.jsx,.tsx,.ts",
5959
"format": "yarn lint --fix",
6060
"test": "jest -c jest.config.js",

packages/strapi-design-system/src/Button/Button.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
107107
>
108108
{(startIcon || loading) && <Box aria-hidden>{loading ? <LoaderAnimated /> : startIcon}</Box>}
109109

110-
<Typography
111-
variant={size === 'S' ? 'pi' : undefined}
112-
fontWeight="bold"
113-
lineHeight={0}
114-
textColor="buttonNeutral0"
115-
>
110+
<Typography variant={size === 'S' ? 'pi' : undefined} fontWeight="bold" textColor="buttonNeutral0">
116111
{children}
117112
</Typography>
118113

packages/strapi-design-system/src/Combobox/Combobox.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export const ComboboxInput = ({
189189
<ComboboxPrimitive.Root
190190
autocomplete={autocomplete || (creatable ? 'list' : 'both')}
191191
onOpenChange={handleOpenChange}
192+
open={internalIsOpen}
192193
onTextValueChange={handleTextValueChange}
193194
textValue={internalTextValue}
194195
allowCustomValue={creatable || allowCustomValue}

packages/strapi-design-system/src/Combobox/__tests__/Combobox.spec.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ describe('Combobox', () => {
3535
expect(getByRole('combobox')).toHaveValue('Hamburger');
3636
});
3737

38+
/**
39+
* @see https://github.com/strapi/design-system/issues/1074
40+
*/
41+
it('should correctly change the text value and value of the combobox even if two items are very similarly named', async () => {
42+
const { getByRole, user } = render({
43+
options: [
44+
{
45+
value: 'strawberry1',
46+
children: 'Strawberry 1',
47+
},
48+
{
49+
value: 'strawberry2',
50+
children: 'Strawberry 2',
51+
},
52+
],
53+
});
54+
55+
getByRole('combobox').focus();
56+
57+
await user.type(getByRole('combobox'), 'Straw');
58+
59+
expect(getByRole('combobox')).toHaveValue('Strawberry 1');
60+
61+
await user.click(getByRole('option', { name: 'Strawberry 2' }));
62+
63+
expect(getByRole('combobox')).toHaveValue('Strawberry 2');
64+
});
65+
3866
describe('callbacks', () => {
3967
it('should fire onChange only when the value is changed not when the input does', async () => {
4068
const onChange = jest.fn();

0 commit comments

Comments
 (0)