@fluentui/web-components 3.0.0-alpha.5 → 3.0.0-alpha.7

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 (98) hide show
  1. package/CHANGELOG.json +43 -1
  2. package/CHANGELOG.md +22 -2
  3. package/dist/dts/avatar/avatar.d.ts +97 -0
  4. package/dist/dts/avatar/avatar.definition.d.ts +9 -0
  5. package/dist/dts/avatar/avatar.options.d.ts +142 -0
  6. package/dist/dts/avatar/avatar.styles.d.ts +4 -0
  7. package/dist/dts/avatar/avatar.template.d.ts +8 -0
  8. package/dist/dts/avatar/define.d.ts +1 -0
  9. package/dist/dts/avatar/index.d.ts +5 -0
  10. package/dist/dts/divider/define.d.ts +1 -0
  11. package/dist/dts/divider/divider.d.ts +31 -0
  12. package/dist/dts/divider/divider.definition.d.ts +9 -0
  13. package/dist/dts/divider/divider.options.d.ts +40 -0
  14. package/dist/dts/divider/divider.styles.d.ts +4 -0
  15. package/dist/dts/divider/divider.template.d.ts +7 -0
  16. package/dist/dts/divider/index.d.ts +5 -0
  17. package/dist/dts/image/define.d.ts +1 -0
  18. package/dist/dts/image/image.d.ts +48 -0
  19. package/dist/dts/image/image.definition.d.ts +9 -0
  20. package/dist/dts/image/image.options.d.ts +27 -0
  21. package/dist/dts/image/image.styles.d.ts +5 -0
  22. package/dist/dts/image/image.template.d.ts +7 -0
  23. package/dist/dts/image/index.d.ts +5 -0
  24. package/dist/dts/index.d.ts +4 -0
  25. package/dist/dts/switch/define.d.ts +1 -0
  26. package/dist/dts/switch/index.d.ts +5 -0
  27. package/dist/dts/switch/switch.d.ts +13 -0
  28. package/dist/dts/switch/switch.definition.d.ts +9 -0
  29. package/dist/dts/switch/switch.options.d.ts +15 -0
  30. package/dist/dts/switch/switch.styles.d.ts +1 -0
  31. package/dist/dts/switch/switch.template.d.ts +3 -0
  32. package/dist/dts/utils/get-initials.d.ts +18 -0
  33. package/dist/esm/avatar/avatar.definition.js +17 -0
  34. package/dist/esm/avatar/avatar.definition.js.map +1 -0
  35. package/dist/esm/avatar/avatar.js +92 -0
  36. package/dist/esm/avatar/avatar.js.map +1 -0
  37. package/dist/esm/avatar/avatar.options.js +87 -0
  38. package/dist/esm/avatar/avatar.options.js.map +1 -0
  39. package/dist/esm/avatar/avatar.styles.js +476 -0
  40. package/dist/esm/avatar/avatar.styles.js.map +1 -0
  41. package/dist/esm/avatar/avatar.template.js +28 -0
  42. package/dist/esm/avatar/avatar.template.js.map +1 -0
  43. package/dist/esm/avatar/define.js +4 -0
  44. package/dist/esm/avatar/define.js.map +1 -0
  45. package/dist/esm/avatar/index.js +6 -0
  46. package/dist/esm/avatar/index.js.map +1 -0
  47. package/dist/esm/divider/define.js +4 -0
  48. package/dist/esm/divider/define.js.map +1 -0
  49. package/dist/esm/divider/divider.definition.js +17 -0
  50. package/dist/esm/divider/divider.definition.js.map +1 -0
  51. package/dist/esm/divider/divider.js +21 -0
  52. package/dist/esm/divider/divider.js.map +1 -0
  53. package/dist/esm/divider/divider.options.js +31 -0
  54. package/dist/esm/divider/divider.options.js.map +1 -0
  55. package/dist/esm/divider/divider.styles.js +111 -0
  56. package/dist/esm/divider/divider.styles.js.map +1 -0
  57. package/dist/esm/divider/divider.template.js +7 -0
  58. package/dist/esm/divider/divider.template.js.map +1 -0
  59. package/dist/esm/divider/index.js +6 -0
  60. package/dist/esm/divider/index.js.map +1 -0
  61. package/dist/esm/image/define.js +4 -0
  62. package/dist/esm/image/define.js.map +1 -0
  63. package/dist/esm/image/image.definition.js +17 -0
  64. package/dist/esm/image/image.definition.js.map +1 -0
  65. package/dist/esm/image/image.js +24 -0
  66. package/dist/esm/image/image.js.map +1 -0
  67. package/dist/esm/image/image.options.js +21 -0
  68. package/dist/esm/image/image.options.js.map +1 -0
  69. package/dist/esm/image/image.styles.js +52 -0
  70. package/dist/esm/image/image.styles.js.map +1 -0
  71. package/dist/esm/image/image.template.js +7 -0
  72. package/dist/esm/image/image.template.js.map +1 -0
  73. package/dist/esm/image/index.js +6 -0
  74. package/dist/esm/image/index.js.map +1 -0
  75. package/dist/esm/index.js +4 -0
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/switch/define.js +4 -0
  78. package/dist/esm/switch/define.js.map +1 -0
  79. package/dist/esm/switch/index.js +6 -0
  80. package/dist/esm/switch/index.js.map +1 -0
  81. package/dist/esm/switch/switch.definition.js +17 -0
  82. package/dist/esm/switch/switch.definition.js.map +1 -0
  83. package/dist/esm/switch/switch.js +9 -0
  84. package/dist/esm/switch/switch.js.map +1 -0
  85. package/dist/esm/switch/switch.options.js +10 -0
  86. package/dist/esm/switch/switch.options.js.map +1 -0
  87. package/dist/esm/switch/switch.styles.js +114 -0
  88. package/dist/esm/switch/switch.styles.js.map +1 -0
  89. package/dist/esm/switch/switch.template.js +5 -0
  90. package/dist/esm/switch/switch.template.js.map +1 -0
  91. package/dist/esm/utils/get-initials.js +83 -0
  92. package/dist/esm/utils/get-initials.js.map +1 -0
  93. package/dist/fluent-web-components.api.json +3517 -1757
  94. package/dist/web-components.d.ts +496 -0
  95. package/dist/web-components.js +1095 -29
  96. package/dist/web-components.min.js +123 -115
  97. package/docs/api-report.md +262 -0
  98. package/package.json +17 -1
