-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add fast-components-msft as a new package #3096
feat: add fast-components-msft as a new package #3096
Conversation
43bd04a
to
268ff8f
Compare
export class MSFTBadge extends Badge { | ||
@attr | ||
public fill: BadgeFill = "lightweight"; | ||
private fillChanged(oldValue: BadgeFill, newValue: BadgeFill): void { | ||
if (oldValue !== newValue) { | ||
this.classList.add(newValue); | ||
this.classList.remove(oldValue); | ||
} | ||
} | ||
|
||
// Can we remove this and circular as attrs if we don't want to leverage them? | ||
// Can I set this internally only in this implementation? | ||
@attr({ mode: "fromView" }) | ||
public color: string = "value"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@microsoft/fast-dna-collaborators my thoughts on the implementation of Badge here was to tighten up the implementation to better align with the MSFT badge requirements. Ideally I'd like to not provide the color value here and just have things work as expected. Since we cannot remove or delete attributes from the classes here, I'm trying to consider how to manage the mappings.
It seems like having defaults for both fill
and color
make sense; while not illustrated above we could also ensure the extensibility by also supporting a string:
export type BadgeFill = "accent" | "lightweight" | "neutral" | string;
I'm not sure what to do with the color attribute in those scenarios though if we elect to handle them in the stylesheet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fast-components
api would remain the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is part of the question...since we can't pull off existing attrs, extending from the Badge would expose all of those values - so yes, the API would stay the same. I think providing some default "named" configurations is helpful here, but wondering what our language/naming should align to. Recipes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming seems right to me. It aligns with what we do elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one thing about our react badge
is that the filled
version was yellow and not aligned with the accent color. So might want @bheston to chime in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd like some thoughts on the defaults - we can still keep things extensible. My concern with the yellow is that it won't respond to dark mode unless we leverage the provider which seems heavy-handed for a default value.
Bigger question in my mind is what to do with the color value (if anything)...do we provide it but not include a default value b/c the fill defaults will be recipe associated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option might be to move color
so that it's defined on FASTBadge
rather than Badge
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EisenbergEffect there would be changes to the template as well I think - those values are set in a nested div as they are setting style
attributes. I wonder if the deltas here are worth different API's or if we should keep consistent for the time being.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Well, then it becomes a matter of what is worse, having some properties that don't apply vs. writing a whole new component.
<fast-divider></fast-divider> | ||
|
||
<h4>Presentation</h4> | ||
<fast-divider role="presentation"></fast-divider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@microsoft/fast-dna-collaborators We've talked about having two different recipes based on whether this needs to be accessible to a screen reader. In the event that the divider is only for presentation, the recipe would not need to meet contrast requirements. In the event that it is exposed to AT, the recipe would meet contrast requirements. I think we should consider adding this for the MSFT implementation here. @bheston - thoughts on the recipe to use for the contrast requirement implementation?
import { | ||
designSystemProvider, | ||
FASTDesignSystemProvider, | ||
} from "@microsoft/fast-components"; | ||
|
||
@designSystemProvider("msft-design-system-provider") | ||
export class MSFTDesignSystemProvider extends FASTDesignSystemProvider {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicholasrice does this map to what you might expect here? I'd expect the default values to change here once we create the FAST system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
Smoked to ensure everything is working properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main feedback to change the import format so that it adds the .js file extension for internal module imports.
@@ -0,0 +1,14 @@ | |||
import { customElement } from "@microsoft/fast-element"; | |||
import { Anchor, AnchorTemplate as template } from "@microsoft/fast-components"; | |||
import { AnchorStyles as styles } from "./anchor.styles"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to prep for the new build setup, let's start this new package with file extension in imports. So, change to this:
import { AnchorStyles as styles } from "./anchor.styles.js";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I wanted to do that work in a separate branch as part of the feature branch work. I can do in this package, but we'll need both packages to be touched prior to the feature branch merging in
export class MSFTBadge extends Badge { | ||
@attr | ||
public fill: BadgeFill = "lightweight"; | ||
private fillChanged(oldValue: BadgeFill, newValue: BadgeFill): void { | ||
if (oldValue !== newValue) { | ||
this.classList.add(newValue); | ||
this.classList.remove(oldValue); | ||
} | ||
} | ||
|
||
// Can we remove this and circular as attrs if we don't want to leverage them? | ||
// Can I set this internally only in this implementation? | ||
@attr({ mode: "fromView" }) | ||
public color: string = "value"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option might be to move color
so that it's defined on FASTBadge
rather than Badge
.
268ff8f
to
6169d67
Compare
aaa91e7
to
d460759
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I've been wondering about...should we use a different element prefix for each design system or not?
We've got "fast-" and now "msft-" for the element names. This will make it hard for people to switch out design systems. They'll have to re-write all their html. Also, the scenario where somebody builds a single UI and then just dynamically loads different design systems based on platform (ios, vs. material vs. msft) isn't really possible because the element names are different. If the element names were the same, then the design language and implementation could simply be switched at load.
Also, with different element names, it feels a bit more like different components as apposed to the same components with a different design system, at least to me.
In any case, I wanted to bring this up as I'm not sure if we've thought through these scenarios.
I think there are different ways to accomplish this. It really depends. The underlying intent here is that these are intended to be different stylesheets for the design systems. There will be different design system values as well between the FAST implementation and the MSFT implementation. This is not simply a configuration change at this point where we're swapping out the design system values - the entire system may be different for certain folks' implementations. Further, design systems apply values (such as corner radius) in different ways and based on different principles. Something like I'm fine keeping this prefixed with To your last point - I think it's extremely important to be clear - these are different custom elements and not just a different design system configuration. If we swap the default stylesheet to align with the FAST, we cannot create exactly the MSFT styled components. Currently we would need class overrides to ensure that the components look exactly like we currently expect the MSFT components to look. There are certain things which are just going to be different, like the thumb on slider. To accomplish that with the design system, we would need to elevate a value or principle to the design system that currently doesn't really exist. That's just one example. Over time, there may be greater divergence here between systems as well. RESOLVED: For interoperability and to ensure that there is clarity that while these may be styled differently they are a single set of components, we'll prefix with FAST. |
@@ -0,0 +1,47 @@ | |||
{ | |||
"name": "@microsoft/fast-components-msft", | |||
"description": "A library of Web Components", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we specify these are Microsoft styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
7085a9e
to
d464ed3
Compare
…lt slot for label
d464ed3
to
53b16c0
Compare
}) | ||
public backgroundColor: string; | ||
|
||
@attr({ attribute: "accent-base-color", ...fromView }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the @attr
or @observable
anymore - see the fast-components
version
Smoked both packages, There seems to be a small amount of visual issues especially around focus. But I think all these issues were already there. The only big issue I see is the tabbing behavior on the MSFT Text Field. You need to tab twice on each control, once to focus the container and again to be able to start typing |
Great catch - missing delegate focus. We'll do another run on any remaining visual issues. Well done! |
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
* initial work to create fast-components-msft * add styles packages for patterns * add msft anchor * add msft button * add msft badge - outstanding issues * add msft card * add msft checkbox * add msft dialog * add msft divider * add msft flipper * add msft progress - do we want to narrow support to align with guidance? * add msft radio * add MSFT radio group * add msft slider and slider-label * add msft switch * add msft tabs - need to ensure alignment of tab panel with tabs * add msft text area * add msft text field * export all components from root * fix eslint errors * update imports from fast-components * add .js extension to anything distributed * update readme to include install instructions * update prefix to align with fast * update package.json description * update tsconfig * add dependency for fast-components-styles-msft * update design system provider to use MSFT design system * remove js extensions for the time being * update imports for fast-foundation * update behavior imports to correct internal path * update pathing for forcedColors behavior * fix order of imports * update system-colors path * update imports for shared utils added to foundation * fix design system signature and update to new textarea api with default slot for label * remove unused behavior and fix color on text field * update design system values and remove unused vars * fix text field focus bug
Description
This PR is
the initial work forcloses #3088. This PR creates a new package forfast-components-msft
. The rewrite of existing styles for the FAST design systemis not included as part of this PR.has been completed and a new package forfast-foundation
was created to hold the templates, classes, and utilities needed to compose web components with FAST.Issue type checklist
Is this a breaking change?
Process & policy checklist