@fluentui/react-label 9.0.0-alpha.9 → 9.0.0-beta.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/CHANGELOG.json +1644 -1
  2. package/CHANGELOG.md +570 -9
  3. package/README.md +2 -1
  4. package/Spec.md +23 -33
  5. package/dist/index.d.ts +81 -0
  6. package/lib/components/Label/Label.d.ts +3 -4
  7. package/lib/components/Label/Label.js +8 -8
  8. package/lib/components/Label/Label.js.map +1 -1
  9. package/lib/components/Label/Label.types.d.ts +20 -35
  10. package/lib/components/Label/Label.types.js.map +1 -1
  11. package/lib/components/Label/renderLabel.d.ts +2 -3
  12. package/lib/components/Label/renderLabel.js +9 -8
  13. package/lib/components/Label/renderLabel.js.map +1 -1
  14. package/lib/components/Label/useLabel.d.ts +4 -12
  15. package/lib/components/Label/useLabel.js +30 -42
  16. package/lib/components/Label/useLabel.js.map +1 -1
  17. package/lib/components/Label/useLabelStyles.d.ts +8 -2
  18. package/lib/components/Label/useLabelStyles.js +56 -35
  19. package/lib/components/Label/useLabelStyles.js.map +1 -1
  20. package/lib/index.d.ts +2 -2
  21. package/lib/index.js +2 -1
  22. package/lib/index.js.map +1 -1
  23. package/lib/tsdoc-metadata.json +1 -1
  24. package/lib-commonjs/Label.js +7 -2
  25. package/lib-commonjs/Label.js.map +1 -1
  26. package/lib-commonjs/components/Label/Label.d.ts +3 -4
  27. package/lib-commonjs/components/Label/Label.js +18 -10
  28. package/lib-commonjs/components/Label/Label.js.map +1 -1
  29. package/lib-commonjs/components/Label/Label.types.d.ts +20 -35
  30. package/lib-commonjs/components/Label/Label.types.js +4 -1
  31. package/lib-commonjs/components/Label/Label.types.js.map +1 -1
  32. package/lib-commonjs/components/Label/index.js +11 -2
  33. package/lib-commonjs/components/Label/index.js.map +1 -1
  34. package/lib-commonjs/components/Label/renderLabel.d.ts +2 -3
  35. package/lib-commonjs/components/Label/renderLabel.js +21 -13
  36. package/lib-commonjs/components/Label/renderLabel.js.map +1 -1
  37. package/lib-commonjs/components/Label/useLabel.d.ts +4 -12
  38. package/lib-commonjs/components/Label/useLabel.js +40 -45
  39. package/lib-commonjs/components/Label/useLabel.js.map +1 -1
  40. package/lib-commonjs/components/Label/useLabelStyles.d.ts +8 -2
  41. package/lib-commonjs/components/Label/useLabelStyles.js +66 -38
  42. package/lib-commonjs/components/Label/useLabelStyles.js.map +1 -1
  43. package/lib-commonjs/index.d.ts +2 -2
  44. package/lib-commonjs/index.js +45 -3
  45. package/lib-commonjs/index.js.map +1 -1
  46. package/package.json +23 -23
  47. package/config/api-extractor.json +0 -3
  48. package/config/tests.js +0 -7
  49. package/dist/react-label.d.ts +0 -99
  50. package/etc/react-label.api.md +0 -51
  51. package/just.config.ts +0 -3
  52. package/lib/common/isConformant.d.ts +0 -4
  53. package/lib/common/isConformant.js +0 -9
  54. package/lib/common/isConformant.js.map +0 -1
  55. package/lib-amd/Label.d.ts +0 -1
  56. package/lib-amd/Label.js +0 -6
  57. package/lib-amd/Label.js.map +0 -1
  58. package/lib-amd/common/isConformant.d.ts +0 -4
  59. package/lib-amd/common/isConformant.js +0 -14
  60. package/lib-amd/common/isConformant.js.map +0 -1
  61. package/lib-amd/components/Label/Label.d.ts +0 -7
  62. package/lib-amd/components/Label/Label.js +0 -16
  63. package/lib-amd/components/Label/Label.js.map +0 -1
  64. package/lib-amd/components/Label/Label.types.d.ts +0 -53
  65. package/lib-amd/components/Label/Label.types.js +0 -5
  66. package/lib-amd/components/Label/Label.types.js.map +0 -1
  67. package/lib-amd/components/Label/index.d.ts +0 -5
  68. package/lib-amd/components/Label/index.js +0 -10
  69. package/lib-amd/components/Label/index.js.map +0 -1
  70. package/lib-amd/components/Label/renderLabel.d.ts +0 -6
  71. package/lib-amd/components/Label/renderLabel.js +0 -17
  72. package/lib-amd/components/Label/renderLabel.js.map +0 -1
  73. package/lib-amd/components/Label/useLabel.d.ts +0 -20
  74. package/lib-amd/components/Label/useLabel.js +0 -55
  75. package/lib-amd/components/Label/useLabel.js.map +0 -1
  76. package/lib-amd/components/Label/useLabelStyles.d.ts +0 -5
  77. package/lib-amd/components/Label/useLabelStyles.js +0 -49
  78. package/lib-amd/components/Label/useLabelStyles.js.map +0 -1
  79. package/lib-amd/index.d.ts +0 -2
  80. package/lib-amd/index.js +0 -6
  81. package/lib-amd/index.js.map +0 -1
  82. package/lib-commonjs/common/isConformant.d.ts +0 -4
  83. package/lib-commonjs/common/isConformant.js +0 -13
  84. package/lib-commonjs/common/isConformant.js.map +0 -1
  85. package/src/components/Label/Label.types.ts +0 -61