@@ -0,0 +1,111 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { colorBrandForeground1, colorBrandStroke1, colorNeutralForeground1, colorNeutralForeground2, colorNeutralForeground3, colorNeutralStroke1, colorNeutralStroke2, colorNeutralStroke3, fontFamilyBase, fontSizeBase200, fontWeightRegular, strokeWidthThin, } from '../theme/design-tokens.js';
4
+ /** Divider styles
5
+ * @public
6
+ */
7
+ export const styles = css `
8
+ ${display('flex')}
9
+
10
+ :host::after,
11
+ :host::before {
12
+ align-self: center;
13
+ background: ${colorNeutralStroke2};
14
+ box-sizing: border-box;
15
+ content: '';
16
+ display: flex;
17
+ flex-grow: 1;
18
+ height: ${strokeWidthThin};
19
+ }
20
+
21
+ :host([inset]) {
22
+ padding: 0 12px;
23
+ }
24
+
25
+ :host ::slotted(*) {
26
+ color: ${colorNeutralForeground2};
27
+ font-family: ${fontFamilyBase};
28
+ font-size: ${fontSizeBase200};
29
+ font-weight: ${fontWeightRegular};
30
+ margin: 0;
31
+ padding: 0 12px;
32
+ }
33
+
34
+ :host([align-content='start'])::before,
35
+ :host([align-content='end'])::after {
36
+ flex-basis: 12px;
37
+ flex-grow: 0;
38
+ flex-shrink: 0;
39
+ }
40
+
41
+ :host([orientation='vertical']) {
42
+ height: 100%;
43
+ min-height: 84px;
44
+ }
45
+ :host([orientation='vertical']):empty {
46
+ min-height: 20px;
47
+ }
48
+
49
+ :host([orientation='vertical']) {
50
+ flex-direction: column;
51
+ align-items: center;
52
+ }
53
+
54
+ :host([orientation='vertical'][inset])::before {
55
+ margin-top: 12px;
56
+ }
57
+ :host([orientation='vertical'][inset])::after {
58
+ margin-bottom: 12px;
59
+ }
60
+
61
+ :host([orientation='vertical']):empty::before,
62
+ :host([orientation='vertical']):empty::after {
63
+ height: 10px;
64
+ min-height: 10px;
65
+ flex-grow: 0;
66
+ }
67
+
68
+ :host([orientation='vertical'])::before,
69
+ :host([orientation='vertical'])::after {
70
+ width: ${strokeWidthThin};
71
+ min-height: 20px;
72
+ height: 100%;
73
+ }
74
+
75
+ :host([orientation='vertical']) ::slotted(*) {
76
+ display: flex;
77
+ flex-direction: column;
78
+ padding: 12px 0;
79
+ line-height: 20px;
80
+ }
81
+
82
+ :host([orientation='vertical'][align-content='start'])::before {
83
+ min-height: 8px;
84
+ }
85
+ :host([orientation='vertical'][align-content='end'])::after {
86
+ min-height: 8px;
87
+ }
88
+
89
+ :host([appearance='strong'])::before,
90
+ :host([appearance='strong'])::after {
91
+ background: ${colorNeutralStroke1};
92
+ }
93
+ :host([appearance='strong']) ::slotted(*) {
94
+ color: ${colorNeutralForeground1};
95
+ }
96
+ :host([appearance='brand'])::before,
97
+ :host([appearance='brand'])::after {
98
+ background: ${colorBrandStroke1};
99
+ }
100
+ :host([appearance='brand']) ::slotted(*) {
101
+ color: ${colorBrandForeground1};
102
+ }
103
+ :host([appearance='subtle'])::before,
104
+ :host([appearance='subtle'])::after {
105
+ background: ${colorNeutralStroke3};
106
+ }
107
+ :host([appearance='subtle']) ::slotted(*) {
108
+ color: ${colorNeutralForeground3};
109
+ }
110
+ `;
111
+ //# sourceMappingURL=divider.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.styles.js","sourceRoot":"","sources":["../../../src/divider/divider.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,MAAM,CAAC;;;;;kBAKD,mBAAmB;;;;;cAKvB,eAAe;;;;;;;;aAQhB,uBAAuB;mBACjB,cAAc;iBAChB,eAAe;mBACb,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAyCvB,eAAe;;;;;;;;;;;;;;;;;;;;;kBAqBV,mBAAmB;;;aAGxB,uBAAuB;;;;kBAIlB,iBAAiB;;;aAGtB,qBAAqB;;;;kBAIhB,mBAAmB;;;aAGxB,uBAAuB;;CAEnC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { dividerTemplate } from '@microsoft/fast-foundation';
2
+ /**
3
+ * Template for the Divider component
4
+ * @public
5
+ */
6
+ export const template = dividerTemplate();
7
+ //# sourceMappingURL=divider.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.template.js","sourceRoot":"","sources":["../../../src/divider/divider.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiC,eAAe,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './divider.js';
2
+ export * from './divider.options.js';
3
+ export { definition as DividerDefinition } from './divider.definition.js';
4
+ export { template as DividerTemplate } from './divider.template.js';
5
+ export { styles as DividerStyles } from './divider.styles.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/divider/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { definition } from './image.definition.js';
3
+ definition.define(FluentDesignSystem.registry);
4
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/image/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { Image } from './image.js';
3
+ import { template } from './image.template.js';
4
+ import { styles } from './image.styles.js';
5
+ /**
6
+ * The Fluent Image Element
7
+ *
8
+ * @public
9
+ * @remarks
10
+ * HTML Element: \<fluent-image\>
11
+ */
12
+ export const definition = Image.compose({
13
+ name: `${FluentDesignSystem.prefix}-image`,
14
+ template,
15
+ styles,
16
+ });
17
+ //# sourceMappingURL=image.definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.definition.js","sourceRoot":"","sources":["../../../src/image/image.definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC;IACtC,IAAI,EAAE,GAAG,kBAAkB,CAAC,MAAM,QAAQ;IAC1C,QAAQ;IACR,MAAM;CACP,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, FASTElement } from '@microsoft/fast-element';
3
+ /**
4
+ * The base class used for constucting a fluent image custom element
5
+ * @public
6
+ */
7
+ export class Image extends FASTElement {
8
+ }
9
+ __decorate([
10
+ attr({ mode: 'boolean' })
11
+ ], Image.prototype, "block", void 0);
12
+ __decorate([
13
+ attr({ mode: 'boolean' })
14
+ ], Image.prototype, "bordered", void 0);
15
+ __decorate([
16
+ attr({ mode: 'boolean' })
17
+ ], Image.prototype, "shadow", void 0);
18
+ __decorate([
19
+ attr
20
+ ], Image.prototype, "fit", void 0);
21
+ __decorate([
22
+ attr
23
+ ], Image.prototype, "shape", void 0);
24
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/image/image.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;GAGG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;CA8CrC;AArCC;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;oCACH;AASvB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;uCACA;AAS1B;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;qCACF;AASxB;IADC,IAAI;kCACiB;AAStB;IADC,IAAI;oCACqB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Image fit
3
+ * @public
4
+ */
5
+ export const ImageFit = {
6
+ none: 'none',
7
+ center: 'center',
8
+ contain: 'contain',
9
+ cover: 'cover',
10
+ default: 'default',
11
+ };
12
+ /**
13
+ * Image shape
14
+ * @public
15
+ */
16
+ export const ImageShape = {
17
+ circular: 'circular',
18
+ rounded: 'rounded',
19
+ square: 'square',
20
+ };
21
+ //# sourceMappingURL=image.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.options.js","sourceRoot":"","sources":["../../../src/image/image.options.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAOX;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACR,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { borderRadiusCircular, colorNeutralStroke2, shadow4, strokeWidthThin } from '../theme/design-tokens.js';
3
+ /** Image styles
4
+ *
5
+ * @public
6
+ */
7
+ export const styles = css `
8
+ :host ::slotted(img) {
9
+ box-sizing: border-box;
10
+ min-height: 8px;
11
+ min-width: 8px;
12
+ display: inline-block;
13
+ }
14
+ :host([block]) ::slotted(img) {
15
+ width: 100%;
16
+ height: auto;
17
+ }
18
+ :host([bordered]) ::slotted(img) {
19
+ border: ${strokeWidthThin} solid ${colorNeutralStroke2};
20
+ }
21
+ :host([fit='none']) ::slotted(img) {
22
+ object-fit: none;
23
+ object-position: top left;
24
+ height: 100%;
25
+ width: 100%;
26
+ }
27
+ :host([fit='center']) ::slotted(img) {
28
+ object-fit: none;
29
+ object-position: center;
30
+ height: 100%;
31
+ width: 100%;
32
+ }
33
+ :host([fit='contain']) ::slotted(img) {
34
+ object-fit: contain;
35
+ object-position: center;
36
+ height: 100%;
37
+ width: 100%;
38
+ }
39
+ :host([fit='cover']) ::slotted(img) {
40
+ object-fit: cover;
41
+ object-position: center;
42
+ height: 100%;
43
+ width: 100%;
44
+ }
45
+ :host([shadow]) ::slotted(img) {
46
+ box-shadow: ${shadow4};
47
+ }
48
+ :host([shape='circular']) ::slotted(img) {
49
+ border-radius: ${borderRadiusCircular};
50
+ }
51
+ `;
52
+ //# sourceMappingURL=image.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.styles.js","sourceRoot":"","sources":["../../../src/image/image.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEhH;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;cAYX,eAAe,UAAU,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2BxC,OAAO;;;qBAGJ,oBAAoB;;CAExC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ /**
3
+ * Template for the Image component
4
+ * @public
5
+ */
6
+ export const template = html `<slot></slot>`;
7
+ //# sourceMappingURL=image.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.template.js","sourceRoot":"","sources":["../../../src/image/image.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpE;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA+B,IAAI,CAAO,eAAe,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './image.js';
2
+ export * from './image.options.js';
3
+ export { definition as ImageDefinition } from './image.definition.js';
4
+ export { template as ImageTemplate } from './image.template.js';
5
+ export { styles as ImageStyles } from './image.styles.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/image/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  export * from './accordion/index.js';
2
2
  export * from './accordion-item/index.js';
