@fluentui/react-field 9.0.0-alpha.26 → 9.0.0-alpha.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +73 -1
  3. package/CHANGELOG.md +27 -2
  4. package/lib/Field.js.map +1 -1
  5. package/lib/components/Field/Field.js.map +1 -1
  6. package/lib/components/Field/Field.types.js +1 -1
  7. package/lib/components/Field/Field.types.js.map +1 -1
  8. package/lib/components/Field/index.js.map +1 -1
  9. package/lib/components/Field/renderField.js +1 -11
  10. package/lib/components/Field/renderField.js.map +1 -1
  11. package/lib/components/Field/useField.js +12 -9
  12. package/lib/components/Field/useField.js.map +1 -1
  13. package/lib/components/Field/useFieldStyles.js.map +1 -1
  14. package/lib/index.js.map +1 -1
  15. package/lib/util/makeDeprecatedField.js +2 -5
  16. package/lib/util/makeDeprecatedField.js.map +1 -1
  17. package/lib-commonjs/Field.js +5 -4
  18. package/lib-commonjs/Field.js.map +1 -1
  19. package/lib-commonjs/components/Field/Field.js +16 -12
  20. package/lib-commonjs/components/Field/Field.js.map +1 -1
  21. package/lib-commonjs/components/Field/Field.types.js +5 -2
  22. package/lib-commonjs/components/Field/Field.types.js.map +1 -1
  23. package/lib-commonjs/components/Field/index.js +9 -8
  24. package/lib-commonjs/components/Field/index.js.map +1 -1
  25. package/lib-commonjs/components/Field/renderField.js +13 -26
  26. package/lib-commonjs/components/Field/renderField.js.map +1 -1
  27. package/lib-commonjs/components/Field/useField.js +98 -102
  28. package/lib-commonjs/components/Field/useField.js.map +1 -1
  29. package/lib-commonjs/components/Field/useFieldStyles.js +137 -96
  30. package/lib-commonjs/components/Field/useFieldStyles.js.map +1 -1
  31. package/lib-commonjs/index.js +21 -49
  32. package/lib-commonjs/index.js.map +1 -1
  33. package/lib-commonjs/util/makeDeprecatedField.js +53 -71
  34. package/lib-commonjs/util/makeDeprecatedField.js.map +1 -1
  35. package/package.json +10 -9
  36. package/lib-amd/Field.js +0 -6
  37. package/lib-amd/Field.js.map +0 -1
  38. package/lib-amd/components/Field/Field.js +0 -12
  39. package/lib-amd/components/Field/Field.js.map +0 -1
  40. package/lib-amd/components/Field/Field.types.js +0 -5
  41. package/lib-amd/components/Field/Field.types.js.map +0 -1
  42. package/lib-amd/components/Field/index.js +0 -10
  43. package/lib-amd/components/Field/index.js.map +0 -1
  44. package/lib-amd/components/Field/renderField.js +0 -20
  45. package/lib-amd/components/Field/renderField.js.map +0 -1
  46. package/lib-amd/components/Field/useField.js +0 -99
  47. package/lib-amd/components/Field/useField.js.map +0 -1
  48. package/lib-amd/components/Field/useFieldStyles.js +0 -115
  49. package/lib-amd/components/Field/useFieldStyles.js.map +0 -1
  50. package/lib-amd/index.js +0 -13
  51. package/lib-amd/index.js.map +0 -1
  52. package/lib-amd/util/makeDeprecatedField.js +0 -38
  53. package/lib-amd/util/makeDeprecatedField.js.map +0 -1
@@ -1,30 +1,17 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderField_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderField_unstable
5
8
  });
