Skip to content

Commit 63c59b3

Browse files
castastrophearamos-adobe
authored andcommitted
fix(pagination): deprecate legacy features to align with foundations
1 parent dfa17dc commit 63c59b3

File tree

12 files changed

+640
-90
lines changed

12 files changed

+640
-90
lines changed

.storybook/guides/develop.mdx

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Meta } from "@storybook/blocks";
22

33
import Illustration from "../assets/images/spectrum_illustration_2x.png";
44

5-
<Meta title="Contributing"/>
5+
<Meta title="Contributing" />
66

77
<img src={Illustration} style={{ marginTop: "-20px", marginBottom: "20px" }} />
88

@@ -31,6 +31,7 @@ For more general information about how to contribute to the Spectrum CSS project
3131

3232
Each component has the following files:
3333

34+
<<<<<<< HEAD
3435
- `index.css` - The source file for all styles related to the component. This contains all selectors and css properties for the component.
3536
- `stories/*.stories.js` - The storybook file that defines the component's stories and the available knobs for the component.
3637
- `stories/template.js` - The template function that generates the component's mark-up based on the provided settings.
@@ -39,16 +40,42 @@ Each component has the following files:
3940
Each component outputs the following assets to `dist`:
4041

4142
- `index.css`: This asset includes the CSS for the component and is meant to be loaded in conjunction with the tokens for your desired color context and scales.
43+
=======
44+
- `index.css` - The source file for all styles related to the component. This contains all selectors and css properties for the component but specifically lacks any custom properties or variables. These values are sourced from the `themes` directory.
45+
- `themes/*.css` - The theme-specific, component-level custom properties used to style the component. These files are meant to be loaded with the source styles.
46+
- `stories/*.stories.js` - The storybook file that defines the component's stories and the available knobs for the component.
47+
- `stories/template.js` - The template function that generates the component's mark-up based on the provided settings.
48+
- `stories/*.test.js` - The testing grid for visual regression testing in Chromatic.
49+
- `stories/*.mdx` - This asset generates the component-specific documentation and is rendered in Storybook as the Docs page.
50+
51+
Each component outputs the following assets to `dist`:
52+
53+
- `index.css`: This asset includes the base CSS and the `themes/spectrum-two.css` definitions (without the system mapping layer). This asset is meant to be used in a environment where only the current Spectrum theme is supported.
54+
- `index-base.css`: This asset includes only the base CSS; that is, the CSS without any custom property definitions. This can be used in conjunction with `index-theme.css` and the desired `themes/*.css` file to render a themed component.
55+
- `index-theme.css`: This asset includes only the custom property definitions for the component as mapped to the system variables. This can be used in conjunction with `index-base.css` and the desired `themes/*.css` file to render a themed component.
56+
57+
Each component outputs theme-specific assets to `dist/themes`. These assets include the system variables mapped to their global token counterparts. This file is meant to be loaded in conjunction with the `index-base.css` and `index-theme.css` files to render a themed component.
58+
59+
- `themes/spectrum-two.css`: Represents the current Spectrum theme, aka Spectrum 2.
60+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
4261

4362
## Adding a new component
4463

