Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fluentui/react-field

Package Overview
Dependencies
Maintainers
12
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/react-field - npm Package Compare versions

Comparing version 0.0.0-nightly-20230223-2115.1 to 0.0.0-nightly-20230227-0424.1

26

CHANGELOG.json

@@ -5,5 +5,5 @@ {

{
"date": "Thu, 23 Feb 2023 21:23:10 GMT",
"tag": "@fluentui/react-field_v0.0.0-nightly-20230223-2115.1",
"version": "0.0.0-nightly-20230223-2115.1",
"date": "Mon, 27 Feb 2023 04:31:23 GMT",
"tag": "@fluentui/react-field_v0.0.0-nightly-20230227-0424.1",
"version": "0.0.0-nightly-20230227-0424.1",
"comments": {

@@ -20,4 +20,4 @@ "prerelease": [

"package": "@fluentui/react-field",
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230223-2115.1",
"commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230227-0424.1",
"commit": "aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d"
},

@@ -27,4 +27,4 @@ {

"package": "@fluentui/react-field",
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230223-2115.1",
"commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230227-0424.1",
"commit": "aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d"
},

@@ -34,4 +34,4 @@ {

"package": "@fluentui/react-field",
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230223-2115.1",
"commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230227-0424.1",
"commit": "aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d"
},

@@ -41,4 +41,4 @@ {

"package": "@fluentui/react-field",
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230223-2115.1",
"commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230227-0424.1",
"commit": "aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d"
},

@@ -48,4 +48,4 @@ {

"package": "@fluentui/react-field",
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230223-2115.1",
"commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230227-0424.1",
"commit": "aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d"
}

@@ -52,0 +52,0 @@ ]

# Change Log - @fluentui/react-field
This log was last generated on Thu, 23 Feb 2023 21:23:10 GMT and should not be manually modified.
This log was last generated on Mon, 27 Feb 2023 04:31:23 GMT and should not be manually modified.
<!-- Start content -->
## [0.0.0-nightly-20230223-2115.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v0.0.0-nightly-20230223-2115.1)
## [0.0.0-nightly-20230227-0424.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v0.0.0-nightly-20230227-0424.1)
Thu, 23 Feb 2023 21:23:10 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.21..@fluentui/react-field_v0.0.0-nightly-20230223-2115.1)
Mon, 27 Feb 2023 04:31:23 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.21..@fluentui/react-field_v0.0.0-nightly-20230227-0424.1)

@@ -15,7 +15,7 @@ ### Changes

- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
- Bump @fluentui/react-label to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
- Bump @fluentui/react-theme to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20230227-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d) by beachball)
- Bump @fluentui/react-label to v0.0.0-nightly-20230227-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d) by beachball)
- Bump @fluentui/react-theme to v0.0.0-nightly-20230227-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d) by beachball)
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230227-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d) by beachball)
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230227-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/aa8e336db1e2cb3ce6a73000564bfb59f2fbdf3d) by beachball)

