@fluentui/react-label 9.3.15 → 9.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # Change Log - @fluentui/react-label
2
2
 
3
- This log was last generated on Wed, 25 Feb 2026 13:28:23 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 23 Apr 2026 11:59:24 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.4.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.4.1)
8
+
9
+ Thu, 23 Apr 2026 11:59:24 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.4.0..@fluentui/react-label_v9.4.1)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-utilities to v9.26.3 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
15
+ - Bump @fluentui/react-jsx-runtime to v9.4.2 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
16
+
17
+ ## [9.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.4.0)
18
+
19
+ Wed, 01 Apr 2026 15:52:40 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.3.15..@fluentui/react-label_v9.4.0)
21
+
22
+ ### Minor changes
23
+
24
+ - feat: add useLabelBase_unstable hook ([PR #35905](https://github.com/microsoft/fluentui/pull/35905) by dmytrokirpa@microsoft.com)
25
+
7
26
  ## [9.3.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.3.15)
8
27
 
9
- Wed, 25 Feb 2026 13:28:23 GMT
28
+ Wed, 25 Feb 2026 13:32:28 GMT
10
29
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.3.14..@fluentui/react-label_v9.3.15)
11
30
 
12
31
  ### Patches
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
3
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
4
  import type { JSXElement } from '@fluentui/react-utilities';
5
- import * as React_2 from 'react';
5
+ import type * as React_2 from 'react';
6
6
  import type { Slot } from '@fluentui/react-utilities';
7
7
  import type { SlotClassNames } from '@fluentui/react-utilities';
8
8
 
@@ -11,6 +11,17 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
11
11
  */
12
12
  export declare const Label: ForwardRefComponent<LabelProps>;
13
13
 
14
+ /**
15
+ * Label props without design-specific props (size, weight).
16
+ * Use this when building a label that is unstyled or uses a custom design system.
17
+ */
18
+ export declare type LabelBaseProps = Omit<LabelProps, 'size' | 'weight'>;
19
+
20
+ /**
21
+ * Label state without design-specific state (size, weight).
22
+ */
23
+ export declare type LabelBaseState = Omit<LabelState, 'size' | 'weight'>;
24
+
14
25
  export declare const labelClassNames: SlotClassNames<LabelSlots>;
15
26
 
16
27
  /**
@@ -53,7 +64,7 @@ export declare type LabelState = ComponentState<LabelSlots> & Required<Pick<Labe
53
64
  /**
54
65
  * Render the final JSX of Label
55
66
  */
56
- export declare const renderLabel_unstable: (state: LabelState) => JSXElement;
67
+ export declare const renderLabel_unstable: (state: LabelBaseState) => JSXElement;
57
68
 
58
69
  /**
59
70
  * Create the state required to render Label.
@@ -66,6 +77,14 @@ export declare const renderLabel_unstable: (state: LabelState) => JSXElement;
66
77
  */
67
78
  export declare const useLabel_unstable: (props: LabelProps, ref: React_2.Ref<HTMLElement>) => LabelState;
68
79
 
80
+ /**
81
+ * Create the base state required to render Label, without design-specific props (size, weight).
82
+ *
83
+ * @param props - props from this instance of Label
84
+ * @param ref - reference to root HTMLElement of Label
85
+ */
86
+ export declare const useLabelBase_unstable: (props: LabelBaseProps, ref: React_2.Ref<HTMLLabelElement>) => LabelBaseState;
87
+
69
88
  /**
70
89
  * Apply styling to the Label slots based on the state
71
90
  */
package/lib/Label.js CHANGED
@@ -1 +1 @@
1
- export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable } from './components/Label/index';
1
+ export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable, useLabelBase_unstable } from './components/Label/index';
package/lib/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Label.ts"],"sourcesContent":["export type { LabelProps, LabelSlots, LabelState } from './components/Label/index';\nexport {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n} from './components/Label/index';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable"],"mappings":"AACA,SACEA,KAAK,EACLC,eAAe,EACfC,oBAAoB,EACpBC,uBAAuB,EACvBC,iBAAiB,QACZ,2BAA2B"}
1
+ {"version":3,"sources":["../src/Label.ts"],"sourcesContent":["export type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './components/Label/index';\nexport {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n useLabelBase_unstable,\n} from './components/Label/index';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable","useLabelBase_unstable"],"mappings":"AACA,SACEA,KAAK,EACLC,eAAe,EACfC,oBAAoB,EACpBC,uBAAuB,EACvBC,iBAAiB,EACjBC,qBAAqB,QAChB,2BAA2B"}
@@ -1,3 +1,3 @@
1
1
  /**
2
- * State used in rendering Label
2
+ * Label state without design-specific state (size, weight).
3
3
  */ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/Label.types.ts"],"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 regular and semibold fontweight.\n * @default regular\n */\n weight?: 'regular' | 'semibold';\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' | 'weight'>>;\n"],"names":[],"mappings":"AAqCA;;CAEC,GACD,WAAiH"}
