@fluentui/react-label 9.0.0-nightly.b5b7401007.0 → 9.0.0-rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/CHANGELOG.json +512 -20
  2. package/CHANGELOG.md +194 -62
  3. package/README.md +17 -3
  4. package/Spec.md +34 -40
  5. package/dist/index.d.ts +78 -0
  6. package/{lib → dist}/tsdoc-metadata.json +0 -0
  7. package/lib/Label.js.map +1 -1
  8. package/lib/components/Label/Label.js +7 -7
  9. package/lib/components/Label/Label.js.map +1 -1
  10. package/lib/components/Label/Label.types.js.map +1 -1
  11. package/lib/components/Label/index.js.map +1 -1
  12. package/lib/components/Label/renderLabel.js +8 -8
  13. package/lib/components/Label/renderLabel.js.map +1 -1
  14. package/lib/components/Label/useLabel.js +18 -27
  15. package/lib/components/Label/useLabel.js.map +1 -1
  16. package/lib/components/Label/useLabelStyles.js +19 -6
  17. package/lib/components/Label/useLabelStyles.js.map +1 -1
  18. package/lib/index.js +2 -1
  19. package/lib/index.js.map +1 -1
  20. package/lib-commonjs/Label.js +1 -1
  21. package/lib-commonjs/Label.js.map +1 -1
  22. package/lib-commonjs/components/Label/Label.js +8 -8
  23. package/lib-commonjs/components/Label/Label.js.map +1 -1
  24. package/lib-commonjs/components/Label/Label.types.js.map +1 -1
  25. package/lib-commonjs/components/Label/index.js +1 -1
  26. package/lib-commonjs/components/Label/index.js.map +1 -1
  27. package/lib-commonjs/components/Label/renderLabel.js +12 -14
  28. package/lib-commonjs/components/Label/renderLabel.js.map +1 -1
  29. package/lib-commonjs/components/Label/useLabel.js +23 -33
  30. package/lib-commonjs/components/Label/useLabel.js.map +1 -1
  31. package/lib-commonjs/components/Label/useLabelStyles.js +23 -9
  32. package/lib-commonjs/components/Label/useLabelStyles.js.map +1 -1
  33. package/lib-commonjs/index.js +39 -2
  34. package/lib-commonjs/index.js.map +1 -1
  35. package/package.json +19 -23
  36. package/dist/react-label.d.ts +0 -80
  37. package/lib/Label.d.ts +0 -1
  38. package/lib/common/isConformant.d.ts +0 -4
  39. package/lib/common/isConformant.js +0 -11
  40. package/lib/common/isConformant.js.map +0 -1
  41. package/lib/components/Label/Label.d.ts +0 -6
  42. package/lib/components/Label/Label.types.d.ts +0 -38
  43. package/lib/components/Label/index.d.ts +0 -5
  44. package/lib/components/Label/renderLabel.d.ts +0 -5
  45. package/lib/components/Label/useLabel.d.ts +0 -17
  46. package/lib/components/Label/useLabelStyles.d.ts +0 -5
  47. package/lib/index.d.ts +0 -2
  48. package/lib-commonjs/Label.d.ts +0 -1
  49. package/lib-commonjs/common/isConformant.d.ts +0 -4
  50. package/lib-commonjs/common/isConformant.js +0 -22
  51. package/lib-commonjs/common/isConformant.js.map +0 -1
  52. package/lib-commonjs/components/Label/Label.d.ts +0 -6
  53. package/lib-commonjs/components/Label/Label.types.d.ts +0 -38
  54. package/lib-commonjs/components/Label/index.d.ts +0 -5
  55. package/lib-commonjs/components/Label/renderLabel.d.ts +0 -5
  56. package/lib-commonjs/components/Label/useLabel.d.ts +0 -17
  57. package/lib-commonjs/components/Label/useLabelStyles.d.ts +0 -5
  58. package/lib-commonjs/index.d.ts +0 -2
package/Spec.md CHANGED
@@ -75,55 +75,48 @@ The Label component should be simple as shown below. It will just need the text
75
75
  ## API
76
76
 
