@fluentui/web-components 3.0.0-alpha.1 → 3.0.0-alpha.2

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 (93) hide show
  1. package/.eslintrc.json +62 -0
  2. package/CHANGELOG.json +68 -9
  3. package/CHANGELOG.md +14 -2
  4. package/build/{clean.js → clean.cjs} +0 -0
  5. package/dist/dts/badge/badge.d.ts +49 -0
  6. package/dist/dts/badge/badge.definition.d.ts +11 -0
  7. package/dist/dts/badge/badge.options.d.ts +73 -0
  8. package/dist/dts/badge/badge.stories.d.ts +12 -0
  9. package/dist/dts/badge/badge.styles.d.ts +4 -0
  10. package/dist/dts/badge/badge.template.d.ts +9 -0
  11. package/dist/dts/badge/define.d.ts +1 -0
  12. package/dist/dts/badge/index.d.ts +5 -0
  13. package/dist/dts/counter-badge/counter-badge.d.ts +90 -0
  14. package/dist/dts/counter-badge/counter-badge.definition.d.ts +11 -0
  15. package/dist/dts/counter-badge/counter-badge.options.d.ts +69 -0
  16. package/dist/dts/counter-badge/counter-badge.stories.d.ts +14 -0
  17. package/dist/dts/counter-badge/counter-badge.styles.d.ts +4 -0
  18. package/dist/dts/counter-badge/counter-badge.template.d.ts +7 -0
  19. package/dist/dts/counter-badge/define.d.ts +1 -0
  20. package/dist/dts/counter-badge/index.d.ts +5 -0
  21. package/dist/dts/fluent-design-system.d.ts +5 -0
  22. package/dist/dts/index-rollup.d.ts +1 -1
  23. package/dist/dts/index.d.ts +5 -1
  24. package/dist/dts/progress-bar/define.d.ts +1 -0
  25. package/dist/dts/progress-bar/index.d.ts +5 -0
  26. package/dist/dts/progress-bar/progress-bar.d.ts +30 -0
  27. package/dist/dts/progress-bar/progress-bar.definition.d.ts +10 -0
  28. package/dist/dts/progress-bar/progress-bar.options.d.ts +41 -0
  29. package/dist/dts/progress-bar/progress-bar.stories.d.ts +9 -0
  30. package/dist/dts/progress-bar/progress-bar.styles.d.ts +4 -0
  31. package/dist/dts/progress-bar/progress-bar.template.d.ts +3 -0
  32. package/dist/dts/styles/index.d.ts +1 -0
  33. package/dist/dts/styles/partials/badge.partials.d.ts +28 -0
  34. package/dist/dts/styles/partials/index.d.ts +1 -0
  35. package/dist/dts/text/define.d.ts +1 -0
  36. package/dist/dts/text/index.d.ts +5 -0
  37. package/dist/dts/text/text.d.ts +91 -0
  38. package/dist/dts/text/text.definition.d.ts +10 -0
  39. package/dist/dts/text/text.options.d.ts +67 -0
  40. package/dist/dts/text/text.stories.d.ts +8 -0
  41. package/dist/dts/text/text.styles.d.ts +4 -0
  42. package/dist/dts/text/text.template.d.ts +6 -0
  43. package/dist/dts/theme/index.d.ts +2 -2
  44. package/dist/esm/badge/badge.definition.js +18 -0
  45. package/dist/esm/badge/badge.js +42 -0
  46. package/dist/esm/badge/badge.options.js +45 -0
  47. package/dist/esm/badge/badge.stories.js +108 -0
  48. package/dist/esm/badge/badge.styles.js +29 -0
  49. package/dist/esm/badge/badge.template.js +14 -0
  50. package/dist/esm/badge/define.js +3 -0
  51. package/dist/esm/badge/index.js +5 -0
  52. package/dist/esm/counter-badge/counter-badge.definition.js +18 -0
  53. package/dist/esm/counter-badge/counter-badge.js +89 -0
  54. package/dist/esm/counter-badge/counter-badge.options.js +42 -0
  55. package/dist/esm/counter-badge/counter-badge.stories.js +102 -0
  56. package/dist/esm/counter-badge/counter-badge.styles.js +30 -0
  57. package/dist/esm/counter-badge/counter-badge.template.js +12 -0
  58. package/dist/esm/counter-badge/define.js +3 -0
  59. package/dist/esm/counter-badge/index.js +5 -0
  60. package/dist/esm/fluent-design-system.js +5 -0
  61. package/dist/esm/index-rollup.js +1 -1
  62. package/dist/esm/index.js +5 -1
  63. package/dist/esm/progress-bar/define.js +3 -0
  64. package/dist/esm/progress-bar/index.js +5 -0
  65. package/dist/esm/progress-bar/progress-bar.definition.js +17 -0
  66. package/dist/esm/progress-bar/progress-bar.js +18 -0
  67. package/dist/esm/progress-bar/progress-bar.options.js +25 -0
  68. package/dist/esm/progress-bar/progress-bar.stories.js +60 -0
  69. package/dist/esm/progress-bar/progress-bar.styles.js +155 -0
  70. package/dist/esm/progress-bar/progress-bar.template.js +5 -0
  71. package/dist/esm/styles/index.js +1 -0
  72. package/dist/esm/styles/partials/badge.partials.js +272 -0
  73. package/dist/esm/styles/partials/index.js +1 -0
  74. package/dist/esm/text/define.js +3 -0
  75. package/dist/esm/text/index.js +5 -0
  76. package/dist/esm/text/text.definition.js +17 -0
  77. package/dist/esm/text/text.js +91 -0
  78. package/dist/esm/text/text.options.js +45 -0
  79. package/dist/esm/text/text.stories.js +111 -0
  80. package/dist/esm/text/text.styles.js +104 -0
  81. package/dist/esm/text/text.template.js +5 -0
  82. package/dist/esm/theme/index.js +2 -2
  83. package/dist/esm/theme/set-theme.js +1 -1
  84. package/dist/esm/theme/theme.stories.js +1 -1
  85. package/dist/fluent-web-components.api.json +14015 -8
  86. package/dist/tsdoc-metadata.json +1 -1
  87. package/dist/web-components.d.ts +1385 -1
  88. package/dist/web-components.js +6694 -2
  89. package/dist/web-components.min.js +284 -1
  90. package/docs/api-report.md +1432 -1
  91. package/package.json +42 -14
  92. package/rollup.config.js +5 -0
  93. package/karma.conf.js +0 -147