3
+ export * from './avatar/index.js';
3
4
  export * from './badge/index.js';
4
5
  export * from './counter-badge/index.js';
6
+ export * from './divider/index.js';
7
+ export * from './image/index.js';
5
8
  export * from './progress-bar/index.js';
6
9
  export * from './spinner/index.js';
10
+ export * from './switch/index.js';
7
11
  export * from './text/index.js';
8
12
  export * from './theme/index.js';
9
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { definition } from './switch.definition.js';
3
+ definition.define(FluentDesignSystem.registry);
4
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/switch/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './switch.js';
2
+ export * from './switch.options.js';
3
+ export { definition } from './switch.definition.js';
4
+ export { styles as switchStyles } from './switch.styles.js';
5
+ export { template as switchTemplate } from './switch.template.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/switch/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { FluentDesignSystem } from '../fluent-design-system.js';
2
+ import { Switch } from './switch.js';
3
+ import { template } from './switch.template.js';
4
+ import { styles } from './switch.styles.js';
5
+ /**
6
+ * The Fluent Switch Element.
7
+ *
8
+ * @public
9
+ * @remarks
10
+ * HTML Element: \<fluent-switch\>
11
+ */
12
+ export const definition = Switch.compose({
13
+ name: `${FluentDesignSystem.prefix}-switch`,
14
+ template,
15
+ styles,
16
+ });
17
+ //# sourceMappingURL=switch.definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.definition.js","sourceRoot":"","sources":["../../../src/switch/switch.definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IACvC,IAAI,EAAE,GAAG,kBAAkB,CAAC,MAAM,SAAS;IAC3C,QAAQ;IACR,MAAM;CACP,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@microsoft/fast-element';
3
+ import { FASTSwitch } from '@microsoft/fast-foundation';
4
+ export class Switch extends FASTSwitch {
5
+ }
6
+ __decorate([
7
+ attr({ attribute: 'label-position' })
8
+ ], Switch.prototype, "labelPosition", void 0);
9
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/switch/switch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,MAAM,OAAO,MAAO,SAAQ,UAAU;CAWrC;AADC;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;6CACgB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * SwitchLabelPosition Constants
3
+ * @public
4
+ */
5
+ export const SwitchLabelPosition = {
6
+ above: 'above',
7
+ after: 'after',
8
+ before: 'before',
9
+ };
10
+ //# sourceMappingURL=switch.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.options.js","sourceRoot":"","sources":["../../../src/switch/switch.options.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { borderRadiusCircular, colorCompoundBrandBackground, colorCompoundBrandBackgroundHover, colorCompoundBrandBackgroundPressed, colorNeutralBackgroundDisabled, colorNeutralForeground1, colorNeutralForeground3, colorNeutralForeground3Hover, colorNeutralForeground3Pressed, colorNeutralForegroundDisabled, colorNeutralForegroundInverted, colorNeutralForegroundInvertedHover, colorNeutralForegroundInvertedPressed, colorNeutralStrokeAccessible, colorNeutralStrokeAccessibleHover, colorNeutralStrokeAccessiblePressed, colorNeutralStrokeDisabled, colorTransparentBackground, curveEasyEase, durationNormal, fontFamilyBase, fontSizeBase300, fontWeightRegular, lineHeightBase300, spacingHorizontalS, spacingHorizontalXS, spacingHorizontalXXS, spacingVerticalS, spacingVerticalXS, } from '../theme/design-tokens.js';
4
+ export const styles = css `
5
+ ${display('inline-flex')}
6
+
7
+ :host {
8
+ align-items: center;
9
+ flex-direction: row-reverse;
10
+ outline: none;
11
+ user-select: none;
12
+ }
13
+ :host([label-position='before']) {
14
+ flex-direction: row;
15
+ }
16
+ :host([label-position='above']) {
17
+ flex-direction: column;
18
+ align-items: flex-start;
19
+ }
20
+ :host([disabled]) .label,
21
+ :host([readonly]) .label,
22
+ :host([readonly]) .switch,
23
+ :host([disabled]) .switch {
24
+ cursor: not-allowed;
25
+ }
26
+ .label {
27
+ position: relative;
28
+ color: ${colorNeutralForeground1};
29
+ line-height: ${lineHeightBase300};
30
+ font-size: ${fontSizeBase300};
31
+ font-weight: ${fontWeightRegular};
32
+ font-family: ${fontFamilyBase};
33
+ padding: ${spacingVerticalXS} ${spacingHorizontalXS};
34
+ cursor: pointer;
35
+ }
36
+ .label__hidden {
37
+ display: none;
38
+ }
39
+ .switch {
40
+ display: flex;
41
+ align-items: center;
42
+ padding: 0 ${spacingHorizontalXXS};
43
+ box-sizing: border-box;
44
+ width: 40px;
45
+ height: 20px;
46
+ background-color: ${colorTransparentBackground};
47
+ border: 1px solid ${colorNeutralStrokeAccessible};
48
+ border-radius: ${borderRadiusCircular};
49
+ outline: none;
50
+ cursor: pointer;
51
+ margin: ${spacingVerticalS} ${spacingHorizontalS};
52
+ }
53
+ :host(:hover) .switch {
54
+ background: none;
55
+ border-color: ${colorNeutralStrokeAccessibleHover};
56
+ }
57
+ :host(:active) .switch {
58
+ border-color: ${colorNeutralStrokeAccessiblePressed};
59
+ }
60
+ :host([disabled]) .switch,
61
+ :host([readonly]) .switch {
62
+ border: 1px solid ${colorNeutralStrokeDisabled};
63
+ background-color: none;
64
+ pointer: default;
65
+ }
66
+ :host([aria-checked='true']) .switch {
67
+ background: ${colorCompoundBrandBackground};
68
+ }
69
+ :host([aria-checked='true']:hover) .switch {
70
+ background: ${colorCompoundBrandBackgroundHover};
71
+ border-color: ${colorCompoundBrandBackgroundHover};
72
+ }
73
+ :host([aria-checked='true']:active) .switch {
74
+ background: ${colorCompoundBrandBackgroundPressed};
75
+ border-color: ${colorCompoundBrandBackgroundPressed};
76
+ }
77
+ :host([aria-checked='true'][disabled]) .switch {
78
+ background: ${colorNeutralBackgroundDisabled};
79
+ border-color: ${colorNeutralStrokeDisabled};
80
+ }
81
+ .checked-indicator {
82
+ height: 14px;
83
+ width: 14px;
84
+ border-radius: 50%;
85
+ background-color: ${colorNeutralForeground3};
86
+ transition-duration: ${durationNormal};
87
+ transition-timing-function: ${curveEasyEase};
88
+ transition-property: transform;
89
+ }
90
+ :host([aria-checked='true']) .checked-indicator {
91
+ background-color: ${colorNeutralForegroundInverted};
92
+ transform: translateX(20px);
93
+ }
94
+ :host([aria-checked='true']:hover) .checked-indicator {
95
+ background: ${colorNeutralForegroundInvertedHover};
96
+ }
97
+ :host([aria-checked='true']:active) .checked-indicator {
98
+ background: ${colorNeutralForegroundInvertedPressed};
99
+ }
100
+ :host(:hover) .checked-indicator {
101
+ background-color: ${colorNeutralForeground3Hover};
102
+ }
103
+ :host(:active) .checked-indicator {
104
+ background-color: ${colorNeutralForeground3Pressed};
105
+ }
106
+ :host([disabled]) .checked-indicator,
107
+ :host([readonly]) .checked-indicator {
108
+ background: ${colorNeutralForegroundDisabled};
109
+ }
110
+ :host([aria-checked='true'][disabled]) .checked-indicator {
111
+ background: ${colorNeutralForegroundDisabled};
112
+ }
113
+ `;
114
+ //# sourceMappingURL=switch.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.styles.js","sourceRoot":"","sources":["../../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,mCAAmC,EACnC,qCAAqC,EACrC,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACnC,0BAA0B,EAC1B,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;aAuBb,uBAAuB;mBACjB,iBAAiB;iBACnB,eAAe;mBACb,iBAAiB;mBACjB,cAAc;eAClB,iBAAiB,IAAI,mBAAmB;;;;;;;;;iBAStC,oBAAoB;;;;wBAIb,0BAA0B;wBAC1B,4BAA4B;qBAC/B,oBAAoB;;;cAG3B,gBAAgB,IAAI,kBAAkB;;;;oBAIhC,iCAAiC;;;oBAGjC,mCAAmC;;;;wBAI/B,0BAA0B;;;;;kBAKhC,4BAA4B;;;kBAG5B,iCAAiC;oBAC/B,iCAAiC;;;kBAGnC,mCAAmC;oBACjC,mCAAmC;;;kBAGrC,8BAA8B;oBAC5B,0BAA0B;;;;;;wBAMtB,uBAAuB;2BACpB,cAAc;kCACP,aAAa;;;;wBAIvB,8BAA8B;;;;kBAIpC,mCAAmC;;;kBAGnC,qCAAqC;;;wBAG/B,4BAA4B;;;wBAG5B,8BAA8B;;;;kBAIpC,8BAA8B;;;kBAG9B,8BAA8B;;CAE/C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { switchTemplate } from '@microsoft/fast-foundation';
2
+ export const template = switchTemplate({
3
+ switch: `<span class="checked-indicator" part="checked-indicator"></span>`,
4
+ });
5
+ //# sourceMappingURL=switch.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.template.js","sourceRoot":"","sources":["../../../src/switch/switch.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,MAAM,CAAC,MAAM,QAAQ,GAAgC,cAAc,CAAC;IAClE,MAAM,EAAE,kEAAkE;CAC3E,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ /* TODO: This file is a direct copy of the React Avatar utils */
2
+ /**
3
+ * Regular expressions matching characters to ignore when calculating the initials.
4
+ */
5
+ /**
6
+ * Regular expression matching characters within various types of enclosures, including the enclosures themselves
7
+ * so for example, (xyz) [xyz] {xyz} all would be ignored
8
+ */
9
+ const UNWANTED_ENCLOSURES_REGEX = /[\(\[\{][^\)\]\}]*[\)\]\}]/g;
10
+ /**
11
+ * Regular expression matching special ASCII characters except space, plus some unicode special characters.
12
+ * Applies after unwanted enclosures have been removed
13
+ */
14
+ // eslint-disable-next-line no-control-regex
15
+ const UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g;
16
+ /**
17
+ * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed
18
+ * and number has been trimmed for whitespaces
19
+ */
20
+ const PHONENUMBER_REGEX = /^\d+[\d\s]*(:?ext|x|)\s*\d+$/i;
21
+ /** Regular expression matching one or more spaces. */
22
+ const MULTIPLE_WHITESPACES_REGEX = /\s+/g;
23
+ /**
24
+ * Regular expression matching languages for which we currently don't support initials.
25
+ * Arabic: Arabic, Arabic Supplement, Arabic Extended-A.
26
+ * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B.
27
+ * Japanese: Hiragana, Katakana.
28
+ * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs,
29
+ * CJK Unified Ideographs Extension B
30
+ */
31
+ // eslint-disable-next-line
32
+ const UNSUPPORTED_TEXT_REGEX = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/;
33
+ function getInitialsLatin(displayName, isRtl, firstInitialOnly) {
34
+ let initials = '';
35
+ const splits = displayName.split(' ');
36
+ if (splits.length !== 0) {
37
+ initials += splits[0].charAt(0).toUpperCase();
38
+ }
39
+ if (!firstInitialOnly) {
40
+ if (splits.length === 2) {
41
+ initials += splits[1].charAt(0).toUpperCase();
42
+ }
43
+ else if (splits.length === 3) {
44
+ initials += splits[2].charAt(0).toUpperCase();
45
+ }
46
+ }
47
+ if (isRtl && initials.length > 1) {
48
+ return initials.charAt(1) + initials.charAt(0);
49
+ }
50
+ return initials;
51
+ }
52
+ function cleanupDisplayName(displayName) {
53
+ displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, '');
54
+ displayName = displayName.replace(UNWANTED_CHARS_REGEX, '');
55
+ displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' ');
56
+ displayName = displayName.trim();
57
+ return displayName;
58
+ }
59
+ /**
60
+ * Get (up to 2 characters) initials based on display name of the persona.
61
+ *
62
+ * @param displayName - The full name of the person or entity
63
+ * @param isRtl - Whether the display is in RTL
64
+ * @param options - Extra options to control the behavior of getInitials
65
+ *
66
+ * @returns The 1 or 2 character initials based on the name. Or an empty string if no initials
67
+ * could be derived from the name.
68
+ *
69
+ * @internal
70
+ */
71
+ export function getInitials(displayName, isRtl, options) {
72
+ if (!displayName) {
73
+ return '';
74
+ }
75
+ displayName = cleanupDisplayName(displayName);
76
+ // For names containing CJK characters, and phone numbers, we don't display initials
77
+ if (UNSUPPORTED_TEXT_REGEX.test(displayName) ||
78
+ (!(options === null || options === void 0 ? void 0 : options.allowPhoneInitials) && PHONENUMBER_REGEX.test(displayName))) {
79
+ return '';
80
+ }
81
+ return getInitialsLatin(displayName, isRtl, options === null || options === void 0 ? void 0 : options.firstInitialOnly);
82
+ }
83
+ //# sourceMappingURL=get-initials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-initials.js","sourceRoot":"","sources":["../../../src/utils/get-initials.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE;;GAEG;AAEH;;;GAGG;AACH,MAAM,yBAAyB,GAAW,6BAA6B,CAAC;AAExE;;;GAGG;AACH,4CAA4C;AAC5C,MAAM,oBAAoB,GAAW,4DAA4D,CAAC;AAElG;;;GAGG;AACH,MAAM,iBAAiB,GAAW,+BAA+B,CAAC;AAElE,sDAAsD;AACtD,MAAM,0BAA0B,GAAW,MAAM,CAAC;AAElD;;;;;;;GAOG;AACH,2BAA2B;AAC3B,MAAM,sBAAsB,GAAW,4MAA4M,CAAC;AAEpP,SAAS,gBAAgB,CAAC,WAAmB,EAAE,KAAc,EAAE,gBAA0B;IACvF,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,MAAM,MAAM,GAAa,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;KAC/C;IAED,IAAI,CAAC,gBAAgB,EAAE;QACrB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/C;aAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/C;KACF;IAED,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAChD;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,kBAAkB,CAAC,WAAmB;IAC7C,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IACjE,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC5D,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IACnE,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAEjC,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CACzB,WAAsC,EACtC,KAAc,EACd,OAMC;IAED,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAE9C,oFAAoF;IACpF,IACE,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC;QACxC,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,CAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EACrE;QACA,OAAO,EAAE,CAAC;KACX;IAED,OAAO,gBAAgB,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,CAAC,CAAC;AACzE,CAAC"}