6
- exports.renderField_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
- /**
10
- * Render the final JSX of Field
11
- */
12
- const renderField_unstable = state => {
13
- const {
14
- slots,
15
- slotProps
16
- } = react_utilities_1.getSlots(state);
17
- return React.createElement(slots.root, {
18
- ...slotProps.root
19
- }, slots.label && React.createElement(slots.label, {
20
- ...slotProps.label
21
- }), slotProps.root.children, slots.validationMessage && React.createElement(slots.validationMessage, {
22
- ...slotProps.validationMessage
23
- }, slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, {
24
- ...slotProps.validationMessageIcon
25
- }), slotProps.validationMessage.children), slots.hint && React.createElement(slots.hint, {
26
- ...slotProps.hint
27
- }));
28
- };
29
- exports.renderField_unstable = renderField_unstable;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactUtilities = require("@fluentui/react-utilities");
12
+ const renderField_unstable = (state)=>{
13
+ const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
14
+ return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, slots.label && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label), slotProps.root.children, slots.validationMessage && /*#__PURE__*/ _react.createElement(slots.validationMessage, slotProps.validationMessage, slots.validationMessageIcon && /*#__PURE__*/ _react.createElement(slots.validationMessageIcon, slotProps.validationMessageIcon), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/ _react.createElement(slots.hint, slotProps.hint));
15
+ }; //# sourceMappingURL=renderField.js.map
16
+
30
17
  //# sourceMappingURL=renderField.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","react_utilities_1","renderField_unstable","state","slots","slotProps","getSlots","createElement","root","label","children","validationMessage","validationMessageIcon","hint","exports"],"sources":["../src/packages/react-components/react-field/src/components/Field/renderField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = (state: FieldState) => {\n const { slots, slotProps } = getSlots<FieldSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.label && <slots.label {...slotProps.label} />}\n {slotProps.root.children}\n {slots.validationMessage && (\n <slots.validationMessage {...slotProps.validationMessage}>\n {slots.validationMessageIcon && <slots.validationMessageIcon {...slotProps.validationMessageIcon} />}\n {slotProps.validationMessage.children}\n </slots.validationMessage>\n )}\n {slots.hint && <slots.hint {...slotProps.hint} />}\n </slots.root>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;AAGO,MAAME,oBAAoB,GAAIC,KAAiB,IAAI;EACxD,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,iBAAA,CAAAK,QAAQ,CAAaH,KAAK,CAAC;EAExD,OACEJ,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BJ,KAAK,CAACK,KAAK,IAAIV,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACK,KAAK;IAAA,GAAKJ,SAAS,CAACI;EAAK,EAAI,EACnDJ,SAAS,CAACG,IAAI,CAACE,QAAQ,EACvBN,KAAK,CAACO,iBAAiB,IACtBZ,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACO,iBAAiB;IAAA,GAAKN,SAAS,CAACM;EAAiB,GACrDP,KAAK,CAACQ,qBAAqB,IAAIb,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACQ,qBAAqB;IAAA,GAAKP,SAAS,CAACO;EAAqB,EAAI,EACnGP,SAAS,CAACM,iBAAiB,CAACD,QAAQ,CAExC,EACAN,KAAK,CAACS,IAAI,IAAId,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACS,IAAI;IAAA,GAAKR,SAAS,CAACQ;EAAI,EAAI,CACtC;AAEjB,CAAC;AAhBYC,OAAA,CAAAZ,oBAAoB,GAAAA,oBAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Field/renderField.js"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root, slots.label && /*#__PURE__*/React.createElement(slots.label, slotProps.label), slotProps.root.children, slots.validationMessage && /*#__PURE__*/React.createElement(slots.validationMessage, slotProps.validationMessage, slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, slotProps.validationMessageIcon), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/React.createElement(slots.hint, slotProps.hint));\n};\n//# sourceMappingURL=renderField.js.map"],"names":["renderField_unstable","state","slots","slotProps","getSlots","React","createElement","root","label","children","validationMessage","validationMessageIcon","hint"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;gCACE;AAIlB,MAAMA,uBAAuBC,CAAAA,QAAS;IAC3C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACJ,MAAMK,IAAI,EAAEJ,UAAUI,IAAI,EAAEL,MAAMM,KAAK,IAAI,WAAW,GAAEH,OAAMC,aAAa,CAACJ,MAAMM,KAAK,EAAEL,UAAUK,KAAK,GAAGL,UAAUI,IAAI,CAACE,QAAQ,EAAEP,MAAMQ,iBAAiB,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACJ,MAAMQ,iBAAiB,EAAEP,UAAUO,iBAAiB,EAAER,MAAMS,qBAAqB,IAAI,WAAW,GAAEN,OAAMC,aAAa,CAACJ,MAAMS,qBAAqB,EAAER,UAAUQ,qBAAqB,GAAGR,UAAUO,iBAAiB,CAACD,QAAQ,GAAGP,MAAMU,IAAI,IAAI,WAAW,GAAEP,OAAMC,aAAa,CAACJ,MAAMU,IAAI,EAAET,UAAUS,IAAI;AAC/gB,GACA,uCAAuC"}
@@ -1,113 +1,109 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useField_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useField_unstable
5
8
  });
