reshaped 3.0.11-rc.3 → 3.1.1

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.
@@ -36,7 +36,7 @@ const CarouselControl = (props) => {
36
36
  if (timer)
37
37
  clearTimeout(timer);
38
38
  };
39
- }, [scrollPosition, scrollElRef.current, mounted]);
39
+ }, [scrollPosition, scrollElRef, mounted, isNext]);
40
40
  return (_jsx("div", { className: controlClassNames, "aria-hidden": "true", children: _jsx(Button, { onClick: onClick, icon: isDisplayedAsNext ? IconChevronRight : IconChevronLeft, rounded: true, variant: "outline", elevated: true, attributes: { "aria-disabled": !visible } }) }));
41
41
  };
42
42
  export default CarouselControl;
@@ -54,5 +54,6 @@ export const base = () => (<Example>
54
54
  </Resizable>
55
55
  </Resizable.Item>
56
56
  </Resizable>
57
+ <div style={{ height: 2000 }}/>
57
58
  </Example.Item>
58
59
  </Example>);
@@ -4,14 +4,14 @@ export declare const TabsProvider: React.Provider<T.Context>;
4
4
  export declare const useTabs: (value?: string) => {
5
5
  panelId: string | undefined;
6
6
  buttonId: string | undefined;
7
- name?: string;
8
- onChange?: (args: {
7
+ name?: string | undefined;
8
+ onChange?: ((args: {
9
9
  value: string;
10
10
  name?: string;
11
- }) => void;
12
- direction?: "column" | "row";
13
- variant?: "bordered" | "borderless" | "pills" | "pills-elevated";
14
- itemWidth?: "equal";
11
+ }) => void) | undefined;
12
+ direction?: ("column" | "row") | undefined;
13
+ variant?: ("bordered" | "borderless" | "pills" | "pills-elevated") | undefined;
14
+ itemWidth?: "equal" | undefined;
15
15
  size: NonNullable<T.BaseProps["size"]>;
16
16
  value?: string;
17
17
  setDefaultValue: (value: string) => void;
@@ -53,7 +53,7 @@ const ToastRegion = (props) => {
53
53
  return null;
54
54
  return (
55
55
  // We only use onClick for touch devices since touchend is not supported
56
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
56
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events
57
57
  _jsx("ul", { role: "region", "aria-live": "polite", className: regionClassNames, ref: rootRef, onTouchStart: handleTouchStart, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { width }, children: queue.map((data, index) => {
58
58
  const visibleIndex = filteredLength - index + hiddenCount - 1;
59
59
  if (data.status !== "entered")
@@ -123,33 +123,34 @@ export const edgeCases = () => (<Example>
123
123
  </Example.Item>
124
124
 
125
125
  <Example.Item title="nested popovers inside a tooltip">
126
- <Tooltip position="top" text="Hello">
127
- {(tooltipAttributes) => (<Popover position="bottom">
128
- <Popover.Trigger>
129
- {(attributes) => (<Button color="primary" attributes={{
130
- ...tooltipAttributes,
131
- ...attributes,
132
- }}>
133
- Open
134
- </Button>)}
135
- </Popover.Trigger>
136
- <Popover.Content>
137
- <View gap={2} align="start">
138
- Popover content
139
- <Popover position="bottom">
140
- <Popover.Trigger>
141
- {(attributes) => <Button attributes={attributes}>Open</Button>}
142
- </Popover.Trigger>
143
- <Popover.Content>
144
- <View gap={2} align="start">
145
- Popover content
146
- <Button onClick={() => { }}>Button</Button>
147
- </View>
148
- </Popover.Content>
149
- </Popover>
150
- </View>
151
- </Popover.Content>
152
- </Popover>)}
153
- </Tooltip>
126
+ <View direction="row" gap={2}>
127
+ <Tooltip position="top" text="Hello">
128
+ {(tooltipAttributes) => (<Popover position="bottom" width="300px">
129
+ <Popover.Trigger>
130
+ {(attributes) => (<Button attributes={{ ...tooltipAttributes, ...attributes }}>
131
+ Tooltip with popover
132
+ </Button>)}
133
+ </Popover.Trigger>
134
+ <Popover.Content>
135
+ <View gap={2} align="center" direction="row" justify="space-between">
136
+ Popover content
137
+ <Popover position="bottom" width="300px">
138
+ <Popover.Trigger>
139
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
140
+ </Popover.Trigger>
141
+ <Popover.Content>
142
+ <Popover.Dismissible align="center" closeAriaLabel="Close">
143
+ Another popover content
144
+ </Popover.Dismissible>
145
+ </Popover.Content>
146
+ </Popover>
147
+ </View>
148
+ </Popover.Content>
149
+ </Popover>)}
150
+ </Tooltip>
151
+ <Tooltip position="top" text="Hello">
152
+ {(tooltipAttributes) => <Button attributes={tooltipAttributes}>Just a tooltip</Button>}
153
+ </Tooltip>
154
+ </View>
154
155
  </Example.Item>
155
156
  </Example>);
@@ -5,7 +5,6 @@ const FlyoutTrigger = (props) => {
5
5
  const { children } = props;
6
6
  const { id, triggerElRef, triggerType, flyout, handleFocus, handleBlur, handleMouseEnter, handleMouseLeave, handleClick, trapFocusMode, isSubmenu, } = useFlyoutContext();
7
7
  let childrenAttributes = {
8
- onBlur: handleBlur,
9
8
  ref: triggerElRef,
10
9
  };
11
10
  if (triggerType === "click" || trapFocusMode === "action-menu") {
@@ -18,6 +17,7 @@ const FlyoutTrigger = (props) => {
18
17
  // Submenus open on keypress instead of hover
19
18
  if ((triggerType === "hover" && !isSubmenu) || triggerType === "focus") {
20
19
  childrenAttributes.onFocus = handleFocus;
20
+ childrenAttributes.onBlur = handleBlur;
21
21
  childrenAttributes["aria-describedby"] = id;
22
22
  }
23
23
  if (triggerType === "click" || triggerType === "focus" || trapFocusMode === "action-menu") {
@@ -136,10 +136,9 @@ if (!window.customElements.get("custom-element")) {
136
136
  export const customPortalTarget = () => {
137
137
  const portalRef = React.useRef(null);
138
138
  return (<Example>
139
- <div style={{ height: 1000 }}/>
140
139
  <Example.Item title="Custom containerRef">
141
140
  <View padding={4} paddingInline={40} height={50} overflow="auto" backgroundColor="neutral-faded" borderRadius="small" attributes={{ ref: portalRef }}>
142
- <Flyout position="bottom-end" containerRef={portalRef}>
141
+ <Flyout position="bottom-end" containerRef={portalRef} active>
143
142
  <Flyout.Trigger>{(attributes) => <button {...attributes}>Open</button>}</Flyout.Trigger>
144
143
  <Flyout.Content>
145
144
  <div style={{
@@ -164,7 +163,7 @@ export const customPortalTarget = () => {
164
163
  </Example.Item>
165
164
  </Example>);
166
165
  };
167
- export const testWidthOverflowOnMobile = () => (<Demo position="bottom-start" width="600px">
166
+ export const testWidthOverflowOnMobile = () => (<Demo position="bottom-start" width={600}>
168
167
  Should work on mobile
169
168
  <button type="button">Item 1</button>
170
169
  <button type="button">Item 2</button>
@@ -79,7 +79,7 @@ const flyout = (triggerEl, flyoutEl, options) => {
79
79
  }
80
80
  const rootNode = triggerEl?.getRootNode();
81
81
  const shadowRoot = rootNode instanceof ShadowRoot ? rootNode : null;
82
- // const shadowHostBounds = shadowRoot ? shadowRoot.host.getBoundingClientRect() : null;
82
+ // Insert inside shadow root if possible to make sure styles are applied correctly
83
83
  (shadowRoot || document.body).appendChild(targetClone);
84
84
  const flyoutBounds = targetClone.getBoundingClientRect();
85
85
  const containerParent = container || getClosestFlyoutTarget(triggerEl);
@@ -86,6 +86,7 @@ export class HotkeyStore {
86
86
  const resolvedEvent = pressedMap[pressedId];
87
87
  if (data.options.preventDefault) {
88
88
  resolvedEvent?.preventDefault();
89
+ e.preventDefault();
89
90
  }
90
91
  data.callback(resolvedEvent);
91
92
  });
@@ -42,6 +42,7 @@ const useDrag = (cb, options) => {
42
42
  [keys.DOWN]: () => isVertical && handleKeyboard(0, 20),
43
43
  }, [], {
44
44
  ref: triggerRef,
45
+ preventDefault: true,
45
46
  disabled,
46
47
  });
47
48
  React.useEffect(() => {
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": "3.0.11-rc.3",
4
+ "version": "3.1.1",
5
5
  "license": "MIT",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",
@@ -84,7 +84,7 @@
84
84
  "test:unit": "jest --config tools/jest/jest.config.ts",
85
85
  "test:size": "size-limit",
86
86
  "lint": "yarn lint:js && yarn lint:css",
87
- "lint:js": "eslint --quiet --fix",
87
+ "lint:js": "eslint './src/**/*.{ts,tsx}' --fix",
88
88
  "lint:css": "stylelint 'src/**/*.css'",
89
89
  "commit": "git-cz"
90
90
  },
@@ -92,29 +92,31 @@
92
92
  "defaults and not IE 11"
93
93
  ],
94
94
  "devDependencies": {
95
- "@commitlint/cli": "19.2.1",
96
- "@commitlint/config-conventional": "19.1.0",
95
+ "@commitlint/cli": "19.4.0",
96
+ "@commitlint/config-conventional": "19.2.2",
97
97
  "@commitlint/types": "19.0.3",
98
- "@size-limit/preset-big-lib": "11.1.2",
99
- "@storybook/addon-a11y": "8.0.6",
100
- "@storybook/addon-controls": "8.0.6",
101
- "@storybook/addon-docs": "8.0.6",
102
- "@storybook/addon-storysource": "8.0.6",
103
- "@storybook/react": "8.0.6",
104
- "@storybook/react-vite": "8.0.6",
105
- "@testing-library/jest-dom": "6.4.2",
106
- "@testing-library/react": "14.3.0",
98
+ "@eslint/js": "^9.9.0",
99
+ "@size-limit/preset-big-lib": "11.1.4",
100
+ "@storybook/addon-a11y": "8.2.8",
101
+ "@storybook/addon-controls": "8.2.8",
102
+ "@storybook/addon-docs": "8.2.8",
103
+ "@storybook/addon-storysource": "8.2.8",
104
+ "@storybook/react": "8.2.8",
105
+ "@storybook/react-vite": "8.2.8",
106
+ "@testing-library/dom": "10.4.0",
107
+ "@testing-library/jest-dom": "6.4.8",
108
+ "@testing-library/react": "16.0.0",
107
109
  "@testing-library/user-event": "14.5.2",
108
- "@types/culori": "^2.1.0",
110
+ "@types/culori": "2.1.1",
109
111
  "@types/events": "3.0.3",
110
112
  "@types/jest": "29.5.12",
111
- "@types/node": "20.12.5",
112
- "@types/react": "18.2.74",
113
- "@types/react-dom": "18.2.24",
113
+ "@types/node": "22.2.0",
114
+ "@types/react": "18.3.3",
115
+ "@types/react-dom": "18.3.0",
114
116
  "@typescript-eslint/eslint-plugin": "7.6.0",
115
117
  "@typescript-eslint/parser": "7.6.0",
116
- "@vitejs/plugin-react": "4.2.1",
117
- "chromatic": "11.3.0",
118
+ "@vitejs/plugin-react": "4.3.1",
119
+ "chromatic": "11.7.0",
118
120
  "cz-conventional-changelog": "3.3.0",
119
121
  "eslint": "8.56.0",
120
122
  "eslint-config-airbnb-typescript": "17.1.0",
@@ -124,28 +126,30 @@
124
126
  "eslint-plugin-prettier": "5.1.3",
125
127
  "eslint-plugin-react": "7.33.2",
126
128
  "eslint-plugin-react-hooks": "4.6.0",
129
+ "globals": "^15.9.0",
127
130
  "identity-obj-proxy": "3.0.0",
128
131
  "jest": "29.7.0",
129
132
  "jest-environment-jsdom": "29.7.0",
130
133
  "jest-matchmedia-mock": "1.1.0",
131
- "lefthook": "1.6.8",
132
- "postcss": "8.4.38",
134
+ "lefthook": "1.7.12",
135
+ "postcss": "8.4.41",
133
136
  "postcss-cli": "11.0.0",
134
137
  "postcss-each": "1.1.0",
135
- "postcss-nested": "6.0.1",
136
- "prettier": "3.2.5",
137
- "react": "18.2.0",
138
- "react-dom": "18.2.0",
139
- "resolve-tspaths": "0.8.18",
140
- "size-limit": "11.1.2",
141
- "storybook": "8.0.6",
142
- "stylelint": "16.3.1",
138
+ "postcss-nested": "6.2.0",
139
+ "prettier": "3.3.3",
140
+ "react": "18.3.1",
141
+ "react-dom": "18.3.1",
142
+ "resolve-tspaths": "0.8.19",
143
+ "size-limit": "11.1.4",
144
+ "storybook": "8.2.8",
145
+ "stylelint": "16.8.1",
143
146
  "stylelint-config-prettier": "9.0.5",
144
- "stylelint-config-standard": "36.0.0",
145
- "ts-jest": "29.1.2",
147
+ "stylelint-config-standard": "36.0.1",
148
+ "ts-jest": "29.2.4",
146
149
  "ts-node": "10.9.2",
147
- "typescript": "5.5.3",
148
- "vite": "5.2.8",
150
+ "typescript": "5.5.4",
151
+ "typescript-eslint": "^8.0.1",
152
+ "vite": "5.4.0",
149
153
  "vite-tsconfig-paths": "4.3.2"
150
154
  },
151
155
  "peerDependencies": {
@@ -154,12 +158,12 @@
154
158
  "react-dom": "^18"
155
159
  },
156
160
  "dependencies": {
157
- "@csstools/postcss-global-data": "2.1.1",
161
+ "@csstools/postcss-global-data": "3.0.0",
158
162
  "chalk": "4.1.2",
159
163
  "commander": "11.1.0",
160
- "cssnano": "6.1.2",
164
+ "cssnano": "7.0.5",
161
165
  "culori": "4.0.1",
162
- "postcss-custom-media": "10.0.4"
166
+ "postcss-custom-media": "11.0.0"
163
167
  },
164
168
  "resolutions": {
165
169
  "jackspeak": "2.1.1"