@fluentui/react-text 0.0.0-nightlyca6ef2bc8e20220105.1 → 0.0.0-nightlyd45ba4664620220211.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.
- package/CHANGELOG.json +85 -20
- package/CHANGELOG.md +25 -10
- package/MIGRATION.md +153 -103
- package/dist/react-text.d.ts +8 -8
- package/lib/components/Body/Body.js +1 -1
- package/lib/components/Body/Body.js.map +1 -1
- package/lib/components/Caption/Caption.js +1 -1
- package/lib/components/Caption/Caption.js.map +1 -1
- package/lib/components/Display/Display.js +1 -1
- package/lib/components/Display/Display.js.map +1 -1
- package/lib/components/Headline/Headline.js +1 -1
- package/lib/components/Headline/Headline.js.map +1 -1
- package/lib/components/LargeTitle/LargeTitle.js +1 -1
- package/lib/components/LargeTitle/LargeTitle.js.map +1 -1
- package/lib/components/Subheadline/Subheadline.js +1 -1
- package/lib/components/Subheadline/Subheadline.js.map +1 -1
- package/lib/components/Text/Text.js +6 -6
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/Text/Text.types.d.ts +4 -3
- package/lib/components/Text/renderText.d.ts +1 -1
- package/lib/components/Text/renderText.js +1 -1
- package/lib/components/Text/renderText.js.map +1 -1
- package/lib/components/Text/useText.d.ts +3 -3
- package/lib/components/Text/useText.js +3 -3
- package/lib/components/Text/useText.js.map +1 -1
- package/lib/components/Text/useTextStyles.d.ts +1 -1
- package/lib/components/Text/useTextStyles.js +3 -2
- package/lib/components/Text/useTextStyles.js.map +1 -1
- package/lib/components/Title1/Title1.js +1 -1
- package/lib/components/Title1/Title1.js.map +1 -1
- package/lib/components/Title2/Title2.js +1 -1
- package/lib/components/Title2/Title2.js.map +1 -1
- package/lib/components/Title3/Title3.js +1 -1
- package/lib/components/Title3/Title3.js.map +1 -1
- package/lib/components/wrapper.js +5 -5
- package/lib/components/wrapper.js.map +1 -1
- package/lib/typographyStyles/typographyStyles.d.ts +10 -11
- package/lib/typographyStyles/typographyStyles.js +56 -54
- package/lib/typographyStyles/typographyStyles.js.map +1 -1
- package/lib-commonjs/components/Body/Body.js +2 -4
- package/lib-commonjs/components/Body/Body.js.map +1 -1
- package/lib-commonjs/components/Caption/Caption.js +2 -4
- package/lib-commonjs/components/Caption/Caption.js.map +1 -1
- package/lib-commonjs/components/Display/Display.js +2 -4
- package/lib-commonjs/components/Display/Display.js.map +1 -1
- package/lib-commonjs/components/Headline/Headline.js +2 -4
- package/lib-commonjs/components/Headline/Headline.js.map +1 -1
- package/lib-commonjs/components/LargeTitle/LargeTitle.js +2 -4
- package/lib-commonjs/components/LargeTitle/LargeTitle.js.map +1 -1
- package/lib-commonjs/components/Subheadline/Subheadline.js +2 -4
- package/lib-commonjs/components/Subheadline/Subheadline.js.map +1 -1
- package/lib-commonjs/components/Text/Text.js +3 -3
- package/lib-commonjs/components/Text/Text.js.map +1 -1
- package/lib-commonjs/components/Text/Text.types.d.ts +4 -3
- package/lib-commonjs/components/Text/renderText.d.ts +1 -1
- package/lib-commonjs/components/Text/renderText.js +3 -3
- package/lib-commonjs/components/Text/renderText.js.map +1 -1
- package/lib-commonjs/components/Text/useText.d.ts +3 -3
- package/lib-commonjs/components/Text/useText.js +5 -5
- package/lib-commonjs/components/Text/useText.js.map +1 -1
- package/lib-commonjs/components/Text/useTextStyles.d.ts +1 -1
- package/lib-commonjs/components/Text/useTextStyles.js +8 -6
- package/lib-commonjs/components/Text/useTextStyles.js.map +1 -1
- package/lib-commonjs/components/Title1/Title1.js +2 -4
- package/lib-commonjs/components/Title1/Title1.js.map +1 -1
- package/lib-commonjs/components/Title2/Title2.js +2 -4
- package/lib-commonjs/components/Title2/Title2.js.map +1 -1
- package/lib-commonjs/components/Title3/Title3.js +2 -4
- package/lib-commonjs/components/Title3/Title3.js.map +1 -1
- package/lib-commonjs/components/wrapper.js +5 -5
- package/lib-commonjs/components/wrapper.js.map +1 -1
- package/lib-commonjs/typographyStyles/typographyStyles.d.ts +10 -11
- package/lib-commonjs/typographyStyles/typographyStyles.js +56 -79
- package/lib-commonjs/typographyStyles/typographyStyles.js.map +1 -1
- package/package.json +6 -8
package/MIGRATION.md
CHANGED
@@ -44,7 +44,7 @@ _This property suffered no changes and can be left as is._
|
|
44
44
|
|
45
45
|
The `nowrap` property was changed to `wrap` and it is `true` by default. You can achieve the same result as `nowrap` by using:
|
46
46
|
|
47
|
-
```
|
47
|
+
```tsx
|
48
48
|
<Text wrap={false}>Not wrapped</Text>
|
49
49
|
```
|
50
50
|
|
@@ -69,7 +69,7 @@ Variants are now represented with tokens that you can override on a theme level.
|
|
69
69
|
|
70
70
|
You can use them with Text as such:
|
71
71
|
|
72
|
-
```
|
72
|
+
```tsx
|
73
73
|
<Text size={300}>Text</Text>
|
74
74
|
```
|
75
75
|
|
@@ -88,8 +88,10 @@ _This property suffered no changes and can be left as is._
|
|
88
88
|
|
89
89
|
To achieve the same result with the new `truncate` property, you'll need to do the following:
|
90
90
|
|
91
|
-
```
|
92
|
-
<Text block truncate wrap={false}>
|
91
|
+
```tsx
|
92
|
+
<Text block truncate wrap={false}>
|
93
|
+
Not wrapped
|
94
|
+
</Text>
|
93
95
|
```
|
94
96
|
|
95
97
|
This is due to `truncate` changing the CSS property `text-overflow` to `ellipsis`.
|
@@ -109,7 +111,7 @@ While the name remains the same, the values are now represented with integer tok
|
|
109
111
|
|
110
112
|
You can use them with Text as such:
|
111
113
|
|
112
|
-
```
|
114
|
+
```tsx
|
113
115
|
<Text size={300}>Text</Text>
|
114
116
|
```
|
115
117
|
|
@@ -129,18 +131,20 @@ Northstar design tokens:
|
|
129
131
|
|
130
132
|
- Color: `siteVariables.colors.brand[600]`
|
131
133
|
|
132
|
-
```
|
133
|
-
|
134
|
+
```tsx
|
135
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
136
|
+
|
137
|
+
const useStyles = makeStyles({
|
134
138
|
root: {
|
135
|
-
|
139
|
+
color: 'rgb(98, 100, 167)',
|
136
140
|
},
|
137
|
-
})
|
141
|
+
});
|
138
142
|
|
139
143
|
const MyComponent = () => {
|
140
|
-
|
144
|
+
const styles = useStyles();
|
141
145
|
|
142
|
-
|
143
|
-
}
|
146
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
147
|
+
};
|
144
148
|
```
|
145
149
|
|
146
150
|
##### **teamsDarkTheme**
|
@@ -149,18 +153,20 @@ Northstar design tokens:
|
|
149
153
|
|
150
154
|
- Color: `siteVariables.colors.brand[400]`
|
151
155
|
|
152
|
-
```
|
153
|
-
|
156
|
+
```tsx
|
157
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
158
|
+
|
159
|
+
const useStyles = makeStyles({
|
154
160
|
root: {
|
155
|
-
|
161
|
+
color: 'rgb(166, 167, 220)',
|
156
162
|
},
|
157
|
-
})
|
163
|
+
});
|
158
164
|
|
159
165
|
const MyComponent = () => {
|
160
|
-
|
166
|
+
const styles = useStyles();
|
161
167
|
|
162
|
-
|
163
|
-
}
|
168
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
169
|
+
};
|
164
170
|
```
|
165
171
|
|
166
172
|
##### **teamsHighContrastTheme**
|
@@ -169,18 +175,20 @@ Northstar design tokens:
|
|
169
175
|
|
170
176
|
- Color: `siteVariables.accessibleYellow`
|
171
177
|
|
172
|
-
```
|
173
|
-
|
178
|
+
```tsx
|
179
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
180
|
+
|
181
|
+
const useStyles = makeStyles({
|
174
182
|
root: {
|
175
|
-
|
183
|
+
color: 'rgb(255, 255, 1)',
|
176
184
|
},
|
177
|
-
})
|
185
|
+
});
|
178
186
|
|
179
187
|
const MyComponent = () => {
|
180
|
-
|
188
|
+
const styles = useStyles();
|
181
189
|
|
182
|
-
|
183
|
-
}
|
190
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
191
|
+
};
|
184
192
|
```
|
185
193
|
|
186
194
|
#### Using `atMention="me"`
|
@@ -192,19 +200,21 @@ Northstar design tokens:
|
|
192
200
|
- Color: `siteVariables.colors.orange[400]`
|
193
201
|
- Font weight: `siteVariables.fontWeightBold`
|
194
202
|
|
195
|
-
```
|
196
|
-
|
203
|
+
```tsx
|
204
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
205
|
+
|
206
|
+
const useStyles = makeStyles({
|
197
207
|
root: {
|
198
|
-
|
199
|
-
|
208
|
+
color: 'rgb(204, 74, 49)',
|
209
|
+
fontWeight: 700,
|
200
210
|
},
|
201
|
-
})
|
211
|
+
});
|
202
212
|
|
203
213
|
const MyComponent = () => {
|
204
|
-
|
214
|
+
const styles = useStyles();
|
205
215
|
|
206
|
-
|
207
|
-
}
|
216
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
217
|
+
};
|
208
218
|
```
|
209
219
|
|
210
220
|
##### **teamsDarkTheme**
|
@@ -214,19 +224,21 @@ Northstar design tokens:
|
|
214
224
|
- Color: `siteVariables.colors.orange[300]`
|
215
225
|
- Font weight: `siteVariables.fontWeightBold`
|
216
226
|
|
217
|
-
```
|
218
|
-
|
227
|
+
```tsx
|
228
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
229
|
+
|
230
|
+
const useStyles = makeStyles({
|
219
231
|
root: {
|
220
|
-
|
221
|
-
|
232
|
+
color: 'rgb(233, 117, 72)',
|
233
|
+
fontWeight: 700,
|
222
234
|
},
|
223
|
-
})
|
235
|
+
});
|
224
236
|
|
225
237
|
const MyComponent = () => {
|
226
|
-
|
238
|
+
const styles = useStyles();
|
227
239
|
|
228
|
-
|
229
|
-
}
|
240
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
241
|
+
};
|
230
242
|
```
|
231
243
|
|
232
244
|
##### **teamsHighContrastTheme**
|
@@ -236,37 +248,41 @@ Northstar design tokens:
|
|
236
248
|
- Color: `siteVariables.accessibleYellow`
|
237
249
|
- Font weight: `siteVariables.fontWeightBold`
|
238
250
|
|
239
|
-
```
|
240
|
-
|
251
|
+
```tsx
|
252
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
253
|
+
|
254
|
+
const useStyles = makeStyles({
|
241
255
|
root: {
|
242
|
-
|
243
|
-
|
256
|
+
color: 'rgb(255, 255, 1)',
|
257
|
+
fontWeight: 700,
|
244
258
|
},
|
245
|
-
})
|
259
|
+
});
|
246
260
|
|
247
261
|
const MyComponent = () => {
|
248
|
-
|
262
|
+
const styles = useStyles();
|
249
263
|
|
250
|
-
|
251
|
-
}
|
264
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
265
|
+
};
|
252
266
|
```
|
253
267
|
|
254
268
|
### color
|
255
269
|
|
256
270
|
This property was deprecated. Below is a simple example on how to achieve the same result:
|
257
271
|
|
258
|
-
```
|
259
|
-
|
272
|
+
```tsx
|
273
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
274
|
+
|
275
|
+
const useStyles = makeStyles({
|
260
276
|
root: {
|
261
|
-
color:
|
277
|
+
color: '__ put your color there __',
|
262
278
|
},
|
263
|
-
})
|
279
|
+
});
|
264
280
|
|
265
281
|
const MyComponent = () => {
|
266
|
-
|
282
|
+
const styles = useStyles();
|
267
283
|
|
268
|
-
|
269
|
-
}
|
284
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
285
|
+
};
|
270
286
|
```
|
271
287
|
|
272
288
|
_Read more about the CSS prop: [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color)_
|
@@ -276,13 +292,13 @@ _Read more about the CSS prop: [color](https://developer.mozilla.org/en-US/docs/
|
|
276
292
|
The `content` prop works the same way as the native `children` prop in React.
|
277
293
|
You can either use:
|
278
294
|
|
279
|
-
```
|
295
|
+
```tsx
|
280
296
|
<Text children="Hello World!" />
|
281
297
|
```
|
282
298
|
|
283
299
|
Or the common and recomended way:
|
284
300
|
|
285
|
-
```
|
301
|
+
```tsx
|
286
302
|
<Text>Hello World!</Text>
|
287
303
|
```
|
288
304
|
|
@@ -297,6 +313,8 @@ Northstar design tokens:
|
|
297
313
|
- Color: `siteVariables.colors.grey[250]`
|
298
314
|
|
299
315
|
```
|
316
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
317
|
+
|
300
318
|
const useStyles = makeStyles(theme => ({
|
301
319
|
root: {
|
302
320
|
color: 'rgb(200, 198, 196)'
|
@@ -317,6 +335,8 @@ Northstar design tokens:
|
|
317
335
|
- Color: `siteVariables.colors.grey[450]`
|
318
336
|
|
319
337
|
```
|
338
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
339
|
+
|
320
340
|
const useStyles = makeStyles(theme => ({
|
321
341
|
root: {
|
322
342
|
color: 'rgb(96, 94, 92)'
|
@@ -337,6 +357,8 @@ Northstar design tokens:
|
|
337
357
|
- Color: `siteVariables.accessibleGreen`
|
338
358
|
|
339
359
|
```
|
360
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
361
|
+
|
340
362
|
const useStyles = makeStyles(theme => ({
|
341
363
|
root: {
|
342
364
|
color: 'rgb(63, 242, 63)'
|
@@ -361,6 +383,8 @@ Northstar design tokens:
|
|
361
383
|
- Color: `siteVariables.colorScheme.red.foreground`
|
362
384
|
|
363
385
|
```
|
386
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
387
|
+
|
364
388
|
const useStyles = makeStyles(theme => ({
|
365
389
|
root: {
|
366
390
|
color: 'rgb(196, 49, 75)'
|
@@ -381,6 +405,8 @@ Northstar design tokens:
|
|
381
405
|
- Color: `siteVariables.colors.red[300]`
|
382
406
|
|
383
407
|
```
|
408
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
409
|
+
|
384
410
|
const useStyles = makeStyles(theme => ({
|
385
411
|
root: {
|
386
412
|
color: 'rgb(231, 53, 80)'
|
@@ -401,6 +427,8 @@ Northstar design tokens:
|
|
401
427
|
- Color: `siteVariables.red`
|
402
428
|
|
403
429
|
```
|
430
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
431
|
+
|
404
432
|
const useStyles = makeStyles(theme => ({
|
405
433
|
root: {
|
406
434
|
color: 'rgb(255, 0, 0)'
|
@@ -426,6 +454,8 @@ Northstar design tokens:
|
|
426
454
|
- Font weight: `siteVariables.fontWeightBold`
|
427
455
|
|
428
456
|
```
|
457
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
458
|
+
|
429
459
|
const useStyles = makeStyles(theme => ({
|
430
460
|
root: {
|
431
461
|
color: 'rgb(196, 49, 75)',
|
@@ -448,6 +478,8 @@ Northstar design tokens:
|
|
448
478
|
- Font weight: `siteVariables.fontWeightBold`
|
449
479
|
|
450
480
|
```
|
481
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
482
|
+
|
451
483
|
const useStyles = makeStyles(theme => ({
|
452
484
|
root: {
|
453
485
|
color: 'rgb(231, 53, 80)',
|
@@ -470,6 +502,8 @@ Northstar design tokens:
|
|
470
502
|
- Font weight: `siteVariables.fontWeightBold`
|
471
503
|
|
472
504
|
```
|
505
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
506
|
+
|
473
507
|
const useStyles = makeStyles(theme => ({
|
474
508
|
root: {
|
475
509
|
color: 'rgb(255, 0, 0)',
|
@@ -495,6 +529,8 @@ Northstar design tokens:
|
|
495
529
|
- Color: `siteVariables.colors.green[600]`
|
496
530
|
|
497
531
|
```
|
532
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
533
|
+
|
498
534
|
const useStyles = makeStyles(theme => ({
|
499
535
|
root: {
|
500
536
|
color: 'rgb(35, 123, 75)'
|
@@ -515,6 +551,8 @@ Northstar design tokens:
|
|
515
551
|
- Color: `siteVariables.colors.green[200]`
|
516
552
|
|
517
553
|
```
|
554
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
555
|
+
|
518
556
|
const useStyles = makeStyles(theme => ({
|
519
557
|
root: {
|
520
558
|
color: 'rgb(146, 195, 83)'
|
@@ -534,36 +572,40 @@ Northstar design tokens:
|
|
534
572
|
|
535
573
|
- Color: `siteVariables.colors.green[200]`
|
536
574
|
|
537
|
-
```
|
538
|
-
|
575
|
+
```tsx
|
576
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
577
|
+
|
578
|
+
const useStyles = makeStyles({
|
539
579
|
root: {
|
540
|
-
|
580
|
+
color: 'rgb(146, 195, 83)',
|
541
581
|
},
|
542
|
-
})
|
582
|
+
});
|
543
583
|
|
544
584
|
const MyComponent = () => {
|
545
|
-
|
585
|
+
const styles = useStyles();
|
546
586
|
|
547
|
-
|
548
|
-
}
|
587
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
588
|
+
};
|
549
589
|
```
|
550
590
|
|
551
591
|
### temporary [DEPRECATED]
|
552
592
|
|
553
593
|
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
554
594
|
|
555
|
-
```
|
556
|
-
|
595
|
+
```tsx
|
596
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
597
|
+
|
598
|
+
const useStyles = makeStyles({
|
557
599
|
root: {
|
558
|
-
|
600
|
+
fontStyle: 'italic',
|
559
601
|
},
|
560
|
-
})
|
602
|
+
});
|
561
603
|
|
562
604
|
const MyComponent = () => {
|
563
|
-
|
605
|
+
const styles = useStyles();
|
564
606
|
|
565
|
-
|
566
|
-
}
|
607
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
608
|
+
};
|
567
609
|
```
|
568
610
|
|
569
611
|
### timestamp [DEPRECATED]
|
@@ -576,18 +618,20 @@ Northstar design tokens:
|
|
576
618
|
|
577
619
|
- Color: `siteVariables.colorScheme.default.foreground1`
|
578
620
|
|
579
|
-
```
|
580
|
-
|
621
|
+
```tsx
|
622
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
623
|
+
|
624
|
+
const useStyles = makeStyles({
|
581
625
|
root: {
|
582
|
-
|
626
|
+
color: 'rgb(72, 70, 68)',
|
583
627
|
},
|
584
|
-
})
|
628
|
+
});
|
585
629
|
|
586
630
|
const MyComponent = () => {
|
587
|
-
|
631
|
+
const styles = useStyles();
|
588
632
|
|
589
|
-
|
590
|
-
}
|
633
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
634
|
+
};
|
591
635
|
```
|
592
636
|
|
593
637
|
#### **teamsDarkTheme**
|
@@ -596,18 +640,20 @@ Northstar design tokens:
|
|
596
640
|
|
597
641
|
- Color: `siteVariables.colorScheme.default.foreground1`
|
598
642
|
|
599
|
-
```
|
600
|
-
|
643
|
+
```tsx
|
644
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
645
|
+
|
646
|
+
const useStyles = makeStyles({
|
601
647
|
root: {
|
602
|
-
|
648
|
+
color: 'rgb(138, 136, 134)',
|
603
649
|
},
|
604
|
-
})
|
650
|
+
});
|
605
651
|
|
606
652
|
const MyComponent = () => {
|
607
|
-
|
653
|
+
const styles = useStyles();
|
608
654
|
|
609
|
-
|
610
|
-
}
|
655
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
656
|
+
};
|
611
657
|
```
|
612
658
|
|
613
659
|
#### **teamsHighContrastTheme**
|
@@ -616,23 +662,25 @@ Northstar design tokens:
|
|
616
662
|
|
617
663
|
- Color: `siteVariables.colors.white`
|
618
664
|
|
619
|
-
```
|
620
|
-
|
665
|
+
```tsx
|
666
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
667
|
+
|
668
|
+
const useStyles = makeStyles({
|
621
669
|
root: {
|
622
|
-
|
670
|
+
color: 'rgb(255, 255, 255)',
|
623
671
|
},
|
624
|
-
})
|
672
|
+
});
|
625
673
|
|
626
674
|
const MyComponent = () => {
|
627
|
-
|
675
|
+
const styles = useStyles();
|
628
676
|
|
629
|
-
|
630
|
-
}
|
677
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
678
|
+
};
|
631
679
|
```
|
632
680
|
|
633
681
|
### variables [DEPRECATED]
|
634
682
|
|
635
|
-
For v9, this feature is no longer supported. The alternative is to apply styles through `
|
683
|
+
For v9, this feature is no longer supported. The alternative is to apply styles through `makeStyles()` (see [Griffel](https://github.com/microsoft/griffel) docs for more details). Below is an example of a migration:
|
636
684
|
|
637
685
|
#### v0 (Northstar) implementation
|
638
686
|
|
@@ -644,18 +692,20 @@ const MyComponent = () => {
|
|
644
692
|
|
645
693
|
#### v9 (Fluent UI) implementation
|
646
694
|
|
647
|
-
```
|
648
|
-
|
695
|
+
```tsx
|
696
|
+
import { makeStyles, Text } from '@fluentui/react-components';
|
697
|
+
|
698
|
+
const useStyles = makeStyles({
|
649
699
|
red: {
|
650
|
-
|
700
|
+
color: 'red',
|
651
701
|
},
|
652
|
-
})
|
702
|
+
});
|
653
703
|
|
654
704
|
const MyComponent = () => {
|
655
|
-
|
705
|
+
const styles = useStyles();
|
656
706
|
|
657
|
-
|
658
|
-
}
|
707
|
+
return <Text className={styles.root}>{/* ... */}</Text>;
|
708
|
+
};
|
659
709
|
```
|
660
710
|
|
661
711
|
### weight
|
@@ -677,4 +727,4 @@ _This property suffered no changes and can be left as is._
|
|
677
727
|
|
678
728
|
### styles
|
679
729
|
|
680
|
-
_This property suffered no changes and can be used as is. However, we highly recommend that you migrate to
|
730
|
+
_This property suffered no changes and can be used as is. However, we highly recommend that you migrate to `makeStyles()` (a [Griffel](https://github.com/microsoft/griffel) styling solution) for performance reasons._
|
package/dist/react-text.d.ts
CHANGED
@@ -2,8 +2,8 @@ import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
3
3
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
4
4
|
import type { FunctionComponent } from 'react';
|
5
|
-
import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
6
5
|
import * as React_2 from 'react';
|
6
|
+
import type { Slot } from '@fluentui/react-utilities';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* Text wrapper component for the Body typography variant
|
@@ -44,7 +44,7 @@ export declare const largeTitleClassName = "fui-LargeTitle";
|
|
44
44
|
/**
|
45
45
|
* Render the final JSX of Text
|
46
46
|
*/
|
47
|
-
export declare const
|
47
|
+
export declare const renderText_unstable: (state: TextState) => JSX.Element;
|
48
48
|
|
49
49
|
/**
|
50
50
|
* Text wrapper component for the Subheadline typography variant
|
@@ -61,7 +61,7 @@ export { Text_2 as Text }
|
|
61
61
|
|
62
62
|
export declare const textClassName = "fui-Text";
|
63
63
|
|
64
|
-
|
64
|
+
declare type TextCommons = {
|
65
65
|
/**
|
66
66
|
* Wraps the text content on white spaces.
|
67
67
|
*
|
@@ -133,7 +133,7 @@ export declare type TextProps = ComponentProps<TextSlots> & Partial<TextCommons>
|
|
133
133
|
* Text slots
|
134
134
|
*/
|
135
135
|
export declare type TextSlots = {
|
136
|
-
root:
|
136
|
+
root: Slot<'span', 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'pre'>;
|
137
137
|
};
|
138
138
|
|
139
139
|
/**
|
@@ -167,17 +167,17 @@ export declare const title3ClassName = "fui-Title3";
|
|
167
167
|
/**
|
168
168
|
* Create the state required to render Text.
|
169
169
|
*
|
170
|
-
* The returned state can be modified with hooks such as
|
171
|
-
* before being passed to
|
170
|
+
* The returned state can be modified with hooks such as useTextStyles_unstable,
|
171
|
+
* before being passed to renderText_unstable.
|
172
172
|
*
|
173
173
|
* @param props - props from this instance of Text
|
174
174
|
* @param ref - reference to root HTMLElement of Text
|
175
175
|
*/
|
176
|
-
export declare const
|
176
|
+
export declare const useText_unstable: (props: TextProps, ref: React_2.Ref<HTMLElement>) => TextState;
|
177
177
|
|
178
178
|
/**
|
179
179
|
* Apply styling to the Text slots based on the state
|
180
180
|
*/
|
181
|
-
export declare const
|
181
|
+
export declare const useTextStyles_unstable: (state: TextState) => TextState;
|
182
182
|
|
183
183
|
export { }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Body/Body.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/Body/Body.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;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":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Caption/Caption.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/Caption/Caption.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,gBAAgB,GAAG,aAAzB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,OAAO,gBAAwC,aAAa,CAAC;AACxE,EAAA,SADwE;AAExE,EAAA,SAAS,EAAE,gBAF6D;AAGxE,EAAA,WAAW,EAAE;AAH2D,CAAD,CAAlE","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Display/Display.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/Display/Display.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,gBAAgB,GAAG,aAAzB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,OAAO,gBAAwC,aAAa,CAAC;AACxE,EAAA,SADwE;AAExE,EAAA,SAAS,EAAE,gBAF6D;AAGxE,EAAA,WAAW,EAAE;AAH2D,CAAD,CAAlE","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Headline/Headline.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/Headline/Headline.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,iBAAiB,GAAG,cAA1B;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,QAAQ,gBAAwC,aAAa,CAAC;AACzE,EAAA,SADyE;AAEzE,EAAA,SAAS,EAAE,iBAF8D;AAGzE,EAAA,WAAW,EAAE;AAH4D,CAAD,CAAnE","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/LargeTitle/LargeTitle.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/LargeTitle/LargeTitle.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,mBAAmB,GAAG,gBAA5B;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,UAAU,gBAAwC,aAAa,CAAC;AAC3E,EAAA,SAD2E;AAE3E,EAAA,SAAS,EAAE,mBAFgE;AAG3E,EAAA,WAAW,EAAE;AAH8D,CAAD,CAArE","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Subheadline/Subheadline.tsx"],"names":[],"mappings":"AACA,yBAA2B,
|
1
|
+
{"version":3,"sources":["../../../src/components/Subheadline/Subheadline.tsx"],"names":[],"mappings":"AACA,yBAA2B,gBAA3B;AACA,SAAS,gBAAT,QAAiC,8BAAjC;AACA,SAAS,aAAT,QAAgD,YAAhD;AAEA,OAAO,MAAM,oBAAoB,GAAG,iBAA7B;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAIA;;AAEG;;;AACH,OAAO,MAAM,WAAW,gBAAwC,aAAa,CAAC;AAC5E,EAAA,SAD4E;AAE5E,EAAA,SAAS,EAAE,oBAFiE;AAG5E,EAAA,WAAW,EAAE;AAH+D,CAAD,CAAtE","sourceRoot":""}
|