4564
1. Generate a new component using the `yarn new component` command. The generator will prompt you to answer questions about your component.
4665
2. Edit the `dependencies` within the `package.json` file to use only the dependencies your component needs. All components rely on `@spectrum-css/tokens`, and most rely on `@spectrum-css/icon`.
4766
3. Once your folder has been generated, you can run `yarn start` in the root of the project to begin developing.
67+
<<<<<<< HEAD
4868
4. The `index.css` file is where all of your styles should be added.
4969
5. Inside the `stories` directory you will find a `template.js` and `*.stories.js` file.
5070
- In the `*.stories.js` file, define the available knobs and properties for your component, as well as any standard variations you want to surface in [Storybook](https://storybook.js.org/docs/react/writing-stories/introduction).
5171
- Update the `template.js` file with the markup, using [lit-html syntax](https://lit.dev/docs/templates/overview/) to adjust results based on the provided settings from the Storybook knobs.
72+
=======
73+
4. The `index.css` file is where most of your styles will be added. Add any custom property mappings to the global token library in the `themes/spectrum-two.css` asset.
74+
5. Inside the `stories` directory you will find a `template.js`, `*.stories.js`, and `*.mdx` file.
75+
- In the `*.stories.js` file, define the available knobs and properties for your component, as well as any standard variations you want to surface in [Storybook](https://storybook.js.org/docs/react/writing-stories/introduction).
76+
- Update the `template.js` file with the markup, using [lit-html syntax](https://lit.dev/docs/templates/overview/) to adjust results based on the provided settings from the Storybook knobs.
77+
- Update the `*.mdx` file with the documentation for your component.
78+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
5279

5380
_Note_: Because we use scoped packages, before it can be published, you must manually publish the new component as public:
5481

@@ -163,6 +190,7 @@ To import shared types into your story, use the following syntax:
163190

164191
```js
165192
import {
193+
<<<<<<< HEAD
166194
isActive,
167195
isDisabled,
168196
isFocused,
@@ -185,6 +213,30 @@ export default {
185213
isFocused: false,
186214
isActive: false,
187215
},
216+
=======
217+
isActive,
218+
isDisabled,
219+
isFocused,
220+
isHovered,
221+
isSelected,
222+
} from "@spectrum-css/preview/types";
223+
224+
export default {
225+
argTypes: {
226+
isDisabled,
227+
isSelected,
228+
isHovered,
229+
isFocused,
230+
isActive,
231+
},
232+
args: {
233+
isDisabled: false,
234+
isSelected: false,
235+
isHovered: false,
236+
isFocused: false,
237+
isActive: false,
238+
},
239+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
188240
};
189241
```
190242

@@ -334,6 +386,7 @@ import { when } from "lit/directives/when.js";
334386
import "../index.css";
335387

336388
export const Template = (
389+
<<<<<<< HEAD
337390
{
338391
rootClass = "spectrum-Tag",
339392
size = "m",
@@ -408,6 +461,82 @@ export const Template = (
408461
)}
409462
</div>
410463
`;
464+
=======
465+
{
466+
rootClass = "spectrum-Tag",
467+
size = "m",
468+
iconName,
469+
avatarUrl,
470+
label,
471+
isSelected = false,
472+
isEmphasized = false,
473+
isDisabled = false,
474+
isInvalid = false,
475+
hasClearButton = false,
476+
id,
477+
customClasses = [],
478+
customStyles = {},
479+
},
480+
context,
481+
) => {
482+
return html`
483+
<div
484+
class=${classMap({
485+
[rootClass]: true,
486+
[`${rootClass}--size${size?.toUpperCase()}`]:
487+
typeof size !== "undefined",
488+
"is-emphasized": isEmphasized,
489+
"is-disabled": isDisabled,
490+
"is-invalid": isInvalid,
491+
"is-selected": isSelected,
492+
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
493+
})}
494+
style=${styleMap(customStyles)}
495+
id=${ifDefined(id)}
496+
tabindex="0"
497+
>
498+
${when(avatarUrl && !iconName, () =>
499+
Avatar(
500+
{
501+
image: avatarUrl,
502+
size: "50",
503+
},
504+
context,
505+
),
506+
)}
507+
${when(iconName, () =>
508+
Icon(
509+
{
510+
iconName,
511+
customClasses: [`${rootClass}s-itemIcon`],
512+
},
513+
context,
514+
),
515+
)}
516+
<span
517+
class=${classMap({
518+
[`${rootClass}s-itemLabel`]: true,
519+
})}
520+
>${label}</span
521+
>
522+
${when(hasClearButton, () =>
523+
ClearButton(
524+
{
525+
customClasses: [`${rootClass}-clearButton`],
526+
onclick: (evt) => {
527+
const el = evt.target;
528+
if (!el) return;
529+
530+
const wrapper = el.closest(rootClass);
531+
wrapper.parentNode.removeChild(wrapper);
532+
},
533+
},
534+
context,
535+
),
536+
)}
537+
</div>
538+
`;
539+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
411540
};
412541
```
413542
@@ -424,6 +553,7 @@ import { Variants } from "@spectrum-css/preview/decorators";
424553
import { Template } from "./template.js";
425554

426555
export const AccordionGroup = Variants({
556+
<<<<<<< HEAD
427557
Template,
428558
testData: [
429559
{
@@ -442,6 +572,26 @@ export const AccordionGroup = Variants({
442572
disableAll: true,
443573
},
444574
],
575+
=======
576+
Template,
577+
testData: [
578+
{
579+
testHeading: "Standard",
580+
},
581+
{
582+
testHeading: "Compact",
583+
density: "compact",
584+
collapseAll: true,
585+
withStates: false,
586+
},
587+
],
588+
stateData: [
589+
{
590+
testHeading: "Disabled",
591+
disableAll: true,
592+
},
593+
],
594+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
445595
});
446596
```
447597
@@ -460,7 +610,11 @@ In the event that you don't want a story to be tested in Chromatic, you can use
460610
461611
```js
462612
Default.parameters = {
613+
<<<<<<< HEAD
463614
chromatic: { disableSnapshot: true },
615+
=======
616+
chromatic: { disableSnapshot: true },
617+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
464618
};
465619
```
466620

.storybook/modes/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
*/
1313

1414
const modes = {
15+
<<<<<<< HEAD
1516
"Light | LTR": {
1617
color: "light",
1718
textDirection: "ltr",
1819
},
1920
"Dark | RTL": {
2021
color: "dark",
22+
=======
23+
Light: {
24+
color: "light",
25+
},
26+
Dark: {
27+
color: "dark",
28+
},
29+
RTL: {
30+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
2131
textDirection: "rtl",
2232
},
2333
};

.storybook/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
"@spectrum-css/button": "workspace:^",
8080
"@spectrum-css/table": "workspace:^",
8181
"@spectrum-css/tokens": "workspace:^",
82-
"@spectrum-css/tokens-legacy": "npm:@spectrum-css/tokens@^14.6.0",
8382
"@spectrum-css/typography": "workspace:^",
8483
"@spectrum-css/ui-icons": "workspace:^",
8584
"@spectrum-css/underlay": "workspace:^"

.storybook/preview.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,15 @@ export const parameters = {
139139
// Set an empty object to avoid the "undefined" value in the ComponentDetails doc block
140140
packageJson: {},
141141
// A list of published npm tags that should not appear in the ComponentDetails doc block
142+
<<<<<<< HEAD
142143
<<<<<<< HEAD
143144
ignoredTags: ["beta"],
144145
=======
145146
ignoredTags: ["beta", "next"],
146147
>>>>>>> 24419a94f (build: align tooling with s2-foundations branch)
148+
=======
149+
ignoredTags: ["beta"],
150+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
147151
};
148152

149153
export default {

.storybook/types/global.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44

55
/** @type import('@storybook/types').GlobalTypes */
66
export default {
7+
<<<<<<< HEAD
8+
=======
9+
context: {
10+
title: "Design context",
11+
description: "The variation of Spectrum to use in the component",
12+
defaultValue: "spectrum",
13+
type: "string",
14+
showName: true,
15+
toolbar: {
16+
items: [
17+
{ value: "spectrum", title: "Spectrum 2", right: "default" },
18+
{ value: "raw", title: "Token-free", right: "raw" },
19+
],
20+
dynamicTitle: true,
21+
},
22+
},
23+
>>>>>>> 27d01dfbc (fix(pagination): deprecate legacy features to align with foundations)
724
color: {
825
title: "Color",
926
description: "Controls the color context of the component",

0 commit comments

Comments
 (0)