1
+ {"version":3,"sources":["../src/components/Label/Label.types.ts"],"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 regular and semibold fontweight.\n * @default regular\n */\n weight?: 'regular' | 'semibold';\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' | 'weight'>>;\n\n/**\n * Label props without design-specific props (size, weight).\n * Use this when building a label that is unstyled or uses a custom design system.\n */\nexport type LabelBaseProps = Omit<LabelProps, 'size' | 'weight'>;\n\n/**\n * Label state without design-specific state (size, weight).\n */\nexport type LabelBaseState = Omit<LabelState, 'size' | 'weight'>;\n"],"names":[],"mappings":"AAgDA;;CAEC,GACD,WAAiE"}
@@ -1,4 +1,4 @@
1
1
  export { Label } from './Label';
2
2
  export { renderLabel_unstable } from './renderLabel';
3
- export { useLabel_unstable } from './useLabel';
3
+ export { useLabel_unstable, useLabelBase_unstable } from './useLabel';
4
4
  export { labelClassNames, useLabelStyles_unstable } from './useLabelStyles.styles';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/index.ts"],"sourcesContent":["export { Label } from './Label';\nexport type { LabelProps, LabelSlots, LabelState } from './Label.types';\nexport { renderLabel_unstable } from './renderLabel';\nexport { useLabel_unstable } from './useLabel';\nexport { labelClassNames, useLabelStyles_unstable } from './useLabelStyles.styles';\n"],"names":["Label","renderLabel_unstable","useLabel_unstable","labelClassNames","useLabelStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAEhC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}
