@trackunit/shared-utils 1.9.37 → 1.9.39
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/package.json +3 -2
- package/src/index.d.ts +1 -0
- package/src/storybookUtils.d.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/shared-utils",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.39",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.x"
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"uuid": "^11.1.0",
|
|
11
|
-
"@trackunit/react-test-setup": "1.4.
|
|
11
|
+
"@trackunit/react-test-setup": "1.4.39",
|
|
12
|
+
"@storybook/react-webpack5": "9.0.15",
|
|
12
13
|
"zod": "^3.23.8"
|
|
13
14
|
},
|
|
14
15
|
"module": "./index.esm.js",
|
package/src/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./objectUtils";
|
|
|
18
18
|
export * from "./pathUtils";
|
|
19
19
|
export * from "./pictureUtils/pictureUtils";
|
|
20
20
|
export * from "./sorting/sorting";
|
|
21
|
+
export * from "./storybookUtils";
|
|
21
22
|
export * from "./stringUtils";
|
|
22
23
|
export * from "./svgTools";
|
|
23
24
|
export * from "./translationUtils";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react-webpack5";
|
|
2
|
+
import { MappedOmit } from "./typeUtils";
|
|
3
|
+
type ArgsType<TMeta extends Meta> = NonNullable<Pick<StoryObj<TMeta>, "args">["args"]>;
|
|
4
|
+
/**
|
|
5
|
+
* Make specific args optional - defaults to all args optional if no keys specified
|
|
6
|
+
* The idea is to allow not passing specific complex args like children components, form controllers etc. (components are complex)
|
|
7
|
+
* Then you must apply the nessescary args in the story itself.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* type Story = StoryObjWithOptionalArgs<typeof meta, "children">;
|
|
12
|
+
* ```
|
|
13
|
+
* @param TMeta - The meta object of the story
|
|
14
|
+
* @param TOptionalKeys - The keys of the args to make optional
|
|
15
|
+
* @returns The story object with the specific args optional
|
|
16
|
+
*/
|
|
17
|
+
export type StoryObjWithOptionalArgs<TMeta extends Meta, TOptionalKeys extends keyof ArgsType<TMeta> = keyof ArgsType<TMeta>> = MappedOmit<StoryObj<TMeta>, "args"> & {
|
|
18
|
+
args: Omit<ArgsType<TMeta>, TOptionalKeys> & Partial<Pick<ArgsType<TMeta>, TOptionalKeys>>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|