@blueprintjs/labs 0.16.3 → 6.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.
Files changed (147) hide show
  1. package/LICENSE +153 -167
  2. package/README.md +1 -1
  3. package/lib/cjs/common/classes.d.ts +6 -0
  4. package/lib/cjs/common/classes.js +20 -0
  5. package/lib/cjs/common/classes.js.map +1 -0
  6. package/lib/cjs/common/index.d.ts +3 -1
  7. package/lib/cjs/common/index.js +9 -4
  8. package/lib/cjs/common/index.js.map +1 -1
  9. package/lib/cjs/common/props.d.ts +1 -0
  10. package/lib/cjs/common/props.js +10 -0
  11. package/lib/cjs/common/props.js.map +1 -0
  12. package/lib/cjs/components/box/box.d.ts +8 -0
  13. package/lib/cjs/components/box/box.js +25 -0
  14. package/lib/cjs/components/box/box.js.map +1 -0
  15. package/lib/cjs/components/box/box.test.d.ts +1 -0
  16. package/lib/cjs/components/box/box.test.js +80 -0
  17. package/lib/cjs/components/box/box.test.js.map +1 -0
  18. package/lib/cjs/components/box/boxProps.d.ts +246 -0
  19. package/lib/cjs/components/box/boxProps.js +6 -0
  20. package/lib/cjs/components/box/boxProps.js.map +1 -0
  21. package/lib/cjs/components/box/buildStyles.d.ts +23 -0
  22. package/lib/cjs/components/box/buildStyles.js +258 -0
  23. package/lib/cjs/components/box/buildStyles.js.map +1 -0
  24. package/lib/cjs/components/flex/flex.d.ts +7 -0
  25. package/lib/cjs/components/flex/flex.js +18 -0
  26. package/lib/cjs/components/flex/flex.js.map +1 -0
  27. package/lib/cjs/components/flex/flex.test.d.ts +1 -0
  28. package/lib/cjs/components/flex/flex.test.js +59 -0
  29. package/lib/cjs/components/flex/flex.test.js.map +1 -0
  30. package/lib/cjs/components/index.d.ts +3 -1
  31. package/lib/cjs/components/index.js +8 -4
  32. package/lib/cjs/components/index.js.map +1 -1
  33. package/lib/cjs/components/slot/slot.d.ts +7 -0
  34. package/lib/cjs/components/slot/slot.js +31 -0
  35. package/lib/cjs/components/slot/slot.js.map +1 -0
  36. package/lib/cjs/components/slot/slot.test.d.ts +1 -0
  37. package/lib/cjs/components/slot/slot.test.js +47 -0
  38. package/lib/cjs/components/slot/slot.test.js.map +1 -0
  39. package/lib/cjs/index.d.ts +0 -7
  40. package/lib/cjs/index.js +6 -15
  41. package/lib/cjs/index.js.map +1 -1
  42. package/lib/css/blueprint-labs.css +1630 -7
  43. package/lib/css/blueprint-labs.css.map +1 -1
  44. package/lib/esm/common/classes.d.ts +6 -0
  45. package/lib/esm/common/classes.js +16 -0
  46. package/lib/esm/common/classes.js.map +1 -0
  47. package/lib/esm/common/index.d.ts +3 -1
  48. package/lib/esm/common/index.js +6 -4
  49. package/lib/esm/common/index.js.map +1 -1
  50. package/lib/esm/common/props.d.ts +1 -0
  51. package/lib/esm/common/props.js +7 -0
  52. package/lib/esm/common/props.js.map +1 -0
  53. package/lib/esm/components/box/box.d.ts +8 -0
  54. package/lib/esm/components/box/box.js +21 -0
  55. package/lib/esm/components/box/box.js.map +1 -0
  56. package/lib/esm/components/box/box.test.d.ts +1 -0
  57. package/lib/esm/components/box/box.test.js +78 -0
  58. package/lib/esm/components/box/box.test.js.map +1 -0
  59. package/lib/esm/components/box/boxProps.d.ts +246 -0
  60. package/lib/esm/components/box/boxProps.js +5 -0
  61. package/lib/esm/components/box/boxProps.js.map +1 -0
  62. package/lib/esm/components/box/buildStyles.d.ts +23 -0
  63. package/lib/esm/components/box/buildStyles.js +254 -0
  64. package/lib/esm/components/box/buildStyles.js.map +1 -0
  65. package/lib/esm/components/flex/flex.d.ts +7 -0
  66. package/lib/esm/components/flex/flex.js +15 -0
  67. package/lib/esm/components/flex/flex.js.map +1 -0
  68. package/lib/esm/components/flex/flex.test.d.ts +1 -0
  69. package/lib/esm/components/flex/flex.test.js +57 -0
  70. package/lib/esm/components/flex/flex.test.js.map +1 -0
  71. package/lib/esm/components/index.d.ts +3 -1
  72. package/lib/esm/components/index.js +5 -4
  73. package/lib/esm/components/index.js.map +1 -1
  74. package/lib/esm/components/slot/slot.d.ts +7 -0
  75. package/lib/esm/components/slot/slot.js +27 -0
  76. package/lib/esm/components/slot/slot.js.map +1 -0
  77. package/lib/esm/components/slot/slot.test.d.ts +1 -0
  78. package/lib/esm/components/slot/slot.test.js +45 -0
  79. package/lib/esm/components/slot/slot.test.js.map +1 -0
  80. package/lib/esm/index.d.ts +0 -7
  81. package/lib/esm/index.js +5 -12
  82. package/lib/esm/index.js.map +1 -1
  83. package/lib/esnext/common/classes.d.ts +6 -0
  84. package/lib/esnext/common/classes.js +16 -0
  85. package/lib/esnext/common/classes.js.map +1 -0
  86. package/lib/esnext/common/index.d.ts +3 -1
  87. package/lib/esnext/common/index.js +6 -4
  88. package/lib/esnext/common/index.js.map +1 -1
  89. package/lib/esnext/common/props.d.ts +1 -0
  90. package/lib/esnext/common/props.js +7 -0
  91. package/lib/esnext/common/props.js.map +1 -0
  92. package/lib/esnext/components/box/box.d.ts +8 -0
  93. package/lib/esnext/components/box/box.js +21 -0
  94. package/lib/esnext/components/box/box.js.map +1 -0
  95. package/lib/esnext/components/box/box.test.d.ts +1 -0
  96. package/lib/esnext/components/box/box.test.js +78 -0
  97. package/lib/esnext/components/box/box.test.js.map +1 -0
  98. package/lib/esnext/components/box/boxProps.d.ts +246 -0
  99. package/lib/esnext/components/box/boxProps.js +5 -0
  100. package/lib/esnext/components/box/boxProps.js.map +1 -0
  101. package/lib/esnext/components/box/buildStyles.d.ts +23 -0
  102. package/lib/esnext/components/box/buildStyles.js +254 -0
  103. package/lib/esnext/components/box/buildStyles.js.map +1 -0
  104. package/lib/esnext/components/flex/flex.d.ts +7 -0
  105. package/lib/esnext/components/flex/flex.js +15 -0
  106. package/lib/esnext/components/flex/flex.js.map +1 -0
  107. package/lib/esnext/components/flex/flex.test.d.ts +1 -0
  108. package/lib/esnext/components/flex/flex.test.js +57 -0
  109. package/lib/esnext/components/flex/flex.test.js.map +1 -0
  110. package/lib/esnext/components/index.d.ts +3 -1
  111. package/lib/esnext/components/index.js +5 -4
  112. package/lib/esnext/components/index.js.map +1 -1
  113. package/lib/esnext/components/slot/slot.d.ts +7 -0
  114. package/lib/esnext/components/slot/slot.js +27 -0
  115. package/lib/esnext/components/slot/slot.js.map +1 -0
  116. package/lib/esnext/components/slot/slot.test.d.ts +1 -0
  117. package/lib/esnext/components/slot/slot.test.js +45 -0
  118. package/lib/esnext/components/slot/slot.test.js.map +1 -0
  119. package/lib/esnext/index.d.ts +0 -7
  120. package/lib/esnext/index.js +5 -12
  121. package/lib/esnext/index.js.map +1 -1
  122. package/package.json +57 -45
  123. package/src/_common.scss +9 -0
  124. package/src/blueprint-labs.scss +5 -7
  125. package/src/common/classes.ts +20 -0
  126. package/src/common/index.ts +7 -6
  127. package/src/common/props.ts +8 -0
  128. package/src/components/box/_box.scss +543 -0
  129. package/src/components/box/box.md +59 -0
  130. package/src/components/box/box.test.tsx +119 -0
  131. package/src/components/box/box.tsx +32 -0
  132. package/src/components/box/boxProps.ts +334 -0
  133. package/src/components/box/buildStyles.ts +307 -0
  134. package/src/components/flex/flex.md +52 -0
  135. package/src/components/flex/flex.test.tsx +93 -0
  136. package/src/components/flex/flex.tsx +20 -0
  137. package/src/components/index.ts +6 -6
  138. package/src/components/slot/slot.test.tsx +73 -0
  139. package/src/components/slot/slot.tsx +30 -0
  140. package/src/index.md +16 -5
  141. package/src/index.ts +3 -20
  142. package/src/tsconfig.json +5 -3
  143. package/src/vitest-env.d.ts +6 -0
  144. package/vitest.config.mts +17 -0
  145. package/vitest.setup.mts +13 -0
  146. package/dist/labs.bundle.js +0 -1
  147. package/src/components/_index.scss +0 -3
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* !
3
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
4
+ */
5
+ import { render, screen } from "@testing-library/react";
6
+ import { describe, expect, it } from "vitest";
7
+ import { Button, Classes as CoreClasses } from "@blueprintjs/core";
8
+ import { Classes } from "../../common";
9
+ import { Flex } from "./flex";
10
+ const NS = Classes.getClassNamespace();
11
+ describe("<Flex>", () => {
12
+ it("should render content", () => {
13
+ render(_jsx(Flex, { children: "Test" }));
14
+ const flex = screen.getByText(/test/i);
15
+ expect(flex).toBeInTheDocument();
16
+ });
17
+ it("should always set display flex", () => {
18
+ render(_jsx(Flex, { children: "Test" }));
19
+ const flex = screen.getByText(/test/i);
20
+ expect(flex).toHaveClass(`${NS}-flex`);
21
+ });
22
+ it("should pass through Box props", () => {
23
+ render(_jsx(Flex, { gap: 2, flexDirection: "column", "data-testid": "flex-test", children: "Test" }));
24
+ const flex = screen.getByTestId("flex-test");
25
+ expect(flex).toHaveClass(`${NS}-gap-2`);
26
+ expect(flex).toHaveClass(`${NS}-flex-column`);
27
+ });
28
+ it("should support className", () => {
29
+ render(_jsx(Flex, { className: "custom-class", children: "Test" }));
30
+ const flex = screen.getByText(/test/i);
31
+ expect(flex).toHaveClass("custom-class");
32
+ expect(flex).toHaveClass(Classes.BOX);
33
+ });
34
+ it("should support style prop", () => {
35
+ render(_jsx(Flex, { style: { fontWeight: 700 }, children: "Test" }));
36
+ const flex = screen.getByText(/test/i);
37
+ expect(flex).toHaveStyle({ fontWeight: 700 });
38
+ });
39
+ it("should support asChild prop", () => {
40
+ render(_jsx(Flex, { asChild: true, gap: 2, children: _jsx(Button, { intent: "primary", children: "Test" }) }));
41
+ const button = screen.getByRole("button", { name: /test/i });
42
+ expect(button).toHaveClass(Classes.BOX);
43
+ expect(button).toHaveClass(CoreClasses.BUTTON);
44
+ expect(button).toHaveClass(`${NS}-flex`);
45
+ expect(button).toHaveClass(`${NS}-gap-2`);
46
+ });
47
+ it("should support all flex-related props", () => {
48
+ render(_jsx(Flex, { flexDirection: "row", flexWrap: "wrap", justifyContent: "center", alignItems: "center", gap: 3, "data-testid": "flex-all-props", children: "Test" }));
49
+ const flex = screen.getByTestId("flex-all-props");
50
+ expect(flex).toHaveClass(`${NS}-flex-row`);
51
+ expect(flex).toHaveClass(`${NS}-flex-wrap`);
52
+ expect(flex).toHaveClass(`${NS}-justify-center`);
53
+ expect(flex).toHaveClass(`${NS}-items-center`);
54
+ expect(flex).toHaveClass(`${NS}-gap-3`);
55
+ });
56
+ });
57
+ //# sourceMappingURL=flex.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flex.test.js","sourceRoot":"","sources":["../../../../src/components/flex/flex.test.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;AAEvC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,KAAC,IAAI,uBAAY,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAiB,OAAO,CAAC,CAAC;QAEvD,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,KAAC,IAAI,uBAAY,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAiB,OAAO,CAAC,CAAC;QAEvD,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,E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export { Box } from "./box/box";
2
+ export type { BoxProps } from "./box/boxProps";
3
+ export { Flex, type FlexProps } from "./flex/flex";
@@ -1,6 +1,7 @@
1
- /*
2
- * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the terms of the LICENSE file distributed with this project.
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
4
  */
5
+ export { Box } from "./box/box";
6
+ export { Flex } from "./flex/flex";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Slot component.
4
+ */
5
+ export declare const Slot: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLElement> & {
6
+ children?: React.ReactNode;
7
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,27 @@
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ */
4
+ import classNames from "classnames";
5
+ import { Children, cloneElement, forwardRef, isValidElement } from "react";
6
+ /**
7
+ * Slot component.
8
+ */
9
+ export const Slot = forwardRef(function Slot({ children, ...props }, ref) {
10
+ if (isValidElement(children)) {
11
+ return cloneElement(children, {
12
+ ...props,
13
+ ...children.props,
14
+ className: classNames(props.className, children.props.className),
15
+ ref,
16
+ style: {
17
+ ...props.style,
18
+ ...children.props.style,
19
+ },
20
+ });
21
+ }
22
+ if (Children.count(children) > 1) {
23
+ throw new TypeError("Only single element child is allowed in Slot");
24
+ }
25
+ return null;
26
+ });
27
+ //# sourceMappingURL=slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../../src/components/slot/slot.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC1B,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACrC,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,OAAO,YAAY,CAAC,QAAQ,EAAE;YAC1B,GAAG,KAAK;YACR,GAAG,QAAQ,CAAC,KAAK;YACjB,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;YAChE,GAAG;YACH,KAAK,EAAE;gBACH,GAAG,KAAK,CAAC,KAAK;gBACd,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK;aAC1B;SACJ,CAAC,CAAC;IACP,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* !
3
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
4
+ */
5
+ import { render, screen } from "@testing-library/react";
6
+ import { createRef } from "react";
7
+ import { describe, expect, it, vi } from "vitest";
8
+ import { Slot } from "./slot";
9
+ describe("<Slot>", () => {
10
+ it("merges props into a single child", () => {
11
+ render(_jsx(Slot, { "data-test": "bar", children: _jsx("button", { id: "foo", children: "Test" }) }));
12
+ const button = screen.getByRole("button", { name: /test/i });
13
+ expect(button).toHaveAttribute("id", "foo");
14
+ expect(button).toHaveAttribute("data-test", "bar");
15
+ });
16
+ it("merges className and style", () => {
17
+ render(_jsx(Slot, { className: "outer", style: { fontWeight: 700 }, children: _jsx("button", { className: "inner", style: { fontStyle: "italic" }, children: "Test" }) }));
18
+ const button = screen.getByRole("button", { name: /test/i });
19
+ expect(button).toHaveClass("outer");
20
+ expect(button).toHaveClass("inner");
21
+ expect(button).toHaveStyle({ fontWeight: 700 });
22
+ expect(button).toHaveStyle({ fontStyle: "italic" });
23
+ });
24
+ it("forwards ref to the child", () => {
25
+ const ref = createRef();
26
+ render(_jsx(Slot, { ref: ref, children: _jsx("button", { children: "Test" }) }));
27
+ expect(ref.current).toBeInstanceOf(HTMLButtonElement);
28
+ expect(ref.current).toBeInTheDocument();
29
+ });
30
+ it("returns null if no children are provided", () => {
31
+ const { container } = render(_jsx(Slot, {}));
32
+ expect(container.firstChild).toBeNull();
33
+ });
34
+ it("throws an error when multiple children are provided", () => {
35
+ // suppress error logging to keep test output clean
36
+ const stderrWriteSpy = vi.spyOn(process.stderr, "write").mockImplementation(vi.fn());
37
+ const consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(vi.fn());
38
+ expect(() => {
39
+ render(_jsxs(Slot, { children: [_jsx("button", { children: "First" }), _jsx("button", { children: "Second" })] }));
40
+ }).toThrow("Only single element child is allowed in Slot");
41
+ stderrWriteSpy.mockRestore();
42
+ consoleErrorSpy.mockRestore();
43
+ });
44
+ });
45
+ //# sourceMappingURL=slot.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.test.js","sourceRoot":"","sources":["../../../../src/components/slot/slot.test.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC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,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,9 +1,2 @@
1
1
  export * from "./common";
2
2
  export * from "./components";
3
- import { Popover, Tooltip } from "@blueprintjs/core";
4
- export declare const Popover2: typeof Popover;
5
- export declare const Tooltip2: typeof Tooltip;
6
- import { Omnibar } from "@blueprintjs/select";
7
- export declare const Omnibox: typeof Omnibar;
8
- export * from "@blueprintjs/select";
9
- export { ITimezonePickerProps, ITimezonePickerState, TimezoneDisplayFormat, TimezonePicker } from "@blueprintjs/timezone";
@@ -1,14 +1,7 @@
1
- /*
2
- * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the terms of the LICENSE file distributed with this project.
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
4
  */
6
- // re-exports for 0.15.x provided as a migration path. these will be removed in 0.16.x
7
- import { Popover, Tooltip } from "@blueprintjs/core";
8
- export const Popover2 = Popover;
9
- export const Tooltip2 = Tooltip;
10
- import { Omnibar } from "@blueprintjs/select";
11
- export const Omnibox = Omnibar;
12
- export * from "@blueprintjs/select";
13
- export { TimezoneDisplayFormat, TimezonePicker, } from "@blueprintjs/timezone";
5
+ export * from "./common";
6
+ export * from "./components";
14
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,sFAAsF;AACtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC;AAChC,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAGH,qBAAqB,EACrB,cAAc,GACjB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,60 +1,49 @@
1
1
  {
2
2
  "name": "@blueprintjs/labs",
3
- "version": "0.16.3",
3
+ "version": "6.1.1",
4
4
  "description": "Incubator for unstable and in-development Blueprint components",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
7
7
  "esnext": "lib/esnext/index.js",
8
8
  "typings": "lib/esm/index.d.ts",
9
9
  "style": "lib/css/blueprint-labs.css",
10
- "unpkg": "dist/labs.bundle.js",
11
- "sideEffects": [
12
- "*.css"
13
- ],
14
- "scripts": {
15
- "clean": "rm -rf dist/* && rm -rf lib/*",
16
- "compile": "run-p \"compile:*\"",
17
- "compile:esm": "tsc -p ./src",
18
- "compile:cjs": "tsc -p ./src -m commonjs --outDir lib/cjs",
19
- "compile:esnext": "tsc -p ./src -t esnext --outDir lib/esnext",
20
- "compile:css": "sass-compile ./src",
21
- "dev": "run-p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
22
- "dist": "run-s \"dist:*\"",
23
- "dist:bundle": "cross-env NODE_ENV=production webpack",
24
- "dist:css": "css-dist lib/css/*.css",
25
- "dist:verify": "assert-package-layout",
26
- "lint": "run-p lint:scss lint:ts",
27
- "lint:scss": "sass-lint",
28
- "lint:ts": "ts-lint",
29
- "lint-fix": "ts-lint --fix",
30
- "test": "run-s test:pre test:karma",
31
- "test:pre": "tsc -p ./test",
32
- "test:karma": "karma start",
33
- "test:karma:debug": "karma start --single-run=false --reporters=mocha --debug",
34
- "verify": "npm-run-all compile -p dist test lint"
35
- },
36
10
  "dependencies": {
37
- "@blueprintjs/core": "^3.12.0",
38
- "@blueprintjs/select": "^3.6.0",
39
- "@blueprintjs/timezone": "^3.3.0",
40
- "classnames": "^2.2",
41
- "tslib": "^1.9.0"
11
+ "classnames": "^2.3.1",
12
+ "tslib": "~2.6.2",
13
+ "@blueprintjs/core": "^6.3.4",
14
+ "@blueprintjs/colors": "^5.1.11"
15
+ },
16
+ "peerDependencies": {
17
+ "@types/react": "18",
18
+ "react": "18",
19
+ "react-dom": "18"
20
+ },
21
+ "peerDependenciesMeta": {
22
+ "@types/react": {
23
+ "optional": true
24
+ }
42
25
  },
43
26
  "devDependencies": {
44
- "@blueprintjs/node-build-scripts": "^0.8.1",
45
- "@blueprintjs/test-commons": "^0.8.1",
46
- "enzyme": "^3.3.0",
47
- "karma": "^3.1.4",
48
- "npm-run-all": "^4.1.2",
49
- "react": "^16.2.0",
50
- "react-dom": "^16.2.0",
51
- "react-test-renderer": "^16.2.0",
52
- "typescript": "~2.8.3",
53
- "webpack-cli": "^3.1.2"
27
+ "@testing-library/dom": "^10.4.1",
28
+ "@testing-library/jest-dom": "^6.9.1",
29
+ "@testing-library/react": "^16.3.0",
30
+ "@testing-library/user-event": "^14.6.1",
31
+ "@vitejs/plugin-react": "^5.1.0",
32
+ "jsdom": "^27.1.0",
33
+ "npm-run-all": "^4.1.5",
34
+ "react": "^18.3.1",
35
+ "react-dom": "^18.3.1",
36
+ "typescript": "~5.3.3",
37
+ "vite": "^7.1.2",
38
+ "vitest": "^4.0.7",
39
+ "@blueprintjs/stylelint-plugin": "^5.1.2",
40
+ "@blueprintjs/test-commons": "^4.0.2",
41
+ "@blueprintjs/node-build-scripts": "^9.2.9",
42
+ "@blueprintjs/webpack-build-scripts": "^6.2.14"
54
43
  },
55
44
  "repository": {
56
45
  "type": "git",
57
- "url": "git@github.com:palantir/blueprint.git",
46
+ "url": "git+ssh://git@github.com/palantir/blueprint.git",
58
47
  "directory": "packages/labs"
59
48
  },
60
49
  "keywords": [
@@ -64,5 +53,28 @@
64
53
  "labs"
65
54
  ],
66
55
  "author": "Palantir Technologies",
67
- "license": "SEE LICENSE IN LICENSE"
68
- }
56
+ "license": "Apache-2.0",
57
+ "bugs": {
58
+ "url": "https://github.com/palantir/blueprint/issues"
59
+ },
60
+ "homepage": "https://github.com/palantir/blueprint#readme",
61
+ "scripts": {
62
+ "clean": "rm -rf lib/* || true",
63
+ "compile": "run-p \"compile:*\"",
64
+ "compile:esm": "tsc -p ./src",
65
+ "compile:cjs": "tsc -p ./src -m commonjs --verbatimModuleSyntax false --outDir lib/cjs",
66
+ "compile:esnext": "tsc -p ./src -t esnext --outDir lib/esnext",
67
+ "compile:css": "sass-compile ./src",
68
+ "dev": "run-p \"compile:esm --watch\" \"compile:css --watch\"",
69
+ "dist": "run-s \"dist:*\"",
70
+ "dist:css": "css-dist lib/css",
71
+ "lint": "run-p lint:scss lint:es",
72
+ "lint:es": "es-lint",
73
+ "lint:scss": "sass-lint",
74
+ "lint-fix": "es-lint --fix && sass-lint --fix",
75
+ "start": "pnpm dev",
76
+ "test": "vitest run",
77
+ "test:watch": "vitest watch",
78
+ "verify": "npm-run-all compile -p dist test lint"
79
+ }
80
+ }
@@ -0,0 +1,9 @@
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ */
5
+
6
+ @import "@blueprintjs/colors/lib/scss/colors";
7
+ @import "@blueprintjs/core/src/common/variables";
8
+
9
+ $ns: #{$ns}-labs;
@@ -1,8 +1,6 @@
1
- /*!
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ */
2
5
 
