@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
package/dist/cjs/index.js
CHANGED
|
@@ -946,9 +946,10 @@ var init_adornmentWithClassName = __esm({
|
|
|
946
946
|
import_react10 = require("react");
|
|
947
947
|
adornmentWithClassName = (component, validationClasses, className) => {
|
|
948
948
|
if (!component) return null;
|
|
949
|
-
|
|
949
|
+
const typedComponent = component;
|
|
950
|
+
return (0, import_react10.cloneElement)(typedComponent, {
|
|
950
951
|
className: (0, import_dedupe12.default)(
|
|
951
|
-
|
|
952
|
+
typedComponent.props.className,
|
|
952
953
|
validationClasses,
|
|
953
954
|
className
|
|
954
955
|
)
|
|
@@ -958,12 +959,13 @@ var init_adornmentWithClassName = __esm({
|
|
|
958
959
|
});
|
|
959
960
|
|
|
960
961
|
// src/components/TextField/TextField.tsx
|
|
961
|
-
var import_dedupe13, import_TextField, import_jsx_runtime12, TextField;
|
|
962
|
+
var import_dedupe13, import_react11, import_TextField, import_jsx_runtime12, TextFieldInner, TextField;
|
|
962
963
|
var init_TextField = __esm({
|
|
963
964
|
"src/components/TextField/TextField.tsx"() {
|
|
964
965
|
"use strict";
|
|
965
966
|
"use client";
|
|
966
967
|
import_dedupe13 = __toESM(require("classnames/dedupe"));
|
|
968
|
+
import_react11 = require("react");
|
|
967
969
|
init_hooks();
|
|
968
970
|
init_ErrorMessage2();
|
|
969
971
|
init_Label2();
|
|
@@ -971,7 +973,7 @@ var init_TextField = __esm({
|
|
|
971
973
|
init_adornmentWithClassName();
|
|
972
974
|
import_TextField = require("@simplybusiness/mobius/src/components/TextField/TextField.css");
|
|
973
975
|
import_jsx_runtime12 = require("react/jsx-runtime");
|
|
974
|
-
|
|
976
|
+
TextFieldInner = ({ ref, ...props }) => {
|
|
975
977
|
const {
|
|
976
978
|
isDisabled,
|
|
977
979
|
type = "text",
|
|
@@ -1065,6 +1067,7 @@ var init_TextField = __esm({
|
|
|
1065
1067
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorMessage, { ...errorMessageProps, errorMessage })
|
|
1066
1068
|
] });
|
|
1067
1069
|
};
|
|
1070
|
+
TextField = (0, import_react11.memo)(TextFieldInner);
|
|
1068
1071
|
TextField.displayName = "TextField";
|
|
1069
1072
|
}
|
|
1070
1073
|
});
|
|
@@ -1082,17 +1085,17 @@ var MaskedField_exports = {};
|
|
|
1082
1085
|
__export(MaskedField_exports, {
|
|
1083
1086
|
MaskedField: () => MaskedField
|
|
1084
1087
|
});
|
|
1085
|
-
var
|
|
1088
|
+
var import_react51, import_react_imask, import_jsx_runtime76, useAcceptHandler, useCombinedRef, useBlurHandler, ControlledMaskedField, UncontrolledMaskedField, MaskedField;
|
|
1086
1089
|
var init_MaskedField = __esm({
|
|
1087
1090
|
"src/components/MaskedField/MaskedField.tsx"() {
|
|
1088
1091
|
"use strict";
|
|
1089
1092
|
"use client";
|
|
1090
|
-
|
|
1093
|
+
import_react51 = require("react");
|
|
1091
1094
|
import_react_imask = require("react-imask");
|
|
1092
1095
|
init_TextField2();
|
|
1093
|
-
|
|
1096
|
+
import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1094
1097
|
useAcceptHandler = (onChange, useMaskedValue, name) => {
|
|
1095
|
-
return (0,
|
|
1098
|
+
return (0, import_react51.useCallback)(
|
|
1096
1099
|
(maskedValue, maskInstance) => {
|
|
1097
1100
|
if (!onChange) {
|
|
1098
1101
|
return;
|
|
@@ -1108,7 +1111,7 @@ var init_MaskedField = __esm({
|
|
|
1108
1111
|
);
|
|
1109
1112
|
};
|
|
1110
1113
|
useCombinedRef = (imaskRef, forwardedRef) => {
|
|
1111
|
-
return (0,
|
|
1114
|
+
return (0, import_react51.useCallback)(
|
|
1112
1115
|
(element) => {
|
|
1113
1116
|
imaskRef.current = element;
|
|
1114
1117
|
if (typeof forwardedRef === "function") {
|
|
@@ -1121,7 +1124,7 @@ var init_MaskedField = __esm({
|
|
|
1121
1124
|
);
|
|
1122
1125
|
};
|
|
1123
1126
|
useBlurHandler = (onBlur, maskRef, useMaskedValue, name) => {
|
|
1124
|
-
return (0,
|
|
1127
|
+
return (0, import_react51.useCallback)(
|
|
1125
1128
|
(event) => {
|
|
1126
1129
|
if (!onBlur || !maskRef.current) {
|
|
1127
1130
|
return;
|
|
@@ -1151,7 +1154,7 @@ var init_MaskedField = __esm({
|
|
|
1151
1154
|
const { ref: imaskRef, maskRef, setValue } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1152
1155
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1153
1156
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1154
|
-
(0,
|
|
1157
|
+
(0, import_react51.useEffect)(() => {
|
|
1155
1158
|
if (!maskRef.current) {
|
|
1156
1159
|
return;
|
|
1157
1160
|
}
|
|
@@ -1162,7 +1165,7 @@ var init_MaskedField = __esm({
|
|
|
1162
1165
|
setValue(stringValue);
|
|
1163
1166
|
}
|
|
1164
1167
|
}, [value, maskRef, setValue, imaskRef]);
|
|
1165
|
-
return /* @__PURE__ */ (0,
|
|
1168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1166
1169
|
TextField,
|
|
1167
1170
|
{
|
|
1168
1171
|
...textFieldProps,
|
|
@@ -1186,7 +1189,7 @@ var init_MaskedField = __esm({
|
|
|
1186
1189
|
const { ref: imaskRef, maskRef } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1187
1190
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1188
1191
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1189
|
-
return /* @__PURE__ */ (0,
|
|
1192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1190
1193
|
TextField,
|
|
1191
1194
|
{
|
|
1192
1195
|
...textFieldProps,
|
|
@@ -1200,7 +1203,7 @@ var init_MaskedField = __esm({
|
|
|
1200
1203
|
MaskedField = ({ ref: forwardedRef, ...props }) => {
|
|
1201
1204
|
const { value, defaultValue, ...rest } = props;
|
|
1202
1205
|
if ("value" in props) {
|
|
1203
|
-
return /* @__PURE__ */ (0,
|
|
1206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1204
1207
|
ControlledMaskedField,
|
|
1205
1208
|
{
|
|
1206
1209
|
...rest,
|
|
@@ -1209,7 +1212,7 @@ var init_MaskedField = __esm({
|
|
|
1209
1212
|
}
|
|
1210
1213
|
);
|
|
1211
1214
|
} else {
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1213
1216
|
UncontrolledMaskedField,
|
|
1214
1217
|
{
|
|
1215
1218
|
...rest,
|
|
@@ -1671,12 +1674,12 @@ AccordionList.displayName = "AccordionList";
|
|
|
1671
1674
|
|
|
1672
1675
|
// src/components/AddressLookup/AddressLookup.tsx
|
|
1673
1676
|
var import_icons3 = require("@simplybusiness/icons");
|
|
1674
|
-
var
|
|
1677
|
+
var import_react16 = require("react");
|
|
1675
1678
|
|
|
1676
1679
|
// src/components/Combobox/Combobox.tsx
|
|
1677
1680
|
var import_mobius_hooks5 = require("@simplybusiness/mobius-hooks");
|
|
1678
1681
|
var import_dedupe16 = __toESM(require("classnames/dedupe"));
|
|
1679
|
-
var
|
|
1682
|
+
var import_react15 = require("react");
|
|
1680
1683
|
init_hooks();
|
|
1681
1684
|
init_TextField2();
|
|
1682
1685
|
|
|
@@ -1715,7 +1718,7 @@ function VisuallyHidden(props) {
|
|
|
1715
1718
|
var import_dedupe15 = __toESM(require("classnames/dedupe"));
|
|
1716
1719
|
|
|
1717
1720
|
// src/components/Combobox/Option.tsx
|
|
1718
|
-
var
|
|
1721
|
+
var import_react12 = require("react");
|
|
1719
1722
|
var import_dedupe14 = __toESM(require("classnames/dedupe"));
|
|
1720
1723
|
|
|
1721
1724
|
// src/components/Combobox/utils.tsx
|
|
@@ -1750,13 +1753,13 @@ var Option = ({
|
|
|
1750
1753
|
optionTestIdPrefix,
|
|
1751
1754
|
id
|
|
1752
1755
|
}) => {
|
|
1753
|
-
const optionRef = (0,
|
|
1756
|
+
const optionRef = (0, import_react12.useRef)(null);
|
|
1754
1757
|
const optionValue = getOptionValue(option) || "";
|
|
1755
1758
|
const testId = buildOptionTestId(
|
|
1756
1759
|
optionTestIdPrefix || "combobox-option",
|
|
1757
1760
|
optionValue
|
|
1758
1761
|
);
|
|
1759
|
-
(0,
|
|
1762
|
+
(0, import_react12.useEffect)(() => {
|
|
1760
1763
|
if (isHighlighted && optionRef.current && optionRef.current.scrollIntoView) {
|
|
1761
1764
|
optionRef.current.scrollIntoView({ block: "nearest" });
|
|
1762
1765
|
}
|
|
@@ -1860,12 +1863,12 @@ var Listbox = ({
|
|
|
1860
1863
|
};
|
|
1861
1864
|
|
|
1862
1865
|
// src/components/Combobox/useComboboxHighlight.tsx
|
|
1863
|
-
var
|
|
1866
|
+
var import_react13 = require("react");
|
|
1864
1867
|
function useComboboxHighlight(options) {
|
|
1865
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
1868
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react13.useState)(
|
|
1866
1869
|
options && options.length ? 0 : -1
|
|
1867
1870
|
);
|
|
1868
|
-
const [highlightedGroupIndex, setHighlightedGroupIndex] = (0,
|
|
1871
|
+
const [highlightedGroupIndex, setHighlightedGroupIndex] = (0, import_react13.useState)(0);
|
|
1869
1872
|
function highlightNextOption() {
|
|
1870
1873
|
const isGroup = isOptionGroup(options);
|
|
1871
1874
|
if (!options) {
|
|
@@ -1944,7 +1947,7 @@ function useComboboxHighlight(options) {
|
|
|
1944
1947
|
|
|
1945
1948
|
// src/components/Combobox/useComboboxOptions.ts
|
|
1946
1949
|
var import_mobius_hooks4 = require("@simplybusiness/mobius-hooks");
|
|
1947
|
-
var
|
|
1950
|
+
var import_react14 = require("react");
|
|
1948
1951
|
function useComboboxOptions({
|
|
1949
1952
|
options,
|
|
1950
1953
|
asyncOptions,
|
|
@@ -1954,19 +1957,19 @@ function useComboboxOptions({
|
|
|
1954
1957
|
skipNextDebounceRef,
|
|
1955
1958
|
onSearched
|
|
1956
1959
|
}) {
|
|
1957
|
-
const [filteredOptions, setFilteredOptions] = (0,
|
|
1960
|
+
const [filteredOptions, setFilteredOptions] = (0, import_react14.useState)(void 0);
|
|
1958
1961
|
const debouncedInputValue = (0, import_mobius_hooks4.useDebouncedValue)(
|
|
1959
1962
|
inputValue,
|
|
1960
1963
|
// Don't debounce synchronous options
|
|
1961
1964
|
options ? 0 : delay
|
|
1962
1965
|
);
|
|
1963
|
-
const [isLoading, setIsLoading] = (0,
|
|
1964
|
-
const [error3, setError] = (0,
|
|
1965
|
-
const asyncOptionsRef = (0,
|
|
1966
|
+
const [isLoading, setIsLoading] = (0, import_react14.useState)(false);
|
|
1967
|
+
const [error3, setError] = (0, import_react14.useState)(null);
|
|
1968
|
+
const asyncOptionsRef = (0, import_react14.useRef)(asyncOptions);
|
|
1966
1969
|
asyncOptionsRef.current = asyncOptions;
|
|
1967
|
-
const onSearchedRef = (0,
|
|
1970
|
+
const onSearchedRef = (0, import_react14.useRef)(onSearched);
|
|
1968
1971
|
onSearchedRef.current = onSearched;
|
|
1969
|
-
(0,
|
|
1972
|
+
(0, import_react14.useEffect)(() => {
|
|
1970
1973
|
const controller = new AbortController();
|
|
1971
1974
|
const { signal } = controller;
|
|
1972
1975
|
const fetchOptions = async () => {
|
|
@@ -2053,11 +2056,11 @@ var ComboboxInner = ({
|
|
|
2053
2056
|
errorMessage,
|
|
2054
2057
|
...otherProps
|
|
2055
2058
|
} = props;
|
|
2056
|
-
const skipNextDebounceRef = (0,
|
|
2057
|
-
const fallbackRef = (0,
|
|
2058
|
-
const [inputValue, setInputValue] = (0,
|
|
2059
|
-
const [isOpen, setIsOpen] = (0,
|
|
2060
|
-
const [isChanging, setIsChanging] = (0,
|
|
2059
|
+
const skipNextDebounceRef = (0, import_react15.useRef)(false);
|
|
2060
|
+
const fallbackRef = (0, import_react15.useRef)(null);
|
|
2061
|
+
const [inputValue, setInputValue] = (0, import_react15.useState)(defaultValue || "");
|
|
2062
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
|
|
2063
|
+
const [isChanging, setIsChanging] = (0, import_react15.useState)(false);
|
|
2061
2064
|
const { filteredOptions, updateFilteredOptions, isLoading, error: error3 } = useComboboxOptions({
|
|
2062
2065
|
options,
|
|
2063
2066
|
asyncOptions,
|
|
@@ -2066,7 +2069,7 @@ var ComboboxInner = ({
|
|
|
2066
2069
|
minSearchLength,
|
|
2067
2070
|
skipNextDebounceRef
|
|
2068
2071
|
});
|
|
2069
|
-
const [validationError, setValidationError] = (0,
|
|
2072
|
+
const [validationError, setValidationError] = (0, import_react15.useState)(
|
|
2070
2073
|
error3?.message || errorMessage
|
|
2071
2074
|
);
|
|
2072
2075
|
const {
|
|
@@ -2079,14 +2082,14 @@ var ComboboxInner = ({
|
|
|
2079
2082
|
clearHighlight
|
|
2080
2083
|
} = useComboboxHighlight(filteredOptions);
|
|
2081
2084
|
const inputRef = ref || fallbackRef;
|
|
2082
|
-
const listboxId = (0,
|
|
2083
|
-
const statusId = (0,
|
|
2084
|
-
const blurTimeoutRef = (0,
|
|
2085
|
-
const userInteractedRef = (0,
|
|
2086
|
-
const justSelectedRef = (0,
|
|
2085
|
+
const listboxId = (0, import_react15.useId)();
|
|
2086
|
+
const statusId = (0, import_react15.useId)();
|
|
2087
|
+
const blurTimeoutRef = (0, import_react15.useRef)(null);
|
|
2088
|
+
const userInteractedRef = (0, import_react15.useRef)(false);
|
|
2089
|
+
const justSelectedRef = (0, import_react15.useRef)(false);
|
|
2087
2090
|
const { down } = useBreakpoint();
|
|
2088
2091
|
const isMobile = down("md");
|
|
2089
|
-
(0,
|
|
2092
|
+
(0, import_react15.useEffect)(() => {
|
|
2090
2093
|
setValidationError(error3?.message || errorMessage);
|
|
2091
2094
|
}, [error3, errorMessage]);
|
|
2092
2095
|
const getEmptyValue = () => {
|
|
@@ -2115,7 +2118,7 @@ var ComboboxInner = ({
|
|
|
2115
2118
|
justSelectedRef.current = false;
|
|
2116
2119
|
}
|
|
2117
2120
|
};
|
|
2118
|
-
(0,
|
|
2121
|
+
(0, import_react15.useEffect)(() => {
|
|
2119
2122
|
if (!inputRef || typeof inputRef === "function") return;
|
|
2120
2123
|
const inputElement = inputRef.current;
|
|
2121
2124
|
if (!inputElement) return;
|
|
@@ -2268,12 +2271,12 @@ var ComboboxInner = ({
|
|
|
2268
2271
|
default:
|
|
2269
2272
|
}
|
|
2270
2273
|
};
|
|
2271
|
-
(0,
|
|
2274
|
+
(0, import_react15.useEffect)(() => {
|
|
2272
2275
|
if (value) {
|
|
2273
2276
|
setInputValue(value);
|
|
2274
2277
|
}
|
|
2275
2278
|
}, [value]);
|
|
2276
|
-
(0,
|
|
2279
|
+
(0, import_react15.useEffect)(() => {
|
|
2277
2280
|
if (asyncOptions && isChanging) {
|
|
2278
2281
|
setIsOpen(!!filteredOptions && filteredOptions.length > 0);
|
|
2279
2282
|
}
|
|
@@ -2387,15 +2390,15 @@ var AddressLookup = ({
|
|
|
2387
2390
|
errorMessage,
|
|
2388
2391
|
...otherProps
|
|
2389
2392
|
}) => {
|
|
2390
|
-
const [error3, _setError] = (0,
|
|
2391
|
-
const setError = (0,
|
|
2393
|
+
const [error3, _setError] = (0, import_react16.useState)(null);
|
|
2394
|
+
const setError = (0, import_react16.useCallback)(
|
|
2392
2395
|
(newError) => {
|
|
2393
2396
|
if (newError != null) onError?.(newError);
|
|
2394
2397
|
_setError(newError);
|
|
2395
2398
|
},
|
|
2396
2399
|
[onError]
|
|
2397
2400
|
);
|
|
2398
|
-
const asyncOptions = (0,
|
|
2401
|
+
const asyncOptions = (0, import_react16.useCallback)(
|
|
2399
2402
|
async (searchTerm) => {
|
|
2400
2403
|
try {
|
|
2401
2404
|
const response = await addressLookupService.search(searchTerm);
|
|
@@ -2642,7 +2645,7 @@ var Box = ({ ref, ...props }) => {
|
|
|
2642
2645
|
Box.displayName = "Box";
|
|
2643
2646
|
|
|
2644
2647
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
2645
|
-
var
|
|
2648
|
+
var import_react17 = require("react");
|
|
2646
2649
|
var import_dedupe19 = __toESM(require("classnames/dedupe"));
|
|
2647
2650
|
var import_Breadcrumbs = require("@simplybusiness/mobius/src/components/Breadcrumbs/Breadcrumbs.css");
|
|
2648
2651
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -2650,26 +2653,22 @@ var Breadcrumbs = ({ ref, ...props }) => {
|
|
|
2650
2653
|
const { "aria-label": ariaLabel = "Breadcrumbs" } = props;
|
|
2651
2654
|
const { navProps } = { navProps: { "aria-label": ariaLabel } };
|
|
2652
2655
|
const { children, ...otherProps } = props;
|
|
2653
|
-
const childArray =
|
|
2656
|
+
const childArray = import_react17.Children.toArray(children);
|
|
2654
2657
|
const classes = (0, import_dedupe19.default)(
|
|
2655
2658
|
"mobius",
|
|
2656
2659
|
"mobius-breadcrumb",
|
|
2657
2660
|
otherProps.className
|
|
2658
2661
|
);
|
|
2659
2662
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("nav", { ref, ...otherProps, ...navProps, className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { children: childArray.map(
|
|
2660
|
-
(child, i) => (0,
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
key: i,
|
|
2664
|
-
isCurrent: i === childArray.length - 1
|
|
2665
|
-
}
|
|
2666
|
-
)
|
|
2663
|
+
(child, i) => (0, import_react17.cloneElement)(child, {
|
|
2664
|
+
isCurrent: i === childArray.length - 1
|
|
2665
|
+
})
|
|
2667
2666
|
) }) });
|
|
2668
2667
|
};
|
|
2669
2668
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
2670
2669
|
|
|
2671
2670
|
// src/components/Breadcrumbs/BreadcrumbItem.tsx
|
|
2672
|
-
var
|
|
2671
|
+
var import_react18 = require("react");
|
|
2673
2672
|
var import_dedupe20 = __toESM(require("classnames/dedupe"));
|
|
2674
2673
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2675
2674
|
var BreadcrumbItem = ({ ref, ...props }) => {
|
|
@@ -2693,9 +2692,9 @@ var BreadcrumbItem = ({ ref, ...props }) => {
|
|
|
2693
2692
|
"mobius-breadcrumb__item",
|
|
2694
2693
|
props.className
|
|
2695
2694
|
);
|
|
2696
|
-
const child = typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { ...itemProps, children }) :
|
|
2695
|
+
const child = typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { ...itemProps, children }) : import_react18.Children.only(children);
|
|
2697
2696
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: classes, children: [
|
|
2698
|
-
(0,
|
|
2697
|
+
(0, import_react18.cloneElement)(child, {
|
|
2699
2698
|
...child.props,
|
|
2700
2699
|
...itemProps,
|
|
2701
2700
|
ref
|
|
@@ -2770,7 +2769,7 @@ var Button = ({ ref, ...props }) => {
|
|
|
2770
2769
|
Button.displayName = "Button";
|
|
2771
2770
|
|
|
2772
2771
|
// src/components/Checkbox/Checkbox.tsx
|
|
2773
|
-
var
|
|
2772
|
+
var import_react19 = require("react");
|
|
2774
2773
|
var import_dedupe22 = __toESM(require("classnames/dedupe"));
|
|
2775
2774
|
var import_icons7 = require("@simplybusiness/icons");
|
|
2776
2775
|
init_ErrorMessage2();
|
|
@@ -2799,12 +2798,12 @@ var Checkbox = ({ ref, ...props }) => {
|
|
|
2799
2798
|
["aria-describedby"]: ariaDescribedBy,
|
|
2800
2799
|
...rest
|
|
2801
2800
|
} = props;
|
|
2802
|
-
const [checked, setChecked] = (0,
|
|
2803
|
-
const fallbackRef = (0,
|
|
2801
|
+
const [checked, setChecked] = (0, import_react19.useState)(defaultSelected);
|
|
2802
|
+
const fallbackRef = (0, import_react19.useRef)(null);
|
|
2804
2803
|
const refObj = ref || fallbackRef;
|
|
2805
|
-
const inputId = (0,
|
|
2804
|
+
const inputId = (0, import_react19.useId)();
|
|
2806
2805
|
const isControlled = typeof selected === "boolean";
|
|
2807
|
-
(0,
|
|
2806
|
+
(0, import_react19.useEffect)(() => {
|
|
2808
2807
|
if (isControlled) {
|
|
2809
2808
|
setChecked(selected);
|
|
2810
2809
|
}
|
|
@@ -2828,13 +2827,13 @@ var Checkbox = ({ ref, ...props }) => {
|
|
|
2828
2827
|
const labelClasses = (0, import_dedupe22.default)("mobius-checkbox__label", sharedClasses);
|
|
2829
2828
|
const inputClasses = (0, import_dedupe22.default)("mobius-checkbox__input", sharedClasses);
|
|
2830
2829
|
const iconClasses = (0, import_dedupe22.default)("mobius-checkbox__icon", sharedClasses);
|
|
2831
|
-
const errorMessageId = (0,
|
|
2830
|
+
const errorMessageId = (0, import_react19.useId)();
|
|
2832
2831
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
2833
2832
|
const describedBy = spaceDelimitedList([
|
|
2834
2833
|
shouldErrorMessageShow,
|
|
2835
2834
|
ariaDescribedBy
|
|
2836
2835
|
]);
|
|
2837
|
-
const labelId = (0,
|
|
2836
|
+
const labelId = (0, import_react19.useId)();
|
|
2838
2837
|
const handleChange = (event) => {
|
|
2839
2838
|
setChecked(!checked);
|
|
2840
2839
|
if (onChange) {
|
|
@@ -2881,7 +2880,7 @@ Checkbox.displayName = "Checkbox";
|
|
|
2881
2880
|
|
|
2882
2881
|
// src/components/Checkbox/CheckboxGroup.tsx
|
|
2883
2882
|
var import_dedupe23 = __toESM(require("classnames/dedupe"));
|
|
2884
|
-
var
|
|
2883
|
+
var import_react20 = require("react");
|
|
2885
2884
|
init_hooks();
|
|
2886
2885
|
init_spaceDelimitedList();
|
|
2887
2886
|
init_ErrorMessage2();
|
|
@@ -2905,10 +2904,10 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2905
2904
|
lastItemDisables = false,
|
|
2906
2905
|
...rest
|
|
2907
2906
|
} = props;
|
|
2908
|
-
const [selected, setSelected] = (0,
|
|
2909
|
-
const isInitializedRef = (0,
|
|
2910
|
-
const prevDefaultValueRef = (0,
|
|
2911
|
-
(0,
|
|
2907
|
+
const [selected, setSelected] = (0, import_react20.useState)(defaultValue);
|
|
2908
|
+
const isInitializedRef = (0, import_react20.useRef)(false);
|
|
2909
|
+
const prevDefaultValueRef = (0, import_react20.useRef)(defaultValue);
|
|
2910
|
+
(0, import_react20.useEffect)(() => {
|
|
2912
2911
|
const hasChanged = defaultValue.length !== prevDefaultValueRef.current.length || defaultValue.some(
|
|
2913
2912
|
(val, index) => val !== prevDefaultValueRef.current[index]
|
|
2914
2913
|
);
|
|
@@ -2936,13 +2935,13 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2936
2935
|
},
|
|
2937
2936
|
validationClasses
|
|
2938
2937
|
);
|
|
2939
|
-
const errorMessageId = (0,
|
|
2938
|
+
const errorMessageId = (0, import_react20.useId)();
|
|
2940
2939
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
2941
2940
|
const describedBy = spaceDelimitedList([
|
|
2942
2941
|
shouldErrorMessageShow,
|
|
2943
2942
|
props["aria-describedby"]
|
|
2944
2943
|
]);
|
|
2945
|
-
const labelId = (0,
|
|
2944
|
+
const labelId = (0, import_react20.useId)();
|
|
2946
2945
|
const handleChange = (event, isLastItem = false) => {
|
|
2947
2946
|
const {
|
|
2948
2947
|
target: { value, checked }
|
|
@@ -2960,9 +2959,9 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2960
2959
|
setSelected(newValue);
|
|
2961
2960
|
onChange?.(newValue);
|
|
2962
2961
|
};
|
|
2963
|
-
const childrenArray =
|
|
2962
|
+
const childrenArray = import_react20.Children.toArray(children);
|
|
2964
2963
|
const lastCheckbox = childrenArray.filter(
|
|
2965
|
-
(child) => (0,
|
|
2964
|
+
(child) => (0, import_react20.isValidElement)(child) && child.type === Checkbox
|
|
2966
2965
|
).pop();
|
|
2967
2966
|
const lastCheckboxIsChecked = lastCheckbox && selected.includes(lastCheckbox.props.value);
|
|
2968
2967
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
@@ -2974,16 +2973,16 @@ var CheckboxGroup = ({ ref, ...props }) => {
|
|
|
2974
2973
|
className: checkboxGroupClasses,
|
|
2975
2974
|
role: "group",
|
|
2976
2975
|
style: {
|
|
2977
|
-
"--checkbox-items-per-row": itemsPerRow ||
|
|
2976
|
+
"--checkbox-items-per-row": itemsPerRow || import_react20.Children.count(children)
|
|
2978
2977
|
},
|
|
2979
2978
|
children: [
|
|
2980
2979
|
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { elementType: "span", id: labelId, className: labelClasses, children: label }),
|
|
2981
2980
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mobius-checkbox-group__wrapper", children: childrenArray.map((child) => {
|
|
2982
|
-
if ((0,
|
|
2981
|
+
if ((0, import_react20.isValidElement)(child)) {
|
|
2983
2982
|
const isLastItem = child === lastCheckbox;
|
|
2984
2983
|
const isChildDisabled = isDisabled || lastItemDisables && lastCheckboxIsChecked && !isLastItem;
|
|
2985
2984
|
const childProps = child.props;
|
|
2986
|
-
return (0,
|
|
2985
|
+
return (0, import_react20.cloneElement)(
|
|
2987
2986
|
child,
|
|
2988
2987
|
{
|
|
2989
2988
|
isDisabled: isChildDisabled,
|
|
@@ -3025,7 +3024,7 @@ Container.displayName = "Container";
|
|
|
3025
3024
|
|
|
3026
3025
|
// src/components/DateField/DateField.tsx
|
|
3027
3026
|
var import_dedupe25 = __toESM(require("classnames/dedupe"));
|
|
3028
|
-
var
|
|
3027
|
+
var import_react21 = require("react");
|
|
3029
3028
|
init_mergeRefs();
|
|
3030
3029
|
init_TextField2();
|
|
3031
3030
|
|
|
@@ -3075,9 +3074,9 @@ var DateField = ({ ref, ...props }) => {
|
|
|
3075
3074
|
value,
|
|
3076
3075
|
...otherProps
|
|
3077
3076
|
} = props;
|
|
3078
|
-
const [error3, setError] = (0,
|
|
3079
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
3080
|
-
const localRef = (0,
|
|
3077
|
+
const [error3, setError] = (0, import_react21.useState)(errorMessage);
|
|
3078
|
+
const [isInvalid, setIsInvalid] = (0, import_react21.useState)(void 0);
|
|
3079
|
+
const localRef = (0, import_react21.useRef)(null);
|
|
3081
3080
|
const classes = (0, import_dedupe25.default)("mobius-date-field", className);
|
|
3082
3081
|
const formattedMin = min ? convertToDateFormat(min, format) : void 0;
|
|
3083
3082
|
const formattedMax = max ? convertToDateFormat(max, format) : void 0;
|
|
@@ -3091,7 +3090,7 @@ var DateField = ({ ref, ...props }) => {
|
|
|
3091
3090
|
setError(props.errorMessage);
|
|
3092
3091
|
setIsInvalid(false);
|
|
3093
3092
|
};
|
|
3094
|
-
(0,
|
|
3093
|
+
(0, import_react21.useEffect)(() => {
|
|
3095
3094
|
if (!isValidDate(min, format)) {
|
|
3096
3095
|
setInvalidState(`Invalid min date: ${min}`);
|
|
3097
3096
|
return;
|
|
@@ -3150,13 +3149,13 @@ Content.displayName = "Content";
|
|
|
3150
3149
|
|
|
3151
3150
|
// src/components/Drawer/Drawer.tsx
|
|
3152
3151
|
var import_dedupe26 = __toESM(require("classnames/dedupe"));
|
|
3153
|
-
var
|
|
3152
|
+
var import_react23 = require("react");
|
|
3154
3153
|
init_hooks();
|
|
3155
3154
|
init_utils();
|
|
3156
3155
|
|
|
3157
3156
|
// src/components/Drawer/DrawerContext.tsx
|
|
3158
|
-
var
|
|
3159
|
-
var DrawerContext = (0,
|
|
3157
|
+
var import_react22 = require("react");
|
|
3158
|
+
var DrawerContext = (0, import_react22.createContext)({
|
|
3160
3159
|
onClose: () => {
|
|
3161
3160
|
},
|
|
3162
3161
|
closeLabel: void 0,
|
|
@@ -3178,8 +3177,8 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3178
3177
|
onClose,
|
|
3179
3178
|
children
|
|
3180
3179
|
} = props;
|
|
3181
|
-
const dialogRef = (0,
|
|
3182
|
-
const [shouldTransition, setShouldTransition] = (0,
|
|
3180
|
+
const dialogRef = (0, import_react23.useRef)(null);
|
|
3181
|
+
const [shouldTransition, setShouldTransition] = (0, import_react23.useState)(false);
|
|
3183
3182
|
const { close } = useDialog({
|
|
3184
3183
|
ref: dialogRef,
|
|
3185
3184
|
isOpen,
|
|
@@ -3190,8 +3189,8 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3190
3189
|
CSSVariable: TRANSITION_CSS_VARIABLE
|
|
3191
3190
|
}
|
|
3192
3191
|
});
|
|
3193
|
-
const hiddenId = `dialog-screen-reader-announce-${(0,
|
|
3194
|
-
const headerId = `dialog-header-${(0,
|
|
3192
|
+
const hiddenId = `dialog-screen-reader-announce-${(0, import_react23.useId)()}`;
|
|
3193
|
+
const headerId = `dialog-header-${(0, import_react23.useId)()}`;
|
|
3195
3194
|
const dialogClasses = (0, import_dedupe26.default)(
|
|
3196
3195
|
"mobius",
|
|
3197
3196
|
"mobius-drawer",
|
|
@@ -3201,10 +3200,10 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3201
3200
|
"--should-transition": shouldTransition
|
|
3202
3201
|
}
|
|
3203
3202
|
);
|
|
3204
|
-
(0,
|
|
3203
|
+
(0, import_react23.useEffect)(() => {
|
|
3205
3204
|
setShouldTransition(supportsDialog());
|
|
3206
3205
|
}, []);
|
|
3207
|
-
const contextValue = (0,
|
|
3206
|
+
const contextValue = (0, import_react23.useMemo)(
|
|
3208
3207
|
() => ({
|
|
3209
3208
|
onClose: close,
|
|
3210
3209
|
closeLabel,
|
|
@@ -3215,7 +3214,7 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3215
3214
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3216
3215
|
"dialog",
|
|
3217
3216
|
{
|
|
3218
|
-
id: (0,
|
|
3217
|
+
id: (0, import_react23.useId)(),
|
|
3219
3218
|
ref: mergeRefs([dialogRef, ref]),
|
|
3220
3219
|
onCancel: close,
|
|
3221
3220
|
className: dialogClasses,
|
|
@@ -3231,9 +3230,9 @@ var Drawer = ({ ref, ...props }) => {
|
|
|
3231
3230
|
Drawer.displayName = "Drawer";
|
|
3232
3231
|
|
|
3233
3232
|
// src/components/Drawer/useDrawer.ts
|
|
3234
|
-
var
|
|
3233
|
+
var import_react24 = require("react");
|
|
3235
3234
|
var useDrawer = () => {
|
|
3236
|
-
const { onClose, closeLabel, headerId } = (0,
|
|
3235
|
+
const { onClose, closeLabel, headerId } = (0, import_react24.useContext)(DrawerContext);
|
|
3237
3236
|
return { onClose, closeLabel, headerId };
|
|
3238
3237
|
};
|
|
3239
3238
|
|
|
@@ -3272,7 +3271,7 @@ var Drawer2 = Object.assign(Drawer, {
|
|
|
3272
3271
|
Drawer2.displayName = "Drawer";
|
|
3273
3272
|
|
|
3274
3273
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
3275
|
-
var
|
|
3274
|
+
var import_react25 = require("react");
|
|
3276
3275
|
var import_react_accessible_dropdown_menu_hook = __toESM(require("react-accessible-dropdown-menu-hook"));
|
|
3277
3276
|
var import_dedupe27 = __toESM(require("classnames/dedupe"));
|
|
3278
3277
|
var import_DropdownMenu = require("@simplybusiness/mobius/src/components/DropdownMenu/DropdownMenu.css");
|
|
@@ -3285,8 +3284,8 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3285
3284
|
children,
|
|
3286
3285
|
...otherProps
|
|
3287
3286
|
} = props;
|
|
3288
|
-
const [activeId, setActiveId] = (0,
|
|
3289
|
-
const numberOfItems =
|
|
3287
|
+
const [activeId, setActiveId] = (0, import_react25.useState)(null);
|
|
3288
|
+
const numberOfItems = import_react25.Children.count(children);
|
|
3290
3289
|
const {
|
|
3291
3290
|
buttonProps,
|
|
3292
3291
|
itemProps,
|
|
@@ -3310,15 +3309,15 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3310
3309
|
}
|
|
3311
3310
|
};
|
|
3312
3311
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Element, { ref, ...otherProps, className: classes, children: [
|
|
3313
|
-
trigger ? (0,
|
|
3312
|
+
trigger ? (0, import_react25.cloneElement)(trigger, {
|
|
3314
3313
|
className: triggerClasses,
|
|
3315
3314
|
open,
|
|
3316
3315
|
label,
|
|
3317
3316
|
...buttonProps
|
|
3318
3317
|
}) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { className: triggerClasses, ...buttonProps, children: label }),
|
|
3319
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: listClasses, role: "menu", children:
|
|
3320
|
-
if ((0,
|
|
3321
|
-
return (0,
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: listClasses, role: "menu", children: import_react25.Children.map(children, (child, index) => {
|
|
3319
|
+
if ((0, import_react25.isValidElement)(child)) {
|
|
3320
|
+
return (0, import_react25.cloneElement)(child, {
|
|
3322
3321
|
onClick: () => handleChildClick(child.props, index),
|
|
3323
3322
|
active: index === activeId,
|
|
3324
3323
|
...itemProps[index]
|
|
@@ -3331,7 +3330,7 @@ var DropdownMenu = ({ ref, ...props }) => {
|
|
|
3331
3330
|
DropdownMenu.displayName = "DropdownMenu";
|
|
3332
3331
|
|
|
3333
3332
|
// src/components/DropdownMenu/Item.tsx
|
|
3334
|
-
var
|
|
3333
|
+
var import_react26 = require("react");
|
|
3335
3334
|
var import_dedupe28 = __toESM(require("classnames/dedupe"));
|
|
3336
3335
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3337
3336
|
var Item = ({ ref, ...props }) => {
|
|
@@ -3348,18 +3347,15 @@ var Item = ({ ref, ...props }) => {
|
|
|
3348
3347
|
{ "--is-active": active },
|
|
3349
3348
|
otherProps.className
|
|
3350
3349
|
);
|
|
3351
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, onClick, ...otherProps, children:
|
|
3352
|
-
if ((0,
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, onClick, ...otherProps, children: import_react26.Children.map(children, (child) => {
|
|
3351
|
+
if ((0, import_react26.isValidElement)(child)) {
|
|
3353
3352
|
const childClasses = (0, import_dedupe28.default)(
|
|
3354
3353
|
child.props.className,
|
|
3355
3354
|
classes
|
|
3356
3355
|
);
|
|
3357
|
-
return (0,
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
className: childClasses
|
|
3361
|
-
}
|
|
3362
|
-
);
|
|
3356
|
+
return (0, import_react26.cloneElement)(child, {
|
|
3357
|
+
className: childClasses
|
|
3358
|
+
});
|
|
3363
3359
|
}
|
|
3364
3360
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: classes, children: child });
|
|
3365
3361
|
}) });
|
|
@@ -3377,7 +3373,7 @@ DropdownMenu2.displayName = "DropdownMenu";
|
|
|
3377
3373
|
|
|
3378
3374
|
// src/components/Fieldset/Fieldset.tsx
|
|
3379
3375
|
var import_dedupe29 = __toESM(require("classnames/dedupe"));
|
|
3380
|
-
var
|
|
3376
|
+
var import_react27 = require("react");
|
|
3381
3377
|
var import_Fieldset = require("@simplybusiness/mobius/src/components/Fieldset/Fieldset.css");
|
|
3382
3378
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3383
3379
|
var useFieldset = (props) => {
|
|
@@ -3386,7 +3382,7 @@ var useFieldset = (props) => {
|
|
|
3386
3382
|
let containerProps = {
|
|
3387
3383
|
role: "group"
|
|
3388
3384
|
};
|
|
3389
|
-
const legendId = (0,
|
|
3385
|
+
const legendId = (0, import_react27.useId)();
|
|
3390
3386
|
if (legend) {
|
|
3391
3387
|
legendProps = {
|
|
3392
3388
|
...legendProps,
|
|
@@ -3413,7 +3409,7 @@ var Fieldset = ({ ref: _ref, ...props }) => {
|
|
|
3413
3409
|
const classes = (0, import_dedupe29.default)("mobius", "mobius-fieldset", props.className);
|
|
3414
3410
|
legendProps.className = "mobius-fieldset__legend";
|
|
3415
3411
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { ...containerProps, ...otherProps, className: classes, children: [
|
|
3416
|
-
legend && (0,
|
|
3412
|
+
legend && (0, import_react27.cloneElement)(legendComponent, { ...legendProps }, [legend]),
|
|
3417
3413
|
children
|
|
3418
3414
|
] });
|
|
3419
3415
|
};
|
|
@@ -3456,7 +3452,7 @@ var Grid = ({ ref, ...props }) => {
|
|
|
3456
3452
|
Grid.displayName = "Grid";
|
|
3457
3453
|
|
|
3458
3454
|
// src/components/Grid/Item.tsx
|
|
3459
|
-
var
|
|
3455
|
+
var import_react28 = require("react");
|
|
3460
3456
|
var import_dedupe31 = __toESM(require("classnames/dedupe"));
|
|
3461
3457
|
init_hooks();
|
|
3462
3458
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -3494,9 +3490,9 @@ var GridItem = ({ ref, ...props }) => {
|
|
|
3494
3490
|
xl,
|
|
3495
3491
|
xxl
|
|
3496
3492
|
});
|
|
3497
|
-
const [responsiveSpan, setResponsiveSpan] = (0,
|
|
3493
|
+
const [responsiveSpan, setResponsiveSpan] = (0, import_react28.useState)();
|
|
3498
3494
|
const classes = (0, import_dedupe31.default)("mobius", "mobius-grid__item", className);
|
|
3499
|
-
(0,
|
|
3495
|
+
(0, import_react28.useEffect)(() => {
|
|
3500
3496
|
setResponsiveSpan(breakpointMap[breakpointSize]);
|
|
3501
3497
|
}, [breakpointSize, breakpointMap]);
|
|
3502
3498
|
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,23 +4937,23 @@ 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
|
};
|
|
4773
4946
|
|
|
4774
4947
|
// src/components/SVG/SVG.tsx
|
|
4775
|
-
var
|
|
4948
|
+
var import_react46 = require("react");
|
|
4776
4949
|
var import_dedupe50 = __toESM(require("classnames/dedupe"));
|
|
4777
|
-
var
|
|
4950
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4778
4951
|
var SVG = ({ ref, ...props }) => {
|
|
4779
4952
|
const { children, className, ...otherProps } = props;
|
|
4780
4953
|
const classes = (0, import_dedupe50.default)("mobius", "mobius-svg", className);
|
|
4781
|
-
const svgNode =
|
|
4954
|
+
const svgNode = import_react46.Children.only(children);
|
|
4782
4955
|
const { children: svgChildren, viewBox, xmlns } = svgNode.props;
|
|
4783
|
-
return /* @__PURE__ */ (0,
|
|
4956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4784
4957
|
"svg",
|
|
4785
4958
|
{
|
|
4786
4959
|
viewBox,
|
|
@@ -4795,10 +4968,10 @@ var SVG = ({ ref, ...props }) => {
|
|
|
4795
4968
|
SVG.displayName = "SVG";
|
|
4796
4969
|
|
|
4797
4970
|
// src/components/Switch/Switch.tsx
|
|
4798
|
-
var
|
|
4971
|
+
var import_react47 = require("react");
|
|
4799
4972
|
var import_dedupe51 = __toESM(require("classnames/dedupe"));
|
|
4800
4973
|
var import_Switch = require("@simplybusiness/mobius/src/components/Switch/Switch.css");
|
|
4801
|
-
var
|
|
4974
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4802
4975
|
var Switch = ({ ref, ...props }) => {
|
|
4803
4976
|
const {
|
|
4804
4977
|
checked = false,
|
|
@@ -4807,8 +4980,8 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4807
4980
|
isDisabled = false,
|
|
4808
4981
|
...otherProps
|
|
4809
4982
|
} = props;
|
|
4810
|
-
const [enabled, setEnabled] = (0,
|
|
4811
|
-
(0,
|
|
4983
|
+
const [enabled, setEnabled] = (0, import_react47.useState)(checked);
|
|
4984
|
+
(0, import_react47.useEffect)(() => {
|
|
4812
4985
|
setEnabled(checked);
|
|
4813
4986
|
}, [checked]);
|
|
4814
4987
|
const classes = (0, import_dedupe51.default)(
|
|
@@ -4826,9 +4999,9 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4826
4999
|
onChange(event);
|
|
4827
5000
|
}
|
|
4828
5001
|
};
|
|
4829
|
-
return /* @__PURE__ */ (0,
|
|
4830
|
-
/* @__PURE__ */ (0,
|
|
4831
|
-
/* @__PURE__ */ (0,
|
|
5002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { ref, className: classes, children: [
|
|
5003
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: enabled ? "On" : "Off" }) }),
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4832
5005
|
"input",
|
|
4833
5006
|
{
|
|
4834
5007
|
type: "checkbox",
|
|
@@ -4839,7 +5012,7 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4839
5012
|
...otherProps
|
|
4840
5013
|
}
|
|
4841
5014
|
),
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
5015
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "mobius-switch__slider" })
|
|
4843
5016
|
] });
|
|
4844
5017
|
};
|
|
4845
5018
|
Switch.displayName = "Switch";
|
|
@@ -4847,72 +5020,72 @@ Switch.displayName = "Switch";
|
|
|
4847
5020
|
// src/components/Table/Table.tsx
|
|
4848
5021
|
var import_dedupe52 = __toESM(require("classnames/dedupe"));
|
|
4849
5022
|
var import_Table = require("@simplybusiness/mobius/src/components/Table/Table.css");
|
|
4850
|
-
var
|
|
5023
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4851
5024
|
var Table = ({ ref, ...props }) => {
|
|
4852
5025
|
const classes = (0, import_dedupe52.default)("mobius", "mobius-table", props.className);
|
|
4853
|
-
return /* @__PURE__ */ (0,
|
|
5026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("table", { ref, ...props, className: classes });
|
|
4854
5027
|
};
|
|
4855
5028
|
Table.displayName = "Table";
|
|
4856
5029
|
|
|
4857
5030
|
// src/components/Table/Head.tsx
|
|
4858
5031
|
var import_dedupe53 = __toESM(require("classnames/dedupe"));
|
|
4859
|
-
var
|
|
5032
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4860
5033
|
var Head = ({ ref, ...props }) => {
|
|
4861
5034
|
const classes = (0, import_dedupe53.default)("mobius", "mobius-table__head", props.className);
|
|
4862
|
-
return /* @__PURE__ */ (0,
|
|
5035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { ref, ...props, className: classes });
|
|
4863
5036
|
};
|
|
4864
5037
|
Head.displayName = "Table.Head";
|
|
4865
5038
|
|
|
4866
5039
|
// src/components/Table/Body.tsx
|
|
4867
5040
|
var import_dedupe54 = __toESM(require("classnames/dedupe"));
|
|
4868
|
-
var
|
|
5041
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4869
5042
|
var Body = ({ ref, ...props }) => {
|
|
4870
5043
|
const classes = (0, import_dedupe54.default)("mobius", "mobius-table__body", props.className);
|
|
4871
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("tbody", { ref, ...props, className: classes });
|
|
4872
5045
|
};
|
|
4873
5046
|
Body.displayName = "Table.Body";
|
|
4874
5047
|
|
|
4875
5048
|
// src/components/Table/Foot.tsx
|
|
4876
5049
|
var import_dedupe55 = __toESM(require("classnames/dedupe"));
|
|
4877
|
-
var
|
|
5050
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4878
5051
|
var Foot = ({ ref, ...props }) => {
|
|
4879
5052
|
const classes = (0, import_dedupe55.default)("mobius", "mobius-table__foot", props.className);
|
|
4880
|
-
return /* @__PURE__ */ (0,
|
|
5053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tfoot", { ref, ...props, className: classes });
|
|
4881
5054
|
};
|
|
4882
5055
|
Foot.displayName = "Table.Foot";
|
|
4883
5056
|
|
|
4884
5057
|
// src/components/Table/Row.tsx
|
|
4885
5058
|
var import_dedupe56 = __toESM(require("classnames/dedupe"));
|
|
4886
|
-
var
|
|
5059
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4887
5060
|
var Row = ({ ref, ...props }) => {
|
|
4888
5061
|
const classes = (0, import_dedupe56.default)("mobius", "mobius-table__row", props.className);
|
|
4889
|
-
return /* @__PURE__ */ (0,
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tr", { ref, ...props, className: classes });
|
|
4890
5063
|
};
|
|
4891
5064
|
Row.displayName = "Table.Row";
|
|
4892
5065
|
|
|
4893
5066
|
// src/components/Table/HeaderCell.tsx
|
|
4894
5067
|
var import_dedupe57 = __toESM(require("classnames/dedupe"));
|
|
4895
|
-
var
|
|
5068
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4896
5069
|
var HeaderCell = ({ ref, scope = "col", ...props }) => {
|
|
4897
5070
|
const classes = (0, import_dedupe57.default)(
|
|
4898
5071
|
"mobius",
|
|
4899
5072
|
"mobius-table__head-cell",
|
|
4900
5073
|
props.className
|
|
4901
5074
|
);
|
|
4902
|
-
return /* @__PURE__ */ (0,
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { ...props, ref, scope, className: classes });
|
|
4903
5076
|
};
|
|
4904
5077
|
HeaderCell.displayName = "Table.HeaderCell";
|
|
4905
5078
|
|
|
4906
5079
|
// src/components/Table/Cell.tsx
|
|
4907
5080
|
var import_dedupe58 = __toESM(require("classnames/dedupe"));
|
|
4908
|
-
var
|
|
5081
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4909
5082
|
var Cell = ({ ref, ...props }) => {
|
|
4910
5083
|
const classes = (0, import_dedupe58.default)(
|
|
4911
5084
|
"mobius",
|
|
4912
5085
|
"mobius-table__body-cell",
|
|
4913
5086
|
props.className
|
|
4914
5087
|
);
|
|
4915
|
-
return /* @__PURE__ */ (0,
|
|
5088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("td", { ref, ...props, className: classes });
|
|
4916
5089
|
};
|
|
4917
5090
|
Cell.displayName = "Table.Cell";
|
|
4918
5091
|
|
|
@@ -4936,7 +5109,7 @@ init_Stack2();
|
|
|
4936
5109
|
|
|
4937
5110
|
// src/components/TextAreaInput/TextAreaInput.tsx
|
|
4938
5111
|
var import_dedupe59 = __toESM(require("classnames/dedupe"));
|
|
4939
|
-
var
|
|
5112
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4940
5113
|
var TextAreaInput = ({ ref, ...props }) => {
|
|
4941
5114
|
const { isSelected, isDisabled, isReadOnly, isRequired, ...otherProps } = props;
|
|
4942
5115
|
const classes = (0, import_dedupe59.default)(
|
|
@@ -4949,7 +5122,7 @@ var TextAreaInput = ({ ref, ...props }) => {
|
|
|
4949
5122
|
},
|
|
4950
5123
|
otherProps.className
|
|
4951
5124
|
);
|
|
4952
|
-
return /* @__PURE__ */ (0,
|
|
5125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4953
5126
|
"textarea",
|
|
4954
5127
|
{
|
|
4955
5128
|
ref,
|
|
@@ -4964,7 +5137,7 @@ TextAreaInput.displayName = "TextAreaInput";
|
|
|
4964
5137
|
|
|
4965
5138
|
// src/components/TextArea/TextArea.tsx
|
|
4966
5139
|
var import_TextArea = require("@simplybusiness/mobius/src/components/TextArea/TextArea.css");
|
|
4967
|
-
var
|
|
5140
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4968
5141
|
var TextArea = ({ ref, ...props }) => {
|
|
4969
5142
|
const {
|
|
4970
5143
|
isDisabled,
|
|
@@ -4984,9 +5157,9 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
4984
5157
|
},
|
|
4985
5158
|
validationClasses
|
|
4986
5159
|
);
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
4988
|
-
label && /* @__PURE__ */ (0,
|
|
4989
|
-
/* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Stack, { className: classes, gap: "xs", children: [
|
|
5161
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Label, { ...labelProps, className: labelClasses, children: props.label }),
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4990
5163
|
TextAreaInput,
|
|
4991
5164
|
{
|
|
4992
5165
|
...otherProps,
|
|
@@ -4997,7 +5170,7 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
4997
5170
|
"aria-invalid": errorMessage != null
|
|
4998
5171
|
}
|
|
4999
5172
|
),
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5173
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorMessage, { ...errorMessageProps, errorMessage })
|
|
5001
5174
|
] });
|
|
5002
5175
|
};
|
|
5003
5176
|
TextArea.displayName = "TextArea";
|
|
@@ -5005,7 +5178,7 @@ TextArea.displayName = "TextArea";
|
|
|
5005
5178
|
// src/components/Title/Title.tsx
|
|
5006
5179
|
var import_dedupe61 = __toESM(require("classnames/dedupe"));
|
|
5007
5180
|
var import_Title = require("@simplybusiness/mobius/src/components/Title/Title.css");
|
|
5008
|
-
var
|
|
5181
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5009
5182
|
var Title = ({ ref, ...props }) => {
|
|
5010
5183
|
const {
|
|
5011
5184
|
elementType: Element = "div",
|
|
@@ -5017,9 +5190,9 @@ var Title = ({ ref, ...props }) => {
|
|
|
5017
5190
|
const headerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__header");
|
|
5018
5191
|
const contentClasses = (0, import_dedupe61.default)("mobius", "mobius-title__description");
|
|
5019
5192
|
const containerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__container");
|
|
5020
|
-
return /* @__PURE__ */ (0,
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5022
|
-
/* @__PURE__ */ (0,
|
|
5193
|
+
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: [
|
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: headerClasses, children: title }),
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: contentClasses, children: description })
|
|
5023
5196
|
] }) });
|
|
5024
5197
|
};
|
|
5025
5198
|
Title.displayName = "Title";
|
|
@@ -5037,7 +5210,7 @@ var toastState = {
|
|
|
5037
5210
|
|
|
5038
5211
|
// src/components/Toast/Toast.tsx
|
|
5039
5212
|
var import_Toast = require("@simplybusiness/mobius/src/components/Toast/Toast.css");
|
|
5040
|
-
var
|
|
5213
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
5041
5214
|
var variantIcons = {
|
|
5042
5215
|
info: import_icons14.circleInfo,
|
|
5043
5216
|
success: import_icons14.circleCheck,
|
|
@@ -5050,8 +5223,8 @@ var variantColors = {
|
|
|
5050
5223
|
warning: "var(--color-warning)",
|
|
5051
5224
|
error: "var(--color-error)"
|
|
5052
5225
|
};
|
|
5053
|
-
var ToastIcon = ({ variant }) => /* @__PURE__ */ (0,
|
|
5054
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
5226
|
+
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] }) });
|
|
5227
|
+
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 }) });
|
|
5055
5228
|
var ToastContent = ({
|
|
5056
5229
|
toastId,
|
|
5057
5230
|
variant,
|
|
@@ -5060,15 +5233,15 @@ var ToastContent = ({
|
|
|
5060
5233
|
action,
|
|
5061
5234
|
cancel,
|
|
5062
5235
|
showCloseButton = toastState.showCloseButton
|
|
5063
|
-
}) => /* @__PURE__ */ (0,
|
|
5064
|
-
/* @__PURE__ */ (0,
|
|
5065
|
-
/* @__PURE__ */ (0,
|
|
5066
|
-
/* @__PURE__ */ (0,
|
|
5067
|
-
title && /* @__PURE__ */ (0,
|
|
5068
|
-
description && /* @__PURE__ */ (0,
|
|
5236
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: (0, import_dedupe62.default)("mobius", "mobius-toast", `--${variant}`), children: [
|
|
5237
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ToastIcon, { variant }),
|
|
5238
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__body", children: [
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__content", children: [
|
|
5240
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__title", children: title }),
|
|
5241
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__description", children: description })
|
|
5069
5242
|
] }),
|
|
5070
|
-
(action || cancel) && /* @__PURE__ */ (0,
|
|
5071
|
-
cancel && /* @__PURE__ */ (0,
|
|
5243
|
+
(action || cancel) && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__actions", children: [
|
|
5244
|
+
cancel && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5072
5245
|
"button",
|
|
5073
5246
|
{
|
|
5074
5247
|
type: "button",
|
|
@@ -5080,7 +5253,7 @@ var ToastContent = ({
|
|
|
5080
5253
|
children: cancel.label
|
|
5081
5254
|
}
|
|
5082
5255
|
),
|
|
5083
|
-
action && /* @__PURE__ */ (0,
|
|
5256
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5084
5257
|
"button",
|
|
5085
5258
|
{
|
|
5086
5259
|
type: "button",
|
|
@@ -5094,19 +5267,19 @@ var ToastContent = ({
|
|
|
5094
5267
|
)
|
|
5095
5268
|
] })
|
|
5096
5269
|
] }),
|
|
5097
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
5270
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5098
5271
|
"button",
|
|
5099
5272
|
{
|
|
5100
5273
|
type: "button",
|
|
5101
5274
|
className: "mobius-toast__close",
|
|
5102
5275
|
onClick: () => import_sonner.toast.dismiss(toastId),
|
|
5103
5276
|
"aria-label": "Close",
|
|
5104
|
-
children: /* @__PURE__ */ (0,
|
|
5277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(CloseIcon, {})
|
|
5105
5278
|
}
|
|
5106
5279
|
)
|
|
5107
5280
|
] });
|
|
5108
5281
|
var createCustomToast = (message, variant, options) => import_sonner.toast.custom(
|
|
5109
|
-
(id) => /* @__PURE__ */ (0,
|
|
5282
|
+
(id) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5110
5283
|
ToastContent,
|
|
5111
5284
|
{
|
|
5112
5285
|
toastId: id,
|
|
@@ -5138,9 +5311,9 @@ var toast = {
|
|
|
5138
5311
|
};
|
|
5139
5312
|
|
|
5140
5313
|
// src/components/Toast/Toaster.tsx
|
|
5141
|
-
var
|
|
5314
|
+
var import_react48 = require("react");
|
|
5142
5315
|
var import_sonner2 = require("sonner");
|
|
5143
|
-
var
|
|
5316
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5144
5317
|
var Toaster = ({
|
|
5145
5318
|
position = "top-right",
|
|
5146
5319
|
closeButton = true,
|
|
@@ -5149,10 +5322,10 @@ var Toaster = ({
|
|
|
5149
5322
|
visibleToasts = 3,
|
|
5150
5323
|
gap = 8
|
|
5151
5324
|
}) => {
|
|
5152
|
-
(0,
|
|
5325
|
+
(0, import_react48.useEffect)(() => {
|
|
5153
5326
|
toastState.showCloseButton = closeButton;
|
|
5154
5327
|
}, [closeButton]);
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5156
5329
|
import_sonner2.Toaster,
|
|
5157
5330
|
{
|
|
5158
5331
|
position,
|
|
@@ -5168,7 +5341,7 @@ Toaster.displayName = "Toaster";
|
|
|
5168
5341
|
|
|
5169
5342
|
// src/components/Trust/Trust.tsx
|
|
5170
5343
|
var import_dedupe63 = __toESM(require("classnames/dedupe"));
|
|
5171
|
-
var
|
|
5344
|
+
var import_react49 = require("react");
|
|
5172
5345
|
init_utils();
|
|
5173
5346
|
|
|
5174
5347
|
// src/components/Trust/constants.ts
|
|
@@ -5233,7 +5406,7 @@ var TRUSTPILOT_WIDGET = {
|
|
|
5233
5406
|
};
|
|
5234
5407
|
|
|
5235
5408
|
// src/components/Trust/Trust.tsx
|
|
5236
|
-
var
|
|
5409
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5237
5410
|
var Trust = ({ ref, ...props }) => {
|
|
5238
5411
|
const {
|
|
5239
5412
|
elementType: Element = "div",
|
|
@@ -5245,8 +5418,8 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5245
5418
|
stars,
|
|
5246
5419
|
className
|
|
5247
5420
|
} = props;
|
|
5248
|
-
const [isMounted, setIsMounted] = (0,
|
|
5249
|
-
const trustRef = (0,
|
|
5421
|
+
const [isMounted, setIsMounted] = (0, import_react49.useState)(false);
|
|
5422
|
+
const trustRef = (0, import_react49.useRef)(null);
|
|
5250
5423
|
const {
|
|
5251
5424
|
templateId,
|
|
5252
5425
|
className: variantClassName,
|
|
@@ -5273,24 +5446,24 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5273
5446
|
},
|
|
5274
5447
|
className
|
|
5275
5448
|
);
|
|
5276
|
-
(0,
|
|
5449
|
+
(0, import_react49.useEffect)(() => {
|
|
5277
5450
|
const hasTrustpilotLoaded = trustRef.current && window?.Trustpilot && window?.Trustpilot.loadFromElement;
|
|
5278
5451
|
if (isMounted && hasTrustpilotLoaded) {
|
|
5279
5452
|
window.Trustpilot.loadFromElement(trustRef.current, true);
|
|
5280
5453
|
}
|
|
5281
5454
|
}, [isMounted]);
|
|
5282
|
-
(0,
|
|
5455
|
+
(0, import_react49.useEffect)(() => {
|
|
5283
5456
|
setIsMounted(true);
|
|
5284
5457
|
}, []);
|
|
5285
|
-
if (!isMounted) return /* @__PURE__ */ (0,
|
|
5286
|
-
return /* @__PURE__ */ (0,
|
|
5458
|
+
if (!isMounted) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles });
|
|
5459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5287
5460
|
Element,
|
|
5288
5461
|
{
|
|
5289
5462
|
ref: mergeRefs([trustRef, ref]),
|
|
5290
5463
|
className: classes,
|
|
5291
5464
|
style: styles,
|
|
5292
5465
|
...dataProps,
|
|
5293
|
-
children: /* @__PURE__ */ (0,
|
|
5466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5294
5467
|
"a",
|
|
5295
5468
|
{
|
|
5296
5469
|
href: link,
|
|
@@ -5306,11 +5479,11 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5306
5479
|
|
|
5307
5480
|
// src/components/ExpandableText/ExpandableText.tsx
|
|
5308
5481
|
var import_dedupe64 = __toESM(require("classnames/dedupe"));
|
|
5309
|
-
var
|
|
5482
|
+
var import_react50 = require("react");
|
|
5310
5483
|
init_hooks();
|
|
5311
5484
|
init_TextOrHTML2();
|
|
5312
5485
|
var import_ExpandableText = require("@simplybusiness/mobius/src/components/ExpandableText/ExpandableText.css");
|
|
5313
|
-
var
|
|
5486
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5314
5487
|
var ExpandableText = ({ ref, ...props }) => {
|
|
5315
5488
|
const {
|
|
5316
5489
|
text,
|
|
@@ -5324,14 +5497,14 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5324
5497
|
onToggle,
|
|
5325
5498
|
...otherProps
|
|
5326
5499
|
} = props;
|
|
5327
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
5328
|
-
const [isCollapsed, setIsCollapsed] = (0,
|
|
5329
|
-
const textRef = (0,
|
|
5500
|
+
const [isExpanded, setIsExpanded] = (0, import_react50.useState)(false);
|
|
5501
|
+
const [isCollapsed, setIsCollapsed] = (0, import_react50.useState)(false);
|
|
5502
|
+
const textRef = (0, import_react50.useRef)(null);
|
|
5330
5503
|
const { down } = useBreakpoint();
|
|
5331
|
-
const baseId = (0,
|
|
5504
|
+
const baseId = (0, import_react50.useId)();
|
|
5332
5505
|
const expandButtonId = `expandable-text-expand-${baseId}`;
|
|
5333
5506
|
const shouldCollapse = breakpoint ? down(breakpoint) : true;
|
|
5334
|
-
(0,
|
|
5507
|
+
(0, import_react50.useEffect)(() => {
|
|
5335
5508
|
if (!shouldCollapse || !textRef.current) {
|
|
5336
5509
|
setIsCollapsed(false);
|
|
5337
5510
|
return;
|
|
@@ -5341,7 +5514,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5341
5514
|
setIsCollapsed(isOverflowing);
|
|
5342
5515
|
}, [text, shouldCollapse, maxLines]);
|
|
5343
5516
|
if (breakpoint && !shouldCollapse) {
|
|
5344
|
-
return /* @__PURE__ */ (0,
|
|
5517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ref, className, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { text, textWrapper: true, ...textProps }) });
|
|
5345
5518
|
}
|
|
5346
5519
|
const handleAccordionChange = (expanded) => {
|
|
5347
5520
|
setIsExpanded(expanded);
|
|
@@ -5354,7 +5527,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5354
5527
|
const textContainerStyle = {
|
|
5355
5528
|
"--line-clamp": maxLines
|
|
5356
5529
|
};
|
|
5357
|
-
return /* @__PURE__ */ (0,
|
|
5530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
5358
5531
|
"div",
|
|
5359
5532
|
{
|
|
5360
5533
|
ref,
|
|
@@ -5362,7 +5535,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5362
5535
|
"data-testid": "expandable-text",
|
|
5363
5536
|
...otherProps,
|
|
5364
5537
|
children: [
|
|
5365
|
-
/* @__PURE__ */ (0,
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5366
5539
|
"div",
|
|
5367
5540
|
{
|
|
5368
5541
|
ref: textRef,
|
|
@@ -5370,10 +5543,10 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5370
5543
|
style: textContainerStyle,
|
|
5371
5544
|
"data-testid": "expandable-text-content",
|
|
5372
5545
|
"aria-describedby": isCollapsed ? expandButtonId : void 0,
|
|
5373
|
-
children: /* @__PURE__ */ (0,
|
|
5546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { elementType: "span", textWrapper: true, text, ...textProps })
|
|
5374
5547
|
}
|
|
5375
5548
|
),
|
|
5376
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
5549
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5377
5550
|
Accordion,
|
|
5378
5551
|
{
|
|
5379
5552
|
showText,
|
|
@@ -5396,7 +5569,7 @@ ExpandableText.displayName = "ExpandableText";
|
|
|
5396
5569
|
// src/components/MaskedField/index.tsx
|
|
5397
5570
|
var import_component = __toESM(require("@loadable/component"));
|
|
5398
5571
|
init_TextField2();
|
|
5399
|
-
var
|
|
5572
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5400
5573
|
var LoadableMaskedField = (0, import_component.default)(() => Promise.resolve().then(() => (init_MaskedField(), MaskedField_exports)), {
|
|
5401
5574
|
resolveComponent: (mod) => mod.MaskedField
|
|
5402
5575
|
});
|
|
@@ -5408,11 +5581,11 @@ function MaskedField2(props) {
|
|
|
5408
5581
|
ref: forwardedRef,
|
|
5409
5582
|
...textFieldProps
|
|
5410
5583
|
} = props;
|
|
5411
|
-
return /* @__PURE__ */ (0,
|
|
5584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5412
5585
|
LoadableMaskedField,
|
|
5413
5586
|
{
|
|
5414
5587
|
...props,
|
|
5415
|
-
fallback: /* @__PURE__ */ (0,
|
|
5588
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5416
5589
|
TextField,
|
|
5417
5590
|
{
|
|
5418
5591
|
...textFieldProps,
|