@fluentui/react-field 9.0.0-alpha.25 → 9.0.0-alpha.27

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 +85 -1
  3. package/CHANGELOG.md +29 -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 +1 @@
1
- {"version":3,"names":["react_theme_1","require","react_1","exports","fieldClassNames","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","useFieldStyles_unstable","state","validationState","orientation","rootStyles","className","mergeClasses","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"sources":["../src/packages/react-components/react-field/src/components/Field/useFieldStyles.ts"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { FieldSlots, FieldState } from './Field.types';\n\nexport const fieldClassNames: SlotClassNames<FieldSlots> = {\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\n// Size of the icon in the validation message\nconst iconSize = '12px';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'grid',\n },\n\n // In horizontal layout, the field is a grid with the label taking up the entire first column.\n // The last row is slack space in case the label is taller than the rest of the content.\n horizontal: {\n gridTemplateColumns: '33% 1fr',\n gridTemplateRows: 'auto auto auto 1fr',\n },\n\n // In horizontal layout without a label, replace the label's column with padding.\n // This lets grid auto-flow properly place the other children, and keeps fields with and without labels aligned.\n horizontalNoLabel: {\n paddingLeft: '33%',\n gridTemplateColumns: '1fr',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n paddingTop: tokens.spacingVerticalXXS,\n paddingBottom: tokens.spacingVerticalXXS,\n },\n\n large: {\n paddingTop: '1px',\n paddingBottom: '1px',\n },\n\n vertical: {\n marginBottom: tokens.spacingVerticalXXS,\n },\n\n verticalLarge: {\n marginBottom: tokens.spacingVerticalXS,\n },\n\n horizontal: {\n marginRight: tokens.spacingHorizontalM,\n gridRowStart: '1',\n gridRowEnd: '-1',\n },\n});\n\nconst useSecondaryTextBaseClassName = makeResetStyles({\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1,\n});\n\nconst useSecondaryTextStyles = makeStyles({\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n\n withIcon: {\n // Add a gutter for the icon, to allow multiple lines of text to line up to the right of the icon.\n paddingLeft: `calc(${iconSize} + ${tokens.spacingHorizontalXS})`,\n },\n});\n\nconst useValidationMessageIconBaseClassName = makeResetStyles({\n display: 'inline-block',\n fontSize: iconSize,\n // Negative left margin puts the icon in the gutter of the validation message div's withIcon style.\n marginLeft: `calc(-${iconSize} - ${tokens.spacingHorizontalXS})`,\n marginRight: tokens.spacingHorizontalXS,\n // Line height of 0 prevents the verticalAlign from affecting the line height of the text.\n lineHeight: '0',\n // Negative verticalAlign shifts the inline icon down to align with the text (effectively top padding).\n verticalAlign: '-1px',\n});\n\nconst useValidationMessageIconStyles = makeStyles({\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n warning: {\n color: tokens.colorPaletteDarkOrangeForeground1,\n },\n success: {\n color: tokens.colorPaletteGreenForeground1,\n },\n});\n\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = (state: FieldState) => {\n const { validationState } = state;\n const horizontal = state.orientation === 'horizontal';\n\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n fieldClassNames.root,\n rootStyles.base,\n horizontal && rootStyles.horizontal,\n horizontal && !state.label && rootStyles.horizontalNoLabel,\n state.root.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n fieldClassNames.label,\n labelStyles.base,\n horizontal && labelStyles.horizontal,\n !horizontal && labelStyles.vertical,\n state.label.size === 'large' && labelStyles.large,\n !horizontal && state.label.size === 'large' && labelStyles.verticalLarge,\n state.label.className,\n );\n }\n\n const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(\n fieldClassNames.validationMessageIcon,\n validationMessageIconBaseClassName,\n validationState !== 'none' && validationMessageIconStyles[validationState],\n state.validationMessageIcon.className,\n );\n }\n\n const secondaryTextBaseClassName = useSecondaryTextBaseClassName();\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(\n fieldClassNames.validationMessage,\n secondaryTextBaseClassName,\n validationState === 'error' && secondaryTextStyles.error,\n !!state.validationMessageIcon && secondaryTextStyles.withIcon,\n state.validationMessage.className,\n );\n }\n\n if (state.hint) {\n state.hint.className = mergeClasses(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n"],"mappings":";;;;;;AAAA,M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,OAAA,CAAAC,eAAe,CAACI,qBAAqB,EACrC0C,kCAAkC,EAClCP,eAAe,KAAK,MAAM,IAAIQ,2BAA2B,CAACR,eAAe,CAAC,EAC1ED,KAAK,CAAClC,qBAAqB,CAACsC,SAAS,CACtC;;EAGH,MAAMM,0BAA0B,GAAGrB,6BAA6B,EAAE;EAClE,MAAMsB,mBAAmB,GAAGpB,sBAAsB,EAAE;EACpD,IAAIS,KAAK,CAACnC,iBAAiB,EAAE;IAC3BmC,KAAK,CAACnC,iBAAiB,CAACuC,SAAS,GAAG5C,OAAA,CAAA6C,YAAY,CAC9C5C,OAAA,CAAAC,eAAe,CAACG,iBAAiB,EACjC6C,0BAA0B,EAC1BT,eAAe,KAAK,OAAO,IAAIU,mBAAmB,CAACnB,KAAK,EACxD,CAAC,CAACQ,KAAK,CAAClC,qBAAqB,IAAI6C,mBAAmB,CAACjB,QAAQ,EAC7DM,KAAK,CAACnC,iBAAiB,CAACuC,SAAS,CAClC;;EAGH,IAAIJ,KAAK,CAACjC,IAAI,EAAE;IACdiC,KAAK,CAACjC,IAAI,CAACqC,SAAS,GAAG5C,OAAA,CAAA6C,YAAY,CAAC5C,OAAA,CAAAC,eAAe,CAACK,IAAI,EAAE2C,0BAA0B,EAAEV,KAAK,CAACjC,IAAI,CAACqC,SAAS,CAAC;;AAE/G,CAAC;AApDY3C,OAAA,CAAAsC,uBAAuB,GAAAA,uBAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Field/useFieldStyles.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.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,IAAAA,kB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AAWU,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,0CAA0C"}
@@ -1,52 +1,24 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.makeDeprecatedField = exports.getDeprecatedFieldClassNames = exports.useField_unstable = exports.useFieldStyles_unstable = exports.renderField_unstable = exports.fieldClassNames = exports.Field = void 0;
7
- var Field_1 = /*#__PURE__*/require("./Field");
8
- Object.defineProperty(exports, "Field", {
9
- enumerable: true,
10
- get: function () {
11
- return Field_1.Field;
12
- }
13
- });
14
- Object.defineProperty(exports, "fieldClassNames", {
15
- enumerable: true,
16
- get: function () {
17
- return Field_1.fieldClassNames;
18
- }
19
- });
20
- Object.defineProperty(exports, "renderField_unstable", {
21
- enumerable: true,
22
- get: function () {
23
- return Field_1.renderField_unstable;
24
- }
25
- });
26
- Object.defineProperty(exports, "useFieldStyles_unstable", {
27
- enumerable: true,
28
- get: function () {
29
- return Field_1.useFieldStyles_unstable;
30
- }
31
- });
32
- Object.defineProperty(exports, "useField_unstable", {
33
- enumerable: true,
34
- get: function () {
35
- return Field_1.useField_unstable;
36
- }
37
- });
38
- // eslint-disable-next-line deprecation/deprecation
39
- var makeDeprecatedField_1 = /*#__PURE__*/require("./util/makeDeprecatedField");
40
- Object.defineProperty(exports, "getDeprecatedFieldClassNames", {
41
- enumerable: true,
42
- get: function () {
43
- return makeDeprecatedField_1.getDeprecatedFieldClassNames;
44
- }
45
- });
46
- Object.defineProperty(exports, "makeDeprecatedField", {
47
- enumerable: true,
48
- get: function () {
49
- return makeDeprecatedField_1.makeDeprecatedField;
50
- }
51
- });
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
+ Field: ()=>_field.Field,
13
+ fieldClassNames: ()=>_field.fieldClassNames,
14
+ renderField_unstable: ()=>_field.renderField_unstable,
15
+ useFieldStyles_unstable: ()=>_field.useFieldStyles_unstable,
16
+ useField_unstable: ()=>_field.useField_unstable,
17
+ getDeprecatedFieldClassNames: ()=>_makeDeprecatedField.getDeprecatedFieldClassNames,
18
+ makeDeprecatedField: ()=>_makeDeprecatedField.makeDeprecatedField
19
+ });
20
+ const _field = require("./Field");
21
+ const _makeDeprecatedField = require("./util/makeDeprecatedField");
22
+ //# sourceMappingURL=index.js.map
23
+
52
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Field_1","require","Object","defineProperty","exports","enumerable","get","Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","makeDeprecatedField_1","getDeprecatedFieldClassNames","makeDeprecatedField"],"sources":["../src/packages/react-components/react-field/src/index.ts"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport type { FieldProps, FieldSlots, FieldState } from './Field';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { getDeprecatedFieldClassNames, makeDeprecatedField } from './util/makeDeprecatedField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { DeprecatedFieldProps } from './util/makeDeprecatedField';\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAO,KAAK;EAAA;AAAA;AAAEL,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAQ,eAAe;EAAA;AAAA;AAAEN,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAS,oBAAoB;EAAA;AAAA;AAAEP,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAU,uBAAuB;EAAA;AAAA;AAAER,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAW,iBAAiB;EAAA;AAAA;AAGjG;AACA,IAAAC,qBAAA,gBAAAX,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAM,qBAAA,CAAAC,4BAA4B;EAAA;AAAA;AAAEX,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAM,qBAAA,CAAAE,mBAAmB;EAAA;AAAA"}
1
+ {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\n// eslint-disable-next-line deprecation/deprecation\nexport { getDeprecatedFieldClassNames, makeDeprecatedField } from './util/makeDeprecatedField';\n//# sourceMappingURL=index.js.map"],"names":["Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","getDeprecatedFieldClassNames","makeDeprecatedField"],"mappings":";;;;;;;;;;;IAASA,KAAK,MAALA,YAAK;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IAExFC,4BAA4B,MAA5BA,iDAA4B;IAAEC,mBAAmB,MAAnBA,wCAAmB;;uBAF+C;qCAEvC;CAClE,iCAAiC"}
@@ -1,79 +1,61 @@
1
- "use strict";
2
-
1
+ /* eslint-disable deprecation/deprecation */ "use strict";
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
+ makeDeprecatedField: ()=>makeDeprecatedField,
13
+ getDeprecatedFieldClassNames: ()=>getDeprecatedFieldClassNames
5
14
  });
