reshaped 2.2.0 → 2.3.0
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 +19 -12
- package/LICENSE-SOURCE.md +40 -0
- package/LICENSE.md +21 -37
- package/bin/clean.sh +1 -0
- package/bin/cli.js +1 -11
- package/bin/release-source.sh +7 -0
- package/bundle.css +1 -1
- package/bundle.js +10 -10
- package/cli/theming/definitions/base.d.ts +1 -1
- package/cli/theming/definitions/figma.d.ts +1 -1
- package/cli/theming/definitions/reshaped.d.ts +1 -1
- package/cli/theming/definitions/slate.d.ts +1 -1
- package/cli/theming/index.d.ts +4 -4
- package/cli/theming/index.js +7 -107
- package/components/Actionable/Actionable.js +14 -3
- package/components/Actionable/Actionable.module.css +1 -1
- package/components/Autocomplete/tests/Autocomplete.stories.js +27 -1
- package/components/Button/Button.js +2 -0
- package/components/Button/Button.module.css +1 -1
- package/components/Button/Button.types.d.ts +6 -0
- package/components/Button/ButtonGroup.d.ts +4 -0
- package/components/Button/ButtonGroup.js +9 -0
- package/components/Button/tests/Button.stories.d.ts +1 -0
- package/components/Button/tests/Button.stories.js +63 -0
- package/components/Checkbox/Checkbox.module.css +1 -1
- package/components/DropdownMenu/DropdownMenu.js +1 -1
- package/components/DropdownMenu/tests/DropdownMenu.stories.js +1 -0
- package/components/Overlay/Overlay.js +4 -4
- package/components/Radio/Radio.module.css +1 -1
- package/components/Select/Select.js +1 -1
- package/components/Slider/Slider.module.css +1 -1
- package/components/Switch/Switch.module.css +1 -1
- package/components/Tabs/Tabs.d.ts +1 -8
- package/components/Tabs/Tabs.module.css +1 -1
- package/components/Tabs/Tabs.types.d.ts +6 -7
- package/components/Tabs/TabsContext.d.ts +4 -0
- package/components/Tabs/TabsControlled.js +24 -1
- package/components/Tabs/TabsItem.d.ts +1 -8
- package/components/Tabs/TabsItem.js +22 -4
- package/components/Tabs/TabsList.js +30 -32
- package/components/Tabs/tests/Tabs.stories.d.ts +1 -0
- package/components/Tabs/tests/Tabs.stories.js +17 -0
- package/components/Toast/ToastContainer.js +1 -0
- package/components/Toast/ToastProvider.js +4 -0
- package/components/Toast/tests/Toast.stories.js +1 -0
- package/components/_private/Flyout/Flyout.types.d.ts +2 -0
- package/components/_private/Flyout/FlyoutContent.js +7 -3
- package/components/_private/Flyout/FlyoutControlled.js +8 -1
- package/components/_private/Flyout/tests/Flyout.stories.d.ts +1 -0
- package/components/_private/Flyout/tests/Flyout.stories.js +25 -0
- package/components/_private/Portal/Portal.d.ts +8 -4
- package/components/_private/Portal/Portal.js +23 -11
- package/components/_private/Portal/Portal.types.d.ts +7 -2
- package/components/_private/Portal/index.d.ts +1 -1
- package/components/_private/Portal/index.js +1 -1
- package/components/_private/Portal/tests/Portal.stories.js +11 -12
- package/config/next.d.ts +4 -5
- package/config/next.js +21 -7
- package/config/tailwind.d.ts +1 -1
- package/config/tailwind.js +3 -3
- package/hooks/_private/useFlyout.js +16 -13
- package/package.json +39 -31
- package/themes/_generator/tests/themes.stories.d.ts +6 -0
- package/themes/_generator/tests/themes.stories.js +32 -0
- package/{cli/theming → themes/_generator}/tokens/color/color.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/duration/duration.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/easing/easing.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/font/font.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/shadow/shadow.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/shadow/shadow.transforms.js +1 -1
- package/{cli/theming → themes/_generator}/tokens/unit/unit.transforms.d.ts +1 -1
- package/{cli/theming → themes/_generator}/tokens/viewport/viewport.transforms.d.ts +1 -1
- package/themes/_generator/transform.d.ts +7 -0
- package/themes/_generator/transform.js +57 -0
- package/{cli/theming → themes/_generator}/types.d.ts +3 -1
- package/{cli/theming → themes/_generator}/utilities/css.js +3 -1
- package/themes/_generator/utilities/generateBackgroundColors.d.ts +4 -0
- package/themes/_generator/utilities/generateBackgroundColors.js +54 -0
- package/themes/_generator/utilities/generateUnits.d.ts +4 -0
- package/themes/_generator/utilities/generateUnits.js +17 -0
- package/{cli/theming → themes/_generator}/utilities/mergeDeep.js +1 -3
- package/{cli/theming → themes/_generator}/utilities/resolveTokenReference.js +1 -3
- package/themes/index.d.ts +3 -0
- package/themes/index.js +5 -0
- package/types/config.d.ts +1 -1
- package/utilities/a11y.js +12 -3
- package/{cli/utilities → utilities}/color.d.ts +1 -1
- package/utilities/dom.d.ts +1 -0
- package/utilities/dom.js +9 -0
- package/cli/theming/definitions/minimal.d.ts +0 -3
- package/cli/theming/definitions/minimal.js +0 -80
- package/cli/utilities/tests/color.test.d.ts +0 -1
- package/cli/utilities/tests/color.test.js +0 -63
- package/styles/aspectRatio/index.test.d.ts +0 -1
- package/styles/aspectRatio/index.test.js +0 -24
- package/styles/bleed/index.test.d.ts +0 -1
- package/styles/bleed/index.test.js +0 -24
- package/styles/height/index.test.d.ts +0 -1
- package/styles/height/index.test.js +0 -27
- package/styles/inset/index.test.d.ts +0 -1
- package/styles/inset/index.test.js +0 -27
- package/styles/maxHeight/index.test.d.ts +0 -1
- package/styles/maxHeight/index.test.js +0 -27
- package/styles/maxWidth/index.test.d.ts +0 -1
- package/styles/maxWidth/index.test.js +0 -27
- package/styles/padding/index.test.d.ts +0 -1
- package/styles/padding/index.test.js +0 -24
- package/styles/position/index.test.d.ts +0 -1
- package/styles/position/index.test.js +0 -21
- package/styles/radius/index.test.d.ts +0 -1
- package/styles/radius/index.test.js +0 -24
- package/styles/width/index.test.d.ts +0 -1
- package/styles/width/index.test.js +0 -27
- package/themes/minimal/theme.css +0 -1
- package/utilities/testPresets.d.ts +0 -25
- package/utilities/testPresets.js +0 -76
- package/utilities/tests/Chain.test.d.ts +0 -1
- package/utilities/tests/Chain.test.js +0 -45
- /package/bin/{copy-release.sh → release-copy.sh} +0 -0
- /package/{cli/theming → themes/_generator}/tokens/color/color.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/color/color.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/color/color.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/duration/duration.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/duration/duration.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/duration/duration.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/easing/easing.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/easing/easing.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/easing/easing.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/font/font.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/font/font.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/font/font.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/shadow/shadow.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/shadow/shadow.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/transforms.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/unit/unit.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/unit/unit.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/unit/unit.types.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.transforms.js +0 -0
- /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.types.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.types.js +0 -0
- /package/{cli/theming → themes/_generator}/types.js +0 -0
- /package/{cli/theming → themes/_generator}/utilities/css.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/utilities/mergeDeep.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/utilities/mergeDefinitions.d.ts +0 -0
- /package/{cli/theming → themes/_generator}/utilities/mergeDefinitions.js +0 -0
- /package/{cli/theming → themes/_generator}/utilities/resolveTokenReference.d.ts +0 -0
- /package/{cli/utilities → utilities}/color.js +0 -0
- /package/{cli/utilities → utilities}/string.d.ts +0 -0
- /package/{cli/utilities → utilities}/string.js +0 -0
package/utilities/testPresets.js
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import React from "react";
|
11
|
-
import { render, screen } from "@testing-library/react";
|
12
|
-
import userEvent from "@testing-library/user-event";
|
13
|
-
export const testChildren = (renderer) => {
|
14
|
-
test("renders children", () => {
|
15
|
-
render(renderer({ children: "Children" }));
|
16
|
-
expect(screen.getByText("Children")).toBeInTheDocument();
|
17
|
-
});
|
18
|
-
};
|
19
|
-
export const testLinkBehavior = (renderer) => {
|
20
|
-
test("works as a link", () => {
|
21
|
-
render(renderer({ href: "https://reshaped.so" }));
|
22
|
-
const link = screen.getByRole("link");
|
23
|
-
expect(link).toBeInTheDocument();
|
24
|
-
expect(link.getAttribute("href")).toBe("https://reshaped.so");
|
25
|
-
});
|
26
|
-
};
|
27
|
-
export const testLinkButtonBehavior = (renderer) => {
|
28
|
-
test("works as a button with href", () => __awaiter(void 0, void 0, void 0, function* () {
|
29
|
-
const noop = jest.fn();
|
30
|
-
render(renderer({ onClick: noop, href: "https://reshaped.so" }));
|
31
|
-
const button = screen.getByRole("link");
|
32
|
-
button.addEventListener("click", (e) => e.preventDefault());
|
33
|
-
expect(button).toBeInTheDocument();
|
34
|
-
yield userEvent.click(button);
|
35
|
-
expect(noop).toBeCalledTimes(1);
|
36
|
-
}));
|
37
|
-
};
|
38
|
-
export const testButtonBehavior = (renderer) => {
|
39
|
-
test("works as a button", () => __awaiter(void 0, void 0, void 0, function* () {
|
40
|
-
const noop = jest.fn();
|
41
|
-
render(renderer({ onClick: noop }));
|
42
|
-
const button = screen.getByRole("button");
|
43
|
-
expect(button).toBeInTheDocument();
|
44
|
-
yield userEvent.click(button);
|
45
|
-
expect(noop).toBeCalledTimes(1);
|
46
|
-
// fireEvent.keyDown(button, { key: "Enter" });
|
47
|
-
// expect(noop).toBeCalledTimes(2);
|
48
|
-
// fireEvent.keyDown(button, { key: " " });
|
49
|
-
// expect(noop).toBeCalledTimes(3);
|
50
|
-
}));
|
51
|
-
};
|
52
|
-
export const testButtonType = (renderer) => {
|
53
|
-
test("applies correct button type", () => __awaiter(void 0, void 0, void 0, function* () {
|
54
|
-
const noop = jest.fn();
|
55
|
-
render(React.createElement("form", { onSubmit: noop }, renderer({ type: "button" })));
|
56
|
-
const button = screen.getByRole("button");
|
57
|
-
yield userEvent.click(button);
|
58
|
-
expect(noop).not.toBeCalled();
|
59
|
-
}));
|
60
|
-
};
|
61
|
-
export const testDisabledButton = (renderer) => {
|
62
|
-
test("disables the button", () => __awaiter(void 0, void 0, void 0, function* () {
|
63
|
-
const noop = jest.fn();
|
64
|
-
render(renderer({ onClick: noop }));
|
65
|
-
const button = screen.getByRole("button");
|
66
|
-
yield userEvent.click(button);
|
67
|
-
expect(noop).not.toBeCalled();
|
68
|
-
}));
|
69
|
-
};
|
70
|
-
export const testAriaLabel = (renderer) => {
|
71
|
-
test("renders aria-label", () => {
|
72
|
-
render(renderer({ ariaLabel: "Hey" }));
|
73
|
-
const button = screen.getByRole("button");
|
74
|
-
expect(button.getAttribute("aria-label")).toBeDefined();
|
75
|
-
});
|
76
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import Chain from "../Chain.js";
|
2
|
-
describe("Chain", () => {
|
3
|
-
test("gets an item", () => {
|
4
|
-
const chain = new Chain();
|
5
|
-
const id = chain.add("Test");
|
6
|
-
expect(chain.get(id).data).toBe("Test");
|
7
|
-
});
|
8
|
-
test("validates last item", () => {
|
9
|
-
const chain = new Chain();
|
10
|
-
const firstId = chain.add("Test");
|
11
|
-
const lastId = chain.add("Test 2");
|
12
|
-
expect(chain.isLast(firstId)).toBe(false);
|
13
|
-
expect(chain.isLast(lastId)).toBe(true);
|
14
|
-
});
|
15
|
-
test("adds items", () => {
|
16
|
-
const chain = new Chain();
|
17
|
-
chain.add("Test");
|
18
|
-
expect(chain.getAll()).toMatchSnapshot();
|
19
|
-
});
|
20
|
-
test("removes item in the middle", () => {
|
21
|
-
const chain = new Chain();
|
22
|
-
chain.add("Test");
|
23
|
-
const id = chain.add("Test 2");
|
24
|
-
chain.add("Test 3");
|
25
|
-
chain.remove(id);
|
26
|
-
expect(chain.getAll()).toMatchSnapshot();
|
27
|
-
});
|
28
|
-
test("removes side items", () => {
|
29
|
-
const chain = new Chain();
|
30
|
-
const idFirst = chain.add("Test");
|
31
|
-
chain.add("Test 2");
|
32
|
-
const idLast = chain.add("Test 3");
|
33
|
-
chain.remove(idFirst);
|
34
|
-
chain.remove(idLast);
|
35
|
-
expect(chain.getAll()).toMatchSnapshot();
|
36
|
-
});
|
37
|
-
test("removes previous elements till condition is true", () => {
|
38
|
-
const chain = new Chain();
|
39
|
-
chain.add("Test");
|
40
|
-
chain.add("Test 2");
|
41
|
-
const id = chain.add("Test 3");
|
42
|
-
chain.removePreviousTill(id, (item) => item.data === "Test 2");
|
43
|
-
expect(chain.getAll()).toMatchSnapshot();
|
44
|
-
});
|
45
|
-
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|