@fluentui/react-input 9.8.4 → 9.8.5

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,21 @@
1
1
  # Change Log - @fluentui/react-input
2
2
 
3
- This log was last generated on Wed, 24 Jun 2026 11:03:33 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 04 Aug 2026 10:10:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.8.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-input_v9.8.5)
8
+
9
+ Tue, 04 Aug 2026 10:10:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-input_v9.8.4..@fluentui/react-input_v9.8.5)
11
+
12
+ ### Patches
13
+
14
+ - fix: fix Field control size handling ([PR #36453](https://github.com/microsoft/fluentui/pull/36453) by dmytrokirpa@microsoft.com)
15
+
7
16
  ## [9.8.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-input_v9.8.4)
8
17
 
9
- Wed, 24 Jun 2026 11:03:33 GMT
18
+ Wed, 24 Jun 2026 11:09:45 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-input_v9.8.3..@fluentui/react-input_v9.8.4)
11
20
 
12
21
  ### Patches
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useFieldControlProps_unstable } from '@fluentui/react-field';
2
+ import { useFieldControlProps_unstable, useFieldContext_unstable } from '@fluentui/react-field';
3
3
  import { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';
4
4
  import { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';
5
5
  /**
@@ -12,8 +12,9 @@ import { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-co
12
12
  * @param ref - reference to `<input>` element of Input
13
13
  */ export const useInput_unstable = (props, ref)=>{
14
14
  const overrides = useOverrides();
15
- var _overrides_inputDefaultAppearance;
16
- const { size = 'medium', appearance = (_overrides_inputDefaultAppearance = overrides.inputDefaultAppearance) !== null && _overrides_inputDefaultAppearance !== void 0 ? _overrides_inputDefaultAppearance : 'outline', ...baseProps } = props;
15
+ const fieldContext = useFieldContext_unstable();
16
+ var _fieldContext_size, _overrides_inputDefaultAppearance;
17
+ const { size = (_fieldContext_size = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.size) !== null && _fieldContext_size !== void 0 ? _fieldContext_size : 'medium', appearance = (_overrides_inputDefaultAppearance = overrides.inputDefaultAppearance) !== null && _overrides_inputDefaultAppearance !== void 0 ? _overrides_inputDefaultAppearance : 'outline', ...baseProps } = props;
17
18
  if (process.env.NODE_ENV !== 'production' && (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')) {
18
19
  // eslint-disable-next-line no-console
19
20
  console.error("The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the" + ' future.');
@@ -34,8 +35,7 @@ import { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-co
34
35
  */ export const useInputBase_unstable = (props, ref)=>{
35
36
  const fieldControlProps = useFieldControlProps_unstable(props, {
36
37
  supportsLabelFor: true,
37
- supportsRequired: true,
38
- supportsSize: true
38
+ supportsRequired: true
39
39
  });
40
40
  const [value, setValue] = useControllableState({
41
41
  state: fieldControlProps.value,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Input/useInput.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { InputBaseProps, InputBaseState, InputProps, InputState } from './Input.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Input.\n *\n * The returned state can be modified with hooks such as useInputStyles_unstable,\n * before being passed to renderInput_unstable.\n *\n * @param props - props from this instance of Input\n * @param ref - reference to `<input>` element of Input\n */\nexport const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputElement>): InputState => {\n const overrides = useOverrides();\n\n const { size = 'medium', appearance = overrides.inputDefaultAppearance ?? 'outline', ...baseProps } = props;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')\n ) {\n // eslint-disable-next-line no-console\n console.error(\n \"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the\" +\n ' future.',\n );\n }\n\n const state = useInputBase_unstable(baseProps, ref);\n\n return {\n size,\n appearance,\n ...state,\n };\n};\n\n/**\n * Base hook for Input component, which manages state related to controlled/uncontrolled value,\n * slot structure, and onChange handling. This hook excludes design-specific props (appearance, size).\n *\n * @param props - User provided props to the Input component.\n * @param ref - User provided ref to be passed to the Input component.\n */\nexport const useInputBase_unstable = (props: InputBaseProps, ref: React.Ref<HTMLInputElement>): InputBaseState => {\n const fieldControlProps = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n supportsSize: true,\n });\n\n const [value, setValue] = useControllableState({\n state: fieldControlProps.value,\n defaultState: fieldControlProps.defaultValue,\n initialState: '',\n });\n\n const nativeProps = getPartitionedNativeProps({\n props: fieldControlProps,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'value', 'defaultValue'],\n });\n\n const state: InputBaseState = {\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n input: slot.always(fieldControlProps.input, {\n defaultProps: {\n type: 'text',\n ref,\n ...nativeProps.primary,\n },\n elementType: 'input',\n }),\n contentAfter: slot.optional(fieldControlProps.contentAfter, { elementType: 'span' }),\n contentBefore: slot.optional(fieldControlProps.contentBefore, { elementType: 'span' }),\n root: slot.always(fieldControlProps.root, {\n defaultProps: nativeProps.root,\n elementType: 'span',\n }),\n };\n\n state.input.value = value;\n state.input.onChange = useEventCallback(ev => {\n const newValue = ev.target.value;\n fieldControlProps.onChange?.(ev, { value: newValue });\n setValue(newValue);\n });\n\n return state;\n};\n"],"names":["useFieldControlProps_unstable","getPartitionedNativeProps","useControllableState","useEventCallback","slot","useOverrides_unstable","useOverrides","useInput_unstable","props","ref","overrides","size","appearance","inputDefaultAppearance","baseProps","process","env","NODE_ENV","console","error","state","useInputBase_unstable","fieldControlProps","supportsLabelFor","supportsRequired","supportsSize","value","setValue","defaultState","defaultValue","initialState","nativeProps","primarySlotTagName","excludedPropNames","components","root","input","contentBefore","contentAfter","always","defaultProps","type","primary","elementType","optional","onChange","ev","newValue","target"],"mappings":"AAAA;AAGA,SAASA,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,yBAAyB,EAAEC,oBAAoB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAEpH,SAASC,yBAAyBC,YAAY,QAAQ,kCAAkC;AAExF;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAMC,YAAYJ;QAEoBI;IAAtC,MAAM,EAAEC,OAAO,QAAQ,EAAEC,aAAaF,CAAAA,oCAAAA,UAAUG,sBAAsB,cAAhCH,+CAAAA,oCAAoC,SAAS,EAAE,GAAGI,WAAW,GAAGN;IAEtG,IACEO,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACxBL,CAAAA,eAAe,0BAA0BA,eAAe,uBAAsB,GAC/E;QACA,sCAAsC;QACtCM,QAAQC,KAAK,CACX,iHACE;IAEN;IAEA,MAAMC,QAAQC,sBAAsBP,WAAWL;IAE/C,OAAO;QACLE;QACAC;QACA,GAAGQ,KAAK;IACV;AACF,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMC,wBAAwB,CAACb,OAAuBC;IAC3D,MAAMa,oBAAoBtB,8BAA8BQ,OAAO;QAC7De,kBAAkB;QAClBC,kBAAkB;QAClBC,cAAc;IAChB;IAEA,MAAM,CAACC,OAAOC,SAAS,GAAGzB,qBAAqB;QAC7CkB,OAAOE,kBAAkBI,KAAK;QAC9BE,cAAcN,kBAAkBO,YAAY;QAC5CC,cAAc;IAChB;IAEA,MAAMC,cAAc9B,0BAA0B;QAC5CO,OAAOc;QACPU,oBAAoB;QACpBC,mBAAmB;YAAC;YAAY;YAAS;SAAe;IAC1D;IAEA,MAAMb,QAAwB;QAC5Bc,YAAY;YACVC,MAAM;YACNC,OAAO;YACPC,eAAe;YACfC,cAAc;QAChB;QACAF,OAAOhC,KAAKmC,MAAM,CAACjB,kBAAkBc,KAAK,EAAE;YAC1CI,cAAc;gBACZC,MAAM;gBACNhC;gBACA,GAAGsB,YAAYW,OAAO;YACxB;YACAC,aAAa;QACf;QACAL,cAAclC,KAAKwC,QAAQ,CAACtB,kBAAkBgB,YAAY,EAAE;YAAEK,aAAa;QAAO;QAClFN,eAAejC,KAAKwC,QAAQ,CAACtB,kBAAkBe,aAAa,EAAE;YAAEM,aAAa;QAAO;QACpFR,MAAM/B,KAAKmC,MAAM,CAACjB,kBAAkBa,IAAI,EAAE;YACxCK,cAAcT,YAAYI,IAAI;YAC9BQ,aAAa;QACf;IACF;IAEAvB,MAAMgB,KAAK,CAACV,KAAK,GAAGA;IACpBN,MAAMgB,KAAK,CAACS,QAAQ,GAAG1C,iBAAiB2C,CAAAA;YAEtCxB;QADA,MAAMyB,WAAWD,GAAGE,MAAM,CAACtB,KAAK;SAChCJ,8BAAAA,kBAAkBuB,QAAQ,cAA1BvB,kDAAAA,iCAAAA,mBAA6BwB,IAAI;YAAEpB,OAAOqB;QAAS;QACnDpB,SAASoB;IACX;IAEA,OAAO3B;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/Input/useInput.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldControlProps_unstable, useFieldContext_unstable } from '@fluentui/react-field';\nimport { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { InputBaseProps, InputBaseState, InputProps, InputState } from './Input.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Input.\n *\n * The returned state can be modified with hooks such as useInputStyles_unstable,\n * before being passed to renderInput_unstable.\n *\n * @param props - props from this instance of Input\n * @param ref - reference to `<input>` element of Input\n */\nexport const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputElement>): InputState => {\n const overrides = useOverrides();\n const fieldContext = useFieldContext_unstable();\n\n const {\n size = fieldContext?.size ?? 'medium',\n appearance = overrides.inputDefaultAppearance ?? 'outline',\n ...baseProps\n } = props;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')\n ) {\n // eslint-disable-next-line no-console\n console.error(\n \"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the\" +\n ' future.',\n );\n }\n\n const state = useInputBase_unstable(baseProps, ref);\n\n return {\n size,\n appearance,\n ...state,\n };\n};\n\n/**\n * Base hook for Input component, which manages state related to controlled/uncontrolled value,\n * slot structure, and onChange handling. This hook excludes design-specific props (appearance, size).\n *\n * @param props - User provided props to the Input component.\n * @param ref - User provided ref to be passed to the Input component.\n */\nexport const useInputBase_unstable = (props: InputBaseProps, ref: React.Ref<HTMLInputElement>): InputBaseState => {\n const fieldControlProps = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n });\n\n const [value, setValue] = useControllableState({\n state: fieldControlProps.value,\n defaultState: fieldControlProps.defaultValue,\n initialState: '',\n });\n\n const nativeProps = getPartitionedNativeProps({\n props: fieldControlProps,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'value', 'defaultValue'],\n });\n\n const state: InputBaseState = {\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n input: slot.always(fieldControlProps.input, {\n defaultProps: {\n type: 'text',\n ref,\n ...nativeProps.primary,\n },\n elementType: 'input',\n }),\n contentAfter: slot.optional(fieldControlProps.contentAfter, { elementType: 'span' }),\n contentBefore: slot.optional(fieldControlProps.contentBefore, { elementType: 'span' }),\n root: slot.always(fieldControlProps.root, {\n defaultProps: nativeProps.root,\n elementType: 'span',\n }),\n };\n\n state.input.value = value;\n state.input.onChange = useEventCallback(ev => {\n const newValue = ev.target.value;\n fieldControlProps.onChange?.(ev, { value: newValue });\n setValue(newValue);\n });\n\n return state;\n};\n"],"names":["useFieldControlProps_unstable","useFieldContext_unstable","getPartitionedNativeProps","useControllableState","useEventCallback","slot","useOverrides_unstable","useOverrides","useInput_unstable","props","ref","overrides","fieldContext","size","appearance","inputDefaultAppearance","baseProps","process","env","NODE_ENV","console","error","state","useInputBase_unstable","fieldControlProps","supportsLabelFor","supportsRequired","value","setValue","defaultState","defaultValue","initialState","nativeProps","primarySlotTagName","excludedPropNames","components","root","input","contentBefore","contentAfter","always","defaultProps","type","primary","elementType","optional","onChange","ev","newValue","target"],"mappings":"AAAA;AAGA,SAASA,6BAA6B,EAAEC,wBAAwB,QAAQ,wBAAwB;AAChG,SAASC,yBAAyB,EAAEC,oBAAoB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAEpH,SAASC,yBAAyBC,YAAY,QAAQ,kCAAkC;AAExF;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAMC,YAAYJ;IAClB,MAAMK,eAAeX;QAGZW,oBACMD;IAFf,MAAM,EACJE,OAAOD,CAAAA,qBAAAA,yBAAAA,mCAAAA,aAAcC,IAAI,cAAlBD,gCAAAA,qBAAsB,QAAQ,EACrCE,aAAaH,CAAAA,oCAAAA,UAAUI,sBAAsB,cAAhCJ,+CAAAA,oCAAoC,SAAS,EAC1D,GAAGK,WACJ,GAAGP;IAEJ,IACEQ,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACxBL,CAAAA,eAAe,0BAA0BA,eAAe,uBAAsB,GAC/E;QACA,sCAAsC;QACtCM,QAAQC,KAAK,CACX,iHACE;IAEN;IAEA,MAAMC,QAAQC,sBAAsBP,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,OAAO1B;AACT,EAAE"}
@@ -22,8 +22,9 @@ const _reactutilities = require("@fluentui/react-utilities");
22
22
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
23
23
  const useInput_unstable = (props, ref)=>{
24
24
  const overrides = (0, _reactsharedcontexts.useOverrides_unstable)();
25
- var _overrides_inputDefaultAppearance;
26
- const { size = 'medium', appearance = (_overrides_inputDefaultAppearance = overrides.inputDefaultAppearance) !== null && _overrides_inputDefaultAppearance !== void 0 ? _overrides_inputDefaultAppearance : 'outline', ...baseProps } = props;
25
+ const fieldContext = (0, _reactfield.useFieldContext_unstable)();
26
+ var _fieldContext_size, _overrides_inputDefaultAppearance;
27
+ const { size = (_fieldContext_size = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.size) !== null && _fieldContext_size !== void 0 ? _fieldContext_size : 'medium', appearance = (_overrides_inputDefaultAppearance = overrides.inputDefaultAppearance) !== null && _overrides_inputDefaultAppearance !== void 0 ? _overrides_inputDefaultAppearance : 'outline', ...baseProps } = props;
27
28
  if (process.env.NODE_ENV !== 'production' && (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')) {
28
29
  // eslint-disable-next-line no-console
29
30
  console.error("The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the" + ' future.');
@@ -38,8 +39,7 @@ const useInput_unstable = (props, ref)=>{
38
39
  const useInputBase_unstable = (props, ref)=>{
39
40
  const fieldControlProps = (0, _reactfield.useFieldControlProps_unstable)(props, {
40
41
  supportsLabelFor: true,
41
- supportsRequired: true,
42
- supportsSize: true
42
+ supportsRequired: true
43
43
  });
44
44
  const [value, setValue] = (0, _reactutilities.useControllableState)({
45
45
  state: fieldControlProps.value,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Input/useInput.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { InputBaseProps, InputBaseState, InputProps, InputState } from './Input.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Input.\n *\n * The returned state can be modified with hooks such as useInputStyles_unstable,\n * before being passed to renderInput_unstable.\n *\n * @param props - props from this instance of Input\n * @param ref - reference to `<input>` element of Input\n */\nexport const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputElement>): InputState => {\n const overrides = useOverrides();\n\n const { size = 'medium', appearance = overrides.inputDefaultAppearance ?? 'outline', ...baseProps } = props;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')\n ) {\n // eslint-disable-next-line no-console\n console.error(\n \"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the\" +\n ' future.',\n );\n }\n\n const state = useInputBase_unstable(baseProps, ref);\n\n return {\n size,\n appearance,\n ...state,\n };\n};\n\n/**\n * Base hook for Input component, which manages state related to controlled/uncontrolled value,\n * slot structure, and onChange handling. This hook excludes design-specific props (appearance, size).\n *\n * @param props - User provided props to the Input component.\n * @param ref - User provided ref to be passed to the Input component.\n */\nexport const useInputBase_unstable = (props: InputBaseProps, ref: React.Ref<HTMLInputElement>): InputBaseState => {\n const fieldControlProps = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n supportsSize: true,\n });\n\n const [value, setValue] = useControllableState({\n state: fieldControlProps.value,\n defaultState: fieldControlProps.defaultValue,\n initialState: '',\n });\n\n const nativeProps = getPartitionedNativeProps({\n props: fieldControlProps,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'value', 'defaultValue'],\n });\n\n const state: InputBaseState = {\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n input: slot.always(fieldControlProps.input, {\n defaultProps: {\n type: 'text',\n ref,\n ...nativeProps.primary,\n },\n elementType: 'input',\n }),\n contentAfter: slot.optional(fieldControlProps.contentAfter, { elementType: 'span' }),\n contentBefore: slot.optional(fieldControlProps.contentBefore, { elementType: 'span' }),\n root: slot.always(fieldControlProps.root, {\n defaultProps: nativeProps.root,\n elementType: 'span',\n }),\n };\n\n state.input.value = value;\n state.input.onChange = useEventCallback(ev => {\n const newValue = ev.target.value;\n fieldControlProps.onChange?.(ev, { value: newValue });\n setValue(newValue);\n });\n\n return state;\n};\n"],"names":["useFieldControlProps_unstable","getPartitionedNativeProps","useControllableState","useEventCallback","slot","useOverrides_unstable","useOverrides","useInput_unstable","props","ref","overrides","size","appearance","inputDefaultAppearance","baseProps","process","env","NODE_ENV","console","error","state","useInputBase_unstable","fieldControlProps","supportsLabelFor","supportsRequired","supportsSize","value","setValue","defaultState","defaultValue","initialState","nativeProps","primarySlotTagName","excludedPropNames","components","root","input","contentBefore","contentAfter","always","defaultProps","type","primary","elementType","optional","onChange","ev","newValue","target"],"mappings":"AAAA;;;;;;;;;;;;yBAiDaqB;eAAAA;;IAhCAd,iBAAAA;;;;4BAdiC,wBAAwB;gCACkB,4BAA4B;qCAE9D,kCAAkC;AAWjF,0BAA0B,CAACC,OAAmBC;IACnD,MAAMC,gBAAYJ,0CAAAA;QAEoBI;IAAtC,MAAM,EAAEC,OAAO,QAAQ,EAAEC,aAAaF,CAAAA,oCAAAA,UAAUG,sBAAsB,AAAtBA,MAAsB,QAAhCH,sCAAAA,KAAAA,IAAAA,oCAAoC,SAAS,EAAE,GAAGI,WAAW,GAAGN;IAEtG,IACEO,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACxBL,CAAAA,eAAe,0BAA0BA,eAAe,uBAAA,CAAsB,EAC/E;QACA,sCAAsC;QACtCM,QAAQC,KAAK,CACX,iHACE;IAEN;IAEA,MAAMC,QAAQC,sBAAsBP,WAAWL;IAE/C,OAAO;QACLE;QACAC;QACA,GAAGQ,KAAK;IACV;AACF,EAAE;AASK,8BAA8B,CAACZ,OAAuBC;IAC3D,MAAMa,wBAAoBtB,yC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E"}
1
+ {"version":3,"sources":["../src/components/Input/useInput.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldControlProps_unstable, useFieldContext_unstable } from '@fluentui/react-field';\nimport { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { InputBaseProps, InputBaseState, InputProps, InputState } from './Input.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Input.\n *\n * The returned state can be modified with hooks such as useInputStyles_unstable,\n * before being passed to renderInput_unstable.\n *\n * @param props - props from this instance of Input\n * @param ref - reference to `<input>` element of Input\n */\nexport const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputElement>): InputState => {\n const overrides = useOverrides();\n const fieldContext = useFieldContext_unstable();\n\n const {\n size = fieldContext?.size ?? 'medium',\n appearance = overrides.inputDefaultAppearance ?? 'outline',\n ...baseProps\n } = props;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n (appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')\n ) {\n // eslint-disable-next-line no-console\n console.error(\n \"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the\" +\n ' future.',\n );\n }\n\n const state = useInputBase_unstable(baseProps, ref);\n\n return {\n size,\n appearance,\n ...state,\n };\n};\n\n/**\n * Base hook for Input component, which manages state related to controlled/uncontrolled value,\n * slot structure, and onChange handling. This hook excludes design-specific props (appearance, size).\n *\n * @param props - User provided props to the Input component.\n * @param ref - User provided ref to be passed to the Input component.\n */\nexport const useInputBase_unstable = (props: InputBaseProps, ref: React.Ref<HTMLInputElement>): InputBaseState => {\n const fieldControlProps = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n });\n\n const [value, setValue] = useControllableState({\n state: fieldControlProps.value,\n defaultState: fieldControlProps.defaultValue,\n initialState: '',\n });\n\n const nativeProps = getPartitionedNativeProps({\n props: fieldControlProps,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'value', 'defaultValue'],\n });\n\n const state: InputBaseState = {\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n input: slot.always(fieldControlProps.input, {\n defaultProps: {\n type: 'text',\n ref,\n ...nativeProps.primary,\n },\n elementType: 'input',\n }),\n contentAfter: slot.optional(fieldControlProps.contentAfter, { elementType: 'span' }),\n contentBefore: slot.optional(fieldControlProps.contentBefore, { elementType: 'span' }),\n root: slot.always(fieldControlProps.root, {\n defaultProps: nativeProps.root,\n elementType: 'span',\n }),\n };\n\n state.input.value = value;\n state.input.onChange = useEventCallback(ev => {\n const newValue = ev.target.value;\n fieldControlProps.onChange?.(ev, { value: newValue });\n setValue(newValue);\n });\n\n return state;\n};\n"],"names":["useFieldControlProps_unstable","useFieldContext_unstable","getPartitionedNativeProps","useControllableState","useEventCallback","slot","useOverrides_unstable","useOverrides","useInput_unstable","props","ref","overrides","fieldContext","size","appearance","inputDefaultAppearance","baseProps","process","env","NODE_ENV","console","error","state","useInputBase_unstable","fieldControlProps","supportsLabelFor","supportsRequired","value","setValue","defaultState","defaultValue","initialState","nativeProps","primarySlotTagName","excludedPropNames","components","root","input","contentBefore","contentAfter","always","defaultProps","type","primary","elementType","optional","onChange","ev","newValue","target"],"mappings":"AAAA;;;;;;;;;;;;yBAsDauB;eAAAA;;IArCAf,iBAAAA;;;;4BAd2D,wBAAwB;gCACR,4BAA4B;qCAE9D,kCAAkC;AAWjF,0BAA0B,CAACC,OAAmBC;IACnD,MAAMC,gBAAYJ,0CAAAA;IAClB,MAAMK,mBAAeX,oCAAAA;QAGZW,oBACMD;IAFf,MAAM,EACJE,OAAOD,CAAAA,qBAAAA,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,IAAAA,AAAI,MAAA,QAAlBD,uBAAAA,KAAAA,IAAAA,qBAAsB,QAAQ,EACrCE,aAAaH,CAAAA,oCAAAA,UAAUI,sBAAsB,AAAt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AAa;QACf;IACF;IAEAtB,MAAMe,KAAK,CAACV,KAAK,GAAGA;IACpBL,MAAMe,KAAK,CAACS,QAAQ,OAAG1C,gCAAAA,EAAiB2C,CAAAA;YAEtCvB;QADA,MAAMwB,WAAWD,GAAGE,MAAM,CAACtB,KAAK;SAChCH,8BAAAA,kBAAkBsB,QAAAA,AAAQ,MAAA,QAA1BtB,gCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,4BAAAA,IAAAA,CAAAA,mBAA6BuB,IAAI;YAAEpB,OAAOqB;QAAS;QACnDpB,SAASoB;IACX;IAEA,OAAO1B;AACT,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-input",
3
- "version": "9.8.4",
3
+ "version": "9.8.5",
4
4
  "description": "Fluent UI React Input component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",