reshaped 2.5.3 → 2.5.6

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.
@@ -54,7 +54,6 @@ const ToastProvider = (props) => {
54
54
  const [data, dispatch] = React.useReducer(toastReducer, defaultContextData.queues);
55
55
  const add = React.useCallback((toastProps) => {
56
56
  const id = generateId();
57
- console.log("add");
58
57
  dispatch({ type: "add", payload: { toastProps, id } });
59
58
  return id;
60
59
  }, []);
@@ -62,7 +61,6 @@ const ToastProvider = (props) => {
62
61
  dispatch({ type: "show", payload: { id } });
63
62
  }, []);
64
63
  const hide = React.useCallback((id) => {
65
- console.log("hide");
66
64
  dispatch({ type: "hide", payload: { id } });
67
65
  }, []);
68
66
  const remove = React.useCallback((id) => {
@@ -1 +1 @@
1
- .content{--rs-flyout-gap:2;--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%}.inner{opacity:0;transform:scale(.8);transform-origin:var(--rs-flyout-origin-x) var(--rs-flyout-origin-y)}.content.--position-top,.content.--position-top-end,.content.--position-top-start{--rs-flyout-origin-y:100%;padding-bottom:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom,.content.--position-bottom-end,.content.--position-bottom-start{--rs-flyout-origin-y:0%;padding-top:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom-start,.content.--position-top-start{--rs-flyout-origin-x:0%}.content.--position-bottom-end,.content.--position-top-end{--rs-flyout-origin-x:100%}.content.--position-start,.content.--position-start-bottom,.content.--position-start-top{--rs-flyout-origin-x:100%;padding-right:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end,.content.--position-end-bottom,.content.--position-end-top{--rs-flyout-origin-x:0%;padding-left:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end-top,.content.--position-start-top{--rs-flyout-origin-y:0%}.content.--position-end-bottom,.content.--position-start-bottom{--rs-flyout-origin-y:100%}.content.--visible .inner{opacity:1;transform:scale(1)}.content.--animated .inner{transition:var(--rs-duration-fast) var(--rs-easing-accelerate);transition-property:opacity,transform}.content.--animated.--visible .inner{transition-timing-function:var(--rs-easing-decelerate)}
1
+ .content{--rs-flyout-gap:2;--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%;position:absolute}.inner{opacity:0;transform:scale(.8);transform-origin:var(--rs-flyout-origin-x) var(--rs-flyout-origin-y)}.content.--position-top,.content.--position-top-end,.content.--position-top-start{--rs-flyout-origin-y:100%;padding-bottom:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom,.content.--position-bottom-end,.content.--position-bottom-start{--rs-flyout-origin-y:0%;padding-top:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom-start,.content.--position-top-start{--rs-flyout-origin-x:0%}.content.--position-bottom-end,.content.--position-top-end{--rs-flyout-origin-x:100%}.content.--position-start,.content.--position-start-bottom,.content.--position-start-top{--rs-flyout-origin-x:100%;padding-right:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end,.content.--position-end-bottom,.content.--position-end-top{--rs-flyout-origin-x:0%;padding-left:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end-top,.content.--position-start-top{--rs-flyout-origin-y:0%}.content.--position-end-bottom,.content.--position-start-bottom{--rs-flyout-origin-y:100%}.content.--visible .inner{opacity:1;transform:scale(1)}.content.--animated .inner{transition:var(--rs-duration-fast) var(--rs-easing-accelerate);transition-property:opacity,transform}.content.--animated.--visible .inner{transition-timing-function:var(--rs-easing-decelerate)}
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import { classNames } from "../../../utilities/helpers.js";
4
4
  import useIsomorphicLayoutEffect from "../../../hooks/useIsomorphicLayoutEffect.js";
5
5
  import Portal from "../Portal/index.js";
6
- import { getClosestScrollableParent } from "../../../utilities/dom.js";
6
+ import { getClosestFlyoutTarget } from "../../../utilities/dom.js";
7
7
  import { useFlyoutContext } from "./Flyout.context.js";
8
8
  import s from "./Flyout.module.css";
9
9
  const FlyoutContent = (props) => {
@@ -38,7 +38,7 @@ const FlyoutContent = (props) => {
38
38
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
39
39
  React.createElement("div", { className: contentClassNames, style: Object.assign(Object.assign({}, styles), { "--rs-flyout-gap": contentGap }), ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp },
40
40
  React.createElement("div", Object.assign({ role: role }, attributes, { id: id, "aria-modal": triggerType === "click", style: contentAttributes === null || contentAttributes === void 0 ? void 0 : contentAttributes.style, className: innerClassNames }), children)));
41
- const closestScrollable = getClosestScrollableParent(triggerElRef.current);
41
+ const closestScrollable = getClosestFlyoutTarget(triggerElRef.current);
42
42
  return (React.createElement(Portal, { targetRef: closestScrollable === document.body ? undefined : { current: closestScrollable } }, content));
43
43
  };
44
44
  export default FlyoutContent;
@@ -13,5 +13,6 @@ export declare const modeActionMenuHover: () => React.JSX.Element;
13
13
  export declare const modeContentMenuHover: () => React.JSX.Element;
14
14
  export declare const testWidthOverflowOnMobile: () => React.JSX.Element;
15
15
  export declare const testInsideScrollArea: () => React.JSX.Element;
16
+ export declare const testInsideFixed: () => React.JSX.Element;
16
17
  export declare const widthTrigger: () => React.JSX.Element;
17
18
  export declare const scopedTheming: () => React.JSX.Element;
@@ -119,6 +119,29 @@ export const testInsideScrollArea = () => (<Example>
119
119
  <div style={{ height: 2000 }}/>
120
120
  </Example.Item>
121
121
  </Example>);
122
+ export const testInsideFixed = () => (<Example>
123
+ <Example.Item title="should move the content on page scroll">
124
+ <View position="fixed" insetTop={20} insetStart={0} insetEnd={0} backgroundColor="neutral-faded" padding={4}>
125
+ <Flyout triggerType="click" position="bottom-start">
126
+ <Flyout.Trigger>{(attributes) => <button {...attributes}>Foo</button>}</Flyout.Trigger>
127
+ <Flyout.Content>
128
+ <div style={{
129
+ background: "var(--rs-color-background-elevation-overlay)",
130
+ padding: "var(--rs-unit-x4)",
131
+ height: 100,
132
+ width: 160,
133
+ borderRadius: "var(--rs-unit-radius-medium)",
134
+ border: "1px solid var(--rs-color-border-neutral-faded)",
135
+ boxSizing: "border-box",
136
+ }}>
137
+ {"Content"}
138
+ </div>
139
+ </Flyout.Content>
140
+ </Flyout>
141
+ </View>
142
+ <div style={{ height: 2000 }}/>
143
+ </Example.Item>
144
+ </Example>);
122
145
  export const widthTrigger = () => (<Flyout triggerType="click" width="trigger" position="bottom">
123
146
  <Flyout.Trigger>
124
147
  {(attributes) => <button {...attributes}>Trigger with long text</button>}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import useRTL from "../useRTL.js";
3
3
  import { onNextFrame } from "../../utilities/animation.js";
4
- import { getClosestScrollableParent } from "../../utilities/dom.js";
4
+ import { getClosestFlyoutTarget } from "../../utilities/dom.js";
5
5
  const SCREEN_OFFSET = 16;
6
6
  const topPos = ["top-start", "top", "top-end"];
7
7
  const bottomPos = ["bottom-start", "bottom", "bottom-end"];
@@ -138,7 +138,6 @@ const defaultStyles = {
138
138
  top: 0,
139
139
  width: "auto",
140
140
  height: "auto",
141
- position: "absolute",
142
141
  // z-index doesn't accept strings
143
142
  zIndex: "var(--rs-z-index-flyout)",
144
143
  };
@@ -146,7 +145,8 @@ const resetStyles = {
146
145
  left: 0,
147
146
  top: 0,
148
147
  position: "fixed",
149
- opacity: 0,
148
+ // opacity: 0,
149
+ visibility: "hidden",
150
150
  animation: "none",
151
151
  transition: "none",
152
152
  zIndex: "var(--rs-z-index-tooltip)",
@@ -174,7 +174,7 @@ const flyout = (origin, target, options) => {
174
174
  }
175
175
  document.body.appendChild(targetClone);
176
176
  const targetBounds = targetClone.getBoundingClientRect();
177
- const scrollableParent = getClosestScrollableParent(origin);
177
+ const scrollableParent = getClosestFlyoutTarget(origin);
178
178
  const boundsDelta = scrollableParent.getBoundingClientRect();
179
179
  const parentOffset = {
180
180
  top: boundsDelta.top + document.documentElement.scrollTop - scrollableParent.scrollTop,
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.5.3",
4
+ "version": "2.5.6",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "https://github.com/formaat-design/reshaped"
26
+ "url": "https://github.com/formaat-design/reshaped-source"
27
27
  },
28
28
  "main": "./index.js",
29
29
  "module": "./index.js",
@@ -62,7 +62,7 @@
62
62
  "build:storybook": "storybook build -c tools/storybook -o dist/app --disable-telemetry",
63
63
  "build:chromatic": "STORYBOOK_ENV=chromatic storybook build -c tools/storybook",
64
64
  "release": "read -p 'Have you updated chromatic tests?' && yarn release:lib && yarn release:source && yarn build:storybook && yarn release:copy",
65
- "release:lib": "yarn build && yarn publish",
65
+ "release:lib": "yarn build && npx semantic-release --no-ci",
66
66
  "release:beta": "yarn build && yarn publish --tag beta",
67
67
  "release:test": "yarn build && yarn pack --filename reshaped-test.tgz",
68
68
  "release:source": "sh ./bin/release-source.sh",
@@ -73,12 +73,16 @@
73
73
  "test:size": "size-limit",
74
74
  "lint": "yarn lint:js && yarn lint:css",
75
75
  "lint:js": "eslint --ext .ts,.tsx src/**/*.ts src/**/*.tsx --quiet --fix",
76
- "lint:css": "stylelint 'src/**/*.css'"
76
+ "lint:css": "stylelint 'src/**/*.css'",
77
+ "commit": "git-cz"
77
78
  },
78
79
  "browserslist": [
79
80
  "defaults and not IE 11"
80
81
  ],
81
82
  "devDependencies": {
83
+ "@commitlint/cli": "18.2.0",
84
+ "@commitlint/config-conventional": "18.1.0",
85
+ "@commitlint/types": "18.1.0",
82
86
  "@size-limit/preset-big-lib": "9.0.0",
83
87
  "@storybook/addon-a11y": "7.4.6",
84
88
  "@storybook/react": "7.4.6",
@@ -86,16 +90,17 @@
86
90
  "@testing-library/jest-dom": "6.1.4",
87
91
  "@testing-library/react": "14.0.0",
88
92
  "@testing-library/user-event": "14.5.1",
89
- "@types/events": "3.0.0",
90
- "@types/jest": "29.5.5",
91
- "@types/node": "20.8.6",
93
+ "@types/events": "3.0.2",
94
+ "@types/jest": "29.5.7",
95
+ "@types/node": "20.8.10",
92
96
  "@types/react": "18.2.28",
93
97
  "@types/react-dom": "18.2.13",
94
- "@typescript-eslint/eslint-plugin": "6.7.5",
95
- "@typescript-eslint/parser": "6.7.5",
96
- "@vitejs/plugin-react": "4.0.4",
97
- "chromatic": "7.1.0",
98
- "eslint": "8.49.0",
98
+ "@typescript-eslint/eslint-plugin": "6.9.1",
99
+ "@typescript-eslint/parser": "6.9.1",
100
+ "@vitejs/plugin-react": "4.1.0",
101
+ "chromatic": "7.6.0",
102
+ "cz-conventional-changelog": "3.3.0",
103
+ "eslint": "8.52.0",
99
104
  "eslint-config-airbnb-typescript": "17.1.0",
100
105
  "eslint-config-prettier": "9.0.0",
101
106
  "eslint-plugin-import": "2.28.1",
@@ -116,7 +121,7 @@
116
121
  "prettier": "3.0.3",
117
122
  "react": "18.2.0",
118
123
  "react-dom": "18.2.0",
119
- "resolve-tspaths": "0.8.15",
124
+ "resolve-tspaths": "0.8.17",
120
125
  "size-limit": "9.0.0",
121
126
  "storybook": "7.4.6",
122
127
  "stylelint": "15.10.3",
@@ -124,8 +129,11 @@
124
129
  "stylelint-config-standard": "34.0.0",
125
130
  "ts-jest": "29.1.1",
126
131
  "typescript": "5.2.2",
127
- "vite": "4.4.9",
128
- "vite-tsconfig-paths": "4.2.1"
132
+ "vite": "4.5.0",
133
+ "vite-tsconfig-paths": "4.2.1",
134
+ "@semantic-release/changelog": "6.0.3",
135
+ "@semantic-release/git": "10.0.1",
136
+ "semantic-release": "22.0.6"
129
137
  },
130
138
  "peerDependencies": {
131
139
  "postcss": "^8.0.0",
@@ -133,7 +141,7 @@
133
141
  "react-dom": "^18.0.0"
134
142
  },
135
143
  "dependencies": {
136
- "autoprefixer": "10.4.15",
144
+ "autoprefixer": "10.4.16",
137
145
  "chalk": "4.1.2",
138
146
  "commander": "11.0.0",
139
147
  "cssnano": "6.0.1",
package/themes/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import type * as T from "./_generator/types";
2
2
  import type { FullThemeDefinition } from "./_generator/tokens/types";
3
- export declare const baseThemeDefinition: {
4
- [key: string]: unknown;
5
- };
3
+ export declare const baseThemeDefinition: FullThemeDefinition;
6
4
  export declare const generateThemeColors: (options: {
7
5
  primary: string;
8
6
  critical?: string;
@@ -1 +1 @@
1
- export declare const getClosestScrollableParent: (el: HTMLElement | null) => HTMLElement;
1
+ export declare const getClosestFlyoutTarget: (el: HTMLElement | null) => HTMLElement;
package/utilities/dom.js CHANGED
@@ -1,9 +1,12 @@
1
- export const getClosestScrollableParent = (el) => {
2
- const overflowY = el && window.getComputedStyle(el).overflowY;
1
+ export const getClosestFlyoutTarget = (el) => {
2
+ const style = el && window.getComputedStyle(el);
3
+ const overflowY = style === null || style === void 0 ? void 0 : style.overflowY;
4
+ const position = style === null || style === void 0 ? void 0 : style.position;
3
5
  const isScrollable = overflowY === null || overflowY === void 0 ? void 0 : overflowY.includes("scroll");
6
+ const isFixed = position === "fixed";
4
7
  if (el === document.body || !el)
5
8
  return document.body;
6
- if (isScrollable && el.scrollHeight > el.clientHeight)
9
+ if ((isScrollable && el.scrollHeight > el.clientHeight) || isFixed)
7
10
  return el;
8
- return getClosestScrollableParent(el.parentElement);
11
+ return getClosestFlyoutTarget(el.parentElement);
9
12
  };
package/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- 2.6
2
-
3
- - TextArea
4
- - Added support for passing `rows` to `inputAttributes`
5
- - Updated onFocus and onBlur typings to use correct html element reference
6
- - TextField
7
- - Updated onFocus and onBlur typings to use correct html element reference
package/LICENSE-SOURCE.md DELETED
@@ -1,40 +0,0 @@
1
- # Reshaped Pro License
2
-
3
- Reshaped grants you a non-exclusive license and permission to use the Design system.
4
- When using the Reshaped Pro License it grants the same permissions to all Employees and Contractors of the Licensee to access and use the Design system.
5
-
6
- Reshaped Pro license is only including the Design system source code.
7
- Reshaped package publicly distributed on NPM is using a separate MIT license and is provided together with the package when it's installed.
8
-
9
- You can:
10
-
11
- - Modify the Design system components to create custom components. Those components are subject to this license.
12
- - Use the Design system to create unlimited Products for yourself, your company or a Client.
13
- - Sell products created with the Design system to the Users.
14
-
15
- You cannot:
16
-
17
- - Share your access to the Design system with other people.
18
- - Redistribute the Design System under other names.
19
- - Reimplement the Design System using other frameworks and make it available publicly or for sale.
20
- - Distribute design kits based on the Design system.
21
- - Distribute design or development tools for building Products using the Design system components.
22
- - Distribute page templates or UI libraries based on the Design system.
23
- - Create any Product that is not the sole property of either you, your company or a Client. For example your Employees and Contractors can't use your company Reshaped Pro license to build their own websites or side projects.
24
-
25
- ## License Definitions
26
-
27
- - Licensee is a person or a business entity who has purchased a License.
28
- - Design system is the source code and design assets made available to the Licensee after purchasing an Reshaped license.
29
- - Product is any artifact produced that incorporates the Design system.
30
- - User is a user of a Product.
31
- - Employee is a full-time or part-time employee of the Licensee.
32
- - Contractor is an individual or business entity contracted to perform services for the Licensee.
33
- - Client is an individual or entity receiving custom professional services directly from the Licensee, produced specifically for that individual or entity.
34
-
35
- The ownership of the Design system remains with the Reshaped development team.
36
- You are required to abide by the licensing terms to avoid termination in case of non-compliance with the agreed terms.
37
-
38
- ---
39
-
40
- Got any further questions? [Send us an email](mailto:hello@reshaped.so)