@repobuddy/storybook 2.14.0 → 2.16.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/esm/index.js +2 -2
- package/esm/storybook-addon-tag-badges/index.d.ts +49 -21
- package/esm/storybook-addon-tag-badges/index.js +90 -26
- package/package.json +1 -1
- package/readme.md +4 -0
- package/src/contexts/{story_card_scope.tsx → _story_card_scope.tsx} +1 -1
- package/src/decorators/show_doc_source.tsx +1 -1
- package/src/decorators/with_story_card.tsx +1 -1
- package/src/storybook-addon-tag-badges/tag_badges.ts +101 -25
- /package/src/contexts/{story_card_registry_context.tsx → _story_card_registry_context.tsx} +0 -0
package/esm/index.js
CHANGED
|
@@ -93,11 +93,11 @@ function generateKey(prefix) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
//#endregion
|
|
96
|
-
//#region src/contexts/
|
|
96
|
+
//#region src/contexts/_story_card_registry_context.tsx
|
|
97
97
|
const StoryCardRegistryContext = createContext(null);
|
|
98
98
|
|
|
99
99
|
//#endregion
|
|
100
|
-
//#region src/contexts/
|
|
100
|
+
//#region src/contexts/_story_card_scope.tsx
|
|
101
101
|
/**
|
|
102
102
|
* Ensures a story-card collection scope: creates the root container when no context exists,
|
|
103
103
|
* otherwise renders the collector so this card participates in the existing scope.
|
|
@@ -8,41 +8,69 @@ type TagBadgeParameter = TagBadgeParameters[0];
|
|
|
8
8
|
/**
|
|
9
9
|
* Type representing the names of predefined tags used in Storybook stories.
|
|
10
10
|
*/
|
|
11
|
-
type TagNames = 'editor' | 'source' | 'new' | 'beta' | 'props' | 'deprecated' | 'outdated' | 'danger' | 'todo' | 'code-only' | 'snapshot' | 'unit' | 'integration' | 'keyboard' | 'internal' | 'usecase' | 'version:next';
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
14
|
-
* Each badge is associated with a specific tag and displays an emoji with a tooltip.
|
|
15
|
-
*
|
|
16
|
-
* The badges help visually identify stories with certain characteristics:
|
|
17
|
-
* - ✏️ Editor - Stories with live editor
|
|
18
|
-
* - 🆕 New - Recently added stories
|
|
19
|
-
* - 🅱️ Beta - Stories for features in beta
|
|
20
|
-
* - 🪦 Deprecated - Stories for deprecated features
|
|
21
|
-
* - ⚠️ Outdated - Stories that need updating
|
|
22
|
-
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
23
|
-
* - 📋 Todo - Stories marked as todo/incomplete
|
|
24
|
-
* - 📝 Code Only - Stories without visual examples
|
|
25
|
-
* - 📸 Snapshot - Stories with snapshot tests
|
|
26
|
-
* - 🧪 Unit - Stories with unit tests
|
|
27
|
-
* - 🔗 Integration - Stories with integration tests
|
|
28
|
-
*
|
|
29
|
-
* Also includes the default version badge from `storybook-addon-tag-badges`.
|
|
30
|
-
*/
|
|
11
|
+
type TagNames = 'editor' | 'source' | 'type' | 'func' | 'var' | 'new' | 'beta' | 'props' | 'deprecated' | 'outdated' | 'danger' | 'todo' | 'code-only' | 'snapshot' | 'unit' | 'integration' | 'keyboard' | 'internal' | 'usecase' | 'version:next';
|
|
12
|
+
/** Badge (✏️) for stories with a live editor. Shown in sidebar on story and inherited. */
|
|
31
13
|
declare const editorBadge: TagBadgeParameter;
|
|
14
|
+
/** Badge (🆕) for recently added stories. */
|
|
32
15
|
declare const newBadge: TagBadgeParameter;
|
|
16
|
+
/** Badge (🅱️) for stories covering features in beta. */
|
|
33
17
|
declare const betaBadge: TagBadgeParameter;
|
|
18
|
+
/** Badge (🔧) for stories that demonstrate props or configuration. */
|
|
34
19
|
declare const propsBadge: TagBadgeParameter;
|
|
20
|
+
/** Badge (🪦) for stories documenting deprecated features. */
|
|
35
21
|
declare const deprecatedBadge: TagBadgeParameter;
|
|
22
|
+
/** Badge (⚠️) for stories that need updating. */
|
|
36
23
|
declare const outdatedBadge: TagBadgeParameter;
|
|
24
|
+
/** Badge (🚨) for stories demonstrating dangerous or cautionary patterns. */
|
|
37
25
|
declare const dangerBadge: TagBadgeParameter;
|
|
26
|
+
/** Badge (📋) for stories marked as todo or incomplete. */
|
|
38
27
|
declare const todoBadge: TagBadgeParameter;
|
|
28
|
+
/** Badge (📝) for stories without visual examples (code-only). Hidden in MDX. */
|
|
39
29
|
declare const codeOnlyBadge: TagBadgeParameter;
|
|
30
|
+
/** Badge (<T>) for stories that showcase or document TypeScript types. Hidden in MDX. */
|
|
31
|
+
declare const typeBadge: TagBadgeParameter;
|
|
32
|
+
/** Badge (ƒ(x)) for stories that showcase or document functions. Hidden in MDX. */
|
|
33
|
+
declare const functionBadge: TagBadgeParameter;
|
|
34
|
+
/** Badge (var) for stories that describe values and variables. */
|
|
35
|
+
declare const varBadge: TagBadgeParameter;
|
|
36
|
+
/** Badge (`</>`) for source-code-focused stories. Hidden in MDX. */
|
|
40
37
|
declare const sourceBadge: TagBadgeParameter;
|
|
38
|
+
/** Badge (📸) for stories with snapshot tests. Shown in toolbar only, not in sidebar. */
|
|
41
39
|
declare const snapshotBadge: TagBadgeParameter;
|
|
40
|
+
/** Badge (🧪) for stories with unit tests. */
|
|
42
41
|
declare const unitBadge: TagBadgeParameter;
|
|
42
|
+
/** Badge (🔗) for stories with integration tests. Hidden in sidebar. */
|
|
43
43
|
declare const integrationBadge: TagBadgeParameter;
|
|
44
|
+
/** Badge (⌨️) for stories that demonstrate or test keyboard interaction. */
|
|
44
45
|
declare const keyboardBadge: TagBadgeParameter;
|
|
46
|
+
/** Badge (🔒) for internal or private-use-only stories. */
|
|
45
47
|
declare const internalBadge: TagBadgeParameter;
|
|
48
|
+
/**
|
|
49
|
+
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
50
|
+
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
51
|
+
*
|
|
52
|
+
* The badges help visually identify stories with certain characteristics:
|
|
53
|
+
* - 🆕 New - Recently added stories
|
|
54
|
+
* - 🅱️ Beta - Stories for features in beta
|
|
55
|
+
* - 🪦 Deprecated - Stories for deprecated features
|
|
56
|
+
* - ⚠️ Outdated - Stories that need updating
|
|
57
|
+
* - ✏️ Editor - Stories with live editor
|
|
58
|
+
* - 🧪 Unit - Stories with unit tests
|
|
59
|
+
* - 🔗 Integration - Stories with integration tests
|
|
60
|
+
* - ⌨️ Keyboard - Stories that demonstrate or test keyboard interaction
|
|
61
|
+
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
62
|
+
* - `</>` Source - Source-code-focused stories
|
|
63
|
+
* - `<T>` Type - Stories that showcase or document TypeScript types
|
|
64
|
+
* - `ƒ(x)` Function - Stories that showcase or document functions
|
|
65
|
+
* - `var` Variables - Stories that describe values and variables
|
|
66
|
+
* - 🔧 Props - Stories that demonstrate props or configuration
|
|
67
|
+
* - 📝 Code Only - Stories without visual examples
|
|
68
|
+
* - 📋 Todo - Stories marked as todo/incomplete
|
|
69
|
+
* - `next` - (`version:next`) The component or function is available in the next version
|
|
70
|
+
* - `x.y` - (`version:x.y`) The component or function was created or updated in the x.y version
|
|
71
|
+
* - 🔒 Internal - Internal or private-use-only stories
|
|
72
|
+
* - 📸 Snapshot - Stories with snapshot tests
|
|
73
|
+
*/
|
|
46
74
|
declare const tagBadges: TagBadgeParameters;
|
|
47
75
|
//#endregion
|
|
48
76
|
//#region src/types/_extract_string_literals.d.ts
|
|
@@ -116,4 +144,4 @@ type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryO
|
|
|
116
144
|
tag: TagNames;
|
|
117
145
|
}>;
|
|
118
146
|
//#endregion
|
|
119
|
-
export { Meta, StoryObj, TagNames, betaBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, propsBadge, snapshotBadge, sourceBadge, tagBadges, todoBadge, unitBadge };
|
|
147
|
+
export { Meta, StoryObj, TagNames, betaBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, propsBadge, snapshotBadge, sourceBadge, tagBadges, todoBadge, typeBadge, unitBadge, varBadge };
|
|
@@ -3,25 +3,7 @@ import { defaultConfig } from "storybook-addon-tag-badges/manager-helpers";
|
|
|
3
3
|
|
|
4
4
|
//#region src/storybook-addon-tag-badges/tag_badges.ts
|
|
5
5
|
const [, , , , , , versionBadge] = defaultConfig;
|
|
6
|
-
/**
|
|
7
|
-
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
8
|
-
* Each badge is associated with a specific tag and displays an emoji with a tooltip.
|
|
9
|
-
*
|
|
10
|
-
* The badges help visually identify stories with certain characteristics:
|
|
11
|
-
* - ✏️ Editor - Stories with live editor
|
|
12
|
-
* - 🆕 New - Recently added stories
|
|
13
|
-
* - 🅱️ Beta - Stories for features in beta
|
|
14
|
-
* - 🪦 Deprecated - Stories for deprecated features
|
|
15
|
-
* - ⚠️ Outdated - Stories that need updating
|
|
16
|
-
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
17
|
-
* - 📋 Todo - Stories marked as todo/incomplete
|
|
18
|
-
* - 📝 Code Only - Stories without visual examples
|
|
19
|
-
* - 📸 Snapshot - Stories with snapshot tests
|
|
20
|
-
* - 🧪 Unit - Stories with unit tests
|
|
21
|
-
* - 🔗 Integration - Stories with integration tests
|
|
22
|
-
*
|
|
23
|
-
* Also includes the default version badge from `storybook-addon-tag-badges`.
|
|
24
|
-
*/
|
|
6
|
+
/** Badge (✏️) for stories with a live editor. Shown in sidebar on story and inherited. */
|
|
25
7
|
const editorBadge = {
|
|
26
8
|
tags: "editor",
|
|
27
9
|
badge: {
|
|
@@ -37,6 +19,7 @@ const editorBadge = {
|
|
|
37
19
|
skipInherited: false
|
|
38
20
|
} }
|
|
39
21
|
};
|
|
22
|
+
/** Badge (🆕) for recently added stories. */
|
|
40
23
|
const newBadge = {
|
|
41
24
|
tags: "new",
|
|
42
25
|
badge: {
|
|
@@ -48,6 +31,7 @@ const newBadge = {
|
|
|
48
31
|
tooltip: "New"
|
|
49
32
|
}
|
|
50
33
|
};
|
|
34
|
+
/** Badge (🅱️) for stories covering features in beta. */
|
|
51
35
|
const betaBadge = {
|
|
52
36
|
tags: "beta",
|
|
53
37
|
badge: {
|
|
@@ -59,6 +43,7 @@ const betaBadge = {
|
|
|
59
43
|
tooltip: "Beta"
|
|
60
44
|
}
|
|
61
45
|
};
|
|
46
|
+
/** Badge (🔧) for stories that demonstrate props or configuration. */
|
|
62
47
|
const propsBadge = {
|
|
63
48
|
tags: "props",
|
|
64
49
|
badge: {
|
|
@@ -70,6 +55,7 @@ const propsBadge = {
|
|
|
70
55
|
tooltip: "Props"
|
|
71
56
|
}
|
|
72
57
|
};
|
|
58
|
+
/** Badge (🪦) for stories documenting deprecated features. */
|
|
73
59
|
const deprecatedBadge = {
|
|
74
60
|
tags: "deprecated",
|
|
75
61
|
badge: {
|
|
@@ -81,6 +67,7 @@ const deprecatedBadge = {
|
|
|
81
67
|
tooltip: "Deprecated"
|
|
82
68
|
}
|
|
83
69
|
};
|
|
70
|
+
/** Badge (⚠️) for stories that need updating. */
|
|
84
71
|
const outdatedBadge = {
|
|
85
72
|
tags: "outdated",
|
|
86
73
|
badge: {
|
|
@@ -92,6 +79,7 @@ const outdatedBadge = {
|
|
|
92
79
|
tooltip: "Outdated"
|
|
93
80
|
}
|
|
94
81
|
};
|
|
82
|
+
/** Badge (🚨) for stories demonstrating dangerous or cautionary patterns. */
|
|
95
83
|
const dangerBadge = {
|
|
96
84
|
tags: "danger",
|
|
97
85
|
badge: {
|
|
@@ -103,6 +91,7 @@ const dangerBadge = {
|
|
|
103
91
|
tooltip: "Dangerous"
|
|
104
92
|
}
|
|
105
93
|
};
|
|
94
|
+
/** Badge (📋) for stories marked as todo or incomplete. */
|
|
106
95
|
const todoBadge = {
|
|
107
96
|
tags: "todo",
|
|
108
97
|
badge: {
|
|
@@ -114,6 +103,7 @@ const todoBadge = {
|
|
|
114
103
|
tooltip: "Todo"
|
|
115
104
|
}
|
|
116
105
|
};
|
|
106
|
+
/** Badge (📝) for stories without visual examples (code-only). Hidden in MDX. */
|
|
117
107
|
const codeOnlyBadge = {
|
|
118
108
|
tags: "code-only",
|
|
119
109
|
badge: {
|
|
@@ -126,6 +116,46 @@ const codeOnlyBadge = {
|
|
|
126
116
|
},
|
|
127
117
|
display: { mdx: false }
|
|
128
118
|
};
|
|
119
|
+
/** Badge (<T>) for stories that showcase or document TypeScript types. Hidden in MDX. */
|
|
120
|
+
const typeBadge = {
|
|
121
|
+
tags: "type",
|
|
122
|
+
badge: {
|
|
123
|
+
text: "<T>",
|
|
124
|
+
style: {
|
|
125
|
+
backgroundColor: "transparent",
|
|
126
|
+
borderColor: "transparent"
|
|
127
|
+
},
|
|
128
|
+
tooltip: "TypeScript Types"
|
|
129
|
+
},
|
|
130
|
+
display: { mdx: true }
|
|
131
|
+
};
|
|
132
|
+
/** Badge (ƒ(x)) for stories that showcase or document functions. Hidden in MDX. */
|
|
133
|
+
const functionBadge = {
|
|
134
|
+
tags: "func",
|
|
135
|
+
badge: {
|
|
136
|
+
text: "ƒ(x)",
|
|
137
|
+
style: {
|
|
138
|
+
backgroundColor: "transparent",
|
|
139
|
+
borderColor: "transparent"
|
|
140
|
+
},
|
|
141
|
+
tooltip: "Function"
|
|
142
|
+
},
|
|
143
|
+
display: { mdx: true }
|
|
144
|
+
};
|
|
145
|
+
/** Badge (var) for stories that describe values and variables. */
|
|
146
|
+
const varBadge = {
|
|
147
|
+
tags: "var",
|
|
148
|
+
badge: {
|
|
149
|
+
text: "var",
|
|
150
|
+
style: {
|
|
151
|
+
backgroundColor: "transparent",
|
|
152
|
+
borderColor: "transparent"
|
|
153
|
+
},
|
|
154
|
+
tooltip: "Variables"
|
|
155
|
+
},
|
|
156
|
+
display: { mdx: true }
|
|
157
|
+
};
|
|
158
|
+
/** Badge (`</>`) for source-code-focused stories. Hidden in MDX. */
|
|
129
159
|
const sourceBadge = {
|
|
130
160
|
tags: "source",
|
|
131
161
|
badge: {
|
|
@@ -138,6 +168,7 @@ const sourceBadge = {
|
|
|
138
168
|
},
|
|
139
169
|
display: { mdx: false }
|
|
140
170
|
};
|
|
171
|
+
/** Badge (📸) for stories with snapshot tests. Shown in toolbar only, not in sidebar. */
|
|
141
172
|
const snapshotBadge = {
|
|
142
173
|
tags: "snapshot",
|
|
143
174
|
badge: {
|
|
@@ -153,6 +184,7 @@ const snapshotBadge = {
|
|
|
153
184
|
toolbar: ["story"]
|
|
154
185
|
}
|
|
155
186
|
};
|
|
187
|
+
/** Badge (🧪) for stories with unit tests. */
|
|
156
188
|
const unitBadge = {
|
|
157
189
|
tags: "unit",
|
|
158
190
|
badge: {
|
|
@@ -165,6 +197,7 @@ const unitBadge = {
|
|
|
165
197
|
},
|
|
166
198
|
display: { sidebar: true }
|
|
167
199
|
};
|
|
200
|
+
/** Badge (🔗) for stories with integration tests. Hidden in sidebar. */
|
|
168
201
|
const integrationBadge = {
|
|
169
202
|
tags: "integration",
|
|
170
203
|
badge: {
|
|
@@ -177,6 +210,7 @@ const integrationBadge = {
|
|
|
177
210
|
},
|
|
178
211
|
display: { sidebar: false }
|
|
179
212
|
};
|
|
213
|
+
/** Badge (⌨️) for stories that demonstrate or test keyboard interaction. */
|
|
180
214
|
const keyboardBadge = {
|
|
181
215
|
tags: "keyboard",
|
|
182
216
|
badge: {
|
|
@@ -188,6 +222,7 @@ const keyboardBadge = {
|
|
|
188
222
|
tooltip: "Keyboard Interaction"
|
|
189
223
|
}
|
|
190
224
|
};
|
|
225
|
+
/** Badge (🔒) for internal or private-use-only stories. */
|
|
191
226
|
const internalBadge = {
|
|
192
227
|
tags: "internal",
|
|
193
228
|
badge: {
|
|
@@ -199,24 +234,53 @@ const internalBadge = {
|
|
|
199
234
|
tooltip: "Internal"
|
|
200
235
|
}
|
|
201
236
|
};
|
|
237
|
+
/**
|
|
238
|
+
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
239
|
+
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
240
|
+
*
|
|
241
|
+
* The badges help visually identify stories with certain characteristics:
|
|
242
|
+
* - 🆕 New - Recently added stories
|
|
243
|
+
* - 🅱️ Beta - Stories for features in beta
|
|
244
|
+
* - 🪦 Deprecated - Stories for deprecated features
|
|
245
|
+
* - ⚠️ Outdated - Stories that need updating
|
|
246
|
+
* - ✏️ Editor - Stories with live editor
|
|
247
|
+
* - 🧪 Unit - Stories with unit tests
|
|
248
|
+
* - 🔗 Integration - Stories with integration tests
|
|
249
|
+
* - ⌨️ Keyboard - Stories that demonstrate or test keyboard interaction
|
|
250
|
+
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
251
|
+
* - `</>` Source - Source-code-focused stories
|
|
252
|
+
* - `<T>` Type - Stories that showcase or document TypeScript types
|
|
253
|
+
* - `ƒ(x)` Function - Stories that showcase or document functions
|
|
254
|
+
* - `var` Variables - Stories that describe values and variables
|
|
255
|
+
* - 🔧 Props - Stories that demonstrate props or configuration
|
|
256
|
+
* - 📝 Code Only - Stories without visual examples
|
|
257
|
+
* - 📋 Todo - Stories marked as todo/incomplete
|
|
258
|
+
* - `next` - (`version:next`) The component or function is available in the next version
|
|
259
|
+
* - `x.y` - (`version:x.y`) The component or function was created or updated in the x.y version
|
|
260
|
+
* - 🔒 Internal - Internal or private-use-only stories
|
|
261
|
+
* - 📸 Snapshot - Stories with snapshot tests
|
|
262
|
+
*/
|
|
202
263
|
const tagBadges = [
|
|
203
|
-
editorBadge,
|
|
204
|
-
sourceBadge,
|
|
205
|
-
unitBadge,
|
|
206
|
-
integrationBadge,
|
|
207
|
-
keyboardBadge,
|
|
208
264
|
newBadge,
|
|
209
265
|
betaBadge,
|
|
210
266
|
deprecatedBadge,
|
|
211
267
|
outdatedBadge,
|
|
268
|
+
editorBadge,
|
|
269
|
+
unitBadge,
|
|
270
|
+
integrationBadge,
|
|
271
|
+
keyboardBadge,
|
|
212
272
|
dangerBadge,
|
|
273
|
+
sourceBadge,
|
|
274
|
+
typeBadge,
|
|
275
|
+
functionBadge,
|
|
276
|
+
varBadge,
|
|
213
277
|
propsBadge,
|
|
214
|
-
todoBadge,
|
|
215
278
|
codeOnlyBadge,
|
|
279
|
+
todoBadge,
|
|
216
280
|
versionBadge,
|
|
217
281
|
internalBadge,
|
|
218
282
|
snapshotBadge
|
|
219
283
|
];
|
|
220
284
|
|
|
221
285
|
//#endregion
|
|
222
|
-
export { betaBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, propsBadge, snapshotBadge, sourceBadge, tagBadges, todoBadge, unitBadge };
|
|
286
|
+
export { betaBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, propsBadge, snapshotBadge, sourceBadge, tagBadges, todoBadge, typeBadge, unitBadge, varBadge };
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @repobuddy/storybook
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@repobuddy/storybook)
|
|
4
|
+
[](https://www.npmjs.com/package/@repobuddy/storybook)
|
|
5
|
+
[](https://github.com/repobuddy/storybook/actions/workflows/release.yml)
|
|
6
|
+
|
|
3
7
|
Your repository buddy for Storybook.
|
|
4
8
|
|
|
5
9
|
> [!NOTE]
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type StoryCardEntry,
|
|
6
6
|
StoryCardRegistryContext,
|
|
7
7
|
type StoryCardRegistryContextValue
|
|
8
|
-
} from './
|
|
8
|
+
} from './_story_card_registry_context.js'
|
|
9
9
|
|
|
10
10
|
export type StoryCardScopeProps = { Story: ComponentType } & StoryCardEntry
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import { addons } from 'storybook/preview-api'
|
|
|
5
5
|
import { convert, ThemeProvider, themes } from 'storybook/theming'
|
|
6
6
|
import { twJoin } from 'tailwind-merge'
|
|
7
7
|
import { StoryCard, type StoryCardProps } from '../components/story_card'
|
|
8
|
-
import { StoryCardScope } from '../contexts/
|
|
8
|
+
import { StoryCardScope } from '../contexts/_story_card_scope'
|
|
9
9
|
|
|
10
10
|
const channel = addons.getChannel()
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react'
|
|
2
2
|
import type { DecoratorFunction, Renderer } from 'storybook/internal/csf'
|
|
3
3
|
import type { StoryCardProps, StoryCardStatus } from '../components/story_card.js'
|
|
4
|
-
import { StoryCardScope } from '../contexts/
|
|
4
|
+
import { StoryCardScope } from '../contexts/_story_card_scope.js'
|
|
5
5
|
import type { StoryCardParam } from '../parameters/define_story_card_param.js'
|
|
6
6
|
|
|
7
7
|
export type WithStoryCardProps = Omit<StoryCardProps, 'children' | 'className'> & {
|
|
@@ -10,6 +10,9 @@ type TagBadgeParameter = TagBadgeParameters[0]
|
|
|
10
10
|
export type TagNames =
|
|
11
11
|
| 'editor'
|
|
12
12
|
| 'source'
|
|
13
|
+
| 'type'
|
|
14
|
+
| 'func'
|
|
15
|
+
| 'var'
|
|
13
16
|
| 'new'
|
|
14
17
|
| 'beta'
|
|
15
18
|
| 'props'
|
|
@@ -26,25 +29,7 @@ export type TagNames =
|
|
|
26
29
|
| 'usecase'
|
|
27
30
|
| 'version:next'
|
|
28
31
|
|
|
29
|
-
/**
|
|
30
|
-
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
31
|
-
* Each badge is associated with a specific tag and displays an emoji with a tooltip.
|
|
32
|
-
*
|
|
33
|
-
* The badges help visually identify stories with certain characteristics:
|
|
34
|
-
* - ✏️ Editor - Stories with live editor
|
|
35
|
-
* - 🆕 New - Recently added stories
|
|
36
|
-
* - 🅱️ Beta - Stories for features in beta
|
|
37
|
-
* - 🪦 Deprecated - Stories for deprecated features
|
|
38
|
-
* - ⚠️ Outdated - Stories that need updating
|
|
39
|
-
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
40
|
-
* - 📋 Todo - Stories marked as todo/incomplete
|
|
41
|
-
* - 📝 Code Only - Stories without visual examples
|
|
42
|
-
* - 📸 Snapshot - Stories with snapshot tests
|
|
43
|
-
* - 🧪 Unit - Stories with unit tests
|
|
44
|
-
* - 🔗 Integration - Stories with integration tests
|
|
45
|
-
*
|
|
46
|
-
* Also includes the default version badge from `storybook-addon-tag-badges`.
|
|
47
|
-
*/
|
|
32
|
+
/** Badge (✏️) for stories with a live editor. Shown in sidebar on story and inherited. */
|
|
48
33
|
export const editorBadge: TagBadgeParameter = {
|
|
49
34
|
tags: 'editor',
|
|
50
35
|
badge: {
|
|
@@ -63,6 +48,7 @@ export const editorBadge: TagBadgeParameter = {
|
|
|
63
48
|
}
|
|
64
49
|
}
|
|
65
50
|
|
|
51
|
+
/** Badge (🆕) for recently added stories. */
|
|
66
52
|
export const newBadge: TagBadgeParameter = {
|
|
67
53
|
tags: 'new',
|
|
68
54
|
badge: {
|
|
@@ -75,6 +61,7 @@ export const newBadge: TagBadgeParameter = {
|
|
|
75
61
|
}
|
|
76
62
|
}
|
|
77
63
|
|
|
64
|
+
/** Badge (🅱️) for stories covering features in beta. */
|
|
78
65
|
export const betaBadge: TagBadgeParameter = {
|
|
79
66
|
tags: 'beta',
|
|
80
67
|
badge: {
|
|
@@ -87,6 +74,7 @@ export const betaBadge: TagBadgeParameter = {
|
|
|
87
74
|
}
|
|
88
75
|
}
|
|
89
76
|
|
|
77
|
+
/** Badge (🔧) for stories that demonstrate props or configuration. */
|
|
90
78
|
export const propsBadge: TagBadgeParameter = {
|
|
91
79
|
tags: 'props',
|
|
92
80
|
badge: {
|
|
@@ -99,6 +87,7 @@ export const propsBadge: TagBadgeParameter = {
|
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
89
|
|
|
90
|
+
/** Badge (🪦) for stories documenting deprecated features. */
|
|
102
91
|
export const deprecatedBadge: TagBadgeParameter = {
|
|
103
92
|
tags: 'deprecated',
|
|
104
93
|
badge: {
|
|
@@ -111,6 +100,7 @@ export const deprecatedBadge: TagBadgeParameter = {
|
|
|
111
100
|
}
|
|
112
101
|
}
|
|
113
102
|
|
|
103
|
+
/** Badge (⚠️) for stories that need updating. */
|
|
114
104
|
export const outdatedBadge: TagBadgeParameter = {
|
|
115
105
|
tags: 'outdated',
|
|
116
106
|
badge: {
|
|
@@ -123,6 +113,7 @@ export const outdatedBadge: TagBadgeParameter = {
|
|
|
123
113
|
}
|
|
124
114
|
}
|
|
125
115
|
|
|
116
|
+
/** Badge (🚨) for stories demonstrating dangerous or cautionary patterns. */
|
|
126
117
|
export const dangerBadge: TagBadgeParameter = {
|
|
127
118
|
tags: 'danger',
|
|
128
119
|
badge: {
|
|
@@ -135,6 +126,7 @@ export const dangerBadge: TagBadgeParameter = {
|
|
|
135
126
|
}
|
|
136
127
|
}
|
|
137
128
|
|
|
129
|
+
/** Badge (📋) for stories marked as todo or incomplete. */
|
|
138
130
|
export const todoBadge: TagBadgeParameter = {
|
|
139
131
|
tags: 'todo',
|
|
140
132
|
badge: {
|
|
@@ -147,6 +139,7 @@ export const todoBadge: TagBadgeParameter = {
|
|
|
147
139
|
}
|
|
148
140
|
}
|
|
149
141
|
|
|
142
|
+
/** Badge (📝) for stories without visual examples (code-only). Hidden in MDX. */
|
|
150
143
|
export const codeOnlyBadge: TagBadgeParameter = {
|
|
151
144
|
tags: 'code-only',
|
|
152
145
|
badge: {
|
|
@@ -162,6 +155,55 @@ export const codeOnlyBadge: TagBadgeParameter = {
|
|
|
162
155
|
}
|
|
163
156
|
}
|
|
164
157
|
|
|
158
|
+
/** Badge (<T>) for stories that showcase or document TypeScript types. Hidden in MDX. */
|
|
159
|
+
export const typeBadge: TagBadgeParameter = {
|
|
160
|
+
tags: 'type',
|
|
161
|
+
badge: {
|
|
162
|
+
text: '<T>',
|
|
163
|
+
style: {
|
|
164
|
+
backgroundColor: 'transparent',
|
|
165
|
+
borderColor: 'transparent'
|
|
166
|
+
},
|
|
167
|
+
tooltip: 'TypeScript Types'
|
|
168
|
+
},
|
|
169
|
+
display: {
|
|
170
|
+
mdx: true
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Badge (ƒ(x)) for stories that showcase or document functions. Hidden in MDX. */
|
|
175
|
+
export const functionBadge: TagBadgeParameter = {
|
|
176
|
+
tags: 'func',
|
|
177
|
+
badge: {
|
|
178
|
+
text: 'ƒ(x)',
|
|
179
|
+
style: {
|
|
180
|
+
backgroundColor: 'transparent',
|
|
181
|
+
borderColor: 'transparent'
|
|
182
|
+
},
|
|
183
|
+
tooltip: 'Function'
|
|
184
|
+
},
|
|
185
|
+
display: {
|
|
186
|
+
mdx: true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Badge (var) for stories that describe values and variables. */
|
|
191
|
+
export const varBadge: TagBadgeParameter = {
|
|
192
|
+
tags: 'var',
|
|
193
|
+
badge: {
|
|
194
|
+
text: 'var',
|
|
195
|
+
style: {
|
|
196
|
+
backgroundColor: 'transparent',
|
|
197
|
+
borderColor: 'transparent'
|
|
198
|
+
},
|
|
199
|
+
tooltip: 'Variables'
|
|
200
|
+
},
|
|
201
|
+
display: {
|
|
202
|
+
mdx: true
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Badge (`</>`) for source-code-focused stories. Hidden in MDX. */
|
|
165
207
|
export const sourceBadge: TagBadgeParameter = {
|
|
166
208
|
tags: 'source',
|
|
167
209
|
badge: {
|
|
@@ -177,6 +219,7 @@ export const sourceBadge: TagBadgeParameter = {
|
|
|
177
219
|
}
|
|
178
220
|
}
|
|
179
221
|
|
|
222
|
+
/** Badge (📸) for stories with snapshot tests. Shown in toolbar only, not in sidebar. */
|
|
180
223
|
export const snapshotBadge: TagBadgeParameter = {
|
|
181
224
|
tags: 'snapshot',
|
|
182
225
|
badge: {
|
|
@@ -193,6 +236,7 @@ export const snapshotBadge: TagBadgeParameter = {
|
|
|
193
236
|
}
|
|
194
237
|
}
|
|
195
238
|
|
|
239
|
+
/** Badge (🧪) for stories with unit tests. */
|
|
196
240
|
export const unitBadge: TagBadgeParameter = {
|
|
197
241
|
tags: 'unit',
|
|
198
242
|
badge: {
|
|
@@ -208,6 +252,7 @@ export const unitBadge: TagBadgeParameter = {
|
|
|
208
252
|
}
|
|
209
253
|
}
|
|
210
254
|
|
|
255
|
+
/** Badge (🔗) for stories with integration tests. Hidden in sidebar. */
|
|
211
256
|
export const integrationBadge: TagBadgeParameter = {
|
|
212
257
|
tags: 'integration',
|
|
213
258
|
badge: {
|
|
@@ -223,6 +268,7 @@ export const integrationBadge: TagBadgeParameter = {
|
|
|
223
268
|
}
|
|
224
269
|
}
|
|
225
270
|
|
|
271
|
+
/** Badge (⌨️) for stories that demonstrate or test keyboard interaction. */
|
|
226
272
|
export const keyboardBadge: TagBadgeParameter = {
|
|
227
273
|
tags: 'keyboard',
|
|
228
274
|
badge: {
|
|
@@ -235,6 +281,7 @@ export const keyboardBadge: TagBadgeParameter = {
|
|
|
235
281
|
}
|
|
236
282
|
}
|
|
237
283
|
|
|
284
|
+
/** Badge (🔒) for internal or private-use-only stories. */
|
|
238
285
|
export const internalBadge: TagBadgeParameter = {
|
|
239
286
|
tags: 'internal',
|
|
240
287
|
badge: {
|
|
@@ -247,20 +294,49 @@ export const internalBadge: TagBadgeParameter = {
|
|
|
247
294
|
}
|
|
248
295
|
}
|
|
249
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
299
|
+
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
300
|
+
*
|
|
301
|
+
* The badges help visually identify stories with certain characteristics:
|
|
302
|
+
* - 🆕 New - Recently added stories
|
|
303
|
+
* - 🅱️ Beta - Stories for features in beta
|
|
304
|
+
* - 🪦 Deprecated - Stories for deprecated features
|
|
305
|
+
* - ⚠️ Outdated - Stories that need updating
|
|
306
|
+
* - ✏️ Editor - Stories with live editor
|
|
307
|
+
* - 🧪 Unit - Stories with unit tests
|
|
308
|
+
* - 🔗 Integration - Stories with integration tests
|
|
309
|
+
* - ⌨️ Keyboard - Stories that demonstrate or test keyboard interaction
|
|
310
|
+
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
311
|
+
* - `</>` Source - Source-code-focused stories
|
|
312
|
+
* - `<T>` Type - Stories that showcase or document TypeScript types
|
|
313
|
+
* - `ƒ(x)` Function - Stories that showcase or document functions
|
|
314
|
+
* - `var` Variables - Stories that describe values and variables
|
|
315
|
+
* - 🔧 Props - Stories that demonstrate props or configuration
|
|
316
|
+
* - 📝 Code Only - Stories without visual examples
|
|
317
|
+
* - 📋 Todo - Stories marked as todo/incomplete
|
|
318
|
+
* - `next` - (`version:next`) The component or function is available in the next version
|
|
319
|
+
* - `x.y` - (`version:x.y`) The component or function was created or updated in the x.y version
|
|
320
|
+
* - 🔒 Internal - Internal or private-use-only stories
|
|
321
|
+
* - 📸 Snapshot - Stories with snapshot tests
|
|
322
|
+
*/
|
|
250
323
|
export const tagBadges: TagBadgeParameters = [
|
|
251
|
-
editorBadge,
|
|
252
|
-
sourceBadge,
|
|
253
|
-
unitBadge,
|
|
254
|
-
integrationBadge,
|
|
255
|
-
keyboardBadge,
|
|
256
324
|
newBadge,
|
|
257
325
|
betaBadge,
|
|
258
326
|
deprecatedBadge,
|
|
259
327
|
outdatedBadge,
|
|
328
|
+
editorBadge,
|
|
329
|
+
unitBadge,
|
|
330
|
+
integrationBadge,
|
|
331
|
+
keyboardBadge,
|
|
260
332
|
dangerBadge,
|
|
333
|
+
sourceBadge,
|
|
334
|
+
typeBadge,
|
|
335
|
+
functionBadge,
|
|
336
|
+
varBadge,
|
|
261
337
|
propsBadge,
|
|
262
|
-
todoBadge,
|
|
263
338
|
codeOnlyBadge,
|
|
339
|
+
todoBadge,
|
|
264
340
|
versionBadge,
|
|
265
341
|
internalBadge,
|
|
266
342
|
snapshotBadge
|
|
File without changes
|