@@ -22,0 +22,0 @@ ## [9.0.0-alpha.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.21)

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
Object.defineProperty(exports, "Field", {
enumerable: true,
get: ()=>Field
exports.Field = void 0;
const React = /*#__PURE__*/require("react");
const renderField_1 = /*#__PURE__*/require("./renderField");
const useField_1 = /*#__PURE__*/require("./useField");
const useFieldStyles_1 = /*#__PURE__*/require("./useFieldStyles");
exports.Field = /*#__PURE__*/React.forwardRef((props, ref) => {
const state = useField_1.useField_unstable(props, ref);
useFieldStyles_1.useFieldStyles_unstable(state);
return renderField_1.renderField_unstable(state);
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
const _renderField = require("./renderField");
const _useField = require("./useField");
const _useFieldStyles = require("./useFieldStyles");
const Field = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useField.useField_unstable)(props, ref);
(0, _useFieldStyles.useFieldStyles_unstable)(state);
return (0, _renderField.renderField_unstable)(state);
});
Field.displayName = 'Field'; //# sourceMappingURL=Field.js.map
exports.Field.displayName = 'Field';
//# sourceMappingURL=Field.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
//# sourceMappingURL=Field.types.js.map
//# sourceMappingURL=Field.types.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
_exportStar(require("./Field.types"), exports);
_exportStar(require("./Field"), exports);
_exportStar(require("./renderField"), exports);
_exportStar(require("./useField"), exports);
_exportStar(require("./useFieldStyles"), exports);
//# sourceMappingURL=index.js.map
const tslib_1 = /*#__PURE__*/require("tslib");
tslib_1.__exportStar(require("./Field.types"), exports);
tslib_1.__exportStar(require("./Field"), exports);
tslib_1.__exportStar(require("./renderField"), exports);
tslib_1.__exportStar(require("./useField"), exports);
tslib_1.__exportStar(require("./useFieldStyles"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
Object.defineProperty(exports, "renderField_unstable", {
enumerable: true,
get: ()=>renderField_unstable
});
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _extends = require("@swc/helpers/lib/_extends.js").default;
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
const _reactUtilities = require("@fluentui/react-utilities");
const renderField_unstable = (state)=>{
const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
return /*#__PURE__*/ _react.createElement(slots.root, _extends({}, slotProps.root), slots.label && /*#__PURE__*/ _react.createElement(slots.label, _extends({}, slotProps.label)), slotProps.root.children, slots.validationMessage && /*#__PURE__*/ _react.createElement(slots.validationMessage, _extends({}, slotProps.validationMessage), slots.validationMessageIcon && /*#__PURE__*/ _react.createElement(slots.validationMessageIcon, _extends({}, slotProps.validationMessageIcon)), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/ _react.createElement(slots.hint, _extends({}, slotProps.hint)));
}; //# sourceMappingURL=renderField.js.map
exports.renderField_unstable = void 0;
const React = /*#__PURE__*/require("react");
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
/**
* Render the final JSX of Field
*/
const renderField_unstable = state => {
const {
slots,
slotProps
} = react_utilities_1.getSlots(state);
return React.createElement(slots.root, {
...slotProps.root
}, slots.label && React.createElement(slots.label, {
...slotProps.label
}), slotProps.root.children, slots.validationMessage && React.createElement(slots.validationMessage, {
...slotProps.validationMessage
}, slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, {
...slotProps.validationMessageIcon
}), slotProps.validationMessage.children), slots.hint && React.createElement(slots.hint, {
...slotProps.hint
}));
};
exports.renderField_unstable = renderField_unstable;
//# sourceMappingURL=renderField.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
Object.defineProperty(exports, "useField_unstable", {
enumerable: true,
get: ()=>useField_unstable
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
const _reactIcons = require("@fluentui/react-icons");
const _reactLabel = require("@fluentui/react-label");
const _reactUtilities = require("@fluentui/react-utilities");
var _controlProps, _arialabelledby, // Assign the child a generated ID if doesn't already have an ID
_controlProps1, _controlProps2, _ariainvalid, _controlProps3, _ariarequired;
exports.useField_unstable = void 0;
const React = /*#__PURE__*/require("react");
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
const react_label_1 = /*#__PURE__*/require("@fluentui/react-label");
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
const validationMessageIcons = {
error: /*#__PURE__*/ _react.createElement(_reactIcons.ErrorCircle12Filled, null),
warning: /*#__PURE__*/ _react.createElement(_reactIcons.Warning12Filled, null),
success: /*#__PURE__*/ _react.createElement(_reactIcons.CheckmarkCircle12Filled, null),
none: undefined
error: /*#__PURE__*/React.createElement(react_icons_1.ErrorCircle12Filled, null),
warning: /*#__PURE__*/React.createElement(react_icons_1.Warning12Filled, null),
success: /*#__PURE__*/React.createElement(react_icons_1.CheckmarkCircle12Filled, null),
none: undefined
};
const useField_unstable = (props, ref)=>{
const { children , orientation ='vertical' , required , validationState =props.validationMessage ? 'error' : 'none' , size } = props;
const baseId = (0, _reactUtilities.useId)('field-');
const root = (0, _reactUtilities.getNativeElementProps)('div', {
...props,
ref
}, /*excludedPropNames:*/ [
'children'
]);
const label = (0, _reactUtilities.resolveShorthand)(props.label, {
defaultProps: {
id: baseId + '__label',
required,
size
}
});
const validationMessage = (0, _reactUtilities.resolveShorthand)(props.validationMessage, {
defaultProps: {
id: baseId + '__validationMessage',
role: validationState === 'error' ? 'alert' : undefined
}
});
const hint = (0, _reactUtilities.resolveShorthand)(props.hint, {
defaultProps: {
id: baseId + '__hint'
}
});
const defaultIcon = validationMessageIcons[validationState];
const validationMessageIcon = (0, _reactUtilities.resolveShorthand)(props.validationMessageIcon, {
required: !!defaultIcon,
defaultProps: {
children: defaultIcon
}
});
const controlProps = /*#__PURE__*/ /*#__PURE__*/ _react.isValidElement(children) ? {
...children.props
} : {};
if (label) {
(_controlProps = controlProps)[_arialabelledby = 'aria-labelledby'] ?? (_controlProps[_arialabelledby] = label.id);
if (!label.htmlFor) {
(_controlProps1 = controlProps).id ?? (_controlProps1.id = baseId + '__control');
label.htmlFor = controlProps.id;
}
/**
* Create the state required to render Field.
*
* The returned state can be modified with hooks such as useFieldStyles_unstable,
* before being passed to renderField_unstable.
*
* @param props - Props passed to this field
* @param ref - Ref to the root
*/
const useField_unstable = (props, ref) => {
var _a, _b, _c, _d;
const {
children,
orientation = 'vertical',
required,
validationState = props.validationMessage ? 'error' : 'none',
size
} = props;
const baseId = react_utilities_1.useId('field-');
const root = react_utilities_1.getNativeElementProps('div', {
...props,
ref
}, /*excludedPropNames:*/['children']);
const label = react_utilities_1.resolveShorthand(props.label, {
defaultProps: {
id: baseId + '__label',
required,
size
// htmlFor is handled below
}
if (validationMessage || hint) {
// The control is described by the validation message, or hint, or both
// We also preserve and append any aria-describedby supplied by the user
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
controlProps['aria-describedby'] = [
validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id,
hint === null || hint === void 0 ? void 0 : hint.id,
controlProps['aria-describedby']
].filter(Boolean).join(' ');
});
const validationMessage = react_utilities_1.resolveShorthand(props.validationMessage, {
defaultProps: {
id: baseId + '__validationMessage',
role: validationState === 'error' ? 'alert' : undefined
}
if (validationState === 'error') {
(_controlProps2 = controlProps)[_ariainvalid = 'aria-invalid'] ?? (_controlProps2[_ariainvalid] = true);
});
const hint = react_utilities_1.resolveShorthand(props.hint, {
defaultProps: {
id: baseId + '__hint'
}
if (required) {
(_controlProps3 = controlProps)[_ariarequired = 'aria-required'] ?? (_controlProps3[_ariarequired] = true);
});
const defaultIcon = validationMessageIcons[validationState];
const validationMessageIcon = react_utilities_1.resolveShorthand(props.validationMessageIcon, {
required: !!defaultIcon,
defaultProps: {
children: defaultIcon
}
if (/*#__PURE__*/ _react.isValidElement(children)) {
root.children = /*#__PURE__*/ _react.cloneElement(children, controlProps);
} else if (typeof children === 'function') {
root.children = children(controlProps);
});
const controlProps = React.isValidElement(children) ? {
...children.props
} : {};
if (label) {
(_a = controlProps['aria-labelledby']) !== null && _a !== void 0 ? _a : controlProps['aria-labelledby'] = label.id;
if (!label.htmlFor) {
// Assign the child a generated ID if doesn't already have an ID
(_b = controlProps.id) !== null && _b !== void 0 ? _b : controlProps.id = baseId + '__control';
label.htmlFor = controlProps.id;
}
return {
orientation,
validationState,
components: {
root: 'div',
label: _reactLabel.Label,
validationMessage: 'div',
validationMessageIcon: 'span',
hint: 'div'
},
root,
label,
validationMessageIcon,
validationMessage,
hint
};
}; //# sourceMappingURL=useField.js.map
}
if (validationMessage || hint) {
// The control is described by the validation message, or hint, or both
// We also preserve and append any aria-describedby supplied by the user
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
controlProps['aria-describedby'] = [validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id, hint === null || hint === void 0 ? void 0 : hint.id, controlProps['aria-describedby']].filter(Boolean).join(' ');
}
if (validationState === 'error') {
(_c = controlProps['aria-invalid']) !== null && _c !== void 0 ? _c : controlProps['aria-invalid'] = true;
}
if (required) {
(_d = controlProps['aria-required']) !== null && _d !== void 0 ? _d : controlProps['aria-required'] = true;
}
if (React.isValidElement(children)) {
root.children = React.cloneElement(children, controlProps);
} else if (typeof children === 'function') {
root.children = children(controlProps);
}
return {
orientation,
validationState,
components: {
root: 'div',
label: react_label_1.Label,
validationMessage: 'div',
validationMessageIcon: 'span',
hint: 'div'
},
root,
label,
validationMessageIcon,
validationMessage,
hint
};
};
exports.useField_unstable = useField_unstable;
//# sourceMappingURL=useField.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
fieldClassNames: ()=>fieldClassNames,
useFieldStyles_unstable: ()=>useFieldStyles_unstable
});
const _react = require("@griffel/react");
const fieldClassNames = {
root: `fui-Field`,
label: `fui-Field__label`,
validationMessage: `fui-Field__validationMessage`,
validationMessageIcon: `fui-Field__validationMessageIcon`,
hint: `fui-Field__hint`
exports.useFieldStyles_unstable = exports.fieldClassNames = void 0;
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
const react_1 = /*#__PURE__*/require("@griffel/react");
exports.fieldClassNames = {
root: `fui-Field`,
label: `fui-Field__label`,
validationMessage: `fui-Field__validationMessage`,
validationMessageIcon: `fui-Field__validationMessageIcon`,
hint: `fui-Field__hint`
};

@@ -27,129 +20,95 @@ // Size of the icon in the validation message

* Styles for the root slot
*/ const useRootStyles = /*#__PURE__*/ (0, _react["__styles"])({
base: {
mc9l5x: "f13qh94s"
},
horizontal: {
Budl1dq: "f2wwaib",
wkccdc: "f1645dqt"
},
horizontalNoLabel: {
uwmqm3: [
"f15jqgz8",
"fggqkej"
],
Budl1dq: "f1c2z91y"
}
*/
const useRootStyles = /*#__PURE__*/react_1.__styles({
base: {
mc9l5x: "f13qh94s"
},
horizontal: {
Budl1dq: "f2wwaib",
wkccdc: "f1645dqt"
},
horizontalNoLabel: {
uwmqm3: ["f15jqgz8", "fggqkej"],
Budl1dq: "f1c2z91y"
}
}, {
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;}"
]
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;}"]
});
const useLabelStyles = /*#__PURE__*/ (0, _react["__styles"])({
base: {
z8tnut: "fclwglc",
Byoj8tv: "fywfov9"
},
large: {
z8tnut: "f1sl3k7w",
Byoj8tv: "f1brlhvm"
},
vertical: {
jrapky: "fyacil5"
},
verticalLarge: {
jrapky: "f8l5zjj"
},
horizontal: {
t21cq0: [
"fkujibs",
"f199hnxi"
],
Ijaq50: "f16hsg94",
nk6f5a: "f1nzqi2z"
}
const useLabelStyles = /*#__PURE__*/react_1.__styles({
base: {
z8tnut: "fclwglc",
Byoj8tv: "fywfov9"
},
large: {
z8tnut: "f1sl3k7w",
Byoj8tv: "f1brlhvm"
},
vertical: {
jrapky: "fyacil5"
},
verticalLarge: {
jrapky: "f8l5zjj"
},
horizontal: {
t21cq0: ["fkujibs", "f199hnxi"],
Ijaq50: "f16hsg94",
nk6f5a: "f1nzqi2z"
}
}, {
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;}"
]
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;}"]
});
const useSecondaryTextBaseClassName = /*#__PURE__*/ (0, _react["__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);}"
]);
const useSecondaryTextStyles = /*#__PURE__*/ (0, _react["__styles"])({
error: {
sj55zd: "f1hcrxcs"
},
withIcon: {
uwmqm3: [
"frawy03",
"fg4c52"
]
}
const useSecondaryTextBaseClassName = /*#__PURE__*/react_1.__resetStyles("r5c4z9l", null, [".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
const useSecondaryTextStyles = /*#__PURE__*/react_1.__styles({
error: {
sj55zd: "f1hcrxcs"
},
withIcon: {
uwmqm3: ["frawy03", "fg4c52"]
}
}, {
d: [
".f1hcrxcs{color:var(--colorPaletteRedForeground1);}",
".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}",
".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"
]
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}", ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"]
});
const useValidationMessageIconBaseClassName = /*#__PURE__*/ (0, _react["__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;}"
]);
const useValidationMessageIconStyles = /*#__PURE__*/ (0, _react["__styles"])({
error: {
sj55zd: "f1hcrxcs"
},
warning: {
sj55zd: "f1k5f75o"
},
success: {
sj55zd: "ffmvakt"
}
const useValidationMessageIconBaseClassName = /*#__PURE__*/react_1.__resetStyles("ra7h1uk", "r1rh6bd7", [".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}", ".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}"]);
const useValidationMessageIconStyles = /*#__PURE__*/react_1.__styles({
error: {
sj55zd: "f1hcrxcs"
},
warning: {
sj55zd: "f1k5f75o"
},
success: {
sj55zd: "ffmvakt"
}
}, {
d: [
".f1hcrxcs{color:var(--colorPaletteRedForeground1);}",
".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}",
".ffmvakt{color:var(--colorPaletteGreenForeground1);}"
]
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
});
const useFieldStyles_unstable = (state)=>{
const { validationState } = state;
const horizontal = state.orientation === 'horizontal';
const rootStyles = useRootStyles();
state.root.className = (0, _react.mergeClasses)(fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
const labelStyles = useLabelStyles();
if (state.label) {
state.label.className = (0, _react.mergeClasses)(fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);
}
const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
const validationMessageIconStyles = useValidationMessageIconStyles();
if (state.validationMessageIcon) {
state.validationMessageIcon.className = (0, _react.mergeClasses)(fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
}
const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
const secondaryTextStyles = useSecondaryTextStyles();
if (state.validationMessage) {
state.validationMessage.className = (0, _react.mergeClasses)(fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
}
if (state.hint) {
state.hint.className = (0, _react.mergeClasses)(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
}
}; //# sourceMappingURL=useFieldStyles.js.map
/**
* Apply styling to the Field slots based on the state
*/
const useFieldStyles_unstable = state => {
const {
validationState
} = state;
const horizontal = state.orientation === 'horizontal';
const rootStyles = useRootStyles();
state.root.className = react_1.mergeClasses(exports.fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
const labelStyles = useLabelStyles();
if (state.label) {
state.label.className = react_1.mergeClasses(exports.fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);
}
const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
const validationMessageIconStyles = useValidationMessageIconStyles();
if (state.validationMessageIcon) {
state.validationMessageIcon.className = react_1.mergeClasses(exports.fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
}
const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
const secondaryTextStyles = useSecondaryTextStyles();
if (state.validationMessage) {
state.validationMessage.className = react_1.mergeClasses(exports.fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
}
if (state.hint) {
state.hint.className = react_1.mergeClasses(exports.fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
}
};
exports.useFieldStyles_unstable = useFieldStyles_unstable;
//# sourceMappingURL=useFieldStyles.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
_exportStar(require("./components/Field/index"), exports);
//# sourceMappingURL=Field.js.map
const tslib_1 = /*#__PURE__*/require("tslib");
tslib_1.__exportStar(require("./components/Field/index"), exports);
//# sourceMappingURL=Field.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Field: ()=>_field.Field,
fieldClassNames: ()=>_field.fieldClassNames,
renderField_unstable: ()=>_field.renderField_unstable,
useFieldStyles_unstable: ()=>_field.useFieldStyles_unstable,
useField_unstable: ()=>_field.useField_unstable,
getDeprecatedFieldClassNames: ()=>_makeDeprecatedField.getDeprecatedFieldClassNames,
makeDeprecatedField: ()=>_makeDeprecatedField.makeDeprecatedField
exports.makeDeprecatedField = exports.getDeprecatedFieldClassNames = exports.useField_unstable = exports.useFieldStyles_unstable = exports.renderField_unstable = exports.fieldClassNames = exports.Field = void 0;
var Field_1 = /*#__PURE__*/require("./Field");
Object.defineProperty(exports, "Field", {
enumerable: true,
get: function () {
return Field_1.Field;
}
});
const _field = require("./Field");
const _makeDeprecatedField = require("./util/makeDeprecatedField");
//# sourceMappingURL=index.js.map
Object.defineProperty(exports, "fieldClassNames", {
enumerable: true,
get: function () {
return Field_1.fieldClassNames;
}
});
Object.defineProperty(exports, "renderField_unstable", {
enumerable: true,
get: function () {
return Field_1.renderField_unstable;
}
});
Object.defineProperty(exports, "useFieldStyles_unstable", {
enumerable: true,
get: function () {
return Field_1.useFieldStyles_unstable;
}
});
Object.defineProperty(exports, "useField_unstable", {
enumerable: true,
get: function () {
return Field_1.useField_unstable;
}
});
// eslint-disable-next-line deprecation/deprecation
var makeDeprecatedField_1 = /*#__PURE__*/require("./util/makeDeprecatedField");
Object.defineProperty(exports, "getDeprecatedFieldClassNames", {
enumerable: true,
get: function () {
return makeDeprecatedField_1.getDeprecatedFieldClassNames;
}
});
Object.defineProperty(exports, "makeDeprecatedField", {
enumerable: true,
get: function () {
return makeDeprecatedField_1.makeDeprecatedField;
}
});
//# sourceMappingURL=index.js.map

@@ -1,63 +0,79 @@

/* eslint-disable deprecation/deprecation */ "use strict";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
makeDeprecatedField: ()=>makeDeprecatedField,
getDeprecatedFieldClassNames: ()=>getDeprecatedFieldClassNames
});
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _extends = require("@swc/helpers/lib/_extends.js").default;
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
const _field = require("../Field");
exports.getDeprecatedFieldClassNames = exports.makeDeprecatedField = void 0;
/* eslint-disable deprecation/deprecation */
const React = /*#__PURE__*/require("react");
const Field_1 = /*#__PURE__*/require("../Field");
/**
* Partition the props used by the Field itself, from the props that are passed to the underlying field component.
*/ function getPartitionedFieldProps(props) {
const { className , control , hint , label , orientation , required , root , size , style , validationMessage , validationMessageIcon , validationState ='none' , ...restOfProps } = props;
return [
{
className,
hint,
label,
orientation,
required,
size,
style,
validationMessage,
validationMessageIcon,
validationState,
...root
},
{
required,
size,
...restOfProps,
...control
}
];
*/
function getPartitionedFieldProps(props) {
const {
className,
control,
hint,
label,
orientation,
required,
root,
size,
style,
validationMessage,
validationMessageIcon,
validationState = 'none',
...restOfProps
} = props;
return [{
className,
hint,
label,
orientation,
required,
size,
style,
validationMessage,
validationMessageIcon,
validationState,
...root
}, {
required,
size,
...restOfProps,
...control
}];
}
function makeDeprecatedField(Control) {
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const { mapProps =(props)=>props , displayName =`${Control.displayName}Field` } = options;
const DeprecatedField = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
return /*#__PURE__*/ _react.createElement(_field.Field, _extends({}, fieldProps), /*#__PURE__*/ _react.createElement(Control, _extends({}, controlProps, {
ref: ref
})));
});
DeprecatedField.displayName = displayName;
return DeprecatedField;
/**
* @deprecated Only for use to make deprecated [Control]Field shim components.
* @internal
*/
function makeDeprecatedField(Control, options = {}) {
const {
mapProps = props => props,
displayName = `${Control.displayName}Field`
} = options;
const DeprecatedField = React.forwardRef((props, ref) => {
const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
return React.createElement(Field_1.Field, {
...fieldProps
}, React.createElement(Control, {
...controlProps,
ref: ref
}));
});
DeprecatedField.displayName = displayName;
return DeprecatedField;
}
const getDeprecatedFieldClassNames = (controlRootClassName)=>({
..._field.fieldClassNames,
control: controlRootClassName
}); //# sourceMappingURL=makeDeprecatedField.js.map
exports.makeDeprecatedField = makeDeprecatedField;
/**
* @deprecated Only for use to make deprecated [Control]Field shim components.
* @internal
*/
const getDeprecatedFieldClassNames = controlRootClassName => ({
...Field_1.fieldClassNames,
control: controlRootClassName
});
exports.getDeprecatedFieldClassNames = getDeprecatedFieldClassNames;
//# sourceMappingURL=makeDeprecatedField.js.map

@@ -1,2 +0,2 @@

import * as React from 'react';
export {};
//# sourceMappingURL=Field.types.js.map

@@ -1,2 +0,1 @@

import _extends from "@swc/helpers/src/_extends.mjs";
import * as React from 'react';

@@ -12,4 +11,14 @@ import { getSlots } from '@fluentui/react-utilities';

} = getSlots(state);
return /*#__PURE__*/React.createElement(slots.root, _extends({}, slotProps.root), slots.label && /*#__PURE__*/React.createElement(slots.label, _extends({}, slotProps.label)), slotProps.root.children, slots.validationMessage && /*#__PURE__*/React.createElement(slots.validationMessage, _extends({}, slotProps.validationMessage), slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, _extends({}, slotProps.validationMessageIcon)), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/React.createElement(slots.hint, _extends({}, slotProps.hint)));
return /*#__PURE__*/React.createElement(slots.root, {
...slotProps.root
}, slots.label && /*#__PURE__*/React.createElement(slots.label, {
...slotProps.label
}), slotProps.root.children, slots.validationMessage && /*#__PURE__*/React.createElement(slots.validationMessage, {
...slotProps.validationMessage
}, slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, {
...slotProps.validationMessageIcon
}), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/React.createElement(slots.hint, {
...slotProps.hint
}));
};
//# sourceMappingURL=renderField.js.map

@@ -1,4 +0,1 @@

var _controlProps, _arialabelledby,
// Assign the child a generated ID if doesn't already have an ID
_controlProps1, _controlProps2, _ariainvalid, _controlProps3, _ariarequired;
import * as React from 'react';

@@ -24,2 +21,3 @@ import { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';

export const useField_unstable = (props, ref) => {
var _a, _b, _c, _d;
const {

@@ -42,4 +40,6 @@ children,

size
// htmlFor is handled below
}
});
const validationMessage = resolveShorthand(props.validationMessage, {

@@ -63,9 +63,10 @@ defaultProps: {

});
const controlProps = /*#__PURE__*/ /*#__PURE__*/React.isValidElement(children) ? {
const controlProps = /*#__PURE__*/React.isValidElement(children) ? {
...children.props
} : {};
if (label) {
(_controlProps = controlProps)[_arialabelledby = 'aria-labelledby'] ?? (_controlProps[_arialabelledby] = label.id);
(_a = controlProps['aria-labelledby']) !== null && _a !== void 0 ? _a : controlProps['aria-labelledby'] = label.id;
if (!label.htmlFor) {
(_controlProps1 = controlProps).id ?? (_controlProps1.id = baseId + '__control');
// Assign the child a generated ID if doesn't already have an ID
(_b = controlProps.id) !== null && _b !== void 0 ? _b : controlProps.id = baseId + '__control';
label.htmlFor = controlProps.id;

@@ -81,6 +82,6 @@ }

if (validationState === 'error') {
(_controlProps2 = controlProps)[_ariainvalid = 'aria-invalid'] ?? (_controlProps2[_ariainvalid] = true);
(_c = controlProps['aria-invalid']) !== null && _c !== void 0 ? _c : controlProps['aria-invalid'] = true;
}
if (required) {
(_controlProps3 = controlProps)[_ariarequired = 'aria-required'] ?? (_controlProps3[_ariarequired] = true);
(_d = controlProps['aria-required']) !== null && _d !== void 0 ? _d : controlProps['aria-required'] = true;
}

@@ -87,0 +88,0 @@ if ( /*#__PURE__*/React.isValidElement(children)) {

@@ -1,2 +0,2 @@

/* eslint-disable deprecation/deprecation */import _extends from "@swc/helpers/src/_extends.mjs";
/* eslint-disable deprecation/deprecation */
import * as React from 'react';

@@ -46,4 +46,3 @@ import { Field, fieldClassNames } from '../Field';

*/
export function makeDeprecatedField(Control) {
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
export function makeDeprecatedField(Control, options = {}) {
const {

@@ -55,5 +54,8 @@ mapProps = props => props,

const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
return /*#__PURE__*/React.createElement(Field, _extends({}, fieldProps), /*#__PURE__*/React.createElement(Control, _extends({}, controlProps, {
return /*#__PURE__*/React.createElement(Field, {
...fieldProps
}, /*#__PURE__*/React.createElement(Control, {
...controlProps,
ref: ref
})));
}));
});

@@ -60,0 +62,0 @@ DeprecatedField.displayName = displayName;

{
"name": "@fluentui/react-field",
"version": "0.0.0-nightly-20230223-2115.1",
"version": "0.0.0-nightly-20230227-0424.1",
"description": "Fluent UI Field components",

@@ -25,3 +25,3 @@ "main": "lib-commonjs/index.js",

"type-check": "tsc -b tsconfig.json",
"generate-api": "just-scripts generate-api"
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
},

@@ -31,3 +31,3 @@ "devDependencies": {

"@fluentui/react-conformance": "*",
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230223-2115.1",
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230227-0424.1",
"@fluentui/scripts-api-extractor": "*",

@@ -37,9 +37,9 @@ "@fluentui/scripts-tasks": "*"

"dependencies": {
"@fluentui/react-context-selector": "0.0.0-nightly-20230223-2115.1",
"@fluentui/react-context-selector": "0.0.0-nightly-20230227-0424.1",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/react-label": "0.0.0-nightly-20230223-2115.1",
"@fluentui/react-theme": "0.0.0-nightly-20230223-2115.1",
"@fluentui/react-utilities": "0.0.0-nightly-20230223-2115.1",
"@fluentui/react-label": "0.0.0-nightly-20230227-0424.1",
"@fluentui/react-theme": "0.0.0-nightly-20230227-0424.1",
"@fluentui/react-utilities": "0.0.0-nightly-20230227-0424.1",
"@griffel/react": "^1.5.2",
"@swc/helpers": "^0.4.14"
"tslib": "^2.1.0"
},

@@ -46,0 +46,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc