storybook-addon-sdc 0.5.1 → 0.5.2
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/README.md +5 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -225,39 +225,6 @@ thirdPartySettings:
|
|
|
225
225
|
content: 'Hello from third grid card!'
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
### Key Features
|
|
229
|
-
|
|
230
|
-
This configuration provides three distinct options for creating stories:
|
|
231
|
-
|
|
232
|
-
1. **Render Using Basic Args**
|
|
233
|
-
The first card in the `grid` example uses only its basic arguments (`Basic.args`). No additional configuration or props are required for this component.
|
|
234
|
-
|
|
235
|
-
```yaml
|
|
236
|
-
- type: component
|
|
237
|
-
component: 'umami:card'
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
2. **Reuse an Existing Story**
|
|
241
|
-
The second card uses the `Preview` story defined earlier. This is particularly useful for reusing pre-configured props and slots without redefining them in each story.
|
|
242
|
-
|
|
243
|
-
```yaml
|
|
244
|
-
- type: component
|
|
245
|
-
component: 'umami:card'
|
|
246
|
-
story: Preview
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
3. **Define Custom Slots**
|
|
250
|
-
The third card defines a custom `content` slot. This allows you to override or enhance the default behavior of the component with specific content.
|
|
251
|
-
|
|
252
|
-
```yaml
|
|
253
|
-
- type: component
|
|
254
|
-
component: 'umami:card'
|
|
255
|
-
props:
|
|
256
|
-
html_tag: 'div'
|
|
257
|
-
slots:
|
|
258
|
-
content: 'Hello from third grid card!'
|
|
259
|
-
```
|
|
260
|
-
|
|
261
228
|
### How It Works in Practice
|
|
262
229
|
|
|
263
230
|
The addon dynamically renders the components and stories as defined:
|
|
@@ -266,6 +233,8 @@ The addon dynamically renders the components and stories as defined:
|
|
|
266
233
|
- **Existing Story:** The `Preview` story is loaded, ensuring consistency across the Storybook environment.
|
|
267
234
|
- **Custom Slots and Props:** Overrides the default slots and props behavior with unique content for that instance.
|
|
268
235
|
|
|
236
|
+
[](https://gyazo.com/7212a3f44052ebde34b59a1555d96afe)
|
|
237
|
+
|
|
269
238
|
### Why stories experimental?
|
|
270
239
|
|
|
271
240
|
The [community will have to decide](https://docs.google.com/document/d/1wCQLXrK1lrV2gYlqmqD2pybTql6_H1dByWIKB5xQFcQ/edit?tab=t.0#heading=h.3949vjfiqczr) what format the YAML stories should be.
|
|
@@ -304,7 +273,7 @@ export const Basic = {}
|
|
|
304
273
|
|
|
305
274
|
In addition to the standard configuration options, you can also specify customDefs and externalDefs to provide additional schema definitions. These options are optional and can be used to extend or override the default definitions.
|
|
306
275
|
|
|
307
|
-
|
|
276
|
+
### `customDefs`
|
|
308
277
|
|
|
309
278
|
The `customDefs` option allows you to define custom schema definitions directly within your configuration. This can be object with custom definitions.
|
|
310
279
|
|
|
@@ -324,7 +293,7 @@ const options = {
|
|
|
324
293
|
}
|
|
325
294
|
```
|
|
326
295
|
|
|
327
|
-
|
|
296
|
+
### `externalDefs`
|
|
328
297
|
|
|
329
298
|
The `externalDefs` option allows you to specify an array of paths to external definition files. These paths can be URLs to CDN-hosted files or local file paths.
|
|
330
299
|
|
|
@@ -344,7 +313,7 @@ const options = {
|
|
|
344
313
|
|
|
345
314
|
When using externalDefs, the definitions will be fetched and registered automatically.
|
|
346
315
|
|
|
347
|
-
### `validate`
|
|
316
|
+
### `validate`
|
|
348
317
|
|
|
349
318
|
The `validate` option enables schema validation for SDC components using the [JSON Schema](https://www.npmjs.com/package/jsonschema) validator. By default, the validator checks the component configurations against the global schema located at:
|
|
350
319
|
|