77
77
  ```ts
78
- /**
79
- * Label Props
80
- */
81
- export type LabelProps = ComponentProps &
82
- React.LabelHTMLAttributes<HTMLElement> & {
83
- /**
84
- * Renders the label as disabled
85
- * @defaultvalue false
86
- */
87
- disabled?: boolean;
88
-
89
- /**
90
- * Whether the associated form field is required or not. If true it will be an asterisk, otherwise it will be what is provided.
91
- * @defaultvalue false
92
- */
93
- required?: boolean | ShorthandProps<ComponentProps>;
78
+ export type LabelCommons = {
79
+ /**
80
+ * Renders the label as disabled
81
+ * @default false
82
+ */
83
+ disabled: boolean;
94
84
 
95
- /**
96
- * A label supports different font sizes, see tokens for reference.
97
- * @defaultvalue 'medium'
98
- */
99
- size?: 'small' | 'medium' | 'large';
85
+ /**
86
+ * A label supports different sizes.
87
+ * @default 'medium'
88
+ */
89
+ size: 'small' | 'medium' | 'large';
100
90
 
101
- /**
102
- * A label supports semibold/strong fontweight. When size is set to large, label strong will be set by default.
103
- * @defaultvalue false
104
- */
105
- strong?: boolean;
106
- };
91
+ /**
92
+ * A label supports semibold/strong fontweight.
93
+ * @default false
94
+ */
95
+ strong: boolean;
96
+ };
107
97
 
108
- /**
109
- * Names of the shorthand properties in LabelProps
110
- */
111
- export type LabelShorthandProps = 'required';
98
+ export type LabelSlots = {
99
+ root: IntrinsicSlotProps<'label'>;
100
+ required?: IntrinsicSlotProps<'span'>;
101
+ };
112
102
 
113
103
  /**
114
- * Names of LabelProps that have a default value in useLabel
104
+ * State used in rendering Label
115
105
  */
116
- export type LabelDefaultedProps = never;
106
+ export type LabelState = ComponentState<LabelSlots> & LabelCommons;
117
107
 
118
108
  /**
119
- * State used in rendering Label
109
+ * Label Props
120
110
  */
121
- export type LabelState = ComponentState<LabelProps, LabelShorthandProps, LabelDefaultedProps> & {
122
- /**
123
- * Ref to the root element
124
- */
125
- ref: React.Ref<HTMLElement>;
126
- };
111
+ export type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> &
112
+ Partial<LabelCommons> & {
113
+ /**
114
+ * Displays an indicator that the label is for a required field. The required prop can be set to true to display
115
+ * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
116
+ * @default false
117
+ */
118
+ required?: boolean | Slot<'span'>;
119
+ };
127
120
  ```
128
121
 
129
122
  ## Structure
@@ -173,3 +166,4 @@ _Keyboard, Cursor, Touch, and Screen Readers_
173
166
  - Label will use the native `label` element to render.
174
167
  - Label cannot receive focus.
175
168
  - Label will have no focusable elements.
169
+ - When a Label is disabled, the required contrast ratio won't be met. This is acceptable behavior due to the nature of the styling. This state should be used sparingly and make it clear that there's no interaction with the control associated with it.
@@ -0,0 +1,78 @@
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
+ import * as React_2 from 'react';
5
+ import type { Slot } from '@fluentui/react-utilities';
6
+ import type { SlotClassNames } from '@fluentui/react-utilities';
7
+
8
+ /**
9
+ * A label component provides a title or name to a component.
10
+ */
11
+ export declare const Label: ForwardRefComponent<LabelProps>;
12
+
13
+ /**
14
+ * @deprecated Use `labelClassNames.root` instead.
15
+ */
16
+ export declare const labelClassName = "fui-Label";
17
+
18
+ export declare const labelClassNames: SlotClassNames<LabelSlots>;
19
+
20
+ /**
21
+ * Label Props
22
+ */
23
+ export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & {
24
+ /**
25
+ * Renders the label as disabled
26
+ * @default false
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Displays an indicator that the label is for a required field. The required prop can be set to true to display
31
+ * an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
32
+ * @default false
33
+ */
34
+ required?: boolean | Slot<'span'>;
35
+ /**
36
+ * A label supports different sizes.
37
+ * @default 'medium'
38
+ */
39
+ size?: 'small' | 'medium' | 'large';
40
+ /**
41
+ * A label supports semibold/strong fontweight.
42
+ * @default false
43
+ */
44
+ strong?: boolean;
45
+ };
46
+
47
+ export declare type LabelSlots = {
48
+ root: Slot<'label'>;
49
+ required?: Slot<'span'>;
50
+ };
51
+
52
+ /**
53
+ * State used in rendering Label
54
+ */
55
+ export declare type LabelState = ComponentState<LabelSlots> & Required<Pick<LabelProps, 'disabled' | 'size' | 'strong'>>;
56
+
57
+ /**
58
+ * Render the final JSX of Label
59
+ */
60
+ export declare const renderLabel_unstable: (state: LabelState) => JSX.Element;
61
+
62
+ /**
63
+ * Create the state required to render Label.
64
+ *
65
+ * The returned state can be modified with hooks such as useLabelStyles_unstable,
66
+ * before being passed to renderLabel_unstable.
67
+ *
68
+ * @param props - props from this instance of Label
69
+ * @param ref - reference to root HTMLElement of Label
70
+ */
71
+ export declare const useLabel_unstable: (props: LabelProps, ref: React_2.Ref<HTMLElement>) => LabelState;
72
+
73
+ /**
74
+ * Apply styling to the Label slots based on the state
75
+ */
76
+ export declare const useLabelStyles_unstable: (state: LabelState) => LabelState;
77
+
78
+ export { }
File without changes
package/lib/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"","sources":["../src/Label.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
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,15 +1,15 @@
1
1
  import * as React from 'react';
2
- import { useLabel } from './useLabel';
3
- import { renderLabel } from './renderLabel';
4
- import { useLabelStyles } from './useLabelStyles';
2
+ import { useLabel_unstable } from './useLabel';
3
+ import { renderLabel_unstable } from './renderLabel';
4
+ import { useLabelStyles_unstable } from './useLabelStyles';
5
5
  /**
6
6
  * A label component provides a title or name to a component.
7
7
  */
8
8
 
9
- export var Label = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = useLabel(props, ref);
11
- useLabelStyles(state);
12
- return renderLabel(state);
9
+ export const Label = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useLabel_unstable(props, ref);
11
+ useLabelStyles_unstable(state);
12
+ return renderLabel_unstable(state);
13
13
  });
