reshaped 2.4.5 → 2.4.7

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/bundle.css +1 -1
  3. package/bundle.js +8 -8
  4. package/components/Accordion/tests/Accordion.stories.js +1 -1
  5. package/components/Actionable/Actionable.js +4 -4
  6. package/components/Autocomplete/Autocomplete.js +8 -2
  7. package/components/Button/Button.js +1 -1
  8. package/components/Button/Button.module.css +1 -1
  9. package/components/Button/ButtonAligner.d.ts +4 -2
  10. package/components/Button/ButtonAligner.js +2 -8
  11. package/components/FormControl/FormControl.context.d.ts +53 -53
  12. package/components/MenuItem/MenuItem.js +1 -1
  13. package/components/MenuItem/MenuItem.module.css +1 -1
  14. package/components/MenuItem/MenuItemAligner.d.ts +2 -2
  15. package/components/MenuItem/MenuItemAligner.js +2 -4
  16. package/components/MenuItem/tests/MenuItem.stories.js +1 -1
  17. package/components/TextArea/TextArea.d.ts +5 -1
  18. package/components/TextArea/TextArea.js +3 -1
  19. package/components/TextArea/TextArea.module.css +1 -1
  20. package/components/TextArea/tests/TextArea.stories.d.ts +1 -0
  21. package/components/TextArea/tests/TextArea.stories.js +16 -0
  22. package/components/TextField/TextField.d.ts +5 -1
  23. package/components/TextField/TextField.js +3 -1
  24. package/components/TextField/TextField.module.css +1 -1
  25. package/components/TextField/tests/TextField.stories.d.ts +1 -0
  26. package/components/TextField/tests/TextField.stories.js +16 -0
  27. package/components/_private/Aligner/Aligner.d.ts +12 -0
  28. package/components/_private/Aligner/Aligner.js +18 -0
  29. package/components/_private/Aligner/Aligner.module.css +1 -0
  30. package/components/_private/Aligner/Aligner.types.d.ts +9 -0
  31. package/components/_private/Aligner/Aligner.types.js +1 -0
  32. package/components/_private/Aligner/index.d.ts +2 -0
  33. package/components/_private/Aligner/index.js +1 -0
  34. package/components/_private/Flyout/FlyoutTrigger.js +3 -12
  35. package/components/_private/Portal/Portal.d.ts +1 -1
  36. package/package.json +17 -17
  37. package/types/global.d.ts +1 -1
  38. package/config/next.d.ts +0 -4
  39. package/config/next.js +0 -22
@@ -0,0 +1,9 @@
1
+ import type * as G from "../../../types/global";
2
+ type Side = "start" | "end" | "top" | "bottom" | "inline" | "block" | "all";
3
+ export type Props = {
4
+ children: React.ReactElement;
5
+ side?: Side | Side[];
6
+ className?: G.ClassName;
7
+ attributes?: G.Attributes<"div", Props>;
8
+ };
9
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from "./Aligner";
2
+ export type { Props as AlignerProps } from "./Aligner.types";
@@ -0,0 +1 @@
1
+ export { default } from "./Aligner.js";
@@ -1,30 +1,21 @@
1
1
  "use client";
2
2
  import React from "react";
3
- import useHotkeys from "../../../hooks/useHotkeys.js";
4
- import * as keys from "../../../constants/keys.js";
5
3
  import { useFlyoutContext } from "./Flyout.context.js";
