@fluentui/react-label 9.0.0-alpha.42 → 9.0.0-alpha.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/CHANGELOG.json +46 -7
  2. package/CHANGELOG.md +20 -7
  3. package/lib/Label.js.map +1 -1
  4. package/lib/common/isConformant.js.map +1 -1
  5. package/lib/components/Label/Label.js.map +1 -1
  6. package/lib/components/Label/Label.types.js.map +1 -1
  7. package/lib/components/Label/index.js.map +1 -1
  8. package/lib/components/Label/renderLabel.js.map +1 -1
  9. package/lib/components/Label/useLabel.js.map +1 -1
  10. package/lib/components/Label/useLabelStyles.js.map +1 -1
  11. package/lib/index.js.map +1 -1
  12. package/lib-commonjs/Label.js.map +1 -1
  13. package/lib-commonjs/common/isConformant.js.map +1 -1
  14. package/lib-commonjs/components/Label/Label.js.map +1 -1
  15. package/lib-commonjs/components/Label/Label.types.js.map +1 -1
  16. package/lib-commonjs/components/Label/index.js.map +1 -1
  17. package/lib-commonjs/components/Label/renderLabel.js.map +1 -1
  18. package/lib-commonjs/components/Label/useLabel.js.map +1 -1
  19. package/lib-commonjs/components/Label/useLabelStyles.js.map +1 -1
  20. package/lib-commonjs/index.js.map +1 -1
  21. package/package.json +6 -6
  22. package/lib-amd/Label.d.ts +0 -1
  23. package/lib-amd/Label.js +0 -6
  24. package/lib-amd/Label.js.map +0 -1
  25. package/lib-amd/common/isConformant.d.ts +0 -4
  26. package/lib-amd/common/isConformant.js +0 -15
  27. package/lib-amd/common/isConformant.js.map +0 -1
  28. package/lib-amd/components/Label/Label.d.ts +0 -10
  29. package/lib-amd/components/Label/Label.js +0 -15
  30. package/lib-amd/components/Label/Label.js.map +0 -1
  31. package/lib-amd/components/Label/Label.types.d.ts +0 -49
  32. package/lib-amd/components/Label/Label.types.js +0 -5
  33. package/lib-amd/components/Label/Label.types.js.map +0 -1
  34. package/lib-amd/components/Label/index.d.ts +0 -5
  35. package/lib-amd/components/Label/index.js +0 -10
  36. package/lib-amd/components/Label/index.js.map +0 -1
  37. package/lib-amd/components/Label/renderLabel.d.ts +0 -5
  38. package/lib-amd/components/Label/renderLabel.js +0 -16
  39. package/lib-amd/components/Label/renderLabel.js.map +0 -1
  40. package/lib-amd/components/Label/useLabel.d.ts +0 -18
  41. package/lib-amd/components/Label/useLabel.js +0 -53
  42. package/lib-amd/components/Label/useLabel.js.map +0 -1
  43. package/lib-amd/components/Label/useLabelStyles.d.ts +0 -5
  44. package/lib-amd/components/Label/useLabelStyles.js +0 -50
  45. package/lib-amd/components/Label/useLabelStyles.js.map +0 -1
  46. package/lib-amd/index.d.ts +0 -2
  47. package/lib-amd/index.js +0 -6
  48. package/lib-amd/index.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,46 @@
2
2
  "name": "@fluentui/react-label",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 21 Sep 2021 07:40:35 GMT",
5
+ "date": "Wed, 22 Sep 2021 10:08:31 GMT",
6
+ "tag": "@fluentui/react-label_v9.0.0-alpha.43",
7
+ "version": "9.0.0-alpha.43",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-label",
13
+ "comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.70",
14
+ "commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-label",
19
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.50",
20
+ "commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-label",
25
+ "comment": "Bump @fluentui/babel-make-styles to v9.0.0-alpha.52",
26
+ "commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-label",
31
+ "comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.45",
32
+ "commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-label",
37
+ "comment": "Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.14",
38
+ "commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
39
+ }
40
+ ]
41
+ }
42
+ },
43
+ {
44
+ "date": "Tue, 21 Sep 2021 07:42:34 GMT",
6
45
  "tag": "@fluentui/react-label_v9.0.0-alpha.42",
7
46
  "version": "9.0.0-alpha.42",
8
47
  "comments": {
@@ -11,7 +50,7 @@
11
50
  "author": "elcraig@microsoft.com",
12
51
  "package": "@fluentui/react-label",
13
52
  "comment": "Remove unnecessary docCategory tags",
14
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
53
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
15
54
  }
16
55
  ],
17
56
  "prerelease": [
@@ -19,31 +58,31 @@
19
58
  "author": "gcox@microsoft.com",
20
59
  "package": "@fluentui/react-label",
21
60
  "comment": "Updating to types over interfaces",
22
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
61
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
23
62
  },
24
63
  {
25
64
  "author": "beachball",
26
65
  "package": "@fluentui/react-label",
27
66
  "comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.69",
28
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
67
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
29
68
  },
30
69
  {
31
70
  "author": "beachball",
32
71
  "package": "@fluentui/react-label",
33
72
  "comment": "Bump @fluentui/babel-make-styles to v9.0.0-alpha.51",
34
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
73
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
35
74
  },
36
75
  {
37
76
  "author": "beachball",
38
77
  "package": "@fluentui/react-label",
39
78
  "comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.44",
40
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
79
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
41
80
  },
42
81
  {
43
82
  "author": "beachball",
44
83
  "package": "@fluentui/react-label",
45
84
  "comment": "Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.13",
46
- "commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
85
+ "commit": "363765ba3d08d2facbb97fb80ab54ff27ac714fd"
47
86
  }
48
87
  ]
49
88
  }
package/CHANGELOG.md CHANGED
@@ -1,21 +1,34 @@
1
1
  # Change Log - @fluentui/react-label
2
2
 