14
14
  Label.displayName = 'Label';
15
15
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
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;AAIA;;AAEG;;AACH,OAAO,IAAM,KAAK,gBAAoC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAChF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAD,EAAQ,GAAR,CAAtB;AAEA,EAAA,cAAc,CAAC,KAAD,CAAd;AACA,SAAO,WAAW,CAAC,KAAD,CAAlB;AACD,CALqD,CAA/C;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,YAAlC;AACA,SAAS,oBAAT,QAAqC,eAArC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AAIA;;AAEG;;AACH,OAAO,MAAM,KAAK,gBAAoC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpF,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AACA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALqD,CAA/C;AAOP,KAAK,CAAC,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 +1 @@
1
- {"version":3,"file":"Label.types.js","sourceRoot":"","sources":["../../../src/components/Label/Label.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Label.types.js","sourceRoot":"../src/","sources":["components/Label/Label.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Label Props\n */\nexport type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & {\n /**\n * Renders the label as disabled\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Displays an 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 * @default false\n */\n required?: boolean | Slot<'span'>;\n\n /**\n * A label supports different sizes.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * A label supports semibold/strong fontweight.\n * @default false\n */\n strong?: boolean;\n};\n\nexport type LabelSlots = {\n root: Slot<'label'>;\n required?: Slot<'span'>;\n};\n\n/**\n * State used in rendering Label\n */\nexport type LabelState = ComponentState<LabelSlots> & Required<Pick<LabelProps, 'disabled' | 'size' | 'strong'>>;\n"]}
@@ -1 +1 @@
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
+ {"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,16 +1,16 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { getSlots } from '@fluentui/react-utilities';
4
- import { labelShorthandProps } from './useLabel';
5
3
  /**
6
4
  * Render the final JSX of Label
7
5
  */
8
6
 
9
- export var renderLabel = function (state) {
10
- var _a = getSlots(state, labelShorthandProps),
11
- slots = _a.slots,
12
- slotProps = _a.slotProps;
13
-
14
- return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), state.root.children, /*#__PURE__*/React.createElement(slots.required, __assign({}, slotProps.required)));
7
+ export const renderLabel_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ }, state.root.children, slots.required && /*#__PURE__*/React.createElement(slots.required, { ...slotProps.required
14
+ }));
15
15
  };
16
16
  //# sourceMappingURL=renderLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,mBAAT,QAAoC,YAApC;AAGA;;AAEG;;AACH,OAAO,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,QAAQ,CAAa,KAAb,EAAoB,mBAApB,CAA/B;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,IAAN,CAAW,QADd,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFF,CADF;AAMD,CATM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Label/renderLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAAsB;AACxD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAa,KAAb,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEG,KAAK,CAAC,QAAN,iBAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;AAAf,GAAf,CAFrB,CADF;AAMD,CATM","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,48 +1,39 @@
