@simplybusiness/mobius 10.4.2 → 10.4.4
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/CHANGELOG.md +17 -0
- package/dist/cjs/components/AddressLookup/AddressLookup.js +39 -36
- package/dist/cjs/components/AddressLookup/AddressLookup.js.map +3 -3
- package/dist/cjs/components/AddressLookup/index.js +39 -36
- package/dist/cjs/components/AddressLookup/index.js.map +3 -3
- package/dist/cjs/components/Breadcrumbs/Breadcrumbs.js +3 -7
- package/dist/cjs/components/Breadcrumbs/Breadcrumbs.js.map +2 -2
- package/dist/cjs/components/Breadcrumbs/index.js +3 -7
- package/dist/cjs/components/Breadcrumbs/index.js.map +2 -2
- package/dist/cjs/components/Combobox/Combobox.js +35 -32
- package/dist/cjs/components/Combobox/Combobox.js.map +3 -3
- package/dist/cjs/components/Combobox/index.js +35 -32
- package/dist/cjs/components/Combobox/index.js.map +3 -3
- package/dist/cjs/components/DateField/DateField.js +11 -8
- package/dist/cjs/components/DateField/DateField.js.map +3 -3
- package/dist/cjs/components/DateField/index.js +11 -8
- package/dist/cjs/components/DateField/index.js.map +3 -3
- package/dist/cjs/components/DropdownMenu/Item.js +3 -6
- package/dist/cjs/components/DropdownMenu/Item.js.map +2 -2
- package/dist/cjs/components/DropdownMenu/index.js +3 -6
- package/dist/cjs/components/DropdownMenu/index.js.map +2 -2
- package/dist/cjs/components/MaskedField/MaskedField.js +11 -8
- package/dist/cjs/components/MaskedField/MaskedField.js.map +3 -3
- package/dist/cjs/components/MaskedField/index.js +13 -10
- package/dist/cjs/components/MaskedField/index.js.map +3 -3
- package/dist/cjs/components/NumberField/NumberField.js +10 -7
- package/dist/cjs/components/NumberField/NumberField.js.map +3 -3
- package/dist/cjs/components/NumberField/index.js +10 -7
- package/dist/cjs/components/NumberField/index.js.map +3 -3
- package/dist/cjs/components/PasswordField/PasswordField.js +9 -6
- package/dist/cjs/components/PasswordField/PasswordField.js.map +3 -3
- package/dist/cjs/components/PasswordField/index.js +9 -6
- package/dist/cjs/components/PasswordField/index.js.map +3 -3
- package/dist/cjs/components/Popover/Arrow.js +43 -0
- package/dist/cjs/components/Popover/Arrow.js.map +7 -0
- package/dist/cjs/components/Popover/Popover.js +258 -83
- package/dist/cjs/components/Popover/Popover.js.map +4 -4
- package/dist/cjs/components/Popover/index.js +258 -83
- package/dist/cjs/components/Popover/index.js.map +4 -4
- package/dist/cjs/components/Popover/useAutoUpdate.js +53 -0
- package/dist/cjs/components/Popover/useAutoUpdate.js.map +7 -0
- package/dist/cjs/components/Popover/useFloatingPosition.js +128 -0
- package/dist/cjs/components/Popover/useFloatingPosition.js.map +7 -0
- package/dist/cjs/components/Popover/useOutsidePress.js +46 -0
- package/dist/cjs/components/Popover/useOutsidePress.js.map +7 -0
- package/dist/cjs/components/TextField/TextField.js +6 -3
- package/dist/cjs/components/TextField/TextField.js.map +3 -3
- package/dist/cjs/components/TextField/adornmentWithClassName.js +3 -2
- package/dist/cjs/components/TextField/adornmentWithClassName.js.map +2 -2
- package/dist/cjs/components/TextField/index.js +6 -3
- package/dist/cjs/components/TextField/index.js.map +3 -3
- package/dist/cjs/components/index.js +550 -377
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/index.js +550 -377
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/meta.json +490 -121
- package/dist/esm/chunk-26KZYRE6.js +108 -0
- package/dist/esm/chunk-26KZYRE6.js.map +7 -0
- package/dist/esm/{chunk-XNEQHHNV.js → chunk-5QMKPWB4.js} +2 -2
- package/dist/esm/{chunk-IQKS662C.js → chunk-6RDK3FM2.js} +5 -3
- package/dist/esm/chunk-6RDK3FM2.js.map +7 -0
- package/dist/esm/{chunk-4HI2AOBC.js → chunk-6TSYA7CJ.js} +4 -7
- package/dist/esm/{chunk-4HI2AOBC.js.map → chunk-6TSYA7CJ.js.map} +2 -2
- package/dist/esm/chunk-CAL44W47.js +23 -0
- package/dist/esm/chunk-CAL44W47.js.map +7 -0
- package/dist/esm/{chunk-PEEQNAIN.js → chunk-DMYDWKKA.js} +4 -4
- package/dist/esm/{chunk-IM3I5CZL.js → chunk-I6CFRGID.js} +4 -3
- package/dist/esm/{chunk-IM3I5CZL.js.map → chunk-I6CFRGID.js.map} +2 -2
- package/dist/esm/chunk-K3ECDAUR.js +33 -0
- package/dist/esm/chunk-K3ECDAUR.js.map +7 -0
- package/dist/esm/{chunk-GJBH37DH.js → chunk-KFHPI67N.js} +4 -4
- package/dist/esm/{chunk-OEDU5ZEA.js → chunk-KUH5AB5T.js} +2 -2
- package/dist/esm/{chunk-JFDDW3IV.js → chunk-P7TPNRU4.js} +4 -8
- package/dist/esm/{chunk-JFDDW3IV.js.map → chunk-P7TPNRU4.js.map} +2 -2
- package/dist/esm/{chunk-F5ELD54X.js → chunk-QNOBB5HT.js} +2 -2
- package/dist/esm/{chunk-GV36OVX7.js → chunk-R67C5QTH.js} +2 -2
- package/dist/esm/{chunk-S4CU4XRB.js → chunk-VGFVSRWH.js} +2 -2
- package/dist/esm/chunk-VZ3IWSK6.js +158 -0
- package/dist/esm/chunk-VZ3IWSK6.js.map +7 -0
- package/dist/esm/{chunk-X4CMSAET.js → chunk-WSQWMVA2.js} +2 -2
- package/dist/esm/chunk-WYJP7HVL.js +26 -0
- package/dist/esm/chunk-WYJP7HVL.js.map +7 -0
- package/dist/esm/{chunk-OAG5T7NC.js → chunk-XEP6X7JU.js} +5 -5
- package/dist/esm/chunk-XEP6X7JU.js.map +7 -0
- package/dist/esm/components/AddressLookup/AddressLookup.js +6 -6
- package/dist/esm/components/AddressLookup/index.js +8 -8
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/components/Breadcrumbs/index.js +3 -3
- package/dist/esm/components/Checkbox/index.js +1 -1
- package/dist/esm/components/Combobox/Combobox.js +5 -5
- package/dist/esm/components/Combobox/index.js +5 -5
- package/dist/esm/components/DateField/DateField.js +3 -3
- package/dist/esm/components/DateField/index.js +3 -3
- package/dist/esm/components/Drawer/index.js +3 -3
- package/dist/esm/components/DropdownMenu/Item.js +1 -1
- package/dist/esm/components/DropdownMenu/index.js +2 -2
- package/dist/esm/components/MaskedField/MaskedField.js +2 -2
- package/dist/esm/components/MaskedField/index.js +3 -3
- package/dist/esm/components/Modal/index.js +3 -3
- package/dist/esm/components/NumberField/NumberField.js +3 -3
- package/dist/esm/components/NumberField/index.js +3 -3
- package/dist/esm/components/PasswordField/PasswordField.js +3 -3
- package/dist/esm/components/PasswordField/index.js +3 -3
- package/dist/esm/components/Popover/Arrow.js +8 -0
- package/dist/esm/components/Popover/Arrow.js.map +7 -0
- package/dist/esm/components/Popover/Popover.js +5 -1
- package/dist/esm/components/Popover/index.js +5 -1
- package/dist/esm/components/Popover/useAutoUpdate.js +8 -0
- package/dist/esm/components/Popover/useAutoUpdate.js.map +7 -0
- package/dist/esm/components/Popover/useFloatingPosition.js +8 -0
- package/dist/esm/components/Popover/useFloatingPosition.js.map +7 -0
- package/dist/esm/components/Popover/useOutsidePress.js +8 -0
- package/dist/esm/components/Popover/useOutsidePress.js.map +7 -0
- package/dist/esm/components/TextField/TextField.js +2 -2
- package/dist/esm/components/TextField/adornmentWithClassName.js +1 -1
- package/dist/esm/components/TextField/index.js +2 -2
- package/dist/esm/components/index.js +81 -77
- package/dist/esm/index.js +81 -77
- package/dist/esm/meta.json +3495 -3149
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/Accordion/Accordion.d.ts +4 -4
- package/dist/types/components/Accordion/AccordionList.d.ts +4 -4
- package/dist/types/components/AddressLookup/AddressLookup.d.ts +4 -4
- package/dist/types/components/AddressLookup/LoqateAddressLookupService.d.ts +1 -1
- package/dist/types/components/Alert/Alert.d.ts +4 -4
- package/dist/types/components/Box/Box.d.ts +4 -4
- package/dist/types/components/Breadcrumbs/BreadcrumbItem.d.ts +4 -4
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/types/components/Button/Button.d.ts +4 -4
- package/dist/types/components/Checkbox/Checkbox.d.ts +4 -4
- package/dist/types/components/Checkbox/CheckboxGroup.d.ts +4 -4
- package/dist/types/components/Combobox/Combobox.d.ts +2 -5
- package/dist/types/components/Combobox/useComboboxOptions.d.ts +1 -1
- package/dist/types/components/Container/Container.d.ts +4 -4
- package/dist/types/components/DateField/DateField.d.ts +4 -4
- package/dist/types/components/Divider/Divider.d.ts +4 -4
- package/dist/types/components/Drawer/Content.d.ts +4 -4
- package/dist/types/components/Drawer/Drawer.d.ts +4 -4
- package/dist/types/components/Drawer/Header.d.ts +4 -4
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +4 -4
- package/dist/types/components/DropdownMenu/Item.d.ts +4 -4
- package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +4 -4
- package/dist/types/components/ExpandableText/ExpandableText.d.ts +4 -4
- package/dist/types/components/Fieldset/Fieldset.d.ts +4 -4
- package/dist/types/components/Flex/Flex.d.ts +4 -4
- package/dist/types/components/Grid/Grid.d.ts +4 -4
- package/dist/types/components/Grid/Item.d.ts +4 -4
- package/dist/types/components/Image/Image.d.ts +4 -4
- package/dist/types/components/Label/Label.d.ts +4 -4
- package/dist/types/components/Link/Link.d.ts +4 -4
- package/dist/types/components/List/List.d.ts +4 -4
- package/dist/types/components/List/ListItem.d.ts +4 -4
- package/dist/types/components/LoadingIndicator/LoadingIndicator.d.ts +4 -4
- package/dist/types/components/Logo/Logo.d.ts +4 -4
- package/dist/types/components/MaskedField/MaskedField.d.ts +4 -4
- package/dist/types/components/Modal/Content.d.ts +4 -4
- package/dist/types/components/Modal/Header.d.ts +4 -4
- package/dist/types/components/Modal/Modal.d.ts +4 -4
- package/dist/types/components/NumberField/NumberField.d.ts +4 -4
- package/dist/types/components/Option/Option.d.ts +4 -4
- package/dist/types/components/PasswordField/PasswordField.d.ts +4 -4
- package/dist/types/components/Popover/Arrow.d.ts +9 -0
- package/dist/types/components/Popover/useAutoUpdate.d.ts +9 -0
- package/dist/types/components/Popover/useFloatingPosition.d.ts +17 -0
- package/dist/types/components/Popover/useOutsidePress.d.ts +9 -0
- package/dist/types/components/Progress/Progress.d.ts +4 -4
- package/dist/types/components/Radio/Radio.d.ts +4 -4
- package/dist/types/components/Radio/RadioGroup.d.ts +4 -4
- package/dist/types/components/SVG/SVG.d.ts +4 -4
- package/dist/types/components/Segment/Segment.d.ts +4 -4
- package/dist/types/components/Segment/SegmentGroup.d.ts +4 -4
- package/dist/types/components/Select/Select.d.ts +4 -4
- package/dist/types/components/Stack/Stack.d.ts +4 -4
- package/dist/types/components/Switch/Switch.d.ts +4 -4
- package/dist/types/components/Table/Body.d.ts +4 -4
- package/dist/types/components/Table/Cell.d.ts +4 -4
- package/dist/types/components/Table/Foot.d.ts +4 -4
- package/dist/types/components/Table/Head.d.ts +4 -4
- package/dist/types/components/Table/HeaderCell.d.ts +4 -4
- package/dist/types/components/Table/Row.d.ts +4 -4
- package/dist/types/components/Table/Table.d.ts +4 -4
- package/dist/types/components/Text/Text.d.ts +4 -4
- package/dist/types/components/TextArea/TextArea.d.ts +4 -4
- package/dist/types/components/TextAreaInput/TextAreaInput.d.ts +4 -4
- package/dist/types/components/TextField/TextField.d.ts +1 -4
- package/dist/types/components/TextField/adornmentWithClassName.d.ts +3 -1
- package/dist/types/components/TextOrHTML/TextOrHTML.d.ts +4 -4
- package/dist/types/components/Title/Title.d.ts +4 -4
- package/dist/types/components/Toast/ToastOptionsDoc.d.ts +4 -8
- package/dist/types/components/Toast/Toaster.d.ts +4 -4
- package/dist/types/hooks/useButton/useButton.d.ts +5 -5
- package/dist/types/hooks/useLabel/useLabel.d.ts +1 -1
- package/package.json +11 -11
- package/src/components/Box/Box.test.tsx +1 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +3 -7
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Combobox/Combobox.tsx +2 -4
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +1 -1
- package/src/components/DropdownMenu/Item.tsx +3 -6
- package/src/components/Grid/Grid.stories.tsx +1 -1
- package/src/components/Popover/Arrow.tsx +25 -0
- package/src/components/Popover/Popover.characterization.test.tsx +269 -0
- package/src/components/Popover/Popover.stories.tsx +40 -3
- package/src/components/Popover/Popover.test.tsx +6 -2
- package/src/components/Popover/Popover.tsx +87 -81
- package/src/components/Popover/useAutoUpdate.ts +43 -0
- package/src/components/Popover/useFloatingPosition.ts +177 -0
- package/src/components/Popover/useOutsidePress.ts +31 -0
- package/src/components/TextField/TextField.tsx +3 -1
- package/src/components/TextField/adornmentWithClassName.ts +4 -3
- package/src/hooks/useBreakpoint/useBreakpoint.test.tsx +4 -4
- package/src/styles.d.ts +2 -0
- package/dist/esm/chunk-IQKS662C.js.map +0 -7
- package/dist/esm/chunk-O5YEU5TG.js +0 -155
- package/dist/esm/chunk-O5YEU5TG.js.map +0 -7
- package/dist/esm/chunk-OAG5T7NC.js.map +0 -7
- /package/dist/esm/{chunk-XNEQHHNV.js.map → chunk-5QMKPWB4.js.map} +0 -0
- /package/dist/esm/{chunk-PEEQNAIN.js.map → chunk-DMYDWKKA.js.map} +0 -0
- /package/dist/esm/{chunk-GJBH37DH.js.map → chunk-KFHPI67N.js.map} +0 -0
- /package/dist/esm/{chunk-OEDU5ZEA.js.map → chunk-KUH5AB5T.js.map} +0 -0
- /package/dist/esm/{chunk-F5ELD54X.js.map → chunk-QNOBB5HT.js.map} +0 -0
- /package/dist/esm/{chunk-GV36OVX7.js.map → chunk-R67C5QTH.js.map} +0 -0
- /package/dist/esm/{chunk-S4CU4XRB.js.map → chunk-VGFVSRWH.js.map} +0 -0
- /package/dist/esm/{chunk-X4CMSAET.js.map → chunk-WSQWMVA2.js.map} +0 -0
|
@@ -945,9 +945,10 @@ var init_adornmentWithClassName = __esm({
|
|
|
945
945
|
import_react10 = require("react");
|
|
946
946
|
adornmentWithClassName = (component, validationClasses, className) => {
|
|
947
947
|
if (!component) return null;
|
|
948
|
-
|
|
948
|
+
const typedComponent = component;
|
|
949
|
+
return (0, import_react10.cloneElement)(typedComponent, {
|
|
949
950
|
className: (0, import_dedupe12.default)(
|
|
950
|
-
|
|
951
|
+
typedComponent.props.className,
|
|
951
952
|
validationClasses,
|
|
952
953
|
className
|
|
953
954
|
)
|
|
@@ -957,12 +958,13 @@ var init_adornmentWithClassName = __esm({
|
|
|
957
958
|
});
|
|
958
959
|
|
|
959
960
|
// src/components/TextField/TextField.tsx
|
|
960
|
-
var import_dedupe13, import_TextField, import_jsx_runtime12, TextField;
|
|
961
|
+
var import_dedupe13, import_react11, import_TextField, import_jsx_runtime12, TextFieldInner, TextField;
|
|
961
962
|
var init_TextField = __esm({
|
|
962
963
|
"src/components/TextField/TextField.tsx"() {
|
|
963
964
|
"use strict";
|
|
964
965
|
"use client";
|
|
965
966
|
import_dedupe13 = __toESM(require("classnames/dedupe"));
|
|
967
|
+
import_react11 = require("react");
|
|
966
968
|
init_hooks();
|
|
967
969
|
init_ErrorMessage2();
|
|
968
970
|
init_Label2();
|
|
@@ -970,7 +972,7 @@ var init_TextField = __esm({
|
|
|
970
972
|
init_adornmentWithClassName();
|
|
971
973
|
import_TextField = require("@simplybusiness/mobius/src/components/TextField/TextField.css");
|
|
972
974
|
import_jsx_runtime12 = require("react/jsx-runtime");
|
|
973
|
-
|
|
975
|
+
TextFieldInner = ({ ref, ...props }) => {
|
|
974
976
|
const {
|
|
975
977
|
isDisabled,
|
|
976
978
|
type = "text",
|
|
@@ -1064,6 +1066,7 @@ var init_TextField = __esm({
|
|
|
1064
1066
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorMessage, { ...errorMessageProps, errorMessage })
|
|
1065
1067
|
] });
|
|
1066
1068
|
};
|
|
1069
|
+
TextField = (0, import_react11.memo)(TextFieldInner);
|
|
1067
1070
|
TextField.displayName = "TextField";
|
|
1068
1071
|
}
|
|
1069
1072
|
});
|
|
@@ -1081,17 +1084,17 @@ var MaskedField_exports = {};
|
|
|
1081
1084
|
__export(MaskedField_exports, {
|
|
1082
1085
|
MaskedField: () => MaskedField
|
|
1083
1086
|
});
|
|
1084
|
-
var
|
|
1087
|
+
var import_react51, import_react_imask, import_jsx_runtime76, useAcceptHandler, useCombinedRef, useBlurHandler, ControlledMaskedField, UncontrolledMaskedField, MaskedField;
|
|
1085
1088
|
var init_MaskedField = __esm({
|
|
1086
1089
|
"src/components/MaskedField/MaskedField.tsx"() {
|
|
1087
1090
|
"use strict";
|
|
1088
1091
|
"use client";
|
|
1089
|
-
|
|
1092
|
+
import_react51 = require("react");
|
|
1090
1093
|
import_react_imask = require("react-imask");
|
|
1091
1094
|
init_TextField2();
|
|
1092
|
-
|
|
1095
|
+
import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1093
1096
|
useAcceptHandler = (onChange, useMaskedValue, name) => {
|
|
1094
|
-
return (0,
|
|
1097
|
+
return (0, import_react51.useCallback)(
|
|
1095
1098
|
(maskedValue, maskInstance) => {
|
|
1096
1099
|
if (!onChange) {
|
|
1097
1100
|
return;
|
|
@@ -1107,7 +1110,7 @@ var init_MaskedField = __esm({
|
|
|
1107
1110
|
);
|
|
1108
1111
|
};
|
|
1109
1112
|
useCombinedRef = (imaskRef, forwardedRef) => {
|
|
1110
|
-
return (0,
|
|
1113
|
+
return (0, import_react51.useCallback)(
|
|
1111
1114
|
(element) => {
|
|
1112
1115
|
imaskRef.current = element;
|
|
1113
1116
|
if (typeof forwardedRef === "function") {
|
|
@@ -1120,7 +1123,7 @@ var init_MaskedField = __esm({
|
|
|
1120
1123
|
);
|
|
1121
1124
|
};
|
|
1122
1125
|
useBlurHandler = (onBlur, maskRef, useMaskedValue, name) => {
|
|
1123
|
-
return (0,
|
|
1126
|
+
return (0, import_react51.useCallback)(
|
|
1124
1127
|
(event) => {
|
|
1125
1128
|
if (!onBlur || !maskRef.current) {
|
|
1126
1129
|
return;
|
|
@@ -1150,7 +1153,7 @@ var init_MaskedField = __esm({
|
|
|
1150
1153
|
const { ref: imaskRef, maskRef, setValue } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1151
1154
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1152
1155
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1153
|
-
(0,
|
|
1156
|
+
(0, import_react51.useEffect)(() => {
|
|
1154
1157
|
if (!maskRef.current) {
|
|
1155
1158
|
return;
|
|
1156
1159
|
}
|
|
@@ -1161,7 +1164,7 @@ var init_MaskedField = __esm({
|
|
|
1161
1164
|
setValue(stringValue);
|
|
1162
1165
|
}
|
|
1163
1166
|
}, [value, maskRef, setValue, imaskRef]);
|
|
1164
|
-
return /* @__PURE__ */ (0,
|
|
1167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1165
1168
|
TextField,
|
|
1166
1169
|
{
|
|
1167
1170
|
...textFieldProps,
|
|
@@ -1185,7 +1188,7 @@ var init_MaskedField = __esm({
|
|
|
1185
1188
|
const { ref: imaskRef, maskRef } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1186
1189
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1187
1190
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1188
|
-
return /* @__PURE__ */ (0,
|
|
1191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1189
1192
|
TextField,
|
|
1190
1193
|
{
|
|
1191
1194
|
...textFieldProps,
|
|
@@ -1199,7 +1202,7 @@ var init_MaskedField = __esm({
|
|
|
1199
1202
|
MaskedField = ({ ref: forwardedRef, ...props }) => {
|
|
1200
1203
|
const { value, defaultValue, ...rest } = props;
|
|
1201
1204
|
if ("value" in props) {
|
|
1202
|
-
return /* @__PURE__ */ (0,
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1203
1206
|
ControlledMaskedField,
|
|
1204
1207
|
{
|
|
1205
1208
|
...rest,
|
|
@@ -1208,7 +1211,7 @@ var init_MaskedField = __esm({
|
|
|
1208
1211
|
}
|
|
1209
1212
|
);
|
|
1210
1213
|
} else {
|
|
1211
|
-
return /* @__PURE__ */ (0,
|
|
1214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1212
1215
|
UncontrolledMaskedField,
|
|
1213
1216
|
{
|
|
1214
1217
|
...rest,
|
|
@@ -1662,12 +1665,12 @@ AccordionList.displayName = "AccordionList";
|
|
|
1662
1665
|
|
|
1663
1666
|
// src/components/AddressLookup/AddressLookup.tsx
|
|
1664
1667
|
var import_icons3 = require("@simplybusiness/icons");
|
|
1665
|
-
var
|
|
1668
|
+
var import_react16 = require("react");
|
|
1666
1669
|
|
|
1667
1670
|
// src/components/Combobox/Combobox.tsx
|
|
1668
1671
|
var import_mobius_hooks5 = require("@simplybusiness/mobius-hooks");
|
|
1669
1672
|
var import_dedupe16 = __toESM(require("classnames/dedupe"));
|
|
1670
|
-
var
|
|
1673
|
+
var import_react15 = require("react");
|
|
1671
1674
|
init_hooks();
|
|
1672
1675
|
init_TextField2();
|
|
1673
1676
|
|
|
@@ -1706,7 +1709,7 @@ function VisuallyHidden(props) {
|
|
|
1706
1709
|
var import_dedupe15 = __toESM(require("classnames/dedupe"));
|
|
1707
1710
|
|
|
1708
1711
|
// src/components/Combobox/Option.tsx
|
|
1709
|
-
var
|
|
1712
|
+
var import_react12 = require("react");
|
|
1710
1713
|
var import_dedupe14 = __toESM(require("classnames/dedupe"));
|
|
1711
1714
|
|
|
1712
1715
|
// src/components/Combobox/utils.tsx
|
|
@@ -1741,13 +1744,13 @@ var Option = ({
|
|
|
1741
1744
|
optionTestIdPrefix,
|
|
1742
1745
|
id
|
|
1743
1746
|
}) => {
|
|
1744
|
-
const optionRef = (0,
|
|
1747
|
+
const optionRef = (0, import_react12.useRef)(null);
|
|
1745
1748
|
const optionValue = getOptionValue(option) || "";
|
|
1746
1749
|
const testId = buildOptionTestId(
|
|
1747
1750
|
optionTestIdPrefix || "combobox-option",
|
|
1748
1751
|
optionValue
|
|
1749
1752
|
);
|
|
1750
|
-
(0,
|
|
1753
|
+
(0, import_react12.useEffect)(() => {
|
|
1751
1754
|
if (isHighlighted && optionRef.current && optionRef.current.scrollIntoView) {
|
|
1752
1755
|
optionRef.current.scrollIntoView({ block: "nearest" });
|
|
1753
1756
|
}
|
|
@@ -1851,12 +1854,12 @@ var Listbox = ({
|
|
|
1851
1854
|
};
|
|
1852
1855
|
|
|
1853
1856
|
// src/components/Combobox/useComboboxHighlight.tsx
|
|
1854
|
-
var
|
|
1857
|
+
var import_react13 = require("react");
|
|
1855
1858
|
function useComboboxHighlight(options) {
|
|
1856
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
1859
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react13.useState)(
|
|
1857
1860
|
options && options.length ? 0 : -1
|
|
1858
1861
|
);
|
|
1859
|
-
const [highlightedGroupIndex, setHighlightedGroupIndex] = (0,
|
|
1862
|
+
const [highlightedGroupIndex, setHighlightedGroupIndex] = (0, import_react13.useState)(0);
|
|
1860
1863
|
function highlightNextOption() {
|
|
1861
1864
|
const isGroup = isOptionGroup(options);
|
|
1862
1865
|
if (!options) {
|
|
@@ -1935,7 +1938,7 @@ function useComboboxHighlight(options) {
|
|
|
1935
1938
|
|
|
1936
1939
|
// src/components/Combobox/useComboboxOptions.ts
|
|
1937
1940
|
var import_mobius_hooks4 = require("@simplybusiness/mobius-hooks");
|
|
1938
|
-
var
|
|
1941
|
+
var import_react14 = require("react");
|
|
1939
1942
|
function useComboboxOptions({
|
|
1940
1943
|
options,
|
|
1941
1944
|
asyncOptions,
|
|
@@ -1945,19 +1948,19 @@ function useComboboxOptions({
|
|
|
1945
1948
|
skipNextDebounceRef,
|
|
1946
1949
|
onSearched
|
|
1947
1950
|
}) {
|
|
1948
|
-
const [filteredOptions, setFilteredOptions] = (0,
|
|
1951
|
+
const [filteredOptions, setFilteredOptions] = (0, import_react14.useState)(void 0);
|
|
1949
1952
|
const debouncedInputValue = (0, import_mobius_hooks4.useDebouncedValue)(
|
|
1950
1953
|
inputValue,
|
|
1951
1954
|
// Don't debounce synchronous options
|
|
1952
1955
|
options ? 0 : delay
|
|
1953
1956
|
);
|
|
1954
|
-
const [isLoading, setIsLoading] = (0,
|
|
1955
|
-
const [error3, setError] = (0,
|
|
1956
|
-
const asyncOptionsRef = (0,
|
|
1957
|
+
const [isLoading, setIsLoading] = (0, import_react14.useState)(false);
|
|
1958
|
+
const [error3, setError] = (0, import_react14.useState)(null);
|
|
1959
|
+
const asyncOptionsRef = (0, import_react14.useRef)(asyncOptions);
|
|
1957
1960
|
asyncOptionsRef.current = asyncOptions;
|
|
1958
|
-
const onSearchedRef = (0,
|
|
1961
|
+
const onSearchedRef = (0, import_react14.useRef)(onSearched);
|
|
1959
1962
|
onSearchedRef.current = onSearched;
|
|
1960
|
-
(0,
|
|
1963
|
+
(0, import_react14.useEffect)(() => {
|
|
1961
1964
|
const controller = new AbortController();
|
|
1962
1965
|
const { signal } = controller;
|
|
1963
1966
|
const fetchOptions = async () => {
|
|
@@ -2044,11 +2047,11 @@ var ComboboxInner = ({
|
|
|
2044
2047
|
errorMessage,
|
|
2045
2048
|
...otherProps
|
|
2046
2049
|
} = props;
|
|
2047
|
-
const skipNextDebounceRef = (0,
|
|
2048
|
-
const fallbackRef = (0,
|
|
2049
|
-
const [inputValue, setInputValue] = (0,
|
|
2050
|
-
const [isOpen, setIsOpen] = (0,
|
|
2051
|
-
const [isChanging, setIsChanging] = (0,
|
|
2050
|
+
const skipNextDebounceRef = (0, import_react15.useRef)(false);
|
|
2051
|
+
const fallbackRef = (0, import_react15.useRef)(null);
|
|
2052
|
+
const [inputValue, setInputValue] = (0, import_react15.useState)(defaultValue || "");
|
|
2053
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
|
|
2054
|
+
const [isChanging, setIsChanging] = (0, import_react15.useState)(false);
|
|
2052
2055
|
const { filteredOptions, updateFilteredOptions, isLoading, error: error3 } = useComboboxOptions({
|
|
2053
2056
|
options,
|
|
2054
2057
|
asyncOptions,
|
|
@@ -2057,7 +2060,7 @@ var ComboboxInner = ({
|
|
|
2057
2060
|
minSearchLength,
|
|
2058
2061
|
skipNextDebounceRef
|
|
2059
2062
|
});
|
|
2060
|
-
const [validationError, setValidationError] = (0,
|
|
2063
|
+
const [validationError, setValidationError] = (0, import_react15.useState)(
|
|
2061
2064
|
error3?.message || errorMessage
|
|
2062
2065
|
);
|
|
2063
2066
|
const {
|
|
@@ -2070,14 +2073,14 @@ var ComboboxInner = ({
|
|
|
2070
2073
|
clearHighlight
|
|
2071
2074
|
} = useComboboxHighlight(filteredOptions);
|
|
2072
2075
|
const inputRef = ref || fallbackRef;
|
|
2073
|
-
const listboxId = (0,
|
|
2074
|
-
const statusId = (0,
|
|
2075
|
-
const blurTimeoutRef = (0,
|
|
2076
|
-
const userInteractedRef = (0,
|
|
2077
|
-
const justSelectedRef = (0,
|
|
2076
|
+
const listboxId = (0, import_react15.useId)();
|
|
2077
|
+
const statusId = (0, import_react15.useId)();
|
|
2078
|
+
const blurTimeoutRef = (0, import_react15.useRef)(null);
|
|
2079
|
+
const userInteractedRef = (0, import_react15.useRef)(false);
|
|
2080
|
+
const justSelectedRef = (0, import_react15.useRef)(false);
|
|
2078
2081
|
const { down } = useBreakpoint();
|
|
2079
2082
|
const isMobile = down("md");
|
|
2080
|
-
(0,
|
|
2083
|
+
(0, import_react15.useEffect)(() => {
|
|
2081
2084
|
setValidationError(error3?.message || errorMessage);
|
|
2082
2085
|
}, [error3, errorMessage]);
|
|
2083
2086
|
const getEmptyValue = () => {
|
|
@@ -2106,7 +2109,7 @@ var ComboboxInner = ({
|
|
|
2106
2109
|
justSelectedRef.current = false;
|
|
2107
2110
|
}
|
|
2108
2111
|
};
|
|
2109
|
-
(0,
|
|
2112
|
+
(0, import_react15.useEffect)(() => {
|
|
2110
2113
|
if (!inputRef || typeof inputRef === "function") return;
|
|
2111
2114
|
const inputElement = inputRef.current;
|
|
2112
2115
|
if (!inputElement) return;
|
|
@@ -2259,12 +2262,12 @@ var ComboboxInner = ({
|
|
|
2259
2262
|
default:
|
|
2260
2263
|
}
|
|
2261
2264
|
};
|
|
2262
|
-
(0,
|
|
2265
|
+
(0, import_react15.useEffect)(() => {
|
|
2263
2266
|
if (value) {
|
|
2264
2267
|
setInputValue(value);
|
|
2265
2268
|
}
|
|
2266
2269
|
}, [value]);
|
|
2267
|
-
(0,
|
|
2270
|
+
(0, import_react15.useEffect)(() => {
|
|
2268
2271
|
if (asyncOptions && isChanging) {
|
|
2269
2272
|
setIsOpen(!!filteredOptions && filteredOptions.length > 0);
|
|
2270
2273
|
}
|
|
@@ -2378,15 +2381,15 @@ var AddressLookup = ({
|
|
|
2378
2381
|
errorMessage,
|
|
2379
2382
|
...otherProps
|
|
2380
2383
|
}) => {
|
|
2381
|
-
const [error3, _setError] = (0,
|
|
2382
|
-
const setError = (0,
|
|
2384
|
+
const [error3, _setError] = (0, import_react16.useState)(null);
|
|
2385
|
+
const setError = (0, import_react16.useCallback)(
|
|
2383
2386
|
(newError) => {
|
|
2384
2387
|
if (newError != null) onError?.(newError);
|
|
2385
2388
|
_setError(newError);
|
|
2386
2389
|
},
|
|
2387
2390
|
[onError]
|
|
2388
2391
|
);
|
|
2389
|
-
const asyncOptions = (0,
|
|
2392
|
+
const asyncOptions = (0, import_react16.useCallback)(
|
|
2390
2393
|
async (searchTerm) => {
|
|
2391
2394
|
try {
|
|
2392
2395
|
const response = await addressLookupService.search(searchTerm);
|
|
@@ -2633,7 +2636,7 @@ var Box = ({ ref, ...props }) => {
|
|
|
2633
2636
|
Box.displayName = "Box";
|
|
2634
2637
|
|
|
2635
2638
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
2636
|
-
var
|
|
2639
|
+
var import_react17 = require("react");
|
|
2637
2640
|
var import_dedupe19 = __toESM(require("classnames/dedupe"));
|
|
2638
2641
|
var import_Breadcrumbs = require("@simplybusiness/mobius/src/components/Breadcrumbs/Breadcrumbs.css");
|
|
2639
2642
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -2641,26 +2644,22 @@ var Breadcrumbs = ({ ref, ...props }) => {
|
|
|
2641
2644
|
const { "aria-label": ariaLabel = "Breadcrumbs" } = props;
|
|
2642
2645
|
const { navProps } = { navProps: { "aria-label": ariaLabel } };
|
|
2643
2646
|
const { children, ...otherProps } = props;
|
|
2644
|
-
const childArray =
|
|
2647
|
+
const childArray = import_react17.Children.toArray(children);
|
|
2645
2648
|
const classes = (0, import_dedupe19.default)(
|
|
2646
2649
|
"mobius",
|
|
2647
2650
|
"mobius-breadcrumb",
|
|
2648
2651
|
otherProps.className
|
|
2649
2652
|
);
|
|
2650
2653
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("nav", { ref, ...otherProps, ...navProps, className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { children: childArray.map(
|
|
2651
|
-
(child, i) => (0,
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
key: i,
|
|
2655
|
-
isCurrent: i === childArray.length - 1
|
|
2656
|
-
}
|
|
2657
|
-
)
|
|
2654
|
+
(child, i) => (0, import_react17.cloneElement)(child, {
|
|
2655
|
+
isCurrent: i === childArray.length - 1
|
|
2656
|
+
})
|
|
2658
2657
|
) }) });
|
|
2659
2658
|
};
|
|
2660
2659
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
2661
2660
|
|
|
2662
2661
|
// src/components/Breadcrumbs/BreadcrumbItem.tsx
|
|
2663
|
-
var
|
|
2662
|
+
var import_react18 = require("react");
|
|
2664
2663
|
var import_dedupe20 = __toESM(require("classnames/dedupe"));
|
|
2665
2664
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2666
2665
|
var BreadcrumbItem = ({ ref, ...props }) => {
|
|
@@ -2684,9 +2683,9 @@ var BreadcrumbItem = ({ ref, ...props }) => {
|
|
|
2684
2683
|
"mobius-breadcrumb__item",
|
|
2685
2684
|
props.className
|
|
2686
2685
|
);
|
|
2687
|
-
const child = typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { ...itemProps, children }) :
|
|
2686
|
+
const child = typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { ...itemProps, children }) : import_react18.Children.only(children);
|
|
2688
2687
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: classes, children: [
|
|
2689
|
-
(0,
|
|
2688
|
+
(0, import_react18.cloneElement)(child, {
|
|
2690
2689
|
...child.props,
|
|
2691
2690
|
...itemProps,
|
|
2692
2691
|
ref
|
|
@@ -2761,7 +2760,7 @@ var Button = ({ ref, ...props }) => {
|
|
|
2761
2760
|
Button.displayName = "Button";
|
|
2762
2761
|
|
|
2763
2762
|
// src/components/Checkbox/Checkbox.tsx
|
|
2764
|
-
var
|
|
2763
|
+
var import_react19 = require("react");
|
|
2765
2764
|
var import_dedupe22 = __toESM(require("classnames/dedupe"));
|
|
2766
2765
|
var import_icons7 = require("@simplybusiness/icons");
|
|
2767
2766
|
init_ErrorMessage2();
|
|
@@ -2790,12 +2789,12 @@ var Checkbox = ({ ref, ...props }) => {
|
|
|
2790
2789
|
["aria-describedby"]: ariaDescribedBy,
|
|
2791
2790
|
...rest
|
|
2792
2791
|
} = props;
|
|
2793
|
-
const [checked, setChecked] = (0,
|
|
2794
|
-
const fallbackRef = (0,
|
|
2792
|
+
const [checked, setChecked] = (0, import_react19.useState)(defaultSelected);
|
|
2793
|
+
const fallbackRef = (0, import_react19.useRef)(null);
|
|
2795
2794
|
const refObj = ref || fallbackRef;
|
|
2796
|
-
const inputId = (0,
|
|
2795
|
+
const inputId = (0, import_react19.useId)();
|
|
2797
2796
|
const isControlled = typeof selected === "boolean";
|
|
2798
|
-
(0,
|
|
2797
|
+
(0, import_react19.useEffect)(() => {
|
|
2799
2798
|
if (isControlled) {
|
|
2800
2799
|
setChecked(selected);
|
|
2801
2800
|
}
|
|
@@ -2819,13 +2818,13 @@ var Checkbox = ({ ref, ...props }) => {
|
|
|
2819
2818
|
const labelClasses = (0, import_dedupe22.default)("mobius-checkbox__label", sharedClasses);
|
|
2820
2819
|
const inputClasses = (0, import_dedupe22.default)("mobius-checkbox__input", sharedClasses);
|
|
2821
2820
|
const iconClasses = (0, import_dedupe22.default)("mobius-checkbox__icon", sharedClasses);
|
|
2822
|
-
const errorMessageId = (0,
|
|
2821
|
+
const errorMessageId = (0, import_react19.useId)();
|
|
2823
2822
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
2824
2823
|
const describedBy = spaceDelimitedList([
|
|
2825
2824
|
shouldErrorMessageShow,
|
|
2826
2825
|
ariaDescribedBy
|
|
2827
2826
|
]);
|
|
2828
|
-
const labelId = (0,
|
|
2827
|
+
const labelId = (0, import_react19.useId)();
|
|
2829
2828
|
const handleChange = (event) => {
|
|
2830
2829
|
setChecked(!checked);
|
|
2831
2830
|
if (onChange) {
|
|
@@ -2872,7 +2871,7 @@ Checkbox.displayName = "Checkbox";
|
|
|
2872
2871
|
|
|
2873
2872
|
// src/components/Checkbox/CheckboxGroup.tsx
|
|
2874
2873
|
var import_dedupe23 = __toESM(require("classnames/dedupe"));
|
|
2875
|
-
var
|
|
2874
|
+
var import_react20 = require("react");
|
|
2876
2875
|
init_hooks();
|
|
2877
2876
|
init_spaceDelimitedList();
|
|
2878
2877
|
init_ErrorMessage2();
|
|
@@ -2896,10 +2895,10 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2896
2895
|
lastItemDisables = false,
|
|
2897
2896
|
...rest
|
|
2898
2897
|
} = props;
|
|
2899
|
-
const [selected, setSelected] = (0,
|
|
2900
|
-
const isInitializedRef = (0,
|
|
2901
|
-
const prevDefaultValueRef = (0,
|
|
2902
|
-
(0,
|
|
2898
|
+
const [selected, setSelected] = (0, import_react20.useState)(defaultValue);
|
|
2899
|
+
const isInitializedRef = (0, import_react20.useRef)(false);
|
|
2900
|
+
const prevDefaultValueRef = (0, import_react20.useRef)(defaultValue);
|
|
2901
|
+
(0, import_react20.useEffect)(() => {
|
|
2903
2902
|
const hasChanged = defaultValue.length !== prevDefaultValueRef.current.length || defaultValue.some(
|
|
2904
2903
|
(val, index) => val !== prevDefaultValueRef.current[index]
|
|
2905
2904
|
);
|
|
@@ -2927,13 +2926,13 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2927
2926
|
},
|
|
2928
2927
|
validationClasses
|
|
2929
2928
|
);
|
|
2930
|
-
const errorMessageId = (0,
|
|
2929
|
+
const errorMessageId = (0, import_react20.useId)();
|
|
2931
2930
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
2932
2931
|
const describedBy = spaceDelimitedList([
|
|
2933
2932
|
shouldErrorMessageShow,
|
|
2934
2933
|
props["aria-describedby"]
|
|
2935
2934
|
]);
|
|
2936
|
-
const labelId = (0,
|
|
2935
|
+
const labelId = (0, import_react20.useId)();
|
|
2937
2936
|
const handleChange = (event, isLastItem = false) => {
|
|
2938
2937
|
const {
|
|
2939
2938
|
target: { value, checked }
|
|
@@ -2951,9 +2950,9 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2951
2950
|
setSelected(newValue);
|
|
2952
2951
|
onChange?.(newValue);
|
|
2953
2952
|
};
|
|
2954
|
-
const childrenArray =
|
|
2953
|
+
const childrenArray = import_react20.Children.toArray(children);
|
|
2955
2954
|
const lastCheckbox = childrenArray.filter(
|
|
2956
|
-
(child) => (0,
|
|
2955
|
+
(child) => (0, import_react20.isValidElement)(child) && child.type === Checkbox
|
|
2957
2956
|
).pop();
|
|
2958
2957
|
const lastCheckboxIsChecked = lastCheckbox && selected.includes(lastCheckbox.props.value);
|
|
2959
2958
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
@@ -2965,16 +2964,16 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2965
2964
|
className: checkboxGroupClasses,
|
|
2966
2965
|
role: "group",
|
|
2967
2966
|
style: {
|
|
2968
|
-
"--checkbox-items-per-row": itemsPerRow ||
|
|
2967
|
+
"--checkbox-items-per-row": itemsPerRow || import_react20.Children.count(children)
|
|
2969
2968
|
},
|
|
2970
2969
|
children: [
|
|
2971
2970
|
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { elementType: "span", id: labelId, className: labelClasses, children: label }),
|
|
2972
2971
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mobius-checkbox-group__wrapper", children: childrenArray.map((child) => {
|
|
2973
|
-
if ((0,
|
|
2972
|
+
if ((0, import_react20.isValidElement)(child)) {
|
|
2974
2973
|
const isLastItem = child === lastCheckbox;
|
|
2975
2974
|
const isChildDisabled = isDisabled || lastItemDisables && lastCheckboxIsChecked && !isLastItem;
|
|
2976
2975
|
const childProps = child.props;
|
|
2977
|
-
return (0,
|
|
2976
|
+
return (0, import_react20.cloneElement)(
|
|
2978
2977
|
child,
|
|
2979
2978
|
{
|
|
2980
2979
|
isDisabled: isChildDisabled,
|
|
@@ -3016,7 +3015,7 @@ Container.displayName = "Container";
|
|
|
3016
3015
|
|
|
3017
3016
|
// src/components/DateField/DateField.tsx
|
|
3018
3017
|
var import_dedupe25 = __toESM(require("classnames/dedupe"));
|
|
3019
|
-
var
|
|
3018
|
+
var import_react21 = require("react");
|
|
3020
3019
|
init_mergeRefs();
|
|
3021
3020
|
init_TextField2();
|
|
3022
3021
|
|
|
@@ -3066,9 +3065,9 @@ var DateField = ({ ref, ...props }) => {
|
|
|
3066
3065
|
value,
|
|
3067
3066
|
...otherProps
|
|
3068
3067
|
} = props;
|
|
3069
|
-
const [error3, setError] = (0,
|
|
3070
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
3071
|
-
const localRef = (0,
|
|
3068
|
+
const [error3, setError] = (0, import_react21.useState)(errorMessage);
|
|
3069
|
+
const [isInvalid, setIsInvalid] = (0, import_react21.useState)(void 0);
|
|
3070
|
+
const localRef = (0, import_react21.useRef)(null);
|
|
3072
3071
|
const classes = (0, import_dedupe25.default)("mobius-date-field", className);
|
|
3073
3072
|
const formattedMin = min ? convertToDateFormat(min, format) : void 0;
|
|
3074
3073
|
const formattedMax = max ? convertToDateFormat(max, format) : void 0;
|
|
@@ -3082,7 +3081,7 @@ var DateField = ({ ref, ...props }) => {
|
|
|
3082
3081
|
setError(props.errorMessage);
|
|
3083
3082
|
setIsInvalid(false);
|
|
3084
3083
|
};
|
|
3085
|
-
(0,
|
|
3084
|
+
(0, import_react21.useEffect)(() => {
|
|
3086
3085
|
if (!isValidDate(min, format)) {
|
|
3087
3086
|
setInvalidState(`Invalid min date: ${min}`);
|
|
3088
3087
|
return;
|
|
@@ -3141,13 +3140,13 @@ Content.displayName = "Content";
|
|
|
3141
3140
|
|
|
3142
3141
|
// src/components/Drawer/Drawer.tsx
|
|
3143
3142
|
var import_dedupe26 = __toESM(require("classnames/dedupe"));
|
|
3144
|
-
var
|
|
3143
|
+
var import_react23 = require("react");
|
|
3145
3144
|
init_hooks();
|
|
3146
3145
|
init_utils();
|
|
3147
3146
|
|
|
3148
3147
|
// src/components/Drawer/DrawerContext.tsx
|
|
3149
|
-
var
|
|
3150
|
-
var DrawerContext = (0,
|
|
3148
|
+
var import_react22 = require("react");
|
|
3149
|
+
var DrawerContext = (0, import_react22.createContext)({
|
|
3151
3150
|
onClose: () => {
|
|
3152
3151
|
},
|
|
3153
3152
|
closeLabel: void 0,
|
|
@@ -3169,8 +3168,8 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3169
3168
|
onClose,
|
|
3170
3169
|
children
|
|
3171
3170
|
} = props;
|
|
3172
|
-
const dialogRef = (0,
|
|
3173
|
-
const [shouldTransition, setShouldTransition] = (0,
|
|
3171
|
+
const dialogRef = (0, import_react23.useRef)(null);
|
|
3172
|
+
const [shouldTransition, setShouldTransition] = (0, import_react23.useState)(false);
|
|
3174
3173
|
const { close } = useDialog({
|
|
3175
3174
|
ref: dialogRef,
|
|
3176
3175
|
isOpen,
|
|
@@ -3181,8 +3180,8 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3181
3180
|
CSSVariable: TRANSITION_CSS_VARIABLE
|
|
3182
3181
|
}
|
|
3183
3182
|
});
|
|
3184
|
-
const hiddenId = `dialog-screen-reader-announce-${(0,
|
|
3185
|
-
const headerId = `dialog-header-${(0,
|
|
3183
|
+
const hiddenId = `dialog-screen-reader-announce-${(0, import_react23.useId)()}`;
|
|
3184
|
+
const headerId = `dialog-header-${(0, import_react23.useId)()}`;
|
|
3186
3185
|
const dialogClasses = (0, import_dedupe26.default)(
|
|
3187
3186
|
"mobius",
|
|
3188
3187
|
"mobius-drawer",
|
|
@@ -3192,10 +3191,10 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3192
3191
|
"--should-transition": shouldTransition
|
|
3193
3192
|
}
|
|
3194
3193
|
);
|
|
3195
|
-
(0,
|
|
3194
|
+
(0, import_react23.useEffect)(() => {
|
|
3196
3195
|
setShouldTransition(supportsDialog());
|
|
3197
3196
|
}, []);
|
|
3198
|
-
const contextValue = (0,
|
|
3197
|
+
const contextValue = (0, import_react23.useMemo)(
|
|
3199
3198
|
() => ({
|
|
3200
3199
|
onClose: close,
|
|
3201
3200
|
closeLabel,
|
|
@@ -3206,7 +3205,7 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3206
3205
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3207
3206
|
"dialog",
|
|
3208
3207
|
{
|
|
3209
|
-
id: (0,
|
|
3208
|
+
id: (0, import_react23.useId)(),
|
|
3210
3209
|
ref: mergeRefs([dialogRef, ref]),
|
|
3211
3210
|
onCancel: close,
|
|
3212
3211
|
className: dialogClasses,
|
|
@@ -3222,9 +3221,9 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3222
3221
|
Drawer.displayName = "Drawer";
|
|
3223
3222
|
|
|
3224
3223
|
// src/components/Drawer/useDrawer.ts
|
|
3225
|
-
var
|
|
3224
|
+
var import_react24 = require("react");
|
|
3226
3225
|
var useDrawer = () => {
|
|
3227
|
-
const { onClose, closeLabel, headerId } = (0,
|
|
3226
|
+
const { onClose, closeLabel, headerId } = (0, import_react24.useContext)(DrawerContext);
|
|
3228
3227
|
return { onClose, closeLabel, headerId };
|
|
3229
3228
|
};
|
|
3230
3229
|
|
|
@@ -3263,7 +3262,7 @@ var Drawer2 = Object.assign(Drawer, {
|
|
|
3263
3262
|
Drawer2.displayName = "Drawer";
|
|
3264
3263
|
|
|
3265
3264
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
3266
|
-
var
|
|
3265
|
+
var import_react25 = require("react");
|
|
3267
3266
|
var import_react_accessible_dropdown_menu_hook = __toESM(require("react-accessible-dropdown-menu-hook"));
|
|
3268
3267
|
var import_dedupe27 = __toESM(require("classnames/dedupe"));
|
|
3269
3268
|
var import_DropdownMenu = require("@simplybusiness/mobius/src/components/DropdownMenu/DropdownMenu.css");
|
|
@@ -3276,8 +3275,8 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3276
3275
|
children,
|
|
3277
3276
|
...otherProps
|
|
3278
3277
|
} = props;
|
|
3279
|
-
const [activeId, setActiveId] = (0,
|
|
3280
|
-
const numberOfItems =
|
|
3278
|
+
const [activeId, setActiveId] = (0, import_react25.useState)(null);
|
|
3279
|
+
const numberOfItems = import_react25.Children.count(children);
|
|
3281
3280
|
const {
|
|
3282
3281
|
buttonProps,
|
|
3283
3282
|
itemProps,
|
|
@@ -3301,15 +3300,15 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3301
3300
|
}
|
|
3302
3301
|
};
|
|
3303
3302
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Element, { ref, ...otherProps, className: classes, children: [
|
|
3304
|
-
trigger ? (0,
|
|
3303
|
+
trigger ? (0, import_react25.cloneElement)(trigger, {
|
|
3305
3304
|
className: triggerClasses,
|
|
3306
3305
|
open,
|
|
3307
3306
|
label,
|
|
3308
3307
|
...buttonProps
|
|
3309
3308
|
}) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { className: triggerClasses, ...buttonProps, children: label }),
|
|
3310
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: listClasses, role: "menu", children:
|
|
3311
|
-
if ((0,
|
|
3312
|
-
return (0,
|
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: listClasses, role: "menu", children: import_react25.Children.map(children, (child, index) => {
|
|
3310
|
+
if ((0, import_react25.isValidElement)(child)) {
|
|
3311
|
+
return (0, import_react25.cloneElement)(child, {
|
|
3313
3312
|
onClick: () => handleChildClick(child.props, index),
|
|
3314
3313
|
active: index === activeId,
|
|
3315
3314
|
...itemProps[index]
|
|
@@ -3322,7 +3321,7 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3322
3321
|
DropdownMenu.displayName = "DropdownMenu";
|
|
3323
3322
|
|
|
3324
3323
|
// src/components/DropdownMenu/Item.tsx
|
|
3325
|
-
var
|
|
3324
|
+
var import_react26 = require("react");
|
|
3326
3325
|
var import_dedupe28 = __toESM(require("classnames/dedupe"));
|
|
3327
3326
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3328
3327
|
var Item = ({ ref, ...props }) => {
|
|
@@ -3339,18 +3338,15 @@ var Item = ({ ref, ...props }) => {
|
|
|
3339
3338
|
{ "--is-active": active },
|
|
3340
3339
|
otherProps.className
|
|
3341
3340
|
);
|
|
3342
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, onClick, ...otherProps, children:
|
|
3343
|
-
if ((0,
|
|
3341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, onClick, ...otherProps, children: import_react26.Children.map(children, (child) => {
|
|
3342
|
+
if ((0, import_react26.isValidElement)(child)) {
|
|
3344
3343
|
const childClasses = (0, import_dedupe28.default)(
|
|
3345
3344
|
child.props.className,
|
|
3346
3345
|
classes
|
|
3347
3346
|
);
|
|
3348
|
-
return (0,
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
className: childClasses
|
|
3352
|
-
}
|
|
3353
|
-
);
|
|
3347
|
+
return (0, import_react26.cloneElement)(child, {
|
|
3348
|
+
className: childClasses
|
|
3349
|
+
});
|
|
3354
3350
|
}
|
|
3355
3351
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: classes, children: child });
|
|
3356
3352
|
}) });
|
|
@@ -3371,7 +3367,7 @@ init_ErrorMessage2();
|
|
|
3371
3367
|
|
|
3372
3368
|
// src/components/Fieldset/Fieldset.tsx
|
|
3373
3369
|
var import_dedupe29 = __toESM(require("classnames/dedupe"));
|
|
3374
|
-
var
|
|
3370
|
+
var import_react27 = require("react");
|
|
3375
3371
|
var import_Fieldset = require("@simplybusiness/mobius/src/components/Fieldset/Fieldset.css");
|
|
3376
3372
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3377
3373
|
var useFieldset = (props) => {
|
|
@@ -3380,7 +3376,7 @@ var useFieldset = (props) => {
|
|
|
3380
3376
|
let containerProps = {
|
|
3381
3377
|
role: "group"
|
|
3382
3378
|
};
|
|
3383
|
-
const legendId = (0,
|
|
3379
|
+
const legendId = (0, import_react27.useId)();
|
|
3384
3380
|
if (legend) {
|
|
3385
3381
|
legendProps = {
|
|
3386
3382
|
...legendProps,
|
|
@@ -3407,7 +3403,7 @@ var Fieldset = ({ ref: _ref, ...props }) => {
|
|
|
3407
3403
|
const classes = (0, import_dedupe29.default)("mobius", "mobius-fieldset", props.className);
|
|
3408
3404
|
legendProps.className = "mobius-fieldset__legend";
|
|
3409
3405
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { ...containerProps, ...otherProps, className: classes, children: [
|
|
3410
|
-
legend && (0,
|
|
3406
|
+
legend && (0, import_react27.cloneElement)(legendComponent, { ...legendProps }, [legend]),
|
|
3411
3407
|
children
|
|
3412
3408
|
] });
|
|
3413
3409
|
};
|
|
@@ -3450,7 +3446,7 @@ var Grid = ({ ref, ...props }) => {
|
|
|
3450
3446
|
Grid.displayName = "Grid";
|
|
3451
3447
|
|
|
3452
3448
|
// src/components/Grid/Item.tsx
|
|
3453
|
-
var
|
|
3449
|
+
var import_react28 = require("react");
|
|
3454
3450
|
var import_dedupe31 = __toESM(require("classnames/dedupe"));
|
|
3455
3451
|
init_hooks();
|
|
3456
3452
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -3488,9 +3484,9 @@ var GridItem = ({ ref, ...props }) => {
|
|
|
3488
3484
|
xl,
|
|
3489
3485
|
xxl
|
|
3490
3486
|
});
|
|
3491
|
-
const [responsiveSpan, setResponsiveSpan] = (0,
|
|
3487
|
+
const [responsiveSpan, setResponsiveSpan] = (0, import_react28.useState)();
|
|
3492
3488
|
const classes = (0, import_dedupe31.default)("mobius", "mobius-grid__item", className);
|
|
3493
|
-
(0,
|
|
3489
|
+
(0, import_react28.useEffect)(() => {
|
|
3494
3490
|
setResponsiveSpan(breakpointMap[breakpointSize]);
|
|
3495
3491
|
}, [breakpointSize, breakpointMap]);
|
|
3496
3492
|
const styles = {
|
|
@@ -3586,7 +3582,7 @@ function LinkButton({
|
|
|
3586
3582
|
}
|
|
3587
3583
|
|
|
3588
3584
|
// src/components/List/List.tsx
|
|
3589
|
-
var
|
|
3585
|
+
var import_react29 = require("react");
|
|
3590
3586
|
var import_dedupe35 = __toESM(require("classnames/dedupe"));
|
|
3591
3587
|
var import_List = require("@simplybusiness/mobius/src/components/List/List.css");
|
|
3592
3588
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
@@ -3613,9 +3609,9 @@ var List = ({ ref, ...props }) => {
|
|
|
3613
3609
|
ref,
|
|
3614
3610
|
...mappedProps,
|
|
3615
3611
|
className: classes,
|
|
3616
|
-
children:
|
|
3617
|
-
if ((0,
|
|
3618
|
-
return (0,
|
|
3612
|
+
children: import_react29.Children.map(children, (child) => {
|
|
3613
|
+
if ((0, import_react29.isValidElement)(child)) {
|
|
3614
|
+
return (0, import_react29.cloneElement)(child, {
|
|
3619
3615
|
parentIcon: icon
|
|
3620
3616
|
});
|
|
3621
3617
|
}
|
|
@@ -3734,16 +3730,16 @@ var Content2 = ({ ref, children, ...otherProps }) => /* @__PURE__ */ (0, import_
|
|
|
3734
3730
|
Content2.displayName = "Content";
|
|
3735
3731
|
|
|
3736
3732
|
// src/components/Modal/Header.tsx
|
|
3737
|
-
var
|
|
3733
|
+
var import_react32 = require("react");
|
|
3738
3734
|
var import_icons10 = require("@simplybusiness/icons");
|
|
3739
3735
|
init_Icon2();
|
|
3740
3736
|
|
|
3741
3737
|
// src/components/Modal/useModal.ts
|
|
3742
|
-
var
|
|
3738
|
+
var import_react31 = require("react");
|
|
3743
3739
|
|
|
3744
3740
|
// src/components/Modal/ModalContext.tsx
|
|
3745
|
-
var
|
|
3746
|
-
var ModalContext = (0,
|
|
3741
|
+
var import_react30 = require("react");
|
|
3742
|
+
var ModalContext = (0, import_react30.createContext)({
|
|
3747
3743
|
onClose: () => {
|
|
3748
3744
|
},
|
|
3749
3745
|
closeLabel: void 0,
|
|
@@ -3754,7 +3750,7 @@ var ModalContext = (0, import_react29.createContext)({
|
|
|
3754
3750
|
|
|
3755
3751
|
// src/components/Modal/useModal.ts
|
|
3756
3752
|
var useModal = () => {
|
|
3757
|
-
const { onClose, closeLabel, titleId, setTitleId } = (0,
|
|
3753
|
+
const { onClose, closeLabel, titleId, setTitleId } = (0, import_react31.useContext)(ModalContext);
|
|
3758
3754
|
return { onClose, closeLabel, titleId, setTitleId };
|
|
3759
3755
|
};
|
|
3760
3756
|
|
|
@@ -3762,8 +3758,8 @@ var useModal = () => {
|
|
|
3762
3758
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3763
3759
|
var Header2 = ({ ref, children, ...otherProps }) => {
|
|
3764
3760
|
const { onClose, closeLabel, setTitleId } = useModal();
|
|
3765
|
-
const titleId = (0,
|
|
3766
|
-
(0,
|
|
3761
|
+
const titleId = (0, import_react32.useId)();
|
|
3762
|
+
(0, import_react32.useEffect)(() => {
|
|
3767
3763
|
setTitleId(titleId);
|
|
3768
3764
|
}, [titleId, setTitleId]);
|
|
3769
3765
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
@@ -3797,7 +3793,7 @@ Header2.displayName = "Header";
|
|
|
3797
3793
|
|
|
3798
3794
|
// src/components/Modal/Modal.tsx
|
|
3799
3795
|
var import_dedupe39 = __toESM(require("classnames/dedupe"));
|
|
3800
|
-
var
|
|
3796
|
+
var import_react33 = require("react");
|
|
3801
3797
|
init_hooks();
|
|
3802
3798
|
init_utils();
|
|
3803
3799
|
init_polyfill_tests();
|
|
@@ -3817,11 +3813,11 @@ var Modal = ({ ref, ...props }) => {
|
|
|
3817
3813
|
animation,
|
|
3818
3814
|
...rest
|
|
3819
3815
|
} = props;
|
|
3820
|
-
const [shouldTransition, setShouldTransition] = (0,
|
|
3821
|
-
(0,
|
|
3816
|
+
const [shouldTransition, setShouldTransition] = (0, import_react33.useState)(false);
|
|
3817
|
+
(0, import_react33.useEffect)(() => {
|
|
3822
3818
|
setShouldTransition(supportsDialog());
|
|
3823
3819
|
}, []);
|
|
3824
|
-
const dialogRef = (0,
|
|
3820
|
+
const dialogRef = (0, import_react33.useRef)(null);
|
|
3825
3821
|
const { close } = useDialog({
|
|
3826
3822
|
ref: dialogRef,
|
|
3827
3823
|
isOpen,
|
|
@@ -3845,11 +3841,11 @@ var Modal = ({ ref, ...props }) => {
|
|
|
3845
3841
|
},
|
|
3846
3842
|
className
|
|
3847
3843
|
);
|
|
3848
|
-
const [titleId, setTitleId] = (0,
|
|
3849
|
-
const handleSetTitleId = (0,
|
|
3844
|
+
const [titleId, setTitleId] = (0, import_react33.useState)(void 0);
|
|
3845
|
+
const handleSetTitleId = (0, import_react33.useCallback)((id) => {
|
|
3850
3846
|
setTitleId(id);
|
|
3851
3847
|
}, []);
|
|
3852
|
-
const contextValue = (0,
|
|
3848
|
+
const contextValue = (0, import_react33.useMemo)(
|
|
3853
3849
|
() => ({
|
|
3854
3850
|
onClose: close,
|
|
3855
3851
|
closeLabel,
|
|
@@ -3886,7 +3882,7 @@ Modal2.displayName = "Modal";
|
|
|
3886
3882
|
|
|
3887
3883
|
// src/components/NumberField/NumberField.tsx
|
|
3888
3884
|
var import_dedupe40 = __toESM(require("classnames/dedupe"));
|
|
3889
|
-
var
|
|
3885
|
+
var import_react34 = require("react");
|
|
3890
3886
|
init_TextField2();
|
|
3891
3887
|
var import_NumberField = require("@simplybusiness/mobius/src/components/NumberField/NumberField.css");
|
|
3892
3888
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
@@ -3905,9 +3901,9 @@ var NumberField = ({ ref, ...props }) => {
|
|
|
3905
3901
|
onBlur: customOnBlur,
|
|
3906
3902
|
...rest
|
|
3907
3903
|
} = otherProps;
|
|
3908
|
-
const focusedInputRef = (0,
|
|
3909
|
-
const wheelHandler = (0,
|
|
3910
|
-
(0,
|
|
3904
|
+
const focusedInputRef = (0, import_react34.useRef)(null);
|
|
3905
|
+
const wheelHandler = (0, import_react34.useCallback)((ev) => ev.preventDefault(), []);
|
|
3906
|
+
(0, import_react34.useEffect)(() => {
|
|
3911
3907
|
return () => {
|
|
3912
3908
|
focusedInputRef.current?.removeEventListener("wheel", wheelHandler);
|
|
3913
3909
|
focusedInputRef.current = null;
|
|
@@ -3988,7 +3984,7 @@ Option2.displayName = "Option";
|
|
|
3988
3984
|
|
|
3989
3985
|
// src/components/PasswordField/PasswordField.tsx
|
|
3990
3986
|
var import_dedupe41 = __toESM(require("classnames/dedupe"));
|
|
3991
|
-
var
|
|
3987
|
+
var import_react35 = require("react");
|
|
3992
3988
|
init_mergeRefs();
|
|
3993
3989
|
init_TextField2();
|
|
3994
3990
|
|
|
@@ -4023,10 +4019,10 @@ var PasswordField = ({
|
|
|
4023
4019
|
autoComplete = "current-password",
|
|
4024
4020
|
...props
|
|
4025
4021
|
}) => {
|
|
4026
|
-
const [show, setShow] = (0,
|
|
4022
|
+
const [show, setShow] = (0, import_react35.useState)(false);
|
|
4027
4023
|
const type = show ? "text" : "password";
|
|
4028
4024
|
const classes = (0, import_dedupe41.default)("mobius-password-field", className);
|
|
4029
|
-
const localRef = (0,
|
|
4025
|
+
const localRef = (0, import_react35.useRef)(null);
|
|
4030
4026
|
const handleShowHideButtonClick = () => {
|
|
4031
4027
|
const selectionStart = localRef.current?.selectionStart;
|
|
4032
4028
|
const selectionEnd = localRef.current?.selectionEnd;
|
|
@@ -4053,59 +4049,231 @@ var PasswordField = ({
|
|
|
4053
4049
|
PasswordField.displayName = "PasswordField";
|
|
4054
4050
|
|
|
4055
4051
|
// src/components/Popover/Popover.tsx
|
|
4056
|
-
var import_react35 = require("@floating-ui/react");
|
|
4057
4052
|
var import_icons12 = require("@simplybusiness/icons");
|
|
4058
4053
|
var import_dedupe42 = __toESM(require("classnames/dedupe"));
|
|
4059
|
-
var
|
|
4054
|
+
var import_react39 = require("react");
|
|
4055
|
+
var import_react_dom = require("react-dom");
|
|
4060
4056
|
var import_mobius_hooks6 = require("@simplybusiness/mobius-hooks");
|
|
4061
4057
|
init_Icon2();
|
|
4062
|
-
|
|
4058
|
+
|
|
4059
|
+
// src/components/Popover/Arrow.tsx
|
|
4063
4060
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4061
|
+
var Arrow = ({ ref, width = 20, className, style }) => {
|
|
4062
|
+
const height = width / 2;
|
|
4063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4064
|
+
"svg",
|
|
4065
|
+
{
|
|
4066
|
+
ref,
|
|
4067
|
+
className,
|
|
4068
|
+
"aria-hidden": "true",
|
|
4069
|
+
width,
|
|
4070
|
+
height,
|
|
4071
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
4072
|
+
style,
|
|
4073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("path", { d: `M0,0 H${width} L${width / 2},${height} Z` })
|
|
4074
|
+
}
|
|
4075
|
+
);
|
|
4076
|
+
};
|
|
4077
|
+
|
|
4078
|
+
// src/components/Popover/useAutoUpdate.ts
|
|
4079
|
+
var import_react36 = require("react");
|
|
4080
|
+
var useAutoUpdate = ({
|
|
4081
|
+
referenceRef,
|
|
4082
|
+
floatingRef,
|
|
4083
|
+
onUpdate,
|
|
4084
|
+
enabled
|
|
4085
|
+
}) => {
|
|
4086
|
+
(0, import_react36.useEffect)(() => {
|
|
4087
|
+
if (!enabled) return;
|
|
4088
|
+
const reference = referenceRef.current;
|
|
4089
|
+
const floating = floatingRef.current;
|
|
4090
|
+
const scrollOpts = {
|
|
4091
|
+
capture: true,
|
|
4092
|
+
passive: true
|
|
4093
|
+
};
|
|
4094
|
+
window.addEventListener("scroll", onUpdate, scrollOpts);
|
|
4095
|
+
window.addEventListener("resize", onUpdate, { passive: true });
|
|
4096
|
+
const observer = typeof ResizeObserver === "function" ? new ResizeObserver(onUpdate) : null;
|
|
4097
|
+
if (observer && reference) observer.observe(reference);
|
|
4098
|
+
if (observer && floating) observer.observe(floating);
|
|
4099
|
+
return () => {
|
|
4100
|
+
window.removeEventListener("scroll", onUpdate, scrollOpts);
|
|
4101
|
+
window.removeEventListener("resize", onUpdate);
|
|
4102
|
+
observer?.disconnect();
|
|
4103
|
+
};
|
|
4104
|
+
}, [enabled, onUpdate, referenceRef, floatingRef]);
|
|
4105
|
+
};
|
|
4106
|
+
|
|
4107
|
+
// src/components/Popover/useFloatingPosition.ts
|
|
4108
|
+
var import_react37 = require("react");
|
|
4109
|
+
var ABSOLUTE_FLOATING_STYLES = {
|
|
4110
|
+
position: "absolute",
|
|
4111
|
+
top: 0,
|
|
4112
|
+
left: 0,
|
|
4113
|
+
width: "max-content"
|
|
4114
|
+
};
|
|
4115
|
+
var FIXED_FLOATING_STYLES = {
|
|
4116
|
+
position: "fixed",
|
|
4117
|
+
top: 0,
|
|
4118
|
+
left: 0,
|
|
4119
|
+
width: "max-content"
|
|
4120
|
+
};
|
|
4121
|
+
var INITIAL_ARROW_STYLES = {
|
|
4122
|
+
position: "absolute"
|
|
4123
|
+
};
|
|
4124
|
+
var VIEWPORT_PADDING = 0;
|
|
4125
|
+
var createsFixedContainingBlock = (el) => {
|
|
4126
|
+
const style = window.getComputedStyle(el);
|
|
4127
|
+
return style.transform !== "none" || style.filter !== "none" || style.backdropFilter !== "none" || style.perspective !== "none" || /\b(transform|filter|perspective)\b/.test(style.willChange);
|
|
4128
|
+
};
|
|
4129
|
+
var useFloatingPosition = ({
|
|
4130
|
+
referenceRef,
|
|
4131
|
+
floatingRef,
|
|
4132
|
+
arrowRef,
|
|
4133
|
+
isOpen,
|
|
4134
|
+
offsetPx,
|
|
4135
|
+
arrowWidth,
|
|
4136
|
+
useFixedStrategy
|
|
4137
|
+
}) => {
|
|
4138
|
+
const update = (0, import_react37.useCallback)(() => {
|
|
4139
|
+
const reference = referenceRef.current;
|
|
4140
|
+
const floating = floatingRef.current;
|
|
4141
|
+
if (!reference || !floating) return;
|
|
4142
|
+
const refRect = reference.getBoundingClientRect();
|
|
4143
|
+
const floatingWidth = floating.offsetWidth;
|
|
4144
|
+
const floatingHeight = floating.offsetHeight;
|
|
4145
|
+
const scrollX = useFixedStrategy ? 0 : window.scrollX;
|
|
4146
|
+
const scrollY = useFixedStrategy ? 0 : window.scrollY;
|
|
4147
|
+
const parent = floating.parentElement;
|
|
4148
|
+
const parentIsCb = useFixedStrategy && !!parent && createsFixedContainingBlock(parent);
|
|
4149
|
+
const boundsRect = parentIsCb ? parent.getBoundingClientRect() : {
|
|
4150
|
+
left: 0,
|
|
4151
|
+
top: 0,
|
|
4152
|
+
right: window.innerWidth,
|
|
4153
|
+
bottom: window.innerHeight
|
|
4154
|
+
};
|
|
4155
|
+
const bottomTopViewport = refRect.bottom + offsetPx;
|
|
4156
|
+
const topTopViewport = refRect.top - floatingHeight - offsetPx;
|
|
4157
|
+
const overflowsBottom = bottomTopViewport + floatingHeight > boundsRect.bottom;
|
|
4158
|
+
const fitsTop = topTopViewport >= boundsRect.top;
|
|
4159
|
+
const nextPlacement = overflowsBottom && fitsTop ? "top" : "bottom";
|
|
4160
|
+
const topViewport = nextPlacement === "bottom" ? bottomTopViewport : topTopViewport;
|
|
4161
|
+
const rawLeftViewport = refRect.left + refRect.width / 2 - floatingWidth / 2;
|
|
4162
|
+
const minLeftViewport = boundsRect.left + VIEWPORT_PADDING;
|
|
4163
|
+
const maxLeftViewport = Math.max(
|
|
4164
|
+
minLeftViewport,
|
|
4165
|
+
boundsRect.right - floatingWidth - VIEWPORT_PADDING
|
|
4166
|
+
);
|
|
4167
|
+
const leftViewport = Math.min(
|
|
4168
|
+
Math.max(minLeftViewport, rawLeftViewport),
|
|
4169
|
+
maxLeftViewport
|
|
4170
|
+
);
|
|
4171
|
+
const cbOffsetLeft = parentIsCb ? boundsRect.left : 0;
|
|
4172
|
+
const cbOffsetTop = parentIsCb ? boundsRect.top : 0;
|
|
4173
|
+
floating.style.top = `${topViewport + scrollY - cbOffsetTop}px`;
|
|
4174
|
+
floating.style.left = `${leftViewport + scrollX - cbOffsetLeft}px`;
|
|
4175
|
+
const arrow = arrowRef.current;
|
|
4176
|
+
if (!arrow) return;
|
|
4177
|
+
const arrowHalf = arrowWidth / 2;
|
|
4178
|
+
const refCenterX = refRect.left + refRect.width / 2;
|
|
4179
|
+
const rawArrowLeft = refCenterX - leftViewport - arrowHalf;
|
|
4180
|
+
const maxArrowLeft = Math.max(0, floatingWidth - arrowWidth);
|
|
4181
|
+
const arrowLeft = Math.min(Math.max(0, rawArrowLeft), maxArrowLeft);
|
|
4182
|
+
arrow.style.left = `${arrowLeft}px`;
|
|
4183
|
+
if (nextPlacement === "bottom") {
|
|
4184
|
+
arrow.style.bottom = "100%";
|
|
4185
|
+
arrow.style.top = "";
|
|
4186
|
+
arrow.style.transform = "rotate(180deg)";
|
|
4187
|
+
} else {
|
|
4188
|
+
arrow.style.top = "100%";
|
|
4189
|
+
arrow.style.bottom = "";
|
|
4190
|
+
arrow.style.transform = "";
|
|
4191
|
+
}
|
|
4192
|
+
}, [
|
|
4193
|
+
referenceRef,
|
|
4194
|
+
floatingRef,
|
|
4195
|
+
arrowRef,
|
|
4196
|
+
offsetPx,
|
|
4197
|
+
arrowWidth,
|
|
4198
|
+
useFixedStrategy
|
|
4199
|
+
]);
|
|
4200
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4201
|
+
if (!isOpen) return;
|
|
4202
|
+
update();
|
|
4203
|
+
}, [isOpen, update]);
|
|
4204
|
+
return {
|
|
4205
|
+
initialFloatingStyles: useFixedStrategy ? FIXED_FLOATING_STYLES : ABSOLUTE_FLOATING_STYLES,
|
|
4206
|
+
initialArrowStyles: INITIAL_ARROW_STYLES,
|
|
4207
|
+
update
|
|
4208
|
+
};
|
|
4209
|
+
};
|
|
4210
|
+
|
|
4211
|
+
// src/components/Popover/useOutsidePress.ts
|
|
4212
|
+
var import_react38 = require("react");
|
|
4213
|
+
var useOutsidePress = ({
|
|
4214
|
+
referenceRef,
|
|
4215
|
+
floatingRef,
|
|
4216
|
+
enabled,
|
|
4217
|
+
onOutsidePress
|
|
4218
|
+
}) => {
|
|
4219
|
+
(0, import_react38.useEffect)(() => {
|
|
4220
|
+
if (!enabled) return;
|
|
4221
|
+
const handler = (event) => {
|
|
4222
|
+
const target = event.target;
|
|
4223
|
+
if (!target) return;
|
|
4224
|
+
if (referenceRef.current?.contains(target)) return;
|
|
4225
|
+
if (floatingRef.current?.contains(target)) return;
|
|
4226
|
+
onOutsidePress(event);
|
|
4227
|
+
};
|
|
4228
|
+
document.addEventListener("pointerdown", handler);
|
|
4229
|
+
return () => document.removeEventListener("pointerdown", handler);
|
|
4230
|
+
}, [enabled, onOutsidePress, referenceRef, floatingRef]);
|
|
4231
|
+
};
|
|
4232
|
+
|
|
4233
|
+
// src/components/Popover/Popover.tsx
|
|
4234
|
+
var import_Popover = require("@simplybusiness/mobius/src/components/Popover/Popover.css");
|
|
4235
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4064
4236
|
var OFFSET_FROM_CONTENT_DEFAULT = 10;
|
|
4237
|
+
var ARROW_WIDTH = 20;
|
|
4065
4238
|
var Popover = (props) => {
|
|
4066
4239
|
const { trigger, children, onOpen, onClose, className } = props;
|
|
4067
|
-
const
|
|
4068
|
-
const
|
|
4069
|
-
const
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
]
|
|
4240
|
+
const referenceRef = (0, import_react39.useRef)(null);
|
|
4241
|
+
const floatingRef = (0, import_react39.useRef)(null);
|
|
4242
|
+
const arrowRef = (0, import_react39.useRef)(null);
|
|
4243
|
+
const [isOpen, setIsOpen] = (0, import_react39.useState)(false);
|
|
4244
|
+
const [portalTarget, setPortalTarget] = (0, import_react39.useState)(null);
|
|
4245
|
+
const isInsideDialog = portalTarget !== null && portalTarget.tagName === "DIALOG";
|
|
4246
|
+
const { initialFloatingStyles, initialArrowStyles, update } = useFloatingPosition({
|
|
4247
|
+
referenceRef,
|
|
4248
|
+
floatingRef,
|
|
4249
|
+
arrowRef,
|
|
4250
|
+
isOpen,
|
|
4251
|
+
offsetPx: OFFSET_FROM_CONTENT_DEFAULT,
|
|
4252
|
+
arrowWidth: ARROW_WIDTH,
|
|
4253
|
+
useFixedStrategy: isInsideDialog
|
|
4082
4254
|
});
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4255
|
+
useAutoUpdate({
|
|
4256
|
+
referenceRef,
|
|
4257
|
+
floatingRef,
|
|
4258
|
+
onUpdate: update,
|
|
4259
|
+
enabled: isOpen
|
|
4260
|
+
});
|
|
4261
|
+
useOutsidePress({
|
|
4262
|
+
referenceRef,
|
|
4263
|
+
floatingRef,
|
|
4264
|
+
enabled: isOpen,
|
|
4265
|
+
onOutsidePress: () => {
|
|
4266
|
+
onClose?.();
|
|
4267
|
+
setIsOpen(false);
|
|
4092
4268
|
}
|
|
4093
4269
|
});
|
|
4094
|
-
const { getReferenceProps, getFloatingProps } = (0, import_react35.useInteractions)([dismiss]);
|
|
4095
4270
|
const containerClasses = (0, import_dedupe42.default)(
|
|
4096
4271
|
"mobius",
|
|
4097
4272
|
"mobius-popover__container",
|
|
4098
4273
|
className
|
|
4099
4274
|
);
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
refs.setFloating(node);
|
|
4103
|
-
floatingContainerRef.current = node;
|
|
4104
|
-
},
|
|
4105
|
-
[refs]
|
|
4106
|
-
);
|
|
4107
|
-
(0, import_react36.useEffect)(() => {
|
|
4108
|
-
const el = floatingContainerRef.current;
|
|
4275
|
+
(0, import_react39.useEffect)(() => {
|
|
4276
|
+
const el = floatingRef.current;
|
|
4109
4277
|
if (!el) return;
|
|
4110
4278
|
const preventLabelActivation = (e) => {
|
|
4111
4279
|
const target = e.target;
|
|
@@ -4122,77 +4290,82 @@ var Popover = (props) => {
|
|
|
4122
4290
|
onClose?.();
|
|
4123
4291
|
return;
|
|
4124
4292
|
}
|
|
4293
|
+
const dialog = referenceRef.current?.closest("dialog");
|
|
4294
|
+
setPortalTarget(dialog ?? document.body);
|
|
4125
4295
|
setIsOpen(true);
|
|
4126
4296
|
onOpen?.();
|
|
4127
4297
|
};
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4298
|
+
const setReferenceRef = (0, import_react39.useCallback)((node) => {
|
|
4299
|
+
referenceRef.current = node;
|
|
4300
|
+
}, []);
|
|
4301
|
+
const triggerComponent = (0, import_react39.cloneElement)(trigger, {
|
|
4302
|
+
ref: setReferenceRef,
|
|
4130
4303
|
className: (0, import_dedupe42.default)(
|
|
4131
4304
|
trigger.props.className,
|
|
4132
4305
|
"mobius-popover__toggle"
|
|
4133
4306
|
),
|
|
4134
|
-
onClick: toggleVisibility
|
|
4135
|
-
...getReferenceProps()
|
|
4307
|
+
onClick: toggleVisibility
|
|
4136
4308
|
});
|
|
4137
4309
|
(0, import_mobius_hooks6.useWindowEvent)("keydown", (e) => {
|
|
4138
|
-
if (e.key === "Escape") {
|
|
4310
|
+
if (e.key === "Escape" && isOpen) {
|
|
4311
|
+
setIsOpen(false);
|
|
4139
4312
|
onClose?.();
|
|
4140
4313
|
e.preventDefault();
|
|
4141
4314
|
e.stopPropagation();
|
|
4142
4315
|
}
|
|
4143
4316
|
});
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "mobius-popover", children: [
|
|
4155
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("header", { className: "mobius-popover__header", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4156
|
-
Button,
|
|
4157
|
-
{
|
|
4158
|
-
type: "button",
|
|
4159
|
-
className: "mobius-popover__close-button",
|
|
4160
|
-
onClick: toggleVisibility,
|
|
4161
|
-
"aria-label": "Close",
|
|
4162
|
-
variant: "ghost",
|
|
4163
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4164
|
-
Icon,
|
|
4165
|
-
{
|
|
4166
|
-
icon: import_icons12.cross,
|
|
4167
|
-
size: "md",
|
|
4168
|
-
className: "mobius-popover__close-icon"
|
|
4169
|
-
}
|
|
4170
|
-
)
|
|
4171
|
-
}
|
|
4172
|
-
) }),
|
|
4173
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "mobius-popover__body", children })
|
|
4174
|
-
] }),
|
|
4175
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4176
|
-
import_react35.FloatingArrow,
|
|
4317
|
+
const floatingElement = isOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4318
|
+
"div",
|
|
4319
|
+
{
|
|
4320
|
+
className: containerClasses,
|
|
4321
|
+
ref: floatingRef,
|
|
4322
|
+
style: initialFloatingStyles,
|
|
4323
|
+
children: [
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "mobius-popover", children: [
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("header", { className: "mobius-popover__header", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4326
|
+
Button,
|
|
4177
4327
|
{
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4328
|
+
type: "button",
|
|
4329
|
+
className: "mobius-popover__close-button",
|
|
4330
|
+
onClick: toggleVisibility,
|
|
4331
|
+
"aria-label": "Close",
|
|
4332
|
+
variant: "ghost",
|
|
4333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4334
|
+
Icon,
|
|
4335
|
+
{
|
|
4336
|
+
icon: import_icons12.cross,
|
|
4337
|
+
size: "md",
|
|
4338
|
+
className: "mobius-popover__close-icon"
|
|
4339
|
+
}
|
|
4340
|
+
)
|
|
4182
4341
|
}
|
|
4183
|
-
)
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4342
|
+
) }),
|
|
4343
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "mobius-popover__body", children })
|
|
4344
|
+
] }),
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4346
|
+
Arrow,
|
|
4347
|
+
{
|
|
4348
|
+
ref: arrowRef,
|
|
4349
|
+
style: initialArrowStyles,
|
|
4350
|
+
className: "mobius-popover__arrow-icon",
|
|
4351
|
+
width: ARROW_WIDTH
|
|
4352
|
+
}
|
|
4353
|
+
)
|
|
4354
|
+
]
|
|
4355
|
+
}
|
|
4356
|
+
) : null;
|
|
4357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
4358
|
+
triggerComponent,
|
|
4359
|
+
floatingElement && portalTarget ? (0, import_react_dom.createPortal)(floatingElement, portalTarget) : null
|
|
4187
4360
|
] });
|
|
4188
4361
|
};
|
|
4189
4362
|
|
|
4190
4363
|
// src/components/Progress/Progress.tsx
|
|
4191
4364
|
var import_dedupe43 = __toESM(require("classnames/dedupe"));
|
|
4192
|
-
var
|
|
4365
|
+
var import_react40 = require("react");
|
|
4193
4366
|
init_Label2();
|
|
4194
4367
|
var import_Progress = require("@simplybusiness/mobius/src/components/Progress/Progress.css");
|
|
4195
|
-
var
|
|
4368
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4196
4369
|
function warnAboutInvalidValues(value, minValue, maxValue) {
|
|
4197
4370
|
if (minValue > maxValue) {
|
|
4198
4371
|
console.warn("minValue is greater than maxValue");
|
|
@@ -4212,7 +4385,7 @@ var sanitizedValue = (value, defaultValue) => {
|
|
|
4212
4385
|
};
|
|
4213
4386
|
var getLabelComponent = (label, progressLabelId, showLabel) => {
|
|
4214
4387
|
if (showLabel) {
|
|
4215
|
-
return /* @__PURE__ */ (0,
|
|
4388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4216
4389
|
Label,
|
|
4217
4390
|
{
|
|
4218
4391
|
id: progressLabelId,
|
|
@@ -4222,7 +4395,7 @@ var getLabelComponent = (label, progressLabelId, showLabel) => {
|
|
|
4222
4395
|
}
|
|
4223
4396
|
);
|
|
4224
4397
|
}
|
|
4225
|
-
return /* @__PURE__ */ (0,
|
|
4398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4226
4399
|
Label,
|
|
4227
4400
|
{
|
|
4228
4401
|
id: progressLabelId,
|
|
@@ -4236,8 +4409,8 @@ var DEFAULT_VALUE = 0;
|
|
|
4236
4409
|
var DEFAULT_MIN_VALUE = 0;
|
|
4237
4410
|
var DEFAULT_MAX_VALUE = 100;
|
|
4238
4411
|
var Progress = ({ ref, ...props }) => {
|
|
4239
|
-
const progressId = (0,
|
|
4240
|
-
const progressLabelId = (0,
|
|
4412
|
+
const progressId = (0, import_react40.useId)();
|
|
4413
|
+
const progressLabelId = (0, import_react40.useId)();
|
|
4241
4414
|
const {
|
|
4242
4415
|
id,
|
|
4243
4416
|
label,
|
|
@@ -4272,7 +4445,7 @@ var Progress = ({ ref, ...props }) => {
|
|
|
4272
4445
|
progressBarProps["aria-valuenow"] = value.toString();
|
|
4273
4446
|
progressBarProps["aria-valuetext"] = valueFormatter instanceof Function ? valueFormatter(value, minValue, maxValue) : barWidth;
|
|
4274
4447
|
const labelComponent = getLabelComponent(label, progressLabelId, showLabel);
|
|
4275
|
-
return /* @__PURE__ */ (0,
|
|
4448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4276
4449
|
"div",
|
|
4277
4450
|
{
|
|
4278
4451
|
id: id || progressId,
|
|
@@ -4283,8 +4456,8 @@ var Progress = ({ ref, ...props }) => {
|
|
|
4283
4456
|
"aria-labelledby": progressLabelId,
|
|
4284
4457
|
children: [
|
|
4285
4458
|
labelComponent,
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4287
|
-
showValueLabel && /* @__PURE__ */ (0,
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mobius-progress__track", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mobius-progress__bar", style: { width: barWidth } }) }),
|
|
4460
|
+
showValueLabel && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Label, { "data-testid": "value-label", elementType: "span", children: progressBarProps["aria-valuetext"] })
|
|
4288
4461
|
]
|
|
4289
4462
|
}
|
|
4290
4463
|
);
|
|
@@ -4293,11 +4466,11 @@ Progress.displayName = "Progress";
|
|
|
4293
4466
|
|
|
4294
4467
|
// src/components/Radio/Radio.tsx
|
|
4295
4468
|
var import_dedupe44 = __toESM(require("classnames/dedupe"));
|
|
4296
|
-
var
|
|
4469
|
+
var import_react41 = require("react");
|
|
4297
4470
|
init_ErrorMessage2();
|
|
4298
4471
|
init_Label2();
|
|
4299
4472
|
var import_Radio = require("@simplybusiness/mobius/src/components/Radio/Radio.css");
|
|
4300
|
-
var
|
|
4473
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4301
4474
|
var Radio = ({ ref, ...props }) => {
|
|
4302
4475
|
const {
|
|
4303
4476
|
children,
|
|
@@ -4321,19 +4494,19 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4321
4494
|
const isMultiline = label && children;
|
|
4322
4495
|
const isControlled = selected !== void 0;
|
|
4323
4496
|
const isChecked = isControlled ? selected === value : defaultChecked;
|
|
4324
|
-
const contentRef = (0,
|
|
4325
|
-
const prevOverflowRef = (0,
|
|
4497
|
+
const contentRef = (0, import_react41.useRef)(null);
|
|
4498
|
+
const prevOverflowRef = (0, import_react41.useRef)({
|
|
4326
4499
|
vertical: false,
|
|
4327
4500
|
horizontal: false
|
|
4328
4501
|
});
|
|
4329
|
-
const hasIconFirst = (0,
|
|
4330
|
-
if (!children ||
|
|
4331
|
-
const firstChild =
|
|
4332
|
-
if (!(0,
|
|
4502
|
+
const hasIconFirst = (0, import_react41.useMemo)(() => {
|
|
4503
|
+
if (!children || import_react41.Children.count(children) === 0) return false;
|
|
4504
|
+
const firstChild = import_react41.Children.toArray(children)[0];
|
|
4505
|
+
if (!(0, import_react41.isValidElement)(firstChild)) return false;
|
|
4333
4506
|
const props2 = firstChild.props;
|
|
4334
4507
|
return "icon" in props2 && props2.icon !== void 0;
|
|
4335
4508
|
}, [children]);
|
|
4336
|
-
(0,
|
|
4509
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
4337
4510
|
if (!contentRef.current || !onOverflow) return;
|
|
4338
4511
|
if (orientation === "vertical") {
|
|
4339
4512
|
return;
|
|
@@ -4382,9 +4555,9 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4382
4555
|
onChange(adaptedEvent);
|
|
4383
4556
|
}
|
|
4384
4557
|
};
|
|
4385
|
-
return /* @__PURE__ */ (0,
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Label, { className: containerClasses, children: [
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4388
4561
|
"input",
|
|
4389
4562
|
{
|
|
4390
4563
|
"aria-describedby": otherProps["aria-describedby"],
|
|
@@ -4401,25 +4574,25 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4401
4574
|
...rest
|
|
4402
4575
|
}
|
|
4403
4576
|
),
|
|
4404
|
-
isMultiline ? /* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4406
|
-
/* @__PURE__ */ (0,
|
|
4407
|
-
] }) : /* @__PURE__ */ (0,
|
|
4577
|
+
isMultiline ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { ref: contentRef, className: "mobius-radio__content--multiline", children: [
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mobius-radio__content-first-line", children: label }),
|
|
4579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mobius-radio__extra-content", children })
|
|
4580
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ref: contentRef, className: "mobius-radio__content", children: label || children })
|
|
4408
4581
|
] }),
|
|
4409
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
4582
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ErrorMessage, { errorMessage })
|
|
4410
4583
|
] });
|
|
4411
4584
|
};
|
|
4412
4585
|
Radio.displayName = "Radio";
|
|
4413
4586
|
|
|
4414
4587
|
// src/components/Radio/RadioGroup.tsx
|
|
4415
4588
|
var import_dedupe45 = __toESM(require("classnames/dedupe"));
|
|
4416
|
-
var
|
|
4589
|
+
var import_react42 = require("react");
|
|
4417
4590
|
init_hooks();
|
|
4418
4591
|
init_spaceDelimitedList();
|
|
4419
4592
|
init_ErrorMessage2();
|
|
4420
4593
|
init_Label2();
|
|
4421
4594
|
init_Stack2();
|
|
4422
|
-
var
|
|
4595
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4423
4596
|
var getDefaultVal = (children, defaultValue) => {
|
|
4424
4597
|
if (Array.isArray(children) && defaultValue) {
|
|
4425
4598
|
const option = children?.find((item) => item.props.value === defaultValue);
|
|
@@ -4447,15 +4620,15 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4447
4620
|
...rest
|
|
4448
4621
|
} = props;
|
|
4449
4622
|
const defaultSelected = getDefaultVal(children, value || defaultValue);
|
|
4450
|
-
const [selected, setSelected] = (0,
|
|
4451
|
-
const overflowsRef = (0,
|
|
4452
|
-
const [hasOverflow, setHasOverflow] = (0,
|
|
4453
|
-
(0,
|
|
4623
|
+
const [selected, setSelected] = (0, import_react42.useState)(defaultSelected);
|
|
4624
|
+
const overflowsRef = (0, import_react42.useRef)({});
|
|
4625
|
+
const [hasOverflow, setHasOverflow] = (0, import_react42.useState)(false);
|
|
4626
|
+
(0, import_react42.useEffect)(() => {
|
|
4454
4627
|
if (value !== void 0) {
|
|
4455
4628
|
setSelected(value);
|
|
4456
4629
|
}
|
|
4457
4630
|
}, [value]);
|
|
4458
|
-
const handleOverflow = (0,
|
|
4631
|
+
const handleOverflow = (0, import_react42.useCallback)(
|
|
4459
4632
|
(radioValue, overflow) => {
|
|
4460
4633
|
overflowsRef.current = {
|
|
4461
4634
|
...overflowsRef.current,
|
|
@@ -4489,16 +4662,16 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4489
4662
|
[`--is-${effectiveOrientation}`]: true
|
|
4490
4663
|
});
|
|
4491
4664
|
const labelClasses = (0, import_dedupe45.default)(radioClasses, validationClasses);
|
|
4492
|
-
const errorMessageId = (0,
|
|
4493
|
-
const defaultNameAttrId = (0,
|
|
4665
|
+
const errorMessageId = (0, import_react42.useId)();
|
|
4666
|
+
const defaultNameAttrId = (0, import_react42.useId)();
|
|
4494
4667
|
const nameAttribute = name || defaultNameAttrId;
|
|
4495
4668
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
4496
4669
|
const describedBy = spaceDelimitedList([
|
|
4497
4670
|
shouldErrorMessageShow,
|
|
4498
4671
|
props["aria-describedby"]
|
|
4499
4672
|
]);
|
|
4500
|
-
const labelId = (0,
|
|
4501
|
-
return /* @__PURE__ */ (0,
|
|
4673
|
+
const labelId = (0, import_react42.useId)();
|
|
4674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4502
4675
|
"div",
|
|
4503
4676
|
{
|
|
4504
4677
|
...rest,
|
|
@@ -4514,12 +4687,12 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4514
4687
|
ref,
|
|
4515
4688
|
className: radioGroupClasses,
|
|
4516
4689
|
role: "radiogroup",
|
|
4517
|
-
children: /* @__PURE__ */ (0,
|
|
4518
|
-
label && /* @__PURE__ */ (0,
|
|
4519
|
-
/* @__PURE__ */ (0,
|
|
4520
|
-
if ((0,
|
|
4690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Stack, { gap: "xs", children: [
|
|
4691
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Label, { htmlFor: name, id: labelId, className: labelClasses, children: label }),
|
|
4692
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: radioWrapperClasses, children: import_react42.Children.map(children, (child) => {
|
|
4693
|
+
if ((0, import_react42.isValidElement)(child)) {
|
|
4521
4694
|
const childValue = child.props.value;
|
|
4522
|
-
return (0,
|
|
4695
|
+
return (0, import_react42.cloneElement)(
|
|
4523
4696
|
child,
|
|
4524
4697
|
{
|
|
4525
4698
|
orientation: effectiveOrientation,
|
|
@@ -4537,7 +4710,7 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4537
4710
|
}
|
|
4538
4711
|
return child;
|
|
4539
4712
|
}) }),
|
|
4540
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ErrorMessage, { id: errorMessageId, errorMessage })
|
|
4541
4714
|
] })
|
|
4542
4715
|
}
|
|
4543
4716
|
);
|
|
@@ -4546,7 +4719,7 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
4546
4719
|
|
|
4547
4720
|
// src/components/Segment/SegmentGroup.tsx
|
|
4548
4721
|
var import_dedupe46 = __toESM(require("classnames/dedupe"));
|
|
4549
|
-
var
|
|
4722
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4550
4723
|
var SegmentGroup = (props) => {
|
|
4551
4724
|
const { children, horizontal, gap, className, ...rest } = props;
|
|
4552
4725
|
const gapClass = gap ? `gap-${gap}` : "";
|
|
@@ -4557,14 +4730,14 @@ var SegmentGroup = (props) => {
|
|
|
4557
4730
|
{ "--is-horizontal": horizontal },
|
|
4558
4731
|
gapClass
|
|
4559
4732
|
);
|
|
4560
|
-
return /* @__PURE__ */ (0,
|
|
4733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: classes, ...rest, children });
|
|
4561
4734
|
};
|
|
4562
4735
|
SegmentGroup.displayName = "SegmentGroup";
|
|
4563
4736
|
|
|
4564
4737
|
// src/components/Segment/Segment.tsx
|
|
4565
4738
|
var import_dedupe47 = __toESM(require("classnames/dedupe"));
|
|
4566
4739
|
var import_Segment = require("@simplybusiness/mobius/src/components/Segment/Segment.css");
|
|
4567
|
-
var
|
|
4740
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4568
4741
|
var Segment = ({ ref, ...props }) => {
|
|
4569
4742
|
const { heading, children, colour, inverted, className, ...rest } = props;
|
|
4570
4743
|
const classes = (0, import_dedupe47.default)(
|
|
@@ -4574,8 +4747,8 @@ var Segment = ({ ref, ...props }) => {
|
|
|
4574
4747
|
{ inverted },
|
|
4575
4748
|
className
|
|
4576
4749
|
);
|
|
4577
|
-
return /* @__PURE__ */ (0,
|
|
4578
|
-
heading && /* @__PURE__ */ (0,
|
|
4750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { ref, className: classes, ...rest, children: [
|
|
4751
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "mobius-segment__heading", children: heading }),
|
|
4579
4752
|
children
|
|
4580
4753
|
] });
|
|
4581
4754
|
};
|
|
@@ -4584,7 +4757,7 @@ Segment.displayName = "Segment";
|
|
|
4584
4757
|
// src/components/Select/Select.tsx
|
|
4585
4758
|
var import_icons13 = require("@simplybusiness/icons");
|
|
4586
4759
|
var import_dedupe48 = __toESM(require("classnames/dedupe"));
|
|
4587
|
-
var
|
|
4760
|
+
var import_react43 = require("react");
|
|
4588
4761
|
init_hooks();
|
|
4589
4762
|
init_useLabel2();
|
|
4590
4763
|
init_spaceDelimitedList();
|
|
@@ -4593,7 +4766,7 @@ init_Icon2();
|
|
|
4593
4766
|
init_Label2();
|
|
4594
4767
|
init_Stack2();
|
|
4595
4768
|
var import_Select = require("@simplybusiness/mobius/src/components/Select/Select.css");
|
|
4596
|
-
var
|
|
4769
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4597
4770
|
var Select = ({ ref, ...props }) => {
|
|
4598
4771
|
const {
|
|
4599
4772
|
label,
|
|
@@ -4631,7 +4804,7 @@ var Select = ({ ref, ...props }) => {
|
|
|
4631
4804
|
otherProps.className
|
|
4632
4805
|
);
|
|
4633
4806
|
const iconClasses = (0, import_dedupe48.default)("mobius-select__icon", sharedClasses);
|
|
4634
|
-
const errorMessageId = (0,
|
|
4807
|
+
const errorMessageId = (0, import_react43.useId)();
|
|
4635
4808
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
4636
4809
|
const describedBy = spaceDelimitedList([
|
|
4637
4810
|
shouldErrorMessageShow,
|
|
@@ -4642,10 +4815,10 @@ var Select = ({ ref, ...props }) => {
|
|
|
4642
4815
|
onChange(e);
|
|
4643
4816
|
}
|
|
4644
4817
|
};
|
|
4645
|
-
return /* @__PURE__ */ (0,
|
|
4646
|
-
label && /* @__PURE__ */ (0,
|
|
4647
|
-
/* @__PURE__ */ (0,
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Stack, { className: "mobius mobius-select__outer", gap: "xs", children: [
|
|
4819
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Label, { ...labelProps, className: labelClasses, children: label }),
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: wrapperClasses, children: [
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4649
4822
|
"select",
|
|
4650
4823
|
{
|
|
4651
4824
|
...otherProps,
|
|
@@ -4661,21 +4834,21 @@ var Select = ({ ref, ...props }) => {
|
|
|
4661
4834
|
onChange: handleChange
|
|
4662
4835
|
}
|
|
4663
4836
|
),
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
4837
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { icon: import_icons13.chevronDown }) })
|
|
4665
4838
|
] }),
|
|
4666
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
4839
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorMessage, { id: errorMessageId, errorMessage })
|
|
4667
4840
|
] });
|
|
4668
4841
|
};
|
|
4669
4842
|
Select.displayName = "Select";
|
|
4670
4843
|
|
|
4671
4844
|
// src/components/Slider/Slider.tsx
|
|
4672
4845
|
var import_dedupe49 = __toESM(require("classnames/dedupe"));
|
|
4673
|
-
var
|
|
4846
|
+
var import_react45 = require("react");
|
|
4674
4847
|
init_hooks();
|
|
4675
4848
|
init_Label2();
|
|
4676
4849
|
|
|
4677
4850
|
// src/components/Slider/helpers.ts
|
|
4678
|
-
var
|
|
4851
|
+
var import_react44 = require("react");
|
|
4679
4852
|
function numberFormatter(value, formatOptions, locale = navigator.languages?.[0] || "en-GB") {
|
|
4680
4853
|
if (!formatOptions) {
|
|
4681
4854
|
return value?.toString() || "";
|
|
@@ -4685,7 +4858,7 @@ function numberFormatter(value, formatOptions, locale = navigator.languages?.[0]
|
|
|
4685
4858
|
|
|
4686
4859
|
// src/components/Slider/Slider.tsx
|
|
4687
4860
|
var import_Slider = require("@simplybusiness/mobius/src/components/Slider/Slider.css");
|
|
4688
|
-
var
|
|
4861
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4689
4862
|
var Slider = (props) => {
|
|
4690
4863
|
const {
|
|
4691
4864
|
id,
|
|
@@ -4706,11 +4879,11 @@ var Slider = (props) => {
|
|
|
4706
4879
|
formatOptions,
|
|
4707
4880
|
isDisabled = false
|
|
4708
4881
|
} = props;
|
|
4709
|
-
const trackRef = (0,
|
|
4710
|
-
const [currentValue, setCurrentValue] = (0,
|
|
4882
|
+
const trackRef = (0, import_react45.useRef)(null);
|
|
4883
|
+
const [currentValue, setCurrentValue] = (0, import_react45.useState)(
|
|
4711
4884
|
value || defaultValue || 0
|
|
4712
4885
|
);
|
|
4713
|
-
const [isDragging, setIsDraggging] = (0,
|
|
4886
|
+
const [isDragging, setIsDraggging] = (0, import_react45.useState)(false);
|
|
4714
4887
|
const { labelProps, fieldProps } = useLabel({
|
|
4715
4888
|
id,
|
|
4716
4889
|
label,
|
|
@@ -4740,12 +4913,12 @@ var Slider = (props) => {
|
|
|
4740
4913
|
onChangeEnd(currentValue);
|
|
4741
4914
|
}
|
|
4742
4915
|
};
|
|
4743
|
-
return /* @__PURE__ */ (0,
|
|
4744
|
-
/* @__PURE__ */ (0,
|
|
4745
|
-
label && /* @__PURE__ */ (0,
|
|
4746
|
-
label && /* @__PURE__ */ (0,
|
|
4916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: classes, children: [
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mobius-slider__label-wrapper", children: [
|
|
4918
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Label, { ...labelProps, children: label }),
|
|
4919
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("output", { style: { flex: "1 0 auto", textAlign: "end" }, children: formattedValue })
|
|
4747
4920
|
] }),
|
|
4748
|
-
/* @__PURE__ */ (0,
|
|
4921
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: trackRef, className: "mobius-slider__track-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4749
4922
|
"input",
|
|
4750
4923
|
{
|
|
4751
4924
|
className: "mobius-slider__track",
|
|
@@ -4764,9 +4937,9 @@ var Slider = (props) => {
|
|
|
4764
4937
|
...fieldProps
|
|
4765
4938
|
}
|
|
4766
4939
|
) }),
|
|
4767
|
-
/* @__PURE__ */ (0,
|
|
4768
|
-
/* @__PURE__ */ (0,
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
4940
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mobius-slider__labels", children: [
|
|
4941
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mobius-slider__min-label", "data-testid": "min-label", children: minLabel }),
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mobius-slider__max-label", "data-testid": "max-label", children: maxLabel })
|
|
4770
4943
|
] })
|
|
4771
4944
|
] });
|
|
4772
4945
|
};
|
|
@@ -4775,15 +4948,15 @@ var Slider = (props) => {
|
|
|
4775
4948
|
init_Stack2();
|
|
4776
4949
|
|
|
4777
4950
|
// src/components/SVG/SVG.tsx
|
|
4778
|
-
var
|
|
4951
|
+
var import_react46 = require("react");
|
|
4779
4952
|
var import_dedupe50 = __toESM(require("classnames/dedupe"));
|
|
4780
|
-
var
|
|
4953
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4781
4954
|
var SVG = ({ ref, ...props }) => {
|
|
4782
4955
|
const { children, className, ...otherProps } = props;
|
|
4783
4956
|
const classes = (0, import_dedupe50.default)("mobius", "mobius-svg", className);
|
|
4784
|
-
const svgNode =
|
|
4957
|
+
const svgNode = import_react46.Children.only(children);
|
|
4785
4958
|
const { children: svgChildren, viewBox, xmlns } = svgNode.props;
|
|
4786
|
-
return /* @__PURE__ */ (0,
|
|
4959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4787
4960
|
"svg",
|
|
4788
4961
|
{
|
|
4789
4962
|
viewBox,
|
|
@@ -4798,10 +4971,10 @@ var SVG = ({ ref, ...props }) => {
|
|
|
4798
4971
|
SVG.displayName = "SVG";
|
|
4799
4972
|
|
|
4800
4973
|
// src/components/Switch/Switch.tsx
|
|
4801
|
-
var
|
|
4974
|
+
var import_react47 = require("react");
|
|
4802
4975
|
var import_dedupe51 = __toESM(require("classnames/dedupe"));
|
|
4803
4976
|
var import_Switch = require("@simplybusiness/mobius/src/components/Switch/Switch.css");
|
|
4804
|
-
var
|
|
4977
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4805
4978
|
var Switch = ({ ref, ...props }) => {
|
|
4806
4979
|
const {
|
|
4807
4980
|
checked = false,
|
|
@@ -4810,8 +4983,8 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4810
4983
|
isDisabled = false,
|
|
4811
4984
|
...otherProps
|
|
4812
4985
|
} = props;
|
|
4813
|
-
const [enabled, setEnabled] = (0,
|
|
4814
|
-
(0,
|
|
4986
|
+
const [enabled, setEnabled] = (0, import_react47.useState)(checked);
|
|
4987
|
+
(0, import_react47.useEffect)(() => {
|
|
4815
4988
|
setEnabled(checked);
|
|
4816
4989
|
}, [checked]);
|
|
4817
4990
|
const classes = (0, import_dedupe51.default)(
|
|
@@ -4829,9 +5002,9 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4829
5002
|
onChange(event);
|
|
4830
5003
|
}
|
|
4831
5004
|
};
|
|
4832
|
-
return /* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { ref, className: classes, children: [
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: enabled ? "On" : "Off" }) }),
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4835
5008
|
"input",
|
|
4836
5009
|
{
|
|
4837
5010
|
type: "checkbox",
|
|
@@ -4842,7 +5015,7 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4842
5015
|
...otherProps
|
|
4843
5016
|
}
|
|
4844
5017
|
),
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "mobius-switch__slider" })
|
|
4846
5019
|
] });
|
|
4847
5020
|
};
|
|
4848
5021
|
Switch.displayName = "Switch";
|
|
@@ -4850,72 +5023,72 @@ Switch.displayName = "Switch";
|
|
|
4850
5023
|
// src/components/Table/Table.tsx
|
|
4851
5024
|
var import_dedupe52 = __toESM(require("classnames/dedupe"));
|
|
4852
5025
|
var import_Table = require("@simplybusiness/mobius/src/components/Table/Table.css");
|
|
4853
|
-
var
|
|
5026
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4854
5027
|
var Table = ({ ref, ...props }) => {
|
|
4855
5028
|
const classes = (0, import_dedupe52.default)("mobius", "mobius-table", props.className);
|
|
4856
|
-
return /* @__PURE__ */ (0,
|
|
5029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("table", { ref, ...props, className: classes });
|
|
4857
5030
|
};
|
|
4858
5031
|
Table.displayName = "Table";
|
|
4859
5032
|
|
|
4860
5033
|
// src/components/Table/Head.tsx
|
|
4861
5034
|
var import_dedupe53 = __toESM(require("classnames/dedupe"));
|
|
4862
|
-
var
|
|
5035
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4863
5036
|
var Head = ({ ref, ...props }) => {
|
|
4864
5037
|
const classes = (0, import_dedupe53.default)("mobius", "mobius-table__head", props.className);
|
|
4865
|
-
return /* @__PURE__ */ (0,
|
|
5038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { ref, ...props, className: classes });
|
|
4866
5039
|
};
|
|
4867
5040
|
Head.displayName = "Table.Head";
|
|
4868
5041
|
|
|
4869
5042
|
// src/components/Table/Body.tsx
|
|
4870
5043
|
var import_dedupe54 = __toESM(require("classnames/dedupe"));
|
|
4871
|
-
var
|
|
5044
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4872
5045
|
var Body = ({ ref, ...props }) => {
|
|
4873
5046
|
const classes = (0, import_dedupe54.default)("mobius", "mobius-table__body", props.className);
|
|
4874
|
-
return /* @__PURE__ */ (0,
|
|
5047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("tbody", { ref, ...props, className: classes });
|
|
4875
5048
|
};
|
|
4876
5049
|
Body.displayName = "Table.Body";
|
|
4877
5050
|
|
|
4878
5051
|
// src/components/Table/Foot.tsx
|
|
4879
5052
|
var import_dedupe55 = __toESM(require("classnames/dedupe"));
|
|
4880
|
-
var
|
|
5053
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4881
5054
|
var Foot = ({ ref, ...props }) => {
|
|
4882
5055
|
const classes = (0, import_dedupe55.default)("mobius", "mobius-table__foot", props.className);
|
|
4883
|
-
return /* @__PURE__ */ (0,
|
|
5056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tfoot", { ref, ...props, className: classes });
|
|
4884
5057
|
};
|
|
4885
5058
|
Foot.displayName = "Table.Foot";
|
|
4886
5059
|
|
|
4887
5060
|
// src/components/Table/Row.tsx
|
|
4888
5061
|
var import_dedupe56 = __toESM(require("classnames/dedupe"));
|
|
4889
|
-
var
|
|
5062
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4890
5063
|
var Row = ({ ref, ...props }) => {
|
|
4891
5064
|
const classes = (0, import_dedupe56.default)("mobius", "mobius-table__row", props.className);
|
|
4892
|
-
return /* @__PURE__ */ (0,
|
|
5065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tr", { ref, ...props, className: classes });
|
|
4893
5066
|
};
|
|
4894
5067
|
Row.displayName = "Table.Row";
|
|
4895
5068
|
|
|
4896
5069
|
// src/components/Table/HeaderCell.tsx
|
|
4897
5070
|
var import_dedupe57 = __toESM(require("classnames/dedupe"));
|
|
4898
|
-
var
|
|
5071
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4899
5072
|
var HeaderCell = ({ ref, scope = "col", ...props }) => {
|
|
4900
5073
|
const classes = (0, import_dedupe57.default)(
|
|
4901
5074
|
"mobius",
|
|
4902
5075
|
"mobius-table__head-cell",
|
|
4903
5076
|
props.className
|
|
4904
5077
|
);
|
|
4905
|
-
return /* @__PURE__ */ (0,
|
|
5078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { ...props, ref, scope, className: classes });
|
|
4906
5079
|
};
|
|
4907
5080
|
HeaderCell.displayName = "Table.HeaderCell";
|
|
4908
5081
|
|
|
4909
5082
|
// src/components/Table/Cell.tsx
|
|
4910
5083
|
var import_dedupe58 = __toESM(require("classnames/dedupe"));
|
|
4911
|
-
var
|
|
5084
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4912
5085
|
var Cell = ({ ref, ...props }) => {
|
|
4913
5086
|
const classes = (0, import_dedupe58.default)(
|
|
4914
5087
|
"mobius",
|
|
4915
5088
|
"mobius-table__body-cell",
|
|
4916
5089
|
props.className
|
|
4917
5090
|
);
|
|
4918
|
-
return /* @__PURE__ */ (0,
|
|
5091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("td", { ref, ...props, className: classes });
|
|
4919
5092
|
};
|
|
4920
5093
|
Cell.displayName = "Table.Cell";
|
|
4921
5094
|
|
|
@@ -4939,7 +5112,7 @@ init_Stack2();
|
|
|
4939
5112
|
|
|
4940
5113
|
// src/components/TextAreaInput/TextAreaInput.tsx
|
|
4941
5114
|
var import_dedupe59 = __toESM(require("classnames/dedupe"));
|
|
4942
|
-
var
|
|
5115
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4943
5116
|
var TextAreaInput = ({ ref, ...props }) => {
|
|
4944
5117
|
const { isSelected, isDisabled, isReadOnly, isRequired, ...otherProps } = props;
|
|
4945
5118
|
const classes = (0, import_dedupe59.default)(
|
|
@@ -4952,7 +5125,7 @@ var TextAreaInput = ({ ref, ...props }) => {
|
|
|
4952
5125
|
},
|
|
4953
5126
|
otherProps.className
|
|
4954
5127
|
);
|
|
4955
|
-
return /* @__PURE__ */ (0,
|
|
5128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4956
5129
|
"textarea",
|
|
4957
5130
|
{
|
|
4958
5131
|
ref,
|
|
@@ -4967,7 +5140,7 @@ TextAreaInput.displayName = "TextAreaInput";
|
|
|
4967
5140
|
|
|
4968
5141
|
// src/components/TextArea/TextArea.tsx
|
|
4969
5142
|
var import_TextArea = require("@simplybusiness/mobius/src/components/TextArea/TextArea.css");
|
|
4970
|
-
var
|
|
5143
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4971
5144
|
var TextArea = ({ ref, ...props }) => {
|
|
4972
5145
|
const {
|
|
4973
5146
|
isDisabled,
|
|
@@ -4987,9 +5160,9 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
4987
5160
|
},
|
|
4988
5161
|
validationClasses
|
|
4989
5162
|
);
|
|
4990
|
-
return /* @__PURE__ */ (0,
|
|
4991
|
-
label && /* @__PURE__ */ (0,
|
|
4992
|
-
/* @__PURE__ */ (0,
|
|
5163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Stack, { className: classes, gap: "xs", children: [
|
|
5164
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Label, { ...labelProps, className: labelClasses, children: props.label }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4993
5166
|
TextAreaInput,
|
|
4994
5167
|
{
|
|
4995
5168
|
...otherProps,
|
|
@@ -5000,7 +5173,7 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
5000
5173
|
"aria-invalid": errorMessage != null
|
|
5001
5174
|
}
|
|
5002
5175
|
),
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorMessage, { ...errorMessageProps, errorMessage })
|
|
5004
5177
|
] });
|
|
5005
5178
|
};
|
|
5006
5179
|
TextArea.displayName = "TextArea";
|
|
@@ -5012,7 +5185,7 @@ init_TextOrHTML2();
|
|
|
5012
5185
|
// src/components/Title/Title.tsx
|
|
5013
5186
|
var import_dedupe61 = __toESM(require("classnames/dedupe"));
|
|
5014
5187
|
var import_Title = require("@simplybusiness/mobius/src/components/Title/Title.css");
|
|
5015
|
-
var
|
|
5188
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5016
5189
|
var Title = ({ ref, ...props }) => {
|
|
5017
5190
|
const {
|
|
5018
5191
|
elementType: Element = "div",
|
|
@@ -5024,9 +5197,9 @@ var Title = ({ ref, ...props }) => {
|
|
|
5024
5197
|
const headerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__header");
|
|
5025
5198
|
const contentClasses = (0, import_dedupe61.default)("mobius", "mobius-title__description");
|
|
5026
5199
|
const containerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__container");
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Element, { ref, ...otherProps, className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { flexDirection: "column", className: containerClasses, children: [
|
|
5201
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: headerClasses, children: title }),
|
|
5202
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: contentClasses, children: description })
|
|
5030
5203
|
] }) });
|
|
5031
5204
|
};
|
|
5032
5205
|
Title.displayName = "Title";
|
|
@@ -5044,7 +5217,7 @@ var toastState = {
|
|
|
5044
5217
|
|
|
5045
5218
|
// src/components/Toast/Toast.tsx
|
|
5046
5219
|
var import_Toast = require("@simplybusiness/mobius/src/components/Toast/Toast.css");
|
|
5047
|
-
var
|
|
5220
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
5048
5221
|
var variantIcons = {
|
|
5049
5222
|
info: import_icons14.circleInfo,
|
|
5050
5223
|
success: import_icons14.circleCheck,
|
|
@@ -5057,8 +5230,8 @@ var variantColors = {
|
|
|
5057
5230
|
warning: "var(--color-warning)",
|
|
5058
5231
|
error: "var(--color-error)"
|
|
5059
5232
|
};
|
|
5060
|
-
var ToastIcon = ({ variant }) => /* @__PURE__ */ (0,
|
|
5061
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
5233
|
+
var ToastIcon = ({ variant }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "mobius-toast__icon", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { icon: variantIcons[variant], color: variantColors[variant] }) });
|
|
5234
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "mobius-toast__close-icon", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { icon: import_icons14.cross }) });
|
|
5062
5235
|
var ToastContent = ({
|
|
5063
5236
|
toastId,
|
|
5064
5237
|
variant,
|
|
@@ -5067,15 +5240,15 @@ var ToastContent = ({
|
|
|
5067
5240
|
action,
|
|
5068
5241
|
cancel,
|
|
5069
5242
|
showCloseButton = toastState.showCloseButton
|
|
5070
|
-
}) => /* @__PURE__ */ (0,
|
|
5071
|
-
/* @__PURE__ */ (0,
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5073
|
-
/* @__PURE__ */ (0,
|
|
5074
|
-
title && /* @__PURE__ */ (0,
|
|
5075
|
-
description && /* @__PURE__ */ (0,
|
|
5243
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: (0, import_dedupe62.default)("mobius", "mobius-toast", `--${variant}`), children: [
|
|
5244
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ToastIcon, { variant }),
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__body", children: [
|
|
5246
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__content", children: [
|
|
5247
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__title", children: title }),
|
|
5248
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__description", children: description })
|
|
5076
5249
|
] }),
|
|
5077
|
-
(action || cancel) && /* @__PURE__ */ (0,
|
|
5078
|
-
cancel && /* @__PURE__ */ (0,
|
|
5250
|
+
(action || cancel) && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__actions", children: [
|
|
5251
|
+
cancel && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5079
5252
|
"button",
|
|
5080
5253
|
{
|
|
5081
5254
|
type: "button",
|
|
@@ -5087,7 +5260,7 @@ var ToastContent = ({
|
|
|
5087
5260
|
children: cancel.label
|
|
5088
5261
|
}
|
|
5089
5262
|
),
|
|
5090
|
-
action && /* @__PURE__ */ (0,
|
|
5263
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5091
5264
|
"button",
|
|
5092
5265
|
{
|
|
5093
5266
|
type: "button",
|
|
@@ -5101,19 +5274,19 @@ var ToastContent = ({
|
|
|
5101
5274
|
)
|
|
5102
5275
|
] })
|
|
5103
5276
|
] }),
|
|
5104
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
5277
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5105
5278
|
"button",
|
|
5106
5279
|
{
|
|
5107
5280
|
type: "button",
|
|
5108
5281
|
className: "mobius-toast__close",
|
|
5109
5282
|
onClick: () => import_sonner.toast.dismiss(toastId),
|
|
5110
5283
|
"aria-label": "Close",
|
|
5111
|
-
children: /* @__PURE__ */ (0,
|
|
5284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(CloseIcon, {})
|
|
5112
5285
|
}
|
|
5113
5286
|
)
|
|
5114
5287
|
] });
|
|
5115
5288
|
var createCustomToast = (message, variant, options) => import_sonner.toast.custom(
|
|
5116
|
-
(id) => /* @__PURE__ */ (0,
|
|
5289
|
+
(id) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5117
5290
|
ToastContent,
|
|
5118
5291
|
{
|
|
5119
5292
|
toastId: id,
|
|
@@ -5145,9 +5318,9 @@ var toast = {
|
|
|
5145
5318
|
};
|
|
5146
5319
|
|
|
5147
5320
|
// src/components/Toast/Toaster.tsx
|
|
5148
|
-
var
|
|
5321
|
+
var import_react48 = require("react");
|
|
5149
5322
|
var import_sonner2 = require("sonner");
|
|
5150
|
-
var
|
|
5323
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5151
5324
|
var Toaster = ({
|
|
5152
5325
|
position = "top-right",
|
|
5153
5326
|
closeButton = true,
|
|
@@ -5156,10 +5329,10 @@ var Toaster = ({
|
|
|
5156
5329
|
visibleToasts = 3,
|
|
5157
5330
|
gap = 8
|
|
5158
5331
|
}) => {
|
|
5159
|
-
(0,
|
|
5332
|
+
(0, import_react48.useEffect)(() => {
|
|
5160
5333
|
toastState.showCloseButton = closeButton;
|
|
5161
5334
|
}, [closeButton]);
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
5335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5163
5336
|
import_sonner2.Toaster,
|
|
5164
5337
|
{
|
|
5165
5338
|
position,
|
|
@@ -5175,7 +5348,7 @@ Toaster.displayName = "Toaster";
|
|
|
5175
5348
|
|
|
5176
5349
|
// src/components/Trust/Trust.tsx
|
|
5177
5350
|
var import_dedupe63 = __toESM(require("classnames/dedupe"));
|
|
5178
|
-
var
|
|
5351
|
+
var import_react49 = require("react");
|
|
5179
5352
|
init_utils();
|
|
5180
5353
|
|
|
5181
5354
|
// src/components/Trust/constants.ts
|
|
@@ -5240,7 +5413,7 @@ var TRUSTPILOT_WIDGET = {
|
|
|
5240
5413
|
};
|
|
5241
5414
|
|
|
5242
5415
|
// src/components/Trust/Trust.tsx
|
|
5243
|
-
var
|
|
5416
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5244
5417
|
var Trust = ({ ref, ...props }) => {
|
|
5245
5418
|
const {
|
|
5246
5419
|
elementType: Element = "div",
|
|
@@ -5252,8 +5425,8 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5252
5425
|
stars,
|
|
5253
5426
|
className
|
|
5254
5427
|
} = props;
|
|
5255
|
-
const [isMounted, setIsMounted] = (0,
|
|
5256
|
-
const trustRef = (0,
|
|
5428
|
+
const [isMounted, setIsMounted] = (0, import_react49.useState)(false);
|
|
5429
|
+
const trustRef = (0, import_react49.useRef)(null);
|
|
5257
5430
|
const {
|
|
5258
5431
|
templateId,
|
|
5259
5432
|
className: variantClassName,
|
|
@@ -5280,24 +5453,24 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5280
5453
|
},
|
|
5281
5454
|
className
|
|
5282
5455
|
);
|
|
5283
|
-
(0,
|
|
5456
|
+
(0, import_react49.useEffect)(() => {
|
|
5284
5457
|
const hasTrustpilotLoaded = trustRef.current && window?.Trustpilot && window?.Trustpilot.loadFromElement;
|
|
5285
5458
|
if (isMounted && hasTrustpilotLoaded) {
|
|
5286
5459
|
window.Trustpilot.loadFromElement(trustRef.current, true);
|
|
5287
5460
|
}
|
|
5288
5461
|
}, [isMounted]);
|
|
5289
|
-
(0,
|
|
5462
|
+
(0, import_react49.useEffect)(() => {
|
|
5290
5463
|
setIsMounted(true);
|
|
5291
5464
|
}, []);
|
|
5292
|
-
if (!isMounted) return /* @__PURE__ */ (0,
|
|
5293
|
-
return /* @__PURE__ */ (0,
|
|
5465
|
+
if (!isMounted) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles });
|
|
5466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5294
5467
|
Element,
|
|
5295
5468
|
{
|
|
5296
5469
|
ref: mergeRefs([trustRef, ref]),
|
|
5297
5470
|
className: classes,
|
|
5298
5471
|
style: styles,
|
|
5299
5472
|
...dataProps,
|
|
5300
|
-
children: /* @__PURE__ */ (0,
|
|
5473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5301
5474
|
"a",
|
|
5302
5475
|
{
|
|
5303
5476
|
href: link,
|
|
@@ -5313,11 +5486,11 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5313
5486
|
|
|
5314
5487
|
// src/components/ExpandableText/ExpandableText.tsx
|
|
5315
5488
|
var import_dedupe64 = __toESM(require("classnames/dedupe"));
|
|
5316
|
-
var
|
|
5489
|
+
var import_react50 = require("react");
|
|
5317
5490
|
init_hooks();
|
|
5318
5491
|
init_TextOrHTML2();
|
|
5319
5492
|
var import_ExpandableText = require("@simplybusiness/mobius/src/components/ExpandableText/ExpandableText.css");
|
|
5320
|
-
var
|
|
5493
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5321
5494
|
var ExpandableText = ({ ref, ...props }) => {
|
|
5322
5495
|
const {
|
|
5323
5496
|
text,
|
|
@@ -5331,14 +5504,14 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5331
5504
|
onToggle,
|
|
5332
5505
|
...otherProps
|
|
5333
5506
|
} = props;
|
|
5334
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
5335
|
-
const [isCollapsed, setIsCollapsed] = (0,
|
|
5336
|
-
const textRef = (0,
|
|
5507
|
+
const [isExpanded, setIsExpanded] = (0, import_react50.useState)(false);
|
|
5508
|
+
const [isCollapsed, setIsCollapsed] = (0, import_react50.useState)(false);
|
|
5509
|
+
const textRef = (0, import_react50.useRef)(null);
|
|
5337
5510
|
const { down } = useBreakpoint();
|
|
5338
|
-
const baseId = (0,
|
|
5511
|
+
const baseId = (0, import_react50.useId)();
|
|
5339
5512
|
const expandButtonId = `expandable-text-expand-${baseId}`;
|
|
5340
5513
|
const shouldCollapse = breakpoint ? down(breakpoint) : true;
|
|
5341
|
-
(0,
|
|
5514
|
+
(0, import_react50.useEffect)(() => {
|
|
5342
5515
|
if (!shouldCollapse || !textRef.current) {
|
|
5343
5516
|
setIsCollapsed(false);
|
|
5344
5517
|
return;
|
|
@@ -5348,7 +5521,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5348
5521
|
setIsCollapsed(isOverflowing);
|
|
5349
5522
|
}, [text, shouldCollapse, maxLines]);
|
|
5350
5523
|
if (breakpoint && !shouldCollapse) {
|
|
5351
|
-
return /* @__PURE__ */ (0,
|
|
5524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ref, className, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { text, textWrapper: true, ...textProps }) });
|
|
5352
5525
|
}
|
|
5353
5526
|
const handleAccordionChange = (expanded) => {
|
|
5354
5527
|
setIsExpanded(expanded);
|
|
@@ -5361,7 +5534,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5361
5534
|
const textContainerStyle = {
|
|
5362
5535
|
"--line-clamp": maxLines
|
|
5363
5536
|
};
|
|
5364
|
-
return /* @__PURE__ */ (0,
|
|
5537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
5365
5538
|
"div",
|
|
5366
5539
|
{
|
|
5367
5540
|
ref,
|
|
@@ -5369,7 +5542,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5369
5542
|
"data-testid": "expandable-text",
|
|
5370
5543
|
...otherProps,
|
|
5371
5544
|
children: [
|
|
5372
|
-
/* @__PURE__ */ (0,
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5373
5546
|
"div",
|
|
5374
5547
|
{
|
|
5375
5548
|
ref: textRef,
|
|
@@ -5377,10 +5550,10 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5377
5550
|
style: textContainerStyle,
|
|
5378
5551
|
"data-testid": "expandable-text-content",
|
|
5379
5552
|
"aria-describedby": isCollapsed ? expandButtonId : void 0,
|
|
5380
|
-
children: /* @__PURE__ */ (0,
|
|
5553
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { elementType: "span", textWrapper: true, text, ...textProps })
|
|
5381
5554
|
}
|
|
5382
5555
|
),
|
|
5383
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
5556
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5384
5557
|
Accordion,
|
|
5385
5558
|
{
|
|
5386
5559
|
showText,
|
|
@@ -5403,7 +5576,7 @@ ExpandableText.displayName = "ExpandableText";
|
|
|
5403
5576
|
// src/components/MaskedField/index.tsx
|
|
5404
5577
|
var import_component = __toESM(require("@loadable/component"));
|
|
5405
5578
|
init_TextField2();
|
|
5406
|
-
var
|
|
5579
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5407
5580
|
var LoadableMaskedField = (0, import_component.default)(() => Promise.resolve().then(() => (init_MaskedField(), MaskedField_exports)), {
|
|
5408
5581
|
resolveComponent: (mod) => mod.MaskedField
|
|
5409
5582
|
});
|
|
@@ -5415,11 +5588,11 @@ function MaskedField2(props) {
|
|
|
5415
5588
|
ref: forwardedRef,
|
|
5416
5589
|
...textFieldProps
|
|
5417
5590
|
} = props;
|
|
5418
|
-
return /* @__PURE__ */ (0,
|
|
5591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5419
5592
|
LoadableMaskedField,
|
|
5420
5593
|
{
|
|
5421
5594
|
...props,
|
|
5422
|
-
fallback: /* @__PURE__ */ (0,
|
|
5595
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5423
5596
|
TextField,
|
|
5424
5597
|
{
|
|
5425
5598
|
...textFieldProps,
|