1
+ {"version":3,"sources":["../src/components/Label/index.ts"],"sourcesContent":["export { Label } from './Label';\nexport type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './Label.types';\nexport { renderLabel_unstable } from './renderLabel';\nexport { useLabel_unstable, useLabelBase_unstable } from './useLabel';\nexport { labelClassNames, useLabelStyles_unstable } from './useLabelStyles.styles';\n"],"names":["Label","renderLabel_unstable","useLabel_unstable","useLabelBase_unstable","labelClassNames","useLabelStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAEhC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,aAAa;AACtE,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/renderLabel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\n assertSlots<LabelSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.required && <state.required />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderLabel_unstable","state","root","children","required"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC;IACnCF,YAAwBE;IAExB,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,QAAQ,kBAAI,KAACH,MAAMG,QAAQ;;;AAGxC,EAAE"}
1
+ {"version":3,"sources":["../src/components/Label/renderLabel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { LabelBaseState, LabelSlots } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel_unstable = (state: LabelBaseState): JSXElement => {\n assertSlots<LabelSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.required && <state.required />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderLabel_unstable","state","root","children","required"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC;IACnCF,YAAwBE;IAExB,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,QAAQ,kBAAI,KAACH,MAAMG,QAAQ;;;AAGxC,EAAE"}
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ 'use client';
2
2
  import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Create the state required to render Label.
@@ -9,7 +9,21 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
9
9
  * @param props - props from this instance of Label
10
10
  * @param ref - reference to root HTMLElement of Label
11
11
  */ export const useLabel_unstable = (props, ref)=>{
12
- const { disabled = false, required = false, weight = 'regular', size = 'medium' } = props;
12
+ const { weight = 'regular', size = 'medium', ...baseProps } = props;
13
+ const state = useLabelBase_unstable(baseProps, ref);
14
+ return {
15
+ weight,
16
+ size,
17
+ ...state
18
+ };
19
+ };
20
+ /**
21
+ * Create the base state required to render Label, without design-specific props (size, weight).
22
+ *
23
+ * @param props - props from this instance of Label
24
+ * @param ref - reference to root HTMLElement of Label
25
+ */ export const useLabelBase_unstable = (props, ref)=>{
26
+ const { disabled = false, required = false, ...rest } = props;
13
27
  return {
14
28
  disabled,
15
29
  required: slot.optional(required === true ? '*' : required || undefined, {
@@ -18,18 +32,13 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
18
32
  },
19
33
  elementType: 'span'
20
34
  }),
21
- weight,
22
- size,
23
35
  components: {
24
36
  root: 'label',
25
37
  required: 'span'
26
38
  },
27
39
  root: slot.always(getIntrinsicElementProps('label', {
28
- // FIXME:
29
- // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLLabelElement`
30
- // but since it would be a breaking change to fix it, we are casting ref to it's proper type
31
40
  ref: ref,
32
- ...props
41
+ ...rest
33
42
  }), {
34
43
  elementType: 'label'
35
44
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/useLabel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelState } from './Label.types';\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, weight = 'regular', size = 'medium' } = props;\n return {\n disabled,\n required: slot.optional(required === true ? '*' : required || undefined, {\n defaultProps: { 'aria-hidden': 'true' },\n elementType: 'span',\n }),\n weight,\n size,\n components: { root: 'label', required: 'span' },\n root: slot.always(\n getIntrinsicElementProps('label', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLLabelElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLLabelElement>,\n ...props,\n }),\n { elementType: 'label' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useLabel_unstable","props","ref","disabled","required","weight","size","optional","undefined","defaultProps","elementType","components","root","always"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,WAAW,KAAK,EAAEC,WAAW,KAAK,EAAEC,SAAS,SAAS,EAAEC,OAAO,QAAQ,EAAE,GAAGL;IACpF,OAAO;QACLE;QACAC,UAAUL,KAAKQ,QAAQ,CAACH,aAAa,OAAO,MAAMA,YAAYI,WAAW;YACvEC,cAAc;gBAAE,eAAe;YAAO;YACtCC,aAAa;QACf;QACAL;QACAC;QACAK,YAAY;YAAEC,MAAM;YAASR,UAAU;QAAO;QAC9CQ,MAAMb,KAAKc,MAAM,CACff,yBAAyB,SAAS;YAChC,SAAS;YACT,8EAA8E;YAC9E,4FAA4F;YAC5FI,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAES,aAAa;QAAQ;IAE3B;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Label/useLabel.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { LabelBaseProps, LabelBaseState, LabelProps, LabelState } from './Label.types';\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 { weight = 'regular', size = 'medium', ...baseProps } = props;\n const state = useLabelBase_unstable(baseProps, ref as React.Ref<HTMLLabelElement>);\n\n return {\n weight,\n size,\n ...state,\n };\n};\n\n/**\n * Create the base state required to render Label, without design-specific props (size, weight).\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n */\nexport const useLabelBase_unstable = (props: LabelBaseProps, ref: React.Ref<HTMLLabelElement>): LabelBaseState => {\n const { disabled = false, required = false, ...rest } = props;\n return {\n disabled,\n required: slot.optional(required === true ? '*' : required || undefined, {\n defaultProps: { 'aria-hidden': 'true' },\n elementType: 'span',\n }),\n components: { root: 'label', required: 'span' },\n root: slot.always(\n getIntrinsicElementProps('label', {\n ref: ref as React.Ref<HTMLLabelElement>,\n ...rest,\n }),\n { elementType: 'label' },\n ),\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useLabel_unstable","props","ref","weight","size","baseProps","state","useLabelBase_unstable","disabled","required","rest","optional","undefined","defaultProps","elementType","components","root","always"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,SAAS,SAAS,EAAEC,OAAO,QAAQ,EAAE,GAAGC,WAAW,GAAGJ;IAC9D,MAAMK,QAAQC,sBAAsBF,WAAWH;IAE/C,OAAO;QACLC;QACAC;QACA,GAAGE,KAAK;IACV;AACF,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMC,wBAAwB,CAACN,OAAuBC;IAC3D,MAAM,EAAEM,WAAW,KAAK,EAAEC,WAAW,KAAK,EAAE,GAAGC,MAAM,GAAGT;IACxD,OAAO;QACLO;QACAC,UAAUV,KAAKY,QAAQ,CAACF,aAAa,OAAO,MAAMA,YAAYG,WAAW;YACvEC,cAAc;gBAAE,eAAe;YAAO;YACtCC,aAAa;QACf;QACAC,YAAY;YAAEC,MAAM;YAASP,UAAU;QAAO;QAC9CO,MAAMjB,KAAKkB,MAAM,CACfnB,yBAAyB,SAAS;YAChCI,KAAKA;YACL,GAAGQ,IAAI;QACT,IACA;YAAEI,aAAa;QAAQ;IAE3B;AACF,EAAE"}
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable } from './Label';
1
+ export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable, useLabelBase_unstable } from './Label';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable } from './Label';\nexport type { LabelProps, LabelSlots, LabelState } from './Label';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable"],"mappings":"AAAA,SAASA,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ,UAAU"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n useLabelBase_unstable,\n} from './Label';\nexport type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './Label';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable","useLabelBase_unstable"],"mappings":"AAAA,SACEA,KAAK,EACLC,eAAe,EACfC,oBAAoB,EACpBC,uBAAuB,EACvBC,iBAAiB,EACjBC,qBAAqB,QAChB,UAAU"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  renderLabel_unstable: function() {
19
19
  return _index.renderLabel_unstable;
20
20
  },
21
+ useLabelBase_unstable: function() {
22
+ return _index.useLabelBase_unstable;
23
+ },
21
24
  useLabelStyles_unstable: function() {
22
25
  return _index.useLabelStyles_unstable;
23
26
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Label.ts"],"sourcesContent":["export type { LabelProps, LabelSlots, LabelState } from './components/Label/index';\nexport {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n} from './components/Label/index';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable"],"mappings":";;;;;;;;;;;;eAEEA,YAAK;;;eACLC,sBAAe;;;eACfC,2BAAoB;;;eACpBC,8BAAuB;;;eACvBC,wBAAiB;;;uBACZ,2BAA2B"}
1
+ {"version":3,"sources":["../src/Label.ts"],"sourcesContent":["export type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './components/Label/index';\nexport {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n useLabelBase_unstable,\n} from './components/Label/index';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable","useLabelBase_unstable"],"mappings":";;;;;;;;;;;;eAEEA,YAAK;;;eACLC,sBAAe;;;eACfC,2BAAoB;;;eAGpBG,4BAAqB;;;eAFrBF,8BAAuB;;;eACvBC,wBAAiB;;;uBAEZ,2BAA2B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * State used in rendering Label
2
+ * Label state without design-specific state (size, weight).
3
3
  */ "use strict";
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/Label.types.ts"],"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 regular and semibold fontweight.\n * @default regular\n */\n weight?: 'regular' | 'semibold';\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' | 'weight'>>;\n"],"names":[],"mappings":"AAqCA;;CAEC,GACD,WAAiH"}
1
+ {"version":3,"sources":["../src/components/Label/Label.types.ts"],"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 regular and semibold fontweight.\n * @default regular\n */\n weight?: 'regular' | 'semibold';\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' | 'weight'>>;\n\n/**\n * Label props without design-specific props (size, weight).\n * Use this when building a label that is unstyled or uses a custom design system.\n */\nexport type LabelBaseProps = Omit<LabelProps, 'size' | 'weight'>;\n\n/**\n * Label state without design-specific state (size, weight).\n */\nexport type LabelBaseState = Omit<LabelState, 'size' | 'weight'>;\n"],"names":[],"mappings":"AAgDA;;CAEC,GACD,WAAiE"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  renderLabel_unstable: function() {
19
19
  return _renderLabel.renderLabel_unstable;
20
20
  },
21
+ useLabelBase_unstable: function() {
22
+ return _useLabel.useLabelBase_unstable;
23
+ },
21
24
  useLabelStyles_unstable: function() {
22
25
  return _useLabelStylesstyles.useLabelStyles_unstable;
23
26
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/index.ts"],"sourcesContent":["export { Label } from './Label';\nexport type { LabelProps, LabelSlots, LabelState } from './Label.types';\nexport { renderLabel_unstable } from './renderLabel';\nexport { useLabel_unstable } from './useLabel';\nexport { labelClassNames, useLabelStyles_unstable } from './useLabelStyles.styles';\n"],"names":["Label","renderLabel_unstable","useLabel_unstable","labelClassNames","useLabelStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,YAAK;;;eAILG,qCAAe;;;eAFfF,iCAAoB;;;eAEHG,6CAAuB;;;eADxCF,2BAAiB;;;uBAHJ,UAAU;6BAEK,gBAAgB;0BACnB,aAAa;sCACU,0BAA0B"}
1
+ {"version":3,"sources":["../src/components/Label/index.ts"],"sourcesContent":["export { Label } from './Label';\nexport type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './Label.types';\nexport { renderLabel_unstable } from './renderLabel';\nexport { useLabel_unstable, useLabelBase_unstable } from './useLabel';\nexport { labelClassNames, useLabelStyles_unstable } from './useLabelStyles.styles';\n"],"names":["Label","renderLabel_unstable","useLabel_unstable","useLabelBase_unstable","labelClassNames","useLabelStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,YAAK;;;eAILI,qCAAe;;;eAFfH,iCAAoB;;;eACDE,+BAAqB;;;eACvBE,6CAAuB;;;eADxCH,2BAAiB;;;uBAHJ,UAAU;6BAEK,gBAAgB;0BACI,aAAa;sCACb,0BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/renderLabel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\n assertSlots<LabelSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.required && <state.required />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderLabel_unstable","state","root","children","required"],"mappings":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,6BAA6B,CAACC;QACnCF,2BAAAA,EAAwBE;IAExB,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,QAAQ,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,QAAQ,EAAA,CAAA;;;AAGxC,EAAE"}
1
+ {"version":3,"sources":["../src/components/Label/renderLabel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { LabelBaseState, LabelSlots } from './Label.types';\n\n/**\n * Render the final JSX of Label\n */\nexport const renderLabel_unstable = (state: LabelBaseState): JSXElement => {\n assertSlots<LabelSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.required && <state.required />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderLabel_unstable","state","root","children","required"],"mappings":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,6BAA6B,CAACC;QACnCF,2BAAAA,EAAwBE;IAExB,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,QAAQ,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,QAAQ,EAAA,CAAA;;;AAGxC,EAAE"}
@@ -1,18 +1,34 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
4
5
  });
5
- Object.defineProperty(exports, "useLabel_unstable", {
6
- enumerable: true,
7
- get: function() {
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ useLabelBase_unstable: function() {
14
+ return useLabelBase_unstable;
15
+ },
16
+ useLabel_unstable: function() {
8
17
  return useLabel_unstable;
9
18
  }
10
19
  });
11
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
20
  const _reactutilities = require("@fluentui/react-utilities");
14
21
  const useLabel_unstable = (props, ref)=>{
15
- const { disabled = false, required = false, weight = 'regular', size = 'medium' } = props;
22
+ const { weight = 'regular', size = 'medium', ...baseProps } = props;
23
+ const state = useLabelBase_unstable(baseProps, ref);
24
+ return {
25
+ weight,
26
+ size,
27
+ ...state
28
+ };
29
+ };
30
+ const useLabelBase_unstable = (props, ref)=>{
31
+ const { disabled = false, required = false, ...rest } = props;
16
32
  return {
17
33
  disabled,
18
34
  required: _reactutilities.slot.optional(required === true ? '*' : required || undefined, {
@@ -21,18 +37,13 @@ const useLabel_unstable = (props, ref)=>{
21
37
  },
22
38
  elementType: 'span'
23
39
  }),
24
- weight,
25
- size,
26
40
  components: {
27
41
  root: 'label',
28
42
  required: 'span'
29
43
  },
30
44
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('label', {
31
- // FIXME:
32
- // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLLabelElement`
33
- // but since it would be a breaking change to fix it, we are casting ref to it's proper type
34
45
  ref: ref,
35
- ...props
46
+ ...rest
36
47
  }), {
37
48
  elementType: 'label'
38
49
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Label/useLabel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { LabelProps, LabelState } from './Label.types';\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, weight = 'regular', size = 'medium' } = props;\n return {\n disabled,\n required: slot.optional(required === true ? '*' : required || undefined, {\n defaultProps: { 'aria-hidden': 'true' },\n elementType: 'span',\n }),\n weight,\n size,\n components: { root: 'label', required: 'span' },\n root: slot.always(\n getIntrinsicElementProps('label', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLLabelElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLLabelElement>,\n ...props,\n }),\n { elementType: 'label' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useLabel_unstable","props","ref","disabled","required","weight","size","optional","undefined","defaultProps","elementType","components","root","always"],"mappings":";;;;+BAaaG;;;;;;;iEAbU,QAAQ;gCACgB,4BAA4B;AAYpE,0BAA0B,CAACC,OAAmBC;IACnD,MAAM,EAAEC,WAAW,KAAK,EAAEC,WAAW,KAAK,EAAEC,SAAS,SAAS,EAAEC,OAAO,QAAQ,EAAE,GAAGL;IACpF,OAAO;QACLE;QACAC,UAAUL,oBAAAA,CAAKQ,QAAQ,CAACH,aAAa,OAAO,MAAMA,YAAYI,WAAW;YACvEC,cAAc;gBAAE,eAAe;YAAO;YACtCC,aAAa;QACf;QACAL;QACAC;QACAK,YAAY;YAAEC,MAAM;YAASR,UAAU;QAAO;QAC9CQ,MAAMb,oBAAAA,CAAKc,MAAM,KACff,wCAAAA,EAAyB,SAAS;YAChC,SAAS;YACT,8EAA8E;YAC9E,4FAA4F;YAC5FI,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAES,aAAa;QAAQ;IAE3B;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Label/useLabel.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { LabelBaseProps, LabelBaseState, LabelProps, LabelState } from './Label.types';\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 { weight = 'regular', size = 'medium', ...baseProps } = props;\n const state = useLabelBase_unstable(baseProps, ref as React.Ref<HTMLLabelElement>);\n\n return {\n weight,\n size,\n ...state,\n };\n};\n\n/**\n * Create the base state required to render Label, without design-specific props (size, weight).\n *\n * @param props - props from this instance of Label\n * @param ref - reference to root HTMLElement of Label\n */\nexport const useLabelBase_unstable = (props: LabelBaseProps, ref: React.Ref<HTMLLabelElement>): LabelBaseState => {\n const { disabled = false, required = false, ...rest } = props;\n return {\n disabled,\n required: slot.optional(required === true ? '*' : required || undefined, {\n defaultProps: { 'aria-hidden': 'true' },\n elementType: 'span',\n }),\n components: { root: 'label', required: 'span' },\n root: slot.always(\n getIntrinsicElementProps('label', {\n ref: ref as React.Ref<HTMLLabelElement>,\n ...rest,\n }),\n { elementType: 'label' },\n ),\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useLabel_unstable","props","ref","weight","size","baseProps","state","useLabelBase_unstable","disabled","required","rest","optional","undefined","defaultProps","elementType","components","root","always"],"mappings":"AAAA;;;;;;;;;;;;yBAgCaS;eAAAA;;qBAjBAP;;;;gCAZkC,4BAA4B;AAYpE,MAAMA,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,SAAS,SAAS,EAAEC,OAAO,QAAQ,EAAE,GAAGC,WAAW,GAAGJ;IAC9D,MAAMK,QAAQC,sBAAsBF,WAAWH;IAE/C,OAAO;QACLC;QACAC;QACA,GAAGE,KAAK;IACV;AACF,EAAE;AAQK,8BAA8B,CAACL,OAAuBC;IAC3D,MAAM,EAAEM,WAAW,KAAK,EAAEC,WAAW,KAAK,EAAE,GAAGC,MAAM,GAAGT;IACxD,OAAO;QACLO;QACAC,UAAUV,oBAAAA,CAAKY,QAAQ,CAACF,aAAa,OAAO,MAAMA,YAAYG,WAAW;YACvEC,cAAc;gBAAE,eAAe;YAAO;YACtCC,aAAa;QACf;QACAC,YAAY;YAAEC,MAAM;YAASP,UAAU;QAAO;QAC9CO,MAAMjB,oBAAAA,CAAKkB,MAAM,KACfnB,wCAAAA,EAAyB,SAAS;YAChCI,KAAKA;YACL,GAAGQ,IAAI;QACT,IACA;YAAEI,aAAa;QAAQ;IAE3B;AACF,EAAE"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  renderLabel_unstable: function() {
19
19
  return _Label.renderLabel_unstable;
20
20
  },
21
+ useLabelBase_unstable: function() {
22
+ return _Label.useLabelBase_unstable;
23
+ },
21
24
  useLabelStyles_unstable: function() {
22
25
  return _Label.useLabelStyles_unstable;
23
26
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { Label, labelClassNames, renderLabel_unstable, useLabelStyles_unstable, useLabel_unstable } from './Label';\nexport type { LabelProps, LabelSlots, LabelState } from './Label';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable"],"mappings":";;;;;;;;;;;;eAASA,YAAK;;;eAAEC,sBAAe;;;eAAEC,2BAAoB;;;eAAEC,8BAAuB;;;eAAEC,wBAAiB;;;uBAAQ,UAAU"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Label,\n labelClassNames,\n renderLabel_unstable,\n useLabelStyles_unstable,\n useLabel_unstable,\n useLabelBase_unstable,\n} from './Label';\nexport type { LabelBaseProps, LabelBaseState, LabelProps, LabelSlots, LabelState } from './Label';\n"],"names":["Label","labelClassNames","renderLabel_unstable","useLabelStyles_unstable","useLabel_unstable","useLabelBase_unstable"],"mappings":";;;;;;;;;;;;eACEA,YAAK;;;eACLC,sBAAe;;;eACfC,2BAAoB;;;eAGpBG,4BAAqB;;;eAFrBF,8BAAuB;;;eACvBC,wBAAiB;;;uBAEZ,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-label",
3
- "version": "9.3.15",
3
+ "version": "9.4.1",
4
4
  "description": "Fluent UI React Label component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -14,8 +14,8 @@
14
14
  "dependencies": {
15
15
  "@fluentui/react-shared-contexts": "^9.26.2",
16
16
  "@fluentui/react-theme": "^9.2.1",
17
- "@fluentui/react-utilities": "^9.26.2",
18
- "@fluentui/react-jsx-runtime": "^9.4.1",
17
+ "@fluentui/react-utilities": "^9.26.3",
18
+ "@fluentui/react-jsx-runtime": "^9.4.2",
19
19
  "@griffel/react": "^1.5.32",
20
20
  "@swc/helpers": "^0.5.1"
21
21
  },