1
- import { __assign } from "tslib";
2
1
  import { getNativeElementProps } from '@fluentui/react-utilities';
3
2
  import { resolveShorthand } from '@fluentui/react-utilities';
4
- /**
5
- * Array of all shorthand properties listed in LabelShorthandProps
6
- * {@docCatergory Label}
7
- */
8
-
9
- export var labelShorthandProps = ['root', 'required'];
10
3
  /**
11
4
  * Create the state required to render Label.
12
5
  *
13
- * The returned state can be modified with hooks such as useLabelStyles,
14
- * 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.
15
8
  *
16
9
  * @param props - props from this instance of Label
17
10
  * @param ref - reference to root HTMLElement of Label
18
11
  */
19
12
 
20
- export var useLabel = function (props, ref) {
21
- var _a = props.disabled,
22
- disabled = _a === void 0 ? false : _a,
23
- _b = props.required,
24
- required = _b === void 0 ? false : _b,
25
- _c = props.strong,
26
- strong = _c === void 0 ? false : _c,
27
- _d = props.size,
28
- size = _d === void 0 ? 'medium' : _d;
13
+ export const useLabel_unstable = (props, ref) => {
14
+ const {
15
+ disabled = false,
16
+ required = false,
17
+ strong = false,
18
+ size = 'medium'
19
+ } = props;
29
20
  return {
30
- disabled: disabled,
31
- required: resolveShorthand(required === false ? null : required, {
32
- required: !!required,
21
+ disabled,
22
+ required: resolveShorthand(required === true ? '*' : required || undefined, {
33
23
  defaultProps: {
34
- children: '*'
24
+ 'aria-hidden': 'true'
35
25
  }
36
26
  }),
37
- strong: strong,
38
- size: size,
27
+ strong,
28
+ size,
39
29
  components: {
40
30
  root: 'label',
41
31
  required: 'span'
42
32
  },
43
- root: getNativeElementProps('label', __assign({
44
- ref: ref
45
- }, props))
33
+ root: getNativeElementProps('label', {
34
+ ref,
35
+ ...props
36
+ })
46
37
  };
47
38
  };
48
39
  //# sourceMappingURL=useLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":";AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA;;;AAGG;;AACH,OAAO,IAAM,mBAAmB,GAA4B,CAAC,MAAD,EAAS,UAAT,CAArD;AAEP;;;;;;;;AAQG;;AACH,OAAO,IAAM,QAAQ,GAAG,UAAC,KAAD,EAAoB,GAApB,EAA+C;AAC7D,MAAA,EAAA,GAAwE,KAAK,CAA7D,QAAhB;AAAA,MAAA,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAhB;AAAA,MAAkB,EAAA,GAAsD,KAAK,CAA3C,QAAlC;AAAA,MAAkB,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlC;AAAA,MAAoC,EAAA,GAAoC,KAAK,CAA3B,MAAlD;AAAA,MAAoC,MAAM,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlD;AAAA,MAAoD,EAAA,GAAoB,KAAK,CAAV,IAAnE;AAAA,MAAoD,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EAAnE;AACR,SAAO;AACL,IAAA,QAAQ,EAAA,QADH;AAEL,IAAA,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,KAAK,KAAb,GAAqB,IAArB,GAA4B,QAA7B,EAAuC;AAC/D,MAAA,QAAQ,EAAE,CAAC,CAAC,QADmD;AAE/D,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE;AAAZ;AAFiD,KAAvC,CAFrB;AAML,IAAA,MAAM,EAAA,MAND;AAOL,IAAA,IAAI,EAAA,IAPC;AAQL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE,OAAR;AAAiB,MAAA,QAAQ,EAAE;AAA3B,KARP;AASL,IAAA,IAAI,EAAE,qBAAqB,CAAC,OAAD,EAAQ,QAAA,CAAA;AAAI,MAAA,GAAG,EAAA;AAAP,KAAA,EAAY,KAAZ,CAAR;AATtB,GAAP;AAWD,CAbM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Label/useLabel.tsx"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA;;;;;;;;AAQG;;AACH,OAAO,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,gBAAgB,CAAC,QAAQ,KAAK,IAAb,GAAoB,GAApB,GAA0B,QAAQ,IAAI,SAAvC,EAAkD;AAC1E,MAAA,YAAY,EAAE;AAAE,uBAAe;AAAjB;AAD4D,KAAlD,CAFrB;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,qBAAqB,CAAC,OAAD,EAAU;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAAV;AARtB,GAAP;AAUD,CAZM","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,9 +1,19 @@
1
- import { __styles, mergeClasses } from '@fluentui/react-make-styles';
1
+ import { __styles, mergeClasses } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ /**
4
+ * @deprecated Use `labelClassNames.root` instead.
5
+ */
6
+
7
+ export const labelClassName = 'fui-Label';
8
+ export const labelClassNames = {
9
+ root: 'fui-Label',
10
+ required: 'fui-Label__required'
11
+ };
2
12
  /**
3
13
  * Styles for the label
4
14
  */
5
15
 
6
- var useStyles = /*#__PURE__*/__styles({
16
+ const useStyles = /*#__PURE__*/__styles({
7
17
  "root": {
8
18
  "Bahqtrf": "fk6fouc",
9
19
  "sj55zd": "f19n0e5"
@@ -15,6 +25,9 @@ var useStyles = /*#__PURE__*/__styles({
15
25
  "sj55zd": "f1whyuy6",
16
26
  "uwmqm3": ["fycuoez", "f8wuabp"]
17
27
  },
28
+ "requiredDisabled": {
29
+ "sj55zd": "f1s2aq7o"
30
+ },
18
31
  "small": {
19
32
  "Be2twd7": "fy9rknc",
20
33
  "Bg96gwp": "fwrc4pm"
@@ -39,12 +52,12 @@ var useStyles = /*#__PURE__*/__styles({
39
52
  */
40
53
 
41
54
 
42
- export var useLabelStyles = function (state) {
43
- var styles = useStyles();
44
- state.root.className = mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
55
+ export const useLabelStyles_unstable = state => {
56
+ const styles = useStyles();
57
+ state.root.className = mergeClasses(labelClassNames.root, styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
45
58
 
46
59
  if (state.required) {
47
- state.required.className = mergeClasses(styles.required, state.required.className);
60
+ state.required.className = mergeClasses(labelClassNames.required, styles.required, state.disabled && styles.requiredDisabled, state.required.className);
48
61
  }
49
62
 
50
63
  return state;
@@ -1 +1 @@
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,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,MAAM,CAAC,IAD0B,EAEjC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFQ,EAGjC,MAAM,CAAC,KAAK,CAAC,IAAP,CAH2B,EAIjC,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJU,EAKjC,KAAK,CAAC,IAAN,CAAW,SALsB,CAAnC;;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":""}
1
+ {"version":3,"sources":["components/Label/useLabelStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAAG,WAAvB;AACP,OAAO,MAAM,eAAe,GAA+B;AACzD,EAAA,IAAI,EAAE,WADmD;AAEzD,EAAA,QAAQ,EAAE;AAF+C,CAApD;AAKP;;AAEG;;AACH,MAAM,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;AAAA;AAAA;AAAA,EAAlB;AAwCA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAkC;AACvE,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,eAAe,CAAC,IADiB,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAHQ,EAIjC,MAAM,CAAC,KAAK,CAAC,IAAP,CAJ2B,EAKjC,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MALU,EAMjC,KAAK,CAAC,IAAN,CAAW,SANsB,CAAnC;;AASA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CACrC,eAAe,CAAC,QADqB,EAErC,MAAM,CAAC,QAF8B,EAGrC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,gBAHY,EAIrC,KAAK,CAAC,QAAN,CAAe,SAJsB,CAAvC;AAMD;;AAED,SAAO,KAAP;AACD,CArBM","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/"}
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":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC"}
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/"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./components/Label/index"), exports);
10
10
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Label.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
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/"}
@@ -5,22 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Label = void 0;
7
7
 
8
- var React = /*#__PURE__*/require("react");
8
+ const React = /*#__PURE__*/require("react");
9
9
 
10
- var useLabel_1 = /*#__PURE__*/require("./useLabel");
10
+ const useLabel_1 = /*#__PURE__*/require("./useLabel");
11
11
 
12
- var renderLabel_1 = /*#__PURE__*/require("./renderLabel");
12
+ const renderLabel_1 = /*#__PURE__*/require("./renderLabel");
13
13
 
14
- var useLabelStyles_1 = /*#__PURE__*/require("./useLabelStyles");
14
+ const useLabelStyles_1 = /*#__PURE__*/require("./useLabelStyles");
15
15
  /**
16
16
  * A label component provides a title or name to a component.
17
17
  */
18
18
 
19
19
 
20
- exports.Label = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
- var state = useLabel_1.useLabel(props, ref);
22
- useLabelStyles_1.useLabelStyles(state);
23
- return renderLabel_1.renderLabel(state);
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);
24
24
  });
25
25
  exports.Label.displayName = 'Label';
26
26
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
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;AAIA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAyC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAChF,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,CALqD,CAAzC;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourceRoot":""}
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 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./Label"), exports);
10
10
 
@@ -1 +1 @@
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
+ {"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/"}
@@ -3,27 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderLabel = void 0;
6
+ exports.renderLabel_unstable = void 0;
7
7
 
8
- var tslib_1 = /*#__PURE__*/require("tslib");
8
+ const React = /*#__PURE__*/require("react");
9
9
 
10
- var React = /*#__PURE__*/require("react");
11
-
12
- var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
13
-
14
- var useLabel_1 = /*#__PURE__*/require("./useLabel");
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
15
11
  /**
16
12
  * Render the final JSX of Label
17
13
  */
18
14
 
19
15
 
20
- var renderLabel = function (state) {
21
- var _a = react_utilities_1.getSlots(state, useLabel_1.labelShorthandProps),
22
- slots = _a.slots,
23
- slotProps = _a.slotProps;
24
-
25
- return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), state.root.children, React.createElement(slots.required, tslib_1.__assign({}, slotProps.required)));
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
+ }));
26
24
  };
27
25
 
28
- exports.renderLabel = renderLabel;
26
+ exports.renderLabel_unstable = renderLabel_unstable;
29
27
  //# sourceMappingURL=renderLabel.js.map
@@ -1 +1 @@
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,QAAA,CAAqB,KAArB,EAA4B,UAAA,CAAA,mBAA5B,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,IAAN,CAAW,QADd,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFF,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourceRoot":""}
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/"}
@@ -3,58 +3,48 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useLabel = exports.labelShorthandProps = void 0;
6
+ exports.useLabel_unstable = void 0;
7
7
 
8
- var tslib_1 = /*#__PURE__*/require("tslib");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
9
 
10
- var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
-
12
- var react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
13
- /**
14
- * Array of all shorthand properties listed in LabelShorthandProps
15
- * {@docCatergory Label}
16
- */
17
-
18
-
19
- exports.labelShorthandProps = ['root', 'required'];
10
+ const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
20
11
  /**
21
12
  * Create the state required to render Label.
22
13
  *
23
- * The returned state can be modified with hooks such as useLabelStyles,
24
- * 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.
25
16
  *
26
17
  * @param props - props from this instance of Label
27
18
  * @param ref - reference to root HTMLElement of Label
28
19
  */
29
20
 
30
- var useLabel = function (props, ref) {
31
- var _a = props.disabled,
32
- disabled = _a === void 0 ? false : _a,
33
- _b = props.required,
34
- required = _b === void 0 ? false : _b,
35
- _c = props.strong,
36
- strong = _c === void 0 ? false : _c,
37
- _d = props.size,
38
- size = _d === void 0 ? 'medium' : _d;
21
+
22
+ const useLabel_unstable = (props, ref) => {
23
+ const {
24
+ disabled = false,
25
+ required = false,
26
+ strong = false,
27
+ size = 'medium'
28
+ } = props;
39
29
  return {
40
- disabled: disabled,
41
- required: react_utilities_2.resolveShorthand(required === false ? null : required, {
42
- required: !!required,
30
+ disabled,
31
+ required: react_utilities_2.resolveShorthand(required === true ? '*' : required || undefined, {
43
32
  defaultProps: {
44
- children: '*'
33
+ 'aria-hidden': 'true'
45
34
  }
46
35
  }),
47
- strong: strong,
48
- size: size,
36
+ strong,
37
+ size,
49
38
  components: {
50
39
  root: 'label',
51
40
  required: 'span'
52
41
  },
53
- root: react_utilities_1.getNativeElementProps('label', tslib_1.__assign({
54
- ref: ref
55
- }, props))
42
+ root: react_utilities_1.getNativeElementProps('label', {
43
+ ref,
44
+ ...props
45
+ })
56
46
  };
57
47
  };
58
48
 
59
- exports.useLabel = useLabel;
49
+ exports.useLabel_unstable = useLabel_unstable;
60
50
  //# sourceMappingURL=useLabel.js.map