@fluentui/react-field 9.1.28 → 9.1.30
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +79 -1
- package/CHANGELOG.md +28 -2
- package/lib/components/Field/renderField.js +1 -2
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/contexts/useFieldControlProps.js +12 -15
- package/lib/contexts/useFieldControlProps.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js +1 -2
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/contexts/useFieldControlProps.js +12 -15
- package/lib-commonjs/contexts/useFieldControlProps.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,85 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 26 Sep 2023 15:14:52 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v9.1.30",
|
7
|
+
"version": "9.1.30",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "ololubek@microsoft.com",
|
12
|
+
"package": "@fluentui/react-field",
|
13
|
+
"commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
|
14
|
+
"comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "martinhochel@microsoft.com",
|
18
|
+
"package": "@fluentui/react-field",
|
19
|
+
"commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
|
20
|
+
"comment": "fix: bump swc core to mitigate transpilation memory leaks"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-field",
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.35",
|
26
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-field",
|
31
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
|
32
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-field",
|
37
|
+
"comment": "Bump @fluentui/react-label to v9.1.38",
|
38
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-field",
|
43
|
+
"comment": "Bump @fluentui/react-theme to v9.1.13",
|
44
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "beachball",
|
48
|
+
"package": "@fluentui/react-field",
|
49
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.4",
|
50
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"date": "Wed, 20 Sep 2023 17:47:37 GMT",
|
57
|
+
"tag": "@fluentui/react-field_v9.1.29",
|
58
|
+
"version": "9.1.29",
|
59
|
+
"comments": {
|
60
|
+
"patch": [
|
61
|
+
{
|
62
|
+
"author": "martinhochel@microsoft.com",
|
63
|
+
"package": "@fluentui/react-field",
|
64
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0",
|
65
|
+
"comment": "chore: trigger manual version bump after broken release"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-field",
|
70
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.10",
|
71
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-field",
|
76
|
+
"comment": "Bump @fluentui/react-label to v9.1.37",
|
77
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"date": "Wed, 20 Sep 2023 14:59:53 GMT",
|
6
84
|
"tag": "@fluentui/react-field_v9.1.28",
|
7
85
|
"version": "9.1.28",
|
8
86
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,38 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 26 Sep 2023 15:14:52 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.30](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.30)
|
8
|
+
|
9
|
+
Tue, 26 Sep 2023 15:14:52 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.29..@fluentui/react-field_v9.1.30)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
|
15
|
+
- fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
|
16
|
+
- Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
17
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
18
|
+
- Bump @fluentui/react-label to v9.1.38 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
19
|
+
- Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
20
|
+
- Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
21
|
+
|
22
|
+
## [9.1.29](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.29)
|
23
|
+
|
24
|
+
Wed, 20 Sep 2023 17:47:37 GMT
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.28..@fluentui/react-field_v9.1.29)
|
26
|
+
|
27
|
+
### Patches
|
28
|
+
|
29
|
+
- chore: trigger manual version bump after broken release ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by martinhochel@microsoft.com)
|
30
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.10 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
31
|
+
- Bump @fluentui/react-label to v9.1.37 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
32
|
+
|
7
33
|
## [9.1.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.28)
|
8
34
|
|
9
|
-
Wed, 20 Sep 2023 14:
|
35
|
+
Wed, 20 Sep 2023 14:59:53 GMT
|
10
36
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.27..@fluentui/react-field_v9.1.28)
|
11
37
|
|
12
38
|
### Patches
|
@@ -4,14 +4,13 @@ import { FieldContextProvider, getFieldControlProps } from '../../contexts/index
|
|
4
4
|
/**
|
5
5
|
* Render the final JSX of Field
|
6
6
|
*/ export const renderField_unstable = (state, contextValues)=>{
|
7
|
-
var _contextValues;
|
8
7
|
assertSlots(state);
|
9
8
|
let { children } = state;
|
10
9
|
if (typeof children === 'function') {
|
11
10
|
children = children(getFieldControlProps(contextValues.field) || {});
|
12
11
|
}
|
13
12
|
return /*#__PURE__*/ _jsx(FieldContextProvider, {
|
14
|
-
value:
|
13
|
+
value: contextValues === null || contextValues === void 0 ? void 0 : contextValues.field,
|
15
14
|
children: /*#__PURE__*/ _jsxs(state.root, {
|
16
15
|
children: [
|
17
16
|
state.label && /*#__PURE__*/ _jsx(state.label, {}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderField.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\nimport type { FieldContextValues, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = (state: FieldState, contextValues: FieldContextValues) => {\n assertSlots<FieldSlots>(state);\n\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n\n return (\n <FieldContextProvider value={contextValues?.field}>\n <state.root>\n {state.label && <state.label />}\n {children}\n {state.validationMessage && (\n <state.validationMessage>\n {state.validationMessageIcon && <state.validationMessageIcon />}\n {state.validationMessage.children}\n </state.validationMessage>\n )}\n\n {state.hint && <state.hint />}\n </state.root>\n </FieldContextProvider>\n );\n};\n"],"names":["assertSlots","FieldContextProvider","getFieldControlProps","renderField_unstable","state","contextValues","children","field","value","root","label","validationMessage","validationMessageIcon","hint"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,uBAAuB;AAGlF;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC;
|
1
|
+
{"version":3,"sources":["renderField.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\nimport type { FieldContextValues, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = (state: FieldState, contextValues: FieldContextValues) => {\n assertSlots<FieldSlots>(state);\n\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n\n return (\n <FieldContextProvider value={contextValues?.field}>\n <state.root>\n {state.label && <state.label />}\n {children}\n {state.validationMessage && (\n <state.validationMessage>\n {state.validationMessageIcon && <state.validationMessageIcon />}\n {state.validationMessage.children}\n </state.validationMessage>\n )}\n\n {state.hint && <state.hint />}\n </state.root>\n </FieldContextProvider>\n );\n};\n"],"names":["assertSlots","FieldContextProvider","getFieldControlProps","renderField_unstable","state","contextValues","children","field","value","root","label","validationMessage","validationMessageIcon","hint"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,uBAAuB;AAGlF;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC;IACtDL,YAAwBI;IAExB,IAAI,EAAEE,QAAQ,EAAE,GAAGF;IACnB,IAAI,OAAOE,aAAa,YAAY;QAClCA,WAAWA,SAASJ,qBAAqBG,cAAcE,KAAK,KAAK,CAAC;IACpE;IAEA,qBACE,KAACN;QAAqBO,KAAK,EAAEH,0BAAAA,oCAAAA,cAAeE,KAAK;kBAC/C,cAAA,MAACH,MAAMK,IAAI;;gBACRL,MAAMM,KAAK,kBAAI,KAACN,MAAMM,KAAK;gBAC3BJ;gBACAF,MAAMO,iBAAiB,kBACtB,MAACP,MAAMO,iBAAiB;;wBACrBP,MAAMQ,qBAAqB,kBAAI,KAACR,MAAMQ,qBAAqB;wBAC3DR,MAAMO,iBAAiB,CAACL,QAAQ;;;gBAIpCF,MAAMS,IAAI,kBAAI,KAACT,MAAMS,IAAI;;;;AAIlC,EAAE"}
|
@@ -7,7 +7,6 @@ export function useFieldControlProps_unstable(props, options) {
|
|
7
7
|
* Implementation of useFieldControlProps_unstable.
|
8
8
|
* Split out so it can be used directly in renderField_unstable.
|
9
9
|
*/ export function getFieldControlProps(context, props, options) {
|
10
|
-
var _options, _options1;
|
11
10
|
if (!context) {
|
12
11
|
return props;
|
13
12
|
}
|
@@ -23,7 +22,7 @@ export function useFieldControlProps_unstable(props, options) {
|
|
23
22
|
}
|
24
23
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
25
24
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
26
|
-
if (labelId && (!(
|
25
|
+
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
|
27
26
|
var _props1, _arialabelledby;
|
28
27
|
var _;
|
29
28
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
@@ -32,36 +31,34 @@ export function useFieldControlProps_unstable(props, options) {
|
|
32
31
|
// We also preserve and append any aria-describedby from props.
|
33
32
|
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
34
33
|
if (validationMessageId || hintId) {
|
35
|
-
var _props2;
|
36
34
|
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
37
35
|
props['aria-describedby'] = [
|
38
36
|
validationMessageId,
|
39
37
|
hintId,
|
40
|
-
|
38
|
+
props === null || props === void 0 ? void 0 : props['aria-describedby']
|
41
39
|
].filter(Boolean).join(' ');
|
42
40
|
}
|
43
41
|
if (validationState === 'error') {
|
44
|
-
var
|
42
|
+
var _props2, _ariainvalid;
|
45
43
|
var _1;
|
46
|
-
(_1 = (
|
44
|
+
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
47
45
|
}
|
48
46
|
if (required) {
|
49
|
-
|
50
|
-
|
51
|
-
var _props4;
|
47
|
+
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
48
|
+
var _props3;
|
52
49
|
var _required;
|
53
|
-
(_required = (
|
50
|
+
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
54
51
|
} else {
|
55
|
-
var
|
52
|
+
var _props4, _ariarequired;
|
56
53
|
var _2;
|
57
|
-
(_2 = (
|
54
|
+
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
58
55
|
}
|
59
56
|
}
|
60
57
|
// Include the size prop if this control supports it
|
61
|
-
if (
|
62
|
-
var
|
58
|
+
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
|
59
|
+
var _props5;
|
63
60
|
var _size;
|
64
|
-
(_size = (
|
61
|
+
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
65
62
|
}
|
66
63
|
return props;
|
67
64
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldControlProps.ts"],"sourcesContent":["import type { FieldContextValue, FieldControlProps } from '../Field';\nimport { useFieldContext_unstable } from './FieldContext';\n\n/**\n * Options for `useFieldControlProps_unstable`.\n */\nexport type FieldControlPropsOptions = {\n /**\n * Skips setting `aria-labelledby` on the control if the `label.htmlFor` refers to the control.\n *\n * This should be used with controls that can be the target of a label's `for` prop:\n * `<button>`, `<input>`, `<progress>`, `<select>`, `<textarea>`.\n */\n supportsLabelFor?: boolean;\n\n /**\n * Sets `required` instead of `aria-required` when the Field is marked required.\n *\n * This should be used with controls that support the `required` prop:\n * `<input>` (except `range` or `color`), `<select>`, `<textarea>`.\n */\n supportsRequired?: boolean;\n\n /**\n * Sets the size prop on the control to match the Field's size: `'small' | 'medium' | 'large'`.\n *\n * This should be used with controls that have a custom size prop that matches the Field's size prop.\n */\n supportsSize?: boolean;\n};\n\n/**\n * Gets the control props from the field context, if this inside a `<Field>`.\n *\n * When called with no arguments, returns the FieldControlProps that should be applied to the control.\n *\n * @returns A FieldControlProps object if inside a `<Field>`, otherwise undefined.\n */\nexport function useFieldControlProps_unstable(): FieldControlProps | undefined;\n\n/**\n * Copies and merges the FieldControlProps with the given props, if this inside a `<Field>`.\n *\n * @param props - The existing props for the control. These will be merged with the control props from the field context.\n * @param options - Option to include the size prop.\n * @returns Merged props if inside a `<Field>`, otherwise the original props, or undefined if no props given.\n */\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props: Props,\n options?: FieldControlPropsOptions,\n): Props;\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */\nexport function getFieldControlProps<Props extends FieldControlProps>(\n context: FieldContextValue | undefined,\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n if (!context) {\n return props;\n }\n\n // Create a copy of props so we don't modify the original\n props = { ...props } as Props;\n\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n\n if (generatedControlId) {\n props.id ??= generatedControlId;\n }\n\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!options?.supportsLabelFor || labelFor !== props.id)) {\n props['aria-labelledby'] ??= labelId;\n }\n\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [validationMessageId, hintId, props?.['aria-describedby']].filter(Boolean).join(' ');\n }\n\n if (validationState === 'error') {\n props['aria-invalid'] ??= true;\n }\n\n if (required) {\n if (options?.supportsRequired) {\n (props as { required?: boolean }).required ??= true;\n } else {\n props['aria-required'] ??= true;\n }\n }\n\n // Include the size prop if this control supports it\n if (options?.supportsSize) {\n (props as { size?: FieldContextValue['size'] }).size ??= context.size;\n }\n\n return props;\n}\n"],"names":["useFieldContext_unstable","useFieldControlProps_unstable","props","options","getFieldControlProps","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","id","supportsLabelFor","filter","Boolean","join","supportsRequired","supportsSize","size"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,iBAAiB;AAkD1D,OAAO,SAASC,8BACdC,KAAa,EACbC,OAAkC;IAElC,OAAOC,qBAAqBJ,4BAA4BE,OAAOC;AACjE;AAEA;;;;CAIC,GACD,OAAO,SAASC,qBACdC,OAAsC,EACtCH,KAAa,EACbC,OAAkC;
|
1
|
+
{"version":3,"sources":["useFieldControlProps.ts"],"sourcesContent":["import type { FieldContextValue, FieldControlProps } from '../Field';\nimport { useFieldContext_unstable } from './FieldContext';\n\n/**\n * Options for `useFieldControlProps_unstable`.\n */\nexport type FieldControlPropsOptions = {\n /**\n * Skips setting `aria-labelledby` on the control if the `label.htmlFor` refers to the control.\n *\n * This should be used with controls that can be the target of a label's `for` prop:\n * `<button>`, `<input>`, `<progress>`, `<select>`, `<textarea>`.\n */\n supportsLabelFor?: boolean;\n\n /**\n * Sets `required` instead of `aria-required` when the Field is marked required.\n *\n * This should be used with controls that support the `required` prop:\n * `<input>` (except `range` or `color`), `<select>`, `<textarea>`.\n */\n supportsRequired?: boolean;\n\n /**\n * Sets the size prop on the control to match the Field's size: `'small' | 'medium' | 'large'`.\n *\n * This should be used with controls that have a custom size prop that matches the Field's size prop.\n */\n supportsSize?: boolean;\n};\n\n/**\n * Gets the control props from the field context, if this inside a `<Field>`.\n *\n * When called with no arguments, returns the FieldControlProps that should be applied to the control.\n *\n * @returns A FieldControlProps object if inside a `<Field>`, otherwise undefined.\n */\nexport function useFieldControlProps_unstable(): FieldControlProps | undefined;\n\n/**\n * Copies and merges the FieldControlProps with the given props, if this inside a `<Field>`.\n *\n * @param props - The existing props for the control. These will be merged with the control props from the field context.\n * @param options - Option to include the size prop.\n * @returns Merged props if inside a `<Field>`, otherwise the original props, or undefined if no props given.\n */\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props: Props,\n options?: FieldControlPropsOptions,\n): Props;\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */\nexport function getFieldControlProps<Props extends FieldControlProps>(\n context: FieldContextValue | undefined,\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n if (!context) {\n return props;\n }\n\n // Create a copy of props so we don't modify the original\n props = { ...props } as Props;\n\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n\n if (generatedControlId) {\n props.id ??= generatedControlId;\n }\n\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!options?.supportsLabelFor || labelFor !== props.id)) {\n props['aria-labelledby'] ??= labelId;\n }\n\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [validationMessageId, hintId, props?.['aria-describedby']].filter(Boolean).join(' ');\n }\n\n if (validationState === 'error') {\n props['aria-invalid'] ??= true;\n }\n\n if (required) {\n if (options?.supportsRequired) {\n (props as { required?: boolean }).required ??= true;\n } else {\n props['aria-required'] ??= true;\n }\n }\n\n // Include the size prop if this control supports it\n if (options?.supportsSize) {\n (props as { size?: FieldContextValue['size'] }).size ??= context.size;\n }\n\n return props;\n}\n"],"names":["useFieldContext_unstable","useFieldControlProps_unstable","props","options","getFieldControlProps","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","id","supportsLabelFor","filter","Boolean","join","supportsRequired","supportsSize","size"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,iBAAiB;AAkD1D,OAAO,SAASC,8BACdC,KAAa,EACbC,OAAkC;IAElC,OAAOC,qBAA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BA,OAAK,CAAC,cAAgB,GAAK;QAC7B;IACF;IAEA,oDAAoD;IACpD,IAAIC,oBAAAA,8BAAAA,QAASgB,YAAY,EAAE;YACxBjB;;QAAD,UAACA,UAAAA,OAA+CkB,6CAA/ClB,QAA+CkB,OAASf,QAAQe,IAAI;IACvE;IAEA,OAAOlB;AACT"}
|
@@ -12,14 +12,13 @@ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
12
|
const _reactutilities = require("@fluentui/react-utilities");
|
13
13
|
const _index = require("../../contexts/index");
|
14
14
|
const renderField_unstable = (state, contextValues)=>{
|
15
|
-
var _contextValues;
|
16
15
|
(0, _reactutilities.assertSlots)(state);
|
17
16
|
let { children } = state;
|
18
17
|
if (typeof children === 'function') {
|
19
18
|
children = children((0, _index.getFieldControlProps)(contextValues.field) || {});
|
20
19
|
}
|
21
20
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.FieldContextProvider, {
|
22
|
-
value:
|
21
|
+
value: contextValues === null || contextValues === void 0 ? void 0 : contextValues.field,
|
23
22
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
24
23
|
children: [
|
25
24
|
state.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.label, {}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderField.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\n/**\n * Render the final JSX of Field\n */ export const renderField_unstable = (state, contextValues)=>{\n
|
1
|
+
{"version":3,"sources":["renderField.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\n/**\n * Render the final JSX of Field\n */ export const renderField_unstable = (state, contextValues)=>{\n assertSlots(state);\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n return /*#__PURE__*/ _jsx(FieldContextProvider, {\n value: contextValues === null || contextValues === void 0 ? void 0 : contextValues.field,\n children: /*#__PURE__*/ _jsxs(state.root, {\n children: [\n state.label && /*#__PURE__*/ _jsx(state.label, {}),\n children,\n state.validationMessage && /*#__PURE__*/ _jsxs(state.validationMessage, {\n children: [\n state.validationMessageIcon && /*#__PURE__*/ _jsx(state.validationMessageIcon, {}),\n state.validationMessage.children\n ]\n }),\n state.hint && /*#__PURE__*/ _jsx(state.hint, {})\n ]\n })\n });\n};\n"],"names":["renderField_unstable","state","contextValues","assertSlots","children","getFieldControlProps","field","_jsx","FieldContextProvider","value","_jsxs","root","label","validationMessage","validationMessageIcon","hint"],"mappings":";;;;+BAKiBA;;;eAAAA;;;4BAL4B;gCACjB;uBAC+B;AAGhD,MAAMA,uBAAuB,CAACC,OAAOC;IAC5CC,IAAAA,2BAAW,EAACF;IACZ,IAAI,EAAEG,QAAQ,EAAE,GAAGH;IACnB,IAAI,OAAOG,aAAa,YAAY;QAChCA,WAAWA,SAASC,IAAAA,2BAAoB,EAACH,cAAcI,KAAK,KAAK,CAAC;IACtE;IACA,OAAO,WAAW,GAAGC,IAAAA,eAAI,EAACC,2BAAoB,EAAE;QAC5CC,OAAOP,kBAAkB,QAAQA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcI,KAAK;QACxFF,UAAU,WAAW,GAAGM,IAAAA,gBAAK,EAACT,MAAMU,IAAI,EAAE;YACtCP,UAAU;gBACNH,MAAMW,KAAK,IAAI,WAAW,GAAGL,IAAAA,eAAI,EAACN,MAAMW,KAAK,EAAE,CAAC;gBAChDR;gBACAH,MAAMY,iBAAiB,IAAI,WAAW,GAAGH,IAAAA,gBAAK,EAACT,MAAMY,iBAAiB,EAAE;oBACpET,UAAU;wBACNH,MAAMa,qBAAqB,IAAI,WAAW,GAAGP,IAAAA,eAAI,EAACN,MAAMa,qBAAqB,EAAE,CAAC;wBAChFb,MAAMY,iBAAiB,CAACT,QAAQ;qBACnC;gBACL;gBACAH,MAAMc,IAAI,IAAI,WAAW,GAAGR,IAAAA,eAAI,EAACN,MAAMc,IAAI,EAAE,CAAC;aACjD;QACL;IACJ;AACJ"}
|
@@ -21,7 +21,6 @@ function useFieldControlProps_unstable(props, options) {
|
|
21
21
|
return getFieldControlProps((0, _FieldContext.useFieldContext_unstable)(), props, options);
|
22
22
|
}
|
23
23
|
function getFieldControlProps(context, props, options) {
|
24
|
-
var _options, _options1;
|
25
24
|
if (!context) {
|
26
25
|
return props;
|
27
26
|
}
|
@@ -37,7 +36,7 @@ function getFieldControlProps(context, props, options) {
|
|
37
36
|
}
|
38
37
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
39
38
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
40
|
-
if (labelId && (!(
|
39
|
+
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
|
41
40
|
var _props1, _arialabelledby;
|
42
41
|
var _;
|
43
42
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
@@ -46,36 +45,34 @@ function getFieldControlProps(context, props, options) {
|
|
46
45
|
// We also preserve and append any aria-describedby from props.
|
47
46
|
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
48
47
|
if (validationMessageId || hintId) {
|
49
|
-
var _props2;
|
50
48
|
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
51
49
|
props['aria-describedby'] = [
|
52
50
|
validationMessageId,
|
53
51
|
hintId,
|
54
|
-
|
52
|
+
props === null || props === void 0 ? void 0 : props['aria-describedby']
|
55
53
|
].filter(Boolean).join(' ');
|
56
54
|
}
|
57
55
|
if (validationState === 'error') {
|
58
|
-
var
|
56
|
+
var _props2, _ariainvalid;
|
59
57
|
var _1;
|
60
|
-
(_1 = (
|
58
|
+
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
61
59
|
}
|
62
60
|
if (required) {
|
63
|
-
|
64
|
-
|
65
|
-
var _props4;
|
61
|
+
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
62
|
+
var _props3;
|
66
63
|
var _required;
|
67
|
-
(_required = (
|
64
|
+
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
68
65
|
} else {
|
69
|
-
var
|
66
|
+
var _props4, _ariarequired;
|
70
67
|
var _2;
|
71
|
-
(_2 = (
|
68
|
+
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
72
69
|
}
|
73
70
|
}
|
74
71
|
// Include the size prop if this control supports it
|
75
|
-
if (
|
76
|
-
var
|
72
|
+
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
|
73
|
+
var _props5;
|
77
74
|
var _size;
|
78
|
-
(_size = (
|
75
|
+
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
79
76
|
}
|
80
77
|
return props;
|
81
78
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["import { useFieldContext_unstable } from './FieldContext';\nexport function useFieldControlProps_unstable(props, options) {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */ export function getFieldControlProps(context, props, options) {\n
|
1
|
+
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["import { useFieldContext_unstable } from './FieldContext';\nexport function useFieldControlProps_unstable(props, options) {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */ export function getFieldControlProps(context, props, options) {\n if (!context) {\n return props;\n }\n // Create a copy of props so we don't modify the original\n props = {\n ...props\n };\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n if (generatedControlId) {\n var _props;\n var _id;\n (_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;\n }\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {\n var _props1, _arialabelledby;\n var _;\n (_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;\n }\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [\n validationMessageId,\n hintId,\n props === null || props === void 0 ? void 0 : props['aria-describedby']\n ].filter(Boolean).join(' ');\n }\n if (validationState === 'error') {\n var _props2, _ariainvalid;\n var _1;\n (_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;\n }\n if (required) {\n if (options === null || options === void 0 ? void 0 : options.supportsRequired) {\n var _props3;\n var _required;\n (_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;\n } else {\n var _props4, _ariarequired;\n var _2;\n (_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;\n }\n }\n // Include the size prop if this control supports it\n if (options === null || options === void 0 ? void 0 : options.supportsSize) {\n var _props5;\n var _size;\n (_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;\n }\n return props;\n}\n"],"names":["useFieldControlProps_unstable","getFieldControlProps","props","options","useFieldContext_unstable","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","_props","_id","id","supportsLabelFor","_props1","_arialabelledby","_","filter","Boolean","join","_props2","_ariainvalid","_1","supportsRequired","_props3","_required","_props4","_ariarequired","_2","supportsSize","_props5","_size","size"],"mappings":";;;;;;;;;;;IACgBA,6BAA6B;eAA7BA;;IAOIC,oBAAoB;eAApBA;;;8BARqB;AAClC,SAASD,8BAA8BE,KAAK,EAAEC,OAAO;IACxD,OAAOF,qBAAqBG,IAAAA,sCAAwB,KAAIF,OAAOC;AACnE;AAKW,SAASF,qBAAqBI,OAAO,EAAEH,KAAK,EAAEC,OAAO;IAC5D,IAAI,CAACE,SAAS;QACV,OAAOH;IACX;IACA,yDAAyD;IACzDA,QAAQ;QACJ,GAAGA,KAAK;IACZ;IACA,MAAM,EAAEI,kBAAkB,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,mBAAmB,EAAEC,eAAe,EAAE,GAAGP;IAC1G,IAAIC,oBAAoB;QACpB,IAAIO;QACJ,IAAIC;QACHA,CAAAA,MAAM,AAACD,CAAAA,SAASX,KAAI,EAAGa,EAAE,AAAD,MAAO,QAAQD,QAAQ,KAAK,IAAIA,MAAMD,OAAOE,EAAE,GAAGT;IAC/E;IACA,4GAA4G;IAC5G,6GAA6G;IAC7G,IAAIG,WAAY,CAAA,CAAEN,CAAAA,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQa,gBAAgB,AAAD,KAAMR,aAAaN,MAAMa,EAAE,AAAD,GAAI;QACrH,IAAIE,SAASC;QACb,IAAIC;QACHA,CAAAA,IAAI,AAACF,CAAAA,UAAUf,KAAI,CAAE,CAACgB,kBAAkB,kBAAkB,AAAD,MAAO,QAAQC,MAAM,KAAK,IAAIA,IAAIF,OAAO,CAACC,gBAAgB,GAAGT;IAC3H;IACA,wEAAwE;IACx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6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "9.1.
|
3
|
+
"version": "9.1.30",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,12 +33,12 @@
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-context-selector": "^9.1.
|
37
|
-
"@fluentui/react-icons": "^2.0.
|
38
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
39
|
-
"@fluentui/react-label": "^9.1.
|
40
|
-
"@fluentui/react-theme": "^9.1.
|
41
|
-
"@fluentui/react-utilities": "^9.13.
|
36
|
+
"@fluentui/react-context-selector": "^9.1.35",
|
37
|
+
"@fluentui/react-icons": "^2.0.217",
|
38
|
+
"@fluentui/react-jsx-runtime": "^9.0.11",
|
39
|
+
"@fluentui/react-label": "^9.1.38",
|
40
|
+
"@fluentui/react-theme": "^9.1.13",
|
41
|
+
"@fluentui/react-utilities": "^9.13.4",
|
42
42
|
"@griffel/react": "^1.5.14",
|
43
43
|
"@swc/helpers": "^0.5.1"
|
44
44
|
},
|