@moda/om 21.6.10 → 21.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +21 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Field/FormControlContext.d.ts +6 -0
- package/dist/src/components/Field/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Field/Field.tsx +46 -41
- package/src/components/Field/FormControlContext.tsx +11 -0
- package/src/components/Field/index.ts +1 -0
- package/src/components/Select/Select.tsx +3 -1
package/dist/index.esm.js
CHANGED
|
@@ -9991,6 +9991,13 @@ var ChevronUp12 = function ChevronUp12(_a) {
|
|
|
9991
9991
|
};
|
|
9992
9992
|
ChevronUp12.displayName = 'ChevronUp12';
|
|
9993
9993
|
|
|
9994
|
+
var FormControlContext = /*#__PURE__*/createContext({
|
|
9995
|
+
displaysError: false
|
|
9996
|
+
});
|
|
9997
|
+
var useFormControlContext = function useFormControlContext() {
|
|
9998
|
+
return useContext(FormControlContext);
|
|
9999
|
+
};
|
|
10000
|
+
|
|
9994
10001
|
var dist$1 = {};
|
|
9995
10002
|
|
|
9996
10003
|
var mapCursorToMax = {};
|
|
@@ -10824,6 +10831,8 @@ var Select = function Select(_ref) {
|
|
|
10824
10831
|
_ref$smallMobileText = _ref.smallMobileText,
|
|
10825
10832
|
smallMobileText = _ref$smallMobileText === void 0 ? false : _ref$smallMobileText,
|
|
10826
10833
|
rest = _objectWithoutProperties(_ref, _excluded$j);
|
|
10834
|
+
var _useFormControlContex = useFormControlContext(),
|
|
10835
|
+
errorDisplayedByParent = _useFormControlContex.displaysError;
|
|
10827
10836
|
var _useSelect = useSelect({
|
|
10828
10837
|
value: value,
|
|
10829
10838
|
defaultValue: defaultValue
|
|
@@ -10943,7 +10952,7 @@ var Select = function Select(_ref) {
|
|
|
10943
10952
|
type: 'CLOSE'
|
|
10944
10953
|
});
|
|
10945
10954
|
}
|
|
10946
|
-
})), typeof error === 'string' && /*#__PURE__*/React__default.createElement("div", {
|
|
10955
|
+
})), typeof error === 'string' && !errorDisplayedByParent && /*#__PURE__*/React__default.createElement("div", {
|
|
10947
10956
|
role: "status",
|
|
10948
10957
|
"aria-live": "polite",
|
|
10949
10958
|
"aria-atomic": "true",
|
|
@@ -11150,7 +11159,14 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
11150
11159
|
label = _ref.label,
|
|
11151
11160
|
placeholder = _ref.placeholder,
|
|
11152
11161
|
rest = _objectWithoutProperties(_ref, _excluded$h);
|
|
11153
|
-
|
|
11162
|
+
var fieldContextValue = useMemo(function () {
|
|
11163
|
+
return {
|
|
11164
|
+
displaysError: Boolean(error)
|
|
11165
|
+
};
|
|
11166
|
+
}, [error]);
|
|
11167
|
+
return /*#__PURE__*/React__default.createElement(FormControlContext.Provider, {
|
|
11168
|
+
value: fieldContextValue
|
|
11169
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
11154
11170
|
className: classNames('Field', className)
|
|
11155
11171
|
}, label && /*#__PURE__*/React__default.createElement("span", {
|
|
11156
11172
|
className: "Field__label"
|
|
@@ -11173,7 +11189,7 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
11173
11189
|
className: "Field__icon"
|
|
11174
11190
|
}, /*#__PURE__*/React__default.createElement(Warning16, null)))), error && /*#__PURE__*/React__default.createElement("span", {
|
|
11175
11191
|
className: "Field__error"
|
|
11176
|
-
}, error));
|
|
11192
|
+
}, error)));
|
|
11177
11193
|
});
|
|
11178
11194
|
Field.displayName = 'Field';
|
|
11179
11195
|
|
|
@@ -12727,4 +12743,4 @@ var Utilities = {
|
|
|
12727
12743
|
States: States
|
|
12728
12744
|
};
|
|
12729
12745
|
|
|
12730
|
-
export { ArcWindow, AspectRatioBox, Badge, Bradley, Brancusi, Breadcrumb, Breadcrumbs, Breakpoint, BreakpointContext, BreakpointProvider, Button, Checkbox, Circle, Clickable, ColorSwatch, ConfirmProvider, Constrain, ControlLink, CreditCardNumberInput, DEFAULT_PRODUCT_ASPECT_HEIGHT, DEFAULT_PRODUCT_ASPECT_RATIO, DEFAULT_PRODUCT_ASPECT_WIDTH, DefinitionList, Dialog, Diamond, Divider, ExceedConstrain, Expandable, Field, FocusOn, Field as Input, Keyhole, Label, LineAboveDivider, Loading, LoadingBalls, LoadingItems1, LoadingItems2, LoadingItems3, LoadingItems4, LoadingItems5, LoadingItemsLavenderBlue1, LoadingItemsLavenderBlue2, LoadingItemsLavenderBlue3, LoadingItemsLavenderBlue4, LoadingItemsLavenderBlue5, LoadingShapes, LoadingShapesLavenderBlue, LoadingShapesPinkGreen, Mirror, Modal, ModalOverlay, MultiSelect, NoLineDivider, Oval, Overlay, POPOVER_MOUSEOUT_DELAY_MS, Paginator, PasswordInput, Popover, PromoBanner, RadioButton, SKU_COLORS, SearchInput, Select, SelectableButton, SlidingPane, Stack, Tab, TabList, TabPanel, TabPanels, Tabs, Tag, Text, TextInput, Textarea, Toast, Triangle, TwoLineDivider, UNMOUNT_DELAY_MS, Utilities, VerticalDivider, Window, discriminate, tokens, useBreakpoint, useClickOutside, useConfirm, useKeyboardListNavigation, useUpdateEffect };
|
|
12746
|
+
export { ArcWindow, AspectRatioBox, Badge, Bradley, Brancusi, Breadcrumb, Breadcrumbs, Breakpoint, BreakpointContext, BreakpointProvider, Button, Checkbox, Circle, Clickable, ColorSwatch, ConfirmProvider, Constrain, ControlLink, CreditCardNumberInput, DEFAULT_PRODUCT_ASPECT_HEIGHT, DEFAULT_PRODUCT_ASPECT_RATIO, DEFAULT_PRODUCT_ASPECT_WIDTH, DefinitionList, Dialog, Diamond, Divider, ExceedConstrain, Expandable, Field, FocusOn, FormControlContext, Field as Input, Keyhole, Label, LineAboveDivider, Loading, LoadingBalls, LoadingItems1, LoadingItems2, LoadingItems3, LoadingItems4, LoadingItems5, LoadingItemsLavenderBlue1, LoadingItemsLavenderBlue2, LoadingItemsLavenderBlue3, LoadingItemsLavenderBlue4, LoadingItemsLavenderBlue5, LoadingShapes, LoadingShapesLavenderBlue, LoadingShapesPinkGreen, Mirror, Modal, ModalOverlay, MultiSelect, NoLineDivider, Oval, Overlay, POPOVER_MOUSEOUT_DELAY_MS, Paginator, PasswordInput, Popover, PromoBanner, RadioButton, SKU_COLORS, SearchInput, Select, SelectableButton, SlidingPane, Stack, Tab, TabList, TabPanel, TabPanels, Tabs, Tag, Text, TextInput, Textarea, Toast, Triangle, TwoLineDivider, UNMOUNT_DELAY_MS, Utilities, VerticalDivider, Window, discriminate, tokens, useBreakpoint, useClickOutside, useConfirm, useFormControlContext, useKeyboardListNavigation, useUpdateEffect };
|