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.
Files changed (160) hide show
  1. package/CHANGELOG.md +19 -12
  2. package/LICENSE-SOURCE.md +40 -0
  3. package/LICENSE.md +21 -37
  4. package/bin/clean.sh +1 -0
  5. package/bin/cli.js +1 -11
  6. package/bin/release-source.sh +7 -0
  7. package/bundle.css +1 -1
  8. package/bundle.js +10 -10
  9. package/cli/theming/definitions/base.d.ts +1 -1
  10. package/cli/theming/definitions/figma.d.ts +1 -1
  11. package/cli/theming/definitions/reshaped.d.ts +1 -1
  12. package/cli/theming/definitions/slate.d.ts +1 -1
  13. package/cli/theming/index.d.ts +4 -4
  14. package/cli/theming/index.js +7 -107
  15. package/components/Actionable/Actionable.js +14 -3
  16. package/components/Actionable/Actionable.module.css +1 -1
  17. package/components/Autocomplete/tests/Autocomplete.stories.js +27 -1
  18. package/components/Button/Button.js +2 -0
  19. package/components/Button/Button.module.css +1 -1
  20. package/components/Button/Button.types.d.ts +6 -0
  21. package/components/Button/ButtonGroup.d.ts +4 -0
  22. package/components/Button/ButtonGroup.js +9 -0
  23. package/components/Button/tests/Button.stories.d.ts +1 -0
  24. package/components/Button/tests/Button.stories.js +63 -0
  25. package/components/Checkbox/Checkbox.module.css +1 -1
  26. package/components/DropdownMenu/DropdownMenu.js +1 -1
  27. package/components/DropdownMenu/tests/DropdownMenu.stories.js +1 -0
  28. package/components/Overlay/Overlay.js +4 -4
  29. package/components/Radio/Radio.module.css +1 -1
  30. package/components/Select/Select.js +1 -1
  31. package/components/Slider/Slider.module.css +1 -1
  32. package/components/Switch/Switch.module.css +1 -1
  33. package/components/Tabs/Tabs.d.ts +1 -8
  34. package/components/Tabs/Tabs.module.css +1 -1
  35. package/components/Tabs/Tabs.types.d.ts +6 -7
  36. package/components/Tabs/TabsContext.d.ts +4 -0
  37. package/components/Tabs/TabsControlled.js +24 -1
  38. package/components/Tabs/TabsItem.d.ts +1 -8
  39. package/components/Tabs/TabsItem.js +22 -4
  40. package/components/Tabs/TabsList.js +30 -32
  41. package/components/Tabs/tests/Tabs.stories.d.ts +1 -0
  42. package/components/Tabs/tests/Tabs.stories.js +17 -0
  43. package/components/Toast/ToastContainer.js +1 -0
  44. package/components/Toast/ToastProvider.js +4 -0
  45. package/components/Toast/tests/Toast.stories.js +1 -0
  46. package/components/_private/Flyout/Flyout.types.d.ts +2 -0
  47. package/components/_private/Flyout/FlyoutContent.js +7 -3
  48. package/components/_private/Flyout/FlyoutControlled.js +8 -1
  49. package/components/_private/Flyout/tests/Flyout.stories.d.ts +1 -0
  50. package/components/_private/Flyout/tests/Flyout.stories.js +25 -0
  51. package/components/_private/Portal/Portal.d.ts +8 -4
  52. package/components/_private/Portal/Portal.js +23 -11
  53. package/components/_private/Portal/Portal.types.d.ts +7 -2
  54. package/components/_private/Portal/index.d.ts +1 -1
  55. package/components/_private/Portal/index.js +1 -1
  56. package/components/_private/Portal/tests/Portal.stories.js +11 -12
  57. package/config/next.d.ts +4 -5
  58. package/config/next.js +21 -7
  59. package/config/tailwind.d.ts +1 -1
  60. package/config/tailwind.js +3 -3
  61. package/hooks/_private/useFlyout.js +16 -13
  62. package/package.json +39 -31
  63. package/themes/_generator/tests/themes.stories.d.ts +6 -0
  64. package/themes/_generator/tests/themes.stories.js +32 -0
  65. package/{cli/theming → themes/_generator}/tokens/color/color.transforms.d.ts +1 -1
  66. package/{cli/theming → themes/_generator}/tokens/duration/duration.transforms.d.ts +1 -1
  67. package/{cli/theming → themes/_generator}/tokens/easing/easing.transforms.d.ts +1 -1
  68. package/{cli/theming → themes/_generator}/tokens/font/font.transforms.d.ts +1 -1
  69. package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.transforms.d.ts +1 -1
  70. package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.transforms.d.ts +1 -1
  71. package/{cli/theming → themes/_generator}/tokens/shadow/shadow.transforms.d.ts +1 -1
  72. package/{cli/theming → themes/_generator}/tokens/shadow/shadow.transforms.js +1 -1
  73. package/{cli/theming → themes/_generator}/tokens/unit/unit.transforms.d.ts +1 -1
  74. package/{cli/theming → themes/_generator}/tokens/viewport/viewport.transforms.d.ts +1 -1
  75. package/themes/_generator/transform.d.ts +7 -0
  76. package/themes/_generator/transform.js +57 -0
  77. package/{cli/theming → themes/_generator}/types.d.ts +3 -1
  78. package/{cli/theming → themes/_generator}/utilities/css.js +3 -1
  79. package/themes/_generator/utilities/generateBackgroundColors.d.ts +4 -0
  80. package/themes/_generator/utilities/generateBackgroundColors.js +54 -0
  81. package/themes/_generator/utilities/generateUnits.d.ts +4 -0
  82. package/themes/_generator/utilities/generateUnits.js +17 -0
  83. package/{cli/theming → themes/_generator}/utilities/mergeDeep.js +1 -3
  84. package/{cli/theming → themes/_generator}/utilities/resolveTokenReference.js +1 -3
  85. package/themes/index.d.ts +3 -0
  86. package/themes/index.js +5 -0
  87. package/types/config.d.ts +1 -1
  88. package/utilities/a11y.js +12 -3
  89. package/{cli/utilities → utilities}/color.d.ts +1 -1
  90. package/utilities/dom.d.ts +1 -0
  91. package/utilities/dom.js +9 -0
  92. package/cli/theming/definitions/minimal.d.ts +0 -3
  93. package/cli/theming/definitions/minimal.js +0 -80
  94. package/cli/utilities/tests/color.test.d.ts +0 -1
  95. package/cli/utilities/tests/color.test.js +0 -63
  96. package/styles/aspectRatio/index.test.d.ts +0 -1
  97. package/styles/aspectRatio/index.test.js +0 -24
  98. package/styles/bleed/index.test.d.ts +0 -1
  99. package/styles/bleed/index.test.js +0 -24
  100. package/styles/height/index.test.d.ts +0 -1
  101. package/styles/height/index.test.js +0 -27
  102. package/styles/inset/index.test.d.ts +0 -1
  103. package/styles/inset/index.test.js +0 -27
  104. package/styles/maxHeight/index.test.d.ts +0 -1
  105. package/styles/maxHeight/index.test.js +0 -27
  106. package/styles/maxWidth/index.test.d.ts +0 -1
  107. package/styles/maxWidth/index.test.js +0 -27
  108. package/styles/padding/index.test.d.ts +0 -1
  109. package/styles/padding/index.test.js +0 -24
  110. package/styles/position/index.test.d.ts +0 -1
  111. package/styles/position/index.test.js +0 -21
  112. package/styles/radius/index.test.d.ts +0 -1
  113. package/styles/radius/index.test.js +0 -24
  114. package/styles/width/index.test.d.ts +0 -1
  115. package/styles/width/index.test.js +0 -27
  116. package/themes/minimal/theme.css +0 -1
  117. package/utilities/testPresets.d.ts +0 -25
  118. package/utilities/testPresets.js +0 -76
  119. package/utilities/tests/Chain.test.d.ts +0 -1
  120. package/utilities/tests/Chain.test.js +0 -45
  121. /package/bin/{copy-release.sh → release-copy.sh} +0 -0
  122. /package/{cli/theming → themes/_generator}/tokens/color/color.transforms.js +0 -0
  123. /package/{cli/theming → themes/_generator}/tokens/color/color.types.d.ts +0 -0
  124. /package/{cli/theming → themes/_generator}/tokens/color/color.types.js +0 -0
  125. /package/{cli/theming → themes/_generator}/tokens/duration/duration.transforms.js +0 -0
  126. /package/{cli/theming → themes/_generator}/tokens/duration/duration.types.d.ts +0 -0
  127. /package/{cli/theming → themes/_generator}/tokens/duration/duration.types.js +0 -0
  128. /package/{cli/theming → themes/_generator}/tokens/easing/easing.transforms.js +0 -0
  129. /package/{cli/theming → themes/_generator}/tokens/easing/easing.types.d.ts +0 -0
  130. /package/{cli/theming → themes/_generator}/tokens/easing/easing.types.js +0 -0
  131. /package/{cli/theming → themes/_generator}/tokens/font/font.transforms.js +0 -0
  132. /package/{cli/theming → themes/_generator}/tokens/font/font.types.d.ts +0 -0
  133. /package/{cli/theming → themes/_generator}/tokens/font/font.types.js +0 -0
  134. /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.transforms.js +0 -0
  135. /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.types.d.ts +0 -0
  136. /package/{cli/theming → themes/_generator}/tokens/fontFamily/fontFamily.types.js +0 -0
  137. /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.transforms.js +0 -0
  138. /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.types.d.ts +0 -0
  139. /package/{cli/theming → themes/_generator}/tokens/fontWeight/fontWeight.types.js +0 -0
  140. /package/{cli/theming → themes/_generator}/tokens/shadow/shadow.types.d.ts +0 -0
  141. /package/{cli/theming → themes/_generator}/tokens/shadow/shadow.types.js +0 -0
  142. /package/{cli/theming → themes/_generator}/tokens/transforms.d.ts +0 -0
  143. /package/{cli/theming → themes/_generator}/tokens/transforms.js +0 -0
  144. /package/{cli/theming → themes/_generator}/tokens/types.d.ts +0 -0
  145. /package/{cli/theming → themes/_generator}/tokens/types.js +0 -0
  146. /package/{cli/theming → themes/_generator}/tokens/unit/unit.transforms.js +0 -0
  147. /package/{cli/theming → themes/_generator}/tokens/unit/unit.types.d.ts +0 -0
  148. /package/{cli/theming → themes/_generator}/tokens/unit/unit.types.js +0 -0
  149. /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.transforms.js +0 -0
  150. /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.types.d.ts +0 -0
  151. /package/{cli/theming → themes/_generator}/tokens/viewport/viewport.types.js +0 -0
  152. /package/{cli/theming → themes/_generator}/types.js +0 -0
  153. /package/{cli/theming → themes/_generator}/utilities/css.d.ts +0 -0
  154. /package/{cli/theming → themes/_generator}/utilities/mergeDeep.d.ts +0 -0
  155. /package/{cli/theming → themes/_generator}/utilities/mergeDefinitions.d.ts +0 -0
  156. /package/{cli/theming → themes/_generator}/utilities/mergeDefinitions.js +0 -0
  157. /package/{cli/theming → themes/_generator}/utilities/resolveTokenReference.d.ts +0 -0
  158. /package/{cli/utilities → utilities}/color.js +0 -0
  159. /package/{cli/utilities → utilities}/string.d.ts +0 -0
  160. /package/{cli/utilities → utilities}/string.js +0 -0
@@ -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