6
- exports.getDeprecatedFieldClassNames = exports.makeDeprecatedField = void 0;
7
- /* eslint-disable deprecation/deprecation */
8
- const React = /*#__PURE__*/require("react");
9
- const Field_1 = /*#__PURE__*/require("../Field");
15
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
16
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
17
+ const _field = require("../Field");
10
18
  /**
11
19
  * Partition the props used by the Field itself, from the props that are passed to the underlying field component.
12
- */
13
- function getPartitionedFieldProps(props) {
14
- const {
15
- className,
16
- control,
17
- hint,
18
- label,
19
- orientation,
20
- required,
21
- root,
22
- size,
23
- style,
24
- validationMessage,
25
- validationMessageIcon,
26
- validationState = 'none',
27
- ...restOfProps
28
- } = props;
29
- return [{
30
- className,
31
- hint,
32
- label,
33
- orientation,
34
- required,
35
- size,
36
- style,
37
- validationMessage,
38
- validationMessageIcon,
39
- validationState,
40
- ...root
41
- }, {
42
- required,
43
- size,
44
- ...restOfProps,
45
- ...control
46
- }];
20
+ */ function getPartitionedFieldProps(props) {
21
+ const { className , control , hint , label , orientation , required , root , size , style , validationMessage , validationMessageIcon , validationState ='none' , ...restOfProps } = props;
22
+ return [
23
+ {
24
+ className,
25
+ hint,
26
+ label,
27
+ orientation,
28
+ required,
29
+ size,
30
+ style,
31
+ validationMessage,
32
+ validationMessageIcon,
33
+ validationState,
34
+ ...root
35
+ },
36
+ {
37
+ required,
38
+ size,
39
+ ...restOfProps,
40
+ ...control
41
+ }
42
+ ];
47
43
  }
48
- /**
49
- * @deprecated Only for use to make deprecated [Control]Field shim components.
50
- * @internal
51
- */
52
44
  function makeDeprecatedField(Control, options = {}) {
53
- const {
54
- mapProps = props => props,
55
- displayName = `${Control.displayName}Field`
56
- } = options;
57
- const DeprecatedField = React.forwardRef((props, ref) => {
58
- const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
59
- return React.createElement(Field_1.Field, {
60
- ...fieldProps
61
- }, React.createElement(Control, {
62
- ...controlProps,
63
- ref: ref
64
- }));
65
- });
66
- DeprecatedField.displayName = displayName;
67
- return DeprecatedField;
45
+ const { mapProps =(props)=>props , displayName =`${Control.displayName}Field` } = options;
46
+ const DeprecatedField = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
47
+ const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
48
+ return /*#__PURE__*/ _react.createElement(_field.Field, fieldProps, /*#__PURE__*/ _react.createElement(Control, {
49
+ ...controlProps,
50
+ ref: ref
51
+ }));
52
+ });
53
+ DeprecatedField.displayName = displayName;
54
+ return DeprecatedField;
68
55
  }
