storybook 10.0.0-beta.0 → 10.0.0-beta.10
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/assets/server/openBrowser.applescript +94 -0
- package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
- package/dist/_browser-chunks/{WithTooltip-2E62HIBN.js → WithTooltip-SK46ZJ2J.js} +1 -1
- package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
- package/dist/_browser-chunks/{chunk-FWKO3E35.js → chunk-BOOOPFZF.js} +10 -3
- package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
- package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
- package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
- package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
- package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
- package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
- package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
- package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
- package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
- package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
- package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
- package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
- package/dist/_node-chunks/{builder-manager-OW6YGKXV.js → builder-manager-SJGIDEN6.js} +45 -155
- package/dist/_node-chunks/camelcase-VZHWABQV.js +18 -0
- package/dist/_node-chunks/{chunk-6JSVPEAU.js → chunk-6CZW7AGN.js} +7 -7
- package/dist/_node-chunks/{chunk-CD3IP6HA.js → chunk-6XT5OLNL.js} +12 -12
- package/dist/_node-chunks/{chunk-2H7LZ2SD.js → chunk-AHRH5RPR.js} +7 -7
- package/dist/_node-chunks/{chunk-5HLANIBM.js → chunk-AOH6ABSV.js} +7 -7
- package/dist/_node-chunks/chunk-C5V22GP7.js +79 -0
- package/dist/_node-chunks/{chunk-IBXERYDG.js → chunk-FIROF4DV.js} +7 -7
- package/dist/_node-chunks/{chunk-I3YCPGZJ.js → chunk-GUJVZUYI.js} +7 -7
- package/dist/_node-chunks/chunk-IHPLRRAR.js +4741 -0
- package/dist/_node-chunks/{chunk-7TISOZS6.js → chunk-JMXKCRWR.js} +30 -21
- package/dist/_node-chunks/{chunk-YWGNEBRO.js → chunk-JUMUXWEV.js} +162 -103
- package/dist/_node-chunks/{chunk-UIREEOC7.js → chunk-KGX33KXX.js} +7 -7
- package/dist/_node-chunks/{chunk-3QB3ZG6H.js → chunk-KLVABNEU.js} +7 -7
- package/dist/_node-chunks/{chunk-H5LTFJHQ.js → chunk-OL6DY6BT.js} +631 -752
- package/dist/_node-chunks/{chunk-X5GAZ3EW.js → chunk-ONJV3K2L.js} +399 -116
- package/dist/_node-chunks/{chunk-LKB7KRSV.js → chunk-PTHTD4RO.js} +223 -243
- package/dist/_node-chunks/{chunk-UHHZPSP7.js → chunk-QQ3Z5KGJ.js} +6 -6
- package/dist/_node-chunks/{chunk-MUD3GH3L.js → chunk-QRTDDTZJ.js} +9 -9
- package/dist/_node-chunks/chunk-R54K4KSM.js +1540 -0
- package/dist/_node-chunks/{chunk-IQAUGVYR.js → chunk-S2LZC6JK.js} +8 -8
- package/dist/_node-chunks/chunk-SFJFSPRT.js +62 -0
- package/dist/_node-chunks/{chunk-LH3BEEIR.js → chunk-SSN5PKIY.js} +6 -6
- package/dist/_node-chunks/{chunk-NOQITS3C.js → chunk-SXR2DITB.js} +7 -7
- package/dist/_node-chunks/{chunk-FWUE7SRE.js → chunk-TH5QVQRL.js} +7 -7
- package/dist/_node-chunks/chunk-U34NWAU2.js +18 -0
- package/dist/_node-chunks/{chunk-FBMMEEO4.js → chunk-UV3CZ3KS.js} +7 -7
- package/dist/_node-chunks/{chunk-NZGJJABJ.js → chunk-UVUGJDAI.js} +60 -102
- package/dist/_node-chunks/{chunk-GZUNYRFU.js → chunk-VOUNSD2E.js} +7 -7
- package/dist/_node-chunks/chunk-WFCPBKQJ.js +64656 -0
- package/dist/_node-chunks/{chunk-BFXER3XW.js → chunk-XHF3WWNP.js} +623 -750
- package/dist/_node-chunks/{chunk-ANEKBWDX.js → chunk-XU45KXNQ.js} +16 -25
- package/dist/_node-chunks/{camelcase-2K3EMR6G.js → chunk-YHO6XR7U.js} +9 -8
- package/dist/_node-chunks/{dist-465RSKRC.js → dist-IIC5PBL7.js} +9 -9
- package/dist/_node-chunks/{globby-LJ3MVB6M.js → globby-CJACC3HJ.js} +17 -13
- package/dist/_node-chunks/{lib-OW3DENXB.js → lib-ZY4TKSOR.js} +40 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-PYX2IFUO.js → mdx-N42X6CFJ-3XNW3DFO.js} +8 -8
- package/dist/_node-chunks/{p-limit-X4OG45RB.js → p-limit-R2OFT5HE.js} +76 -10
- package/dist/_node-chunks/{plugin-ALTIQMDE.js → plugin-5XD5R2KD.js} +10 -10
- package/dist/_node-chunks/{plugin-GE36R32R.js → plugin-WAWVQMVR.js} +10 -12
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-NLCAF7S6.js → webpack-inject-mocker-runtime-plugin-SCRGJLIS.js} +1307 -847
- package/dist/_node-chunks/{webpack-mock-plugin-BRYODMCC.js → webpack-mock-plugin-3VAXEGG2.js} +9 -11
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/index.js +11 -12
- package/dist/bin/core.js +638 -187
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.d.ts +62 -75
- package/dist/cli/index.js +66 -56
- package/dist/common/index.d.ts +3 -1
- package/dist/common/index.js +22 -22
- package/dist/components/index.d.ts +234 -2
- package/dist/components/index.js +74 -5741
- package/dist/core-events/index.d.ts +18 -2
- package/dist/core-events/index.js +7 -1
- package/dist/core-server/index.d.ts +540 -39
- package/dist/core-server/index.js +4647 -4182
- package/dist/core-server/presets/common-manager.js +1570 -1272
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +691 -38
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -11
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -12
- package/dist/csf/index.d.ts +9 -4
- package/dist/csf/index.js +50 -15
- package/dist/csf-tools/index.d.ts +47 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +4 -4
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +9233 -18113
- package/dist/manager/globals.d.ts +0 -4
- package/dist/manager/globals.js +1 -6
- package/dist/manager/runtime.js +13396 -11518
- package/dist/manager-api/index.d.ts +540 -32
- package/dist/manager-api/index.js +364 -90
- package/dist/manager-errors.d.ts +527 -0
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +1136 -662
- package/dist/preview/globals.js +1 -1
- package/dist/preview/runtime.js +12103 -21579
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +10 -10
- package/dist/preview-errors.d.ts +527 -0
- package/dist/router/index.d.ts +668 -10
- package/dist/router/index.js +2 -2
- package/dist/server-errors.d.ts +527 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +23 -25
- package/dist/test/index.js +1874 -4024
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js +6 -6
- package/dist/types/index.d.ts +553 -16
- package/dist/viewport/index.d.ts +36 -4
- package/dist/viewport/index.js +1 -1
- package/package.json +9 -46
- package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
- package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
- package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
- package/dist/_node-chunks/chunk-27W2Z6VL.js +0 -28502
- package/dist/_node-chunks/chunk-G46DWX7Z.js +0 -266
- package/dist/_node-chunks/chunk-GZZDIJIB.js +0 -80
- package/dist/_node-chunks/chunk-JDKH3XYB.js +0 -9845
- package/dist/_node-chunks/chunk-R7RKO2DC.js +0 -35783
- package/dist/_node-chunks/chunk-T23YQHYB.js +0 -62
- package/dist/_node-chunks/chunk-VKKLKNFC.js +0 -2377
- package/dist/_node-chunks/chunk-W6GKFQ7F.js +0 -87
- package/dist/_node-chunks/chunk-YUYBO6S7.js +0 -18
- package/dist/_node-chunks/default-browser-id-Z6WQ7DZA.js +0 -1719
package/dist/cli/index.js
CHANGED
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
boxen
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-XHF3WWNP.js";
|
|
15
|
+
import "../_node-chunks/chunk-YHO6XR7U.js";
|
|
15
16
|
import {
|
|
16
17
|
Settings,
|
|
17
18
|
_clearGlobalSettings,
|
|
18
19
|
globalSettings
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-PTHTD4RO.js";
|
|
20
21
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "../_node-chunks/chunk-
|
|
24
|
-
import "../_node-chunks/chunk-W6GKFQ7F.js";
|
|
22
|
+
any,
|
|
23
|
+
up2 as up
|
|
24
|
+
} from "../_node-chunks/chunk-C5V22GP7.js";
|
|
25
25
|
import {
|
|
26
26
|
invariant
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-KGX33KXX.js";
|
|
28
28
|
import {
|
|
29
29
|
resolvePackageDir
|
|
30
|
-
} from "../_node-chunks/chunk-
|
|
31
|
-
import "../_node-chunks/chunk-
|
|
30
|
+
} from "../_node-chunks/chunk-R54K4KSM.js";
|
|
31
|
+
import "../_node-chunks/chunk-AOH6ABSV.js";
|
|
32
32
|
import {
|
|
33
33
|
require_prompts
|
|
34
|
-
} from "../_node-chunks/chunk-
|
|
34
|
+
} from "../_node-chunks/chunk-UV3CZ3KS.js";
|
|
35
35
|
import {
|
|
36
36
|
require_dist
|
|
37
|
-
} from "../_node-chunks/chunk-
|
|
37
|
+
} from "../_node-chunks/chunk-GUJVZUYI.js";
|
|
38
38
|
import {
|
|
39
39
|
babelParse,
|
|
40
40
|
recast,
|
|
41
41
|
traverse,
|
|
42
42
|
types
|
|
43
|
-
} from "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
45
|
-
import "../_node-chunks/chunk-
|
|
46
|
-
import "../_node-chunks/chunk-GZUNYRFU.js";
|
|
43
|
+
} from "../_node-chunks/chunk-WFCPBKQJ.js";
|
|
44
|
+
import "../_node-chunks/chunk-JUMUXWEV.js";
|
|
45
|
+
import "../_node-chunks/chunk-VOUNSD2E.js";
|
|
47
46
|
import {
|
|
48
47
|
require_picocolors
|
|
49
|
-
} from "../_node-chunks/chunk-
|
|
48
|
+
} from "../_node-chunks/chunk-FIROF4DV.js";
|
|
50
49
|
import {
|
|
51
50
|
__commonJS,
|
|
52
51
|
__name,
|
|
53
52
|
__require,
|
|
54
53
|
__toESM
|
|
55
|
-
} from "../_node-chunks/chunk-
|
|
54
|
+
} from "../_node-chunks/chunk-SSN5PKIY.js";
|
|
56
55
|
|
|
57
56
|
// ../node_modules/wrappy/wrappy.js
|
|
58
57
|
var require_wrappy = __commonJS({
|
|
@@ -138,6 +137,7 @@ var require_end_of_stream = __commonJS({
|
|
|
138
137
|
var once = require_once();
|
|
139
138
|
var noop = /* @__PURE__ */ __name(function() {
|
|
140
139
|
}, "noop");
|
|
140
|
+
var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process);
|
|
141
141
|
var isRequest = /* @__PURE__ */ __name(function(stream) {
|
|
142
142
|
return stream.setHeader && typeof stream.abort === "function";
|
|
143
143
|
}, "isRequest");
|
|
@@ -171,7 +171,7 @@ var require_end_of_stream = __commonJS({
|
|
|
171
171
|
callback.call(stream, err);
|
|
172
172
|
}, "onerror");
|
|
173
173
|
var onclose = /* @__PURE__ */ __name(function() {
|
|
174
|
-
|
|
174
|
+
qnt(onclosenexttick);
|
|
175
175
|
}, "onclose");
|
|
176
176
|
var onclosenexttick = /* @__PURE__ */ __name(function() {
|
|
177
177
|
if (cancelled) return;
|
|
@@ -226,7 +226,7 @@ var require_pump = __commonJS({
|
|
|
226
226
|
}
|
|
227
227
|
var noop = /* @__PURE__ */ __name(function() {
|
|
228
228
|
}, "noop");
|
|
229
|
-
var ancient = /^v?\.0/.test(process.version);
|
|
229
|
+
var ancient = typeof process === "undefined" ? false : /^v?\.0/.test(process.version);
|
|
230
230
|
var isFn = /* @__PURE__ */ __name(function(fn) {
|
|
231
231
|
return typeof fn === "function";
|
|
232
232
|
}, "isFn");
|
|
@@ -4645,7 +4645,7 @@ var require_tar_fs = __commonJS({
|
|
|
4645
4645
|
if (win32) return next();
|
|
4646
4646
|
xfs.unlink(name, function() {
|
|
4647
4647
|
var dst = path.resolve(path.dirname(name), header.linkname);
|
|
4648
|
-
if (!dst
|
|
4648
|
+
if (!inCwd(dst, cwd)) return next(new Error(name + " is not a valid symlink"));
|
|
4649
4649
|
xfs.symlink(header.linkname, name, stat);
|
|
4650
4650
|
});
|
|
4651
4651
|
}, "onsymlink");
|
|
@@ -4653,12 +4653,15 @@ var require_tar_fs = __commonJS({
|
|
|
4653
4653
|
if (win32) return next();
|
|
4654
4654
|
xfs.unlink(name, function() {
|
|
4655
4655
|
var srcpath = path.join(cwd, path.join("/", header.linkname));
|
|
4656
|
-
xfs.
|
|
4657
|
-
if (err
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4656
|
+
xfs.realpath(srcpath, function(err, dst) {
|
|
4657
|
+
if (err || !inCwd(dst, cwd)) return next(new Error(name + " is not a valid hardlink"));
|
|
4658
|
+
xfs.link(dst, name, function(err2) {
|
|
4659
|
+
if (err2 && err2.code === "EPERM" && opts.hardlinkAsFilesFallback) {
|
|
4660
|
+
stream = xfs.createReadStream(srcpath);
|
|
4661
|
+
return onfile();
|
|
4662
|
+
}
|
|
4663
|
+
stat(err2);
|
|
4664
|
+
});
|
|
4662
4665
|
});
|
|
4663
4666
|
});
|
|
4664
4667
|
}, "onlink");
|
|
@@ -4729,6 +4732,11 @@ var require_tar_fs = __commonJS({
|
|
|
4729
4732
|
});
|
|
4730
4733
|
}
|
|
4731
4734
|
__name(mkdirfix, "mkdirfix");
|
|
4735
|
+
function inCwd(dst, cwd) {
|
|
4736
|
+
cwd = path.resolve(cwd);
|
|
4737
|
+
return cwd === dst || dst.startsWith(cwd + path.sep);
|
|
4738
|
+
}
|
|
4739
|
+
__name(inCwd, "inCwd");
|
|
4732
4740
|
}
|
|
4733
4741
|
});
|
|
4734
4742
|
|
|
@@ -27463,7 +27471,7 @@ import { coerce, satisfies } from "semver";
|
|
|
27463
27471
|
var singleComment = Symbol("singleComment");
|
|
27464
27472
|
var multiComment = Symbol("multiComment");
|
|
27465
27473
|
var stripWithoutWhitespace = /* @__PURE__ */ __name(() => "", "stripWithoutWhitespace");
|
|
27466
|
-
var stripWithWhitespace = /* @__PURE__ */ __name((string, start, end) => string.slice(start, end).replace(
|
|
27474
|
+
var stripWithWhitespace = /* @__PURE__ */ __name((string, start, end) => string.slice(start, end).replace(/[^ \t\r\n]/g, " "), "stripWithWhitespace");
|
|
27467
27475
|
var isEscaped = /* @__PURE__ */ __name((jsonString, quotePosition) => {
|
|
27468
27476
|
let index = quotePosition - 1;
|
|
27469
27477
|
let backslashCount = 0;
|
|
@@ -27544,7 +27552,8 @@ function stripJsonComments(jsonString, { whitespace = true, trailingCommas = fal
|
|
|
27544
27552
|
}
|
|
27545
27553
|
}
|
|
27546
27554
|
}
|
|
27547
|
-
|
|
27555
|
+
const remaining = isInsideComment === singleComment ? strip(jsonString, offset) : jsonString.slice(offset);
|
|
27556
|
+
return result + buffer + remaining;
|
|
27548
27557
|
}
|
|
27549
27558
|
__name(stripJsonComments, "stripJsonComments");
|
|
27550
27559
|
|
|
@@ -28011,7 +28020,7 @@ async function adjustTemplate(templatePath, templateData) {
|
|
|
28011
28020
|
}
|
|
28012
28021
|
__name(adjustTemplate, "adjustTemplate");
|
|
28013
28022
|
async function isNxProject() {
|
|
28014
|
-
return
|
|
28023
|
+
return up("nx.json", { last: getProjectRoot() });
|
|
28015
28024
|
}
|
|
28016
28025
|
__name(isNxProject, "isNxProject");
|
|
28017
28026
|
function coerceSemver(version) {
|
|
@@ -28085,8 +28094,8 @@ function detectFrameworkPreset(packageJson = {}) {
|
|
|
28085
28094
|
}
|
|
28086
28095
|
__name(detectFrameworkPreset, "detectFrameworkPreset");
|
|
28087
28096
|
async function detectBuilder(packageManager, projectType) {
|
|
28088
|
-
const viteConfig =
|
|
28089
|
-
const webpackConfig =
|
|
28097
|
+
const viteConfig = any(viteConfigFiles, { last: getProjectRoot2() });
|
|
28098
|
+
const webpackConfig = any(webpackConfigFiles, { last: getProjectRoot2() });
|
|
28090
28099
|
const dependencies = packageManager.getAllDependencies();
|
|
28091
28100
|
if (viteConfig || dependencies.vite && dependencies.webpack === void 0) {
|
|
28092
28101
|
commandLog("Detected Vite project. Setting builder to Vite")();
|
|
@@ -28134,7 +28143,7 @@ function isStorybookInstantiated(configDir = resolve2(process.cwd(), ".storybook
|
|
|
28134
28143
|
}
|
|
28135
28144
|
__name(isStorybookInstantiated, "isStorybookInstantiated");
|
|
28136
28145
|
async function detectPnp() {
|
|
28137
|
-
return !!
|
|
28146
|
+
return !!any([".pnp.js", ".pnp.cjs"]);
|
|
28138
28147
|
}
|
|
28139
28148
|
__name(detectPnp, "detectPnp");
|
|
28140
28149
|
async function detectLanguage(packageManager) {
|
|
@@ -28325,6 +28334,10 @@ import { logger as logger4, prompt } from "storybook/internal/node-logger";
|
|
|
28325
28334
|
var INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
28326
28335
|
var INDENT_TYPE_SPACE = "space";
|
|
28327
28336
|
var INDENT_TYPE_TAB = "tab";
|
|
28337
|
+
function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
|
|
28338
|
+
return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && value === 1;
|
|
28339
|
+
}
|
|
28340
|
+
__name(shouldIgnoreSingleSpace, "shouldIgnoreSingleSpace");
|
|
28328
28341
|
function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
28329
28342
|
const indents = /* @__PURE__ */ new Map();
|
|
28330
28343
|
let previousSize = 0;
|
|
@@ -28334,39 +28347,36 @@ function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
|
28334
28347
|
if (!line) {
|
|
28335
28348
|
continue;
|
|
28336
28349
|
}
|
|
28337
|
-
let indent;
|
|
28338
|
-
let indentType;
|
|
28339
|
-
let use;
|
|
28340
|
-
let weight;
|
|
28341
|
-
let entry;
|
|
28342
28350
|
const matches = line.match(INDENT_REGEX);
|
|
28343
28351
|
if (matches === null) {
|
|
28344
28352
|
previousSize = 0;
|
|
28345
28353
|
previousIndentType = "";
|
|
28346
28354
|
} else {
|
|
28347
|
-
indent = matches[0].length;
|
|
28348
|
-
indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
28349
|
-
if (ignoreSingleSpaces
|
|
28355
|
+
const indent = matches[0].length;
|
|
28356
|
+
const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
28357
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) {
|
|
28350
28358
|
continue;
|
|
28351
28359
|
}
|
|
28352
28360
|
if (indentType !== previousIndentType) {
|
|
28353
28361
|
previousSize = 0;
|
|
28354
28362
|
}
|
|
28355
28363
|
previousIndentType = indentType;
|
|
28356
|
-
use = 1;
|
|
28357
|
-
weight = 0;
|
|
28364
|
+
let use = 1;
|
|
28365
|
+
let weight = 0;
|
|
28358
28366
|
const indentDifference = indent - previousSize;
|
|
28359
28367
|
previousSize = indent;
|
|
28360
28368
|
if (indentDifference === 0) {
|
|
28361
28369
|
use = 0;
|
|
28362
28370
|
weight = 1;
|
|
28363
28371
|
} else {
|
|
28364
|
-
const absoluteIndentDifference = indentDifference
|
|
28372
|
+
const absoluteIndentDifference = Math.abs(indentDifference);
|
|
28373
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) {
|
|
28374
|
+
continue;
|
|
28375
|
+
}
|
|
28365
28376
|
key = encodeIndentsKey(indentType, absoluteIndentDifference);
|
|
28366
28377
|
}
|
|
28367
|
-
entry = indents.get(key);
|
|
28368
|
-
|
|
28369
|
-
indents.set(key, entry);
|
|
28378
|
+
const entry = indents.get(key);
|
|
28379
|
+
indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
|
|
28370
28380
|
}
|
|
28371
28381
|
}
|
|
28372
28382
|
return indents;
|
|
@@ -28432,11 +28442,11 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
|
28432
28442
|
var import_ts_dedent2 = __toESM(require_dist(), 1);
|
|
28433
28443
|
var SUPPORTED_ESLINT_EXTENSIONS = ["ts", "mts", "cts", "mjs", "js", "cjs", "json"];
|
|
28434
28444
|
var UNSUPPORTED_ESLINT_EXTENSIONS = ["yaml", "yml"];
|
|
28435
|
-
var findEslintFile = /* @__PURE__ */ __name(
|
|
28445
|
+
var findEslintFile = /* @__PURE__ */ __name((instanceDir) => {
|
|
28436
28446
|
const filePrefixes = ["eslint.config", ".eslintrc"];
|
|
28437
28447
|
for (const prefix of filePrefixes) {
|
|
28438
28448
|
for (const ext of UNSUPPORTED_ESLINT_EXTENSIONS) {
|
|
28439
|
-
const file =
|
|
28449
|
+
const file = up(`${prefix}.${ext}`, { cwd: instanceDir, last: getProjectRoot3() });
|
|
28440
28450
|
if (file) {
|
|
28441
28451
|
throw new Error(`Unsupported ESLint config extension: .${ext}`);
|
|
28442
28452
|
}
|
|
@@ -28444,7 +28454,7 @@ var findEslintFile = /* @__PURE__ */ __name(async (instanceDir) => {
|
|
|
28444
28454
|
}
|
|
28445
28455
|
for (const prefix of filePrefixes) {
|
|
28446
28456
|
for (const ext of SUPPORTED_ESLINT_EXTENSIONS) {
|
|
28447
|
-
const file =
|
|
28457
|
+
const file = up(`${prefix}.${ext}`, { cwd: instanceDir, last: getProjectRoot3() });
|
|
28448
28458
|
if (file) {
|
|
28449
28459
|
return file;
|
|
28450
28460
|
}
|
|
@@ -28526,7 +28536,7 @@ async function extractEslintInfo(packageManager) {
|
|
|
28526
28536
|
const { packageJson } = packageManager.primaryPackageJson;
|
|
28527
28537
|
let eslintConfigFile = void 0;
|
|
28528
28538
|
try {
|
|
28529
|
-
eslintConfigFile =
|
|
28539
|
+
eslintConfigFile = findEslintFile(packageManager.instanceDir);
|
|
28530
28540
|
} catch (err) {
|
|
28531
28541
|
if (err instanceof Error && err.message.includes("Unsupported ESLint")) {
|
|
28532
28542
|
unsupportedExtension = String(err);
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1140,6 +1140,8 @@ declare const normalizeStories: (entries: StoriesEntry[], options: NormalizeOpti
|
|
|
1140
1140
|
|
|
1141
1141
|
declare const getProjectRoot: () => string;
|
|
1142
1142
|
declare const invalidateProjectRootCache: () => void;
|
|
1143
|
+
/** Finds files in the directory tree up to the project root */
|
|
1144
|
+
declare const findFilesUp: (matchers: string[], baseDir?: string) => string[];
|
|
1143
1145
|
declare const nodePathsToArray: (nodePath: string) => string[];
|
|
1144
1146
|
/** Ensures that a path starts with `./` or `../`, or is entirely `.` or `..` */
|
|
1145
1147
|
declare function normalizeStoryPath(filename: string): string;
|
|
@@ -1301,4 +1303,4 @@ declare const safeResolveModule: ({ specifier, parent, extensions, }: {
|
|
|
1301
1303
|
extensions?: string[];
|
|
1302
1304
|
}) => string | undefined;
|
|
1303
1305
|
|
|
1304
|
-
export { COMMON_ENV_VARS, DEFAULT_FILES_PATTERN, type FileOptions, FileSystemCache, HandledError, type InstallationMetadata, JsPackageManager, JsPackageManagerFactory, type PackageJsonInfo, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, type RemoveAddonOptions, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, formatFileContent, frameworkPackages, frameworkToRenderer, getAddonNames, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getPackageDetails, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, getSyncedStorybookAddons, globToRegexp, importMetaResolve, importModule, interpolate, invalidateProjectRootCache, isCI, isCorePackage, isPreservingSymlinks, isSatelliteAddon, loadAllPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, optionalEnvToBoolean, paddedLog, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolvePackageDir, resolvePathInStorybookCache, safeResolveModule, satisfies, scanAndTransformFiles, serverRequire, stringifyEnvs, stringifyProcessEnvs, supportedExtensions, syncStorybookAddons, temporaryDirectory, temporaryFile, transformImportFiles, validateConfigurationFiles, validateFrameworkName, _default as versions };
|
|
1306
|
+
export { COMMON_ENV_VARS, DEFAULT_FILES_PATTERN, type FileOptions, FileSystemCache, HandledError, type InstallationMetadata, JsPackageManager, JsPackageManagerFactory, type PackageJsonInfo, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, type RemoveAddonOptions, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, findFilesUp, formatFileContent, frameworkPackages, frameworkToRenderer, getAddonNames, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getPackageDetails, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, getSyncedStorybookAddons, globToRegexp, importMetaResolve, importModule, interpolate, invalidateProjectRootCache, isCI, isCorePackage, isPreservingSymlinks, isSatelliteAddon, loadAllPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, optionalEnvToBoolean, paddedLog, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolvePackageDir, resolvePathInStorybookCache, safeResolveModule, satisfies, scanAndTransformFiles, serverRequire, stringifyEnvs, stringifyProcessEnvs, supportedExtensions, syncStorybookAddons, temporaryDirectory, temporaryFile, transformImportFiles, validateConfigurationFiles, validateFrameworkName, _default as versions };
|
package/dist/common/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -83,13 +83,13 @@ import {
|
|
|
83
83
|
transformImportFiles,
|
|
84
84
|
validateConfigurationFiles,
|
|
85
85
|
validateFrameworkName
|
|
86
|
-
} from "../_node-chunks/chunk-
|
|
87
|
-
import "../_node-chunks/chunk-
|
|
88
|
-
import "../_node-chunks/chunk-JDKH3XYB.js";
|
|
86
|
+
} from "../_node-chunks/chunk-OL6DY6BT.js";
|
|
87
|
+
import "../_node-chunks/chunk-TH5QVQRL.js";
|
|
89
88
|
import {
|
|
90
89
|
versions_default
|
|
91
|
-
} from "../_node-chunks/chunk-
|
|
90
|
+
} from "../_node-chunks/chunk-SFJFSPRT.js";
|
|
92
91
|
import {
|
|
92
|
+
findFilesUp,
|
|
93
93
|
getProjectRoot,
|
|
94
94
|
invalidateProjectRootCache,
|
|
95
95
|
isCI,
|
|
@@ -99,23 +99,22 @@ import {
|
|
|
99
99
|
optionalEnvToBoolean,
|
|
100
100
|
stringifyEnvs,
|
|
101
101
|
stringifyProcessEnvs
|
|
102
|
-
} from "../_node-chunks/chunk-
|
|
103
|
-
import "../_node-chunks/chunk-
|
|
104
|
-
import "../_node-chunks/chunk-
|
|
105
|
-
import "../_node-chunks/chunk-UIREEOC7.js";
|
|
102
|
+
} from "../_node-chunks/chunk-IHPLRRAR.js";
|
|
103
|
+
import "../_node-chunks/chunk-C5V22GP7.js";
|
|
104
|
+
import "../_node-chunks/chunk-KGX33KXX.js";
|
|
106
105
|
import {
|
|
107
106
|
importMetaResolve,
|
|
108
107
|
importModule,
|
|
109
108
|
resolvePackageDir,
|
|
110
109
|
safeResolveModule
|
|
111
|
-
} from "../_node-chunks/chunk-
|
|
112
|
-
import "../_node-chunks/chunk-
|
|
113
|
-
import "../_node-chunks/chunk-
|
|
114
|
-
import "../_node-chunks/chunk-
|
|
115
|
-
import "../_node-chunks/chunk-
|
|
116
|
-
import "../_node-chunks/chunk-
|
|
117
|
-
import "../_node-chunks/chunk-
|
|
118
|
-
import "../_node-chunks/chunk-
|
|
110
|
+
} from "../_node-chunks/chunk-R54K4KSM.js";
|
|
111
|
+
import "../_node-chunks/chunk-AOH6ABSV.js";
|
|
112
|
+
import "../_node-chunks/chunk-UV3CZ3KS.js";
|
|
113
|
+
import "../_node-chunks/chunk-S2LZC6JK.js";
|
|
114
|
+
import "../_node-chunks/chunk-KLVABNEU.js";
|
|
115
|
+
import "../_node-chunks/chunk-GUJVZUYI.js";
|
|
116
|
+
import "../_node-chunks/chunk-FIROF4DV.js";
|
|
117
|
+
import "../_node-chunks/chunk-SSN5PKIY.js";
|
|
119
118
|
export {
|
|
120
119
|
COMMON_ENV_VARS,
|
|
121
120
|
DEFAULT_FILES_PATTERN,
|
|
@@ -135,6 +134,7 @@ export {
|
|
|
135
134
|
extractProperRendererNameFromFramework,
|
|
136
135
|
filterPresetsConfig,
|
|
137
136
|
findConfigFile,
|
|
137
|
+
findFilesUp,
|
|
138
138
|
formatFileContent,
|
|
139
139
|
frameworkPackages,
|
|
140
140
|
frameworkToRenderer,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ComponentProps, AnchorHTMLAttributes, MouseEvent, ReactNode, ReactElement, ButtonHTMLAttributes, SyntheticEvent, Component, RefObject, FC, PropsWithChildren, DetailedHTMLProps, RefAttributes, ElementType } from 'react';
|
|
3
|
-
import { Config, PopperOptions } from 'react-popper-tooltip';
|
|
4
3
|
import { Addon_RenderOptions } from 'storybook/internal/types';
|
|
5
4
|
import { FunctionInterpolation } from 'storybook/theming';
|
|
6
5
|
|
|
@@ -720,6 +719,234 @@ declare const Form: StyledComponent<{
|
|
|
720
719
|
Radio: (props: React.InputHTMLAttributes<HTMLInputElement>) => React$1.JSX.Element;
|
|
721
720
|
};
|
|
722
721
|
|
|
722
|
+
declare const top: "top";
|
|
723
|
+
declare const bottom: "bottom";
|
|
724
|
+
declare const right: "right";
|
|
725
|
+
declare const left: "left";
|
|
726
|
+
declare type BasePlacement = typeof top | typeof bottom | typeof right | typeof left;
|
|
727
|
+
declare type VariationPlacement = "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end";
|
|
728
|
+
declare type AutoPlacement = "auto" | "auto-start" | "auto-end";
|
|
729
|
+
declare type Placement = AutoPlacement | BasePlacement | VariationPlacement;
|
|
730
|
+
declare const beforeRead: "beforeRead";
|
|
731
|
+
declare const read: "read";
|
|
732
|
+
declare const afterRead: "afterRead";
|
|
733
|
+
declare const beforeMain: "beforeMain";
|
|
734
|
+
declare const main: "main";
|
|
735
|
+
declare const afterMain: "afterMain";
|
|
736
|
+
declare const beforeWrite: "beforeWrite";
|
|
737
|
+
declare const write: "write";
|
|
738
|
+
declare const afterWrite: "afterWrite";
|
|
739
|
+
declare type ModifierPhases = typeof beforeRead | typeof read | typeof afterRead | typeof beforeMain | typeof main | typeof afterMain | typeof beforeWrite | typeof write | typeof afterWrite;
|
|
740
|
+
|
|
741
|
+
declare type Obj = {
|
|
742
|
+
[key: string]: any;
|
|
743
|
+
};
|
|
744
|
+
declare type VisualViewport = EventTarget & {
|
|
745
|
+
width: number;
|
|
746
|
+
height: number;
|
|
747
|
+
offsetLeft: number;
|
|
748
|
+
offsetTop: number;
|
|
749
|
+
scale: number;
|
|
750
|
+
};
|
|
751
|
+
declare type Window = {
|
|
752
|
+
innerHeight: number;
|
|
753
|
+
offsetHeight: number;
|
|
754
|
+
innerWidth: number;
|
|
755
|
+
offsetWidth: number;
|
|
756
|
+
pageXOffset: number;
|
|
757
|
+
pageYOffset: number;
|
|
758
|
+
getComputedStyle: typeof getComputedStyle;
|
|
759
|
+
addEventListener(type: any, listener: any, optionsOrUseCapture?: any): void;
|
|
760
|
+
removeEventListener(type: any, listener: any, optionsOrUseCapture?: any): void;
|
|
761
|
+
Element: Element;
|
|
762
|
+
HTMLElement: HTMLElement;
|
|
763
|
+
Node: Node;
|
|
764
|
+
toString(): "[object Window]";
|
|
765
|
+
devicePixelRatio: number;
|
|
766
|
+
visualViewport?: VisualViewport;
|
|
767
|
+
ShadowRoot: ShadowRoot;
|
|
768
|
+
};
|
|
769
|
+
declare type Rect = {
|
|
770
|
+
width: number;
|
|
771
|
+
height: number;
|
|
772
|
+
x: number;
|
|
773
|
+
y: number;
|
|
774
|
+
};
|
|
775
|
+
declare type Offsets = {
|
|
776
|
+
y: number;
|
|
777
|
+
x: number;
|
|
778
|
+
};
|
|
779
|
+
declare type PositioningStrategy = "absolute" | "fixed";
|
|
780
|
+
declare type StateRects = {
|
|
781
|
+
reference: Rect;
|
|
782
|
+
popper: Rect;
|
|
783
|
+
};
|
|
784
|
+
declare type OffsetData = {
|
|
785
|
+
[key in Placement]?: Offsets;
|
|
786
|
+
};
|
|
787
|
+
declare type State = {
|
|
788
|
+
elements: {
|
|
789
|
+
reference: Element | VirtualElement;
|
|
790
|
+
popper: HTMLElement;
|
|
791
|
+
arrow?: HTMLElement;
|
|
792
|
+
};
|
|
793
|
+
options: OptionsGeneric<any>;
|
|
794
|
+
placement: Placement;
|
|
795
|
+
strategy: PositioningStrategy;
|
|
796
|
+
orderedModifiers: Array<Modifier<any, any>>;
|
|
797
|
+
rects: StateRects;
|
|
798
|
+
scrollParents: {
|
|
799
|
+
reference: Array<Element | Window | VisualViewport>;
|
|
800
|
+
popper: Array<Element | Window | VisualViewport>;
|
|
801
|
+
};
|
|
802
|
+
styles: {
|
|
803
|
+
[key: string]: Partial<CSSStyleDeclaration>;
|
|
804
|
+
};
|
|
805
|
+
attributes: {
|
|
806
|
+
[key: string]: {
|
|
807
|
+
[key: string]: string | boolean;
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
modifiersData: {
|
|
811
|
+
arrow?: {
|
|
812
|
+
x?: number;
|
|
813
|
+
y?: number;
|
|
814
|
+
centerOffset: number;
|
|
815
|
+
};
|
|
816
|
+
hide?: {
|
|
817
|
+
isReferenceHidden: boolean;
|
|
818
|
+
hasPopperEscaped: boolean;
|
|
819
|
+
referenceClippingOffsets: SideObject;
|
|
820
|
+
popperEscapeOffsets: SideObject;
|
|
821
|
+
};
|
|
822
|
+
offset?: OffsetData;
|
|
823
|
+
preventOverflow?: Offsets;
|
|
824
|
+
popperOffsets?: Offsets;
|
|
825
|
+
[key: string]: any;
|
|
826
|
+
};
|
|
827
|
+
reset: boolean;
|
|
828
|
+
};
|
|
829
|
+
declare type SetAction<S> = S | ((prev: S) => S);
|
|
830
|
+
declare type Instance = {
|
|
831
|
+
state: State;
|
|
832
|
+
destroy: () => void;
|
|
833
|
+
forceUpdate: () => void;
|
|
834
|
+
update: () => Promise<Partial<State>>;
|
|
835
|
+
setOptions: (setOptionsAction: SetAction<Partial<OptionsGeneric<any>>>) => Promise<Partial<State>>;
|
|
836
|
+
};
|
|
837
|
+
declare type ModifierArguments<Options extends Obj> = {
|
|
838
|
+
state: State;
|
|
839
|
+
instance: Instance;
|
|
840
|
+
options: Partial<Options>;
|
|
841
|
+
name: string;
|
|
842
|
+
};
|
|
843
|
+
declare type Modifier<Name, Options extends Obj> = {
|
|
844
|
+
name: Name;
|
|
845
|
+
enabled: boolean;
|
|
846
|
+
phase: ModifierPhases;
|
|
847
|
+
requires?: Array<string>;
|
|
848
|
+
requiresIfExists?: Array<string>;
|
|
849
|
+
fn: (arg0: ModifierArguments<Options>) => State | void;
|
|
850
|
+
effect?: (arg0: ModifierArguments<Options>) => (() => void) | void;
|
|
851
|
+
options?: Partial<Options>;
|
|
852
|
+
data?: Obj;
|
|
853
|
+
};
|
|
854
|
+
declare type Options = {
|
|
855
|
+
placement: Placement;
|
|
856
|
+
modifiers: Array<Partial<Modifier<any, any>>>;
|
|
857
|
+
strategy: PositioningStrategy;
|
|
858
|
+
onFirstUpdate?: (arg0: Partial<State>) => void;
|
|
859
|
+
};
|
|
860
|
+
declare type OptionsGeneric<TModifier> = {
|
|
861
|
+
placement: Placement;
|
|
862
|
+
modifiers: Array<TModifier>;
|
|
863
|
+
strategy: PositioningStrategy;
|
|
864
|
+
onFirstUpdate?: (arg0: Partial<State>) => void;
|
|
865
|
+
};
|
|
866
|
+
declare type SideObject = {
|
|
867
|
+
top: number;
|
|
868
|
+
left: number;
|
|
869
|
+
right: number;
|
|
870
|
+
bottom: number;
|
|
871
|
+
};
|
|
872
|
+
declare type VirtualElement = {
|
|
873
|
+
getBoundingClientRect: () => ClientRect | DOMRect;
|
|
874
|
+
contextElement?: Element;
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
declare const createPopper: <TModifier extends Partial<Modifier<any, any>>>(reference: Element | VirtualElement, popper: HTMLElement, options?: Partial<OptionsGeneric<TModifier>>) => Instance;
|
|
878
|
+
|
|
879
|
+
declare type TriggerType = 'click' | 'double-click' | 'right-click' | 'hover' | 'focus';
|
|
880
|
+
declare type Config = {
|
|
881
|
+
/**
|
|
882
|
+
* Whether to close the tooltip when its trigger is out of boundary
|
|
883
|
+
* @default false
|
|
884
|
+
*/
|
|
885
|
+
closeOnTriggerHidden?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Event or events that trigger the tooltip
|
|
888
|
+
* @default hover
|
|
889
|
+
*/
|
|
890
|
+
trigger?: TriggerType | TriggerType[] | null;
|
|
891
|
+
/**
|
|
892
|
+
* Delay in hiding the tooltip (ms)
|
|
893
|
+
* @default 0
|
|
894
|
+
*/
|
|
895
|
+
delayHide?: number;
|
|
896
|
+
/**
|
|
897
|
+
* Delay in showing the tooltip (ms)
|
|
898
|
+
* @default 0
|
|
899
|
+
*/
|
|
900
|
+
delayShow?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Whether to make the tooltip spawn at cursor position
|
|
903
|
+
* @default false
|
|
904
|
+
*/
|
|
905
|
+
followCursor?: boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Options to MutationObserver, used internally for updating
|
|
908
|
+
* tooltip position based on its DOM changes
|
|
909
|
+
* @default { attributes: true, childList: true, subtree: true }
|
|
910
|
+
*/
|
|
911
|
+
mutationObserverOptions?: MutationObserverInit | null;
|
|
912
|
+
/**
|
|
913
|
+
* Whether tooltip is shown by default
|
|
914
|
+
* @default false
|
|
915
|
+
*/
|
|
916
|
+
defaultVisible?: boolean;
|
|
917
|
+
/**
|
|
918
|
+
* Used to create controlled tooltip
|
|
919
|
+
*/
|
|
920
|
+
visible?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Called when the visibility of the tooltip changes
|
|
923
|
+
*/
|
|
924
|
+
onVisibleChange?: (state: boolean) => void;
|
|
925
|
+
/**
|
|
926
|
+
* If `true`, a click outside the trigger element closes the tooltip
|
|
927
|
+
* @default true
|
|
928
|
+
*/
|
|
929
|
+
closeOnOutsideClick?: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* If `true`, hovering the tooltip will keep it open. Normally tooltip closes when the mouse cursor moves out of
|
|
932
|
+
* the trigger element. If it moves to the tooltip element, the tooltip stays open.
|
|
933
|
+
* @default false
|
|
934
|
+
*/
|
|
935
|
+
interactive?: boolean;
|
|
936
|
+
/**
|
|
937
|
+
* Alias for popper.js placement, see https://popper.js.org/docs/v2/constructors/#placement
|
|
938
|
+
*/
|
|
939
|
+
placement?: Placement;
|
|
940
|
+
/**
|
|
941
|
+
* Shorthand for popper.js offset modifier, see https://popper.js.org/docs/v2/modifiers/offset/
|
|
942
|
+
* @default [0, 6]
|
|
943
|
+
*/
|
|
944
|
+
offset?: [number, number];
|
|
945
|
+
};
|
|
946
|
+
declare type PopperOptions = Partial<Options> & {
|
|
947
|
+
createPopper?: typeof createPopper;
|
|
948
|
+
};
|
|
949
|
+
|
|
723
950
|
declare const TargetContainer: StyledComponent<{
|
|
724
951
|
theme?: Theme;
|
|
725
952
|
as?: React__default.ElementType;
|
|
@@ -742,6 +969,11 @@ interface WithTooltipPureProps extends Omit<Config, 'closeOnOutsideClick'>, Omit
|
|
|
742
969
|
* @default false
|
|
743
970
|
*/
|
|
744
971
|
closeOnOutsideClick?: boolean;
|
|
972
|
+
/**
|
|
973
|
+
* Optional container to portal the tooltip into. Can be a CSS selector string or a DOM Element.
|
|
974
|
+
* Falls back to document.body.
|
|
975
|
+
*/
|
|
976
|
+
portalContainer?: Element | string | null;
|
|
745
977
|
}
|
|
746
978
|
interface WithTooltipStateProps extends Omit<WithTooltipPureProps, 'onVisibleChange'> {
|
|
747
979
|
startOpen?: boolean;
|
|
@@ -750,7 +982,7 @@ interface WithTooltipStateProps extends Omit<WithTooltipPureProps, 'onVisibleCha
|
|
|
750
982
|
|
|
751
983
|
declare const LazyWithTooltip: React__default.LazyExoticComponent<({ startOpen, onVisibleChange: onChange, ...rest }: WithTooltipStateProps) => React__default.JSX.Element>;
|
|
752
984
|
declare const WithTooltip: (props: ComponentProps<typeof LazyWithTooltip>) => React__default.JSX.Element;
|
|
753
|
-
declare const LazyWithTooltipPure: React__default.LazyExoticComponent<({ svg, trigger, closeOnOutsideClick, placement, modifiers, hasChrome, defaultVisible, withArrows, offset, tooltip, children, closeOnTriggerHidden, mutationObserverOptions, delayHide, visible, interactive, delayShow, strategy, followCursor, onVisibleChange, ...props }: WithTooltipPureProps) => React__default.JSX.Element>;
|
|
985
|
+
declare const LazyWithTooltipPure: React__default.LazyExoticComponent<({ svg, trigger, closeOnOutsideClick, placement, modifiers, hasChrome, defaultVisible, withArrows, offset, tooltip, children, closeOnTriggerHidden, mutationObserverOptions, delayHide, visible, interactive, delayShow, strategy, followCursor, onVisibleChange, portalContainer, ...props }: WithTooltipPureProps) => React__default.JSX.Element>;
|
|
754
986
|
declare const WithTooltipPure: (props: ComponentProps<typeof LazyWithTooltipPure>) => React__default.JSX.Element;
|
|
755
987
|
|
|
756
988
|
interface TooltipMessageProps {
|