forked from microsoft/fast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds direction property to design system (microsoft#3535)
* adds direction design system property * adds inline-start and inline-end behaviors * update API reports * update API docs with examples
- @microsoft/site-utilities@0.4.2
- @microsoft/site-utilities@0.4.1
- @microsoft/fast-tooling-wasm@1.1.0
- @microsoft/fast-tooling-react@2.3.2
- @microsoft/fast-tooling-react@2.3.1
- @microsoft/fast-tooling-examples@0.4.2
- @microsoft/fast-tooling-examples@0.4.1
- @microsoft/fast-tooling@0.8.0
- @microsoft/fast-foundation@1.6.0
- @microsoft/fast-foundation@1.5.0
- @microsoft/fast-figma-plugin-msft@0.7.2
- @microsoft/fast-figma-plugin-msft@0.7.1
- @microsoft/fast-element@0.15.2
- @microsoft/fast-element@0.15.1
- @microsoft/fast-creator@0.2.2
- @microsoft/fast-creator@0.2.1
- @microsoft/fast-components-msft@1.6.0
- @microsoft/fast-components@1.7.0
- @microsoft/fast-components@1.6.0
- @microsoft/fast-component-explorer@0.11.2
- @microsoft/fast-component-explorer@0.11.1
- @microsoft/fast-color-explorer@1.6.2
- @microsoft/fast-color-explorer@1.6.1
- fast-website@1.2.2
- fast-website@1.2.1
1 parent
1f61053
commit 492f5e7
Showing
10 changed files
with
181 additions
and
9 deletions.
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
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
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
packages/web-components/fast-components/src/styles/direction.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,57 @@ | ||
import { cssCustomPropertyBehaviorFactory } from "@microsoft/fast-foundation"; | ||
import { Direction } from "@microsoft/fast-web-utilities"; | ||
import { FASTDesignSystem, direction } from "../fast-design-system"; | ||
import { FASTDesignSystemProvider } from "../design-system-provider"; | ||
/** | ||
* Behavior to resolve and make available the inline-start CSS custom property. | ||
* | ||
* @remarks | ||
* Replaces the inline-start value for the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/float | float} property | ||
* when the native value is not supported. | ||
* | ||
* @public | ||
* @example | ||
* ```ts | ||
* import { css } from "@microsoft/fast-element"; | ||
* import { inlineStartBehavior } from "@microsoft/fast-components"; | ||
* | ||
* css` | ||
* :host { | ||
* float: ${inlineStartBehavior.var}; | ||
* } | ||
* `.withBehaviors(inlineStartBehavior) | ||
* ``` | ||
*/ | ||
export const inlineStartBehavior = cssCustomPropertyBehaviorFactory( | ||
"inline-start", | ||
(designSystem: FASTDesignSystem) => | ||
direction(designSystem) === Direction.ltr ? "left" : "right", | ||
FASTDesignSystemProvider.findProvider | ||
); | ||
|
||
/** | ||
* Behavior to resolve and make available the inline-end CSS custom property. | ||
* | ||
* @remarks | ||
* Replaces the inline-end value for the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/float | float} property | ||
* when the native value is not supported. | ||
* | ||
* @public | ||
* @example | ||
* ```ts | ||
* import { css } from "@microsoft/fast-element"; | ||
* import { inlineEndBehavior } from "@microsoft/fast-components"; | ||
* | ||
* css` | ||
* :host { | ||
* float: ${inlineEndBehavior.var}; | ||
* } | ||
* `.withBehaviors(inlineEndBehavior) | ||
* ``` | ||
*/ | ||
export const inlineEndBehavior = cssCustomPropertyBehaviorFactory( | ||
"inline-end", | ||
(designSystem: FASTDesignSystem) => | ||
direction(designSystem) === Direction.ltr ? "right" : "left", | ||
FASTDesignSystemProvider.findProvider | ||
); |
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
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