@fluentui/react-field 9.1.5 → 9.1.7
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 +97 -1
- package/CHANGELOG.md +31 -2
- package/lib/Field.js +0 -1
- package/lib/Field.js.map +1 -1
- package/lib/components/Field/Field.js +5 -6
- package/lib/components/Field/Field.js.map +1 -1
- package/lib/components/Field/Field.types.js +0 -1
- package/lib/components/Field/Field.types.js.map +1 -1
- package/lib/components/Field/index.js +0 -1
- package/lib/components/Field/index.js.map +1 -1
- package/lib/components/Field/renderField.js +10 -17
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/components/Field/useField.js +60 -66
- package/lib/components/Field/useField.js.map +1 -1
- package/lib/components/Field/useFieldStyles.styles.js.map +1 -1
- package/lib/contexts/FieldContext.js +2 -3
- package/lib/contexts/FieldContext.js.map +1 -1
- package/lib/contexts/index.js +0 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/useFieldContextValues.js +31 -29
- package/lib/contexts/useFieldContextValues.js.map +1 -1
- package/lib/contexts/useFieldControlProps.js +49 -55
- package/lib/contexts/useFieldControlProps.js.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Field.js +0 -3
- package/lib-commonjs/Field.js.map +1 -1
- package/lib-commonjs/components/Field/Field.js +1 -3
- package/lib-commonjs/components/Field/Field.js.map +1 -1
- package/lib-commonjs/components/Field/Field.types.js +0 -3
- package/lib-commonjs/components/Field/Field.types.js.map +1 -1
- package/lib-commonjs/components/Field/index.js +0 -3
- package/lib-commonjs/components/Field/index.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js +1 -3
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/components/Field/useField.js +1 -3
- package/lib-commonjs/components/Field/useField.js.map +1 -1
- package/lib-commonjs/components/Field/useFieldStyles.styles.js +0 -2
- package/lib-commonjs/components/Field/useFieldStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/FieldContext.js +1 -3
- package/lib-commonjs/contexts/FieldContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +0 -3
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/useFieldContextValues.js +1 -3
- package/lib-commonjs/contexts/useFieldContextValues.js.map +1 -1
- package/lib-commonjs/contexts/useFieldControlProps.js +1 -3
- package/lib-commonjs/contexts/useFieldControlProps.js.map +1 -1
- package/lib-commonjs/index.js +0 -3
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
@@ -1,33 +1,35 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
/**
|
3
3
|
* Get the context values used when rendering Field.
|
4
|
-
*/
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
4
|
+
*/ export const useFieldContextValues_unstable = (state)=>{
|
5
|
+
var _state_label, _state_label1, _state_validationMessage, _state_hint;
|
6
|
+
const { generatedControlId , orientation , required , size , validationState } = state;
|
7
|
+
const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;
|
8
|
+
const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;
|
9
|
+
const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;
|
10
|
+
const hintId = (_state_hint = state.hint) === null || _state_hint === void 0 ? void 0 : _state_hint.id;
|
11
|
+
const field = React.useMemo(()=>({
|
12
|
+
generatedControlId,
|
13
|
+
hintId,
|
14
|
+
labelFor,
|
15
|
+
labelId,
|
16
|
+
orientation,
|
17
|
+
required,
|
18
|
+
size,
|
19
|
+
validationMessageId,
|
20
|
+
validationState
|
21
|
+
}), [
|
22
|
+
generatedControlId,
|
23
|
+
hintId,
|
24
|
+
labelFor,
|
25
|
+
labelId,
|
26
|
+
orientation,
|
27
|
+
required,
|
28
|
+
size,
|
29
|
+
validationMessageId,
|
30
|
+
validationState
|
31
|
+
]);
|
32
|
+
return {
|
33
|
+
field
|
34
|
+
};
|
32
35
|
};
|
33
|
-
//# sourceMappingURL=useFieldContextValues.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["useFieldContextValues.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { FieldContextValue, FieldContextValues, FieldState } from '../Field';\n\n/**\n * Get the context values used when rendering Field.\n */\nexport const useFieldContextValues_unstable = (state: FieldState): FieldContextValues => {\n const { generatedControlId, orientation, required, size, validationState } = state;\n const labelFor = state.label?.htmlFor;\n const labelId = state.label?.id;\n const validationMessageId = state.validationMessage?.id;\n const hintId = state.hint?.id;\n\n const field: FieldContextValue = React.useMemo(\n () => ({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState,\n }),\n [generatedControlId, hintId, labelFor, labelId, orientation, required, size, validationMessageId, validationState],\n );\n\n return { field };\n};\n"],"names":["React","useFieldContextValues_unstable","state","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC,QAA0C;QAEtEA,cACDA,eACYA,0BACbA;IAJf,MAAM,EAAEC,mBAAkB,EAAEC,YAAW,EAAEC,SAAQ,EAAEC,KAAI,EAAEC,gBAAe,EAAE,GAAGL;IAC7E,MAAMM,WAAWN,CAAAA,eAAAA,MAAMO,KAAK,cAAXP,0BAAAA,KAAAA,IAAAA,aAAaQ,OAAO;IACrC,MAAMC,UAAUT,CAAAA,gBAAAA,MAAMO,KAAK,cAAXP,2BAAAA,KAAAA,IAAAA,cAAaU,EAAE;IAC/B,MAAMC,sBAAsBX,CAAAA,2BAAAA,MAAMY,iBAAiB,cAAvBZ,sCAAAA,KAAAA,IAAAA,yBAAyBU,EAAE;IACvD,MAAMG,SAASb,CAAAA,cAAAA,MAAMc,IAAI,cAAVd,yBAAAA,KAAAA,IAAAA,YAAYU,EAAE;IAE7B,MAAMK,QAA2BjB,MAAMkB,OAAO,CAC5C,IAAO,CAAA;YACLf;YACAY;YACAP;YACAG;YACAP;YACAC;YACAC;YACAO;YACAN;QACF,CAAA,GACA;QAACJ;QAAoBY;QAAQP;QAAUG;QAASP;QAAaC;QAAUC;QAAMO;QAAqBN;KAAgB;IAGpH,OAAO;QAAEU;IAAM;AACjB,EAAE"}
|
@@ -1,65 +1,59 @@
|
|
1
1
|
var _props, _props1, _arialabelledby, _props2, _ariainvalid, _props3, _props4, _ariarequired, _props5;
|
2
2
|
import { useFieldContext_unstable } from './FieldContext';
|
3
3
|
export function useFieldControlProps_unstable(props, options) {
|
4
|
-
|
4
|
+
return getFieldControlProps(useFieldContext_unstable(), props, options);
|
5
5
|
}
|
6
6
|
/**
|
7
7
|
* @internal
|
8
8
|
* Implementation of useFieldControlProps_unstable.
|
9
9
|
* Split out so it can be used directly in renderField_unstable.
|
10
|
-
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
// We also preserve and append any aria-describedby from props.
|
40
|
-
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
41
|
-
if (validationMessageId || hintId) {
|
42
|
-
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
43
|
-
props['aria-describedby'] = [validationMessageId, hintId, props === null || props === void 0 ? void 0 : props['aria-describedby']].filter(Boolean).join(' ');
|
44
|
-
}
|
45
|
-
if (validationState === 'error') {
|
46
|
-
var _1;
|
47
|
-
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
48
|
-
}
|
49
|
-
if (required) {
|
50
|
-
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
51
|
-
var _required;
|
52
|
-
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
53
|
-
} else {
|
54
|
-
var _2;
|
55
|
-
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
10
|
+
*/ export function getFieldControlProps(context, props, options) {
|
11
|
+
if (!context) {
|
12
|
+
return props;
|
13
|
+
}
|
14
|
+
// Create a copy of props so we don't modify the original
|
15
|
+
props = {
|
16
|
+
...props
|
17
|
+
};
|
18
|
+
const { generatedControlId , hintId , labelFor , labelId , required , validationMessageId , validationState } = context;
|
19
|
+
if (generatedControlId) {
|
20
|
+
var _id;
|
21
|
+
(_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;
|
22
|
+
}
|
23
|
+
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
24
|
+
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
25
|
+
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
|
26
|
+
var _;
|
27
|
+
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
28
|
+
}
|
29
|
+
// The control is described by the validation message, or hint, or both.
|
30
|
+
// We also preserve and append any aria-describedby from props.
|
31
|
+
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
32
|
+
if (validationMessageId || hintId) {
|
33
|
+
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
34
|
+
props['aria-describedby'] = [
|
35
|
+
validationMessageId,
|
36
|
+
hintId,
|
37
|
+
props === null || props === void 0 ? void 0 : props['aria-describedby']
|
38
|
+
].filter(Boolean).join(' ');
|
56
39
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
40
|
+
if (validationState === 'error') {
|
41
|
+
var _1;
|
42
|
+
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
|
43
|
+
}
|
44
|
+
if (required) {
|
45
|
+
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
|
46
|
+
var _required;
|
47
|
+
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
|
48
|
+
} else {
|
49
|
+
var _2;
|
50
|
+
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
// Include the size prop if this control supports it
|
54
|
+
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
|
55
|
+
var _size;
|
56
|
+
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
57
|
+
}
|
58
|
+
return props;
|
64
59
|
}
|
65
|
-
//# sourceMappingURL=useFieldControlProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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":["props","useFieldContext_unstable","useFieldControlProps_unstable","options","getFieldControlProps","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","id","supportsLabelFor","filter","Boolean","join","supportsRequired","supportsSize","size"],"mappings":"IA8EIA,QAMAA,SAAM,iBAYNA,SAAM,cAKHA,SAEDA,SAAM,eAMPA;AA5GL,SAASC,wBAAwB,QAAQ,iBAAiB;AAkD1D,OAAO,SAASC,8BACdF,KAAa,EACbG,OAAkC,EACf;IACnB,OAAOC,qBAAqBH,4BAA4BD,OAAOG;AACjE,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASC,qBACdC,OAAsC,EACtCL,KAAa,EACbG,OAAkC,EACf;IACnB,IAAI,CAACE,SAAS;QACZ,OAAOL;IACT,CAAC;IAED,yDAAyD;IACzDA,QAAQ;QAAE,GAAGA,KAAK;IAAC;IAEnB,MAAM,EAAEM,mBAAkB,EAAEC,OAAM,EAAEC,SAAQ,EAAEC,QAAO,EAAEC,SAAQ,EAAEC,oBAAmB,EAAEC,gBAAe,EAAE,GAAGP;IAE1G,IAAIC,oBAAoB;;QACtBN,QAAAA,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able, useFieldStyles_unstable, useField_unstable } from './Field';
|
2
2
|
export { FieldContextProvider, useFieldContext_unstable, useFieldContextValues_unstable, useFieldControlProps_unstable } from './contexts/index';
|
3
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport type {\n FieldContextValue,\n FieldContextValues,\n FieldControlProps,\n FieldProps,\n FieldSlots,\n FieldState,\n} from './Field';\nexport {\n FieldContextProvider,\n useFieldContext_unstable,\n useFieldContextValues_unstable,\n useFieldControlProps_unstable,\n} from './contexts/index';\nexport type { FieldControlPropsOptions } from './contexts/index';\n"],"names":["Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","FieldContextProvider","useFieldContext_unstable","useFieldContextValues_unstable","useFieldControlProps_unstable"],"mappings":"AAAA,SAASA,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ,UAAU;AASnH,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,8BAA8B,EAC9BC,6BAA6B,QACxB,mBAAmB"}
|
package/lib-commonjs/Field.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["Field.js"],"sourcesContent":["export * from './components/Field/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
|
@@ -18,6 +18,4 @@ const Field = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
18
18
|
const context = (0, _index.useFieldContextValues_unstable)(state);
|
19
19
|
return (0, _renderField.renderField_unstable)(state, context);
|
20
20
|
});
|
21
|
-
Field.displayName = 'Field';
|
22
|
-
|
23
|
-
//# sourceMappingURL=Field.js.map
|
21
|
+
Field.displayName = 'Field';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["Field.js"],"sourcesContent":["import * as React from 'react';\nimport { renderField_unstable } from './renderField';\nimport { useField_unstable } from './useField';\nimport { useFieldStyles_unstable } from './useFieldStyles.styles';\nimport { useFieldContextValues_unstable } from '../../contexts/index';\nexport const Field = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n const context = useFieldContextValues_unstable(state);\n return renderField_unstable(state, context);\n});\nField.displayName = 'Field';\n"],"names":["Field","React","forwardRef","props","ref","state","useField_unstable","useFieldStyles_unstable","context","useFieldContextValues_unstable","renderField_unstable","displayName"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;6BACc;0BACH;sCACM;uBACO;AACxC,MAAMA,QAAQ,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAM;IAC9D,MAAMC,QAAQC,IAAAA,2BAAiB,EAACH,OAAOC;IACvCG,IAAAA,6CAAuB,EAACF;IACxB,MAAMG,UAAUC,IAAAA,qCAA8B,EAACJ;IAC/C,OAAOK,IAAAA,iCAAoB,EAACL,OAAOG;AACvC;AACAR,MAAMW,WAAW,GAAG"}
|
@@ -4,6 +4,3 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
6
6
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
7
|
-
//# sourceMappingURL=Field.types.js.map
|
8
|
-
|
9
|
-
//# sourceMappingURL=Field.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["Field.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
|
@@ -8,6 +8,3 @@ _exportStar(require("./Field"), exports);
|
|
8
8
|
_exportStar(require("./renderField"), exports);
|
9
9
|
_exportStar(require("./useField"), exports);
|
10
10
|
_exportStar(require("./useFieldStyles.styles"), exports);
|
11
|
-
//# sourceMappingURL=index.js.map
|
12
|
-
|
13
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Field.types';\nexport * from './Field';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles.styles';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA"}
|
@@ -18,6 +18,4 @@ const renderField_unstable = (state, contextValues)=>{
|
|
18
18
|
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_index.FieldContextProvider, {
|
19
19
|
value: contextValues === null || contextValues === void 0 ? void 0 : contextValues.field
|
20
20
|
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.root, slotProps.root, slots.label && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.label, slotProps.label), children, slots.validationMessage && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.validationMessage, slotProps.validationMessage, slots.validationMessageIcon && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.validationMessageIcon, slotProps.validationMessageIcon), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.hint, slotProps.hint)));
|
21
|
-
};
|
22
|
-
|
23
|
-
//# sourceMappingURL=renderField.js.map
|
21
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["renderField.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } 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 const { slots , slotProps } = getSlotsNext(state);\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n return /*#__PURE__*/ createElement(FieldContextProvider, {\n value: contextValues === null || contextValues === void 0 ? void 0 : contextValues.field\n }, /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.label && /*#__PURE__*/ createElement(slots.label, slotProps.label), children, slots.validationMessage && /*#__PURE__*/ createElement(slots.validationMessage, slotProps.validationMessage, slots.validationMessageIcon && /*#__PURE__*/ createElement(slots.validationMessageIcon, slotProps.validationMessageIcon), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/ createElement(slots.hint, slotProps.hint)));\n};\n"],"names":["renderField_unstable","state","contextValues","slots","slotProps","getSlotsNext","children","getFieldControlProps","field","createElement","FieldContextProvider","value","root","label","validationMessage","validationMessageIcon","hint"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACtD;uBAC8B;AAGhD,MAAMA,uBAAuB,CAACC,OAAOC,gBAAgB;IAC5D,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACJ;IAC5C,IAAI,EAAEK,SAAQ,EAAG,GAAGL;IACpB,IAAI,OAAOK,aAAa,YAAY;QAChCA,WAAWA,SAASC,IAAAA,2BAAoB,EAACL,cAAcM,KAAK,KAAK,CAAC;IACtE,CAAC;IACD,OAAO,WAAW,GAAGC,IAAAA,8BAAa,EAACC,2BAAoB,EAAE;QACrDC,OAAOT,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcM,KAAK;IAC5F,GAAG,WAAW,GAAGC,IAAAA,8BAAa,EAACN,MAAMS,IAAI,EAAER,UAAUQ,IAAI,EAAET,MAAMU,KAAK,IAAI,WAAW,GAAGJ,IAAAA,8BAAa,EAACN,MAAMU,KAAK,EAAET,UAAUS,KAAK,GAAGP,UAAUH,MAAMW,iBAAiB,IAAI,WAAW,GAAGL,IAAAA,8BAAa,EAACN,MAAMW,iBAAiB,EAAEV,UAAUU,iBAAiB,EAAEX,MAAMY,qBAAqB,IAAI,WAAW,GAAGN,IAAAA,8BAAa,EAACN,MAAMY,qBAAqB,EAAEX,UAAUW,qBAAqB,GAAGX,UAAUU,iBAAiB,CAACR,QAAQ,GAAGH,MAAMa,IAAI,IAAI,WAAW,GAAGP,IAAAA,8BAAa,EAACN,MAAMa,IAAI,EAAEZ,UAAUY,IAAI;AACre"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["useField.js"],"sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nconst validationMessageIcons = {\n error: /*#__PURE__*/ React.createElement(ErrorCircle12Filled, null),\n warning: /*#__PURE__*/ React.createElement(Warning12Filled, null),\n success: /*#__PURE__*/ React.createElement(CheckmarkCircle12Filled, null),\n none: undefined\n};\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the root\n */ export const useField_unstable = (props, ref)=>{\n const { children , orientation ='vertical' , required =false , validationState =props.validationMessage ? 'error' : 'none' , size ='medium' } = props;\n const baseId = useId('field-');\n const generatedControlId = baseId + '__control';\n const root = getNativeElementProps('div', {\n ...props,\n ref\n }, /*excludedPropNames:*/ [\n 'children'\n ]);\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: generatedControlId,\n id: baseId + '__label',\n required,\n size\n }\n });\n const validationMessage = resolveShorthand(props.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n role: validationState === 'error' ? 'alert' : undefined\n }\n });\n const hint = resolveShorthand(props.hint, {\n defaultProps: {\n id: baseId + '__hint'\n }\n });\n const defaultIcon = validationMessageIcons[validationState];\n const validationMessageIcon = resolveShorthand(props.validationMessageIcon, {\n required: !!defaultIcon,\n defaultProps: {\n children: defaultIcon\n }\n });\n return {\n children,\n generatedControlId,\n orientation,\n required,\n size,\n validationState,\n components: {\n root: 'div',\n label: Label,\n validationMessage: 'div',\n validationMessageIcon: 'span',\n hint: 'div'\n },\n root,\n label,\n validationMessageIcon,\n validationMessage,\n hint\n };\n};\n"],"names":["useField_unstable","validationMessageIcons","error","React","createElement","ErrorCircle12Filled","warning","Warning12Filled","success","CheckmarkCircle12Filled","none","undefined","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","useId","generatedControlId","root","getNativeElementProps","label","resolveShorthand","defaultProps","htmlFor","id","role","hint","defaultIcon","validationMessageIcon","components","Label"],"mappings":";;;;+BAkBiBA;;aAAAA;;;6DAlBM;4BACuD;4BACxD;gCACyC;AAC/D,MAAMC,yBAAyB;IAC3BC,OAAO,WAAW,GAAGC,OAAMC,aAAa,CAACC,+BAAmB,EAAE,IAAI;IAClEC,SAAS,WAAW,GAAGH,OAAMC,aAAa,CAACG,2BAAe,EAAE,IAAI;IAChEC,SAAS,WAAW,GAAGL,OAAMC,aAAa,CAACK,mCAAuB,EAAE,IAAI;IACxEC,MAAMC;AACV;AASW,MAAMX,oBAAoB,CAACY,OAAOC,MAAM;IAC/C,MAAM,EAAEC,SAAQ,EAAGC,aAAa,WAAU,EAAGC,UAAU,KAAK,CAAA,EAAGC,iBAAiBL,MAAMM,iBAAiB,GAAG,UAAU,MAAM,CAAA,EAAGC,MAAM,SAAQ,EAAG,GAAGP;IACjJ,MAAMQ,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAMC,qBAAqBF,SAAS;IACpC,MAAMG,OAAOC,IAAAA,qCAAqB,EAAC,OAAO;QACtC,GAAGZ,KAAK;QACRC;IACJ,GAAG,oBAAoB,GAAG;QACtB;KACH;IACD,MAAMY,QAAQC,IAAAA,gCAAgB,EAACd,MAAMa,KAAK,EAAE;QACxCE,cAAc;YACVC,SAASN;YACTO,IAAIT,SAAS;YACbJ;YACAG;QACJ;IACJ;IACA,MAAMD,oBAAoBQ,IAAAA,gCAAgB,EAACd,MAAMM,iBAAiB,EAAE;QAChES,cAAc;YACVE,IAAIT,SAAS;YACbU,MAAMb,oBAAoB,UAAU,UAAUN,SAAS;QAC3D;IACJ;IACA,MAAMoB,OAAOL,IAAAA,gCAAgB,EAACd,MAAMmB,IAAI,EAAE;QACtCJ,cAAc;YACVE,IAAIT,SAAS;QACjB;IACJ;IACA,MAAMY,cAAc/B,sBAAsB,CAACgB,gBAAgB;IAC3D,MAAMgB,wBAAwBP,IAAAA,gCAAgB,EAACd,MAAMqB,qBAAqB,EAAE;QACxEjB,UAAU,CAAC,CAACgB;QACZL,cAAc;YACVb,UAAUkB;QACd;IACJ;IACA,OAAO;QACHlB;QACAQ;QACAP;QACAC;QACAG;QACAF;QACAiB,YAAY;YACRX,MAAM;YACNE,OAAOU,iBAAK;YACZjB,mBAAmB;YACnBe,uBAAuB;YACvBF,MAAM;QACV;QACAR;QACAE;QACAQ;QACAf;QACAa;IACJ;AACJ"}
|
@@ -150,5 +150,3 @@ const useFieldStyles_unstable = (state)=>{
|
|
150
150
|
state.hint.className = (0, _react.mergeClasses)(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
|
151
151
|
}
|
152
152
|
}; //# sourceMappingURL=useFieldStyles.styles.js.map
|
153
|
-
|
154
|
-
//# sourceMappingURL=useFieldStyles.styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["useFieldStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nexport const fieldClassNames = {\n root: `fui-Field`,\n label: `fui-Field__label`,\n validationMessage: `fui-Field__validationMessage`,\n validationMessageIcon: `fui-Field__validationMessageIcon`,\n hint: `fui-Field__hint`\n};\n// Size of the icon in the validation message\nconst iconSize = '12px';\n/**\n * Styles for the root slot\n */\nconst useRootStyles = /*#__PURE__*/__styles({\n base: {\n mc9l5x: \"f13qh94s\"\n },\n horizontal: {\n Budl1dq: \"f2wwaib\",\n wkccdc: \"f1645dqt\"\n },\n horizontalNoLabel: {\n uwmqm3: [\"f15jqgz8\", \"fggqkej\"],\n Budl1dq: \"f1c2z91y\"\n }\n}, {\n d: [\".f13qh94s{display:grid;}\", \".f2wwaib{grid-template-columns:33% 1fr;}\", \".f1645dqt{grid-template-rows:auto auto auto 1fr;}\", \".f15jqgz8{padding-left:33%;}\", \".fggqkej{padding-right:33%;}\", \".f1c2z91y{grid-template-columns:1fr;}\"]\n});\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n z8tnut: \"fclwglc\",\n Byoj8tv: \"fywfov9\"\n },\n large: {\n z8tnut: \"f1sl3k7w\",\n Byoj8tv: \"f1brlhvm\"\n },\n vertical: {\n jrapky: \"fyacil5\"\n },\n verticalLarge: {\n jrapky: \"f8l5zjj\"\n },\n horizontal: {\n t21cq0: [\"fkujibs\", \"f199hnxi\"],\n Ijaq50: \"f16hsg94\",\n nk6f5a: \"f1nzqi2z\"\n }\n}, {\n d: [\".fclwglc{padding-top:var(--spacingVerticalXXS);}\", \".fywfov9{padding-bottom:var(--spacingVerticalXXS);}\", \".f1sl3k7w{padding-top:1px;}\", \".f1brlhvm{padding-bottom:1px;}\", \".fyacil5{margin-bottom:var(--spacingVerticalXXS);}\", \".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}\", \".fkujibs{margin-right:var(--spacingHorizontalM);}\", \".f199hnxi{margin-left:var(--spacingHorizontalM);}\", \".f16hsg94{grid-row-start:1;}\", \".f1nzqi2z{grid-row-end:-1;}\"]\n});\nconst useSecondaryTextBaseClassName = /*#__PURE__*/__resetStyles(\"r5c4z9l\", null, [\".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}\"]);\nconst useSecondaryTextStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n withIcon: {\n uwmqm3: [\"frawy03\", \"fg4c52\"]\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}\", \".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}\"]\n});\nconst useValidationMessageIconBaseClassName = /*#__PURE__*/__resetStyles(\"ra7h1uk\", \"r1rh6bd7\", [\".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\", \".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\"]);\nconst useValidationMessageIconStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n warning: {\n sj55zd: \"f1k5f75o\"\n },\n success: {\n sj55zd: \"ffmvakt\"\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}\", \".ffmvakt{color:var(--colorPaletteGreenForeground1);}\"]\n});\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = state => {\n const {\n validationState\n } = state;\n const horizontal = state.orientation === 'horizontal';\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);\n }\n const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);\n }\n const secondaryTextBaseClassName = useSecondaryTextBaseClassName();\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);\n }\n if (state.hint) {\n state.hint.className = mergeClasses(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n//# sourceMappingURL=useFieldStyles.styles.js.map"],"names":["fieldClassNames","useFieldStyles_unstable","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","__styles","base","mc9l5x","horizontal","Budl1dq","wkccdc","horizontalNoLabel","uwmqm3","d","useLabelStyles","z8tnut","Byoj8tv","large","vertical","jrapky","verticalLarge","t21cq0","Ijaq50","nk6f5a","useSecondaryTextBaseClassName","__resetStyles","useSecondaryTextStyles","error","sj55zd","withIcon","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","warning","success","state","validationState","orientation","rootStyles","className","mergeClasses","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"mappings":";;;;;;;;;;;IAEaA,eAAe,MAAfA;IA8EAC,uBAAuB,MAAvBA;;uBA/EyC;AAC/C,MAAMD,kBAAkB;IAC7BE,MAAM,CAAC,SAAS,CAAC;IACjBC,OAAO,CAAC,gBAAgB,CAAC;IACzBC,mBAAmB,CAAC,4BAA4B,CAAC;IACjDC,uBAAuB,CAAC,gCAAgC,CAAC;IACzDC,MAAM,CAAC,eAAe,CAAC;AACzB;AACA,6CAA6C;AAC7C,MAAMC,WAAW;AACjB;;CAEC,GACD,MAAMC,gBAAgB,WAAW,GAAEC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,oBAAoB,WAAWU,oBAAoBlB,KAAK,EAAE,CAAC,CAACO,MAAMjC,qBAAqB,IAAI4C,oBAAoBhB,QAAQ,EAAEK,MAAMlC,iBAAiB,CAACsC,SAAS;IAC5Q,CAAC;IACD,IAAIJ,MAAMhC,IAAI,EAAE;QACdgC,MAAMhC,IAAI,CAACoC,SAAS,GAAGC,IAAAA,mBAAY,EAAC3C,gBAAgBM,IAAI,EAAE0C,4BAA4BV,MAAMhC,IAAI,CAACoC,SAAS;IAC5G,CAAC;AACH,GACA,iDAAiD"}
|
@@ -16,6 +16,4 @@ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildc
|
|
16
16
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
17
17
|
const FieldContext = /*#__PURE__*/ _react.createContext(undefined);
|
18
18
|
const FieldContextProvider = FieldContext.Provider;
|
19
|
-
const useFieldContext_unstable = ()=>_react.useContext(FieldContext);
|
20
|
-
|
21
|
-
//# sourceMappingURL=FieldContext.js.map
|
19
|
+
const useFieldContext_unstable = ()=>_react.useContext(FieldContext);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["FieldContext.js"],"sourcesContent":["import * as React from 'react';\nconst FieldContext = React.createContext(undefined);\nexport const FieldContextProvider = FieldContext.Provider;\nexport const useFieldContext_unstable = ()=>React.useContext(FieldContext);\n"],"names":["FieldContextProvider","useFieldContext_unstable","FieldContext","React","createContext","undefined","Provider","useContext"],"mappings":";;;;;;;;;;;IAEaA,oBAAoB,MAApBA;IACAC,wBAAwB,MAAxBA;;;6DAHU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAML,uBAAuBE,aAAaI,QAAQ;AAClD,MAAML,2BAA2B,IAAIE,OAAMI,UAAU,CAACL"}
|
@@ -6,6 +6,3 @@ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
6
|
_exportStar(require("./FieldContext"), exports);
|
7
7
|
_exportStar(require("./useFieldContextValues"), exports);
|
8
8
|
_exportStar(require("./useFieldControlProps"), exports);
|
9
|
-
//# sourceMappingURL=index.js.map
|
10
|
-
|
11
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './FieldContext';\nexport * from './useFieldContextValues';\nexport * from './useFieldControlProps';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["useFieldContextValues.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Get the context values used when rendering Field.\n */ export const useFieldContextValues_unstable = (state)=>{\n var _state_label, _state_label1, _state_validationMessage, _state_hint;\n const { generatedControlId , orientation , required , size , validationState } = state;\n const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;\n const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;\n const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;\n const hintId = (_state_hint = state.hint) === null || _state_hint === void 0 ? void 0 : _state_hint.id;\n const field = React.useMemo(()=>({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState\n }), [\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState\n ]);\n return {\n field\n };\n};\n"],"names":["useFieldContextValues_unstable","state","_state_label","_state_label1","_state_validationMessage","_state_hint","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","React","useMemo"],"mappings":";;;;+BAGiBA;;aAAAA;;;6DAHM;AAGZ,MAAMA,iCAAiC,CAACC,QAAQ;IACvD,IAAIC,cAAcC,eAAeC,0BAA0BC;IAC3D,MAAM,EAAEC,mBAAkB,EAAGC,YAAW,EAAGC,SAAQ,EAAGC,KAAI,EAAGC,gBAAe,EAAG,GAAGT;IAClF,MAAMU,WAAW,AAACT,CAAAA,eAAeD,MAAMW,KAAK,AAAD,MAAO,IAAI,IAAIV,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaW,OAAO;IACjH,MAAMC,UAAU,AAACX,CAAAA,gBAAgBF,MAAMW,KAAK,AAAD,MAAO,IAAI,IAAIT,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcY,EAAE;IAC9G,MAAMC,sBAAsB,AAACZ,CAAAA,2BAA2BH,MAAMgB,iBAAiB,AAAD,MAAO,IAAI,IAAIb,6BAA6B,KAAK,IAAI,KAAK,IAAIA,yBAAyBW,EAAE;IACvK,MAAMG,SAAS,AAACb,CAAAA,cAAcJ,MAAMkB,IAAI,AAAD,MAAO,IAAI,IAAId,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYU,EAAE;IACtG,MAAMK,QAAQC,OAAMC,OAAO,CAAC,IAAK,CAAA;YACzBhB;YACAY;YACAP;YACAG;YACAP;YACAC;YACAC;YACAO;YACAN;QACJ,CAAA,GAAI;QACJJ;QACAY;QACAP;QACAG;QACAP;QACAC;QACAC;QACAO;QACAN;KACH;IACD,OAAO;QACHU;IACJ;AACJ"}
|
@@ -66,6 +66,4 @@ function getFieldControlProps(context, props, options) {
|
|
66
66
|
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
|
67
67
|
}
|
68
68
|
return props;
|
69
|
-
}
|
70
|
-
|
71
|
-
//# sourceMappingURL=useFieldControlProps.js.map
|
69
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["var _props, _props1, _arialabelledby, _props2, _ariainvalid, _props3, _props4, _ariarequired, _props5;\nimport { 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 _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 _;\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 _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 _required;\n (_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;\n } else {\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 _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","_props1","_arialabelledby","_props2","_ariainvalid","_props3","_props4","_ariarequired","_props5","props","options","useFieldContext_unstable","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","_id","id","supportsLabelFor","_","filter","Boolean","join","_1","supportsRequired","_required","_2","supportsSize","_size","size"],"mappings":";;;;;;;;;;;IAEgBA,6BAA6B,MAA7BA;IAOIC,oBAAoB,MAApBA;;8BARqB;AADzC,IAAIC,QAAQC,SAASC,iBAAiBC,SAASC,cAAcC,SAASC,SAASC,eAAeC;AAEvF,SAASV,8BAA8BW,KAAK,EAAEC,OAAO,EAAE;IAC1D,OAAOX,qBAAqBY,IAAAA,sCAAwB,KAAIF,OAAOC;AACnE;AAKW,SAASX,qBAAqBa,OAAO,EAAEH,KAAK,EAAEC,OAAO,EAAE;IAC9D,IAAI,CAACE,SAAS;QACV,OAAOH;IACX,CAAC;IACD,yDAAyD;IACzDA,QAAQ;QACJ,GAAGA,KAAK;IACZ;IACA,MAAM,EAAEI,mBAAkB,EAAGC,OAAM,EAAGC,SAAQ,EAAGC,QAAO,EAAGC,SAAQ,EAAGC,oBAAmB,EAAGC,gBAAe,EAAG,GAAGP;IACjH,IAAIC,oBAAoB;QACpB,IAAIO;QACHA,CAAAA,MAAM,AAACpB,CAAAA,SAASS,KAAI,EAAGY,EAAE,AAAD,MAAO,IAAI,IAAID,QAAQ,KAAK,IAAIA,MAAMpB,OAAOqB,EAAE,GAAGR,kBAAkB;IACjG,CAAC;IACD,4GAA4G;IAC5G,6GAA6G;IAC7G,IAAIG,WAAY,CAAA,CAAEN,CAAAA,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQY,gBAAgB,AAAD,KAAMP,aAAaN,MAAMY,EAAE,AAAD,GAAI;QACrH,IAAIE;QACHA,CAAAA,IAAI,AAACtB,CAAAA,UAAUQ,KAAI,CAAE,CAACP,kBAAkB,kBAAkB,AAAD,MAAO,IAAI,IA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AAK,IAAIA,QAAQxB,QAAQyB,IAAI,GAAGrB,QAAQqB,IAAI;IACvG,CAAC;IACD,OAAOxB;AACX"}
|
package/lib-commonjs/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport { FieldContextProvider, useFieldContext_unstable, useFieldContextValues_unstable, useFieldControlProps_unstable } from './contexts/index';\n"],"names":["Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","FieldContextProvider","useFieldContext_unstable","useFieldContextValues_unstable","useFieldControlProps_unstable"],"mappings":";;;;;;;;;;;IAASA,KAAK,MAALA,YAAK;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IACxFC,oBAAoB,MAApBA,2BAAoB;IAAEC,wBAAwB,MAAxBA,+BAAwB;IAAEC,8BAA8B,MAA9BA,qCAA8B;IAAEC,6BAA6B,MAA7BA,oCAA6B;;uBADb;uBACqB"}
|