6
4
  const FlyoutTrigger = (props) => {
7
5
  const { children } = props;
8
- const { id, triggerElRef, triggerType, flyout, handleFocus, handleBlur, handleMouseEnter, handleMouseLeave, handleClick, handleOpen, trapFocusMode, } = useFlyoutContext();
9
- useHotkeys({
10
- [`${keys.UP},${keys.DOWN}`]: () => {
11
- if (flyout.status !== "idle")
12
- return;
13
- handleOpen();
14
- },
15
- }, [handleOpen, flyout.status], { ref: triggerElRef });
6
+ const { id, triggerElRef, triggerType, flyout, handleFocus, handleBlur, handleMouseEnter, handleMouseLeave, handleClick, trapFocusMode, } = useFlyoutContext();
16
7
  let childrenAttributes = {
17
8
  onBlur: handleBlur,
18
9
  ref: triggerElRef,
19
10
  };
20
- if (triggerType === "click") {
11
+ if (triggerType === "click" || trapFocusMode === "action-menu") {
21
12
  childrenAttributes.onClick = handleClick;
22
13
  }
23
14
  if (triggerType === "hover") {
24
15
  childrenAttributes.onMouseEnter = handleMouseEnter;
25
16
  childrenAttributes.onMouseLeave = handleMouseLeave;
26
17
  }
27
- if (triggerType === "hover" || triggerType === "focus") {
18
+ if ((triggerType === "hover" && trapFocusMode !== "action-menu") || triggerType === "focus") {
28
19
  childrenAttributes.onFocus = handleFocus;
29
20
  childrenAttributes["aria-describedby"] = id;
30
21
  }
@@ -6,7 +6,7 @@ export declare const usePortalScope: () => T.Context;
6
6
  * That gives Portal time to receive scope on first render
7
7
  */
8
8
  declare const Portal: {
9
- (props: T.Props): JSX.Element;
9
+ (props: T.Props): any;
10
10
  Scope: typeof PortalScope;
11
11
  };
12
12
  declare function PortalScope<T extends HTMLElement>(props: T.ScopeProps<T>): React.JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reshaped",
3
3
  "description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
4
- "version": "2.4.5",
4
+ "version": "2.4.7",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",
@@ -80,19 +80,19 @@
80
80
  ],
81
81
  "devDependencies": {
82
82
  "@size-limit/preset-big-lib": "9.0.0",
83
- "@storybook/addon-a11y": "7.4.0",
84
- "@storybook/react": "7.4.0",
85
- "@storybook/react-vite": "7.4.0",
86
- "@testing-library/jest-dom": "6.1.3",
83
+ "@storybook/addon-a11y": "7.4.6",
84
+ "@storybook/react": "7.4.6",
85
+ "@storybook/react-vite": "7.4.6",
86
+ "@testing-library/jest-dom": "6.1.4",
87
87
  "@testing-library/react": "14.0.0",
88
- "@testing-library/user-event": "14.4.3",
88
+ "@testing-library/user-event": "14.5.1",
89
89
  "@types/events": "3.0.0",
90
- "@types/jest": "29.5.4",
91
- "@types/node": "20.6.0",
92
- "@types/react": "18.2.21",
93
- "@types/react-dom": "18.2.7",
94
- "@typescript-eslint/eslint-plugin": "6.6.0",
95
- "@typescript-eslint/parser": "6.6.0",
90
+ "@types/jest": "29.5.5",
91
+ "@types/node": "20.8.6",
92
+ "@types/react": "18.2.28",
93
+ "@types/react-dom": "18.2.13",
94
+ "@typescript-eslint/eslint-plugin": "6.7.5",
95
+ "@typescript-eslint/parser": "6.7.5",
96
96
  "@vitejs/plugin-react": "4.0.4",
97
97
  "chromatic": "7.1.0",
98
98
  "eslint": "8.49.0",
@@ -104,11 +104,11 @@
104
104
  "eslint-plugin-react": "7.33.2",
105
105
  "eslint-plugin-react-hooks": "4.6.0",
106
106
  "identity-obj-proxy": "3.0.0",
107
- "jest": "29.6.4",
108
- "jest-environment-jsdom": "29.6.4",
107
+ "jest": "29.7.0",
108
+ "jest-environment-jsdom": "29.7.0",
109
109
  "jest-matchmedia-mock": "1.1.0",
110
- "lefthook": "1.4.10",
111
- "postcss": "8.4.29",
110
+ "lefthook": "1.5.2",
111
+ "postcss": "8.4.31",
112
112
  "postcss-cli": "10.1.0",
113
113
  "postcss-each": "1.1.0",
114
114
  "postcss-import": "15.1.0",
@@ -118,7 +118,7 @@
118
118
  "react-dom": "18.2.0",
119
119
  "resolve-tspaths": "0.8.15",
120
120
  "size-limit": "9.0.0",
121
- "storybook": "7.4.0",
121
+ "storybook": "7.4.6",
122
122
  "stylelint": "15.10.3",
123
123
  "stylelint-config-prettier": "9.0.5",
124
124
  "stylelint-config-standard": "34.0.0",
package/types/global.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  type ClassNameValue = string | null | undefined | false;
3
- export type ClassName = ClassNameValue | ClassNameValue[];
3
+ export type ClassName = ClassNameValue | ClassNameValue[] | ClassName[];
4
4
  export type CSSVariable = `--${string}`;
5
5
  export type StyleAttribute = React.CSSProperties & Record<CSSVariable, string | number | undefined>;
6
6
  type DataAttributes = Record<`data-${string}`, string | boolean>;
package/config/next.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * TODO: Work in progress
3
- * Needs named exports support before we can use it
4
- */
package/config/next.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /**
3
- * TODO: Work in progress
4
- * Needs named exports support before we can use it
5
- */
6
- // export const config = {
7
- // modularizeImports: {
8
- // reshaped: {
9
- // transform: {
10
- // // Utilities
11
- // // classNames: "reshaped/utilities/classNames",
12
- // // Hooks
13
- // useToast: "reshaped/components/Toast",
14
- // useFormControl: "reshaped/components/FormControl",
15
- // useTheme: "reshaped/components/Theme",
16
- // "use.*": "reshaped/hooks/{{ member }}",
17
- // // Components
18
- // "*": "reshaped/components/{{ member }}",
19
- // },
20
- // },
21
- // },
22
- // };