6
- exports.useField_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
9
- const react_label_1 = /*#__PURE__*/require("@fluentui/react-label");
10
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactIcons = require("@fluentui/react-icons");
12
+ const _reactLabel = require("@fluentui/react-label");
13
+ const _reactUtilities = require("@fluentui/react-utilities");
14
+ var _controlProps, _arialabelledby, // Assign the child a generated ID if doesn't already have an ID
15
+ _controlProps1, _controlProps2, _ariainvalid, _controlProps3, _ariarequired;
11
16
  const validationMessageIcons = {
12
- error: /*#__PURE__*/React.createElement(react_icons_1.ErrorCircle12Filled, null),
13
- warning: /*#__PURE__*/React.createElement(react_icons_1.Warning12Filled, null),
14
- success: /*#__PURE__*/React.createElement(react_icons_1.CheckmarkCircle12Filled, null),
15
- none: undefined
17
+ error: /*#__PURE__*/ _react.createElement(_reactIcons.ErrorCircle12Filled, null),
18
+ warning: /*#__PURE__*/ _react.createElement(_reactIcons.Warning12Filled, null),
19
+ success: /*#__PURE__*/ _react.createElement(_reactIcons.CheckmarkCircle12Filled, null),
20
+ none: undefined
16
21
  };
17
- /**
18
- * Create the state required to render Field.
19
- *
20
- * The returned state can be modified with hooks such as useFieldStyles_unstable,
21
- * before being passed to renderField_unstable.
22
- *
23
- * @param props - Props passed to this field
24
- * @param ref - Ref to the root
25
- */
26
- const useField_unstable = (props, ref) => {
27
- var _a, _b, _c, _d;
28
- const {
29
- children,
30
- orientation = 'vertical',
31
- required,
32
- validationState = props.validationMessage ? 'error' : 'none',
33
- size
34
- } = props;
35
- const baseId = react_utilities_1.useId('field-');
36
- const root = react_utilities_1.getNativeElementProps('div', {
37
- ...props,
38
- ref
39
- }, /*excludedPropNames:*/['children']);
40
- const label = react_utilities_1.resolveShorthand(props.label, {
41
- defaultProps: {
42
- id: baseId + '__label',
43
- required,
44
- size
45
- // htmlFor is handled below
22
+ const useField_unstable = (props, ref)=>{
23
+ const { children , orientation ='vertical' , required , validationState =props.validationMessage ? 'error' : 'none' , size } = props;
24
+ const baseId = (0, _reactUtilities.useId)('field-');
25
+ const root = (0, _reactUtilities.getNativeElementProps)('div', {
26
+ ...props,
27
+ ref
28
+ }, /*excludedPropNames:*/ [
29
+ 'children'
30
+ ]);
31
+ const label = (0, _reactUtilities.resolveShorthand)(props.label, {
32
+ defaultProps: {
33
+ id: baseId + '__label',
34
+ required,
35
+ size
36
+ }
37
+ });
38
+ const validationMessage = (0, _reactUtilities.resolveShorthand)(props.validationMessage, {
39
+ defaultProps: {
40
+ id: baseId + '__validationMessage',
41
+ role: validationState === 'error' ? 'alert' : undefined
42
+ }
43
+ });
44
+ const hint = (0, _reactUtilities.resolveShorthand)(props.hint, {
45
+ defaultProps: {
46
+ id: baseId + '__hint'
47
+ }
48
+ });
49
+ const defaultIcon = validationMessageIcons[validationState];
50
+ const validationMessageIcon = (0, _reactUtilities.resolveShorthand)(props.validationMessageIcon, {
51
+ required: !!defaultIcon,
52
+ defaultProps: {
53
+ children: defaultIcon
54
+ }
55
+ });
56
+ const controlProps = /*#__PURE__*/ /*#__PURE__*/ _react.isValidElement(children) ? {
57
+ ...children.props
58
+ } : {};
59
+ if (label) {
60
+ var _;
61
+ (_ = (_controlProps = controlProps)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _controlProps[_arialabelledby] = label.id;
62
+ if (!label.htmlFor) {
63
+ var _id;
64
+ (_id = (_controlProps1 = controlProps).id) !== null && _id !== void 0 ? _id : _controlProps1.id = baseId + '__control';
65
+ label.htmlFor = controlProps.id;
66
+ }
46
67
  }
47
- });
48
-
49
- const validationMessage = react_utilities_1.resolveShorthand(props.validationMessage, {
50
- defaultProps: {
51
- id: baseId + '__validationMessage',
52
- role: validationState === 'error' ? 'alert' : undefined
68
+ if (validationMessage || hint) {
69
+ // The control is described by the validation message, or hint, or both
70
+ // We also preserve and append any aria-describedby supplied by the user
71
+ // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
72
+ controlProps['aria-describedby'] = [
73
+ validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id,
74
+ hint === null || hint === void 0 ? void 0 : hint.id,
75
+ controlProps['aria-describedby']
76
+ ].filter(Boolean).join(' ');
53
77
  }
54
- });
55
- const hint = react_utilities_1.resolveShorthand(props.hint, {
56
- defaultProps: {
57
- id: baseId + '__hint'
78
+ if (validationState === 'error') {
79
+ var _1;
80
+ (_1 = (_controlProps2 = controlProps)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _controlProps2[_ariainvalid] = true;
58
81
  }
59
- });
60
- const defaultIcon = validationMessageIcons[validationState];
61
- const validationMessageIcon = react_utilities_1.resolveShorthand(props.validationMessageIcon, {
62
- required: !!defaultIcon,
63
- defaultProps: {
64
- children: defaultIcon
82
+ if (required) {
83
+ var _2;
84
+ (_2 = (_controlProps3 = controlProps)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _controlProps3[_ariarequired] = true;
65
85
  }
66
- });
67
- const controlProps = React.isValidElement(children) ? {
68
- ...children.props
69
- } : {};
70
- if (label) {
71
- (_a = controlProps['aria-labelledby']) !== null && _a !== void 0 ? _a : controlProps['aria-labelledby'] = label.id;
72
- if (!label.htmlFor) {
73
- // Assign the child a generated ID if doesn't already have an ID
74
- (_b = controlProps.id) !== null && _b !== void 0 ? _b : controlProps.id = baseId + '__control';
75
- label.htmlFor = controlProps.id;
86
+ if (/*#__PURE__*/ _react.isValidElement(children)) {
87
+ root.children = /*#__PURE__*/ _react.cloneElement(children, controlProps);
88
+ } else if (typeof children === 'function') {
89
+ root.children = children(controlProps);
76
90
  }
77
- }
78
- if (validationMessage || hint) {
79
- // The control is described by the validation message, or hint, or both
80
- // We also preserve and append any aria-describedby supplied by the user
81
- // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
82
- controlProps['aria-describedby'] = [validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id, hint === null || hint === void 0 ? void 0 : hint.id, controlProps['aria-describedby']].filter(Boolean).join(' ');
83
- }
84
- if (validationState === 'error') {
85
- (_c = controlProps['aria-invalid']) !== null && _c !== void 0 ? _c : controlProps['aria-invalid'] = true;
86
- }
87
- if (required) {
88
- (_d = controlProps['aria-required']) !== null && _d !== void 0 ? _d : controlProps['aria-required'] = true;
89
- }
90
- if (React.isValidElement(children)) {
91
- root.children = React.cloneElement(children, controlProps);
92
- } else if (typeof children === 'function') {
93
- root.children = children(controlProps);
94
- }
95
- return {
96
- orientation,
97
- validationState,
98
- components: {
99
- root: 'div',
100
- label: react_label_1.Label,
101
- validationMessage: 'div',
102
- validationMessageIcon: 'span',
103
- hint: 'div'
104
- },
105
- root,
106
- label,
107
- validationMessageIcon,
108
- validationMessage,
109
- hint
110
- };
111
- };
112
- exports.useField_unstable = useField_unstable;
91
+ return {
92
+ orientation,
93
+ validationState,
94
+ components: {
95
+ root: 'div',
96
+ label: _reactLabel.Label,
97
+ validationMessage: 'div',
98
+ validationMessageIcon: 'span',
99
+ hint: 'div'
100
+ },
101
+ root,
102
+ label,
103
+ validationMessageIcon,
104
+ validationMessage,
105
+ hint
106
+ };
107
+ }; //# sourceMappingURL=useField.js.map
108
+
113
109
  //# sourceMappingURL=useField.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","react_icons_1","react_label_1","react_utilities_1","validationMessageIcons","error","createElement","ErrorCircle12Filled","warning","Warning12Filled","success","CheckmarkCircle12Filled","none","undefined","useField_unstable","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","useId","root","getNativeElementProps","label","resolveShorthand","defaultProps","id","role","hint","defaultIcon","validationMessageIcon","controlProps","isValidElement","_a","htmlFor","_b","filter","Boolean","join","_c","_d","cloneElement","components","Label","exports"],"sources":["../src/packages/react-components/react-field/src/components/Field/useField.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type { FieldChildProps, FieldProps, FieldState } from './Field.types';\n\nconst validationMessageIcons = {\n error: <ErrorCircle12Filled />,\n warning: <Warning12Filled />,\n success: <CheckmarkCircle12Filled />,\n none: undefined,\n} as const;\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 */\nexport const useField_unstable = (props: FieldProps, ref: React.Ref<HTMLDivElement>): FieldState => {\n const {\n children,\n orientation = 'vertical',\n required,\n validationState = props.validationMessage ? 'error' : 'none',\n size,\n } = props;\n\n const baseId = useId('field-');\n\n const root = getNativeElementProps('div', { ...props, ref }, /*excludedPropNames:*/ ['children']);\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n id: baseId + '__label',\n required,\n size,\n // htmlFor is handled below\n },\n });\n\n const validationMessage = resolveShorthand(props.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n role: validationState === 'error' ? 'alert' : undefined,\n },\n });\n\n const hint = resolveShorthand(props.hint, {\n defaultProps: {\n id: baseId + '__hint',\n },\n });\n\n const defaultIcon = validationMessageIcons[validationState];\n const validationMessageIcon = resolveShorthand(props.validationMessageIcon, {\n required: !!defaultIcon,\n defaultProps: {\n children: defaultIcon,\n },\n });\n\n const controlProps: FieldChildProps = React.isValidElement(children) ? { ...children.props } : {};\n\n if (label) {\n controlProps['aria-labelledby'] ??= label.id;\n\n if (!label.htmlFor) {\n // Assign the child a generated ID if doesn't already have an ID\n controlProps.id ??= baseId + '__control';\n label.htmlFor = controlProps.id;\n }\n }\n\n if (validationMessage || hint) {\n // The control is described by the validation message, or hint, or both\n // We also preserve and append any aria-describedby supplied by the user\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n controlProps['aria-describedby'] = [validationMessage?.id, hint?.id, controlProps['aria-describedby']]\n .filter(Boolean)\n .join(' ');\n }\n\n if (validationState === 'error') {\n controlProps['aria-invalid'] ??= true;\n }\n\n if (required) {\n controlProps['aria-required'] ??= true;\n }\n\n if (React.isValidElement(children)) {\n root.children = React.cloneElement(children, controlProps);\n } else if (typeof children === 'function') {\n root.children = children(controlProps);\n }\n\n return {\n orientation,\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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAEA,MAAAC,aAAA,gBAAAD,OAAA;AACA,MAAAE,aAAA,gBAAAF,OAAA;AACA,MAAAG,iBAAA,gBAAAH,OAAA;AAGA,MAAMI,sBAAsB,GAAG;EAC7BC,KAAK,eAAEN,KAAA,CAAAO,aAAA,CAACL,aAAA,CAAAM,mBAAmB,OAAG;EAC9BC,OAAO,eAAET,KAAA,CAAAO,aAAA,CAACL,aAAA,CAAAQ,eAAe,OAAG;EAC5BC,OAAO,eAAEX,KAAA,CAAAO,aAAA,CAACL,aAAA,CAAAU,uBAAuB,OAAG;EACpCC,IAAI,EAAEC;CACE;AAEV;;;;;;;;;AASO,MAAMC,iBAAiB,GAAGA,CAACC,KAAiB,EAAEC,GAA8B,KAAgB;;EACjG,MAAM;IACJC,QAAQ;IACRC,WAAW,GAAG,UAAU;IACxBC,QAAQ;IACRC,eAAe,GAAGL,KAAK,CAACM,iBAAiB,GAAG,OAAO,GAAG,MAAM;IAC5DC;EAAI,CACL,GAAGP,KAAK;EAET,MAAMQ,MAAM,GAAGpB,iBAAA,CAAAqB,KAAK,CAAC,QAAQ,CAAC;EAE9B,MAAMC,IAAI,GAAGtB,iBAAA,CAAAuB,qBAAqB,CAAC,KAAK,EAAE;IAAE,GAAGX,KAAK;IAAEC;EAAG,CAAE,EAAE,sBAAuB,CAAC,UAAU,CAAC,CAAC;EAEjG,MAAMW,KAAK,GAAGxB,iBAAA,CAAAyB,gBAAgB,CAACb,KAAK,CAACY,KAAK,EAAE;IAC1CE,YAAY,EAAE;MACZC,EAAE,EAAEP,MAAM,GAAG,SAAS;MACtBJ,QAAQ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AG,CAACd,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAES,EAAE,EAAEE,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEF,EAAE,EAAEK,YAAY,CAAC,kBAAkB,CAAC,CAAC,CACnGK,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;;EAGd,IAAItB,eAAe,KAAK,OAAO,EAAE;IAC/B,CAAAuB,EAAA,GAAAR,YAAY,CAAC,cAAc,eAAAQ,EAAA,cAAAA,EAAA,GAA3BR,YAAY,CAAC,cAAc,IAAM,IAAI;;EAGvC,IAAIhB,QAAQ,EAAE;IACZ,CAAAyB,EAAA,GAAAT,YAAY,CAAC,eAAe,eAAAS,EAAA,cAAAA,EAAA,GAA5BT,YAAY,CAAC,eAAe,IAAM,IAAI;;EAGxC,IAAIpC,KAAK,CAACqC,cAAc,CAACnB,QAAQ,CAAC,EAAE;IAClCQ,IAAI,CAACR,QAAQ,GAAGlB,KAAK,CAAC8C,YAAY,CAAC5B,QAAQ,EAAEkB,YAAY,CAAC;GAC3D,MAAM,IAAI,OAAOlB,QAAQ,KAAK,UAAU,EAAE;IACzCQ,IAAI,CAACR,QAAQ,GAAGA,QAAQ,CAACkB,YAAY,CAAC;;EAGxC,OAAO;IACLjB,WAAW;IACXE,eAAe;IACf0B,UAAU,EAAE;MACVrB,IAAI,EAAE,KAAK;MACXE,KAAK,EAAEzB,aAAA,CAAA6C,KAAK;MACZ1B,iBAAiB,EAAE,KAAK;MACxBa,qBAAqB,EAAE,MAAM;MAC7BF,IAAI,EAAE;KACP;IACDP,IAAI;IACJE,KAAK;IACLO,qBAAqB;IACrBb,iBAAiB;IACjBW;GACD;AACH,CAAC;AA9FYgB,OAAA,CAAAlC,iBAAiB,GAAAA,iBAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Field/useField.js"],"sourcesContent":["var _controlProps, _arialabelledby,\n // Assign the child a generated ID if doesn't already have an ID\n _controlProps1, _controlProps2, _ariainvalid, _controlProps3, _ariarequired;\nimport * 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 */\nexport const useField_unstable = (props, ref) => {\n const {\n children,\n orientation = 'vertical',\n required,\n validationState = props.validationMessage ? 'error' : 'none',\n size\n } = props;\n const baseId = useId('field-');\n const root = getNativeElementProps('div', {\n ...props,\n ref\n }, /*excludedPropNames:*/['children']);\n const label = resolveShorthand(props.label, {\n defaultProps: {\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 const controlProps = /*#__PURE__*/ /*#__PURE__*/React.isValidElement(children) ? {\n ...children.props\n } : {};\n if (label) {\n var _;\n (_ = (_controlProps = controlProps)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _controlProps[_arialabelledby] = label.id;\n if (!label.htmlFor) {\n var _id;\n (_id = (_controlProps1 = controlProps).id) !== null && _id !== void 0 ? _id : _controlProps1.id = baseId + '__control';\n label.htmlFor = controlProps.id;\n }\n }\n if (validationMessage || hint) {\n // The control is described by the validation message, or hint, or both\n // We also preserve and append any aria-describedby supplied by the user\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n controlProps['aria-describedby'] = [validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id, hint === null || hint === void 0 ? void 0 : hint.id, controlProps['aria-describedby']].filter(Boolean).join(' ');\n }\n if (validationState === 'error') {\n var _1;\n (_1 = (_controlProps2 = controlProps)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _controlProps2[_ariainvalid] = true;\n }\n if (required) {\n var _2;\n (_2 = (_controlProps3 = controlProps)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _controlProps3[_ariarequired] = true;\n }\n if ( /*#__PURE__*/React.isValidElement(children)) {\n root.children = /*#__PURE__*/React.cloneElement(children, controlProps);\n } else if (typeof children === 'function') {\n root.children = children(controlProps);\n }\n return {\n orientation,\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//# sourceMappingURL=useField.js.map"],"names":["useField_unstable","_controlProps","_arialabelledby","_controlProps1","_controlProps2","_ariainvalid","_controlProps3","_ariarequired","validationMessageIcons","error","React","createElement","ErrorCircle12Filled","warning","Warning12Filled","success","CheckmarkCircle12Filled","none","undefined","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","useId","root","getNativeElementProps","label","resolveShorthand","defaultProps","id","role","hint","defaultIcon","validationMessageIcon","controlProps","isValidElement","_","htmlFor","_id","filter","Boolean","join","_1","_2","cloneElement","components","Label"],"mappings":";;;;+BAsBaA;;aAAAA;;;6DAnBU;4BACuD;4BACxD;gCACyC;AAN/D,IAAIC,eAAeC,iBACjB,gEAAgE;AAChEC,gBAAgBC,gBAAgBC,cAAcC,gBAAgBC;AAKhE,MAAMC,yBAAyB;IAC7BC,OAAO,WAAW,GAAEC,OAAMC,aA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M8B,cAAc,CAACnB,WAAW;QAChDQ,KAAKR,QAAQ,GAAG,WAAW,GAAEX,OAAMuC,YAAY,CAAC5B,UAAUkB;IAC5D,OAAO,IAAI,OAAOlB,aAAa,YAAY;QACzCQ,KAAKR,QAAQ,GAAGA,SAASkB;IAC3B,CAAC;IACD,OAAO;QACLjB;QACAE;QACA0B,YAAY;YACVrB,MAAM;YACNE,OAAOoB,iBAAK;YACZ1B,mBAAmB;YACnBa,uBAAuB;YACvBF,MAAM;QACR;QACAP;QACAE;QACAO;QACAb;QACAW;IACF;AACF,GACA,oCAAoC"}
@@ -1,113 +1,154 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ fieldClassNames: ()=>fieldClassNames,
13
+ useFieldStyles_unstable: ()=>useFieldStyles_unstable
5
14
  });
6
- exports.useFieldStyles_unstable = exports.fieldClassNames = void 0;
7
- const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
8
- const react_1 = /*#__PURE__*/require("@griffel/react");
9
- exports.fieldClassNames = {
10
- root: `fui-Field`,
11
- label: `fui-Field__label`,
12
- validationMessage: `fui-Field__validationMessage`,
13
- validationMessageIcon: `fui-Field__validationMessageIcon`,
14
- hint: `fui-Field__hint`
15
+ const _react = require("@griffel/react");
16
+ const fieldClassNames = {
17
+ root: `fui-Field`,
18
+ label: `fui-Field__label`,
19
+ validationMessage: `fui-Field__validationMessage`,
20
+ validationMessageIcon: `fui-Field__validationMessageIcon`,
21
+ hint: `fui-Field__hint`
15
22
  };
16
23
  // Size of the icon in the validation message
17
24
  const iconSize = '12px';
18
25
  /**
19
26
  * Styles for the root slot
20
- */
21
- const useRootStyles = /*#__PURE__*/react_1.__styles({
22
- base: {
23
- mc9l5x: "f13qh94s"
24
- },
25
- horizontal: {
26
- Budl1dq: "f2wwaib",
27
- wkccdc: "f1645dqt"
28
- },
29
- horizontalNoLabel: {
30
- uwmqm3: ["f15jqgz8", "fggqkej"],
31
- Budl1dq: "f1c2z91y"
32
- }
27
+ */ const useRootStyles = /*#__PURE__*/ (0, _react["__styles"])({
28
+ base: {
29
+ mc9l5x: "f13qh94s"
30
+ },
31
+ horizontal: {
32
+ Budl1dq: "f2wwaib",
33
+ wkccdc: "f1645dqt"
34
+ },
35
+ horizontalNoLabel: {
36
+ uwmqm3: [
37
+ "f15jqgz8",
38
+ "fggqkej"
39
+ ],
40
+ Budl1dq: "f1c2z91y"
41
+ }
33
42
  }, {
34
- 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;}"]
43
+ d: [
44
+ ".f13qh94s{display:grid;}",
45
+ ".f2wwaib{grid-template-columns:33% 1fr;}",
46
+ ".f1645dqt{grid-template-rows:auto auto auto 1fr;}",
47
+ ".f15jqgz8{padding-left:33%;}",
48
+ ".fggqkej{padding-right:33%;}",
49
+ ".f1c2z91y{grid-template-columns:1fr;}"
50
+ ]
35
51
  });
36
- const useLabelStyles = /*#__PURE__*/react_1.__styles({
37
- base: {
38
- z8tnut: "fclwglc",
39
- Byoj8tv: "fywfov9"
40
- },
41
- large: {
42
- z8tnut: "f1sl3k7w",
43
- Byoj8tv: "f1brlhvm"
44
- },
45
- vertical: {
46
- jrapky: "fyacil5"
47
- },
48
- verticalLarge: {
49
- jrapky: "f8l5zjj"
50
- },
51
- horizontal: {
52
- t21cq0: ["fkujibs", "f199hnxi"],
53
- Ijaq50: "f16hsg94",
54
- nk6f5a: "f1nzqi2z"
55
- }
52
+ const useLabelStyles = /*#__PURE__*/ (0, _react["__styles"])({
53
+ base: {
54
+ z8tnut: "fclwglc",
55
+ Byoj8tv: "fywfov9"
56
+ },
57
+ large: {
58
+ z8tnut: "f1sl3k7w",
59
+ Byoj8tv: "f1brlhvm"
60
+ },
61
+ vertical: {
62
+ jrapky: "fyacil5"
63
+ },
64
+ verticalLarge: {
65
+ jrapky: "f8l5zjj"
66
+ },
67
+ horizontal: {
68
+ t21cq0: [
69
+ "fkujibs",
70
+ "f199hnxi"
71
+ ],
72
+ Ijaq50: "f16hsg94",
73
+ nk6f5a: "f1nzqi2z"
74
+ }
56
75
  }, {
57
- 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;}"]
76
+ d: [
77
+ ".fclwglc{padding-top:var(--spacingVerticalXXS);}",
78
+ ".fywfov9{padding-bottom:var(--spacingVerticalXXS);}",
79
+ ".f1sl3k7w{padding-top:1px;}",
80
+ ".f1brlhvm{padding-bottom:1px;}",
81
+ ".fyacil5{margin-bottom:var(--spacingVerticalXXS);}",
82
+ ".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}",
83
+ ".fkujibs{margin-right:var(--spacingHorizontalM);}",
84
+ ".f199hnxi{margin-left:var(--spacingHorizontalM);}",
85
+ ".f16hsg94{grid-row-start:1;}",
86
+ ".f1nzqi2z{grid-row-end:-1;}"
87
+ ]
58
88
  });
59
- const useSecondaryTextBaseClassName = /*#__PURE__*/react_1.__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);}"]);
60
- const useSecondaryTextStyles = /*#__PURE__*/react_1.__styles({
61
- error: {
62
- sj55zd: "f1hcrxcs"
63
- },
64
- withIcon: {
65
- uwmqm3: ["frawy03", "fg4c52"]
66
- }
89
+ const useSecondaryTextBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r5c4z9l", null, [
90
+ ".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
91
+ ]);
92
+ const useSecondaryTextStyles = /*#__PURE__*/ (0, _react["__styles"])({
93
+ error: {
94
+ sj55zd: "f1hcrxcs"
95
+ },
96
+ withIcon: {
97
+ uwmqm3: [
98
+ "frawy03",
99
+ "fg4c52"
100
+ ]
101
+ }
67
102
  }, {
68
- d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}", ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"]
103
+ d: [
104
+ ".f1hcrxcs{color:var(--colorPaletteRedForeground1);}",
105
+ ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}",
106
+ ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"
107
+ ]
69
108
  });
70
- const useValidationMessageIconBaseClassName = /*#__PURE__*/react_1.__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;}"]);
71
- const useValidationMessageIconStyles = /*#__PURE__*/react_1.__styles({
72
- error: {
73
- sj55zd: "f1hcrxcs"
74
- },
75
- warning: {
76
- sj55zd: "f1k5f75o"
77
- },
78
- success: {
79
- sj55zd: "ffmvakt"
80
- }
109
+ const useValidationMessageIconBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("ra7h1uk", "r1rh6bd7", [
110
+ ".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}",
111
+ ".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}"
112
+ ]);
113
+ const useValidationMessageIconStyles = /*#__PURE__*/ (0, _react["__styles"])({
114
+ error: {
115
+ sj55zd: "f1hcrxcs"
116
+ },
117
+ warning: {
118
+ sj55zd: "f1k5f75o"
119
+ },
120
+ success: {
121
+ sj55zd: "ffmvakt"
122
+ }
81
123
  }, {
82
- d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
124
+ d: [
125
+ ".f1hcrxcs{color:var(--colorPaletteRedForeground1);}",
126
+ ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}",
127
+ ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"
128
+ ]
83
129
  });
84
- /**
85
- * Apply styling to the Field slots based on the state
86
- */
87
- const useFieldStyles_unstable = state => {
88
- const {
89
- validationState
90
- } = state;
91
- const horizontal = state.orientation === 'horizontal';
92
- const rootStyles = useRootStyles();
93
- state.root.className = react_1.mergeClasses(exports.fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
94
- const labelStyles = useLabelStyles();
95
- if (state.label) {
96
- state.label.className = react_1.mergeClasses(exports.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);
97
- }
98
- const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
99
- const validationMessageIconStyles = useValidationMessageIconStyles();
100
- if (state.validationMessageIcon) {
101
- state.validationMessageIcon.className = react_1.mergeClasses(exports.fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
102
- }
103
- const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
104
- const secondaryTextStyles = useSecondaryTextStyles();
105
- if (state.validationMessage) {
106
- state.validationMessage.className = react_1.mergeClasses(exports.fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
107
- }
108
- if (state.hint) {
109
- state.hint.className = react_1.mergeClasses(exports.fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
110
- }
111
- };
112
- exports.useFieldStyles_unstable = useFieldStyles_unstable;
130
+ const useFieldStyles_unstable = (state)=>{
131
+ const { validationState } = state;
132
+ const horizontal = state.orientation === 'horizontal';
133
+ const rootStyles = useRootStyles();
134
+ state.root.className = (0, _react.mergeClasses)(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
135
+ const labelStyles = useLabelStyles();
136
+ if (state.label) {
137
+ state.label.className = (0, _react.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);
138
+ }
139
+ const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
140
+ const validationMessageIconStyles = useValidationMessageIconStyles();
141
+ if (state.validationMessageIcon) {
142
+ state.validationMessageIcon.className = (0, _react.mergeClasses)(fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
143
+ }
144
+ const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
145
+ const secondaryTextStyles = useSecondaryTextStyles();
146
+ if (state.validationMessage) {
147
+ state.validationMessage.className = (0, _react.mergeClasses)(fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
148
+ }
149
+ if (state.hint) {
150
+ state.hint.className = (0, _react.mergeClasses)(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
151
+ }
152
+ }; //# sourceMappingURL=useFieldStyles.js.map
153
+
113
154
  //# sourceMappingURL=useFieldStyles.js.map