Skip to content

Commit fa7a1b4

Browse files
authored
feat(storybook): expand argEvents API; resolve lint warnings (#4165)
1 parent 122ad8c commit fa7a1b4

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

.changeset/kind-cycles-check.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@spectrum-css/preview": minor
3+
---
4+
5+
- _feature_: Add the `resetArgs` function to the argEvents decorator
6+
- _fix_: Resolve minor lint warnings in the Storybook CSS assets

.storybook/assets/base.css

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2-
31
/*!
42
* Copyright 2024 Adobe. All rights reserved.
53
*
@@ -31,7 +29,7 @@ body {
3129
.spectrum {
3230
color: var(--spectrum-neutral-content-color-default);
3331
background-color: var(--spectrum-background-base-color);
34-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0%);
32+
-webkit-tap-highlight-color: rgb(0, 0, 0, 0%);
3533
}
3634

3735
.spectrum .spectrum-examples-static-black {
@@ -61,7 +59,7 @@ svg:has(symbol):not(:has(use)) {
6159
line-height: normal;
6260
letter-spacing: normal;
6361
text-transform: none;
64-
border-block-end: 1px solid hsla(203deg, 50%, 30%, 15%);
62+
border-block-end: 1px solid hsl(203deg, 50%, 30%, 15%);
6563
}
6664

6765
/* Force the modal wrapper to be contained by the frame not the viewport */
@@ -77,4 +75,14 @@ svg:has(symbol):not(:has(use)) {
7775
overflow: visible !important;
7876
}
7977

80-
/* stylelint-enable selector-class-pattern */
78+
#panel-tab-content tr th:nth-child(1),
79+
#panel-tab-content tr th:nth-child(3),
80+
#panel-tab-content tr td:nth-child(1),
81+
#panel-tab-content tr td:nth-child(3) {
82+
min-inline-size: 100px !important;
83+
}
84+
85+
#panel-tab-content tr th:nth-child(2),
86+
#panel-tab-content tr td:nth-child(2) {
87+
max-inline-size: 500px !important;
88+
}

.storybook/assets/index.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2-
31
/*!
42
* Copyright 2024 Adobe. All rights reserved.
53
*
@@ -72,6 +70,13 @@ div.sb-bar > div > div > span:first-child {
7270
.docblock-argstable-body tr td {
7371
letter-spacing: unset;
7472
font-size: 11px;
73+
max-inline-size: 400px;
74+
overflow-x: auto;
75+
}
76+
77+
.docblock-argstable-body tr td code {
78+
white-space: pre-wrap;
79+
line-height: inherit;
7580
}
7681

7782
.docblock-argstable-body td > span:has(select),
@@ -125,5 +130,3 @@ div.sb-bar {
125130
color: var(--spectrum-neutral-content-color-default) !important;
126131
background-color: var(--spectrum-background-layer-2-color) !important;
127132
}
128-
129-
/* stylelint-enable selector-class-pattern */

.storybook/decorators/utilities.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,12 @@ export const renderContent = (content = [], {
556556
if (content.length === 0) return nothing;
557557

558558
return html`
559-
${content.map((c) => {
559+
${content.map((c, idx) => {
560560
if (typeof c === "undefined") return nothing;
561561
562562
/* If the content is an object (but not a lit object), we need to merge the object with the template */
563563
if (typeof c !== "string" && (typeof c === "object" && !c._$litType$)) {
564-
return callback({ ...args, ...c }, context);
564+
return callback({ ...args, ...c, idx }, context);
565565
}
566566
567567
if (typeof c === "function") {

0 commit comments

Comments
 (0)