@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
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export {};
2
- export * from './Label';
1
+ export { Label, labelClassName, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable, } from './Label';
2
+ export type { LabelProps, LabelSlots, LabelState } from './Label';
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from './Label';
1
+ export { Label, // eslint-disable-next-line deprecation/deprecation
2
+ labelClassName, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable } from './Label';
2
3
  //# sourceMappingURL=index.js.map
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,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,KADF,EAEE;AACA,cAHF,EAIE,eAJF,EAKE,oBALF,EAME,uBANF,EAOE,iBAPF,QAQO,SARP","sourcesContent":["export {\n Label,\n // eslint-disable-next-line deprecation/deprecation\n labelClassName,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n} from './Label';\nexport type { LabelProps, LabelSlots, LabelState } from './Label';\n"],"sourceRoot":"../src/"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.13.0"
8
+ "packageVersion": "7.18.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
4
9
  tslib_1.__exportStar(require("./components/Label/index"), exports);
5
10
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"../src/","sources":["Label.ts"],"names":[],"mappings":";;;AAAA,mEAAyC","sourcesContent":["export * from './components/Label/index';\n"]}
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,7 +1,6 @@
1
- import * as React from 'react';
2
- import { LabelProps } from './Label.types';
1
+ import type { LabelProps } from './Label.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * A label component provides a title or name to a component.
5
- * {@docCategory Label}
6
5
  */
7
- export declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLElement>>;
6
+ export declare const Label: ForwardRefComponent<LabelProps>;
@@ -1,18 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.Label = void 0;
4
- var React = require("react");
5
- var useLabel_1 = require("./useLabel");
6
- var renderLabel_1 = require("./renderLabel");
7
- var useLabelStyles_1 = require("./useLabelStyles");
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const useLabel_1 = /*#__PURE__*/require("./useLabel");
11
+
12
+ const renderLabel_1 = /*#__PURE__*/require("./renderLabel");
13
+
14
+ const useLabelStyles_1 = /*#__PURE__*/require("./useLabelStyles");
8
15
  /**
9
16
  * A label component provides a title or name to a component.
10
- * {@docCategory Label}
11
17
  */
