@fluentui/react-text 9.1.2 → 9.1.4

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 (84) hide show
  1. package/CHANGELOG.json +63 -1
  2. package/CHANGELOG.md +24 -2
  3. package/README.md +2 -4
  4. package/lib/Body1.js.map +1 -1
  5. package/lib/Caption1.js.map +1 -1
  6. package/lib/Caption2.js.map +1 -1
  7. package/lib/Display.js.map +1 -1
  8. package/lib/LargeTitle.js.map +1 -1
  9. package/lib/Subtitle1.js.map +1 -1
  10. package/lib/Subtitle2.js.map +1 -1
  11. package/lib/Text.js.map +1 -1
  12. package/lib/Title1.js.map +1 -1
  13. package/lib/Title2.js.map +1 -1
  14. package/lib/Title3.js.map +1 -1
  15. package/lib/components/Body1/Body1.js.map +1 -1
  16. package/lib/components/Body1/index.js.map +1 -1
  17. package/lib/components/Caption1/Caption1.js.map +1 -1
  18. package/lib/components/Caption1/index.js.map +1 -1
  19. package/lib/components/Caption2/Caption2.js.map +1 -1
  20. package/lib/components/Caption2/index.js.map +1 -1
  21. package/lib/components/Display/Display.js.map +1 -1
  22. package/lib/components/Display/index.js.map +1 -1
  23. package/lib/components/LargeTitle/LargeTitle.js.map +1 -1
  24. package/lib/components/LargeTitle/index.js.map +1 -1
  25. package/lib/components/Subtitle1/Subtitle1.js.map +1 -1
  26. package/lib/components/Subtitle1/index.js.map +1 -1
  27. package/lib/components/Subtitle2/Subtitle2.js.map +1 -1
  28. package/lib/components/Subtitle2/index.js.map +1 -1
  29. package/lib/components/Text/Text.js.map +1 -1
  30. package/lib/components/Text/Text.types.js.map +1 -1
  31. package/lib/components/Text/index.js.map +1 -1
  32. package/lib/components/Text/renderText.js.map +1 -1
  33. package/lib/components/Text/useText.js.map +1 -1
  34. package/lib/components/Text/useTextStyles.js.map +1 -1
  35. package/lib/components/Title1/Title1.js.map +1 -1
  36. package/lib/components/Title1/index.js.map +1 -1
  37. package/lib/components/Title2/Title2.js.map +1 -1
  38. package/lib/components/Title2/index.js.map +1 -1
  39. package/lib/components/Title3/Title3.js.map +1 -1
  40. package/lib/components/Title3/index.js.map +1 -1
  41. package/lib/components/wrapper.js.map +1 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib-commonjs/Body1.js.map +1 -1
  44. package/lib-commonjs/Caption1.js.map +1 -1
  45. package/lib-commonjs/Caption2.js.map +1 -1
  46. package/lib-commonjs/Display.js.map +1 -1
  47. package/lib-commonjs/LargeTitle.js.map +1 -1
  48. package/lib-commonjs/Subtitle1.js.map +1 -1
  49. package/lib-commonjs/Subtitle2.js.map +1 -1
  50. package/lib-commonjs/Text.js.map +1 -1
  51. package/lib-commonjs/Title1.js.map +1 -1
  52. package/lib-commonjs/Title2.js.map +1 -1
  53. package/lib-commonjs/Title3.js.map +1 -1
  54. package/lib-commonjs/components/Body1/Body1.js.map +1 -1
  55. package/lib-commonjs/components/Body1/index.js.map +1 -1
  56. package/lib-commonjs/components/Caption1/Caption1.js.map +1 -1
  57. package/lib-commonjs/components/Caption1/index.js.map +1 -1
  58. package/lib-commonjs/components/Caption2/Caption2.js.map +1 -1
  59. package/lib-commonjs/components/Caption2/index.js.map +1 -1
  60. package/lib-commonjs/components/Display/Display.js.map +1 -1
  61. package/lib-commonjs/components/Display/index.js.map +1 -1
  62. package/lib-commonjs/components/LargeTitle/LargeTitle.js.map +1 -1
  63. package/lib-commonjs/components/LargeTitle/index.js.map +1 -1
  64. package/lib-commonjs/components/Subtitle1/Subtitle1.js.map +1 -1
  65. package/lib-commonjs/components/Subtitle1/index.js.map +1 -1
  66. package/lib-commonjs/components/Subtitle2/Subtitle2.js.map +1 -1
  67. package/lib-commonjs/components/Subtitle2/index.js.map +1 -1
  68. package/lib-commonjs/components/Text/Text.js.map +1 -1
  69. package/lib-commonjs/components/Text/index.js.map +1 -1
  70. package/lib-commonjs/components/Text/renderText.js.map +1 -1
  71. package/lib-commonjs/components/Text/useText.js.map +1 -1
  72. package/lib-commonjs/components/Text/useTextStyles.js.map +1 -1
  73. package/lib-commonjs/components/Title1/Title1.js.map +1 -1
  74. package/lib-commonjs/components/Title1/index.js.map +1 -1
  75. package/lib-commonjs/components/Title2/Title2.js.map +1 -1
  76. package/lib-commonjs/components/Title2/index.js.map +1 -1
  77. package/lib-commonjs/components/Title3/Title3.js.map +1 -1
  78. package/lib-commonjs/components/Title3/index.js.map +1 -1
  79. package/lib-commonjs/components/wrapper.js.map +1 -1
  80. package/lib-commonjs/index.js.map +1 -1
  81. package/package.json +15 -15
  82. package/MIGRATION.md +0 -730
  83. package/Spec.md +0 -162
  84. package/assets/typography-examples.gif +0 -0
package/Spec.md DELETED
@@ -1,162 +0,0 @@
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