@@ -0,0 +1,272 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { borderRadiusCircular, colorBrandBackground, colorBrandBackground2, colorBrandForeground1, colorBrandForeground2, colorBrandStroke2, colorNeutralBackground1, colorNeutralBackground4, colorNeutralBackground5, colorNeutralForeground1, colorNeutralForeground3, colorNeutralForegroundInverted, colorNeutralForegroundOnBrand, colorNeutralForegroundStaticInverted, colorNeutralStroke2, colorNeutralStrokeAccessible, colorPaletteDarkOrangeBackground1, colorPaletteDarkOrangeBackground3, colorPaletteDarkOrangeBorder1, colorPaletteDarkOrangeForeground1, colorPaletteDarkOrangeForeground3, colorPaletteGreenBackground1, colorPaletteGreenBackground3, colorPaletteGreenBorder2, colorPaletteGreenForeground1, colorPaletteGreenForeground2, colorPaletteGreenForeground3, colorPaletteRedBackground1, colorPaletteRedBackground3, colorPaletteRedBorder1, colorPaletteRedForeground1, colorPaletteRedForeground3, colorPaletteYellowBackground1, colorPaletteYellowBackground3, colorPaletteYellowBorder1, colorPaletteYellowForeground2, colorTransparentStroke, fontFamilyBase, fontSizeBase100, fontSizeBase200, fontWeightSemibold, lineHeightBase100, lineHeightBase200, spacingHorizontalSNudge, spacingHorizontalXS, spacingHorizontalXXS, strokeWidthThin, } from '../../theme/design-tokens.js';
4
+ const textPadding = spacingHorizontalXXS;
5
+ export const badgeBaseStyles = css.partial `
6
+ ${display('inline-flex')} :host {
7
+ position: relative;
8
+ box-sizing: border-box;
9
+ align-items: center;
10
+ justify-content: center;
11
+ font-family: ${fontFamilyBase};
12
+ font-weight: ${fontWeightSemibold};
13
+ font-size: ${fontSizeBase200};
14
+ line-height: ${lineHeightBase200};
15
+ min-width: 20px;
16
+ height: 20px;
17
+ padding-inline: calc(${spacingHorizontalXS} + ${textPadding});
18
+ border-radius: ${borderRadiusCircular};
19
+ border-color: ${colorTransparentStroke};
20
+ background-color: ${colorBrandBackground};
21
+ color: ${colorNeutralForegroundOnBrand};
22
+ }
23
+
24
+ ::slotted(svg) {
25
+ font-size: 12px;
26
+ }
27
+
28
+ :host(:not([appearance='ghost']))::after {
29
+ position: absolute;
30
+ content: '';
31
+ top: 0;
32
+ left: 0;
33
+ bottom: 0;
34
+ right: 0;
35
+ border-style: solid;
36
+ border-width: ${strokeWidthThin};
37
+ border-color: inherit;
38
+ border-radius: inherit;
39
+ }
40
+ `;
41
+ /**
42
+ * @public
43
+ * The badge's size styles
44
+ */
45
+ export const badgeSizeStyles = css.partial `
46
+ :host([size='tiny']) {
47
+ width: 6px;
48
+ height: 6px;
49
+ font-size: 4px;
50
+ line-height: 4px;
51
+ padding-inline: 0;
52
+ min-width: unset;
53
+ }
54
+ :host([size='tiny']) ::slotted(svg) {
55
+ font-size: 6px;
56
+ }
57
+ :host([size='extra-small']) {
58
+ width: 10px;
59
+ height: 10px;
60
+ font-size: 6px;
61
+ line-height: 6px;
62
+ padding-inline: 0;
63
+ min-width: unset;
64
+ }
65
+ :host([size='extra-small']) ::slotted(svg) {
66
+ font-size: 10px;
67
+ }
68
+ :host([size='small']) {
69
+ min-width: 16px;
70
+ height: 16px;
71
+ font-size: ${fontSizeBase100};
72
+ line-height: ${lineHeightBase100};
73
+ padding-inline: calc(${spacingHorizontalXXS} + ${textPadding});
74
+ }
75
+ :host([size='small']) ::slotted(svg) {
76
+ font-size: 12px;
77
+ }
78
+ :host([size='large']) {
79
+ min-width: 24px;
80
+ height: 24px;
81
+ font-size: ${fontSizeBase200};
82
+ line-height: ${lineHeightBase200};
83
+ padding-inline: calc(${spacingHorizontalXS} + ${textPadding});
84
+ }
85
+ :host([size='large']) ::slotted(svg) {
86
+ font-size: 16px;
87
+ }
88
+ :host([size='extra-large']) {
89
+ min-width: 32px;
90
+ height: 32px;
91
+ font-size: ${fontSizeBase200};
92
+ line-height: ${lineHeightBase200};
93
+ padding-inline: calc(${spacingHorizontalSNudge} + ${textPadding});
94
+ }
95
+ :host([size='extra-large']) ::slotted(svg) {
96
+ font-size: 20px;
97
+ }
98
+ `;
99
+ /**
100
+ * The badge's `filled` appearance styles
101
+ * Filled appearance is default so do not
102
+ * Include that attribute as it's not present by default
103
+ * @public
104
+ */
105
+ export const badgeFilledStyles = css.partial `
106
+ :host([color='danger']) {
107
+ background-color: ${colorPaletteRedBackground3};
108
+ color: ${colorNeutralForegroundOnBrand};
109
+ }
110
+
111
+ :host([color='important']) {
112
+ background-color: ${colorNeutralForeground1};
113
+ color: ${colorNeutralBackground1};
114
+ }
115
+
116
+ :host([color='informative']) {
117
+ background-color: ${colorNeutralBackground5};
118
+ color: ${colorNeutralForeground3};
119
+ }
120
+
121
+ :host([color='severe']) {
122
+ background-color: ${colorPaletteDarkOrangeBackground3};
123
+ color: ${colorNeutralForegroundOnBrand};
124
+ }
125
+
126
+ :host([color='subtle']) {
127
+ background-color: ${colorNeutralBackground1};
128
+ color: ${colorNeutralForeground1};
129
+ }
130
+
131
+ :host([color='success']) {
132
+ background-color: ${colorPaletteGreenBackground3};
133
+ color: ${colorNeutralForegroundOnBrand};
134
+ }
135
+
136
+ :host([color='warning']) {
137
+ background-color: ${colorPaletteYellowBackground3};
138
+ color: ${colorNeutralForeground1};
139
+ }
140
+ `;
141
+ /**
142
+ * The badge's `ghost` appearance styles
143
+ * @public
144
+ */
145
+ export const badgeGhostStyles = css.partial `
146
+ :host([appearance='ghost']) {
147
+ color: ${colorBrandBackground};
148
+ background-color: initial;
149
+ }
150
+
151
+ :host([appearance='ghost'][color='danger']) {
152
+ color: ${colorPaletteRedForeground3};
153
+ }
154
+
155
+ :host([appearance='ghost'][color='important']) {
156
+ color: ${colorNeutralForeground1};
157
+ }
158
+
159
+ :host([appearance='ghost'][color='informative']) {
160
+ color: ${colorNeutralForeground3};
161
+ }
162
+
163
+ :host([appearance='ghost'][color='severe']) {
164
+ color: ${colorPaletteDarkOrangeForeground3};
165
+ }
166
+
167
+ :host([appearance='ghost'][color='subtle']) {
168
+ color: ${colorNeutralForegroundInverted};
169
+ }
170
+
171
+ :host([appearance='ghost'][color='success']) {
172
+ color: ${colorPaletteGreenForeground3};
173
+ }
174
+
175
+ :host([appearance='ghost'][color='warning']) {
176
+ color: ${colorPaletteYellowForeground2};
177
+ }
178
+ `;
179
+ /**
180
+ * The badge's `outline` appearance styles
181
+ * @public
182
+ */
183
+ export const badgeOutlineStyles = css.partial `
184
+ :host([appearance='outline']) {
185
+ border-color: currentColor;
186
+ color: ${colorBrandForeground1};
187
+ background-color: initial;
188
+ }
189
+
190
+ :host([appearance='outline'][color='danger']) {
191
+ color: ${colorPaletteRedForeground3};
192
+ }
193
+
194
+ :host([appearance='outline'][color='important']) {
195
+ color: ${colorNeutralForeground3};
196
+ border-color: ${colorNeutralStrokeAccessible};
197
+ }
198
+
199
+ :host([appearance='outline'][color='informative']) {
200
+ color: ${colorNeutralForeground3};
201
+ border-color: ${colorNeutralStroke2};
202
+ }
203
+
204
+ :host([appearance='outline'][color='severe']) {
205
+ color: ${colorPaletteDarkOrangeForeground3};
206
+ }
207
+
208
+ :host([appearance='outline'][color='subtle']) {
209
+ color: ${colorNeutralForegroundStaticInverted};
210
+ }
211
+
212
+ :host([appearance='outline'][color='success']) {
213
+ color: ${colorPaletteGreenForeground2};
214
+ }
215
+
216
+ :host([appearance='outline'][color='warning']) {
217
+ color: ${colorPaletteYellowForeground2};
218
+ }
219
+ `;
220
+ /**
221
+ * The badge's `tint` appearance styles
222
+ * @public
223
+ */
224
+ export const badgeTintStyles = css.partial `
225
+ :host([appearance='tint']) {
226
+ background-color: ${colorBrandBackground2};
227
+ color: ${colorBrandForeground2};
228
+ border-color: ${colorBrandStroke2};
229
+ }
230
+
231
+ :host([appearance='tint'][color='danger']) {
232
+ background-color: ${colorPaletteRedBackground1};
233
+ color: ${colorPaletteRedForeground1};
234
+ border-color: ${colorPaletteRedBorder1};
235
+ }
236
+
237
+ :host([appearance='tint'][color='important']) {
238
+ background-color: ${colorNeutralForeground3};
239
+ color: ${colorNeutralBackground1};
240
+ border-color: ${colorTransparentStroke};
241
+ }
242
+
243
+ :host([appearance='tint'][color='informative']) {
244
+ background-color: ${colorNeutralBackground4};
245
+ color: ${colorNeutralForeground3};
246
+ border-color: ${colorNeutralStroke2};
247
+ }
248
+
249
+ :host([appearance='tint'][color='severe']) {
250
+ background-color: ${colorPaletteDarkOrangeBackground1};
251
+ color: ${colorPaletteDarkOrangeForeground1};
252
+ border-color: ${colorPaletteDarkOrangeBorder1};
253
+ }
254
+
255
+ :host([appearance='tint'][color='subtle']) {
256
+ background-color: ${colorNeutralBackground1};
257
+ color: ${colorNeutralForeground3};
258
+ border-color: ${colorNeutralStroke2};
259
+ }
260
+
261
+ :host([appearance='tint'][color='success']) {
262
+ background-color: ${colorPaletteGreenBackground1};
263
+ color: ${colorPaletteGreenForeground1};
264
+ border-color: ${colorPaletteGreenBorder2};
265
+ }
266
+
267
+ :host([appearance='tint'][color='warning']) {
268
+ background-color: ${colorPaletteYellowBackground1};
269
+ color: ${colorPaletteYellowForeground2};
270
+ border-color: ${colorPaletteYellowBorder1};
271
+ }
272
+ `;
@@ -0,0 +1 @@
1
+ export * from './badge.partials.js';
@@ -0,0 +1,3 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { definition } from './text.definition.js';
3
+ definition.define(FluentDesignSystem.registry);
@@ -0,0 +1,5 @@
1
+ export * from './text.js';
2
+ export * from './text.options.js';
3
+ export { template as TextTemplate } from './text.template.js';
4
+ export { styles as TextStyles } from './text.styles.js';
5
+ export { definition as TextDefinition } from './text.definition.js';
@@ -0,0 +1,17 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { Text } from './text.js';
3
+ import { styles } from './text.styles.js';
4
+ import { template } from './text.template.js';
5
+ /**
6
+ * The Fluent Text Element.
7
+ *
8
+ *
9
+ * @public
10
+ * @remarks
11
+ * HTML Element: \<fluent-text\>
12
+ */
13
+ export const definition = Text.compose({
14
+ name: `${FluentDesignSystem.prefix}-text`,
15
+ template,
16
+ styles,
17
+ });
@@ -0,0 +1,91 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, FASTElement } from '@microsoft/fast-element';
3
+ /**
4
+ * The base class used for constructing a fluent-text custom element
5
+ * @public
6
+ */
7
+ export class Text extends FASTElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ /**
11
+ * The text will not wrap
12
+ * NOTE: In Fluent UI React v9 this is "wrap"
13
+ * Boolean attributes which default to true in HTML can't be switched off in the DOM
14
+ *
15
+ * @public
16
+ * @remarks
17
+ * HTML Attribute: nowrap
18
+ */
19
+ this.nowrap = false;
20
+ /**
21
+ * The text truncates
22
+ *
23
+ * @public
24
+ * @remarks
25
+ * HTML Attribute: truncate
26
+ */
27
+ this.truncate = false;
28
+ /**
29
+ * The text style is italic
30
+ *
31
+ * @public
32
+ * @remarks
33
+ * HTML Attribute: italic
34
+ */
35
+ this.italic = false;
36
+ /**
37
+ * The text style is underline
38
+ *
39
+ * @public
40
+ * @remarks
41
+ * HTML Attribute: underline
42
+ */
43
+ this.underline = false;
44
+ /**
45
+ * The text style is strikethrough
46
+ *
47
+ * @public
48
+ * @remarks
49
+ * HTML Attribute: strikethrough
50
+ */
51
+ this.strikethrough = false;
52
+ /**
53
+ * An text can take up the width of its container.
54
+ *
55
+ * @public
56
+ * @remarks
57
+ * HTML Attribute: block
58
+ */
59
+ this.block = false;
60
+ }
61
+ }
62
+ __decorate([
63
+ attr({ mode: 'boolean' })
64
+ ], Text.prototype, "nowrap", void 0);
65
+ __decorate([
66
+ attr({ mode: 'boolean' })
67
+ ], Text.prototype, "truncate", void 0);
68
+ __decorate([
69
+ attr({ mode: 'boolean' })
70
+ ], Text.prototype, "italic", void 0);
71
+ __decorate([
72
+ attr({ mode: 'boolean' })
73
+ ], Text.prototype, "underline", void 0);
74
+ __decorate([
75
+ attr({ mode: 'boolean' })
76
+ ], Text.prototype, "strikethrough", void 0);
77
+ __decorate([
78
+ attr({ mode: 'boolean' })
79
+ ], Text.prototype, "block", void 0);
80
+ __decorate([
81
+ attr
82
+ ], Text.prototype, "size", void 0);
83
+ __decorate([
84
+ attr
85
+ ], Text.prototype, "font", void 0);
86
+ __decorate([
87
+ attr
88
+ ], Text.prototype, "weight", void 0);
89
+ __decorate([
90
+ attr
91
+ ], Text.prototype, "align", void 0);
@@ -0,0 +1,45 @@
1
+ /**
2
+ * TextSize constants
3
+ * @public
4
+ */
5
+ export const TextSize = {
6
+ _100: '100',
7
+ _200: '200',
8
+ _300: '300',
9
+ _400: '400',
10
+ _500: '500',
11
+ _600: '600',
12
+ _700: '700',
13
+ _800: '800',
14
+ _900: '900',
15
+ _1000: '1000',
16
+ };
17
+ /**
18
+ * TextFont Constants
19
+ * @public
20
+ */
21
+ export const TextFont = {
22
+ base: 'base',
23
+ numeric: 'numeric',
24
+ monospace: 'monospace',
25
+ };
26
+ /**
27
+ * TextWeight Constants
28
+ * @public
29
+ */
30
+ export const TextWeight = {
31
+ medium: 'medium',
32
+ regular: 'regular',
33
+ semibold: 'semibold',
34
+ bold: 'bold',
35
+ };
36
+ /**
37
+ * TextAlign Constants
38
+ * @public
39
+ */
40
+ export const TextAlign = {
41
+ start: 'start',
42
+ end: 'end',
43
+ center: 'center',
44
+ justify: 'justify',
45
+ };
@@ -0,0 +1,111 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ import { renderComponent } from '../__test__/helpers.js';
3
+ import './define.js';
4
+ import { TextAlign, TextFont, TextSize, TextWeight } from './text.options.js';
5
+ /**
6
+ * Used to generate slotted content for stories
7
+ * @param as - the element to generate
8
+ * @param content - the content for the element
9
+ * @returns ViewTemplate
10
+ */
11
+ const generateSemanticElementTemplate = (as, content) => {
12
+ switch (as) {
13
+ case 'h1':
14
+ return html `<h1>${content}</h1>`;
15
+ case 'h2':
16
+ return html `<h2>${content}</h2>`;
17
+ case 'h3':
18
+ return html `<h3>${content}</h3>`;
19
+ case 'h4':
20
+ return html `<h4>${content}</h4>`;
21
+ case 'h5':
22
+ return html `<h5>${content}</h5>`;
23
+ case 'h6':
24
+ return html `<h6>${content}</h6>`;
25
+ case 'p':
26
+ return html `<p>${content}</p>`;
27
+ case 'pre':
28
+ return html `<pre>${content}</pre>`;
29
+ case 'span':
30
+ default:
31
+ return html `<span>${content}</span>`;
32
+ }
33
+ };
34
+ const storyTemplate = html `
35
+ <fluent-text
36
+ align=${x => x.align}
37
+ font=${x => x.font}
38
+ size=${x => x.size}
39
+ weight=${x => x.weight}
40
+ ?nowrap=${x => x.nowrap}
41
+ ?truncate=${x => x.truncate}
42
+ ?italic=${x => x.italic}
43
+ ?underline=${x => x.underline}
44
+ ?strikethrough=${x => x.strikethrough}
45
+ ?block=${x => x.block}
46
+ >${x => generateSemanticElementTemplate(x.as, x.content)}</fluent-text
47
+ >
48
+ `;
49
+ export default {
50
+ title: 'Components/Text',
51
+ args: {
52
+ content: 'Text',
53
+ nowrap: false,
54
+ truncate: false,
55
+ italic: false,
56
+ underline: false,
57
+ strikethrough: false,
58
+ block: false,
59
+ },
60
+ argTypes: {
61
+ as: {
62
+ options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'span'],
63
+ control: {
64
+ type: 'select',
65
+ },
66
+ },
67
+ size: {
68
+ options: Object.values(TextSize),
69
+ control: {
70
+ type: 'select',
71
+ },
72
+ },
73
+ weight: {
74
+ options: Object.keys(TextWeight),
75
+ control: {
76
+ type: 'select',
77
+ },
78
+ },
79
+ align: {
80
+ options: Object.keys(TextAlign),
81
+ control: {
82
+ type: 'select',
83
+ },
84
+ },
85
+ font: {
86
+ options: Object.keys(TextFont),
87
+ control: {
88
+ type: 'select',
89
+ },
90
+ },
91
+ nowrap: {
92
+ control: 'boolean',
93
+ },
94
+ truncate: {
95
+ control: 'boolean',
96
+ },
97
+ italic: {
98
+ control: 'boolean',
99
+ },
100
+ underline: {
101
+ control: 'boolean',
102
+ },
103
+ strikethrough: {
104
+ control: 'boolean',
105
+ },
106
+ block: {
107
+ control: 'boolean',
108
+ },
109
+ },
110
+ };
111
+ export const Text = renderComponent(storyTemplate).bind({});
@@ -0,0 +1,104 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { fontFamilyBase, fontFamilyMonospace, fontFamilyNumeric, fontSizeBase100, fontSizeBase200, fontSizeBase300, fontSizeBase400, fontSizeBase500, fontSizeBase600, fontSizeHero1000, fontSizeHero700, fontSizeHero800, fontSizeHero900, fontWeightBold, fontWeightMedium, fontWeightRegular, fontWeightSemibold, lineHeightBase100, lineHeightBase200, lineHeightBase300, lineHeightBase400, lineHeightBase500, lineHeightBase600, lineHeightHero1000, lineHeightHero700, lineHeightHero800, lineHeightHero900, } from '../theme/design-tokens.js';
4
+ /** Text styles
5
+ * @public
6
+ */
7
+ export const styles = css `
8
+ ${display('inline')}
9
+
10
+ ::slotted(*) {
11
+ font-family: ${fontFamilyBase};
12
+ font-size: ${fontSizeBase300};
13
+ line-height: ${lineHeightBase300};
14
+ font-weight: ${fontWeightRegular};
15
+ text-align: start;
16
+ display: inline;
17
+ white-space: normal;
18
+ overflow: visible;
19
+ text-overflow: clip;
20
+ margin: 0;
21
+ }
22
+ :host([nowrap]) ::slotted(*) {
23
+ white-space: nowrap;
24
+ overflow: hidden;
25
+ }
26
+ :host([truncate]) ::slotted(*) {
27
+ text-overflow: ellipsis;
28
+ }
29
+ :host([block]) ::slotted(*) {
30
+ display: block;
31
+ }
32
+ :host([italic]) ::slotted(*) {
33
+ font-style: italic;
34
+ }
35
+ :host([underline]) ::slotted(*) {
36
+ text-decoration-line: underline;
37
+ }
38
+ :host([strikethrough]) ::slotted(*) {
39
+ text-decoration-line: line-through;
40
+ }
41
+ :host([underline][strikethrough]) ::slotted(*) {
42
+ text-decoration-line: line-through underline;
43
+ }
44
+ :host([size='100']) ::slotted(*) {
45
+ font-size: ${fontSizeBase100};
46
+ line-height: ${lineHeightBase100};
47
+ }
48
+ :host([size='200']) ::slotted(*) {
49
+ font-size: ${fontSizeBase200};
50
+ line-height: ${lineHeightBase200};
51
+ }
52
+ :host([size='400']) ::slotted(*) {
53
+ font-size: ${fontSizeBase400};
54
+ line-height: ${lineHeightBase400};
55
+ }
56
+ :host([size='500']) ::slotted(*) {
57
+ font-size: ${fontSizeBase500};
58
+ line-height: ${lineHeightBase500};
59
+ }
60
+ :host([size='600']) ::slotted(*) {
61
+ font-size: ${fontSizeBase600};
62
+ line-height: ${lineHeightBase600};
63
+ }
64
+ :host([size='700']) ::slotted(*) {
65
+ font-size: ${fontSizeHero700};
66
+ line-height: ${lineHeightHero700};
67
+ }
68
+ :host([size='800']) ::slotted(*) {
69
+ font-size: ${fontSizeHero800};
70
+ line-height: ${lineHeightHero800};
71
+ }
72
+ :host([size='900']) ::slotted(*) {
73
+ font-size: ${fontSizeHero900};
74
+ line-height: ${lineHeightHero900};
75
+ }
76
+ :host([size='1000']) ::slotted(*) {
77
+ font-size: ${fontSizeHero1000};
78
+ line-height: ${lineHeightHero1000};
79
+ }
80
+ :host([font='monospace']) ::slotted(*) {
81
+ font-family: ${fontFamilyMonospace};
82
+ }
83
+ :host([font='numeric']) ::slotted(*) {
84
+ font-family: ${fontFamilyNumeric};
85
+ }
86
+ :host([weight='medium']) ::slotted(*) {
87
+ font-weight: ${fontWeightMedium};
88
+ }
89
+ :host([weight='semibold']) ::slotted(*) {
90
+ font-weight: ${fontWeightSemibold};
91
+ }
92
+ :host([weight='bold']) ::slotted(*) {
93
+ font-weight: ${fontWeightBold};
94
+ }
95
+ :host([align='center']) ::slotted(*) {
96
+ text-align: center;
97
+ }
98
+ :host([align='end']) ::slotted(*) {
99
+ text-align: end;
100
+ }
101
+ :host([align='justify']) ::slotted(*) {
102
+ text-align: justify;
103
+ }
104
+ `;
@@ -0,0 +1,5 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ /**
3
+ * @internal
4
+ */
5
+ export const template = html `<slot></slot>`;
@@ -1,2 +1,2 @@
1
- export * from './design-tokens';
2
- export { setTheme } from './set-theme';
1
+ export * from './design-tokens.js';
2
+ export { setTheme } from './set-theme.js';
@@ -1,4 +1,4 @@
1
- import * as tokens from './design-tokens';
1
+ import * as tokens from './design-tokens.js';
2
2
  const tokenNames = Object.keys(tokens);
3
3
  /**
4
4
  * Sets the theme tokens on defaultNode.
@@ -1,5 +1,5 @@
1
1
  import { DesignToken } from '@microsoft/fast-foundation';
2
- import * as tokens from '../theme/design-tokens';
2
+ import * as tokens from '../theme/design-tokens.js';
3
3
  DesignToken.registerDefaultStyleTarget();
4
4
  export default {
5
5
  title: 'Theme/Tokens',