12
- exports.Label = React.forwardRef(function (props, ref) {
13
- var state = useLabel_1.useLabel(props, ref);
14
- useLabelStyles_1.useLabelStyles(state);
15
- return renderLabel_1.renderLabel(state);
18
+
19
+
20
+ exports.Label = /*#__PURE__*/React.forwardRef((props, ref) => {
21
+ const state = useLabel_1.useLabel_unstable(props, ref);
22
+ useLabelStyles_1.useLabelStyles_unstable(state);
23
+ return renderLabel_1.renderLabel_unstable(state);
16
24
  });
17
25
  exports.Label.displayName = 'Label';
18
26
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"../src/","sources":["components/Label/Label.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAEtC,6CAA4C;AAC5C,mDAAkD;AAElD;;;GAGG;AACU,QAAA,KAAK,GAAG,KAAK,CAAC,UAAU,CAA0B,UAAC,KAAK,EAAE,GAAG;IACxE,IAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEnC,+BAAc,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,yBAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEH,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC","sourcesContent":["import * as React from 'react';\nimport { useLabel } from './useLabel';\nimport { LabelProps } from './Label.types';\nimport { renderLabel } from './renderLabel';\nimport { useLabelStyles } from './useLabelStyles';\n\n/**\n * A label component provides a title or name to a component.\n * {@docCategory Label}\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
+ {"version":3,"sources":["components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpF,QAAM,KAAK,GAAG,UAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;AAEA,EAAA,gBAAA,CAAA,uBAAA,CAAwB,KAAxB;AACA,SAAO,aAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CALqD,CAAzC;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { useLabel_unstable } from './useLabel';\nimport { renderLabel_unstable } from './renderLabel';\nimport { useLabelStyles_unstable } from './useLabelStyles';\nimport type { LabelProps } from './Label.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A label component provides a title or name to a component.\n */\nexport const Label: ForwardRefComponent<LabelProps> = React.forwardRef((props, ref) => {\n const state = useLabel_unstable(props, ref);\n\n useLabelStyles_unstable(state);\n return renderLabel_unstable(state);\n});\n\nLabel.displayName = 'Label';\n"],"sourceRoot":"../src/"}
@@ -1,53 +1,38 @@
1
- import * as React from 'react';
2
- import { ComponentProps, ComponentState, ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities';
3
- /**
4
- * Label Props
5
- * {@docCategory Label}
6
- */
7
- export interface LabelProps extends ComponentProps, React.LabelHTMLAttributes<HTMLLabelElement> {
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
+ declare type LabelCommons = {
8
3
  /**
9
4
  * Renders the label as disabled
10
5
  * @defaultvalue false
11
6
  */
12
- disabled?: boolean;
13
- /**
14
- * Displays and indicator that the label is for a required field. The required prop can be set to true to display
15
- * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
16
- * @defaultvalue false
17
- */
18
- required?: boolean | ShorthandProps<ComponentProps>;
7
+ disabled: boolean;
19
8
  /**
20
9
  * A label supports different sizes.
21
10
  * @defaultvalue 'medium'
22
11
  */
23
- size?: 'small' | 'medium' | 'large';
12
+ size: 'small' | 'medium' | 'large';
24
13
  /**
25
14
  * A label supports semibold/strong fontweight.
26
15
  * @defaultvalue false
27
16
  */
28
- strong?: boolean;
29
- }
30
- /**
31
- * Names of the shorthand properties in LabelProps
32
- * {@docCategory Label}
33
- */
34
- export declare type LabelShorthandProps = 'required';
17
+ strong: boolean;
18
+ };
19
+ export declare type LabelSlots = {
20
+ root: Slot<'label'>;
21
+ required?: Slot<'span'>;
22
+ };
35
23
  /**
36
- * Names of LabelProps that have a default value in useLabel
37
- * {@docCategory Label}
24
+ * State used in rendering Label
38
25
  */
39
- export declare type LabelDefaultedProps = 'size';
26
+ export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
40
27
  /**
41
- * State used in rendering Label
42
- * {@docCategory Label}
28
+ * Label Props
43
29
  */
44
- export interface LabelState extends ComponentState<LabelProps, LabelShorthandProps, LabelDefaultedProps> {
30
+ export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
45
31
  /**
46
- * Ref to the root element
47
- */
48
- ref: React.Ref<HTMLElement>;
49
- /**
50
- * The required prop resolved to a slot object
32
+ * Displays and indicator that the label is for a required field. The required prop can be set to true to display
33
+ * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
34
+ * @defaultvalue false
51
35
  */
52
- required?: ObjectShorthandProps<ComponentProps>;
53
- }
36
+ required?: boolean | Slot<'span'>;
37
+ };
38
+ export {};
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  //# sourceMappingURL=Label.types.js.map
@@ -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 { ComponentProps, ComponentState, ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities';\n\n/**\n * Label Props\n * {@docCategory Label}\n */\nexport interface LabelProps extends ComponentProps, 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 | ShorthandProps<ComponentProps>;\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 * {@docCategory Label}\n */\nexport type LabelShorthandProps = 'required';\n\n/**\n * Names of LabelProps that have a default value in useLabel\n * {@docCategory Label}\n */\nexport type LabelDefaultedProps = 'size';\n\n/**\n * State used in rendering Label\n * {@docCategory Label}\n */\nexport interface LabelState extends ComponentState<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?: ObjectShorthandProps<ComponentProps>;\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
4
9
  tslib_1.__exportStar(require("./Label"), exports);
10
+
5
11
  tslib_1.__exportStar(require("./Label.types"), exports);
12
+
6
13
  tslib_1.__exportStar(require("./renderLabel"), exports);
14
+
7
15
  tslib_1.__exportStar(require("./useLabel"), exports);
16
+
8
17
  tslib_1.__exportStar(require("./useLabelStyles"), exports);
9
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Label/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,wDAA8B;AAC9B,wDAA8B;AAC9B,qDAA2B;AAC3B,2DAAiC","sourcesContent":["export * from './Label';\nexport * from './Label.types';\nexport * from './renderLabel';\nexport * from './useLabel';\nexport * from './useLabelStyles';\n"]}
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,6 +1,5 @@
1
- import { LabelState } from './Label.types';
1
+ import type { LabelState } from './Label.types';
2
2
  /**
3
3
  * Render the final JSX of Label
4
- * {@docCategory Label}
5
4
  */
6
- export declare const renderLabel: (state: LabelState) => JSX.Element;
5
+ export declare const renderLabel_unstable: (state: LabelState) => JSX.Element;
@@ -1,19 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderLabel = void 0;
4
- var tslib_1 = require("tslib");
5
- var React = require("react");
6
- var react_utilities_1 = require("@fluentui/react-utilities");
7
- var useLabel_1 = require("./useLabel");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderLabel_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
8
11
  /**
9
12
  * Render the final JSX of Label
10
- * {@docCategory Label}
11
13
  */
12
- var renderLabel = function (state) {
13
- var _a = react_utilities_1.getSlots(state, useLabel_1.labelShorthandProps), slots = _a.slots, slotProps = _a.slotProps;
14
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
15
- state.children,
16
- state.required && React.createElement(slots.required, tslib_1.__assign({}, slotProps.required))));
14
+
15
+
16
+ const renderLabel_unstable = state => {
17
+ const {
18
+ slots,
19
+ slotProps
20
+ } = react_utilities_1.getSlots(state);
21
+ return React.createElement(slots.root, { ...slotProps.root
22
+ }, state.root.children, slots.required && React.createElement(slots.required, { ...slotProps.required
23
+ }));
17
24
  };
18
- exports.renderLabel = renderLabel;
25
+
26
+ exports.renderLabel_unstable = renderLabel_unstable;
19
27
  //# sourceMappingURL=renderLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderLabel.js","sourceRoot":"../src/","sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,6DAAqD;AAErD,uCAAiD;AAEjD;;;GAGG;AACI,IAAM,WAAW,GAAG,UAAC,KAAiB;IACrC,IAAA,KAAuB,0BAAQ,CAAC,KAAK,EAAE,8BAAmB,CAAC,EAAzD,KAAK,WAAA,EAAE,SAAS,eAAyC,CAAC;IAElE,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;QAC3B,KAAK,CAAC,QAAQ;QACd,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CAClD,CACd,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,WAAW,eAStB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { LabelState } from './Label.types';\nimport { labelShorthandProps } from './useLabel';\n\n/**\n * Render the final JSX of Label\n * {@docCategory Label}\n */\nexport const renderLabel = (state: LabelState) => {\n const { slots, slotProps } = getSlots(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
+ {"version":3,"sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAAsB;AACxD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAqB,KAArB,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEG,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;AAAf,GAAf,CAFrB,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { LabelState, LabelSlots } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel_unstable = (state: LabelState) => {\n const { slots, slotProps } = getSlots<LabelSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.root.children}\n {slots.required && <slots.required {...slotProps.required} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,20 +1,12 @@
1
1
  import * as React from 'react';
2
- import { 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[];
2
+ import type { LabelProps, LabelState } from './Label.types';
8
3
  /**
9
4
  * Create the state required to render Label.
10
5
  *
11
- * The returned state can be modified with hooks such as useLabelStyles,
12
- * before being passed to renderLabel.
6
+ * The returned state can be modified with hooks such as useLabelStyles_unstable,
7
+ * before being passed to renderLabel_unstable.
13
8
  *
14
9
  * @param props - props from this instance of Label
15
10
  * @param ref - reference to root HTMLElement of Label
16
- * @param defaultProps - (optional) default prop values provided by the implementing type
17
- *
18
- * {@docCategory Label}
19
11
  */
20
- export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement>, defaultProps?: LabelProps | undefined) => LabelState;
12
+ export declare const useLabel_unstable: (props: LabelProps, ref: React.Ref<HTMLElement>) => LabelState;
@@ -1,55 +1,50 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLabel = exports.labelShorthandProps = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_utilities_1 = require("@fluentui/react-utilities");
6
- /**
7
- * Array of all shorthand properties listed in LabelShorthandProps
8
- * {@docCatergory Label}
9
- */
10
- exports.labelShorthandProps = ['required'];
11
- var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.labelShorthandProps });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useLabel_unstable = void 0;
7
+
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+
10
+ const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
12
11
  /**
13
12
  * Create the state required to render Label.
14
13
  *
15
- * The returned state can be modified with hooks such as useLabelStyles,
16
- * before being passed to renderLabel.
14
+ * The returned state can be modified with hooks such as useLabelStyles_unstable,
15
+ * before being passed to renderLabel_unstable.
17
16
  *
18
17
  * @param props - props from this instance of Label
19
18
  * @param ref - reference to root HTMLElement of Label
20
- * @param defaultProps - (optional) default prop values provided by the implementing type
21
- *
22
- * {@docCategory Label}
23
- */
24
- var useLabel = function (props, ref, defaultProps) {
25
- var state = mergeProps({
26
- ref: ref,
27
- as: 'label',
28
- size: 'medium',
29
- required: {
30
- as: 'span',
31
- },
32
- }, defaultProps && resolveLabelShorthandProps(defaultProps), resolveLabelShorthandProps(props));
33
- return state;
34
- };
35
- exports.useLabel = useLabel;
36
- /**
37
- * Label will first need to check if required is a boolean or shorthandprops,
38
- * this allows for the required prop to handle both the default asterisk for required
39
- * or a custom required text.
40
19
  */
41
- var resolveLabelShorthandProps = function (props) {
42
- var propsNormalized;
43
- if (props.required === true) {
44
- propsNormalized = tslib_1.__assign(tslib_1.__assign({}, props), { required: { children: '*' } });
45
- }
46
- else if (props.required === false) {
47
- propsNormalized = tslib_1.__assign(tslib_1.__assign({}, props), { required: undefined });
48
- }
49
- else {
50
- // TypeScript needs a nudge to figure out that props.required won't be a boolean here
51
- propsNormalized = props;
52
- }
53
- return react_utilities_1.resolveShorthandProps(propsNormalized, exports.labelShorthandProps);
20
+
21
+
22
+ const useLabel_unstable = (props, ref) => {
23
+ const {
24
+ disabled = false,
25
+ required = false,
26
+ strong = false,
27
+ size = 'medium'
28
+ } = props;
29
+ return {
30
+ disabled,
31
+ required: react_utilities_2.resolveShorthand(required === true ? '*' : required || undefined, {
32
+ defaultProps: {
33
+ 'aria-hidden': 'true'
34
+ }
35
+ }),
36
+ strong,
37
+ size,
38
+ components: {
39
+ root: 'label',
40
+ required: 'span'
41
+ },
42
+ root: react_utilities_1.getNativeElementProps('label', {
43
+ ref,
44
+ ...props
45
+ })
46
+ };
54
47
  };
48
+
49
+ exports.useLabel_unstable = useLabel_unstable;
55
50
  //# sourceMappingURL=useLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLabel.js","sourceRoot":"../src/","sources":["components/Label/useLabel.tsx"],"names":[],"mappings":";;;;AACA,6DAAkF;AAGlF;;;GAGG;AACU,QAAA,mBAAmB,GAA0B,CAAC,UAAU,CAAC,CAAC;AAEvE,IAAM,UAAU,GAAG,gCAAc,CAAa,EAAE,SAAS,EAAE,2BAAmB,EAAE,CAAC,CAAC;AAElF;;;;;;;;;;;GAWG;AACI,IAAM,QAAQ,GAAG,UAAC,KAAiB,EAAE,GAA2B,EAAE,YAAyB;IAChG,IAAM,KAAK,GAAG,UAAU,CACtB;QACE,GAAG,KAAA;QACH,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE;YACR,EAAE,EAAE,MAAM;SACX;KACF,EACD,YAAY,IAAI,0BAA0B,CAAC,YAAY,CAAC,EACxD,0BAA0B,CAAC,KAAK,CAAC,CAClC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAfW,QAAA,QAAQ,YAenB;AAEF;;;;GAIG;AACH,IAAM,0BAA0B,GAAG,UAAC,KAAiB;IACnD,IAAI,eAAe,CAAC;IACpB,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC3B,eAAe,yCAAQ,KAAK,KAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KAC7D;SAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE;QACnC,eAAe,yCAAQ,KAAK,KAAE,QAAQ,EAAE,SAAS,GAAE,CAAC;KACrD;SAAM;QACL,qFAAqF;QACrF,eAAe,GAAG,KAA6E,CAAC;KACjG;IAED,OAAO,uCAAqB,CAAC,eAAe,EAAE,2BAAmB,CAAC,CAAC;AACrE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { 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 *\n * {@docCategory Label}\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
+ {"version":3,"sources":["components/Label/useLabel.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;AAC9F,QAAM;AAAE,IAAA,QAAQ,GAAG,KAAb;AAAoB,IAAA,QAAQ,GAAG,KAA/B;AAAsC,IAAA,MAAM,GAAG,KAA/C;AAAsD,IAAA,IAAI,GAAG;AAA7D,MAA0E,KAAhF;AACA,SAAO;AACL,IAAA,QADK;AAEL,IAAA,QAAQ,EAAE,iBAAA,CAAA,gBAAA,CAAiB,QAAQ,KAAK,IAAb,GAAoB,GAApB,GAA0B,QAAQ,IAAI,SAAvD,EAAkE;AAC1E,MAAA,YAAY,EAAE;AAAE,uBAAe;AAAjB;AAD4D,KAAlE,CAFL;AAKL,IAAA,MALK;AAML,IAAA,IANK;AAOL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE,OAAR;AAAiB,MAAA,QAAQ,EAAE;AAA3B,KAPP;AAQL,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,OAAtB,EAA+B;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAA/B;AARD,GAAP;AAUD,CAZM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelState } from './Label.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render Label.\n *\n * The returned state can be modified with hooks such as useLabelStyles_unstable,\n * before being passed to renderLabel_unstable.\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n */\nexport const useLabel_unstable = (props: LabelProps, ref: React.Ref<HTMLElement>): LabelState => {\n const { disabled = false, required = false, strong = false, size = 'medium' } = props;\n return {\n disabled,\n required: resolveShorthand(required === true ? '*' : required || undefined, {\n defaultProps: { 'aria-hidden': 'true' },\n }),\n strong,\n size,\n components: { root: 'label', required: 'span' },\n root: getNativeElementProps('label', { ref, ...props }),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,11 @@
1
- import { LabelState } from './Label.types';
1
+ import type { LabelSlots, LabelState } from './Label.types';
2
+ import type { SlotClassNames } from '@fluentui/react-utilities';
3
+ /**
4
+ * @deprecated Use `labelClassNames.root` instead.
5
+ */
6
+ export declare const labelClassName = "fui-Label";
7
+ export declare const labelClassNames: SlotClassNames<LabelSlots>;
2
8
  /**
3
9
  * Apply styling to the Label slots based on the state
4
10
  */
5
- export declare const useLabelStyles: (state: LabelState) => LabelState;
11
+ export declare const useLabelStyles_unstable: (state: LabelState) => LabelState;
@@ -1,48 +1,76 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLabelStyles = void 0;
4
- var react_make_styles_1 = require("@fluentui/react-make-styles");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useLabelStyles_unstable = exports.labelClassNames = exports.labelClassName = void 0;
7
+
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
11
+ /**
12
+ * @deprecated Use `labelClassNames.root` instead.
13
+ */
14
+
15
+
16
+ exports.labelClassName = 'fui-Label';
17
+ exports.labelClassNames = {
18
+ root: 'fui-Label',
19
+ required: 'fui-Label__required'
20
+ };
5
21
  /**
6
22
  * Styles for the label
7
23
  */
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
- }); },
24
+
25
+ const useStyles = /*#__PURE__*/react_1.__styles({
26
+ "root": {
27
+ "Bahqtrf": "fk6fouc",
28
+ "sj55zd": "f19n0e5"
29
+ },
30
+ "disabled": {
31
+ "sj55zd": "f1s2aq7o"
32
+ },
33
+ "required": {
34
+ "sj55zd": "f1whyuy6",
35
+ "uwmqm3": ["fycuoez", "f8wuabp"]
36
+ },
37
+ "requiredDisabled": {
38
+ "sj55zd": "f1s2aq7o"
39
+ },
40
+ "small": {
41
+ "Be2twd7": "fy9rknc",
42
+ "Bg96gwp": "fwrc4pm"
43
+ },
44
+ "medium": {
45
+ "Be2twd7": "fkhj508",
46
+ "Bg96gwp": "f1i3iumi"
47
+ },
48
+ "large": {
49
+ "Be2twd7": "fod5ikn",
50
+ "Bg96gwp": "faaz57k",
51
+ "Bhrd7zp": "fl43uef"
52
+ },
53
+ "strong": {
54
+ "Bhrd7zp": "fl43uef"
55
+ }
56
+ }, {
57
+ "d": [".fk6fouc{font-family:var(--fontFamilyBase);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f1whyuy6{color:var(--colorPaletteRedForeground3);}", ".fycuoez{padding-left:4px;}", ".f8wuabp{padding-right:4px;}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}"]
35
58
  });
36
59
  /**
37
60
  * Apply styling to the Label slots based on the state
38
61
  */
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;
62
+
63
+
64
+ const useLabelStyles_unstable = state => {
65
+ const styles = useStyles();
66
+ state.root.className = react_1.mergeClasses(exports.labelClassNames.root, styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
67
+
68
+ if (state.required) {
69
+ state.required.className = react_1.mergeClasses(exports.labelClassNames.required, styles.required, state.disabled && styles.requiredDisabled, state.required.className);
70
+ }
71
+
72
+ return state;
46
73
  };
47
- exports.useLabelStyles = useLabelStyles;
74
+
75
+ exports.useLabelStyles_unstable = useLabelStyles_unstable;
48
76
  //# sourceMappingURL=useLabelStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLabelStyles.js","sourceRoot":"../src/","sources":["components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAGvE;;GAEG;AACH,IAAM,SAAS,GAAG,8BAAU,CAAC;IAC3B,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QACd,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI;QAC/C,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;QAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;KACpD,CAAC,EAJa,CAIb;IAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;KAC3D,CAAC,EAFiB,CAEjB;IAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW;QACxC,oEAAoE;QACpE,WAAW,EAAE,KAAK;KACnB,CAAC,EAJiB,CAIjB;IAEF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QACf,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;KAChD,CAAC,EAFc,CAEd;IAEF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QAChB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;KAChD,CAAC,EAFe,CAEf;IAEF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QACf,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;QAC/C,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ;KACnD,CAAC,EAHc,CAGd;IAEF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;QAChB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ;KACnD,CAAC,EAFe,CAEf;CACH,CAAC,CAAC;AAEH;;GAEG;AACI,IAAM,cAAc,GAAG,UAAC,KAAiB;IAC9C,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,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;IAEF,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,gCAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;KACpF;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAfW,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
+ {"version":3,"sources":["components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,cAAA,GAAiB,WAAjB;AACA,OAAA,CAAA,eAAA,GAA8C;AACzD,EAAA,IAAI,EAAE,WADmD;AAEzD,EAAA,QAAQ,EAAE;AAF+C,CAA9C;AAKb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,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;AAAA;AAAA;AAAA,EAAlB;AAwCA;;AAEG;;;AACI,MAAM,uBAAuB,GAAI,KAAD,IAAkC;AACvE,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,eAAA,CAAgB,IADK,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAHJ,EAIrB,MAAM,CAAC,KAAK,CAAC,IAAP,CAJe,EAKrB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MALF,EAMrB,KAAK,CAAC,IAAN,CAAW,SANU,CAAvB;;AASA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,OAAA,CAAA,YAAA,CACzB,OAAA,CAAA,eAAA,CAAgB,QADS,EAEzB,MAAM,CAAC,QAFkB,EAGzB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,gBAHA,EAIzB,KAAK,CAAC,QAAN,CAAe,SAJU,CAA3B;AAMD;;AAED,SAAO,KAAP;AACD,CArBM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { LabelSlots, LabelState } from './Label.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n/**\n * @deprecated Use `labelClassNames.root` instead.\n */\nexport const labelClassName = 'fui-Label';\nexport const labelClassNames: SlotClassNames<LabelSlots> = {\n root: 'fui-Label',\n required: 'fui-Label__required',\n};\n\n/**\n * Styles for the label\n */\nconst useStyles = makeStyles({\n root: {\n fontFamily: tokens.fontFamilyBase,\n color: tokens.colorNeutralForeground1,\n },\n\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n required: {\n color: tokens.colorPaletteRedForeground3,\n paddingLeft: '4px', // TODO: Once spacing tokens are added, change this to Horizontal XS\n },\n\n requiredDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n small: {\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n },\n\n medium: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n\n large: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n fontWeight: tokens.fontWeightSemibold,\n },\n\n strong: {\n fontWeight: tokens.fontWeightSemibold,\n },\n});\n\n/**\n * Apply styling to the Label slots based on the state\n */\nexport const useLabelStyles_unstable = (state: LabelState): LabelState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n labelClassNames.root,\n styles.root,\n state.disabled && styles.disabled,\n styles[state.size],\n state.strong && styles.strong,\n state.root.className,\n );\n\n if (state.required) {\n state.required.className = mergeClasses(\n labelClassNames.required,\n styles.required,\n state.disabled && styles.requiredDisabled,\n state.required.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,2 +1,2 @@
1
- export {};
2
- export * from './Label';
1
+ export { Label, labelClassName, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable, } from './Label';
2
+ export type { LabelProps, LabelSlots, LabelState } from './Label';