@fluentui/react-field 0.0.0-nightly-20230728-0413.1 → 0.0.0-nightly-20230801-0416.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.json +17 -17
- package/CHANGELOG.md +11 -11
- package/lib/contexts/useFieldControlProps.js +6 -1
- package/lib/contexts/useFieldControlProps.js.map +1 -1
- package/lib-commonjs/contexts/useFieldControlProps.js +6 -1
- package/lib-commonjs/contexts/useFieldControlProps.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-field_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 01 Aug 2023 04:22:54 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v0.0.0-nightly-20230801-0416.1",
|
7
|
+
"version": "0.0.0-nightly-20230801-0416.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,44 +16,44 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-field",
|
19
|
-
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230801-0416.1",
|
20
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-field",
|
25
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230801-0416.1",
|
26
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-field",
|
31
|
-
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230801-0416.1",
|
32
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-field",
|
37
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230801-0416.1",
|
38
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-field",
|
43
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230801-0416.1",
|
44
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
45
45
|
},
|
46
46
|
{
|
47
47
|
"author": "beachball",
|
48
48
|
"package": "@fluentui/react-field",
|
49
|
-
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-
|
50
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230801-0416.1",
|
50
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"author": "beachball",
|
54
54
|
"package": "@fluentui/react-field",
|
55
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
56
|
-
"commit": "
|
55
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230801-0416.1",
|
56
|
+
"commit": "c709049b745bb4a6e1729b2b47ed2f44aee2f308"
|
57
57
|
}
|
58
58
|
]
|
59
59
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 01 Aug 2023 04:22:54 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230801-0416.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v0.0.0-nightly-20230801-0416.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.13..@fluentui/react-field_v0.0.0-nightly-
|
9
|
+
Tue, 01 Aug 2023 04:22:54 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.13..@fluentui/react-field_v0.0.0-nightly-20230801-0416.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-label to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
20
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
21
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
17
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
18
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
19
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
20
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
21
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230801-0416.1 ([commit](https://github.com/microsoft/fluentui/commit/c709049b745bb4a6e1729b2b47ed2f44aee2f308) by beachball)
|
22
22
|
|
23
23
|
## [9.1.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.13)
|
24
24
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
var _props, _props1, _arialabelledby, _props2, _ariainvalid, _props3, _props4, _ariarequired, _props5;
|
2
1
|
import { useFieldContext_unstable } from './FieldContext';
|
3
2
|
export function useFieldControlProps_unstable(props, options) {
|
4
3
|
return getFieldControlProps(useFieldContext_unstable(), props, options);
|
@@ -17,12 +16,14 @@ export function useFieldControlProps_unstable(props, options) {
|
|
17
16
|
};
|
18
17
|
const { generatedControlId , hintId , labelFor , labelId , required , validationMessageId , validationState } = context;
|
19
18
|
if (generatedControlId) {
|
19
|
+
var _props;
|
20
20
|
var _id;
|
21
21
|
(_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;
|
22
22
|
}
|
23
23
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
24
24
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
25
25
|
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
|
26
|
+
var _props1, _arialabelledby;
|
26
27
|
var _;
|
27
28
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
28
29
|
}
|
@@ -38,20 +39,24 @@ export function useFieldControlProps_unstable(props, options) {
|
|
38
39
|
].filter(Boolean).join(' ');
|
39
40
|
}
|
40
41
|
if (validationState === 'error') {
|
42
|
+
var _props2, _ariainvalid;
|
41
43
|
var _1;
|
42
44
|
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
43
45
|
}
|
44
46
|
if (required) {
|
45
47
|
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
48
|
+
var _props3;
|
46
49
|
var _required;
|
47
50
|
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
48
51
|
} else {
|
52
|
+
var _props4, _ariarequired;
|
49
53
|
var _2;
|
50
54
|
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
51
55
|
}
|
52
56
|
}
|
53
57
|
// Include the size prop if this control supports it
|
54
58
|
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
|
59
|
+
var _props5;
|
55
60
|
var _size;
|
56
61
|
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
57
62
|
}
|
@@ -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":["
|
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,EACf;IACnB,OAAOC,qBAAqBJ,4BAA4BE,OAAOC;AACjE,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASC,qBACdC,OAAsC,EACtCH,KAAa,EACbC,OAAkC,EACf;IACnB,IAAI,CAACE,SAAS;QACZ,OAAOH;IACT,CAAC;IAED,yDAAyD;IACzDA,QAAQ;QAAE,GAAGA,KAAK;IAAC;IAEnB,MAAM,EAAEI,mBAAkB,EAAEC,OAAM,EAAEC,SAAQ,EAAEC,QAAO,EAAEC,SAAQ,EAAEC,oBAAmB,EAAEC,gBAAe,EAAE,GAAGP;IAE1G,IAAIC,oBAAoB;YACtBJ;;QAAAA,QAAAA,SAAAA,OAAMW,uCAANX,OAAMW,KAAOP,kBAAkB;IACjC,CAAC;IAED,4GAA4G;IAC5G,6GAA6G;IAC7G,IAAIG,WAAY,CAAA,CAACN,CAAAA,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASW,gBAAgB,AAAD,KAAKN,aAAaN,MAAMW,EAAE,AAAD,GAAI;YACpEX,SAAM;;QAANA,MAAAA,UAAAA,MAAK,CAAC,kBAAA,kBAAkB,iCAAxBA,OAAK,CAAC,gBAAkB,GAAKO,OAAO;IACtC,CAAC;IAED,wEAAwE;IACxE,+DAA+D;IAC/D,yFAAyF;IACzF,IAAIE,uBAAuBJ,QAAQ;QACjC,kFAAkF;QAClFL,KAAK,CAAC,mBAAmB,GAAG;YAACS;YAAqBJ;YAAQL,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,mBAAmB;SAAC,CAACa,MAAM,CAACC,SAASC,IAAI,CAAC;IAC9G,CAAC;IAED,IAAIL,oBAAoB,SAAS;YAC/BV,SAAM;;QAANA,OAAAA,UAAAA,MAAK,CAAC,eAAA,eAAe,mCAArBA,OAAK,CAAC,aAAe,GAAK,IAAI;IAChC,CAAC;IAED,IAAIQ,UAAU;QACZ,IAAIP,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASe,gBAAgB,EAAE;gBAC5BhB;;YAAD,cAACA,UAAAA,OAAiCQ,yDAAjCR,QAAiCQ,WAAa,IAAI;QACrD,OAAO;gBACLR,SAAM;;YAANA,OAAAA,UAAAA,MAAK,CAAC,gBAAA,gBAAgB,mCAAtBA,OAAK,CAAC,cAAgB,GAAK,IAAI;QACjC,CAAC;IACH,CAAC;IAED,oDAAoD;IACpD,IAAIC,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASgB,YAAY,EAAE;YACxBjB;;QAAD,UAACA,UAAAA,OAA+CkB,6CAA/ClB,QAA+CkB,OAASf,QAAQe,IAAI;IACvE,CAAC;IAED,OAAOlB;AACT,CAAC"}
|
@@ -13,7 +13,6 @@ _export(exports, {
|
|
13
13
|
getFieldControlProps: ()=>getFieldControlProps
|
14
14
|
});
|
15
15
|
const _fieldContext = require("./FieldContext");
|
16
|
-
var _props, _props1, _arialabelledby, _props2, _ariainvalid, _props3, _props4, _ariarequired, _props5;
|
17
16
|
function useFieldControlProps_unstable(props, options) {
|
18
17
|
return getFieldControlProps((0, _fieldContext.useFieldContext_unstable)(), props, options);
|
19
18
|
}
|
@@ -27,12 +26,14 @@ function getFieldControlProps(context, props, options) {
|
|
27
26
|
};
|
28
27
|
const { generatedControlId , hintId , labelFor , labelId , required , validationMessageId , validationState } = context;
|
29
28
|
if (generatedControlId) {
|
29
|
+
var _props;
|
30
30
|
var _id;
|
31
31
|
(_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;
|
32
32
|
}
|
33
33
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
34
34
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
35
35
|
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
|
36
|
+
var _props1, _arialabelledby;
|
36
37
|
var _;
|
37
38
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
38
39
|
}
|
@@ -48,20 +49,24 @@ function getFieldControlProps(context, props, options) {
|
|
48
49
|
].filter(Boolean).join(' ');
|
49
50
|
}
|
50
51
|
if (validationState === 'error') {
|
52
|
+
var _props2, _ariainvalid;
|
51
53
|
var _1;
|
52
54
|
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
53
55
|
}
|
54
56
|
if (required) {
|
55
57
|
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
58
|
+
var _props3;
|
56
59
|
var _required;
|
57
60
|
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
58
61
|
} else {
|
62
|
+
var _props4, _ariarequired;
|
59
63
|
var _2;
|
60
64
|
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
61
65
|
}
|
62
66
|
}
|
63
67
|
// Include the size prop if this control supports it
|
64
68
|
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
|
69
|
+
var _props5;
|
65
70
|
var _size;
|
66
71
|
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
67
72
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["
|
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":"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"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230801-0416.1",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,18 +27,18 @@
|
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
30
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20230801-0416.1",
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230801-0416.1",
|
32
32
|
"@fluentui/scripts-api-extractor": "*",
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-context-selector": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-context-selector": "0.0.0-nightly-20230801-0416.1",
|
37
37
|
"@fluentui/react-icons": "^2.0.207",
|
38
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
39
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
40
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
41
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
38
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230801-0416.1",
|
39
|
+
"@fluentui/react-label": "0.0.0-nightly-20230801-0416.1",
|
40
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230801-0416.1",
|
41
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230801-0416.1",
|
42
42
|
"@griffel/react": "^1.5.7",
|
43
43
|
"@swc/helpers": "^0.4.14"
|
44
44
|
},
|