@@ -1,49 +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
- fontSize: theme.global.type.fontSizes.base[300],
12
- color: theme.alias.color.neutral.neutralForeground1,
13
- }); },
14
- disabled: function (theme) { return ({
15
- color: theme.alias.color.neutral.neutralForegroundDisabled,
16
- }); },
17
- required: function (theme) { return ({
18
- color: theme.alias.color.red.foreground3,
19
- // TODO: Once spacing tokens are added, change this to Horizontal XS
20
- paddingLeft: '4px',
21
- }); },
22
- small: function (theme) { return ({
23
- fontSize: theme.global.type.fontSizes.base[200],
24
- }); },
25
- medium: function (theme) { return ({
26
- fontSize: theme.global.type.fontSizes.base[300],
27
- }); },
28
- large: function (theme) { return ({
29
- fontSize: theme.global.type.fontSizes.base[400],
30
- fontWeight: theme.global.type.fontWeights.semibold,
31
- }); },
32
- strong: function (theme) { return ({
33
- fontWeight: theme.global.type.fontWeights.semibold,
34
- }); },
35
- });
36
- /**
37
- * Apply styling to the Label slots based on the state
38
- */
39
- var useLabelStyles = function (state) {
40
- var styles = useStyles();
41
- state.className = react_make_styles_1.mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.className);
42
- if (state.required) {
43
- state.required.className = react_make_styles_1.mergeClasses(styles.required, state.required.className);
44
- }
45
- return state;
46
- };
47
- exports.useLabelStyles = useLabelStyles;
48
- });
49
- //# 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,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;SACpD,CAAC,EAJa,CAIb;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,oEAAoE;YACpE,WAAW,EAAE,KAAK;SACnB,CAAC,EAJiB,CAIjB;QAEF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACf,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;SAChD,CAAC,EAFc,CAEd;QAEF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAChB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;SAChD,CAAC,EAFe,CAEf;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,QAAQ;SACnD,CAAC,EAHc,CAGd;QAEF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAChB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ;SACnD,CAAC,EAFe,CAEf;KACH,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,cAAc,GAAG,UAAC,KAAiB;QAC9C,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,SAAS,GAAG,gCAAY,CAC5B,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAClB,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAC7B,KAAK,CAAC,SAAS,CAChB,CAAC;QAEF,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,gCAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SACpF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAfW,QAAA,cAAc,kBAezB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { 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 fontSize: theme.global.type.fontSizes.base[300],\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 // TODO: Once spacing tokens are added, change this to Horizontal XS\n paddingLeft: '4px',\n }),\n\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n }),\n\n large: theme => ({\n fontSize: theme.global.type.fontSizes.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"]}
@@ -1,4 +0,0 @@
1
- import { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
- componentPath?: string;
4
- }): void;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isConformant = void 0;
4
- var react_conformance_1 = require("@fluentui/react-conformance");
5
- function isConformant(testInfo) {
6
- var defaultOptions = {
7
- asPropHandlesRef: true,
8
- componentPath: module.parent.filename.replace('.test', ''),
9
- };
10
- react_conformance_1.isConformant(defaultOptions, testInfo);
11
- }
12
- exports.isConformant = isConformant;
13
- //# sourceMappingURL=isConformant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":";;;AAAA,iEAAoG;AAEpG,SAAgB,YAAY,CAC1B,QAAyF;IAEzF,IAAM,cAAc,GAAyC;QAC3D,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;KAC7D,CAAC;IAEF,gCAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AATD,oCASC","sourcesContent":["import { isConformant as baseIsConformant, IsConformantOptions } from '@fluentui/react-conformance';\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 };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
@@ -1,61 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps, ComponentState, ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities';
3
-
4
- /**
5
- * Label Props
6
- * {@docCategory Label}
7
- */
8
- export interface LabelProps extends ComponentProps, React.LabelHTMLAttributes<HTMLLabelElement> {
9
- /**
10
- * Renders the label as disabled
11
- * @defaultvalue false
12
- */
13
- disabled?: boolean;
14
-
15
- /**
16
- * Displays and indicator that the label is for a required field. The required prop can be set to true to display
17
- * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
18
- * @defaultvalue false
19
- */
20
- required?: boolean | ShorthandProps<ComponentProps>;
21
-
22
- /**
23
- * A label supports different sizes.
24
- * @defaultvalue 'medium'
25
- */
26
- size?: 'small' | 'medium' | 'large';
27
-
28
- /**
29
- * A label supports semibold/strong fontweight.
30
- * @defaultvalue false
31
- */
32
- strong?: boolean;
33
- }
34
-
35
- /**
36
- * Names of the shorthand properties in LabelProps
37
- * {@docCategory Label}
38
- */
39
- export type LabelShorthandProps = 'required';
40
-
41
- /**
42
- * Names of LabelProps that have a default value in useLabel
43
- * {@docCategory Label}
44
- */
45
- export type LabelDefaultedProps = 'size';
46
-
47
- /**
48
- * State used in rendering Label
49
- * {@docCategory Label}
50
- */
51
- export interface LabelState extends ComponentState<LabelProps, LabelShorthandProps, LabelDefaultedProps> {
52
- /**
53
- * Ref to the root element
54
- */
55
- ref: React.Ref<HTMLElement>;
56
-
57
- /**
58
- * The required prop resolved to a slot object
59
- */
60
- required?: ObjectShorthandProps<ComponentProps>;
61
- }