3
- This log was last generated on Tue, 21 Sep 2021 07:40:35 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 22 Sep 2021 10:08:31 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.43](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.0.0-alpha.43)
8
+
9
+ Wed, 22 Sep 2021 10:08:31 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.0.0-alpha.42..@fluentui/react-label_v9.0.0-alpha.43)
11
+
12
+ ### Changes
13
+
14
+ - Bump @fluentui/react-make-styles to v9.0.0-alpha.70 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
15
+ - Bump @fluentui/react-utilities to v9.0.0-alpha.50 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
16
+ - Bump @fluentui/babel-make-styles to v9.0.0-alpha.52 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
17
+ - Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.45 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
18
+ - Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.14 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
19
+
7
20
  ## [9.0.0-alpha.42](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.0.0-alpha.42)
8
21
 
9
- Tue, 21 Sep 2021 07:40:35 GMT
22
+ Tue, 21 Sep 2021 07:42:34 GMT
10
23
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.0.0-alpha.41..@fluentui/react-label_v9.0.0-alpha.42)
11
24
 
12
25
  ### Changes
13
26
 
14
- - Updating to types over interfaces ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by gcox@microsoft.com)
15
- - Bump @fluentui/react-make-styles to v9.0.0-alpha.69 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
16
- - Bump @fluentui/babel-make-styles to v9.0.0-alpha.51 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
17
- - Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.44 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
18
- - Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.13 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
27
+ - Updating to types over interfaces ([PR #19865](https://github.com/microsoft/fluentui/pull/19865) by gcox@microsoft.com)
28
+ - Bump @fluentui/react-make-styles to v9.0.0-alpha.69 ([PR #19865](https://github.com/microsoft/fluentui/pull/19865) by beachball)
29
+ - Bump @fluentui/babel-make-styles to v9.0.0-alpha.51 ([PR #19865](https://github.com/microsoft/fluentui/pull/19865) by beachball)
30
+ - Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.44 ([PR #19865](https://github.com/microsoft/fluentui/pull/19865) by beachball)
31
+ - Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.13 ([PR #19865](https://github.com/microsoft/fluentui/pull/19865) by beachball)
19
32
 
20
33
  ## [9.0.0-alpha.41](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.0.0-alpha.41)
21
34
 
package/lib/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"../src/","sources":["Label.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './components/Label/index';\n"]}
1
+ {"version":3,"file":"Label.js","sourceRoot":"","sources":["../src/Label.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE;AAH+C,GAA7D;AAMA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourcesContent":["import { isConformant as baseIsConformant } from '@fluentui/react-conformance';\nimport type { IsConformantOptions, TestObject } from '@fluentui/react-conformance';\nimport makeStylesTests from '@fluentui/react-conformance-make-styles';\n\nexport function isConformant<TProps = {}>(\n testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },\n) {\n const defaultOptions: Partial<IsConformantOptions<TProps>> = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n extraTests: makeStylesTests as TestObject<TProps>,\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE;AAH+C,GAA7D;AAMA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,YAAzB;AACA,SAAS,WAAT,QAA4B,eAA5B;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAGA;;AAEG;;AACH,OAAO,IAAM,KAAK,gBAAG,KAAK,CAAC,UAAN,CAA0C,UAAC,KAAD,EAAQ,GAAR,EAAW;AACxE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAD,EAAQ,GAAR,CAAtB;AAEA,EAAA,cAAc,CAAC,KAAD,CAAd;AACA,SAAO,WAAW,CAAC,KAAD,CAAlB;AACD,CALoB,CAAd;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { useLabel } from './useLabel';\nimport { renderLabel } from './renderLabel';\nimport { useLabelStyles } from './useLabelStyles';\nimport type { LabelProps } from './Label.types';\n\n/**\n * A label component provides a title or name to a component.\n */\nexport const Label = React.forwardRef<HTMLElement, LabelProps>((props, ref) => {\n const state = useLabel(props, ref);\n\n useLabelStyles(state);\n return renderLabel(state);\n});\n\nLabel.displayName = 'Label';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,YAAzB;AACA,SAAS,WAAT,QAA4B,eAA5B;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAGA;;AAEG;;AACH,OAAO,IAAM,KAAK,gBAAG,KAAK,CAAC,UAAN,CAA0C,UAAC,KAAD,EAAQ,GAAR,EAAW;AACxE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAD,EAAQ,GAAR,CAAtB;AAEA,EAAA,cAAc,CAAC,KAAD,CAAd;AACA,SAAO,WAAW,CAAC,KAAD,CAAlB;AACD,CALoB,CAAd;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Label.types.js","sourceRoot":"../src/","sources":["components/Label/Label.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type {\n ComponentPropsCompat,\n ComponentStateCompat,\n ObjectShorthandPropsCompat,\n ShorthandPropsCompat,\n} from '@fluentui/react-utilities';\n\n/**\n * Label Props\n */\nexport type LabelProps = ComponentPropsCompat &\n React.LabelHTMLAttributes<HTMLLabelElement> & {\n /**\n * Renders the label as disabled\n * @defaultvalue false\n */\n disabled?: boolean;\n\n /**\n * Displays and indicator that the label is for a required field. The required prop can be set to true to display\n * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.\n * @defaultvalue false\n */\n required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;\n\n /**\n * A label supports different sizes.\n * @defaultvalue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * A label supports semibold/strong fontweight.\n * @defaultvalue false\n */\n strong?: boolean;\n };\n\n/**\n * Names of the shorthand properties in LabelProps\n */\nexport type LabelShorthandProps = 'required';\n\n/**\n * Names of LabelProps that have a default value in useLabel\n */\nexport type LabelDefaultedProps = 'size';\n\n/**\n * State used in rendering Label\n */\nexport type LabelState = ComponentStateCompat<LabelProps, LabelShorthandProps, LabelDefaultedProps> & {\n /**\n * Ref to the root element\n */\n ref: React.Ref<HTMLElement>;\n\n /**\n * The required prop resolved to a slot object\n */\n required?: ObjectShorthandPropsCompat<ComponentPropsCompat>;\n};\n"]}
1
+ {"version":3,"file":"Label.types.js","sourceRoot":"","sources":["../../../src/components/Label/Label.types.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Label/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Label';\nexport * from './Label.types';\nexport * from './renderLabel';\nexport * from './useLabel';\nexport * from './useLabelStyles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Label/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,mBAAT,QAAoC,YAApC;AAGA;;AAEG;;AACH,OAAO,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,mBAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,QAAN,iBAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFrB,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { labelShorthandProps } from './useLabel';\nimport type { LabelState } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel = (state: LabelState) => {\n const { slots, slotProps } = getSlotsCompat(state, labelShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n {state.children}\n {state.required && <slots.required {...slotProps.required} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,mBAAT,QAAoC,YAApC;AAGA;;AAEG;;AACH,OAAO,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,mBAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,QAAN,iBAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFrB,CADF;AAMD,CATM","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/useLabel.tsx"],"names":[],"mappings":";AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AAGA;;;AAGG;;AACH,OAAO,IAAM,mBAAmB,GAA0B,CAAC,UAAD,CAAnD;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAa;AAAE,EAAA,SAAS,EAAE;AAAb,CAAb,CAAjC;AAEA;;;;;;;;;AASG;;AACH,OAAO,IAAM,QAAQ,GAAG,UAAC,KAAD,EAAoB,GAApB,EAAiD,YAAjD,EAA0E;AAChG,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,OAFN;AAGE,IAAA,IAAI,EAAE,QAHR;AAIE,IAAA,QAAQ,EAAE;AACR,MAAA,EAAE,EAAE;AADI;AAJZ,GADsB,EAStB,YAAY,IAAI,0BAA0B,CAAC,YAAD,CATpB,EAUtB,0BAA0B,CAAC,KAAD,CAVJ,CAAxB;AAaA,SAAO,KAAP;AACD,CAfM;AAiBP;;;;AAIG;;AACH,IAAM,0BAA0B,GAAG,UAAC,KAAD,EAAkB;AACnD,MAAI,eAAJ;;AACA,MAAI,KAAK,CAAC,QAAN,KAAmB,IAAvB,EAA6B;AAC3B,IAAA,eAAe,GAAA,QAAA,CAAA,QAAA,CAAA,EAAA,EAAQ,KAAR,CAAA,EAAa;AAAE,MAAA,QAAQ,EAAE;AAAE,QAAA,QAAQ,EAAE;AAAZ;AAAZ,KAAb,CAAf;AACD,GAFD,MAEO,IAAI,KAAK,CAAC,QAAN,KAAmB,KAAvB,EAA8B;AACnC,IAAA,eAAe,GAAA,QAAA,CAAA,QAAA,CAAA,EAAA,EAAQ,KAAR,CAAA,EAAa;AAAE,MAAA,QAAQ,EAAE;AAAZ,KAAb,CAAf;AACD,GAFM,MAEA;AACL;AACA,IAAA,eAAe,GAAG,KAAlB;AACD;;AAED,SAAO,qBAAqB,CAAC,eAAD,EAAkB,mBAAlB,CAA5B;AACD,CAZD","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelShorthandProps, LabelState } from './Label.types';\n\n/**\n * Array of all shorthand properties listed in LabelShorthandProps\n * {@docCatergory Label}\n */\nexport const labelShorthandProps: LabelShorthandProps[] = ['required'];\n\nconst mergeProps = makeMergeProps<LabelState>({ deepMerge: labelShorthandProps });\n\n/**\n * Create the state required to render Label.\n *\n * The returned state can be modified with hooks such as useLabelStyles,\n * before being passed to renderLabel.\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const useLabel = (props: LabelProps, ref: React.Ref<HTMLElement>, defaultProps?: LabelProps): LabelState => {\n const state = mergeProps(\n {\n ref,\n as: 'label',\n size: 'medium',\n required: {\n as: 'span',\n },\n },\n defaultProps && resolveLabelShorthandProps(defaultProps),\n resolveLabelShorthandProps(props),\n );\n\n return state;\n};\n\n/**\n * Label will first need to check if required is a boolean or shorthandprops,\n * this allows for the required prop to handle both the default asterisk for required\n * or a custom required text.\n */\nconst resolveLabelShorthandProps = (props: LabelProps) => {\n let propsNormalized;\n if (props.required === true) {\n propsNormalized = { ...props, required: { children: '*' } };\n } else if (props.required === false) {\n propsNormalized = { ...props, required: undefined };\n } else {\n // TypeScript needs a nudge to figure out that props.required won't be a boolean here\n propsNormalized = props as LabelProps & { required?: Exclude<LabelProps['required'], boolean> };\n }\n\n return resolveShorthandProps(propsNormalized, labelShorthandProps);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":";AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AAGA;;;AAGG;;AACH,OAAO,IAAM,mBAAmB,GAA0B,CAAC,UAAD,CAAnD;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAa;AAAE,EAAA,SAAS,EAAE;AAAb,CAAb,CAAjC;AAEA;;;;;;;;;AASG;;AACH,OAAO,IAAM,QAAQ,GAAG,UAAC,KAAD,EAAoB,GAApB,EAAiD,YAAjD,EAA0E;AAChG,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,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UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,MAAM,CAAC,IADqB,EAE5B,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFG,EAG5B,MAAM,CAAC,KAAK,CAAC,IAAP,CAHsB,EAI5B,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJK,EAK5B,KAAK,CAAC,SALsB,CAA9B;;AAQA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,MAAM,CAAC,QAAR,EAAkB,KAAK,CAAC,QAAN,CAAe,SAAjC,CAAvC;AACD;;AAED,SAAO,KAAP;AACD,CAfM","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { LabelState } from './Label.types';\n\n/**\n * Styles for the label\n */\nconst useStyles = makeStyles({\n root: theme => ({\n fontFamily: theme.global.type.fontFamilies.base,\n color: theme.alias.color.neutral.neutralForeground1,\n }),\n\n disabled: theme => ({\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n }),\n\n required: theme => ({\n color: theme.alias.color.red.foreground3,\n paddingLeft: '4px', // TODO: Once spacing tokens are added, change this to Horizontal XS\n }),\n\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n lineHeight: theme.global.type.lineHeights.base[200],\n }),\n\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n\n strong: theme => ({\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n});\n\n/**\n * Apply styling to the Label slots based on the state\n */\nexport const useLabelStyles = (state: LabelState): LabelState => {\n const styles = useStyles();\n state.className = mergeClasses(\n styles.root,\n state.disabled && styles.disabled,\n styles[state.size],\n state.strong && styles.strong,\n state.className,\n );\n\n if (state.required) {\n state.required.className = mergeClasses(styles.required, state.required.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA;;AAEG;;AACH,IAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAoCA;;AAEG;;;AACH,OAAO,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,MAAM,CAAC,IADqB,EAE5B,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFG,EAG5B,MAAM,CAAC,KAAK,CAAC,IAAP,CAHsB,EAI5B,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJK,EAK5B,KAAK,CAAC,SALsB,CAA9B;;AAQA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,MAAM,CAAC,QAAR,EAAkB,KAAK,CAAC,QAAN,CAAe,SAAjC,CAAvC;AACD;;AAED,SAAO,KAAP;AACD,CAfM","sourceRoot":""}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC","sourcesContent":["// TODO: replace with real exports\nexport {};\nexport * from './Label';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["Label.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Label/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/Label.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,IAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE,+BAAA,CAAA;AAH+C,GAA7D;AAMA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAVD,OAAA,CAAA,YAAA,GAAA,YAAA","sourcesContent":["import { isConformant as baseIsConformant } from '@fluentui/react-conformance';\nimport type { IsConformantOptions, TestObject } from '@fluentui/react-conformance';\nimport makeStylesTests from '@fluentui/react-conformance-make-styles';\n\nexport function isConformant<TProps = {}>(\n testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },\n) {\n const defaultOptions: Partial<IsConformantOptions<TProps>> = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n extraTests: makeStylesTests as TestObject<TProps>,\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,IAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE,+BAAA,CAAA;AAH+C,GAA7D;AAMA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAVD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAQ,KAAK,CAAC,UAAN,CAA0C,UAAC,KAAD,EAAQ,GAAR,EAAW;AACxE,MAAM,KAAK,GAAG,UAAA,CAAA,QAAA,CAAS,KAAT,EAAgB,GAAhB,CAAd;AAEA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AACA,SAAO,aAAA,CAAA,WAAA,CAAY,KAAZ,CAAP;AACD,CALoB,CAAR;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { useLabel } from './useLabel';\nimport { renderLabel } from './renderLabel';\nimport { useLabelStyles } from './useLabelStyles';\nimport type { LabelProps } from './Label.types';\n\n/**\n * A label component provides a title or name to a component.\n */\nexport const Label = React.forwardRef<HTMLElement, LabelProps>((props, ref) => {\n const state = useLabel(props, ref);\n\n useLabelStyles(state);\n return renderLabel(state);\n});\n\nLabel.displayName = 'Label';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAQ,KAAK,CAAC,UAAN,CAA0C,UAAC,KAAD,EAAQ,GAAR,EAAW;AACxE,MAAM,KAAK,GAAG,UAAA,CAAA,QAAA,CAAS,KAAT,EAAgB,GAAhB,CAAd;AAEA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AACA,SAAO,aAAA,CAAA,WAAA,CAAY,KAAZ,CAAP;AACD,CALoB,CAAR;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Label';\nexport * from './Label.types';\nexport * from './renderLabel';\nexport * from './useLabel';\nexport * from './useLabelStyles';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,UAAA,CAAA,mBAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFrB,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { labelShorthandProps } from './useLabel';\nimport type { LabelState } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel = (state: LabelState) => {\n const { slots, slotProps } = getSlotsCompat(state, labelShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n {state.children}\n {state.required && <slots.required {...slotProps.required} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,UAAA,CAAA,mBAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFrB,CADF;AAMD,CATM;;AA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AAA,EAAQ,KAAR,CAAA,EAAa;AAAE,MAAA,QAAQ,EAAE;AAAZ,KAAb,CAAf;AACD,GAFM,MAEA;AACL;AACA,IAAA,eAAe,GAAG,KAAlB;AACD;;AAED,SAAO,iBAAA,CAAA,qBAAA,CAAsB,eAAtB,EAAuC,OAAA,CAAA,mBAAvC,CAAP;AACD,CAZD","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelShorthandProps, LabelState } from './Label.types';\n\n/**\n * Array of all shorthand properties listed in LabelShorthandProps\n * {@docCatergory Label}\n */\nexport const labelShorthandProps: LabelShorthandProps[] = ['required'];\n\nconst mergeProps = makeMergeProps<LabelState>({ deepMerge: labelShorthandProps });\n\n/**\n * Create the state required to render Label.\n *\n * The returned state can be modified with hooks such as useLabelStyles,\n * before being passed to renderLabel.\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const useLabel = (props: LabelProps, ref: React.Ref<HTMLElement>, defaultProps?: LabelProps): LabelState => {\n const state = mergeProps(\n {\n ref,\n as: 'label',\n size: 'medium',\n required: {\n as: 'span',\n },\n },\n defaultProps && resolveLabelShorthandProps(defaultProps),\n resolveLabelShorthandProps(props),\n );\n\n return state;\n};\n\n/**\n * Label will first need to check if required is a boolean or shorthandprops,\n * this allows for the required prop to handle both the default asterisk for required\n * or a custom required text.\n */\nconst resolveLabelShorthandProps = (props: LabelProps) => {\n let propsNormalized;\n if (props.required === true) {\n propsNormalized = { ...props, required: { children: '*' } };\n } else if (props.required === false) {\n propsNormalized = { ...props, required: undefined };\n } else {\n // TypeScript needs a nudge to figure out that props.required won't be a boolean here\n propsNormalized = props as LabelProps & { required?: Exclude<LabelProps['required'], boolean> };\n }\n\n return resolveShorthandProps(propsNormalized, labelShorthandProps);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/useLabel.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A;AACL;AACA,IAAA,eAAe,GAAG,KAAlB;AACD;;AAED,SAAO,iBAAA,CAAA,qBAAA,CAAsB,eAAtB,EAAuC,OAAA,CAAA,mBAAvC,CAAP;AACD,CAZD","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAGA;;AAEG;;;AACH,IAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAoCA;;AAEG;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,SAAN,GAAkB,mBAAA,CAAA,YAAA,CAChB,MAAM,CAAC,IADS,EAEhB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFT,EAGhB,MAAM,CAAC,KAAK,CAAC,IAAP,CAHU,EAIhB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJP,EAKhB,KAAK,CAAC,SALU,CAAlB;;AAQA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,MAAM,CAAC,QAApB,EAA8B,KAAK,CAAC,QAAN,CAAe,SAA7C,CAA3B;AACD;;AAED,SAAO,KAAP;AACD,CAfM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { LabelState } from './Label.types';\n\n/**\n * Styles for the label\n */\nconst useStyles = makeStyles({\n root: theme => ({\n fontFamily: theme.global.type.fontFamilies.base,\n color: theme.alias.color.neutral.neutralForeground1,\n }),\n\n disabled: theme => ({\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n }),\n\n required: theme => ({\n color: theme.alias.color.red.foreground3,\n paddingLeft: '4px', // TODO: Once spacing tokens are added, change this to Horizontal XS\n }),\n\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n lineHeight: theme.global.type.lineHeights.base[200],\n }),\n\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n\n strong: theme => ({\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n});\n\n/**\n * Apply styling to the Label slots based on the state\n */\nexport const useLabelStyles = (state: LabelState): LabelState => {\n const styles = useStyles();\n state.className = mergeClasses(\n styles.root,\n state.disabled && styles.disabled,\n styles[state.size],\n state.strong && styles.strong,\n state.className,\n );\n\n if (state.required) {\n state.required.className = mergeClasses(styles.required, state.required.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAGA;;AAEG;;;AACH,IAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAoCA;;AAEG;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,SAAN,GAAkB,mBAAA,CAAA,YAAA,CAChB,MAAM,CAAC,IADS,EAEhB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFT,EAGhB,MAAM,CAAC,KAAK,CAAC,IAAP,CAHU,EAIhB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJP,EAKhB,KAAK,CAAC,SALU,CAAlB;;AAQA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,MAAM,CAAC,QAApB,EAA8B,KAAK,CAAC,QAAN,CAAe,SAA7C,CAA3B;AACD;;AAED,SAAO,KAAP;AACD,CAfM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAEA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourcesContent":["// TODO: replace with real exports\nexport {};\nexport * from './Label';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAEA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-label",
3
- "version": "9.0.0-alpha.42",
3
+ "version": "9.0.0-alpha.43",
4
4
  "description": "Label component for FluentUI library.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -25,11 +25,11 @@
25
25
  "storybook": "start-storybook"
26
26
  },
27
27
  "devDependencies": {
28
- "@fluentui/babel-make-styles": "9.0.0-alpha.51",
28
+ "@fluentui/babel-make-styles": "9.0.0-alpha.52",
29
29
  "@fluentui/eslint-plugin": "*",
30
- "@fluentui/jest-serializer-make-styles": "9.0.0-alpha.44",
30
+ "@fluentui/jest-serializer-make-styles": "9.0.0-alpha.45",
31
31
  "@fluentui/react-conformance": "*",
32
- "@fluentui/react-conformance-make-styles": "9.0.0-alpha.13",
32
+ "@fluentui/react-conformance-make-styles": "9.0.0-alpha.14",
33
33
  "@fluentui/scripts": "^1.0.0",
34
34
  "@types/enzyme": "3.10.3",
35
35
  "@types/enzyme-adapter-react-16": "1.0.3",
@@ -43,8 +43,8 @@
43
43
  "react-test-renderer": "^16.3.0"
44
44
  },
45
45
  "dependencies": {
46
- "@fluentui/react-make-styles": "9.0.0-alpha.69",
47
- "@fluentui/react-utilities": "9.0.0-alpha.49",
46
+ "@fluentui/react-make-styles": "9.0.0-alpha.70",
47
+ "@fluentui/react-utilities": "9.0.0-alpha.50",
48
48
  "tslib": "^2.1.0"
49
49
  },
50
50
  "peerDependencies": {
@@ -1 +0,0 @@
1
- export * from './components/Label/index';
package/lib-amd/Label.js DELETED
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/Label/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=Label.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"../src/","sources":["Label.ts"],"names":[],"mappings":";;;IAAA,uCAAyC","sourcesContent":["export * from './components/Label/index';\n"]}
@@ -1,4 +0,0 @@
1
- import type { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
- componentPath?: string;
4
- }): void;
@@ -1,15 +0,0 @@
1
- define(["require", "exports", "@fluentui/react-conformance", "@fluentui/react-conformance-make-styles"], function (require, exports, react_conformance_1, react_conformance_make_styles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isConformant = void 0;
5
- function isConformant(testInfo) {
6
- var defaultOptions = {
7
- asPropHandlesRef: true,
8
- componentPath: module.parent.filename.replace('.test', ''),
9
- extraTests: react_conformance_make_styles_1.default,
10
- };
11
- react_conformance_1.isConformant(defaultOptions, testInfo);
12
- }
13
- exports.isConformant = isConformant;
14
- });
15
- //# sourceMappingURL=isConformant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":";;;;IAIA,SAAgB,YAAY,CAC1B,QAAyF;QAEzF,IAAM,cAAc,GAAyC;YAC3D,gBAAgB,EAAE,IAAI;YACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5D,UAAU,EAAE,uCAAqC;SAClD,CAAC;QAEF,gCAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAVD,oCAUC","sourcesContent":["import { isConformant as baseIsConformant } from '@fluentui/react-conformance';\nimport type { IsConformantOptions, TestObject } from '@fluentui/react-conformance';\nimport makeStylesTests from '@fluentui/react-conformance-make-styles';\n\nexport function isConformant<TProps = {}>(\n testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },\n) {\n const defaultOptions: Partial<IsConformantOptions<TProps>> = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n extraTests: makeStylesTests as TestObject<TProps>,\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * A label component provides a title or name to a component.
4
- */
5
- export declare const Label: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentPropsCompat & React.LabelHTMLAttributes<HTMLLabelElement> & {
6
- disabled?: boolean | undefined;
7
- required?: string | number | boolean | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | import("@fluentui/react-utilities").ObjectShorthandPropsCompat<import("@fluentui/react-utilities").ComponentPropsCompat> | null | undefined;
8
- size?: "small" | "medium" | "large" | undefined;
9
- strong?: boolean | undefined;
10
- } & React.RefAttributes<HTMLElement>>;
@@ -1,15 +0,0 @@
1
- define(["require", "exports", "react", "./useLabel", "./renderLabel", "./useLabelStyles"], function (require, exports, React, useLabel_1, renderLabel_1, useLabelStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Label = void 0;
5
- /**
6
- * A label component provides a title or name to a component.
7
- */
8
- exports.Label = React.forwardRef(function (props, ref) {
9
- var state = useLabel_1.useLabel(props, ref);
10
- useLabelStyles_1.useLabelStyles(state);
11
- return renderLabel_1.renderLabel(state);
12
- });
13
- exports.Label.displayName = 'Label';
14
- });
15
- //# sourceMappingURL=Label.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"../src/","sources":["components/Label/Label.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACU,QAAA,KAAK,GAAG,KAAK,CAAC,UAAU,CAA0B,UAAC,KAAK,EAAE,GAAG;QACxE,IAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEnC,+BAAc,CAAC,KAAK,CAAC,CAAC;QACtB,OAAO,yBAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC","sourcesContent":["import * as React from 'react';\nimport { useLabel } from './useLabel';\nimport { renderLabel } from './renderLabel';\nimport { useLabelStyles } from './useLabelStyles';\nimport type { LabelProps } from './Label.types';\n\n/**\n * A label component provides a title or name to a component.\n */\nexport const Label = React.forwardRef<HTMLElement, LabelProps>((props, ref) => {\n const state = useLabel(props, ref);\n\n useLabelStyles(state);\n return renderLabel(state);\n});\n\nLabel.displayName = 'Label';\n"]}
@@ -1,49 +0,0 @@
1
- import * as React from 'react';
2
- import type { ComponentPropsCompat, ComponentStateCompat, ObjectShorthandPropsCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
3
- /**
4
- * Label Props
5
- */
6
- export declare type LabelProps = ComponentPropsCompat & React.LabelHTMLAttributes<HTMLLabelElement> & {
7
- /**
8
- * Renders the label as disabled
9
- * @defaultvalue false
10
- */
11
- disabled?: boolean;
12
- /**
13
- * Displays and indicator that the label is for a required field. The required prop can be set to true to display
14
- * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
15
- * @defaultvalue false
16
- */
17
- required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;
18
- /**
19
- * A label supports different sizes.
20
- * @defaultvalue 'medium'
21
- */
22
- size?: 'small' | 'medium' | 'large';
23
- /**
24
- * A label supports semibold/strong fontweight.
25
- * @defaultvalue false
26
- */
27
- strong?: boolean;
28
- };
29
- /**
30
- * Names of the shorthand properties in LabelProps
31
- */
32
- export declare type LabelShorthandProps = 'required';
33
- /**
34
- * Names of LabelProps that have a default value in useLabel
35
- */
36
- export declare type LabelDefaultedProps = 'size';
37
- /**
38
- * State used in rendering Label
39
- */
40
- export declare type LabelState = ComponentStateCompat<LabelProps, LabelShorthandProps, LabelDefaultedProps> & {
41
- /**
42
- * Ref to the root element
43
- */
44
- ref: React.Ref<HTMLElement>;
45
- /**
46
- * The required prop resolved to a slot object
47
- */
48
- required?: ObjectShorthandPropsCompat<ComponentPropsCompat>;
49
- };
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Label.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Label.types.js","sourceRoot":"../src/","sources":["components/Label/Label.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type {\n ComponentPropsCompat,\n ComponentStateCompat,\n ObjectShorthandPropsCompat,\n ShorthandPropsCompat,\n} from '@fluentui/react-utilities';\n\n/**\n * Label Props\n */\nexport type LabelProps = ComponentPropsCompat &\n React.LabelHTMLAttributes<HTMLLabelElement> & {\n /**\n * Renders the label as disabled\n * @defaultvalue false\n */\n disabled?: boolean;\n\n /**\n * Displays and indicator that the label is for a required field. The required prop can be set to true to display\n * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.\n * @defaultvalue false\n */\n required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;\n\n /**\n * A label supports different sizes.\n * @defaultvalue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * A label supports semibold/strong fontweight.\n * @defaultvalue false\n */\n strong?: boolean;\n };\n\n/**\n * Names of the shorthand properties in LabelProps\n */\nexport type LabelShorthandProps = 'required';\n\n/**\n * Names of LabelProps that have a default value in useLabel\n */\nexport type LabelDefaultedProps = 'size';\n\n/**\n * State used in rendering Label\n */\nexport type LabelState = ComponentStateCompat<LabelProps, LabelShorthandProps, LabelDefaultedProps> & {\n /**\n * Ref to the root element\n */\n ref: React.Ref<HTMLElement>;\n\n /**\n * The required prop resolved to a slot object\n */\n required?: ObjectShorthandPropsCompat<ComponentPropsCompat>;\n};\n"]}
@@ -1,5 +0,0 @@
1
- export * from './Label';
2
- export * from './Label.types';
3
- export * from './renderLabel';
4
- export * from './useLabel';
5
- export * from './useLabelStyles';
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Label", "./Label.types", "./renderLabel", "./useLabel", "./useLabelStyles"], function (require, exports, tslib_1, Label_1, Label_types_1, renderLabel_1, useLabel_1, useLabelStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Label_1, exports);
5
- tslib_1.__exportStar(Label_types_1, exports);
6
- tslib_1.__exportStar(renderLabel_1, exports);
7
- tslib_1.__exportStar(useLabel_1, exports);
8
- tslib_1.__exportStar(useLabelStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Label/index.ts"],"names":[],"mappings":";;;IAAA,uCAAwB;IACxB,6CAA8B;IAC9B,6CAA8B;IAC9B,0CAA2B;IAC3B,gDAAiC","sourcesContent":["export * from './Label';\nexport * from './Label.types';\nexport * from './renderLabel';\nexport * from './useLabel';\nexport * from './useLabelStyles';\n"]}
@@ -1,5 +0,0 @@
1
- import type { LabelState } from './Label.types';
2
- /**
3
- * Render the final JSX of Label
4
- */
5
- export declare const renderLabel: (state: LabelState) => JSX.Element;
@@ -1,16 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./useLabel"], function (require, exports, tslib_1, React, react_utilities_1, useLabel_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderLabel = void 0;
5
- /**
6
- * Render the final JSX of Label
7
- */
8
- var renderLabel = function (state) {
9
- var _a = react_utilities_1.getSlotsCompat(state, useLabel_1.labelShorthandProps), slots = _a.slots, slotProps = _a.slotProps;
10
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
- state.children,
12
- state.required && React.createElement(slots.required, tslib_1.__assign({}, slotProps.required))));
13
- };
14
- exports.renderLabel = renderLabel;
15
- });
16
- //# sourceMappingURL=renderLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderLabel.js","sourceRoot":"../src/","sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,WAAW,GAAG,UAAC,KAAiB;QACrC,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,8BAAmB,CAAC,EAA/D,KAAK,WAAA,EAAE,SAAS,eAA+C,CAAC;QAExE,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CAClD,CACd,CAAC;IACJ,CAAC,CAAC;IATW,QAAA,WAAW,eAStB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { labelShorthandProps } from './useLabel';\nimport type { LabelState } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel = (state: LabelState) => {\n const { slots, slotProps } = getSlotsCompat(state, labelShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n {state.children}\n {state.required && <slots.required {...slotProps.required} />}\n </slots.root>\n );\n};\n"]}
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import type { LabelProps, LabelShorthandProps, LabelState } from './Label.types';
3
- /**
4
- * Array of all shorthand properties listed in LabelShorthandProps
5
- * {@docCatergory Label}
6
- */
7
- export declare const labelShorthandProps: LabelShorthandProps[];
8
- /**
9
- * Create the state required to render Label.
10
- *
11
- * The returned state can be modified with hooks such as useLabelStyles,
12
- * before being passed to renderLabel.
13
- *
14
- * @param props - props from this instance of Label
15
- * @param ref - reference to root HTMLElement of Label
16
- * @param defaultProps - (optional) default prop values provided by the implementing type
17
- */
18
- export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement>, defaultProps?: LabelProps | undefined) => LabelState;
@@ -1,53 +0,0 @@
1
- define(["require", "exports", "tslib", "@fluentui/react-utilities"], function (require, exports, tslib_1, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useLabel = exports.labelShorthandProps = void 0;
5
- /**
6
- * Array of all shorthand properties listed in LabelShorthandProps
7
- * {@docCatergory Label}
8
- */
9
- exports.labelShorthandProps = ['required'];
10
- var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.labelShorthandProps });
11
- /**
12
- * Create the state required to render Label.
13
- *
14
- * The returned state can be modified with hooks such as useLabelStyles,
15
- * before being passed to renderLabel.
16
- *
17
- * @param props - props from this instance of Label
18
- * @param ref - reference to root HTMLElement of Label
19
- * @param defaultProps - (optional) default prop values provided by the implementing type
20
- */
21
- var useLabel = function (props, ref, defaultProps) {
22
- var state = mergeProps({
23
- ref: ref,
24
- as: 'label',
25
- size: 'medium',
26
- required: {
27
- as: 'span',
28
- },
29
- }, defaultProps && resolveLabelShorthandProps(defaultProps), resolveLabelShorthandProps(props));
30
- return state;
31
- };
32
- exports.useLabel = useLabel;
33
- /**
34
- * Label will first need to check if required is a boolean or shorthandprops,
35
- * this allows for the required prop to handle both the default asterisk for required
36
- * or a custom required text.
37
- */
38
- var resolveLabelShorthandProps = function (props) {
39
- var propsNormalized;
40
- if (props.required === true) {
41
- propsNormalized = tslib_1.__assign(tslib_1.__assign({}, props), { required: { children: '*' } });
42
- }
43
- else if (props.required === false) {
44
- propsNormalized = tslib_1.__assign(tslib_1.__assign({}, props), { required: undefined });
45
- }
46
- else {
47
- // TypeScript needs a nudge to figure out that props.required won't be a boolean here
48
- propsNormalized = props;
49
- }
50
- return react_utilities_1.resolveShorthandProps(propsNormalized, exports.labelShorthandProps);
51
- };
52
- });
53
- //# sourceMappingURL=useLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLabel.js","sourceRoot":"../src/","sources":["components/Label/useLabel.tsx"],"names":[],"mappings":";;;;IAIA;;;OAGG;IACU,QAAA,mBAAmB,GAA0B,CAAC,UAAU,CAAC,CAAC;IAEvE,IAAM,UAAU,GAAG,gCAAc,CAAa,EAAE,SAAS,EAAE,2BAAmB,EAAE,CAAC,CAAC;IAElF;;;;;;;;;OASG;IACI,IAAM,QAAQ,GAAG,UAAC,KAAiB,EAAE,GAA2B,EAAE,YAAyB;QAChG,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE;gBACR,EAAE,EAAE,MAAM;aACX;SACF,EACD,YAAY,IAAI,0BAA0B,CAAC,YAAY,CAAC,EACxD,0BAA0B,CAAC,KAAK,CAAC,CAClC,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAfW,QAAA,QAAQ,YAenB;IAEF;;;;OAIG;IACH,IAAM,0BAA0B,GAAG,UAAC,KAAiB;QACnD,IAAI,eAAe,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC3B,eAAe,yCAAQ,KAAK,KAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;SAC7D;aAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE;YACnC,eAAe,yCAAQ,KAAK,KAAE,QAAQ,EAAE,SAAS,GAAE,CAAC;SACrD;aAAM;YACL,qFAAqF;YACrF,eAAe,GAAG,KAA6E,CAAC;SACjG;QAED,OAAO,uCAAqB,CAAC,eAAe,EAAE,2BAAmB,CAAC,CAAC;IACrE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelShorthandProps, LabelState } from './Label.types';\n\n/**\n * Array of all shorthand properties listed in LabelShorthandProps\n * {@docCatergory Label}\n */\nexport const labelShorthandProps: LabelShorthandProps[] = ['required'];\n\nconst mergeProps = makeMergeProps<LabelState>({ deepMerge: labelShorthandProps });\n\n/**\n * Create the state required to render Label.\n *\n * The returned state can be modified with hooks such as useLabelStyles,\n * before being passed to renderLabel.\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const useLabel = (props: LabelProps, ref: React.Ref<HTMLElement>, defaultProps?: LabelProps): LabelState => {\n const state = mergeProps(\n {\n ref,\n as: 'label',\n size: 'medium',\n required: {\n as: 'span',\n },\n },\n defaultProps && resolveLabelShorthandProps(defaultProps),\n resolveLabelShorthandProps(props),\n );\n\n return state;\n};\n\n/**\n * Label will first need to check if required is a boolean or shorthandprops,\n * this allows for the required prop to handle both the default asterisk for required\n * or a custom required text.\n */\nconst resolveLabelShorthandProps = (props: LabelProps) => {\n let propsNormalized;\n if (props.required === true) {\n propsNormalized = { ...props, required: { children: '*' } };\n } else if (props.required === false) {\n propsNormalized = { ...props, required: undefined };\n } else {\n // TypeScript needs a nudge to figure out that props.required won't be a boolean here\n propsNormalized = props as LabelProps & { required?: Exclude<LabelProps['required'], boolean> };\n }\n\n return resolveShorthandProps(propsNormalized, labelShorthandProps);\n};\n"]}
@@ -1,5 +0,0 @@
1
- import type { LabelState } from './Label.types';
2
- /**
3
- * Apply styling to the Label slots based on the state
4
- */
5
- export declare const useLabelStyles: (state: LabelState) => LabelState;
@@ -1,50 +0,0 @@
1
- define(["require", "exports", "@fluentui/react-make-styles"], function (require, exports, react_make_styles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useLabelStyles = void 0;
5
- /**
6
- * Styles for the label
7
- */
8
- var useStyles = react_make_styles_1.makeStyles({
9
- root: function (theme) { return ({
10
- fontFamily: theme.global.type.fontFamilies.base,
11
- color: theme.alias.color.neutral.neutralForeground1,
12
- }); },
13
- disabled: function (theme) { return ({
14
- color: theme.alias.color.neutral.neutralForegroundDisabled,
15
- }); },
16
- required: function (theme) { return ({
17
- color: theme.alias.color.red.foreground3,
18
- paddingLeft: '4px',
19
- }); },
20
- small: function (theme) { return ({
21
- fontSize: theme.global.type.fontSizes.base[200],
22
- lineHeight: theme.global.type.lineHeights.base[200],
23
- }); },
24
- medium: function (theme) { return ({
25
- fontSize: theme.global.type.fontSizes.base[300],
26
- lineHeight: theme.global.type.lineHeights.base[300],
27
- }); },
28
- large: function (theme) { return ({
29
- fontSize: theme.global.type.fontSizes.base[400],
30
- lineHeight: theme.global.type.lineHeights.base[400],
31
- fontWeight: theme.global.type.fontWeights.semibold,
32
- }); },
33
- strong: function (theme) { return ({
34
- fontWeight: theme.global.type.fontWeights.semibold,
35
- }); },
36
- });
37
- /**
38
- * Apply styling to the Label slots based on the state
39
- */
40
- var useLabelStyles = function (state) {
41
- var styles = useStyles();
42
- state.className = react_make_styles_1.mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.className);
43
- if (state.required) {
44
- state.required.className = react_make_styles_1.mergeClasses(styles.required, state.required.className);
45
- }
46
- return state;
47
- };
48
- exports.useLabelStyles = useLabelStyles;
49
- });
50
- //# sourceMappingURL=useLabelStyles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLabelStyles.js","sourceRoot":"../src/","sources":["components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACH,IAAM,SAAS,GAAG,8BAAU,CAAC;QAC3B,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACd,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI;YAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;SACpD,CAAC,EAHa,CAGb;QAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;SAC3D,CAAC,EAFiB,CAEjB;QAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW;YACxC,WAAW,EAAE,KAAK;SACnB,CAAC,EAHiB,CAGjB;QAEF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACf,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YAC/C,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;SACpD,CAAC,EAHc,CAGd;QAEF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAChB,QAAQ,EAAE,KAAK,CAAC,MAAM,C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["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { LabelState } from './Label.types';\n\n/**\n * Styles for the label\n */\nconst useStyles = makeStyles({\n root: theme => ({\n fontFamily: theme.global.type.fontFamilies.base,\n color: theme.alias.color.neutral.neutralForeground1,\n }),\n\n disabled: theme => ({\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n }),\n\n required: theme => ({\n color: theme.alias.color.red.foreground3,\n paddingLeft: '4px', // TODO: Once spacing tokens are added, change this to Horizontal XS\n }),\n\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n lineHeight: theme.global.type.lineHeights.base[200],\n }),\n\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n\n strong: theme => ({\n fontWeight: theme.global.type.fontWeights.semibold,\n }),\n});\n\n/**\n * Apply styling to the Label slots based on the state\n */\nexport const useLabelStyles = (state: LabelState): LabelState => {\n const styles = useStyles();\n state.className = mergeClasses(\n styles.root,\n state.disabled && styles.disabled,\n styles[state.size],\n state.strong && styles.strong,\n state.className,\n );\n\n if (state.required) {\n state.required.className = mergeClasses(styles.required, state.required.className);\n }\n\n return state;\n};\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- export * from './Label';
package/lib-amd/index.js DELETED
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./Label"], function (require, exports, tslib_1, Label_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Label_1, exports);
5
- });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAEA,uCAAwB","sourcesContent":["// TODO: replace with real exports\nexport {};\nexport * from './Label';\n"]}