69
- exports.makeDeprecatedField = makeDeprecatedField;
70
- /**
71
- * @deprecated Only for use to make deprecated [Control]Field shim components.
72
- * @internal
73
- */
74
- const getDeprecatedFieldClassNames = controlRootClassName => ({
75
- ...Field_1.fieldClassNames,
76
- control: controlRootClassName
77
- });
78
- exports.getDeprecatedFieldClassNames = getDeprecatedFieldClassNames;
56
+ const getDeprecatedFieldClassNames = (controlRootClassName)=>({
57
+ ..._field.fieldClassNames,
58
+ control: controlRootClassName
59
+ }); //# sourceMappingURL=makeDeprecatedField.js.map
60
+
79
61
  //# sourceMappingURL=makeDeprecatedField.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","Field_1","getPartitionedFieldProps","props","className","control","hint","label","orientation","required","root","size","style","validationMessage","validationMessageIcon","validationState","restOfProps","makeDeprecatedField","Control","options","mapProps","displayName","DeprecatedField","forwardRef","ref","fieldProps","controlProps","createElement","Field","exports","getDeprecatedFieldClassNames","controlRootClassName","fieldClassNames"],"sources":["../src/packages/react-components/react-field/src/util/makeDeprecatedField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport * as React from 'react';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../Field';\nimport { Field, fieldClassNames } from '../Field';\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport type DeprecatedFieldProps<ControlProps> = ControlProps & {\n root?: FieldProps;\n control?: ControlProps;\n} & Pick<\n FieldProps,\n | 'className'\n | 'hint'\n | 'label'\n | 'orientation'\n | 'style'\n | 'validationMessage'\n | 'validationMessageIcon'\n | 'validationState'\n >;\n\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nfunction getPartitionedFieldProps<ControlProps>(\n props: DeprecatedFieldProps<ControlProps> & Pick<FieldProps, 'required' | 'size'>,\n) {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n required,\n root,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState = 'none',\n ...restOfProps\n } = props;\n\n return [\n {\n className,\n hint,\n label,\n orientation,\n required,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...root,\n },\n {\n required,\n size,\n ...restOfProps,\n ...control,\n },\n ];\n}\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport function makeDeprecatedField<ControlProps>(\n Control: React.ComponentType<ControlProps>,\n options: {\n mapProps?: (props: DeprecatedFieldProps<ControlProps>) => DeprecatedFieldProps<ControlProps>;\n displayName?: string;\n } = {},\n) {\n const { mapProps = props => props, displayName = `${Control.displayName}Field` } = options;\n\n const DeprecatedField = React.forwardRef((props, ref) => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));\n return (\n <Field {...fieldProps}>\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n <Control {...(controlProps as any)} ref={ref as any} />\n </Field>\n );\n }) as ForwardRefComponent<DeprecatedFieldProps<ControlProps>>;\n\n DeprecatedField.displayName = displayName;\n\n return DeprecatedField;\n}\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport const getDeprecatedFieldClassNames = (controlRootClassName: string) => ({\n ...fieldClassNames,\n control: controlRootClassName,\n});\n"],"mappings":";;;;;;AAAA;AACA,MAAAA,KAAA,gBAAAC,OAAA;AAGA,MAAAC,OAAA,gBAAAD,OAAA;AAqBA;;;AAGA,SAASE,wBAAwBA,CAC/BC,KAAiF;EAEjF,MAAM;IACJC,SAAS;IACTC,OAAO;IACPC,IAAI;IACJC,KAAK;IACLC,WAAW;IACXC,QAAQ;IACRC,IAAI;IACJC,IAAI;IACJC,KAAK;IACLC,iBAAiB;IACjBC,qBAAqB;IACrBC,eAAe,GAAG,MAAM;IACxB,GAAGC;EAAW,CACf,GAAGb,KAAK;EAET,OAAO,CACL;IACEC,SAAS;IACTE,IAAI;IACJC,KAAK;IACLC,WAAW;IACXC,QAAQ;IACRE,IAAI;IACJC,KAAK;IACLC,iBAAiB;IACjBC,qBAAqB;IACrBC,eAAe;IACf,GAAGL;GACJ,EACD;IACED,QAAQ;IACRE,IAAI;IACJ,GAAGK,WAAW;IACd,GAAGX;GACJ,CACF;AACH;AAEA;;;;AAIA,SAAgBY,mBAAmBA,CACjCC,OAA0C,EAC1CC,OAAA,GAGI,EAAE;EAEN,MAAM;IAAEC,QAAQ,GAAGjB,KAAK,IAAIA,KAAK;IAAEkB,WAAW,GAAG,GAAGH,OAAO,CAACG,WAAW;EAAO,CAAE,GAAGF,OAAO;EAE1F,MAAMG,eAAe,GAAGvB,KAAK,CAACwB,UAAU,CAAC,CAACpB,KAAK,EAAEqB,GAAG,KAAI;IACtD,MAAM,CAACC,UAAU,EAAEC,YAAY,CAAC,GAAGxB,wBAAwB,CAACkB,QAAQ,CAACjB,KAAK,CAAC,CAAC;IAC5E,OACEJ,KAAA,CAAA4B,aAAA,CAAC1B,OAAA,CAAA2B,KAAK;MAAA,GAAKH;IAAU,GAEnB1B,KAAA,CAAA4B,aAAA,CAACT,OAAO;MAAA,GAAMQ,YAAoB;MAAEF,GAAG,EAAEA;IAAU,EAAI,CACjD;EAEZ,CAAC,CAA4D;EAE7DF,eAAe,CAACD,WAAW,GAAGA,WAAW;EAEzC,OAAOC,eAAe;AACxB;AAtBAO,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA;AAwBA;;;;AAIO,MAAMa,4BAA4B,GAAIC,oBAA4B,KAAM;EAC7E,GAAG9B,OAAA,CAAA+B,eAAe;EAClB3B,OAAO,EAAE0B;CACV,CAAC;AAHWF,OAAA,CAAAC,4BAA4B,GAAAA,4BAAA"}
