@fluentui/react-field 9.1.22 → 9.1.24
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +85 -1
- package/CHANGELOG.md +29 -2
- package/lib/components/Field/Field.js.map +1 -1
- package/lib/components/Field/renderField.js +19 -5
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/components/Field/useField.js +1 -1
- package/lib/components/Field/useField.js.map +1 -1
- package/lib/components/Field/useFieldStyles.styles.js.map +1 -1
- package/lib/contexts/useFieldContextValues.js +1 -1
- package/lib/contexts/useFieldContextValues.js.map +1 -1
- package/lib/contexts/useFieldControlProps.js +16 -13
- package/lib/contexts/useFieldControlProps.js.map +1 -1
- package/lib-commonjs/Field.js +2 -2
- package/lib-commonjs/Field.js.map +1 -1
- package/lib-commonjs/components/Field/Field.js +7 -5
- package/lib-commonjs/components/Field/Field.js.map +1 -1
- package/lib-commonjs/components/Field/Field.types.js +2 -2
- package/lib-commonjs/components/Field/Field.types.js.map +1 -1
- package/lib-commonjs/components/Field/index.js +6 -6
- package/lib-commonjs/components/Field/index.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js +25 -9
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/components/Field/useField.js +20 -18
- package/lib-commonjs/components/Field/useField.js.map +1 -1
- package/lib-commonjs/components/Field/useFieldStyles.styles.js +13 -9
- package/lib-commonjs/components/Field/useFieldStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/FieldContext.js +8 -4
- package/lib-commonjs/contexts/FieldContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +4 -4
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/useFieldContextValues.js +6 -4
- package/lib-commonjs/contexts/useFieldContextValues.js.map +1 -1
- package/lib-commonjs/contexts/useFieldControlProps.js +24 -17
- package/lib-commonjs/contexts/useFieldControlProps.js.map +1 -1
- package/lib-commonjs/index.js +28 -10
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,91 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Tue,
|
5
|
+
"date": "Tue, 05 Sep 2023 15:35:07 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v9.1.24",
|
7
|
+
"version": "9.1.24",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-field",
|
13
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.33",
|
14
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-field",
|
19
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.5",
|
20
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-field",
|
25
|
+
"comment": "Bump @fluentui/react-label to v9.1.32",
|
26
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-field",
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.2",
|
32
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"date": "Tue, 05 Sep 2023 13:29:23 GMT",
|
39
|
+
"tag": "@fluentui/react-field_v9.1.23",
|
40
|
+
"version": "9.1.23",
|
41
|
+
"comments": {
|
42
|
+
"patch": [
|
43
|
+
{
|
44
|
+
"author": "bernardo.sunderhus@gmail.com",
|
45
|
+
"package": "@fluentui/react-field",
|
46
|
+
"commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
|
47
|
+
"comment": "bumps @swc/helpers version to 0.5.1"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"author": "bernardo.sunderhus@gmail.com",
|
51
|
+
"package": "@fluentui/react-field",
|
52
|
+
"commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
|
53
|
+
"comment": "chore: migrate package to use JSX importSource"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"author": "beachball",
|
57
|
+
"package": "@fluentui/react-field",
|
58
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.32",
|
59
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-field",
|
64
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.4",
|
65
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-field",
|
70
|
+
"comment": "Bump @fluentui/react-label to v9.1.31",
|
71
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-field",
|
76
|
+
"comment": "Bump @fluentui/react-theme to v9.1.12",
|
77
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-field",
|
82
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.1",
|
83
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
84
|
+
}
|
85
|
+
]
|
86
|
+
}
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"date": "Tue, 29 Aug 2023 12:57:36 GMT",
|
6
90
|
"tag": "@fluentui/react-field_v9.1.22",
|
7
91
|
"version": "9.1.22",
|
8
92
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,39 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on Tue,
|
3
|
+
This log was last generated on Tue, 05 Sep 2023 15:35:07 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.24)
|
8
|
+
|
9
|
+
Tue, 05 Sep 2023 15:35:07 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.23..@fluentui/react-field_v9.1.24)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- Bump @fluentui/react-context-selector to v9.1.33 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.5 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
16
|
+
- Bump @fluentui/react-label to v9.1.32 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
18
|
+
|
19
|
+
## [9.1.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.23)
|
20
|
+
|
21
|
+
Tue, 05 Sep 2023 13:29:23 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.22..@fluentui/react-field_v9.1.23)
|
23
|
+
|
24
|
+
### Patches
|
25
|
+
|
26
|
+
- bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
|
27
|
+
- chore: migrate package to use JSX importSource ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
|
28
|
+
- Bump @fluentui/react-context-selector to v9.1.32 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
29
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
30
|
+
- Bump @fluentui/react-label to v9.1.31 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
31
|
+
- Bump @fluentui/react-theme to v9.1.12 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
32
|
+
- Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
33
|
+
|
7
34
|
## [9.1.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.1.22)
|
8
35
|
|
9
|
-
Tue, 29 Aug 2023 12:
|
36
|
+
Tue, 29 Aug 2023 12:57:36 GMT
|
10
37
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.1.21..@fluentui/react-field_v9.1.22)
|
11
38
|
|
12
39
|
### Patches
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Field.tsx"],"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.styles';\nimport { useFieldContextValues_unstable } from '../../contexts/index';\n\nexport const Field: ForwardRefComponent<FieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n const context = useFieldContextValues_unstable(state);\n return renderField_unstable(state, context);\n});\n\nField.displayName = 'Field';\n"],"names":["React","renderField_unstable","useField_unstable","useFieldStyles_unstable","useFieldContextValues_unstable","Field","forwardRef","props","ref","state","context","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,8BAA8B,QAAQ,uBAAuB;AAEtE,OAAO,MAAMC,sBAAyCL,MAAMM,UAAU,CAAC,CAACC,OAAOC
|
1
|
+
{"version":3,"sources":["Field.tsx"],"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.styles';\nimport { useFieldContextValues_unstable } from '../../contexts/index';\n\nexport const Field: ForwardRefComponent<FieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n const context = useFieldContextValues_unstable(state);\n return renderField_unstable(state, context);\n});\n\nField.displayName = 'Field';\n"],"names":["React","renderField_unstable","useField_unstable","useFieldStyles_unstable","useFieldContextValues_unstable","Field","forwardRef","props","ref","state","context","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,8BAA8B,QAAQ,uBAAuB;AAEtE,OAAO,MAAMC,sBAAyCL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC7E,MAAMC,QAAQP,kBAAkBK,OAAOC;IACvCL,wBAAwBM;IACxB,MAAMC,UAAUN,+BAA+BK;IAC/C,OAAOR,qBAAqBQ,OAAOC;AACrC,GAAG;AAEHL,MAAMM,WAAW,GAAG"}
|
@@ -1,15 +1,29 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
2
2
|
import { assertSlots } from '@fluentui/react-utilities';
|
3
3
|
import { FieldContextProvider, getFieldControlProps } from '../../contexts/index';
|
4
4
|
/**
|
5
5
|
* Render the final JSX of Field
|
6
6
|
*/ export const renderField_unstable = (state, contextValues)=>{
|
7
|
+
var _contextValues;
|
7
8
|
assertSlots(state);
|
8
|
-
let { children
|
9
|
+
let { children } = state;
|
9
10
|
if (typeof children === 'function') {
|
10
11
|
children = children(getFieldControlProps(contextValues.field) || {});
|
11
12
|
}
|
12
|
-
return /*#__PURE__*/
|
13
|
-
value: contextValues === null ||
|
14
|
-
|
13
|
+
return /*#__PURE__*/ _jsx(FieldContextProvider, {
|
14
|
+
value: (_contextValues = contextValues) === null || _contextValues === void 0 ? void 0 : _contextValues.field,
|
15
|
+
children: /*#__PURE__*/ _jsxs(state.root, {
|
16
|
+
children: [
|
17
|
+
state.label && /*#__PURE__*/ _jsx(state.label, {}),
|
18
|
+
children,
|
19
|
+
state.validationMessage && /*#__PURE__*/ _jsxs(state.validationMessage, {
|
20
|
+
children: [
|
21
|
+
state.validationMessageIcon && /*#__PURE__*/ _jsx(state.validationMessageIcon, {}),
|
22
|
+
state.validationMessage.children
|
23
|
+
]
|
24
|
+
}),
|
25
|
+
state.hint && /*#__PURE__*/ _jsx(state.hint, {})
|
26
|
+
]
|
27
|
+
})
|
28
|
+
});
|
15
29
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderField.tsx"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderField.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\nimport type { FieldContextValues, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = (state: FieldState, contextValues: FieldContextValues) => {\n assertSlots<FieldSlots>(state);\n\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n\n return (\n <FieldContextProvider value={contextValues?.field}>\n <state.root>\n {state.label && <state.label />}\n {children}\n {state.validationMessage && (\n <state.validationMessage>\n {state.validationMessageIcon && <state.validationMessageIcon />}\n {state.validationMessage.children}\n </state.validationMessage>\n )}\n\n {state.hint && <state.hint />}\n </state.root>\n </FieldContextProvider>\n );\n};\n"],"names":["assertSlots","FieldContextProvider","getFieldControlProps","renderField_unstable","state","contextValues","children","field","value","root","label","validationMessage","validationMessageIcon","hint"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,uBAAuB;AAGlF;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC;QASvBA;IAR/BL,YAAwBI;IAExB,IAAI,EAAEE,QAAQ,EAAE,GAAGF;IACnB,IAAI,OAAOE,aAAa,YAAY;QAClCA,WAAWA,SAASJ,qBAAqBG,cAAcE,KAAK,KAAK,CAAC;IACpE;IAEA,qBACE,KAACN;QAAqBO,KAAK,GAAEH,iBAAAA,2BAAAA,qCAAAA,eAAeE,KAAK;kBAC/C,cAAA,MAACH,MAAMK,IAAI;;gBACRL,MAAMM,KAAK,kBAAI,KAACN,MAAMM,KAAK;gBAC3BJ;gBACAF,MAAMO,iBAAiB,kBACtB,MAACP,MAAMO,iBAAiB;;wBACrBP,MAAMQ,qBAAqB,kBAAI,KAACR,MAAMQ,qBAAqB;wBAC3DR,MAAMO,iBAAiB,CAACL,QAAQ;;;gBAIpCF,MAAMS,IAAI,kBAAI,KAACT,MAAMS,IAAI;;;;AAIlC,EAAE"}
|
@@ -17,7 +17,7 @@ const validationMessageIcons = {
|
|
17
17
|
* @param props - Props passed to this field
|
18
18
|
* @param ref - Ref to the root
|
19
19
|
*/ export const useField_unstable = (props, ref)=>{
|
20
|
-
const { children
|
20
|
+
const { children, orientation = 'vertical', required = false, validationState = props.validationMessage ? 'error' : 'none', size = 'medium' } = props;
|
21
21
|
const baseId = useId('field-');
|
22
22
|
const generatedControlId = baseId + '__control';
|
23
23
|
const root = slot.always(getNativeElementProps('div', {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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, useId, slot } from '@fluentui/react-utilities';\nimport type { 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 = false,\n validationState = props.validationMessage ? 'error' : 'none',\n size = 'medium',\n } = props;\n\n const baseId = useId('field-');\n const generatedControlId = baseId + '__control';\n\n const root = slot.always(getNativeElementProps('div', { ...props, ref }, /*excludedPropNames:*/ ['children']), {\n elementType: 'div',\n });\n const label = slot.optional(props.label, {\n defaultProps: { htmlFor: generatedControlId, id: baseId + '__label', required, size },\n elementType: Label,\n });\n const validationMessage = slot.optional(props.validationMessage, {\n defaultProps: { id: baseId + '__validationMessage', role: validationState === 'error' ? 'alert' : undefined },\n elementType: 'div',\n });\n const hint = slot.optional(props.hint, { defaultProps: { id: baseId + '__hint' }, elementType: 'div' });\n const defaultIcon = validationMessageIcons[validationState];\n const validationMessageIcon = slot.optional(props.validationMessageIcon, {\n renderByDefault: !!defaultIcon,\n defaultProps: { children: defaultIcon },\n elementType: 'span',\n });\n return {\n children,\n generatedControlId,\n orientation,\n required,\n size,\n validationState,\n components: { root: 'div', label: Label, validationMessage: 'div', validationMessageIcon: 'span', hint: 'div' },\n root,\n label,\n validationMessageIcon,\n validationMessage,\n hint,\n };\n};\n"],"names":["React","CheckmarkCircle12Filled","ErrorCircle12Filled","Warning12Filled","Label","getNativeElementProps","useId","slot","validationMessageIcons","error","warning","success","none","undefined","useField_unstable","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","generatedControlId","root","always","elementType","label","optional","defaultProps","htmlFor","id","role","hint","defaultIcon","validationMessageIcon","renderByDefault","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,eAAe,QAAQ,wBAAwB;AACtG,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAG/E,MAAMC,yBAAyB;IAC7BC,qBAAO,oBAACP;IACRQ,uBAAS,oBAACP;IACVQ,uBAAS,oBAACV;IACVW,MAAMC;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC
|
1
|
+
{"version":3,"sources":["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, useId, slot } from '@fluentui/react-utilities';\nimport type { 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 = false,\n validationState = props.validationMessage ? 'error' : 'none',\n size = 'medium',\n } = props;\n\n const baseId = useId('field-');\n const generatedControlId = baseId + '__control';\n\n const root = slot.always(getNativeElementProps('div', { ...props, ref }, /*excludedPropNames:*/ ['children']), {\n elementType: 'div',\n });\n const label = slot.optional(props.label, {\n defaultProps: { htmlFor: generatedControlId, id: baseId + '__label', required, size },\n elementType: Label,\n });\n const validationMessage = slot.optional(props.validationMessage, {\n defaultProps: { id: baseId + '__validationMessage', role: validationState === 'error' ? 'alert' : undefined },\n elementType: 'div',\n });\n const hint = slot.optional(props.hint, { defaultProps: { id: baseId + '__hint' }, elementType: 'div' });\n const defaultIcon = validationMessageIcons[validationState];\n const validationMessageIcon = slot.optional(props.validationMessageIcon, {\n renderByDefault: !!defaultIcon,\n defaultProps: { children: defaultIcon },\n elementType: 'span',\n });\n return {\n children,\n generatedControlId,\n orientation,\n required,\n size,\n validationState,\n components: { root: 'div', label: Label, validationMessage: 'div', validationMessageIcon: 'span', hint: 'div' },\n root,\n label,\n validationMessageIcon,\n validationMessage,\n hint,\n };\n};\n"],"names":["React","CheckmarkCircle12Filled","ErrorCircle12Filled","Warning12Filled","Label","getNativeElementProps","useId","slot","validationMessageIcons","error","warning","success","none","undefined","useField_unstable","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","generatedControlId","root","always","elementType","label","optional","defaultProps","htmlFor","id","role","hint","defaultIcon","validationMessageIcon","renderByDefault","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,eAAe,QAAQ,wBAAwB;AACtG,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAG/E,MAAMC,yBAAyB;IAC7BC,qBAAO,oBAACP;IACRQ,uBAAS,oBAACP;IACVQ,uBAAS,oBAACV;IACVW,MAAMC;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EACJC,QAAQ,EACRC,cAAc,UAAU,EACxBC,WAAW,KAAK,EAChBC,kBAAkBL,MAAMM,iBAAiB,GAAG,UAAU,MAAM,EAC5DC,OAAO,QAAQ,EAChB,GAAGP;IAEJ,MAAMQ,SAASjB,MAAM;IACrB,MAAMkB,qBAAqBD,SAAS;IAEpC,MAAME,OAAOlB,KAAKmB,MAAM,CAACrB,sBAAsB,OAAO;QAAE,GAAGU,KAAK;QAAEC;IAAI,GAAG,oBAAoB,GAAG;QAAC;KAAW,GAAG;QAC7GW,aAAa;IACf;IACA,MAAMC,QAAQrB,KAAKsB,QAAQ,CAACd,MAAMa,KAAK,EAAE;QACvCE,cAAc;YAAEC,SAASP;YAAoBQ,IAAIT,SAAS;YAAWJ;YAAUG;QAAK;QACpFK,aAAavB;IACf;IACA,MAAMiB,oBAAoBd,KAAKsB,QAAQ,CAACd,MAAMM,iBAAiB,EAAE;QAC/DS,cAAc;YAAEE,IAAIT,SAAS;YAAuBU,MAAMb,oBAAoB,UAAU,UAAUP;QAAU;QAC5Gc,aAAa;IACf;IACA,MAAMO,OAAO3B,KAAKsB,QAAQ,CAACd,MAAMmB,IAAI,EAAE;QAAEJ,cAAc;YAAEE,IAAIT,SAAS;QAAS;QAAGI,aAAa;IAAM;IACrG,MAAMQ,cAAc3B,sBAAsB,CAACY,gBAAgB;IAC3D,MAAMgB,wBAAwB7B,KAAKsB,QAAQ,CAACd,MAAMqB,qBAAqB,EAAE;QACvEC,iBAAiB,CAAC,CAACF;QACnBL,cAAc;YAAEb,UAAUkB;QAAY;QACtCR,aAAa;IACf;IACA,OAAO;QACLV;QACAO;QACAN;QACAC;QACAG;QACAF;QACAkB,YAAY;YAAEb,MAAM;YAAOG,OAAOxB;YAAOiB,mBAAmB;YAAOe,uBAAuB;YAAQF,MAAM;QAAM;QAC9GT;QACAG;QACAQ;QACAf;QACAa;IACF;AACF,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["tokens","typographyStyles","__resetStyles","__styles","mergeClasses","fieldClassNames","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","base","mc9l5x","horizontal","Budl1dq","wkccdc","horizontalNoLabel","uwmqm3","d","useLabelStyles","z8tnut","Byoj8tv","large","vertical","jrapky","verticalLarge","t21cq0","Ijaq50","nk6f5a","useSecondaryTextBaseClassName","useSecondaryTextStyles","error","sj55zd","withIcon","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","warning","success","useFieldStyles_unstable","state","validationState","orientation","rootStyles","className","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"sources":["useFieldStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, 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 */ const useRootStyles = makeStyles({\n base: {\n display: 'grid'\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 // 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});\nconst useLabelStyles = makeStyles({\n base: {\n paddingTop: tokens.spacingVerticalXXS,\n paddingBottom: tokens.spacingVerticalXXS\n },\n large: {\n paddingTop: '1px',\n paddingBottom: '1px'\n },\n vertical: {\n marginBottom: tokens.spacingVerticalXXS\n },\n verticalLarge: {\n marginBottom: tokens.spacingVerticalXS\n },\n horizontal: {\n marginRight: tokens.spacingHorizontalM,\n gridRowStart: '1',\n gridRowEnd: '-1'\n }\n});\nconst useSecondaryTextBaseClassName = makeResetStyles({\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1\n});\nconst useSecondaryTextStyles = makeStyles({\n error: {\n color: tokens.colorPaletteRedForeground1\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});\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});\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 * Apply styling to the Field slots based on the state\n */ export const useFieldStyles_unstable = (state)=>{\n const { validationState
|
1
|
+
{"version":3,"names":["tokens","typographyStyles","__resetStyles","__styles","mergeClasses","fieldClassNames","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","base","mc9l5x","horizontal","Budl1dq","wkccdc","horizontalNoLabel","uwmqm3","d","useLabelStyles","z8tnut","Byoj8tv","large","vertical","jrapky","verticalLarge","t21cq0","Ijaq50","nk6f5a","useSecondaryTextBaseClassName","useSecondaryTextStyles","error","sj55zd","withIcon","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","warning","success","useFieldStyles_unstable","state","validationState","orientation","rootStyles","className","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"sources":["useFieldStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, 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 */ const useRootStyles = makeStyles({\n base: {\n display: 'grid'\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 // 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});\nconst useLabelStyles = makeStyles({\n base: {\n paddingTop: tokens.spacingVerticalXXS,\n paddingBottom: tokens.spacingVerticalXXS\n },\n large: {\n paddingTop: '1px',\n paddingBottom: '1px'\n },\n vertical: {\n marginBottom: tokens.spacingVerticalXXS\n },\n verticalLarge: {\n marginBottom: tokens.spacingVerticalXS\n },\n horizontal: {\n marginRight: tokens.spacingHorizontalM,\n gridRowStart: '1',\n gridRowEnd: '-1'\n }\n});\nconst useSecondaryTextBaseClassName = makeResetStyles({\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1\n});\nconst useSecondaryTextStyles = makeStyles({\n error: {\n color: tokens.colorPaletteRedForeground1\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});\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});\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 * Apply styling to the Field slots based on the state\n */ export const useFieldStyles_unstable = (state)=>{\n const { validationState } = 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"],"mappings":"AAAA,SAASA,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAAAC,aAAA,EAAAC,QAAA,EAAsCC,YAAY,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AChC,qBAAqB,CAACoC,SAAS,CAAC;EACtP;EACA,MAAMK,0BAA0B,GAAGnB,6BAA6B,CAAC,CAAC;EAClE,MAAMoB,mBAAmB,GAAGnB,sBAAsB,CAAC,CAAC;EACpD,IAAIS,KAAK,CAACjC,iBAAiB,EAAE;IACzBiC,KAAK,CAACjC,iBAAiB,CAACqC,SAAS,GAAGzC,YAAY,CAACC,eAAe,CAACG,iBAAiB,EAAE0C,0BAA0B,EAAER,eAAe,KAAK,OAAO,IAAIS,mBAAmB,CAAClB,KAAK,EAAE,CAAC,CAACQ,KAAK,CAAChC,qBAAqB,IAAI0C,mBAAmB,CAAChB,QAAQ,EAAEM,KAAK,CAACjC,iBAAiB,CAACqC,SAAS,CAAC;EAC/Q;EACA,IAAIJ,KAAK,CAAC/B,IAAI,EAAE;IACZ+B,KAAK,CAAC/B,IAAI,CAACmC,SAAS,GAAGzC,YAAY,CAACC,eAAe,CAACK,IAAI,EAAEwC,0BAA0B,EAAET,KAAK,CAAC/B,IAAI,CAACmC,SAAS,CAAC;EAC/G;AACJ,CAAC"}
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
3
3
|
* Get the context values used when rendering Field.
|
4
4
|
*/ export const useFieldContextValues_unstable = (state)=>{
|
5
5
|
var _state_label, _state_label1, _state_validationMessage, _state_hint;
|
6
|
-
const { generatedControlId
|
6
|
+
const { generatedControlId, orientation, required, size, validationState } = state;
|
7
7
|
const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;
|
8
8
|
const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;
|
9
9
|
const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldContextValues.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { FieldContextValue, FieldContextValues, FieldState } from '../Field';\n\n/**\n * Get the context values used when rendering Field.\n */\nexport const useFieldContextValues_unstable = (state: FieldState): FieldContextValues => {\n const { generatedControlId, orientation, required, size, validationState } = state;\n const labelFor = state.label?.htmlFor;\n const labelId = state.label?.id;\n const validationMessageId = state.validationMessage?.id;\n const hintId = state.hint?.id;\n\n const field: FieldContextValue = React.useMemo(\n () => ({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState,\n }),\n [generatedControlId, hintId, labelFor, labelId, orientation, required, size, validationMessageId, validationState],\n );\n\n return { field };\n};\n"],"names":["React","useFieldContextValues_unstable","state","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC
|
1
|
+
{"version":3,"sources":["useFieldContextValues.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { FieldContextValue, FieldContextValues, FieldState } from '../Field';\n\n/**\n * Get the context values used when rendering Field.\n */\nexport const useFieldContextValues_unstable = (state: FieldState): FieldContextValues => {\n const { generatedControlId, orientation, required, size, validationState } = state;\n const labelFor = state.label?.htmlFor;\n const labelId = state.label?.id;\n const validationMessageId = state.validationMessage?.id;\n const hintId = state.hint?.id;\n\n const field: FieldContextValue = React.useMemo(\n () => ({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState,\n }),\n [generatedControlId, hintId, labelFor, labelId, orientation, required, size, validationMessageId, validationState],\n );\n\n return { field };\n};\n"],"names":["React","useFieldContextValues_unstable","state","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC;QAE5BA,cACDA,eACYA,0BACbA;IAJf,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,eAAe,EAAE,GAAGL;IAC7E,MAAMM,YAAWN,eAAAA,MAAMO,KAAK,cAAXP,mCAAAA,aAAaQ,OAAO;IACrC,MAAMC,WAAUT,gBAAAA,MAAMO,KAAK,cAAXP,oCAAAA,cAAaU,EAAE;IAC/B,MAAMC,uBAAsBX,2BAAAA,MAAMY,iBAAiB,cAAvBZ,+CAAAA,yBAAyBU,EAAE;IACvD,MAAMG,UAASb,cAAAA,MAAMc,IAAI,cAAVd,kCAAAA,YAAYU,EAAE;IAE7B,MAAMK,QAA2BjB,MAAMkB,OAAO,CAC5C,IAAO,CAAA;YACLf;YACAY;YACAP;YACAG;YACAP;YACAC;YACAC;YACAO;YACAN;QACF,CAAA,GACA;QAACJ;QAAoBY;QAAQP;QAAUG;QAASP;QAAaC;QAAUC;QAAMO;QAAqBN;KAAgB;IAGpH,OAAO;QAAEU;IAAM;AACjB,EAAE"}
|
@@ -7,6 +7,7 @@ export function useFieldControlProps_unstable(props, options) {
|
|
7
7
|
* Implementation of useFieldControlProps_unstable.
|
8
8
|
* Split out so it can be used directly in renderField_unstable.
|
9
9
|
*/ export function getFieldControlProps(context, props, options) {
|
10
|
+
var _options, _options1;
|
10
11
|
if (!context) {
|
11
12
|
return props;
|
12
13
|
}
|
@@ -14,7 +15,7 @@ export function useFieldControlProps_unstable(props, options) {
|
|
14
15
|
props = {
|
15
16
|
...props
|
16
17
|
};
|
17
|
-
const { generatedControlId
|
18
|
+
const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;
|
18
19
|
if (generatedControlId) {
|
19
20
|
var _props;
|
20
21
|
var _id;
|
@@ -22,7 +23,7 @@ export function useFieldControlProps_unstable(props, options) {
|
|
22
23
|
}
|
23
24
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
24
25
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
25
|
-
if (labelId && (!(options === null ||
|
26
|
+
if (labelId && (!((_options = options) === null || _options === void 0 ? void 0 : _options.supportsLabelFor) || labelFor !== props.id)) {
|
26
27
|
var _props1, _arialabelledby;
|
27
28
|
var _;
|
28
29
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
@@ -31,34 +32,36 @@ export function useFieldControlProps_unstable(props, options) {
|
|
31
32
|
// We also preserve and append any aria-describedby from props.
|
32
33
|
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
33
34
|
if (validationMessageId || hintId) {
|
35
|
+
var _props2;
|
34
36
|
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
35
37
|
props['aria-describedby'] = [
|
36
38
|
validationMessageId,
|
37
39
|
hintId,
|
38
|
-
props === null ||
|
40
|
+
(_props2 = props) === null || _props2 === void 0 ? void 0 : _props2['aria-describedby']
|
39
41
|
].filter(Boolean).join(' ');
|
40
42
|
}
|
41
43
|
if (validationState === 'error') {
|
42
|
-
var
|
44
|
+
var _props3, _ariainvalid;
|
43
45
|
var _1;
|
44
|
-
(_1 = (
|
46
|
+
(_1 = (_props3 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props3[_ariainvalid] = true;
|
45
47
|
}
|
46
48
|
if (required) {
|
47
|
-
|
48
|
-
|
49
|
+
var _options2;
|
50
|
+
if ((_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.supportsRequired) {
|
51
|
+
var _props4;
|
49
52
|
var _required;
|
50
|
-
(_required = (
|
53
|
+
(_required = (_props4 = props).required) !== null && _required !== void 0 ? _required : _props4.required = true;
|
51
54
|
} else {
|
52
|
-
var
|
55
|
+
var _props5, _ariarequired;
|
53
56
|
var _2;
|
54
|
-
(_2 = (
|
57
|
+
(_2 = (_props5 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props5[_ariarequired] = true;
|
55
58
|
}
|
56
59
|
}
|
57
60
|
// Include the size prop if this control supports it
|
58
|
-
if (options === null ||
|
59
|
-
var
|
61
|
+
if ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.supportsSize) {
|
62
|
+
var _props6;
|
60
63
|
var _size;
|
61
|
-
(_size = (
|
64
|
+
(_size = (_props6 = props).size) !== null && _size !== void 0 ? _size : _props6.size = context.size;
|
62
65
|
}
|
63
66
|
return props;
|
64
67
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldControlProps.ts"],"sourcesContent":["import type { FieldContextValue, FieldControlProps } from '../Field';\nimport { useFieldContext_unstable } from './FieldContext';\n\n/**\n * Options for `useFieldControlProps_unstable`.\n */\nexport type FieldControlPropsOptions = {\n /**\n * Skips setting `aria-labelledby` on the control if the `label.htmlFor` refers to the control.\n *\n * This should be used with controls that can be the target of a label's `for` prop:\n * `<button>`, `<input>`, `<progress>`, `<select>`, `<textarea>`.\n */\n supportsLabelFor?: boolean;\n\n /**\n * Sets `required` instead of `aria-required` when the Field is marked required.\n *\n * This should be used with controls that support the `required` prop:\n * `<input>` (except `range` or `color`), `<select>`, `<textarea>`.\n */\n supportsRequired?: boolean;\n\n /**\n * Sets the size prop on the control to match the Field's size: `'small' | 'medium' | 'large'`.\n *\n * This should be used with controls that have a custom size prop that matches the Field's size prop.\n */\n supportsSize?: boolean;\n};\n\n/**\n * Gets the control props from the field context, if this inside a `<Field>`.\n *\n * When called with no arguments, returns the FieldControlProps that should be applied to the control.\n *\n * @returns A FieldControlProps object if inside a `<Field>`, otherwise undefined.\n */\nexport function useFieldControlProps_unstable(): FieldControlProps | undefined;\n\n/**\n * Copies and merges the FieldControlProps with the given props, if this inside a `<Field>`.\n *\n * @param props - The existing props for the control. These will be merged with the control props from the field context.\n * @param options - Option to include the size prop.\n * @returns Merged props if inside a `<Field>`, otherwise the original props, or undefined if no props given.\n */\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props: Props,\n options?: FieldControlPropsOptions,\n): Props;\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */\nexport function getFieldControlProps<Props extends FieldControlProps>(\n context: FieldContextValue | undefined,\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n if (!context) {\n return props;\n }\n\n // Create a copy of props so we don't modify the original\n props = { ...props } as Props;\n\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n\n if (generatedControlId) {\n props.id ??= generatedControlId;\n }\n\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!options?.supportsLabelFor || labelFor !== props.id)) {\n props['aria-labelledby'] ??= labelId;\n }\n\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [validationMessageId, hintId, props?.['aria-describedby']].filter(Boolean).join(' ');\n }\n\n if (validationState === 'error') {\n props['aria-invalid'] ??= true;\n }\n\n if (required) {\n if (options?.supportsRequired) {\n (props as { required?: boolean }).required ??= true;\n } else {\n props['aria-required'] ??= true;\n }\n }\n\n // Include the size prop if this control supports it\n if (options?.supportsSize) {\n (props as { size?: FieldContextValue['size'] }).size ??= context.size;\n }\n\n return props;\n}\n"],"names":["useFieldContext_unstable","useFieldControlProps_unstable","props","options","getFieldControlProps","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","id","supportsLabelFor","filter","Boolean","join","supportsRequired","supportsSize","size"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,iBAAiB;AAkD1D,OAAO,SAASC,8BACdC,KAAa,EACbC,OAAkC
|
1
|
+
{"version":3,"sources":["useFieldControlProps.ts"],"sourcesContent":["import type { FieldContextValue, FieldControlProps } from '../Field';\nimport { useFieldContext_unstable } from './FieldContext';\n\n/**\n * Options for `useFieldControlProps_unstable`.\n */\nexport type FieldControlPropsOptions = {\n /**\n * Skips setting `aria-labelledby` on the control if the `label.htmlFor` refers to the control.\n *\n * This should be used with controls that can be the target of a label's `for` prop:\n * `<button>`, `<input>`, `<progress>`, `<select>`, `<textarea>`.\n */\n supportsLabelFor?: boolean;\n\n /**\n * Sets `required` instead of `aria-required` when the Field is marked required.\n *\n * This should be used with controls that support the `required` prop:\n * `<input>` (except `range` or `color`), `<select>`, `<textarea>`.\n */\n supportsRequired?: boolean;\n\n /**\n * Sets the size prop on the control to match the Field's size: `'small' | 'medium' | 'large'`.\n *\n * This should be used with controls that have a custom size prop that matches the Field's size prop.\n */\n supportsSize?: boolean;\n};\n\n/**\n * Gets the control props from the field context, if this inside a `<Field>`.\n *\n * When called with no arguments, returns the FieldControlProps that should be applied to the control.\n *\n * @returns A FieldControlProps object if inside a `<Field>`, otherwise undefined.\n */\nexport function useFieldControlProps_unstable(): FieldControlProps | undefined;\n\n/**\n * Copies and merges the FieldControlProps with the given props, if this inside a `<Field>`.\n *\n * @param props - The existing props for the control. These will be merged with the control props from the field context.\n * @param options - Option to include the size prop.\n * @returns Merged props if inside a `<Field>`, otherwise the original props, or undefined if no props given.\n */\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props: Props,\n options?: FieldControlPropsOptions,\n): Props;\nexport function useFieldControlProps_unstable<Props extends FieldControlProps>(\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */\nexport function getFieldControlProps<Props extends FieldControlProps>(\n context: FieldContextValue | undefined,\n props?: Props,\n options?: FieldControlPropsOptions,\n): Props | undefined {\n if (!context) {\n return props;\n }\n\n // Create a copy of props so we don't modify the original\n props = { ...props } as Props;\n\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n\n if (generatedControlId) {\n props.id ??= generatedControlId;\n }\n\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!options?.supportsLabelFor || labelFor !== props.id)) {\n props['aria-labelledby'] ??= labelId;\n }\n\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [validationMessageId, hintId, props?.['aria-describedby']].filter(Boolean).join(' ');\n }\n\n if (validationState === 'error') {\n props['aria-invalid'] ??= true;\n }\n\n if (required) {\n if (options?.supportsRequired) {\n (props as { required?: boolean }).required ??= true;\n } else {\n props['aria-required'] ??= true;\n }\n }\n\n // Include the size prop if this control supports it\n if (options?.supportsSize) {\n (props as { size?: FieldContextValue['size'] }).size ??= context.size;\n }\n\n return props;\n}\n"],"names":["useFieldContext_unstable","useFieldControlProps_unstable","props","options","getFieldControlProps","context","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","id","supportsLabelFor","filter","Boolean","join","supportsRequired","supportsSize","size"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,iBAAiB;AAkD1D,OAAO,SAASC,8BACdC,KAAa,EACbC,OAAkC;IAElC,OAAOC,qBAAqBJ,4BAA4BE,OAAOC;AACjE;AAEA;;;;CAIC,GACD,OAAO,SAASC,qBACdC,OAAsC,EACtCH,KAAa,EACbC,OAAkC;QAiBjBA,UAyBbA;IAxCJ,IAAI,CAACE,SAAS;QACZ,OAAOH;IACT;IAEA,yDAAyD;IACzDA,QAAQ;QAAE,GAAGA,KAAK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AA/ClB,QAA+CkB,OAASf,QAAQe,IAAI;IACvE;IAEA,OAAOlB;AACT"}
|
package/lib-commonjs/Field.js
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./components/Field/index"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Field.js"],"sourcesContent":["export * from './components/Field/index';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Field.js"],"sourcesContent":["export * from './components/Field/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "Field", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return Field;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _renderField = require("./renderField");
|
12
14
|
const _useField = require("./useField");
|
13
|
-
const
|
15
|
+
const _useFieldStylesstyles = require("./useFieldStyles.styles");
|
14
16
|
const _index = require("../../contexts/index");
|
15
17
|
const Field = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
16
18
|
const state = (0, _useField.useField_unstable)(props, ref);
|
17
|
-
(0,
|
19
|
+
(0, _useFieldStylesstyles.useFieldStyles_unstable)(state);
|
18
20
|
const context = (0, _index.useFieldContextValues_unstable)(state);
|
19
21
|
return (0, _renderField.renderField_unstable)(state, context);
|
20
22
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Field.js"],"sourcesContent":["import * as React from 'react';\nimport { renderField_unstable } from './renderField';\nimport { useField_unstable } from './useField';\nimport { useFieldStyles_unstable } from './useFieldStyles.styles';\nimport { useFieldContextValues_unstable } from '../../contexts/index';\nexport const Field = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n const context = useFieldContextValues_unstable(state);\n return renderField_unstable(state, context);\n});\nField.displayName = 'Field';\n"],"names":["Field","React","forwardRef","props","ref","state","useField_unstable","useFieldStyles_unstable","context","useFieldContextValues_unstable","renderField_unstable","displayName"],"mappings":";;;;+BAKaA
|
1
|
+
{"version":3,"sources":["Field.js"],"sourcesContent":["import * as React from 'react';\nimport { renderField_unstable } from './renderField';\nimport { useField_unstable } from './useField';\nimport { useFieldStyles_unstable } from './useFieldStyles.styles';\nimport { useFieldContextValues_unstable } from '../../contexts/index';\nexport const Field = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useField_unstable(props, ref);\n useFieldStyles_unstable(state);\n const context = useFieldContextValues_unstable(state);\n return renderField_unstable(state, context);\n});\nField.displayName = 'Field';\n"],"names":["Field","React","forwardRef","props","ref","state","useField_unstable","useFieldStyles_unstable","context","useFieldContextValues_unstable","renderField_unstable","displayName"],"mappings":";;;;+BAKaA;;;eAAAA;;;;iEALU;6BACc;0BACH;sCACM;uBACO;AACxC,MAAMA,QAAQ,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACxD,MAAMC,QAAQC,IAAAA,2BAAiB,EAACH,OAAOC;IACvCG,IAAAA,6CAAuB,EAACF;IACxB,MAAMG,UAAUC,IAAAA,qCAA8B,EAACJ;IAC/C,OAAOK,IAAAA,iCAAoB,EAACL,OAAOG;AACvC;AACAR,MAAMW,WAAW,GAAG"}
|
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
const _react = /*#__PURE__*/
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Field.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Field.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./Field.types"), exports);
|
7
|
+
_export_star._(require("./Field"), exports);
|
8
|
+
_export_star._(require("./renderField"), exports);
|
9
|
+
_export_star._(require("./useField"), exports);
|
10
|
+
_export_star._(require("./useFieldStyles.styles"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Field.types';\nexport * from './Field';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles.styles';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Field.types';\nexport * from './Field';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles.styles';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
@@ -1,21 +1,37 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ "use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "renderField_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return renderField_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
12
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
11
13
|
const _index = require("../../contexts/index");
|
12
14
|
const renderField_unstable = (state, contextValues)=>{
|
13
|
-
|
14
|
-
|
15
|
+
var _contextValues;
|
16
|
+
(0, _reactutilities.assertSlots)(state);
|
17
|
+
let { children } = state;
|
15
18
|
if (typeof children === 'function') {
|
16
19
|
children = children((0, _index.getFieldControlProps)(contextValues.field) || {});
|
17
20
|
}
|
18
|
-
return /*#__PURE__*/ (0,
|
19
|
-
value: contextValues === null ||
|
20
|
-
|
21
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.FieldContextProvider, {
|
22
|
+
value: (_contextValues = contextValues) === null || _contextValues === void 0 ? void 0 : _contextValues.field,
|
23
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
24
|
+
children: [
|
25
|
+
state.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.label, {}),
|
26
|
+
children,
|
27
|
+
state.validationMessage && /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.validationMessage, {
|
28
|
+
children: [
|
29
|
+
state.validationMessageIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.validationMessageIcon, {}),
|
30
|
+
state.validationMessage.children
|
31
|
+
]
|
32
|
+
}),
|
33
|
+
state.hint && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.hint, {})
|
34
|
+
]
|
35
|
+
})
|
36
|
+
});
|
21
37
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderField.js"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderField.js"],"sourcesContent":["/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { FieldContextProvider, getFieldControlProps } from '../../contexts/index';\n/**\n * Render the final JSX of Field\n */ export const renderField_unstable = (state, contextValues)=>{\n var _contextValues;\n assertSlots(state);\n let { children } = state;\n if (typeof children === 'function') {\n children = children(getFieldControlProps(contextValues.field) || {});\n }\n return /*#__PURE__*/ _jsx(FieldContextProvider, {\n value: (_contextValues = contextValues) === null || _contextValues === void 0 ? void 0 : _contextValues.field,\n children: /*#__PURE__*/ _jsxs(state.root, {\n children: [\n state.label && /*#__PURE__*/ _jsx(state.label, {}),\n children,\n state.validationMessage && /*#__PURE__*/ _jsxs(state.validationMessage, {\n children: [\n state.validationMessageIcon && /*#__PURE__*/ _jsx(state.validationMessageIcon, {}),\n state.validationMessage.children\n ]\n }),\n state.hint && /*#__PURE__*/ _jsx(state.hint, {})\n ]\n })\n });\n};\n"],"names":["renderField_unstable","state","contextValues","_contextValues","assertSlots","children","getFieldControlProps","field","_jsx","FieldContextProvider","value","_jsxs","root","label","validationMessage","validationMessageIcon","hint"],"mappings":"AAAA,0BAA0B,GAAG,iDAAiD;;;;+BAK7DA;;;eAAAA;;;4BAL2G;gCAChG;uBAC+B;AAGhD,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,IAAIC;IACJC,IAAAA,2BAAW,EAACH;IACZ,IAAI,EAAEI,QAAQ,EAAE,GAAGJ;IACnB,IAAI,OAAOI,aAAa,YAAY;QAChCA,WAAWA,SAASC,IAAAA,2BAAoB,EAACJ,cAAcK,KAAK,KAAK,CAAC;IACtE;IACA,OAAO,WAAW,GAAGC,IAAAA,eAAI,EAACC,2BAAoB,EAAE;QAC5CC,OAAO,AAACP,CAAAA,iBAAiBD,aAAY,MAAO,QAAQC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeI,KAAK;QAC7GF,UAAU,WAAW,GAAGM,IAAAA,gBAAK,EAACV,MAAMW,IAAI,EAAE;YACtCP,UAAU;gBACNJ,MAAMY,KAAK,IAAI,WAAW,GAAGL,IAAAA,eAAI,EAACP,MAAMY,KAAK,EAAE,CAAC;gBAChDR;gBACAJ,MAAMa,iBAAiB,IAAI,WAAW,GAAGH,IAAAA,gBAAK,EAACV,MAAMa,iBAAiB,EAAE;oBACpET,UAAU;wBACNJ,MAAMc,qBAAqB,IAAI,WAAW,GAAGP,IAAAA,eAAI,EAACP,MAAMc,qBAAqB,EAAE,CAAC;wBAChFd,MAAMa,iBAAiB,CAACT,QAAQ;qBACnC;gBACL;gBACAJ,MAAMe,IAAI,IAAI,WAAW,GAAGR,IAAAA,eAAI,EAACP,MAAMe,IAAI,EAAE,CAAC;aACjD;QACL;IACJ;AACJ"}
|
@@ -4,24 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useField_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useField_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
+
const _reacticons = require("@fluentui/react-icons");
|
14
|
+
const _reactlabel = require("@fluentui/react-label");
|
15
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
14
16
|
const validationMessageIcons = {
|
15
|
-
error: /*#__PURE__*/ _react.createElement(
|
16
|
-
warning: /*#__PURE__*/ _react.createElement(
|
17
|
-
success: /*#__PURE__*/ _react.createElement(
|
17
|
+
error: /*#__PURE__*/ _react.createElement(_reacticons.ErrorCircle12Filled, null),
|
18
|
+
warning: /*#__PURE__*/ _react.createElement(_reacticons.Warning12Filled, null),
|
19
|
+
success: /*#__PURE__*/ _react.createElement(_reacticons.CheckmarkCircle12Filled, null),
|
18
20
|
none: undefined
|
19
21
|
};
|
20
22
|
const useField_unstable = (props, ref)=>{
|
21
|
-
const { children
|
22
|
-
const baseId = (0,
|
23
|
+
const { children, orientation = 'vertical', required = false, validationState = props.validationMessage ? 'error' : 'none', size = 'medium' } = props;
|
24
|
+
const baseId = (0, _reactutilities.useId)('field-');
|
23
25
|
const generatedControlId = baseId + '__control';
|
24
|
-
const root =
|
26
|
+
const root = _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('div', {
|
25
27
|
...props,
|
26
28
|
ref
|
27
29
|
}, /*excludedPropNames:*/ [
|
@@ -29,30 +31,30 @@ const useField_unstable = (props, ref)=>{
|
|
29
31
|
]), {
|
30
32
|
elementType: 'div'
|
31
33
|
});
|
32
|
-
const label =
|
34
|
+
const label = _reactutilities.slot.optional(props.label, {
|
33
35
|
defaultProps: {
|
34
36
|
htmlFor: generatedControlId,
|
35
37
|
id: baseId + '__label',
|
36
38
|
required,
|
37
39
|
size
|
38
40
|
},
|
39
|
-
elementType:
|
41
|
+
elementType: _reactlabel.Label
|
40
42
|
});
|
41
|
-
const validationMessage =
|
43
|
+
const validationMessage = _reactutilities.slot.optional(props.validationMessage, {
|
42
44
|
defaultProps: {
|
43
45
|
id: baseId + '__validationMessage',
|
44
46
|
role: validationState === 'error' ? 'alert' : undefined
|
45
47
|
},
|
46
48
|
elementType: 'div'
|
47
49
|
});
|
48
|
-
const hint =
|
50
|
+
const hint = _reactutilities.slot.optional(props.hint, {
|
49
51
|
defaultProps: {
|
50
52
|
id: baseId + '__hint'
|
51
53
|
},
|
52
54
|
elementType: 'div'
|
53
55
|
});
|
54
56
|
const defaultIcon = validationMessageIcons[validationState];
|
55
|
-
const validationMessageIcon =
|
57
|
+
const validationMessageIcon = _reactutilities.slot.optional(props.validationMessageIcon, {
|
56
58
|
renderByDefault: !!defaultIcon,
|
57
59
|
defaultProps: {
|
58
60
|
children: defaultIcon
|
@@ -68,7 +70,7 @@ const useField_unstable = (props, ref)=>{
|
|
68
70
|
validationState,
|
69
71
|
components: {
|
70
72
|
root: 'div',
|
71
|
-
label:
|
73
|
+
label: _reactlabel.Label,
|
72
74
|
validationMessage: 'div',
|
73
75
|
validationMessageIcon: 'span',
|
74
76
|
hint: 'div'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useField.js"],"sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';\nconst validationMessageIcons = {\n error: /*#__PURE__*/ React.createElement(ErrorCircle12Filled, null),\n warning: /*#__PURE__*/ React.createElement(Warning12Filled, null),\n success: /*#__PURE__*/ React.createElement(CheckmarkCircle12Filled, null),\n none: undefined\n};\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the root\n */ export const useField_unstable = (props, ref)=>{\n const { children
|
1
|
+
{"version":3,"sources":["useField.js"],"sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';\nconst validationMessageIcons = {\n error: /*#__PURE__*/ React.createElement(ErrorCircle12Filled, null),\n warning: /*#__PURE__*/ React.createElement(Warning12Filled, null),\n success: /*#__PURE__*/ React.createElement(CheckmarkCircle12Filled, null),\n none: undefined\n};\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the root\n */ export const useField_unstable = (props, ref)=>{\n const { children, orientation = 'vertical', required = false, validationState = props.validationMessage ? 'error' : 'none', size = 'medium' } = props;\n const baseId = useId('field-');\n const generatedControlId = baseId + '__control';\n const root = slot.always(getNativeElementProps('div', {\n ...props,\n ref\n }, /*excludedPropNames:*/ [\n 'children'\n ]), {\n elementType: 'div'\n });\n const label = slot.optional(props.label, {\n defaultProps: {\n htmlFor: generatedControlId,\n id: baseId + '__label',\n required,\n size\n },\n elementType: Label\n });\n const validationMessage = slot.optional(props.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n role: validationState === 'error' ? 'alert' : undefined\n },\n elementType: 'div'\n });\n const hint = slot.optional(props.hint, {\n defaultProps: {\n id: baseId + '__hint'\n },\n elementType: 'div'\n });\n const defaultIcon = validationMessageIcons[validationState];\n const validationMessageIcon = slot.optional(props.validationMessageIcon, {\n renderByDefault: !!defaultIcon,\n defaultProps: {\n children: defaultIcon\n },\n elementType: 'span'\n });\n return {\n children,\n generatedControlId,\n orientation,\n required,\n size,\n validationState,\n components: {\n root: 'div',\n label: Label,\n validationMessage: 'div',\n validationMessageIcon: 'span',\n hint: 'div'\n },\n root,\n label,\n validationMessageIcon,\n validationMessage,\n hint\n };\n};\n"],"names":["useField_unstable","validationMessageIcons","error","React","createElement","ErrorCircle12Filled","warning","Warning12Filled","success","CheckmarkCircle12Filled","none","undefined","props","ref","children","orientation","required","validationState","validationMessage","size","baseId","useId","generatedControlId","root","slot","always","getNativeElementProps","elementType","label","optional","defaultProps","htmlFor","id","Label","role","hint","defaultIcon","validationMessageIcon","renderByDefault","components"],"mappings":";;;;+BAkBiBA;;;eAAAA;;;;iEAlBM;4BACuD;4BACxD;gCAC6B;AACnD,MAAMC,yBAAyB;IAC3BC,OAAO,WAAW,GAAGC,OAAMC,aAAa,CAACC,+BAAmB,EAAE;IAC9DC,SAAS,WAAW,GAAGH,OAAMC,aAAa,CAACG,2BAAe,EAAE;IAC5DC,SAAS,WAAW,GAAGL,OAAMC,aAAa,CAACK,mCAAuB,EAAE;IACpEC,MAAMC;AACV;AASW,MAAMX,oBAAoB,CAACY,OAAOC;IACzC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,UAAU,EAAEC,WAAW,KAAK,EAAEC,kBAAkBL,MAAMM,iBAAiB,GAAG,UAAU,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGP;IAChJ,MAAMQ,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAMC,qBAAqBF,SAAS;IACpC,MAAMG,OAAOC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;QAClD,GAAGd,KAAK;QACRC;IACJ,GAAG,oBAAoB,GAAG;QACtB;KACH,GAAG;QACAc,aAAa;IACjB;IACA,MAAMC,QAAQJ,oBAAI,CAACK,QAAQ,CAACjB,MAAMgB,KAAK,EAAE;QACrCE,cAAc;YACVC,SAAST;YACTU,IAAIZ,SAAS;YACbJ;YACAG;QACJ;QACAQ,aAAaM,iBAAK;IACtB;IACA,MAAMf,oBAAoBM,oBAAI,CAACK,QAAQ,CAACjB,MAAMM,iBAAiB,EAAE;QAC7DY,cAAc;YACVE,IAAIZ,SAAS;YACbc,MAAMjB,oBAAoB,UAAU,UAAUN;QAClD;QACAgB,aAAa;IACjB;IACA,MAAMQ,OAAOX,oBAAI,CAACK,QAAQ,CAACjB,MAAMuB,IAAI,EAAE;QACnCL,cAAc;YACVE,IAAIZ,SAAS;QACjB;QACAO,aAAa;IACjB;IACA,MAAMS,cAAcnC,sBAAsB,CAACgB,gBAAgB;IAC3D,MAAMoB,wBAAwBb,oBAAI,CAACK,QAAQ,CAACjB,MAAMyB,qBAAqB,EAAE;QACrEC,iBAAiB,CAAC,CAACF;QACnBN,cAAc;YACVhB,UAAUsB;QACd;QACAT,aAAa;IACjB;IACA,OAAO;QACHb;QACAQ;QACAP;QACAC;QACAG;QACAF;QACAsB,YAAY;YACRhB,MAAM;YACNK,OAAOK,iBAAK;YACZf,mBAAmB;YACnBmB,uBAAuB;YACvBF,MAAM;QACV;QACAZ;QACAK;QACAS;QACAnB;QACAiB;IACJ;AACJ"}
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
fieldClassNames: ()
|
13
|
-
|
12
|
+
fieldClassNames: function() {
|
13
|
+
return fieldClassNames;
|
14
|
+
},
|
15
|
+
useFieldStyles_unstable: function() {
|
16
|
+
return useFieldStyles_unstable;
|
17
|
+
}
|
14
18
|
});
|
15
19
|
const _react = require("@griffel/react");
|
16
20
|
const fieldClassNames = {
|
@@ -24,7 +28,7 @@ const fieldClassNames = {
|
|
24
28
|
const iconSize = '12px';
|
25
29
|
/**
|
26
30
|
* Styles for the root slot
|
27
|
-
*/ const useRootStyles = /*#__PURE__*/ (0, _react
|
31
|
+
*/ const useRootStyles = /*#__PURE__*/ (0, _react.__styles)({
|
28
32
|
base: {
|
29
33
|
mc9l5x: "f13qh94s"
|
30
34
|
},
|
@@ -49,7 +53,7 @@ const iconSize = '12px';
|
|
49
53
|
".f1c2z91y{grid-template-columns:1fr;}"
|
50
54
|
]
|
51
55
|
});
|
52
|
-
const useLabelStyles = /*#__PURE__*/ (0, _react
|
56
|
+
const useLabelStyles = /*#__PURE__*/ (0, _react.__styles)({
|
53
57
|
base: {
|
54
58
|
z8tnut: "fclwglc",
|
55
59
|
Byoj8tv: "fywfov9"
|
@@ -86,10 +90,10 @@ const useLabelStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
86
90
|
".f1nzqi2z{grid-row-end:-1;}"
|
87
91
|
]
|
88
92
|
});
|
89
|
-
const useSecondaryTextBaseClassName = /*#__PURE__*/ (0, _react
|
93
|
+
const useSecondaryTextBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r5c4z9l", null, [
|
90
94
|
".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
95
|
]);
|
92
|
-
const useSecondaryTextStyles = /*#__PURE__*/ (0, _react
|
96
|
+
const useSecondaryTextStyles = /*#__PURE__*/ (0, _react.__styles)({
|
93
97
|
error: {
|
94
98
|
sj55zd: "f1hcrxcs"
|
95
99
|
},
|
@@ -106,11 +110,11 @@ const useSecondaryTextStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
106
110
|
".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"
|
107
111
|
]
|
108
112
|
});
|
109
|
-
const useValidationMessageIconBaseClassName = /*#__PURE__*/ (0, _react
|
113
|
+
const useValidationMessageIconBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("ra7h1uk", "r1rh6bd7", [
|
110
114
|
".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}",
|
111
115
|
".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}"
|
112
116
|
]);
|
113
|
-
const useValidationMessageIconStyles = /*#__PURE__*/ (0, _react
|
117
|
+
const useValidationMessageIconStyles = /*#__PURE__*/ (0, _react.__styles)({
|
114
118
|
error: {
|
115
119
|
sj55zd: "f1hcrxcs"
|
116
120
|
},
|
@@ -128,7 +132,7 @@ const useValidationMessageIconStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
128
132
|
]
|
129
133
|
});
|
130
134
|
const useFieldStyles_unstable = (state)=>{
|
131
|
-
const { validationState
|
135
|
+
const { validationState } = state;
|
132
136
|
const horizontal = state.orientation === 'horizontal';
|
133
137
|
const rootStyles = useRootStyles();
|
134
138
|
state.root.className = (0, _react.mergeClasses)(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nexport const fieldClassNames = {\n root: `fui-Field`,\n label: `fui-Field__label`,\n validationMessage: `fui-Field__validationMessage`,\n validationMessageIcon: `fui-Field__validationMessageIcon`,\n hint: `fui-Field__hint`\n};\n// Size of the icon in the validation message\nconst iconSize = '12px';\n/**\n * Styles for the root slot\n */\nconst useRootStyles = /*#__PURE__*/__styles({\n base: {\n mc9l5x: \"f13qh94s\"\n },\n horizontal: {\n Budl1dq: \"f2wwaib\",\n wkccdc: \"f1645dqt\"\n },\n horizontalNoLabel: {\n uwmqm3: [\"f15jqgz8\", \"fggqkej\"],\n Budl1dq: \"f1c2z91y\"\n }\n}, {\n d: [\".f13qh94s{display:grid;}\", \".f2wwaib{grid-template-columns:33% 1fr;}\", \".f1645dqt{grid-template-rows:auto auto auto 1fr;}\", \".f15jqgz8{padding-left:33%;}\", \".fggqkej{padding-right:33%;}\", \".f1c2z91y{grid-template-columns:1fr;}\"]\n});\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n z8tnut: \"fclwglc\",\n Byoj8tv: \"fywfov9\"\n },\n large: {\n z8tnut: \"f1sl3k7w\",\n Byoj8tv: \"f1brlhvm\"\n },\n vertical: {\n jrapky: \"fyacil5\"\n },\n verticalLarge: {\n jrapky: \"f8l5zjj\"\n },\n horizontal: {\n t21cq0: [\"fkujibs\", \"f199hnxi\"],\n Ijaq50: \"f16hsg94\",\n nk6f5a: \"f1nzqi2z\"\n }\n}, {\n d: [\".fclwglc{padding-top:var(--spacingVerticalXXS);}\", \".fywfov9{padding-bottom:var(--spacingVerticalXXS);}\", \".f1sl3k7w{padding-top:1px;}\", \".f1brlhvm{padding-bottom:1px;}\", \".fyacil5{margin-bottom:var(--spacingVerticalXXS);}\", \".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}\", \".fkujibs{margin-right:var(--spacingHorizontalM);}\", \".f199hnxi{margin-left:var(--spacingHorizontalM);}\", \".f16hsg94{grid-row-start:1;}\", \".f1nzqi2z{grid-row-end:-1;}\"]\n});\nconst useSecondaryTextBaseClassName = /*#__PURE__*/__resetStyles(\"r5c4z9l\", null, [\".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}\"]);\nconst useSecondaryTextStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n withIcon: {\n uwmqm3: [\"frawy03\", \"fg4c52\"]\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}\", \".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}\"]\n});\nconst useValidationMessageIconBaseClassName = /*#__PURE__*/__resetStyles(\"ra7h1uk\", \"r1rh6bd7\", [\".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\", \".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\"]);\nconst useValidationMessageIconStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n warning: {\n sj55zd: \"f1k5f75o\"\n },\n success: {\n sj55zd: \"ffmvakt\"\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}\", \".ffmvakt{color:var(--colorPaletteGreenForeground1);}\"]\n});\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = state => {\n const {\n validationState\n } = state;\n const horizontal = state.orientation === 'horizontal';\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);\n }\n const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);\n }\n const secondaryTextBaseClassName = useSecondaryTextBaseClassName();\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);\n }\n if (state.hint) {\n state.hint.className = mergeClasses(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n//# sourceMappingURL=useFieldStyles.styles.js.map"],"names":["fieldClassNames","useFieldStyles_unstable","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","__styles","base","mc9l5x","horizontal","Budl1dq","wkccdc","horizontalNoLabel","uwmqm3","d","useLabelStyles","z8tnut","Byoj8tv","large","vertical","jrapky","verticalLarge","t21cq0","Ijaq50","nk6f5a","useSecondaryTextBaseClassName","__resetStyles","useSecondaryTextStyles","error","sj55zd","withIcon","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","warning","success","state","validationState","orientation","rootStyles","className","mergeClasses","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"mappings":";;;;;;;;;;;IAEaA,eAAe
|
1
|
+
{"version":3,"sources":["useFieldStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nexport const fieldClassNames = {\n root: `fui-Field`,\n label: `fui-Field__label`,\n validationMessage: `fui-Field__validationMessage`,\n validationMessageIcon: `fui-Field__validationMessageIcon`,\n hint: `fui-Field__hint`\n};\n// Size of the icon in the validation message\nconst iconSize = '12px';\n/**\n * Styles for the root slot\n */\nconst useRootStyles = /*#__PURE__*/__styles({\n base: {\n mc9l5x: \"f13qh94s\"\n },\n horizontal: {\n Budl1dq: \"f2wwaib\",\n wkccdc: \"f1645dqt\"\n },\n horizontalNoLabel: {\n uwmqm3: [\"f15jqgz8\", \"fggqkej\"],\n Budl1dq: \"f1c2z91y\"\n }\n}, {\n d: [\".f13qh94s{display:grid;}\", \".f2wwaib{grid-template-columns:33% 1fr;}\", \".f1645dqt{grid-template-rows:auto auto auto 1fr;}\", \".f15jqgz8{padding-left:33%;}\", \".fggqkej{padding-right:33%;}\", \".f1c2z91y{grid-template-columns:1fr;}\"]\n});\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n z8tnut: \"fclwglc\",\n Byoj8tv: \"fywfov9\"\n },\n large: {\n z8tnut: \"f1sl3k7w\",\n Byoj8tv: \"f1brlhvm\"\n },\n vertical: {\n jrapky: \"fyacil5\"\n },\n verticalLarge: {\n jrapky: \"f8l5zjj\"\n },\n horizontal: {\n t21cq0: [\"fkujibs\", \"f199hnxi\"],\n Ijaq50: \"f16hsg94\",\n nk6f5a: \"f1nzqi2z\"\n }\n}, {\n d: [\".fclwglc{padding-top:var(--spacingVerticalXXS);}\", \".fywfov9{padding-bottom:var(--spacingVerticalXXS);}\", \".f1sl3k7w{padding-top:1px;}\", \".f1brlhvm{padding-bottom:1px;}\", \".fyacil5{margin-bottom:var(--spacingVerticalXXS);}\", \".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}\", \".fkujibs{margin-right:var(--spacingHorizontalM);}\", \".f199hnxi{margin-left:var(--spacingHorizontalM);}\", \".f16hsg94{grid-row-start:1;}\", \".f1nzqi2z{grid-row-end:-1;}\"]\n});\nconst useSecondaryTextBaseClassName = /*#__PURE__*/__resetStyles(\"r5c4z9l\", null, [\".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}\"]);\nconst useSecondaryTextStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n withIcon: {\n uwmqm3: [\"frawy03\", \"fg4c52\"]\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}\", \".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}\"]\n});\nconst useValidationMessageIconBaseClassName = /*#__PURE__*/__resetStyles(\"ra7h1uk\", \"r1rh6bd7\", [\".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\", \".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}\"]);\nconst useValidationMessageIconStyles = /*#__PURE__*/__styles({\n error: {\n sj55zd: \"f1hcrxcs\"\n },\n warning: {\n sj55zd: \"f1k5f75o\"\n },\n success: {\n sj55zd: \"ffmvakt\"\n }\n}, {\n d: [\".f1hcrxcs{color:var(--colorPaletteRedForeground1);}\", \".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}\", \".ffmvakt{color:var(--colorPaletteGreenForeground1);}\"]\n});\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = state => {\n const {\n validationState\n } = state;\n const horizontal = state.orientation === 'horizontal';\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);\n }\n const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);\n }\n const secondaryTextBaseClassName = useSecondaryTextBaseClassName();\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);\n }\n if (state.hint) {\n state.hint.className = mergeClasses(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n//# sourceMappingURL=useFieldStyles.styles.js.map"],"names":["fieldClassNames","useFieldStyles_unstable","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","__styles","base","mc9l5x","horizontal","Budl1dq","wkccdc","horizontalNoLabel","uwmqm3","d","useLabelStyles","z8tnut","Byoj8tv","large","vertical","jrapky","verticalLarge","t21cq0","Ijaq50","nk6f5a","useSecondaryTextBaseClassName","__resetStyles","useSecondaryTextStyles","error","sj55zd","withIcon","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","warning","success","state","validationState","orientation","rootStyles","className","mergeClasses","labelStyles","size","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles"],"mappings":";;;;;;;;;;;IAEaA,eAAe;eAAfA;;IA8EAC,uBAAuB;eAAvBA;;;uBA/EyC;AAC/C,MAAMD,kBAAkB;IAC7BE,MAAM,CAAC,SAAS,CAAC;IACjBC,OAAO,CAAC,gBAAgB,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,MAAMqB,sBAAsBnB;IAC5B,IAAIQ,MAAMlC,iBAAiB,EAAE;QAC3BkC,MAAMlC,iBAAiB,CAACsC,SAAS,GAAGC,IAAAA,mBAAY,EAAC3C,gBAAgBI,iBAAiB,EAAE4C,4BAA4BT,oBAAoB,WAAWU,oBAAoBlB,KAAK,EAAE,CAAC,CAACO,MAAMjC,qBAAqB,IAAI4C,oBAAoBhB,QAAQ,EAAEK,MAAMlC,iBAAiB,CAACsC,SAAS;IAC5Q;IACA,IAAIJ,MAAMhC,IAAI,EAAE;QACdgC,MAAMhC,IAAI,CAACoC,SAAS,GAAGC,IAAAA,mBAAY,EAAC3C,gBAAgBM,IAAI,EAAE0C,4BAA4BV,MAAMhC,IAAI,CAACoC,SAAS;IAC5G;AACF,GACA,iDAAiD"}
|
@@ -9,11 +9,15 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
FieldContextProvider: ()
|
13
|
-
|
12
|
+
FieldContextProvider: function() {
|
13
|
+
return FieldContextProvider;
|
14
|
+
},
|
15
|
+
useFieldContext_unstable: function() {
|
16
|
+
return useFieldContext_unstable;
|
17
|
+
}
|
14
18
|
});
|
15
|
-
const
|
16
|
-
const _react = /*#__PURE__*/
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
17
21
|
const FieldContext = /*#__PURE__*/ _react.createContext(undefined);
|
18
22
|
const FieldContextProvider = FieldContext.Provider;
|
19
23
|
const useFieldContext_unstable = ()=>_react.useContext(FieldContext);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["FieldContext.js"],"sourcesContent":["import * as React from 'react';\nconst FieldContext = React.createContext(undefined);\nexport const FieldContextProvider = FieldContext.Provider;\nexport const useFieldContext_unstable = ()=>React.useContext(FieldContext);\n"],"names":["FieldContextProvider","useFieldContext_unstable","FieldContext","React","createContext","undefined","Provider","useContext"],"mappings":";;;;;;;;;;;IAEaA,oBAAoB
|
1
|
+
{"version":3,"sources":["FieldContext.js"],"sourcesContent":["import * as React from 'react';\nconst FieldContext = React.createContext(undefined);\nexport const FieldContextProvider = FieldContext.Provider;\nexport const useFieldContext_unstable = ()=>React.useContext(FieldContext);\n"],"names":["FieldContextProvider","useFieldContext_unstable","FieldContext","React","createContext","undefined","Provider","useContext"],"mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IACAC,wBAAwB;eAAxBA;;;;iEAHU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAML,uBAAuBE,aAAaI,QAAQ;AAClD,MAAML,2BAA2B,IAAIE,OAAMI,UAAU,CAACL"}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./FieldContext"), exports);
|
7
|
+
_export_star._(require("./useFieldContextValues"), exports);
|
8
|
+
_export_star._(require("./useFieldControlProps"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './FieldContext';\nexport * from './useFieldContextValues';\nexport * from './useFieldControlProps';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './FieldContext';\nexport * from './useFieldContextValues';\nexport * from './useFieldControlProps';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA"}
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useFieldContextValues_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useFieldContextValues_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const useFieldContextValues_unstable = (state)=>{
|
12
14
|
var _state_label, _state_label1, _state_validationMessage, _state_hint;
|
13
|
-
const { generatedControlId
|
15
|
+
const { generatedControlId, orientation, required, size, validationState } = state;
|
14
16
|
const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;
|
15
17
|
const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;
|
16
18
|
const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldContextValues.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Get the context values used when rendering Field.\n */ export const useFieldContextValues_unstable = (state)=>{\n var _state_label, _state_label1, _state_validationMessage, _state_hint;\n const { generatedControlId
|
1
|
+
{"version":3,"sources":["useFieldContextValues.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Get the context values used when rendering Field.\n */ export const useFieldContextValues_unstable = (state)=>{\n var _state_label, _state_label1, _state_validationMessage, _state_hint;\n const { generatedControlId, orientation, required, size, validationState } = state;\n const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;\n const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;\n const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;\n const hintId = (_state_hint = state.hint) === null || _state_hint === void 0 ? void 0 : _state_hint.id;\n const field = React.useMemo(()=>({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState\n }), [\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState\n ]);\n return {\n field\n };\n};\n"],"names":["useFieldContextValues_unstable","state","_state_label","_state_label1","_state_validationMessage","_state_hint","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","React","useMemo"],"mappings":";;;;+BAGiBA;;;eAAAA;;;;iEAHM;AAGZ,MAAMA,iCAAiC,CAACC;IAC/C,IAAIC,cAAcC,eAAeC,0BAA0BC;IAC3D,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,eAAe,EAAE,GAAGT;IAC7E,MAAMU,WAAW,AAACT,CAAAA,eAAeD,MAAMW,KAAK,AAAD,MAAO,QAAQV,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaW,OAAO;IACjH,MAAMC,UAAU,AAACX,CAAAA,gBAAgBF,MAAMW,KAAK,AAAD,MAAO,QAAQT,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcY,EAAE;IAC9G,MAAMC,sBAAsB,AAACZ,CAAAA,2BAA2BH,MAAMgB,iBAAiB,AAAD,MAAO,QAAQb,6BAA6B,KAAK,IAAI,KAAK,IAAIA,yBAAyBW,EAAE;IACvK,MAAMG,SAAS,AAACb,CAAAA,cAAcJ,MAAMkB,IAAI,AAAD,MAAO,QAAQd,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYU,EAAE;IACtG,MAAMK,QAAQC,OAAMC,OAAO,CAAC,IAAK,CAAA;YACzBhB;YACAY;YACAP;YACAG;YACAP;YACAC;YACAC;YACAO;YACAN;QACJ,CAAA,GAAI;QACJJ;QACAY;QACAP;QACAG;QACAP;QACAC;QACAC;QACAO;QACAN;KACH;IACD,OAAO;QACHU;IACJ;AACJ"}
|
@@ -9,14 +9,19 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
useFieldControlProps_unstable: ()
|
13
|
-
|
12
|
+
useFieldControlProps_unstable: function() {
|
13
|
+
return useFieldControlProps_unstable;
|
14
|
+
},
|
15
|
+
getFieldControlProps: function() {
|
16
|
+
return getFieldControlProps;
|
17
|
+
}
|
14
18
|
});
|
15
|
-
const
|
19
|
+
const _FieldContext = require("./FieldContext");
|
16
20
|
function useFieldControlProps_unstable(props, options) {
|
17
|
-
return getFieldControlProps((0,
|
21
|
+
return getFieldControlProps((0, _FieldContext.useFieldContext_unstable)(), props, options);
|
18
22
|
}
|
19
23
|
function getFieldControlProps(context, props, options) {
|
24
|
+
var _options, _options1;
|
20
25
|
if (!context) {
|
21
26
|
return props;
|
22
27
|
}
|
@@ -24,7 +29,7 @@ function getFieldControlProps(context, props, options) {
|
|
24
29
|
props = {
|
25
30
|
...props
|
26
31
|
};
|
27
|
-
const { generatedControlId
|
32
|
+
const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;
|
28
33
|
if (generatedControlId) {
|
29
34
|
var _props;
|
30
35
|
var _id;
|
@@ -32,7 +37,7 @@ function getFieldControlProps(context, props, options) {
|
|
32
37
|
}
|
33
38
|
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
|
34
39
|
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
|
35
|
-
if (labelId && (!(options === null ||
|
40
|
+
if (labelId && (!((_options = options) === null || _options === void 0 ? void 0 : _options.supportsLabelFor) || labelFor !== props.id)) {
|
36
41
|
var _props1, _arialabelledby;
|
37
42
|
var _;
|
38
43
|
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
|
@@ -41,34 +46,36 @@ function getFieldControlProps(context, props, options) {
|
|
41
46
|
// We also preserve and append any aria-describedby from props.
|
42
47
|
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
|
43
48
|
if (validationMessageId || hintId) {
|
49
|
+
var _props2;
|
44
50
|
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
|
45
51
|
props['aria-describedby'] = [
|
46
52
|
validationMessageId,
|
47
53
|
hintId,
|
48
|
-
props === null ||
|
54
|
+
(_props2 = props) === null || _props2 === void 0 ? void 0 : _props2['aria-describedby']
|
49
55
|
].filter(Boolean).join(' ');
|
50
56
|
}
|
51
57
|
if (validationState === 'error') {
|
52
|
-
var
|
58
|
+
var _props3, _ariainvalid;
|
53
59
|
var _1;
|
54
|
-
(_1 = (
|
60
|
+
(_1 = (_props3 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props3[_ariainvalid] = true;
|
55
61
|
}
|
56
62
|
if (required) {
|
57
|
-
|
58
|
-
|
63
|
+
var _options2;
|
64
|
+
if ((_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.supportsRequired) {
|
65
|
+
var _props4;
|
59
66
|
var _required;
|
60
|
-
(_required = (
|
67
|
+
(_required = (_props4 = props).required) !== null && _required !== void 0 ? _required : _props4.required = true;
|
61
68
|
} else {
|
62
|
-
var
|
69
|
+
var _props5, _ariarequired;
|
63
70
|
var _2;
|
64
|
-
(_2 = (
|
71
|
+
(_2 = (_props5 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props5[_ariarequired] = true;
|
65
72
|
}
|
66
73
|
}
|
67
74
|
// Include the size prop if this control supports it
|
68
|
-
if (options === null ||
|
69
|
-
var
|
75
|
+
if ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.supportsSize) {
|
76
|
+
var _props6;
|
70
77
|
var _size;
|
71
|
-
(_size = (
|
78
|
+
(_size = (_props6 = props).size) !== null && _size !== void 0 ? _size : _props6.size = context.size;
|
72
79
|
}
|
73
80
|
return props;
|
74
81
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["import { useFieldContext_unstable } from './FieldContext';\nexport function useFieldControlProps_unstable(props, options) {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */ export function getFieldControlProps(context, props, options) {\n if (!context) {\n return props;\n }\n // Create a copy of props so we don't modify the original\n props = {\n ...props\n };\n const { generatedControlId
|
1
|
+
{"version":3,"sources":["useFieldControlProps.js"],"sourcesContent":["import { useFieldContext_unstable } from './FieldContext';\nexport function useFieldControlProps_unstable(props, options) {\n return getFieldControlProps(useFieldContext_unstable(), props, options);\n}\n/**\n * @internal\n * Implementation of useFieldControlProps_unstable.\n * Split out so it can be used directly in renderField_unstable.\n */ export function getFieldControlProps(context, props, options) {\n var _options, _options1;\n if (!context) {\n return props;\n }\n // Create a copy of props so we don't modify the original\n props = {\n ...props\n };\n const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;\n if (generatedControlId) {\n var _props;\n var _id;\n (_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;\n }\n // Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer\n // to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).\n if (labelId && (!((_options = options) === null || _options === void 0 ? void 0 : _options.supportsLabelFor) || labelFor !== props.id)) {\n var _props1, _arialabelledby;\n var _;\n (_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;\n }\n // The control is described by the validation message, or hint, or both.\n // We also preserve and append any aria-describedby from props.\n // For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933\n if (validationMessageId || hintId) {\n var _props2;\n // NOTE: Not using ??= since we're merging and overriding the user-provided value.\n props['aria-describedby'] = [\n validationMessageId,\n hintId,\n (_props2 = props) === null || _props2 === void 0 ? void 0 : _props2['aria-describedby']\n ].filter(Boolean).join(' ');\n }\n if (validationState === 'error') {\n var _props3, _ariainvalid;\n var _1;\n (_1 = (_props3 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props3[_ariainvalid] = true;\n }\n if (required) {\n var _options2;\n if ((_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.supportsRequired) {\n var _props4;\n var _required;\n (_required = (_props4 = props).required) !== null && _required !== void 0 ? _required : _props4.required = true;\n } else {\n var _props5, _ariarequired;\n var _2;\n (_2 = (_props5 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props5[_ariarequired] = true;\n }\n }\n // Include the size prop if this control supports it\n if ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.supportsSize) {\n var _props6;\n var _size;\n (_size = (_props6 = props).size) !== null && _size !== void 0 ? _size : _props6.size = context.size;\n }\n return props;\n}\n"],"names":["useFieldControlProps_unstable","getFieldControlProps","props","options","useFieldContext_unstable","context","_options","_options1","generatedControlId","hintId","labelFor","labelId","required","validationMessageId","validationState","_props","_id","id","supportsLabelFor","_props1","_arialabelledby","_","_props2","filter","Boolean","join","_props3","_ariainvalid","_1","_options2","supportsRequired","_props4","_required","_props5","_ariarequired","_2","supportsSize","_props6","_size","size"],"mappings":";;;;;;;;;;;IACgBA,6BAA6B;eAA7BA;;IAOIC,oBAAoB;eAApBA;;;8BARqB;AAClC,SAASD,8BAA8BE,KAAK,EAAEC,OAAO;IACxD,OAAOF,qBAAqBG,IAAAA,sCAAwB,KAAIF,OAAOC;AACnE;AAKW,SAASF,qBAAqBI,OAAO,EAAEH,KAAK,EAAEC,OAAO;IAC5D,IAAIG,UAAUC;IACd,IAAI,CAACF,SAAS;QACV,OAAOH;IACX;IACA,yDAAyD;IACzDA,QAAQ;QACJ,GAAGA,KAAK;IACZ;IACA,MAAM,EAAEM,kBAAkB,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,mBAAmB,EAAEC,eAAe,EAAE,GAAGT;IAC1G,IAAIG,oBAAoB;QACpB,IAAIO;QACJ,IAAIC;QACHA,CAAAA,MAAM,AAACD,CAAAA,SAASb,KAAI,EAAGe,EAAE,AAAD,MAAO,QAAQD,QAAQ,KAAK,I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C/G,OAAO;YACH,IAAIqB,SAASC;YACb,IAAIC;YACHA,CAAAA,KAAK,AAACF,CAAAA,UAAU/B,KAAI,CAAE,CAACgC,gBAAgB,gBAAgB,AAAD,MAAO,QAAQC,OAAO,KAAK,IAAIA,KAAKF,OAAO,CAACC,cAAc,GAAG;QACxH;IACJ;IACA,oDAAoD;IACpD,IAAI,AAAC3B,CAAAA,YAAYJ,OAAM,MAAO,QAAQI,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAU6B,YAAY,EAAE;QAC1F,IAAIC;QACJ,IAAIC;QACHA,CAAAA,QAAQ,AAACD,CAAAA,UAAUnC,KAAI,EAAGqC,IAAI,AAAD,MAAO,QAAQD,UAAU,KAAK,IAAIA,QAAQD,QAAQE,IAAI,GAAGlC,QAAQkC,IAAI;IACvG;IACA,OAAOrC;AACX"}
|
package/lib-commonjs/index.js
CHANGED
@@ -9,15 +9,33 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
Field: ()
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
Field: function() {
|
13
|
+
return _Field.Field;
|
14
|
+
},
|
15
|
+
fieldClassNames: function() {
|
16
|
+
return _Field.fieldClassNames;
|
17
|
+
},
|
18
|
+
renderField_unstable: function() {
|
19
|
+
return _Field.renderField_unstable;
|
20
|
+
},
|
21
|
+
useFieldStyles_unstable: function() {
|
22
|
+
return _Field.useFieldStyles_unstable;
|
23
|
+
},
|
24
|
+
useField_unstable: function() {
|
25
|
+
return _Field.useField_unstable;
|
26
|
+
},
|
27
|
+
FieldContextProvider: function() {
|
28
|
+
return _index.FieldContextProvider;
|
29
|
+
},
|
30
|
+
useFieldContext_unstable: function() {
|
31
|
+
return _index.useFieldContext_unstable;
|
32
|
+
},
|
33
|
+
useFieldContextValues_unstable: function() {
|
34
|
+
return _index.useFieldContextValues_unstable;
|
35
|
+
},
|
36
|
+
useFieldControlProps_unstable: function() {
|
37
|
+
return _index.useFieldControlProps_unstable;
|
38
|
+
}
|
21
39
|
});
|
22
|
-
const
|
40
|
+
const _Field = require("./Field");
|
23
41
|
const _index = require("./contexts/index");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport { FieldContextProvider, useFieldContext_unstable, useFieldContextValues_unstable, useFieldControlProps_unstable } from './contexts/index';\n"],"names":["Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","FieldContextProvider","useFieldContext_unstable","useFieldContextValues_unstable","useFieldControlProps_unstable"],"mappings":";;;;;;;;;;;IAASA,KAAK,
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport { FieldContextProvider, useFieldContext_unstable, useFieldContextValues_unstable, useFieldControlProps_unstable } from './contexts/index';\n"],"names":["Field","fieldClassNames","renderField_unstable","useFieldStyles_unstable","useField_unstable","FieldContextProvider","useFieldContext_unstable","useFieldContextValues_unstable","useFieldControlProps_unstable"],"mappings":";;;;;;;;;;;IAASA,KAAK;eAALA,YAAK;;IAAEC,eAAe;eAAfA,sBAAe;;IAAEC,oBAAoB;eAApBA,2BAAoB;;IAAEC,uBAAuB;eAAvBA,8BAAuB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IACxFC,oBAAoB;eAApBA,2BAAoB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,8BAA8B;eAA9BA,qCAA8B;;IAAEC,6BAA6B;eAA7BA,oCAA6B;;;uBADb;uBACqB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "9.1.
|
3
|
+
"version": "9.1.24",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,20 +33,20 @@
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-context-selector": "^9.1.
|
36
|
+
"@fluentui/react-context-selector": "^9.1.33",
|
37
37
|
"@fluentui/react-icons": "^2.0.207",
|
38
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
39
|
-
"@fluentui/react-label": "^9.1.
|
40
|
-
"@fluentui/react-theme": "^9.1.
|
41
|
-
"@fluentui/react-utilities": "^9.13.
|
38
|
+
"@fluentui/react-jsx-runtime": "^9.0.5",
|
39
|
+
"@fluentui/react-label": "^9.1.32",
|
40
|
+
"@fluentui/react-theme": "^9.1.12",
|
41
|
+
"@fluentui/react-utilities": "^9.13.2",
|
42
42
|
"@griffel/react": "^1.5.14",
|
43
|
-
"@swc/helpers": "^0.
|
43
|
+
"@swc/helpers": "^0.5.1"
|
44
44
|
},
|
45
45
|
"peerDependencies": {
|
46
|
-
"@types/react": ">=16.
|
47
|
-
"@types/react-dom": ">=16.
|
48
|
-
"react": ">=16.
|
49
|
-
"react-dom": ">=16.
|
46
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
47
|
+
"@types/react-dom": ">=16.14.0 <19.0.0",
|
48
|
+
"react": ">=16.14.0 <19.0.0",
|
49
|
+
"react-dom": ">=16.14.0 <19.0.0"
|
50
50
|
},
|
51
51
|
"beachball": {
|
52
52
|
"disallowedChangeTypes": [
|