@fluentui/react-text 0.0.0-nightly0025eeb82020211108.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/CHANGELOG.json +1283 -0
  2. package/CHANGELOG.md +472 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +680 -0
  5. package/README.md +99 -0
  6. package/Spec.md +162 -0
  7. package/assets/typography-examples.gif +0 -0
  8. package/dist/react-text.d.ts +183 -0
  9. package/lib/Body.d.ts +1 -0
  10. package/lib/Body.js +2 -0
  11. package/lib/Body.js.map +1 -0
  12. package/lib/Caption.d.ts +1 -0
  13. package/lib/Caption.js +2 -0
  14. package/lib/Caption.js.map +1 -0
  15. package/lib/Display.d.ts +1 -0
  16. package/lib/Display.js +2 -0
  17. package/lib/Display.js.map +1 -0
  18. package/lib/Headline.d.ts +1 -0
  19. package/lib/Headline.js +2 -0
  20. package/lib/Headline.js.map +1 -0
  21. package/lib/LargeTitle.d.ts +1 -0
  22. package/lib/LargeTitle.js +2 -0
  23. package/lib/LargeTitle.js.map +1 -0
  24. package/lib/Subheadline.d.ts +1 -0
  25. package/lib/Subheadline.js +2 -0
  26. package/lib/Subheadline.js.map +1 -0
  27. package/lib/Text.d.ts +1 -0
  28. package/lib/Text.js +2 -0
  29. package/lib/Text.js.map +1 -0
  30. package/lib/Title1.d.ts +1 -0
  31. package/lib/Title1.js +2 -0
  32. package/lib/Title1.js.map +1 -0
  33. package/lib/Title2.d.ts +1 -0
  34. package/lib/Title2.js +2 -0
  35. package/lib/Title2.js.map +1 -0
  36. package/lib/Title3.d.ts +1 -0
  37. package/lib/Title3.js +2 -0
  38. package/lib/Title3.js.map +1 -0
  39. package/lib/common/isConformant.d.ts +4 -0
  40. package/lib/common/isConformant.js +16 -0
  41. package/lib/common/isConformant.js.map +1 -0
  42. package/lib/components/Body/Body.d.ts +7 -0
  43. package/lib/components/Body/Body.js +29 -0
  44. package/lib/components/Body/Body.js.map +1 -0
  45. package/lib/components/Body/index.d.ts +1 -0
  46. package/lib/components/Body/index.js +2 -0
  47. package/lib/components/Body/index.js.map +1 -0
  48. package/lib/components/Caption/Caption.d.ts +7 -0
  49. package/lib/components/Caption/Caption.js +29 -0
  50. package/lib/components/Caption/Caption.js.map +1 -0
  51. package/lib/components/Caption/index.d.ts +1 -0
  52. package/lib/components/Caption/index.js +2 -0
  53. package/lib/components/Caption/index.js.map +1 -0
  54. package/lib/components/Display/Display.d.ts +7 -0
  55. package/lib/components/Display/Display.js +29 -0
  56. package/lib/components/Display/Display.js.map +1 -0
  57. package/lib/components/Display/index.d.ts +1 -0
  58. package/lib/components/Display/index.js +2 -0
  59. package/lib/components/Display/index.js.map +1 -0
  60. package/lib/components/Headline/Headline.d.ts +7 -0
  61. package/lib/components/Headline/Headline.js +29 -0
  62. package/lib/components/Headline/Headline.js.map +1 -0
  63. package/lib/components/Headline/index.d.ts +1 -0
  64. package/lib/components/Headline/index.js +2 -0
  65. package/lib/components/Headline/index.js.map +1 -0
  66. package/lib/components/LargeTitle/LargeTitle.d.ts +7 -0
  67. package/lib/components/LargeTitle/LargeTitle.js +29 -0
  68. package/lib/components/LargeTitle/LargeTitle.js.map +1 -0
  69. package/lib/components/LargeTitle/index.d.ts +1 -0
  70. package/lib/components/LargeTitle/index.js +2 -0
  71. package/lib/components/LargeTitle/index.js.map +1 -0
  72. package/lib/components/Subheadline/Subheadline.d.ts +7 -0
  73. package/lib/components/Subheadline/Subheadline.js +29 -0
  74. package/lib/components/Subheadline/Subheadline.js.map +1 -0
  75. package/lib/components/Subheadline/index.d.ts +1 -0
  76. package/lib/components/Subheadline/index.js +2 -0
  77. package/lib/components/Subheadline/index.js.map +1 -0
  78. package/lib/components/Text/Text.d.ts +6 -0
  79. package/lib/components/Text/Text.js +15 -0
  80. package/lib/components/Text/Text.js.map +1 -0
  81. package/lib/components/Text/Text.types.d.ts +77 -0
  82. package/lib/components/Text/Text.types.js +2 -0
  83. package/lib/components/Text/Text.types.js.map +1 -0
  84. package/lib/components/Text/index.d.ts +5 -0
  85. package/lib/components/Text/index.js +6 -0
  86. package/lib/components/Text/index.js.map +1 -0
  87. package/lib/components/Text/renderText.d.ts +5 -0
  88. package/lib/components/Text/renderText.js +14 -0
  89. package/lib/components/Text/renderText.js.map +1 -0
  90. package/lib/components/Text/useText.d.ts +12 -0
  91. package/lib/components/Text/useText.js +50 -0
  92. package/lib/components/Text/useText.js.map +1 -0
  93. package/lib/components/Text/useTextStyles.d.ts +6 -0
  94. package/lib/components/Text/useTextStyles.js +111 -0
  95. package/lib/components/Text/useTextStyles.js.map +1 -0
  96. package/lib/components/Title1/Title1.d.ts +7 -0
  97. package/lib/components/Title1/Title1.js +29 -0
  98. package/lib/components/Title1/Title1.js.map +1 -0
  99. package/lib/components/Title1/index.d.ts +1 -0
  100. package/lib/components/Title1/index.js +2 -0
  101. package/lib/components/Title1/index.js.map +1 -0
  102. package/lib/components/Title2/Title2.d.ts +7 -0
  103. package/lib/components/Title2/Title2.js +29 -0
  104. package/lib/components/Title2/Title2.js.map +1 -0
  105. package/lib/components/Title2/index.d.ts +1 -0
  106. package/lib/components/Title2/index.js +2 -0
  107. package/lib/components/Title2/index.js.map +1 -0
  108. package/lib/components/Title3/Title3.d.ts +7 -0
  109. package/lib/components/Title3/Title3.js +29 -0
  110. package/lib/components/Title3/Title3.js.map +1 -0
  111. package/lib/components/Title3/index.d.ts +1 -0
  112. package/lib/components/Title3/index.js +2 -0
  113. package/lib/components/Title3/index.js.map +1 -0
  114. package/lib/components/wrapper.d.ts +8 -0
  115. package/lib/components/wrapper.js +20 -0
  116. package/lib/components/wrapper.js.map +1 -0
  117. package/lib/index.d.ts +10 -0
  118. package/lib/index.js +11 -0
  119. package/lib/index.js.map +1 -0
  120. package/lib/tsdoc-metadata.json +11 -0
  121. package/lib/typographyStyles/index.d.ts +2 -0
  122. package/lib/typographyStyles/index.js +3 -0
  123. package/lib/typographyStyles/index.js.map +1 -0
  124. package/lib/typographyStyles/typographyStyles.d.ts +14 -0
  125. package/lib/typographyStyles/typographyStyles.js +58 -0
  126. package/lib/typographyStyles/typographyStyles.js.map +1 -0
  127. package/lib-commonjs/Body.d.ts +1 -0
  128. package/lib-commonjs/Body.js +10 -0
  129. package/lib-commonjs/Body.js.map +1 -0
  130. package/lib-commonjs/Caption.d.ts +1 -0
  131. package/lib-commonjs/Caption.js +10 -0
  132. package/lib-commonjs/Caption.js.map +1 -0
  133. package/lib-commonjs/Display.d.ts +1 -0
  134. package/lib-commonjs/Display.js +10 -0
  135. package/lib-commonjs/Display.js.map +1 -0
  136. package/lib-commonjs/Headline.d.ts +1 -0
  137. package/lib-commonjs/Headline.js +10 -0
  138. package/lib-commonjs/Headline.js.map +1 -0
  139. package/lib-commonjs/LargeTitle.d.ts +1 -0
  140. package/lib-commonjs/LargeTitle.js +10 -0
  141. package/lib-commonjs/LargeTitle.js.map +1 -0
  142. package/lib-commonjs/Subheadline.d.ts +1 -0
  143. package/lib-commonjs/Subheadline.js +10 -0
  144. package/lib-commonjs/Subheadline.js.map +1 -0
  145. package/lib-commonjs/Text.d.ts +1 -0
  146. package/lib-commonjs/Text.js +10 -0
  147. package/lib-commonjs/Text.js.map +1 -0
  148. package/lib-commonjs/Title1.d.ts +1 -0
  149. package/lib-commonjs/Title1.js +10 -0
  150. package/lib-commonjs/Title1.js.map +1 -0
  151. package/lib-commonjs/Title2.d.ts +1 -0
  152. package/lib-commonjs/Title2.js +10 -0
  153. package/lib-commonjs/Title2.js.map +1 -0
  154. package/lib-commonjs/Title3.d.ts +1 -0
  155. package/lib-commonjs/Title3.js +10 -0
  156. package/lib-commonjs/Title3.js.map +1 -0
  157. package/lib-commonjs/common/isConformant.d.ts +4 -0
  158. package/lib-commonjs/common/isConformant.js +27 -0
  159. package/lib-commonjs/common/isConformant.js.map +1 -0
  160. package/lib-commonjs/components/Body/Body.d.ts +7 -0
  161. package/lib-commonjs/components/Body/Body.js +32 -0
  162. package/lib-commonjs/components/Body/Body.js.map +1 -0
  163. package/lib-commonjs/components/Body/index.d.ts +1 -0
  164. package/lib-commonjs/components/Body/index.js +10 -0
  165. package/lib-commonjs/components/Body/index.js.map +1 -0
  166. package/lib-commonjs/components/Caption/Caption.d.ts +7 -0
  167. package/lib-commonjs/components/Caption/Caption.js +32 -0
  168. package/lib-commonjs/components/Caption/Caption.js.map +1 -0
  169. package/lib-commonjs/components/Caption/index.d.ts +1 -0
  170. package/lib-commonjs/components/Caption/index.js +10 -0
  171. package/lib-commonjs/components/Caption/index.js.map +1 -0
  172. package/lib-commonjs/components/Display/Display.d.ts +7 -0
  173. package/lib-commonjs/components/Display/Display.js +32 -0
  174. package/lib-commonjs/components/Display/Display.js.map +1 -0
  175. package/lib-commonjs/components/Display/index.d.ts +1 -0
  176. package/lib-commonjs/components/Display/index.js +10 -0
  177. package/lib-commonjs/components/Display/index.js.map +1 -0
  178. package/lib-commonjs/components/Headline/Headline.d.ts +7 -0
  179. package/lib-commonjs/components/Headline/Headline.js +32 -0
  180. package/lib-commonjs/components/Headline/Headline.js.map +1 -0
  181. package/lib-commonjs/components/Headline/index.d.ts +1 -0
  182. package/lib-commonjs/components/Headline/index.js +10 -0
  183. package/lib-commonjs/components/Headline/index.js.map +1 -0
  184. package/lib-commonjs/components/LargeTitle/LargeTitle.d.ts +7 -0
  185. package/lib-commonjs/components/LargeTitle/LargeTitle.js +32 -0
  186. package/lib-commonjs/components/LargeTitle/LargeTitle.js.map +1 -0
  187. package/lib-commonjs/components/LargeTitle/index.d.ts +1 -0
  188. package/lib-commonjs/components/LargeTitle/index.js +10 -0
  189. package/lib-commonjs/components/LargeTitle/index.js.map +1 -0
  190. package/lib-commonjs/components/Subheadline/Subheadline.d.ts +7 -0
  191. package/lib-commonjs/components/Subheadline/Subheadline.js +32 -0
  192. package/lib-commonjs/components/Subheadline/Subheadline.js.map +1 -0
  193. package/lib-commonjs/components/Subheadline/index.d.ts +1 -0
  194. package/lib-commonjs/components/Subheadline/index.js +10 -0
  195. package/lib-commonjs/components/Subheadline/index.js.map +1 -0
  196. package/lib-commonjs/components/Text/Text.d.ts +6 -0
  197. package/lib-commonjs/components/Text/Text.js +26 -0
  198. package/lib-commonjs/components/Text/Text.js.map +1 -0
  199. package/lib-commonjs/components/Text/Text.types.d.ts +77 -0
  200. package/lib-commonjs/components/Text/Text.types.js +6 -0
  201. package/lib-commonjs/components/Text/Text.types.js.map +1 -0
  202. package/lib-commonjs/components/Text/index.d.ts +5 -0
  203. package/lib-commonjs/components/Text/index.js +18 -0
  204. package/lib-commonjs/components/Text/index.js.map +1 -0
  205. package/lib-commonjs/components/Text/renderText.d.ts +5 -0
  206. package/lib-commonjs/components/Text/renderText.js +25 -0
  207. package/lib-commonjs/components/Text/renderText.js.map +1 -0
  208. package/lib-commonjs/components/Text/useText.d.ts +12 -0
  209. package/lib-commonjs/components/Text/useText.js +60 -0
  210. package/lib-commonjs/components/Text/useText.js.map +1 -0
  211. package/lib-commonjs/components/Text/useTextStyles.d.ts +6 -0
  212. package/lib-commonjs/components/Text/useTextStyles.js +121 -0
  213. package/lib-commonjs/components/Text/useTextStyles.js.map +1 -0
  214. package/lib-commonjs/components/Title1/Title1.d.ts +7 -0
  215. package/lib-commonjs/components/Title1/Title1.js +32 -0
  216. package/lib-commonjs/components/Title1/Title1.js.map +1 -0
  217. package/lib-commonjs/components/Title1/index.d.ts +1 -0
  218. package/lib-commonjs/components/Title1/index.js +10 -0
  219. package/lib-commonjs/components/Title1/index.js.map +1 -0
  220. package/lib-commonjs/components/Title2/Title2.d.ts +7 -0
  221. package/lib-commonjs/components/Title2/Title2.js +32 -0
  222. package/lib-commonjs/components/Title2/Title2.js.map +1 -0
  223. package/lib-commonjs/components/Title2/index.d.ts +1 -0
  224. package/lib-commonjs/components/Title2/index.js +10 -0
  225. package/lib-commonjs/components/Title2/index.js.map +1 -0
  226. package/lib-commonjs/components/Title3/Title3.d.ts +7 -0
  227. package/lib-commonjs/components/Title3/Title3.js +32 -0
  228. package/lib-commonjs/components/Title3/Title3.js.map +1 -0
  229. package/lib-commonjs/components/Title3/index.d.ts +1 -0
  230. package/lib-commonjs/components/Title3/index.js +10 -0
  231. package/lib-commonjs/components/Title3/index.js.map +1 -0
  232. package/lib-commonjs/components/wrapper.d.ts +8 -0
  233. package/lib-commonjs/components/wrapper.js +32 -0
  234. package/lib-commonjs/components/wrapper.js.map +1 -0
  235. package/lib-commonjs/index.d.ts +10 -0
  236. package/lib-commonjs/index.js +28 -0
  237. package/lib-commonjs/index.js.map +1 -0
  238. package/lib-commonjs/typographyStyles/index.d.ts +2 -0
  239. package/lib-commonjs/typographyStyles/index.js +11 -0
  240. package/lib-commonjs/typographyStyles/index.js.map +1 -0
  241. package/lib-commonjs/typographyStyles/typographyStyles.d.ts +14 -0
  242. package/lib-commonjs/typographyStyles/typographyStyles.js +91 -0
  243. package/lib-commonjs/typographyStyles/typographyStyles.js.map +1 -0
  244. package/package.json +64 -0
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # @fluentui/react-text
2
+
3
+ > WIP 🚧 - These are not production-ready components as we are still in a Beta phase.
4
+
5
+ <!-- TODO: Add link to the new website -->
6
+
7
+ The Text component exists to ensure consistency in your application's content by setting fixed sizes and other styles.
8
+ This package also exports wrappers which ensure your text follows the Fluent design standards of typography.
9
+
10
+ ## Usage
11
+
12
+ To use the Text components in your application, you can start by installing the main package of Fluent UI components:
13
+
14
+ <!-- TODO: Validate if FluentProvider works without theme. If not, which theme should we refer to -->
15
+
16
+ ```sh
17
+ npm install @fluentui/react-components
18
+ ```
19
+
20
+ ```jsx
21
+ import { FluentProvider, Text } from '@fluentui/react-components';
22
+
23
+ const App = () => (
24
+ <FluentProvider>
25
+ <Text>Fluent UI Text!</Text>
26
+ </FluentProvider>
27
+ );
28
+ ```
29
+
30
+ Or by installing only the `@fluentui/react-text` package. Keep in mind you'll need to install the FluentProvider package as well:
31
+
32
+ ```sh
33
+ npm install @fluentui/react-text
34
+ npm install @fluentui/react-provider
35
+ ```
36
+
37
+ ```jsx
38
+ import { FluentProvider } from '@fluentui/react-provider';
39
+ import { Text } from '@fluentui/react-text';
40
+
41
+ const App = () => (
42
+ <FluentProvider>
43
+ <Text>Fluent UI Text!</Text>
44
+ </FluentProvider>
45
+ );
46
+ ```
47
+
48
+ ## Typography wrappers
49
+
50
+ ![List of typography variants by sorted descending by size](./assets/typography-examples.gif 'Typography wrapper list')
51
+
52
+ Wrappers offer an easy way to use text according to the Fluent Design System while also providing semantic code readability.
53
+
54
+ Below is an example of the Display wrapper vs using the Text component:
55
+
56
+ ```tsx
57
+ import { Text, Display } from '@fluentui/react-text';
58
+
59
+ const Example = () => (
60
+ <>
61
+ <Text size={1000} weight="semibold">
62
+ This text is styled like a Display variant.
63
+ </Text>
64
+ <Display>This text is also styled like a Display variant.</Display>
65
+ </>
66
+ );
67
+ ```
68
+
69
+ As you can see, using the `Display` wrapper is a lot easier to read and provides a clearer visual of the page's layout.
70
+
71
+ ## Semantic elements
72
+
73
+ By default, Text and all the typography wrappers render a `<span>` element. You should use the `as` property to ensure your page has proper semantic elements such as heading or paragraph elements.
74
+
75
+ ```html
76
+ <div>
77
+ <Headline as="h1">Headline</Headline>
78
+ <Subheadline as="h2">Subheadline</Subheadline>
79
+ <Text as="p">This is simple example</Text>
80
+ </div>
81
+ ```
82
+
83
+ This will result in the following DOM structure:
84
+
85
+ ```html
86
+ <div>
87
+ <h1>Headline</h1>
88
+ <h2>Subheadline</h2>
89
+ <p>This is simple example</p>
90
+ </div>
91
+ ```
92
+
93
+ ## API
94
+
95
+ For more information about the components, please refer to the [API documentation](https://aka.ms/fluentui-storybook).
96
+
97
+ ## Migration
98
+
99
+ For migration information, have a look at the [migration guide](./MIGRATION.md).
package/Spec.md ADDED
@@ -0,0 +1,162 @@
1
+ # @fluentui/react-text Spec
2
+
3
+ ## Background
4
+
5
+ Text is a typography and styling abstraction component that can be used to ensure the consistency of all text across your application.
6
+
7
+ Fabric used the `variant` prop to set any styling/format to the Text component, while also providing other utilities like `nowrap` and `block`.
8
+
9
+ ```jsx
10
+ <Text>This is a Text component</Text>
11
+
12
+ <Text variant="medium">Text</Text>
13
+
14
+ <Text block>Text</Text>
15
+
16
+ <Text nowrap>Text with ellipsis</Text>
17
+ ```
18
+
19
+ Stardust's approach provides a more open API, allowing the user to customize `Text` to their own specific needs.
20
+
21
+ ```jsx
22
+ <Text weight="light" content="This text is light." />
23
+
24
+ <Text color="green" content="Green text" />
25
+
26
+ <Text align="end" content="Text aligned to end" />
27
+
28
+ <Text error content="There has been an error." />
29
+
30
+ <Text disabled content="This feature has been disabled." />
31
+ ```
32
+
33
+ ## Prior Art
34
+
35
+ - [Open UI research](https://github.com/openui/open-ui/pull/351)
36
+ - [Convergence epic](https://github.com/microsoft/fluentui/issues/16847)
37
+
38
+ ## Comparison of [Fabric Text](https://developer.microsoft.com/en-us/fluentui#/controls/web/text) and [Stardust Text](https://fluentsite.z22.web.core.windows.net/0.56.0/components/text/definition)
39
+
40
+ | Purpose | Fabric | Northstar | Matching |
41
+ | ---------------------------------------------------------------------------------------------------------------- | ------- | ------------- | -------------------- |
42
+ | An element type to render as (string or component). | as | as | Matching |
43
+ | Truncates text as needed | nowrap | truncated | Matching |
44
+ | Set font size for text | variant | size | Matching |
45
+ | Renders Text as a block element | block | | Missing in Northstar |
46
+ | Accessibility behavior if overridden by the user. | | accessibility | Missing in Fabric |
47
+ | Align text content. | | align | Missing in Fabric |
48
+ | At mentions can be formatted to draw users' attention. Mentions for "me" can be formatted to appear differently. | | atMention | Missing in Fabric |
49
+ | A component can have a color. | | color | Missing in Fabric |
50
+ | Shorthand for primary content. | | content | Missing in Fabric |
51
+ | Set as disabled Text component | | disabled | Missing in Fabric |
52
+ | Set as error Text component | | error | Missing in Fabric |
53
+ | The text can appear more important and draw user's attention | | important | Missing in Fabric |
54
+ | Set as success Text component | | success | Missing in Fabric |
55
+ | The text can signify a temporary state | | temporary | Missing in Fabric |
56
+ | Set as timestamp Text component | | timestamp | Missing in Fabric |
57
+ | Override for theme site variables to allow modifications of component styling via themes. | | variables | Missing in Fabric |
58
+ | The weight for the Text component | | weight | Missing in Fabric |
59
+ | Additional CSS class name(s) to apply. | | className | Missing in Fabric |
60
+ | Additional CSS styles to apply to the component instance. | | styles | Missing in Fabric |
61
+ | - | | design | Missing in Fabric |
62
+
63
+ ## API Proposal
64
+
65
+ The new Text will provide props to customize text according to the standards defined by Fluent design. The component will not be tied down to specific application usage, like Stardust did, for example, with `mention` and `timestamp` props, and will allow a bigger degree of freedom when customizing, unlike we did in Fabric.
66
+ We're also introducing a new concept of wrappers for the main design variants (i.e. 'Title', 'Subtitle', 'Caption') to improve readability and semantics of the code. The wrappers are expected to have fixed styles in terms of size and font family, but flexible for the other supported props in Text.
67
+ These wrappers follow the Fluent UI language so for any deviation, regarding the fixed styles mentioned above, should use the Text component instead, given that this is fully customizable.
68
+
69
+ | Property | Type | Default value | Comments |
70
+ | ------------- | ---------------------------------------------------------------------- | ------------- | -------- |
71
+ | as | "span" \| "p" \| "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "pre" | "span" | |
72
+ | wrap | boolean | true | |
73
+ | truncate | boolean | false | |
74
+ | block | boolean | false | |
75
+ | italic | boolean | false | |
76
+ | underline | boolean | false | |
77
+ | strikethrough | boolean | false | |
78
+ | size | number - 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 | 300 | |
79
+ | font | string - "base" \| "monospace" \| "numeric" | "base" | |
80
+ | weight | string - "regular" \| "medium" \| "semibold" | "regular" | |
81
+ | align | string - "start" \| "center" \| "end" \| "justify" | "start" | |
82
+
83
+ ### make-styles rules
84
+
85
+ Finally, we're also making available the styling used internally in Text for a lightweight styling solution if you want to avoid using Text or the added JavaScript layers of Text/wrappers.
86
+ This is achieved with the `make-styles` rules being available to the user so that they can follow the Fluent design standards for Typography.
87
+
88
+ ## Sample Code
89
+
90
+ ### Using Text
91
+
92
+ ```jsx
93
+ <Text weight="semibold" size={1000}>This text is semibold and huge.</Text>
94
+
95
+ <Text align="end" italic>Text aligned to the end</Text>
96
+
97
+ <Text strikethrough>This text has a strikethrough.</Text>
98
+ ```
99
+
100
+ ### Using the wrappers
101
+
102
+ ```jsx
103
+ <Display bold>This text is huge.</Display>
104
+ <LargeTitle>This is a large title.</LargeTitle>
105
+ <Title as="h1">Title</Title>
106
+ <Subtitle as="h2">Sub title</Subtitle>
107
+ <Caption>Captioned</Caption>
108
+ ```
109
+
110
+ ### Using styles directly
111
+
112
+ ```jsx
113
+ import { typographyStyles } from '@fluentui/react-text';
114
+
115
+ const useStyles = makeStyles({
116
+ root: typographyStyles.title,
117
+ caption: typographyStyles.caption,
118
+ });
119
+
120
+ const Test = () => {
121
+ const styles = useStyles();
122
+
123
+ return (
124
+ <>
125
+ <p className={styles.root}>
126
+ <span>I am styled like a title</span>
127
+ <span className={styles.caption}>I am styled like a caption</span>
128
+ </p>
129
+ </>
130
+ );
131
+ };
132
+ ```
133
+
134
+ ## Behaviours
135
+
136
+ ### Screen readers
137
+
138
+ #### Truncate
139
+
140
+ When using a screen reader, truncated text will be read completely, as truncation is used strictly to prevent text overflow.
141
+
142
+ Sample:
143
+
144
+ ```jsx
145
+ <Text truncate>This is a very long text that will be truncated.</Text>
146
+ ```
147
+
148
+ Visual result:
149
+
150
+ ```
151
+ This is a very long text...
152
+ ```
153
+
154
+ Screen reader:
155
+
156
+ ```
157
+ This is a very long text that will be truncated.
158
+ ```
159
+
160
+ ## Accesibility
161
+
162
+ Accessibility is included in the entirety of the spec and there are no specific themes to address here.
Binary file
@@ -0,0 +1,183 @@
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
+ import type { FunctionComponent } from 'react';
5
+ import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
6
+ import * as React_2 from 'react';
7
+
8
+ /**
9
+ * Text wrapper component for the Body typography variant
10
+ */
11
+ declare const Body_2: FunctionComponent<TextWrapperProps>;
12
+ export { Body_2 as Body }
13
+
14
+ export declare const bodyClassName = "fui-Body";
15
+
16
+ /**
17
+ * Text wrapper component for the Caption typography variant
18
+ */
19
+ export declare const Caption: FunctionComponent<TextWrapperProps>;
20
+
21
+ export declare const captionClassName = "fui-Caption";
22
+
23
+ /**
24
+ * Text wrapper component for the Display typography variant
25
+ */
26
+ export declare const Display: FunctionComponent<TextWrapperProps>;
27
+
28
+ export declare const displayClassName = "fui-Display";
29
+
30
+ /**
31
+ * Text wrapper component for the Headline typography variant
32
+ */
33
+ export declare const Headline: FunctionComponent<TextWrapperProps>;
34
+
35
+ export declare const headlineClassName = "fui-Headline";
36
+
37
+ /**
38
+ * Text wrapper component for the Large Title typography variant
39
+ */
40
+ export declare const LargeTitle: FunctionComponent<TextWrapperProps>;
41
+
42
+ export declare const largeTitleClassName = "fui-LargeTitle";
43
+
44
+ /**
45
+ * Render the final JSX of Text
46
+ */
47
+ export declare const renderText: (state: TextState) => JSX.Element;
48
+
49
+ /**
50
+ * Text wrapper component for the Subheadline typography variant
51
+ */
52
+ export declare const Subheadline: FunctionComponent<TextWrapperProps>;
53
+
54
+ export declare const subheadlineClassName = "fui-Subheadline";
55
+
56
+ /**
57
+ * Typography and styling abstraction component used to ensure consistency of text.
58
+ */
59
+ declare const Text_2: ForwardRefComponent<TextProps>;
60
+ export { Text_2 as Text }
61
+
62
+ export declare const textClassName = "fui-Text";
63
+
64
+ export declare type TextCommons = {
65
+ /**
66
+ * Wraps the text content on white spaces.
67
+ *
68
+ * @defaultValue true
69
+ */
70
+ wrap: boolean;
71
+ /**
72
+ * Truncate overflowing text for block displays.
73
+ *
74
+ * @defaultValue false
75
+ */
76
+ truncate: boolean;
77
+ /**
78
+ * Applies a block display for the content.
79
+ *
80
+ * @defaultValue false
81
+ */
82
+ block: boolean;
83
+ /**
84
+ * Applies the italic font style to the content.
85
+ *
86
+ * @defaultValue false
87
+ */
88
+ italic: boolean;
89
+ /**
90
+ * Applies the underline text decoration to the content.
91
+ *
92
+ * @defaultValue false
93
+ */
94
+ underline: boolean;
95
+ /**
96
+ * Applies the strikethrough text decoration to the content.
97
+ *
98
+ * @defaultValue false
99
+ */
100
+ strikethrough: boolean;
101
+ /**
102
+ * Applies font size and line height based on the theme tokens.
103
+ *
104
+ * @defaultValue 300
105
+ */
106
+ size: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000;
107
+ /**
108
+ * Applies the font family to the content.
109
+ *
110
+ * @defaultValue base
111
+ */
112
+ font: 'base' | 'monospace' | 'numeric';
113
+ /**
114
+ * Applies font weight to the content.
115
+ *
116
+ * @defaultValue regular
117
+ */
118
+ weight: 'regular' | 'medium' | 'semibold';
119
+ /**
120
+ * Aligns text based on the parent container.
121
+ *
122
+ * @defaultValue start
123
+ */
124
+ align: 'start' | 'center' | 'end' | 'justify';
125
+ };
126
+
127
+ /**
128
+ * Text Props
129
+ */
130
+ export declare type TextProps = ComponentProps<TextSlots> & Partial<TextCommons>;
131
+
132
+ /**
133
+ * Text slots
134
+ */
135
+ export declare type TextSlots = {
136
+ root: IntrinsicShorthandProps<'span', 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'pre'>;
137
+ };
138
+
139
+ /**
140
+ * State used in rendering Text
141
+ */
142
+ export declare type TextState = ComponentState<TextSlots> & TextCommons;
143
+
144
+ declare type TextWrapperProps = Omit<TextProps, 'font' | 'size'>;
145
+
146
+ /**
147
+ * Text wrapper component for the Title 1 typography variant
148
+ */
149
+ export declare const Title1: FunctionComponent<TextWrapperProps>;
150
+
151
+ export declare const title1ClassName = "fui-Title1";
152
+
153
+ /**
154
+ * Text wrapper component for the Title 2 typography variant
155
+ */
156
+ export declare const Title2: FunctionComponent<TextWrapperProps>;
157
+
158
+ export declare const title2ClassName = "fui-Title2";
159
+
160
+ /**
161
+ * Text wrapper component for the Title 3 typography variant
162
+ */
163
+ export declare const Title3: FunctionComponent<TextWrapperProps>;
164
+
165
+ export declare const title3ClassName = "fui-Title3";
166
+
167
+ /**
168
+ * Create the state required to render Text.
169
+ *
170
+ * The returned state can be modified with hooks such as useTextStyles,
171
+ * before being passed to renderText.
172
+ *
173
+ * @param props - props from this instance of Text
174
+ * @param ref - reference to root HTMLElement of Text
175
+ */
176
+ export declare const useText: (props: TextProps, ref: React_2.Ref<HTMLElement>) => TextState;
177
+
178
+ /**
179
+ * Apply styling to the Text slots based on the state
180
+ */
181
+ export declare const useTextStyles: (state: TextState) => TextState;
182
+
183
+ export { }
package/lib/Body.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components/Body/index';
package/lib/Body.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Body/index';
2
+ //# sourceMappingURL=Body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Body.js","sourceRoot":"","sources":["../src/Body.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Caption/index';
package/lib/Caption.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Caption/index';
2
+ //# sourceMappingURL=Caption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Caption.js","sourceRoot":"","sources":["../src/Caption.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Display/index';
package/lib/Display.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Display/index';
2
+ //# sourceMappingURL=Display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Display.js","sourceRoot":"","sources":["../src/Display.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Headline/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/Headline/index';
2
+ //# sourceMappingURL=Headline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Headline.js","sourceRoot":"","sources":["../src/Headline.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/LargeTitle/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/LargeTitle/index';
2
+ //# sourceMappingURL=LargeTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LargeTitle.js","sourceRoot":"","sources":["../src/LargeTitle.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Subheadline/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/Subheadline/index';
2
+ //# sourceMappingURL=Subheadline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subheadline.js","sourceRoot":"","sources":["../src/Subheadline.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
package/lib/Text.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components/Text/index';
package/lib/Text.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Text/index';
2
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Title1/index';
package/lib/Title1.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Title1/index';
2
+ //# sourceMappingURL=Title1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Title1.js","sourceRoot":"","sources":["../src/Title1.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Title2/index';
package/lib/Title2.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Title2/index';
2
+ //# sourceMappingURL=Title2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Title2.js","sourceRoot":"","sources":["../src/Title2.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/Title3/index';
package/lib/Title3.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Title3/index';
2
+ //# sourceMappingURL=Title3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Title3.js","sourceRoot":"","sources":["../src/Title3.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IsConformantOptions } from '@fluentui/react-conformance';
2
+ export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
+ componentPath?: string;
4
+ }): void;
@@ -0,0 +1,16 @@
1
+ import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
2
+ import makeStylesTests from '@fluentui/react-conformance-make-styles';
3
+ export function isConformant(testInfo) {
4
+ const defaultOptions = {
5
+ asPropHandlesRef: true,
6
+ componentPath: module.parent.filename.replace('.test', ''),
7
+ extraTests: makeStylesTests,
8
+ testOptions: {
9
+ 'make-styles-overrides-win': {
10
+ callCount: 2
11
+ }
12
+ }
13
+ };
14
+ baseIsConformant(defaultOptions, testInfo);
15
+ }
16
+ //# sourceMappingURL=isConformant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,QAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE,eAH+C;AAI3D,IAAA,WAAW,EAAE;AACX,mCAA6B;AAC3B,QAAA,SAAS,EAAE;AADgB;AADlB;AAJ8C,GAA7D;AAaA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
@@ -0,0 +1,7 @@
1
+ import type { FunctionComponent } from 'react';
2
+ import { TextWrapperProps } from '../wrapper';
3
+ export declare const bodyClassName = "fui-Body";
4
+ /**
5
+ * Text wrapper component for the Body typography variant
6
+ */
7
+ export declare const Body: FunctionComponent<TextWrapperProps>;
@@ -0,0 +1,29 @@
1
+ import { __styles } from '@fluentui/react-make-styles';
2
+ import { typographyStyles } from '../../typographyStyles/index';
3
+ import { createWrapper } from '../wrapper';
4
+ export const bodyClassName = 'fui-Body';
5
+ /**
6
+ * Styles for the root slot
7
+ */
8
+
9
+ const useStyles = /*#__PURE__*/__styles({
10
+ "root": {
11
+ "Bahqtrf": "fk6fouc",
12
+ "Be2twd7": "fkhj508",
13
+ "Bg96gwp": "f1i3iumi",
14
+ "Bhrd7zp": "figsok6"
15
+ }
16
+ }, {
17
+ "d": [".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}"]
18
+ });
19
+ /**
20
+ * Text wrapper component for the Body typography variant
21
+ */
22
+
23
+
24
+ export const Body = /*#__PURE__*/createWrapper({
25
+ useStyles,
26
+ className: bodyClassName,
27
+ displayName: 'Body'
28
+ });
29
+ //# sourceMappingURL=Body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Body/Body.tsx"],"names":[],"mappings":"AACA,yBAA2B,6BAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,aAAa,GAAG,UAAtB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,IAAI,gBAAwC,aAAa,CAAC;AACrE,EAAA,SADqE;AAErE,EAAA,SAAS,EAAE,aAF0D;AAGrE,EAAA,WAAW,EAAE;AAHwD,CAAD,CAA/D","sourceRoot":""}
@@ -0,0 +1 @@
1
+ export * from './Body';
@@ -0,0 +1,2 @@
1
+ export * from './Body';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Body/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FunctionComponent } from 'react';
2
+ import { TextWrapperProps } from '../wrapper';
3
+ export declare const captionClassName = "fui-Caption";
4
+ /**
5
+ * Text wrapper component for the Caption typography variant
6
+ */
7
+ export declare const Caption: FunctionComponent<TextWrapperProps>;