1
+ {"version":3,"sources":["../../lib/util/makeDeprecatedField.js"],"sourcesContent":["/* eslint-disable deprecation/deprecation */import * as React from 'react';\nimport { Field, fieldClassNames } from '../Field';\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nfunction getPartitionedFieldProps(props) {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n required,\n root,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState = 'none',\n ...restOfProps\n } = props;\n return [{\n className,\n hint,\n label,\n orientation,\n required,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...root\n }, {\n required,\n size,\n ...restOfProps,\n ...control\n }];\n}\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport function makeDeprecatedField(Control, options = {}) {\n const {\n mapProps = props => props,\n displayName = `${Control.displayName}Field`\n } = options;\n const DeprecatedField = /*#__PURE__*/React.forwardRef((props, ref) => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));\n return /*#__PURE__*/React.createElement(Field, fieldProps, /*#__PURE__*/React.createElement(Control, {\n ...controlProps,\n ref: ref\n }));\n });\n DeprecatedField.displayName = displayName;\n return DeprecatedField;\n}\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport const getDeprecatedFieldClassNames = controlRootClassName => ({\n ...fieldClassNames,\n control: controlRootClassName\n});\n//# sourceMappingURL=makeDeprecatedField.js.map"],"names":["makeDeprecatedField","getDeprecatedFieldClassNames","getPartitionedFieldProps","props","className","control","hint","label","orientation","required","root","size","style","validationMessage","validationMessageIcon","validationState","restOfProps","Control","options","mapProps","displayName","DeprecatedField","React","forwardRef","ref","fieldProps","controlProps","createElement","Field","controlRootClassName","fieldClassNames"],"mappings":"AAAA,0CAA0C;;;;;;;;;;;IA4C1BA,mBAAmB,MAAnBA;IAmBHC,4BAA4B,MAA5BA;;;6DA/DsD;uBAC5B;AACvC;;CAEC,GACD,SAASC,yBAAyBC,KAAK,EAAE;IACvC,MAAM,EACJC,UAAS,EACTC,QAAO,EACPC,KAAI,EACJC,MAAK,EACLC,YAAW,EACXC,SAAQ,EACRC,KAAI,EACJC,KAAI,EACJC,MAAK,EACLC,kBAAiB,EACjBC,sBAAqB,EACrBC,iBAAkB,OAAM,EACxB,GAAGC,aACJ,GAAGb;IACJ,OAAO;QAAC;YACNC;YACAE;YACAC;YACAC;YACAC;YACAE;YACAC;YACAC;YACAC;YACAC;YACA,GAAGL,IAAI;QACT;QAAG;YACDD;YACAE;YACA,GAAGK,WAAW;YACd,GAAGX,OAAO;QACZ;KAAE;AACJ;AAKO,SAASL,oBAAoBiB,OAAO,EAAEC,UAAU,CAAC,CAAC,EAAE;IACzD,MAAM,EACJC,UAAWhB,CAAAA,QAASA,MAAK,EACzBiB,aAAc,CAAC,EAAEH,QAAQG,WAAW,CAAC,KAAK,CAAC,CAAA,EAC5C,GAAGF;IACJ,MAAMG,kBAAkB,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACpB,OAAOqB,MAAQ;QACpE,MAAM,CAACC,YAAYC,aAAa,GAAGxB,yBAAyBiB,SAAShB;QACrE,OAAO,WAAW,GAAEmB,OAAMK,aAAa,CAACC,YAAK,EAAEH,YAAY,WAAW,GAAEH,OAAMK,aAAa,CAACV,SAAS;YACnG,GAAGS,YAAY;YACfF,KAAKA;QACP;IACF;IACAH,gBAAgBD,WAAW,GAAGA;IAC9B,OAAOC;AACT;AAKO,MAAMpB,+BAA+B4B,CAAAA,uBAAyB,CAAA;QACnE,GAAGC,sBAAe;QAClBzB,SAASwB;IACX,CAAA,GACA,+CAA+C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-field",
3
- "version": "9.0.0-alpha.25",
3
+ "version": "9.0.0-alpha.27",
4
4
  "description": "Fluent UI Field components",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -22,23 +22,23 @@
22
22
  "storybook": "start-storybook",
23
23
  "test": "jest --passWithNoTests",
24
24
  "type-check": "tsc -b tsconfig.json",
25
- "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
25
+ "generate-api": "just-scripts generate-api"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
- "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
30
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.20",
31
31
  "@fluentui/scripts-api-extractor": "*",
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-context-selector": "^9.1.13",
36
- "@fluentui/react-icons": "^2.0.175",
37
- "@fluentui/react-label": "^9.1.3",
38
- "@fluentui/react-theme": "^9.1.6",
39
- "@fluentui/react-utilities": "^9.7.0",
35
+ "@fluentui/react-context-selector": "^9.1.15",
36
+ "@fluentui/react-icons": "^2.0.196",
37
+ "@fluentui/react-label": "^9.1.5",
38
+ "@fluentui/react-theme": "^9.1.7",
39
+ "@fluentui/react-utilities": "^9.7.2",
40
40
  "@griffel/react": "^1.5.2",
41
- "tslib": "^2.1.0"
41
+ "@swc/helpers": "^0.4.14"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@types/react": ">=16.8.0 <19.0.0",
@@ -56,6 +56,7 @@
56
56
  "exports": {
57
57
  ".": {
58
58
  "types": "./dist/index.d.ts",
59
+ "node": "./lib-commonjs/index.js",
59
60
  "import": "./lib/index.js",
60
61
  "require": "./lib-commonjs/index.js"
61
62
  },
package/lib-amd/Field.js DELETED
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/Field/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=Field.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-field/src/Field.ts"],"names":[],"mappings":";;;IAAA,uCAAyC","sourcesContent":["export * from './components/Field/index';\n"]}
@@ -1,12 +0,0 @@
1
- define(["require", "exports", "react", "./renderField", "./useField", "./useFieldStyles"], function (require, exports, React, renderField_1, useField_1, useFieldStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Field = void 0;
5
- exports.Field = React.forwardRef(function (props, ref) {
6
- var state = useField_1.useField_unstable(props, ref);
7
- useFieldStyles_1.useFieldStyles_unstable(state);
8
- return renderField_1.renderField_unstable(state);
9
- });
10
- exports.Field.displayName = 'Field';
11
- });
12
- //# sourceMappingURL=Field.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/Field.tsx"],"names":[],"mappings":";;;;IAOa,QAAA,KAAK,GAAoC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAChF,IAAM,KAAK,GAAG,4BAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC5C,wCAAuB,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,kCAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC","sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from './Field.types';\nimport { renderField_unstable } from './renderField';\nimport { useField_unstable } from './useField';\nimport { useFieldStyles_unstable } from './useFieldStyles';\n\nexport const Field: ForwardRefComponent<FieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nField.displayName = 'Field';\n"]}
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Field.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Field.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/Field.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * The props added to the Field's child element.\n */\nexport type FieldChildProps = Pick<\n React.HTMLAttributes<HTMLElement>,\n 'id' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-required'\n>;\n\n/**\n * Slots of the Field component\n */\nexport type FieldSlots = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The label associated with the field.\n */\n label?: Slot<typeof Label>;\n\n /**\n * A message about the validation state. By default, this is an error message, but it can be a success, warning,\n * or custom message by setting `validationState`.\n */\n validationMessage?: Slot<'div'>;\n\n /**\n * The icon associated with the `validationMessage`. This will only be displayed if `validationMessage` is set.\n *\n * The default depends on `validationState`:\n * * error: `<ErrorCircle12Filled />`\n * * warning: `<Warning12Filled />`\n * * success: `<CheckmarkCircle12Filled />`\n * * none: `null`\n */\n validationMessageIcon?: Slot<'span'>;\n\n /**\n * Additional hint text below the field.\n */\n hint?: Slot<'div'>;\n};\n\n/**\n * Field Props\n */\nexport type FieldProps = Omit<ComponentProps<FieldSlots>, 'children'> & {\n /**\n * The Field's child can be a single form control, or a render function that takes the props that should be spread on\n * a form control.\n *\n * All form controls in this library can be used directly as children (such as `<Input>` or `<RadioGroup>`), as well\n * as intrinsic form controls like `<input>` or `<textarea>`. Custom controls can also be used as long as they\n * accept FieldChildProps and spread them on the appropriate element.\n *\n * For more complex scenarios, a render function can be used to pass the FieldChildProps to the appropriate control.\n */\n children?: React.ReactElement<FieldChildProps> | null | ((props: FieldChildProps) => React.ReactNode);\n\n /**\n * The orientation of the label relative to the field component.\n * This only affects the label, and not the validationMessage or hint (which always appear below the field component).\n *\n * @default vertical\n */\n orientation?: 'vertical' | 'horizontal';\n\n /**\n * The `validationState` affects the display of the `validationMessage` and `validationMessageIcon`.\n *\n * * error: (default) The validation message has a red error icon and red text, with `role=\"alert\"` so it is\n * announced by screen readers. Additionally, the control inside the field has `aria-invalid` set, which adds a\n * red border to some field components (such as `Input`).\n * * success: The validation message has a green checkmark icon and gray text.\n * * warning: The validation message has a yellow exclamation icon and gray text.\n * * none: The validation message has no icon and gray text.\n *\n * @default error when validationMessage is set; none otherwise.\n */\n validationState?: 'error' | 'warning' | 'success' | 'none';\n\n /**\n * Marks the Field as required. If `true`, an asterisk will be appended to the label, and `aria-required` will be set\n * on the Field's child.\n */\n required?: boolean;\n\n /**\n * The size of the Field's label.\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n};\n\n/**\n * State used in rendering Field\n */\nexport type FieldState = ComponentState<Required<FieldSlots>> &\n Required<Pick<FieldProps, 'orientation' | 'validationState'>>;\n"]}
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Field.types", "./Field", "./renderField", "./useField", "./useFieldStyles"], function (require, exports, tslib_1, Field_types_1, Field_1, renderField_1, useField_1, useFieldStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Field_types_1, exports);
5
- tslib_1.__exportStar(Field_1, exports);
6
- tslib_1.__exportStar(renderField_1, exports);
7
- tslib_1.__exportStar(useField_1, exports);
8
- tslib_1.__exportStar(useFieldStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B;IAC9B,uCAAwB;IACxB,6CAA8B;IAC9B,0CAA2B;IAC3B,gDAAiC","sourcesContent":["export * from './Field.types';\nexport * from './Field';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles';\n"]}
@@ -1,20 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderField_unstable = void 0;
5
- /**
6
- * Render the final JSX of Field
7
- */
8
- var renderField_unstable = function (state) {
9
- var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
- slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label)),
12
- slotProps.root.children,
13
- slots.validationMessage && (React.createElement(slots.validationMessage, tslib_1.__assign({}, slotProps.validationMessage),
14
- slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, tslib_1.__assign({}, slotProps.validationMessageIcon)),
15
- slotProps.validationMessage.children)),
16
- slots.hint && React.createElement(slots.hint, tslib_1.__assign({}, slotProps.hint))));
17
- };
18
- exports.renderField_unstable = renderField_unstable;
19
- });
20
- //# sourceMappingURL=renderField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/renderField.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAiB;QAC9C,IAAA,KAAuB,0BAAQ,CAAa,KAAK,CAAC,EAAhD,KAAK,WAAA,EAAE,SAAS,eAAgC,CAAC;QAEzD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACnD,SAAS,CAAC,IAAI,CAAC,QAAQ;YACvB,KAAK,CAAC,iBAAiB,IAAI,CAC1B,oBAAC,KAAK,CAAC,iBAAiB,uBAAK,SAAS,CAAC,iBAAiB;gBACrD,KAAK,CAAC,qBAAqB,IAAI,oBAAC,KAAK,CAAC,qBAAqB,uBAAK,SAAS,CAAC,qBAAqB,EAAI;gBACnG,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CACb,CAC3B;YACA,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACtC,CACd,CAAC;IACJ,CAAC,CAAC;IAhBW,QAAA,oBAAoB,wBAgB/B","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"]}
@@ -1,99 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-icons", "@fluentui/react-label", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_icons_1, react_label_1, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useField_unstable = void 0;
5
- var validationMessageIcons = {
6
- error: React.createElement(react_icons_1.ErrorCircle12Filled, null),
7
- warning: React.createElement(react_icons_1.Warning12Filled, null),
8
- success: React.createElement(react_icons_1.CheckmarkCircle12Filled, null),
9
- none: undefined,
10
- };
11
- /**
12
- * Create the state required to render Field.
13
- *
14
- * The returned state can be modified with hooks such as useFieldStyles_unstable,
15
- * before being passed to renderField_unstable.
16
- *
17
- * @param props - Props passed to this field
18
- * @param ref - Ref to the root
19
- */
20
- var useField_unstable = function (props, ref) {
21
- var _a, _b, _c, _d;
22
- var children = props.children, _e = props.orientation, orientation = _e === void 0 ? 'vertical' : _e, required = props.required, _f = props.validationState, validationState = _f === void 0 ? props.validationMessage ? 'error' : 'none' : _f, size = props.size;
23
- var baseId = react_utilities_1.useId('field-');
24
- var root = react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign({}, props), { ref: ref }), /*excludedPropNames:*/ ['children']);
25
- var label = react_utilities_1.resolveShorthand(props.label, {
26
- defaultProps: {
27
- id: baseId + '__label',
28
- required: required,
29
- size: size,
30
- // htmlFor is handled below
31
- },
32
- });
33
- var validationMessage = react_utilities_1.resolveShorthand(props.validationMessage, {
34
- defaultProps: {
35
- id: baseId + '__validationMessage',
36
- role: validationState === 'error' ? 'alert' : undefined,
37
- },
38
- });
39
- var hint = react_utilities_1.resolveShorthand(props.hint, {
40
- defaultProps: {
41
- id: baseId + '__hint',
42
- },
43
- });
44
- var defaultIcon = validationMessageIcons[validationState];
45
- var validationMessageIcon = react_utilities_1.resolveShorthand(props.validationMessageIcon, {
46
- required: !!defaultIcon,
47
- defaultProps: {
48
- children: defaultIcon,
49
- },
50
- });
51
- var controlProps = React.isValidElement(children) ? tslib_1.__assign({}, children.props) : {};
52
- if (label) {
53
- (_a = controlProps['aria-labelledby']) !== null && _a !== void 0 ? _a : (controlProps['aria-labelledby'] = label.id);
54
- if (!label.htmlFor) {
55
- // Assign the child a generated ID if doesn't already have an ID
56
- (_b = controlProps.id) !== null && _b !== void 0 ? _b : (controlProps.id = baseId + '__control');
57
- label.htmlFor = controlProps.id;
58
- }
59
- }
60
- if (validationMessage || hint) {
61
- // The control is described by the validation message, or hint, or both
62
- // We also preserve and append any aria-describedby supplied by the user
63
- // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
64
- controlProps['aria-describedby'] = [validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id, hint === null || hint === void 0 ? void 0 : hint.id, controlProps['aria-describedby']]
65
- .filter(Boolean)
66
- .join(' ');
67
- }
68
- if (validationState === 'error') {
69
- (_c = controlProps['aria-invalid']) !== null && _c !== void 0 ? _c : (controlProps['aria-invalid'] = true);
70
- }
71
- if (required) {
72
- (_d = controlProps['aria-required']) !== null && _d !== void 0 ? _d : (controlProps['aria-required'] = true);
73
- }
74
- if (React.isValidElement(children)) {
75
- root.children = React.cloneElement(children, controlProps);
76
- }
77
- else if (typeof children === 'function') {
78
- root.children = children(controlProps);
79
- }
80
- return {
81
- orientation: orientation,
82
- validationState: validationState,
83
- components: {
84
- root: 'div',
85
- label: react_label_1.Label,
86
- validationMessage: 'div',
87
- validationMessageIcon: 'span',
88
- hint: 'div',
89
- },
90
- root: root,
91
- label: label,
92
- validationMessageIcon: validationMessageIcon,
93
- validationMessage: validationMessage,
94
- hint: hint,
95
- };
96
- };
97
- exports.useField_unstable = useField_unstable;
98
- });
99
- //# sourceMappingURL=useField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/useField.tsx"],"names":[],"mappings":";;;;IAOA,IAAM,sBAAsB,GAAG;QAC7B,KAAK,EAAE,oBAAC,iCAAmB,OAAG;QAC9B,OAAO,EAAE,oBAAC,6BAAe,OAAG;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,CAAC,QAAQ,CAAC,EAAE;YAClC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;SAC5D;aAAM,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;SACxC;QAED,OAAO;YACL,WAAW,aAAA;YACX,eAAe,iBAAA;YACf,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,mBAAK;gBACZ,iBAAiB,EAAE,KAAK;gBACxB,qBAAqB,EAAE,MAAM;gBAC7B,IAAI,EAAE,KAAK;aACZ;YACD,IAAI,MAAA;YACJ,KAAK,OAAA;YACL,qBAAqB,uBAAA;YACrB,iBAAiB,mBAAA;YACjB,IAAI,MAAA;SACL,CAAC;IACJ,CAAC,CAAC;IA9FW,QAAA,iBAAiB,qBA8F5B","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"]}