3
- Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
4
- Licensed under the terms of the LICENSE file distributed with this project.
5
-
6
- */
7
-
8
- @import "./components/index";
6
+ @forward "components/box/box";
@@ -0,0 +1,20 @@
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ */
5
+
6
+ import { Classes } from "@blueprintjs/core";
7
+
8
+ const CORE_NS = Classes.getClassNamespace();
9
+
10
+ const NS = `${CORE_NS}-labs`;
11
+
12
+ /**
13
+ * Returns the namespace prefix for all Blueprint CSS classes.
14
+ * Customize this namespace at build time by defining it with `webpack.DefinePlugin`.
15
+ */
16
+ export function getClassNamespace() {
17
+ return NS;
18
+ }
19
+
20
+ export const BOX = `${NS}-box`;
@@ -1,8 +1,9 @@
1
- /*
2
- * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the terms of the LICENSE file distributed with this project.
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
4
  */
6
5
 
7
- // Empty module since there's nothing to export.
8
- export {};
6
+ import * as Classes from "./classes";
7
+
8
+ export { DISPLAYNAME_PREFIX } from "./props";
9
+ export { Classes };
@@ -0,0 +1,8 @@
1
+ /* !
2
+ * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ */
5
+
6
+ import { DISPLAYNAME_PREFIX as CORE_DISPLAYNAME_PREFIX } from "@blueprintjs/core";
7
+
8
+ export const DISPLAYNAME_PREFIX = `${CORE_DISPLAYNAME_PREFIX}Labs`;