-
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
Merged
chrisdholt
merged 39 commits into
master
from
users/chhol/add-fast-components-msft-package
May 15, 2020
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
fb01653
initial work to create fast-components-msft
chrisdholt 342cfcb
add styles packages for patterns
chrisdholt c2ba6eb
add msft anchor
chrisdholt 1908608
add msft button
chrisdholt df41703
add msft badge - outstanding issues
chrisdholt 079b196
add msft card
chrisdholt 3851052
add msft checkbox
chrisdholt d2c27a5
add msft dialog
chrisdholt d3834ee
add msft divider
chrisdholt 0633549
add msft flipper
chrisdholt 464e08a
add msft progress - do we want to narrow support to align with guidance?
chrisdholt ceab683
add msft radio
chrisdholt a3eeef4
add MSFT radio group
chrisdholt 36b2a3c
add msft slider and slider-label
chrisdholt 04566a4
add msft switch
chrisdholt 21fb826
add msft tabs - need to ensure alignment of tab panel with tabs
chrisdholt fda8207
add msft text area
chrisdholt 270e73e
add msft text field
chrisdholt 6b081ce
export all components from root
chrisdholt 8b67e67
fix eslint errors
chrisdholt 2eaa239
update imports from fast-components
chrisdholt 2db5e51
add .js extension to anything distributed
chrisdholt 00b9a7d
update readme to include install instructions
chrisdholt 0752b6c
update prefix to align with fast
chrisdholt 6d53dbc
update package.json description
chrisdholt 08d36b0
update tsconfig
chrisdholt 9476101
add dependency for fast-components-styles-msft
chrisdholt b7cd0ef
update design system provider to use MSFT design system
chrisdholt ecd8992
remove js extensions for the time being
chrisdholt c741d59
update imports for fast-foundation
chrisdholt 38f9088
update behavior imports to correct internal path
chrisdholt 708d9cd
update pathing for forcedColors behavior
chrisdholt cd2fb13
fix order of imports
chrisdholt 09a592f
update system-colors path
chrisdholt 3741ebc
update imports for shared utils added to foundation
chrisdholt 5281158
fix design system signature and update to new textarea api with defau…
chrisdholt 53b16c0
remove unused behavior and fix color on text field
chrisdholt a2a0b45
update design system values and remove unused vars
chrisdholt 053f14e
fix text field focus bug
chrisdholt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# don't ever lint node_modules | ||
node_modules | ||
# don't lint build output (make sure it's set to your correct build folder name) | ||
dist | ||
# don't lint coverage output | ||
coverage | ||
# don't lint storybook | ||
.storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
extends: ["@microsoft/eslint-config-fast-dna", "prettier"], | ||
rules: { | ||
"no-extra-boolean-cast": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/typedef": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Tests | ||
__test__/ | ||
*.test.* | ||
|
||
# specifications | ||
*.spec.* | ||
|
||
# images | ||
images/ | ||
|
||
# Source files | ||
src/ | ||
|
||
# config files | ||
.eslintignore | ||
.eslintrc.js | ||
.prettierignore | ||
.storybook | ||
tsconfig.json | ||
tsconfig.build.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coverage/* | ||
dist/* |
24 changes: 24 additions & 0 deletions
24
packages/web-components/fast-components-msft/.storybook/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const CircularDependencyPlugin = require("circular-dependency-plugin"); | ||
|
||
module.exports = { | ||
stories: ["../src/**/*.stories.ts"], | ||
webpackFinal: async config => { | ||
config.module.rules.push({ | ||
test: /\.(ts)$/, | ||
use: [ | ||
{ | ||
loader: require.resolve("ts-loader"), | ||
}, | ||
], | ||
}); | ||
config.resolve.extensions.push(".ts"); | ||
config.plugins.push( | ||
new CircularDependencyPlugin({ | ||
exclude: /node_modules/, | ||
failOnError: process.env.NODE_ENV === "production", | ||
}) | ||
); | ||
|
||
return config; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# FAST Components MSFT | ||
|
||
A set of React components which implements the Microsoft styling. | ||
|
||
## Installation | ||
|
||
`npm i --save @microsoft/fast-components-msft` | ||
|
||
### Known issue with Storybook site hot-reloading during development | ||
|
||
Storybook will watch modules for changes and hot-reload the module when necessary. This is usually great but poses a problem when the module being hot-reloaded defines a custom element. A custom element name can only be defined by the `CustomElementsRegistry` once, so reloading a module that defines a custom element will attempt to re-register the custom element name, throwing an error because the name has already been defined. This error will manifest with the following message: | ||
`Failed to execute 'define' on 'CustomElementRegistry': the name "my-custom-element-name" has already been used with this registry` | ||
|
||
This is a known issue and will indicate that you need to refresh the page. We're working on surfacing a more instructive error message for this case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "@microsoft/fast-components-msft", | ||
"description": "A library of Web Components with Microsoft styles", | ||
"sideEffects": false, | ||
"version": "0.0.0", | ||
"author": { | ||
"name": "Microsoft", | ||
"url": "https://discord.gg/FcSNfg4" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Microsoft/fast-dna.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Microsoft/fast-dna/issues/new/choose" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc -p ./tsconfig.build.json", | ||
"clean:dist": "node ../../../build/clean.js dist", | ||
"prepare": "yarn clean:dist && yarn build", | ||
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"", | ||
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", | ||
"eslint": "eslint . --ext .ts", | ||
"eslint:fix": "eslint . --ext .ts --fix", | ||
"start": "start-storybook -p 6006", | ||
"test": "yarn build-storybook && yarn eslint", | ||
"build-storybook": "build-storybook" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@microsoft/eslint-config-fast-dna": "^1.1.1", | ||
"@storybook/cli": "^5.3.13", | ||
"@storybook/html": "^5.3.13", | ||
"circular-dependency-plugin": "^5.2.0", | ||
"prettier": "2.0.2", | ||
"ts-loader": "^6.2.1", | ||
"typescript": "^3.7.5" | ||
}, | ||
"dependencies": { | ||
"@microsoft/fast-components": "^0.10.1", | ||
"@microsoft/fast-components-styles-msft": "4.28.9", | ||
"@microsoft/fast-element": "^0.8.1" | ||
} | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
packages/web-components/fast-components-msft/src/anchor/anchor.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { FASTDesignSystemProvider } from "../design-system-provider"; | ||
import AnchorTemplate from "./fixtures/anchor.html"; | ||
import { FASTAnchor } from "./"; | ||
|
||
// Prevent tree-shaking | ||
FASTAnchor; | ||
FASTDesignSystemProvider; | ||
|
||
export default { | ||
title: "Anchor", | ||
}; | ||
|
||
export const Anchor = () => AnchorTemplate; |
59 changes: 59 additions & 0 deletions
59
packages/web-components/fast-components-msft/src/anchor/anchor.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { css } from "@microsoft/fast-element"; | ||
import { | ||
AccentButtonStyles, | ||
accentFillActiveBehavior, | ||
accentFillHoverBehavior, | ||
accentFillRestBehavior, | ||
accentForegroundActiveBehavior, | ||
accentForegroundCutRestBehavior, | ||
accentForegroundHoverBehavior, | ||
accentForegroundRestBehavior, | ||
BaseButtonStyles, | ||
HypertextStyles, | ||
LightweightButtonStyles, | ||
neutralFillActiveBehavior, | ||
neutralFillFocusBehavior, | ||
neutralFillHoverBehavior, | ||
neutralFillRestBehavior, | ||
neutralFillStealthActiveBehavior, | ||
neutralFillStealthHoverBehavior, | ||
neutralFillStealthRestBehavior, | ||
neutralFocusBehavior, | ||
neutralFocusInnerAccentBehavior, | ||
neutralForegroundRestBehavior, | ||
neutralOutlineActiveBehavior, | ||
neutralOutlineHoverBehavior, | ||
neutralOutlineRestBehavior, | ||
OutlineButtonStyles, | ||
StealthButtonStyles, | ||
} from "../styles/"; | ||
|
||
export const AnchorStyles = css` | ||
${BaseButtonStyles} | ||
${AccentButtonStyles} | ||
${HypertextStyles} | ||
${LightweightButtonStyles} | ||
${OutlineButtonStyles} | ||
${StealthButtonStyles} | ||
`.withBehaviors( | ||
accentFillActiveBehavior, | ||
accentFillHoverBehavior, | ||
accentFillRestBehavior, | ||
accentForegroundActiveBehavior, | ||
accentForegroundCutRestBehavior, | ||
accentForegroundHoverBehavior, | ||
accentForegroundRestBehavior, | ||
neutralFillActiveBehavior, | ||
neutralFillFocusBehavior, | ||
neutralFillHoverBehavior, | ||
neutralFillRestBehavior, | ||
neutralFillStealthActiveBehavior, | ||
neutralFillStealthHoverBehavior, | ||
neutralFillStealthRestBehavior, | ||
neutralFocusBehavior, | ||
neutralFocusInnerAccentBehavior, | ||
neutralForegroundRestBehavior, | ||
neutralOutlineActiveBehavior, | ||
neutralOutlineHoverBehavior, | ||
neutralOutlineRestBehavior | ||
); |
69 changes: 69 additions & 0 deletions
69
packages/web-components/fast-components-msft/src/anchor/fixtures/anchor.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<fast-design-system-provider use-defaults> | ||
<h1>Anchor</h1> | ||
|
||
<h4>Default</h4> | ||
<fast-anchor href="#">Anchor</fast-anchor> | ||
|
||
<h5>With target</h5> | ||
<fast-anchor href="https://microsoft.com" target="_blank">Anchor</fast-anchor> | ||
|
||
<h4>Neutral</h4> | ||
<fast-anchor href="#" appearance="neutral">Button</fast-anchor> | ||
|
||
<h4>Accent</h4> | ||
<fast-anchor href="#" appearance="accent">Anchor</fast-anchor> | ||
|
||
<h4>Hypertext</h4> | ||
<fast-anchor href="#" appearance="hypertext">Anchor</fast-anchor> | ||
<br/> | ||
<fast-anchor appearance="hypertext">Anchor (no href)</fast-anchor> | ||
|
||
<h4>Lightweight</h4> | ||
<fast-anchor href="#" appearance="lightweight">Anchor</fast-anchor> | ||
|
||
<h4>Outline</h4> | ||
<fast-anchor href="#" appearance="outline">Anchor</fast-anchor> | ||
|
||
<h4>Stealth</h4> | ||
<fast-anchor href="#" appearance="stealth">Anchor</fast-anchor> | ||
|
||
<h4>With start</h4> | ||
<fast-anchor href="#"> | ||
Anchor | ||
<svg | ||
slot="start" | ||
width="16" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path d="M6.5,7.7h-1v-1h1V7.7z M10.6,7.7h-1v-1h1V7.7z M14.7,6.7v2.1h-1v2.6c0,0.2,0,0.4-0.1,0.6c-0.1,0.2-0.2,0.4-0.3,0.5c-0.1,0.1-0.3,0.3-0.5,0.3c-0.2,0.1-0.4,0.1-0.6,0.1H10l-3.5,3v-3H3.9c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.2-0.5-0.3c-0.1-0.1-0.3-0.3-0.3-0.5c-0.1-0.2-0.1-0.4-0.1-0.6V8.8h-1V6.7h1V5.2c0-0.2,0-0.4,0.1-0.6c0.1-0.2,0.2-0.4,0.3-0.5c0.1-0.1,0.3-0.3,0.5-0.3c0.2-0.1,0.4-0.1,0.6-0.1h3.6V1.9C7.3,1.8,7.2,1.7,7.1,1.5C7,1.4,7,1.2,7,1C7,0.9,7,0.8,7,0.6c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.2C7.7,0,7.9,0,8,0c0.1,0,0.3,0,0.4,0.1c0.1,0.1,0.2,0.1,0.3,0.2C8.8,0.4,8.9,0.5,9,0.6C9,0.8,9,0.9,9,1c0,0.2,0,0.4-0.1,0.5C8.8,1.7,8.7,1.8,8.5,1.9v1.7h3.6c0.2,0,0.4,0,0.6,0.1c0.2,0.1,0.4,0.2,0.5,0.3c0.1,0.1,0.3,0.3,0.3,0.5c0.1,0.2,0.1,0.4,0.1,0.6v1.5H14.7z M12.6,5.2c0-0.1-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.4-0.2H3.9c-0.1,0-0.3,0.1-0.4,0.2C3.4,4.9,3.4,5,3.4,5.2v6.2c0,0.1,0.1,0.3,0.2,0.4c0.1,0.1,0.2,0.2,0.4,0.2h3.6v1.8l2.1-1.8h2.5c0.1,0,0.3-0.1,0.4-0.2c0.1-0.1,0.2-0.2,0.2-0.4V5.2z M5.8,8.9c0.3,0.3,0.6,0.5,1,0.7C7.2,9.7,7.6,9.8,8,9.8s0.8-0.1,1.2-0.2c0.4-0.2,0.7-0.4,1-0.7l0.7,0.7c-0.4,0.4-0.8,0.7-1.4,0.9c-0.5,0.2-1,0.3-1.6,0.3s-1.1-0.1-1.6-0.3c-0.5-0.2-1-0.5-1.3-0.9L5.8,8.9z" /> | ||
</svg> | ||
</fast-anchor> | ||
|
||
<h4>With end</h4> | ||
<fast-anchor href="#"> | ||
Anchor | ||
<svg | ||
slot="end" | ||
width="16" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path d="M6.5,7.7h-1v-1h1V7.7z M10.6,7.7h-1v-1h1V7.7z M14.7,6.7v2.1h-1v2.6c0,0.2,0,0.4-0.1,0.6c-0.1,0.2-0.2,0.4-0.3,0.5c-0.1,0.1-0.3,0.3-0.5,0.3c-0.2,0.1-0.4,0.1-0.6,0.1H10l-3.5,3v-3H3.9c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.2-0.5-0.3c-0.1-0.1-0.3-0.3-0.3-0.5c-0.1-0.2-0.1-0.4-0.1-0.6V8.8h-1V6.7h1V5.2c0-0.2,0-0.4,0.1-0.6c0.1-0.2,0.2-0.4,0.3-0.5c0.1-0.1,0.3-0.3,0.5-0.3c0.2-0.1,0.4-0.1,0.6-0.1h3.6V1.9C7.3,1.8,7.2,1.7,7.1,1.5C7,1.4,7,1.2,7,1C7,0.9,7,0.8,7,0.6c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.2C7.7,0,7.9,0,8,0c0.1,0,0.3,0,0.4,0.1c0.1,0.1,0.2,0.1,0.3,0.2C8.8,0.4,8.9,0.5,9,0.6C9,0.8,9,0.9,9,1c0,0.2,0,0.4-0.1,0.5C8.8,1.7,8.7,1.8,8.5,1.9v1.7h3.6c0.2,0,0.4,0,0.6,0.1c0.2,0.1,0.4,0.2,0.5,0.3c0.1,0.1,0.3,0.3,0.3,0.5c0.1,0.2,0.1,0.4,0.1,0.6v1.5H14.7z M12.6,5.2c0-0.1-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.4-0.2H3.9c-0.1,0-0.3,0.1-0.4,0.2C3.4,4.9,3.4,5,3.4,5.2v6.2c0,0.1,0.1,0.3,0.2,0.4c0.1,0.1,0.2,0.2,0.4,0.2h3.6v1.8l2.1-1.8h2.5c0.1,0,0.3-0.1,0.4-0.2c0.1-0.1,0.2-0.2,0.2-0.4V5.2z M5.8,8.9c0.3,0.3,0.6,0.5,1,0.7C7.2,9.7,7.6,9.8,8,9.8s0.8-0.1,1.2-0.2c0.4-0.2,0.7-0.4,1-0.7l0.7,0.7c-0.4,0.4-0.8,0.7-1.4,0.9c-0.5,0.2-1,0.3-1.6,0.3s-1.1-0.1-1.6-0.3c-0.5-0.2-1-0.5-1.3-0.9L5.8,8.9z" /> | ||
</svg> | ||
</fast-anchor> | ||
|
||
<h4>Icon in default slot</h4> | ||
<fast-anchor href="#"> | ||
<svg | ||
width="16" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path d="M6.5,7.7h-1v-1h1V7.7z M10.6,7.7h-1v-1h1V7.7z M14.7,6.7v2.1h-1v2.6c0,0.2,0,0.4-0.1,0.6c-0.1,0.2-0.2,0.4-0.3,0.5c-0.1,0.1-0.3,0.3-0.5,0.3c-0.2,0.1-0.4,0.1-0.6,0.1H10l-3.5,3v-3H3.9c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.2-0.5-0.3c-0.1-0.1-0.3-0.3-0.3-0.5c-0.1-0.2-0.1-0.4-0.1-0.6V8.8h-1V6.7h1V5.2c0-0.2,0-0.4,0.1-0.6c0.1-0.2,0.2-0.4,0.3-0.5c0.1-0.1,0.3-0.3,0.5-0.3c0.2-0.1,0.4-0.1,0.6-0.1h3.6V1.9C7.3,1.8,7.2,1.7,7.1,1.5C7,1.4,7,1.2,7,1C7,0.9,7,0.8,7,0.6c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.2C7.7,0,7.9,0,8,0c0.1,0,0.3,0,0.4,0.1c0.1,0.1,0.2,0.1,0.3,0.2C8.8,0.4,8.9,0.5,9,0.6C9,0.8,9,0.9,9,1c0,0.2,0,0.4-0.1,0.5C8.8,1.7,8.7,1.8,8.5,1.9v1.7h3.6c0.2,0,0.4,0,0.6,0.1c0.2,0.1,0.4,0.2,0.5,0.3c0.1,0.1,0.3,0.3,0.3,0.5c0.1,0.2,0.1,0.4,0.1,0.6v1.5H14.7z M12.6,5.2c0-0.1-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.4-0.2H3.9c-0.1,0-0.3,0.1-0.4,0.2C3.4,4.9,3.4,5,3.4,5.2v6.2c0,0.1,0.1,0.3,0.2,0.4c0.1,0.1,0.2,0.2,0.4,0.2h3.6v1.8l2.1-1.8h2.5c0.1,0,0.3-0.1,0.4-0.2c0.1-0.1,0.2-0.2,0.2-0.4V5.2z M5.8,8.9c0.3,0.3,0.6,0.5,1,0.7C7.2,9.7,7.6,9.8,8,9.8s0.8-0.1,1.2-0.2c0.4-0.2,0.7-0.4,1-0.7l0.7,0.7c-0.4,0.4-0.8,0.7-1.4,0.9c-0.5,0.2-1,0.3-1.6,0.3s-1.1-0.1-1.6-0.3c-0.5-0.2-1-0.5-1.3-0.9L5.8,8.9z" /> | ||
</svg> | ||
</fast-anchor> | ||
</fast-design-system-provider> |
14 changes: 14 additions & 0 deletions
14
packages/web-components/fast-components-msft/src/anchor/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { customElement } from "@microsoft/fast-element"; | ||
import { Anchor, AnchorTemplate as template } from "@microsoft/fast-foundation"; | ||
import { AnchorStyles as styles } from "./anchor.styles"; | ||
|
||
// Anchor | ||
@customElement({ | ||
name: "fast-anchor", | ||
template, | ||
styles, | ||
shadowOptions: { | ||
delegatesFocus: true, | ||
}, | ||
}) | ||
export class FASTAnchor extends Anchor {} |
13 changes: 13 additions & 0 deletions
13
packages/web-components/fast-components-msft/src/badge/badge.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { FASTDesignSystemProvider } from "../design-system-provider"; | ||
import BadgeTemplate from "./fixtures/badge.html"; | ||
import { FASTBadge } from "./"; | ||
|
||
// Prevent tree-shaking | ||
FASTBadge; | ||
FASTDesignSystemProvider; | ||
|
||
export default { | ||
title: "Badge", | ||
}; | ||
|
||
export const Badge = () => BadgeTemplate; |
49 changes: 49 additions & 0 deletions
49
packages/web-components/fast-components-msft/src/badge/badge.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { css } from "@microsoft/fast-element"; | ||
import { display } from "@microsoft/fast-foundation"; | ||
import { | ||
accentFillRestBehavior, | ||
accentForegroundCutRestBehavior, | ||
accentForegroundRestBehavior, | ||
neutralFillInputRestBehavior, | ||
neutralFillToggleRestBehavior, | ||
neutralForegroundRestBehavior, | ||
} from "../styles"; | ||
|
||
export const BadgeStyles = css` | ||
${display("inline-block")} :host { | ||
box-sizing: border-box; | ||
font-family: var(--body-font); | ||
${/* Font size, weight, and line height are temporary - | ||
replace when adaptive typography is figured out */ ""} font-size: 12px; | ||
font-weight: 400; | ||
line-height: 18px; | ||
} | ||
|
||
.badge { | ||
border-radius: calc(var(--corner-radius) * 1px); | ||
padding: calc(var(--design-unit) * 0.5px) calc(var(--design-unit) * 1px); | ||
} | ||
|
||
:host(.lightweight) { | ||
--badge-fill-lightweight: transparent; | ||
--badge-color-value: var(--neutral-foreground-rest); | ||
font-weight: 600; | ||
} | ||
|
||
:host(.accent) { | ||
--badge-fill-accent: var(--accent-fill-rest); | ||
--badge-color-value: var(--accent-foreground-cut-rest); | ||
} | ||
|
||
:host(.neutral) { | ||
--badge-fill-neutral: var(--neutral-fill-toggle-rest); | ||
--badge-color-value: var(--neutral-fill-input-rest); | ||
} | ||
`.withBehaviors( | ||
accentFillRestBehavior, | ||
accentForegroundCutRestBehavior, | ||
accentForegroundRestBehavior, | ||
neutralForegroundRestBehavior, | ||
neutralFillInputRestBehavior, | ||
neutralFillToggleRestBehavior | ||
); |
19 changes: 19 additions & 0 deletions
19
packages/web-components/fast-components-msft/src/badge/fixtures/badge.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<fast-design-system-provider use-defaults> | ||
<h1>Badge</h1> | ||
<h4>Default</h4> | ||
<fast-badge> | ||
Badge | ||
</fast-badge> | ||
<h4>Lightweight</h4> | ||
<fast-badge fill="lightweight"> | ||
Badge | ||
</fast-badge> | ||
<h4>Accent</h4> | ||
<fast-badge fill="accent"> | ||
Badge | ||
</fast-badge> | ||
<h4>Neutral</h4> | ||
<fast-badge fill="neutral"> | ||
Badge | ||
</fast-badge> | ||
</fast-design-system-provider> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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