@simplybusiness/mobius 10.4.2 → 10.4.3
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 +7 -0
- 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/index.js +422 -245
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/index.js +422 -245
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/meta.json +316 -32
- package/dist/esm/chunk-26KZYRE6.js +108 -0
- package/dist/esm/chunk-26KZYRE6.js.map +7 -0
- 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-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-F5ELD54X.js → chunk-LGZWQZLS.js} +2 -2
- package/dist/esm/{chunk-OAG5T7NC.js → chunk-NEFRXIFY.js} +4 -4
- package/dist/esm/chunk-VZ3IWSK6.js +158 -0
- package/dist/esm/chunk-VZ3IWSK6.js.map +7 -0
- package/dist/esm/chunk-WYJP7HVL.js +26 -0
- package/dist/esm/chunk-WYJP7HVL.js.map +7 -0
- package/dist/esm/components/AddressLookup/AddressLookup.js +4 -4
- package/dist/esm/components/AddressLookup/index.js +6 -6
- 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 +3 -3
- package/dist/esm/components/Combobox/index.js +3 -3
- package/dist/esm/components/Drawer/index.js +3 -3
- package/dist/esm/components/Modal/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/index.js +77 -73
- package/dist/esm/index.js +77 -73
- package/dist/esm/meta.json +3737 -3401
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- 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/package.json +1 -2
- 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/dist/esm/chunk-O5YEU5TG.js +0 -155
- package/dist/esm/chunk-O5YEU5TG.js.map +0 -7
- /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-F5ELD54X.js.map → chunk-LGZWQZLS.js.map} +0 -0
- /package/dist/esm/{chunk-OAG5T7NC.js.map → chunk-NEFRXIFY.js.map} +0 -0
|
@@ -1081,17 +1081,17 @@ var MaskedField_exports = {};
|
|
|
1081
1081
|
__export(MaskedField_exports, {
|
|
1082
1082
|
MaskedField: () => MaskedField
|
|
1083
1083
|
});
|
|
1084
|
-
var
|
|
1084
|
+
var import_react50, import_react_imask, import_jsx_runtime76, useAcceptHandler, useCombinedRef, useBlurHandler, ControlledMaskedField, UncontrolledMaskedField, MaskedField;
|
|
1085
1085
|
var init_MaskedField = __esm({
|
|
1086
1086
|
"src/components/MaskedField/MaskedField.tsx"() {
|
|
1087
1087
|
"use strict";
|
|
1088
1088
|
"use client";
|
|
1089
|
-
|
|
1089
|
+
import_react50 = require("react");
|
|
1090
1090
|
import_react_imask = require("react-imask");
|
|
1091
1091
|
init_TextField2();
|
|
1092
|
-
|
|
1092
|
+
import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1093
1093
|
useAcceptHandler = (onChange, useMaskedValue, name) => {
|
|
1094
|
-
return (0,
|
|
1094
|
+
return (0, import_react50.useCallback)(
|
|
1095
1095
|
(maskedValue, maskInstance) => {
|
|
1096
1096
|
if (!onChange) {
|
|
1097
1097
|
return;
|
|
@@ -1107,7 +1107,7 @@ var init_MaskedField = __esm({
|
|
|
1107
1107
|
);
|
|
1108
1108
|
};
|
|
1109
1109
|
useCombinedRef = (imaskRef, forwardedRef) => {
|
|
1110
|
-
return (0,
|
|
1110
|
+
return (0, import_react50.useCallback)(
|
|
1111
1111
|
(element) => {
|
|
1112
1112
|
imaskRef.current = element;
|
|
1113
1113
|
if (typeof forwardedRef === "function") {
|
|
@@ -1120,7 +1120,7 @@ var init_MaskedField = __esm({
|
|
|
1120
1120
|
);
|
|
1121
1121
|
};
|
|
1122
1122
|
useBlurHandler = (onBlur, maskRef, useMaskedValue, name) => {
|
|
1123
|
-
return (0,
|
|
1123
|
+
return (0, import_react50.useCallback)(
|
|
1124
1124
|
(event) => {
|
|
1125
1125
|
if (!onBlur || !maskRef.current) {
|
|
1126
1126
|
return;
|
|
@@ -1150,7 +1150,7 @@ var init_MaskedField = __esm({
|
|
|
1150
1150
|
const { ref: imaskRef, maskRef, setValue } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1151
1151
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1152
1152
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1153
|
-
(0,
|
|
1153
|
+
(0, import_react50.useEffect)(() => {
|
|
1154
1154
|
if (!maskRef.current) {
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
@@ -1161,7 +1161,7 @@ var init_MaskedField = __esm({
|
|
|
1161
1161
|
setValue(stringValue);
|
|
1162
1162
|
}
|
|
1163
1163
|
}, [value, maskRef, setValue, imaskRef]);
|
|
1164
|
-
return /* @__PURE__ */ (0,
|
|
1164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1165
1165
|
TextField,
|
|
1166
1166
|
{
|
|
1167
1167
|
...textFieldProps,
|
|
@@ -1185,7 +1185,7 @@ var init_MaskedField = __esm({
|
|
|
1185
1185
|
const { ref: imaskRef, maskRef } = (0, import_react_imask.useIMask)(mask, { onAccept });
|
|
1186
1186
|
const combinedRef = useCombinedRef(imaskRef, forwardedRef);
|
|
1187
1187
|
const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);
|
|
1188
|
-
return /* @__PURE__ */ (0,
|
|
1188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1189
1189
|
TextField,
|
|
1190
1190
|
{
|
|
1191
1191
|
...textFieldProps,
|
|
@@ -1199,7 +1199,7 @@ var init_MaskedField = __esm({
|
|
|
1199
1199
|
MaskedField = ({ ref: forwardedRef, ...props }) => {
|
|
1200
1200
|
const { value, defaultValue, ...rest } = props;
|
|
1201
1201
|
if ("value" in props) {
|
|
1202
|
-
return /* @__PURE__ */ (0,
|
|
1202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1203
1203
|
ControlledMaskedField,
|
|
1204
1204
|
{
|
|
1205
1205
|
...rest,
|
|
@@ -1208,7 +1208,7 @@ var init_MaskedField = __esm({
|
|
|
1208
1208
|
}
|
|
1209
1209
|
);
|
|
1210
1210
|
} else {
|
|
1211
|
-
return /* @__PURE__ */ (0,
|
|
1211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1212
1212
|
UncontrolledMaskedField,
|
|
1213
1213
|
{
|
|
1214
1214
|
...rest,
|
|
@@ -4053,59 +4053,231 @@ var PasswordField = ({
|
|
|
4053
4053
|
PasswordField.displayName = "PasswordField";
|
|
4054
4054
|
|
|
4055
4055
|
// src/components/Popover/Popover.tsx
|
|
4056
|
-
var import_react35 = require("@floating-ui/react");
|
|
4057
4056
|
var import_icons12 = require("@simplybusiness/icons");
|
|
4058
4057
|
var import_dedupe42 = __toESM(require("classnames/dedupe"));
|
|
4059
|
-
var
|
|
4058
|
+
var import_react38 = require("react");
|
|
4059
|
+
var import_react_dom = require("react-dom");
|
|
4060
4060
|
var import_mobius_hooks6 = require("@simplybusiness/mobius-hooks");
|
|
4061
4061
|
init_Icon2();
|
|
4062
|
-
|
|
4062
|
+
|
|
4063
|
+
// src/components/Popover/Arrow.tsx
|
|
4063
4064
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4065
|
+
var Arrow = ({ ref, width = 20, className, style }) => {
|
|
4066
|
+
const height = width / 2;
|
|
4067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4068
|
+
"svg",
|
|
4069
|
+
{
|
|
4070
|
+
ref,
|
|
4071
|
+
className,
|
|
4072
|
+
"aria-hidden": "true",
|
|
4073
|
+
width,
|
|
4074
|
+
height,
|
|
4075
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
4076
|
+
style,
|
|
4077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("path", { d: `M0,0 H${width} L${width / 2},${height} Z` })
|
|
4078
|
+
}
|
|
4079
|
+
);
|
|
4080
|
+
};
|
|
4081
|
+
|
|
4082
|
+
// src/components/Popover/useAutoUpdate.ts
|
|
4083
|
+
var import_react35 = require("react");
|
|
4084
|
+
var useAutoUpdate = ({
|
|
4085
|
+
referenceRef,
|
|
4086
|
+
floatingRef,
|
|
4087
|
+
onUpdate,
|
|
4088
|
+
enabled
|
|
4089
|
+
}) => {
|
|
4090
|
+
(0, import_react35.useEffect)(() => {
|
|
4091
|
+
if (!enabled) return;
|
|
4092
|
+
const reference = referenceRef.current;
|
|
4093
|
+
const floating = floatingRef.current;
|
|
4094
|
+
const scrollOpts = {
|
|
4095
|
+
capture: true,
|
|
4096
|
+
passive: true
|
|
4097
|
+
};
|
|
4098
|
+
window.addEventListener("scroll", onUpdate, scrollOpts);
|
|
4099
|
+
window.addEventListener("resize", onUpdate, { passive: true });
|
|
4100
|
+
const observer = typeof ResizeObserver === "function" ? new ResizeObserver(onUpdate) : null;
|
|
4101
|
+
if (observer && reference) observer.observe(reference);
|
|
4102
|
+
if (observer && floating) observer.observe(floating);
|
|
4103
|
+
return () => {
|
|
4104
|
+
window.removeEventListener("scroll", onUpdate, scrollOpts);
|
|
4105
|
+
window.removeEventListener("resize", onUpdate);
|
|
4106
|
+
observer?.disconnect();
|
|
4107
|
+
};
|
|
4108
|
+
}, [enabled, onUpdate, referenceRef, floatingRef]);
|
|
4109
|
+
};
|
|
4110
|
+
|
|
4111
|
+
// src/components/Popover/useFloatingPosition.ts
|
|
4112
|
+
var import_react36 = require("react");
|
|
4113
|
+
var ABSOLUTE_FLOATING_STYLES = {
|
|
4114
|
+
position: "absolute",
|
|
4115
|
+
top: 0,
|
|
4116
|
+
left: 0,
|
|
4117
|
+
width: "max-content"
|
|
4118
|
+
};
|
|
4119
|
+
var FIXED_FLOATING_STYLES = {
|
|
4120
|
+
position: "fixed",
|
|
4121
|
+
top: 0,
|
|
4122
|
+
left: 0,
|
|
4123
|
+
width: "max-content"
|
|
4124
|
+
};
|
|
4125
|
+
var INITIAL_ARROW_STYLES = {
|
|
4126
|
+
position: "absolute"
|
|
4127
|
+
};
|
|
4128
|
+
var VIEWPORT_PADDING = 0;
|
|
4129
|
+
var createsFixedContainingBlock = (el) => {
|
|
4130
|
+
const style = window.getComputedStyle(el);
|
|
4131
|
+
return style.transform !== "none" || style.filter !== "none" || style.backdropFilter !== "none" || style.perspective !== "none" || /\b(transform|filter|perspective)\b/.test(style.willChange);
|
|
4132
|
+
};
|
|
4133
|
+
var useFloatingPosition = ({
|
|
4134
|
+
referenceRef,
|
|
4135
|
+
floatingRef,
|
|
4136
|
+
arrowRef,
|
|
4137
|
+
isOpen,
|
|
4138
|
+
offsetPx,
|
|
4139
|
+
arrowWidth,
|
|
4140
|
+
useFixedStrategy
|
|
4141
|
+
}) => {
|
|
4142
|
+
const update = (0, import_react36.useCallback)(() => {
|
|
4143
|
+
const reference = referenceRef.current;
|
|
4144
|
+
const floating = floatingRef.current;
|
|
4145
|
+
if (!reference || !floating) return;
|
|
4146
|
+
const refRect = reference.getBoundingClientRect();
|
|
4147
|
+
const floatingWidth = floating.offsetWidth;
|
|
4148
|
+
const floatingHeight = floating.offsetHeight;
|
|
4149
|
+
const scrollX = useFixedStrategy ? 0 : window.scrollX;
|
|
4150
|
+
const scrollY = useFixedStrategy ? 0 : window.scrollY;
|
|
4151
|
+
const parent = floating.parentElement;
|
|
4152
|
+
const parentIsCb = useFixedStrategy && !!parent && createsFixedContainingBlock(parent);
|
|
4153
|
+
const boundsRect = parentIsCb ? parent.getBoundingClientRect() : {
|
|
4154
|
+
left: 0,
|
|
4155
|
+
top: 0,
|
|
4156
|
+
right: window.innerWidth,
|
|
4157
|
+
bottom: window.innerHeight
|
|
4158
|
+
};
|
|
4159
|
+
const bottomTopViewport = refRect.bottom + offsetPx;
|
|
4160
|
+
const topTopViewport = refRect.top - floatingHeight - offsetPx;
|
|
4161
|
+
const overflowsBottom = bottomTopViewport + floatingHeight > boundsRect.bottom;
|
|
4162
|
+
const fitsTop = topTopViewport >= boundsRect.top;
|
|
4163
|
+
const nextPlacement = overflowsBottom && fitsTop ? "top" : "bottom";
|
|
4164
|
+
const topViewport = nextPlacement === "bottom" ? bottomTopViewport : topTopViewport;
|
|
4165
|
+
const rawLeftViewport = refRect.left + refRect.width / 2 - floatingWidth / 2;
|
|
4166
|
+
const minLeftViewport = boundsRect.left + VIEWPORT_PADDING;
|
|
4167
|
+
const maxLeftViewport = Math.max(
|
|
4168
|
+
minLeftViewport,
|
|
4169
|
+
boundsRect.right - floatingWidth - VIEWPORT_PADDING
|
|
4170
|
+
);
|
|
4171
|
+
const leftViewport = Math.min(
|
|
4172
|
+
Math.max(minLeftViewport, rawLeftViewport),
|
|
4173
|
+
maxLeftViewport
|
|
4174
|
+
);
|
|
4175
|
+
const cbOffsetLeft = parentIsCb ? boundsRect.left : 0;
|
|
4176
|
+
const cbOffsetTop = parentIsCb ? boundsRect.top : 0;
|
|
4177
|
+
floating.style.top = `${topViewport + scrollY - cbOffsetTop}px`;
|
|
4178
|
+
floating.style.left = `${leftViewport + scrollX - cbOffsetLeft}px`;
|
|
4179
|
+
const arrow = arrowRef.current;
|
|
4180
|
+
if (!arrow) return;
|
|
4181
|
+
const arrowHalf = arrowWidth / 2;
|
|
4182
|
+
const refCenterX = refRect.left + refRect.width / 2;
|
|
4183
|
+
const rawArrowLeft = refCenterX - leftViewport - arrowHalf;
|
|
4184
|
+
const maxArrowLeft = Math.max(0, floatingWidth - arrowWidth);
|
|
4185
|
+
const arrowLeft = Math.min(Math.max(0, rawArrowLeft), maxArrowLeft);
|
|
4186
|
+
arrow.style.left = `${arrowLeft}px`;
|
|
4187
|
+
if (nextPlacement === "bottom") {
|
|
4188
|
+
arrow.style.bottom = "100%";
|
|
4189
|
+
arrow.style.top = "";
|
|
4190
|
+
arrow.style.transform = "rotate(180deg)";
|
|
4191
|
+
} else {
|
|
4192
|
+
arrow.style.top = "100%";
|
|
4193
|
+
arrow.style.bottom = "";
|
|
4194
|
+
arrow.style.transform = "";
|
|
4195
|
+
}
|
|
4196
|
+
}, [
|
|
4197
|
+
referenceRef,
|
|
4198
|
+
floatingRef,
|
|
4199
|
+
arrowRef,
|
|
4200
|
+
offsetPx,
|
|
4201
|
+
arrowWidth,
|
|
4202
|
+
useFixedStrategy
|
|
4203
|
+
]);
|
|
4204
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
4205
|
+
if (!isOpen) return;
|
|
4206
|
+
update();
|
|
4207
|
+
}, [isOpen, update]);
|
|
4208
|
+
return {
|
|
4209
|
+
initialFloatingStyles: useFixedStrategy ? FIXED_FLOATING_STYLES : ABSOLUTE_FLOATING_STYLES,
|
|
4210
|
+
initialArrowStyles: INITIAL_ARROW_STYLES,
|
|
4211
|
+
update
|
|
4212
|
+
};
|
|
4213
|
+
};
|
|
4214
|
+
|
|
4215
|
+
// src/components/Popover/useOutsidePress.ts
|
|
4216
|
+
var import_react37 = require("react");
|
|
4217
|
+
var useOutsidePress = ({
|
|
4218
|
+
referenceRef,
|
|
4219
|
+
floatingRef,
|
|
4220
|
+
enabled,
|
|
4221
|
+
onOutsidePress
|
|
4222
|
+
}) => {
|
|
4223
|
+
(0, import_react37.useEffect)(() => {
|
|
4224
|
+
if (!enabled) return;
|
|
4225
|
+
const handler = (event) => {
|
|
4226
|
+
const target = event.target;
|
|
4227
|
+
if (!target) return;
|
|
4228
|
+
if (referenceRef.current?.contains(target)) return;
|
|
4229
|
+
if (floatingRef.current?.contains(target)) return;
|
|
4230
|
+
onOutsidePress(event);
|
|
4231
|
+
};
|
|
4232
|
+
document.addEventListener("pointerdown", handler);
|
|
4233
|
+
return () => document.removeEventListener("pointerdown", handler);
|
|
4234
|
+
}, [enabled, onOutsidePress, referenceRef, floatingRef]);
|
|
4235
|
+
};
|
|
4236
|
+
|
|
4237
|
+
// src/components/Popover/Popover.tsx
|
|
4238
|
+
var import_Popover = require("@simplybusiness/mobius/src/components/Popover/Popover.css");
|
|
4239
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4064
4240
|
var OFFSET_FROM_CONTENT_DEFAULT = 10;
|
|
4241
|
+
var ARROW_WIDTH = 20;
|
|
4065
4242
|
var Popover = (props) => {
|
|
4066
4243
|
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
|
-
]
|
|
4244
|
+
const referenceRef = (0, import_react38.useRef)(null);
|
|
4245
|
+
const floatingRef = (0, import_react38.useRef)(null);
|
|
4246
|
+
const arrowRef = (0, import_react38.useRef)(null);
|
|
4247
|
+
const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
|
|
4248
|
+
const [portalTarget, setPortalTarget] = (0, import_react38.useState)(null);
|
|
4249
|
+
const isInsideDialog = portalTarget !== null && portalTarget.tagName === "DIALOG";
|
|
4250
|
+
const { initialFloatingStyles, initialArrowStyles, update } = useFloatingPosition({
|
|
4251
|
+
referenceRef,
|
|
4252
|
+
floatingRef,
|
|
4253
|
+
arrowRef,
|
|
4254
|
+
isOpen,
|
|
4255
|
+
offsetPx: OFFSET_FROM_CONTENT_DEFAULT,
|
|
4256
|
+
arrowWidth: ARROW_WIDTH,
|
|
4257
|
+
useFixedStrategy: isInsideDialog
|
|
4082
4258
|
});
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4259
|
+
useAutoUpdate({
|
|
4260
|
+
referenceRef,
|
|
4261
|
+
floatingRef,
|
|
4262
|
+
onUpdate: update,
|
|
4263
|
+
enabled: isOpen
|
|
4264
|
+
});
|
|
4265
|
+
useOutsidePress({
|
|
4266
|
+
referenceRef,
|
|
4267
|
+
floatingRef,
|
|
4268
|
+
enabled: isOpen,
|
|
4269
|
+
onOutsidePress: () => {
|
|
4270
|
+
onClose?.();
|
|
4271
|
+
setIsOpen(false);
|
|
4092
4272
|
}
|
|
4093
4273
|
});
|
|
4094
|
-
const { getReferenceProps, getFloatingProps } = (0, import_react35.useInteractions)([dismiss]);
|
|
4095
4274
|
const containerClasses = (0, import_dedupe42.default)(
|
|
4096
4275
|
"mobius",
|
|
4097
4276
|
"mobius-popover__container",
|
|
4098
4277
|
className
|
|
4099
4278
|
);
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
refs.setFloating(node);
|
|
4103
|
-
floatingContainerRef.current = node;
|
|
4104
|
-
},
|
|
4105
|
-
[refs]
|
|
4106
|
-
);
|
|
4107
|
-
(0, import_react36.useEffect)(() => {
|
|
4108
|
-
const el = floatingContainerRef.current;
|
|
4279
|
+
(0, import_react38.useEffect)(() => {
|
|
4280
|
+
const el = floatingRef.current;
|
|
4109
4281
|
if (!el) return;
|
|
4110
4282
|
const preventLabelActivation = (e) => {
|
|
4111
4283
|
const target = e.target;
|
|
@@ -4122,77 +4294,82 @@ var Popover = (props) => {
|
|
|
4122
4294
|
onClose?.();
|
|
4123
4295
|
return;
|
|
4124
4296
|
}
|
|
4297
|
+
const dialog = referenceRef.current?.closest("dialog");
|
|
4298
|
+
setPortalTarget(dialog ?? document.body);
|
|
4125
4299
|
setIsOpen(true);
|
|
4126
4300
|
onOpen?.();
|
|
4127
4301
|
};
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4302
|
+
const setReferenceRef = (0, import_react38.useCallback)((node) => {
|
|
4303
|
+
referenceRef.current = node;
|
|
4304
|
+
}, []);
|
|
4305
|
+
const triggerComponent = (0, import_react38.cloneElement)(trigger, {
|
|
4306
|
+
ref: setReferenceRef,
|
|
4130
4307
|
className: (0, import_dedupe42.default)(
|
|
4131
4308
|
trigger.props.className,
|
|
4132
4309
|
"mobius-popover__toggle"
|
|
4133
4310
|
),
|
|
4134
|
-
onClick: toggleVisibility
|
|
4135
|
-
...getReferenceProps()
|
|
4311
|
+
onClick: toggleVisibility
|
|
4136
4312
|
});
|
|
4137
4313
|
(0, import_mobius_hooks6.useWindowEvent)("keydown", (e) => {
|
|
4138
|
-
if (e.key === "Escape") {
|
|
4314
|
+
if (e.key === "Escape" && isOpen) {
|
|
4315
|
+
setIsOpen(false);
|
|
4139
4316
|
onClose?.();
|
|
4140
4317
|
e.preventDefault();
|
|
4141
4318
|
e.stopPropagation();
|
|
4142
4319
|
}
|
|
4143
4320
|
});
|
|
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,
|
|
4321
|
+
const floatingElement = isOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4322
|
+
"div",
|
|
4323
|
+
{
|
|
4324
|
+
className: containerClasses,
|
|
4325
|
+
ref: floatingRef,
|
|
4326
|
+
style: initialFloatingStyles,
|
|
4327
|
+
children: [
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "mobius-popover", children: [
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("header", { className: "mobius-popover__header", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4330
|
+
Button,
|
|
4177
4331
|
{
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4332
|
+
type: "button",
|
|
4333
|
+
className: "mobius-popover__close-button",
|
|
4334
|
+
onClick: toggleVisibility,
|
|
4335
|
+
"aria-label": "Close",
|
|
4336
|
+
variant: "ghost",
|
|
4337
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4338
|
+
Icon,
|
|
4339
|
+
{
|
|
4340
|
+
icon: import_icons12.cross,
|
|
4341
|
+
size: "md",
|
|
4342
|
+
className: "mobius-popover__close-icon"
|
|
4343
|
+
}
|
|
4344
|
+
)
|
|
4182
4345
|
}
|
|
4183
|
-
)
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4346
|
+
) }),
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "mobius-popover__body", children })
|
|
4348
|
+
] }),
|
|
4349
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4350
|
+
Arrow,
|
|
4351
|
+
{
|
|
4352
|
+
ref: arrowRef,
|
|
4353
|
+
style: initialArrowStyles,
|
|
4354
|
+
className: "mobius-popover__arrow-icon",
|
|
4355
|
+
width: ARROW_WIDTH
|
|
4356
|
+
}
|
|
4357
|
+
)
|
|
4358
|
+
]
|
|
4359
|
+
}
|
|
4360
|
+
) : null;
|
|
4361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
4362
|
+
triggerComponent,
|
|
4363
|
+
floatingElement && portalTarget ? (0, import_react_dom.createPortal)(floatingElement, portalTarget) : null
|
|
4187
4364
|
] });
|
|
4188
4365
|
};
|
|
4189
4366
|
|
|
4190
4367
|
// src/components/Progress/Progress.tsx
|
|
4191
4368
|
var import_dedupe43 = __toESM(require("classnames/dedupe"));
|
|
4192
|
-
var
|
|
4369
|
+
var import_react39 = require("react");
|
|
4193
4370
|
init_Label2();
|
|
4194
4371
|
var import_Progress = require("@simplybusiness/mobius/src/components/Progress/Progress.css");
|
|
4195
|
-
var
|
|
4372
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4196
4373
|
function warnAboutInvalidValues(value, minValue, maxValue) {
|
|
4197
4374
|
if (minValue > maxValue) {
|
|
4198
4375
|
console.warn("minValue is greater than maxValue");
|
|
@@ -4212,7 +4389,7 @@ var sanitizedValue = (value, defaultValue) => {
|
|
|
4212
4389
|
};
|
|
4213
4390
|
var getLabelComponent = (label, progressLabelId, showLabel) => {
|
|
4214
4391
|
if (showLabel) {
|
|
4215
|
-
return /* @__PURE__ */ (0,
|
|
4392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4216
4393
|
Label,
|
|
4217
4394
|
{
|
|
4218
4395
|
id: progressLabelId,
|
|
@@ -4222,7 +4399,7 @@ var getLabelComponent = (label, progressLabelId, showLabel) => {
|
|
|
4222
4399
|
}
|
|
4223
4400
|
);
|
|
4224
4401
|
}
|
|
4225
|
-
return /* @__PURE__ */ (0,
|
|
4402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4226
4403
|
Label,
|
|
4227
4404
|
{
|
|
4228
4405
|
id: progressLabelId,
|
|
@@ -4236,8 +4413,8 @@ var DEFAULT_VALUE = 0;
|
|
|
4236
4413
|
var DEFAULT_MIN_VALUE = 0;
|
|
4237
4414
|
var DEFAULT_MAX_VALUE = 100;
|
|
4238
4415
|
var Progress = ({ ref, ...props }) => {
|
|
4239
|
-
const progressId = (0,
|
|
4240
|
-
const progressLabelId = (0,
|
|
4416
|
+
const progressId = (0, import_react39.useId)();
|
|
4417
|
+
const progressLabelId = (0, import_react39.useId)();
|
|
4241
4418
|
const {
|
|
4242
4419
|
id,
|
|
4243
4420
|
label,
|
|
@@ -4272,7 +4449,7 @@ var Progress = ({ ref, ...props }) => {
|
|
|
4272
4449
|
progressBarProps["aria-valuenow"] = value.toString();
|
|
4273
4450
|
progressBarProps["aria-valuetext"] = valueFormatter instanceof Function ? valueFormatter(value, minValue, maxValue) : barWidth;
|
|
4274
4451
|
const labelComponent = getLabelComponent(label, progressLabelId, showLabel);
|
|
4275
|
-
return /* @__PURE__ */ (0,
|
|
4452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4276
4453
|
"div",
|
|
4277
4454
|
{
|
|
4278
4455
|
id: id || progressId,
|
|
@@ -4283,8 +4460,8 @@ var Progress = ({ ref, ...props }) => {
|
|
|
4283
4460
|
"aria-labelledby": progressLabelId,
|
|
4284
4461
|
children: [
|
|
4285
4462
|
labelComponent,
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4287
|
-
showValueLabel && /* @__PURE__ */ (0,
|
|
4463
|
+
/* @__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 } }) }),
|
|
4464
|
+
showValueLabel && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Label, { "data-testid": "value-label", elementType: "span", children: progressBarProps["aria-valuetext"] })
|
|
4288
4465
|
]
|
|
4289
4466
|
}
|
|
4290
4467
|
);
|
|
@@ -4293,11 +4470,11 @@ Progress.displayName = "Progress";
|
|
|
4293
4470
|
|
|
4294
4471
|
// src/components/Radio/Radio.tsx
|
|
4295
4472
|
var import_dedupe44 = __toESM(require("classnames/dedupe"));
|
|
4296
|
-
var
|
|
4473
|
+
var import_react40 = require("react");
|
|
4297
4474
|
init_ErrorMessage2();
|
|
4298
4475
|
init_Label2();
|
|
4299
4476
|
var import_Radio = require("@simplybusiness/mobius/src/components/Radio/Radio.css");
|
|
4300
|
-
var
|
|
4477
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4301
4478
|
var Radio = ({ ref, ...props }) => {
|
|
4302
4479
|
const {
|
|
4303
4480
|
children,
|
|
@@ -4321,19 +4498,19 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4321
4498
|
const isMultiline = label && children;
|
|
4322
4499
|
const isControlled = selected !== void 0;
|
|
4323
4500
|
const isChecked = isControlled ? selected === value : defaultChecked;
|
|
4324
|
-
const contentRef = (0,
|
|
4325
|
-
const prevOverflowRef = (0,
|
|
4501
|
+
const contentRef = (0, import_react40.useRef)(null);
|
|
4502
|
+
const prevOverflowRef = (0, import_react40.useRef)({
|
|
4326
4503
|
vertical: false,
|
|
4327
4504
|
horizontal: false
|
|
4328
4505
|
});
|
|
4329
|
-
const hasIconFirst = (0,
|
|
4330
|
-
if (!children ||
|
|
4331
|
-
const firstChild =
|
|
4332
|
-
if (!(0,
|
|
4506
|
+
const hasIconFirst = (0, import_react40.useMemo)(() => {
|
|
4507
|
+
if (!children || import_react40.Children.count(children) === 0) return false;
|
|
4508
|
+
const firstChild = import_react40.Children.toArray(children)[0];
|
|
4509
|
+
if (!(0, import_react40.isValidElement)(firstChild)) return false;
|
|
4333
4510
|
const props2 = firstChild.props;
|
|
4334
4511
|
return "icon" in props2 && props2.icon !== void 0;
|
|
4335
4512
|
}, [children]);
|
|
4336
|
-
(0,
|
|
4513
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4337
4514
|
if (!contentRef.current || !onOverflow) return;
|
|
4338
4515
|
if (orientation === "vertical") {
|
|
4339
4516
|
return;
|
|
@@ -4382,9 +4559,9 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4382
4559
|
onChange(adaptedEvent);
|
|
4383
4560
|
}
|
|
4384
4561
|
};
|
|
4385
|
-
return /* @__PURE__ */ (0,
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Label, { className: containerClasses, children: [
|
|
4564
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4388
4565
|
"input",
|
|
4389
4566
|
{
|
|
4390
4567
|
"aria-describedby": otherProps["aria-describedby"],
|
|
@@ -4401,25 +4578,25 @@ var Radio = ({ ref, ...props }) => {
|
|
|
4401
4578
|
...rest
|
|
4402
4579
|
}
|
|
4403
4580
|
),
|
|
4404
|
-
isMultiline ? /* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4406
|
-
/* @__PURE__ */ (0,
|
|
4407
|
-
] }) : /* @__PURE__ */ (0,
|
|
4581
|
+
isMultiline ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { ref: contentRef, className: "mobius-radio__content--multiline", children: [
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mobius-radio__content-first-line", children: label }),
|
|
4583
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mobius-radio__extra-content", children })
|
|
4584
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ref: contentRef, className: "mobius-radio__content", children: label || children })
|
|
4408
4585
|
] }),
|
|
4409
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
4586
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ErrorMessage, { errorMessage })
|
|
4410
4587
|
] });
|
|
4411
4588
|
};
|
|
4412
4589
|
Radio.displayName = "Radio";
|
|
4413
4590
|
|
|
4414
4591
|
// src/components/Radio/RadioGroup.tsx
|
|
4415
4592
|
var import_dedupe45 = __toESM(require("classnames/dedupe"));
|
|
4416
|
-
var
|
|
4593
|
+
var import_react41 = require("react");
|
|
4417
4594
|
init_hooks();
|
|
4418
4595
|
init_spaceDelimitedList();
|
|
4419
4596
|
init_ErrorMessage2();
|
|
4420
4597
|
init_Label2();
|
|
4421
4598
|
init_Stack2();
|
|
4422
|
-
var
|
|
4599
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4423
4600
|
var getDefaultVal = (children, defaultValue) => {
|
|
4424
4601
|
if (Array.isArray(children) && defaultValue) {
|
|
4425
4602
|
const option = children?.find((item) => item.props.value === defaultValue);
|
|
@@ -4447,15 +4624,15 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4447
4624
|
...rest
|
|
4448
4625
|
} = props;
|
|
4449
4626
|
const defaultSelected = getDefaultVal(children, value || defaultValue);
|
|
4450
|
-
const [selected, setSelected] = (0,
|
|
4451
|
-
const overflowsRef = (0,
|
|
4452
|
-
const [hasOverflow, setHasOverflow] = (0,
|
|
4453
|
-
(0,
|
|
4627
|
+
const [selected, setSelected] = (0, import_react41.useState)(defaultSelected);
|
|
4628
|
+
const overflowsRef = (0, import_react41.useRef)({});
|
|
4629
|
+
const [hasOverflow, setHasOverflow] = (0, import_react41.useState)(false);
|
|
4630
|
+
(0, import_react41.useEffect)(() => {
|
|
4454
4631
|
if (value !== void 0) {
|
|
4455
4632
|
setSelected(value);
|
|
4456
4633
|
}
|
|
4457
4634
|
}, [value]);
|
|
4458
|
-
const handleOverflow = (0,
|
|
4635
|
+
const handleOverflow = (0, import_react41.useCallback)(
|
|
4459
4636
|
(radioValue, overflow) => {
|
|
4460
4637
|
overflowsRef.current = {
|
|
4461
4638
|
...overflowsRef.current,
|
|
@@ -4489,16 +4666,16 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4489
4666
|
[`--is-${effectiveOrientation}`]: true
|
|
4490
4667
|
});
|
|
4491
4668
|
const labelClasses = (0, import_dedupe45.default)(radioClasses, validationClasses);
|
|
4492
|
-
const errorMessageId = (0,
|
|
4493
|
-
const defaultNameAttrId = (0,
|
|
4669
|
+
const errorMessageId = (0, import_react41.useId)();
|
|
4670
|
+
const defaultNameAttrId = (0, import_react41.useId)();
|
|
4494
4671
|
const nameAttribute = name || defaultNameAttrId;
|
|
4495
4672
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
4496
4673
|
const describedBy = spaceDelimitedList([
|
|
4497
4674
|
shouldErrorMessageShow,
|
|
4498
4675
|
props["aria-describedby"]
|
|
4499
4676
|
]);
|
|
4500
|
-
const labelId = (0,
|
|
4501
|
-
return /* @__PURE__ */ (0,
|
|
4677
|
+
const labelId = (0, import_react41.useId)();
|
|
4678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4502
4679
|
"div",
|
|
4503
4680
|
{
|
|
4504
4681
|
...rest,
|
|
@@ -4514,12 +4691,12 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4514
4691
|
ref,
|
|
4515
4692
|
className: radioGroupClasses,
|
|
4516
4693
|
role: "radiogroup",
|
|
4517
|
-
children: /* @__PURE__ */ (0,
|
|
4518
|
-
label && /* @__PURE__ */ (0,
|
|
4519
|
-
/* @__PURE__ */ (0,
|
|
4520
|
-
if ((0,
|
|
4694
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Stack, { gap: "xs", children: [
|
|
4695
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Label, { htmlFor: name, id: labelId, className: labelClasses, children: label }),
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: radioWrapperClasses, children: import_react41.Children.map(children, (child) => {
|
|
4697
|
+
if ((0, import_react41.isValidElement)(child)) {
|
|
4521
4698
|
const childValue = child.props.value;
|
|
4522
|
-
return (0,
|
|
4699
|
+
return (0, import_react41.cloneElement)(
|
|
4523
4700
|
child,
|
|
4524
4701
|
{
|
|
4525
4702
|
orientation: effectiveOrientation,
|
|
@@ -4537,7 +4714,7 @@ var RadioGroup = ({ ref, ...props }) => {
|
|
|
4537
4714
|
}
|
|
4538
4715
|
return child;
|
|
4539
4716
|
}) }),
|
|
4540
|
-
/* @__PURE__ */ (0,
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ErrorMessage, { id: errorMessageId, errorMessage })
|
|
4541
4718
|
] })
|
|
4542
4719
|
}
|
|
4543
4720
|
);
|
|
@@ -4546,7 +4723,7 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
4546
4723
|
|
|
4547
4724
|
// src/components/Segment/SegmentGroup.tsx
|
|
4548
4725
|
var import_dedupe46 = __toESM(require("classnames/dedupe"));
|
|
4549
|
-
var
|
|
4726
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4550
4727
|
var SegmentGroup = (props) => {
|
|
4551
4728
|
const { children, horizontal, gap, className, ...rest } = props;
|
|
4552
4729
|
const gapClass = gap ? `gap-${gap}` : "";
|
|
@@ -4557,14 +4734,14 @@ var SegmentGroup = (props) => {
|
|
|
4557
4734
|
{ "--is-horizontal": horizontal },
|
|
4558
4735
|
gapClass
|
|
4559
4736
|
);
|
|
4560
|
-
return /* @__PURE__ */ (0,
|
|
4737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: classes, ...rest, children });
|
|
4561
4738
|
};
|
|
4562
4739
|
SegmentGroup.displayName = "SegmentGroup";
|
|
4563
4740
|
|
|
4564
4741
|
// src/components/Segment/Segment.tsx
|
|
4565
4742
|
var import_dedupe47 = __toESM(require("classnames/dedupe"));
|
|
4566
4743
|
var import_Segment = require("@simplybusiness/mobius/src/components/Segment/Segment.css");
|
|
4567
|
-
var
|
|
4744
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4568
4745
|
var Segment = ({ ref, ...props }) => {
|
|
4569
4746
|
const { heading, children, colour, inverted, className, ...rest } = props;
|
|
4570
4747
|
const classes = (0, import_dedupe47.default)(
|
|
@@ -4574,8 +4751,8 @@ var Segment = ({ ref, ...props }) => {
|
|
|
4574
4751
|
{ inverted },
|
|
4575
4752
|
className
|
|
4576
4753
|
);
|
|
4577
|
-
return /* @__PURE__ */ (0,
|
|
4578
|
-
heading && /* @__PURE__ */ (0,
|
|
4754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { ref, className: classes, ...rest, children: [
|
|
4755
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "mobius-segment__heading", children: heading }),
|
|
4579
4756
|
children
|
|
4580
4757
|
] });
|
|
4581
4758
|
};
|
|
@@ -4584,7 +4761,7 @@ Segment.displayName = "Segment";
|
|
|
4584
4761
|
// src/components/Select/Select.tsx
|
|
4585
4762
|
var import_icons13 = require("@simplybusiness/icons");
|
|
4586
4763
|
var import_dedupe48 = __toESM(require("classnames/dedupe"));
|
|
4587
|
-
var
|
|
4764
|
+
var import_react42 = require("react");
|
|
4588
4765
|
init_hooks();
|
|
4589
4766
|
init_useLabel2();
|
|
4590
4767
|
init_spaceDelimitedList();
|
|
@@ -4593,7 +4770,7 @@ init_Icon2();
|
|
|
4593
4770
|
init_Label2();
|
|
4594
4771
|
init_Stack2();
|
|
4595
4772
|
var import_Select = require("@simplybusiness/mobius/src/components/Select/Select.css");
|
|
4596
|
-
var
|
|
4773
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4597
4774
|
var Select = ({ ref, ...props }) => {
|
|
4598
4775
|
const {
|
|
4599
4776
|
label,
|
|
@@ -4631,7 +4808,7 @@ var Select = ({ ref, ...props }) => {
|
|
|
4631
4808
|
otherProps.className
|
|
4632
4809
|
);
|
|
4633
4810
|
const iconClasses = (0, import_dedupe48.default)("mobius-select__icon", sharedClasses);
|
|
4634
|
-
const errorMessageId = (0,
|
|
4811
|
+
const errorMessageId = (0, import_react42.useId)();
|
|
4635
4812
|
const shouldErrorMessageShow = errorMessage ? errorMessageId : void 0;
|
|
4636
4813
|
const describedBy = spaceDelimitedList([
|
|
4637
4814
|
shouldErrorMessageShow,
|
|
@@ -4642,10 +4819,10 @@ var Select = ({ ref, ...props }) => {
|
|
|
4642
4819
|
onChange(e);
|
|
4643
4820
|
}
|
|
4644
4821
|
};
|
|
4645
|
-
return /* @__PURE__ */ (0,
|
|
4646
|
-
label && /* @__PURE__ */ (0,
|
|
4647
|
-
/* @__PURE__ */ (0,
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Stack, { className: "mobius mobius-select__outer", gap: "xs", children: [
|
|
4823
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Label, { ...labelProps, className: labelClasses, children: label }),
|
|
4824
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: wrapperClasses, children: [
|
|
4825
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4649
4826
|
"select",
|
|
4650
4827
|
{
|
|
4651
4828
|
...otherProps,
|
|
@@ -4661,21 +4838,21 @@ var Select = ({ ref, ...props }) => {
|
|
|
4661
4838
|
onChange: handleChange
|
|
4662
4839
|
}
|
|
4663
4840
|
),
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
4841
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { icon: import_icons13.chevronDown }) })
|
|
4665
4842
|
] }),
|
|
4666
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
4843
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorMessage, { id: errorMessageId, errorMessage })
|
|
4667
4844
|
] });
|
|
4668
4845
|
};
|
|
4669
4846
|
Select.displayName = "Select";
|
|
4670
4847
|
|
|
4671
4848
|
// src/components/Slider/Slider.tsx
|
|
4672
4849
|
var import_dedupe49 = __toESM(require("classnames/dedupe"));
|
|
4673
|
-
var
|
|
4850
|
+
var import_react44 = require("react");
|
|
4674
4851
|
init_hooks();
|
|
4675
4852
|
init_Label2();
|
|
4676
4853
|
|
|
4677
4854
|
// src/components/Slider/helpers.ts
|
|
4678
|
-
var
|
|
4855
|
+
var import_react43 = require("react");
|
|
4679
4856
|
function numberFormatter(value, formatOptions, locale = navigator.languages?.[0] || "en-GB") {
|
|
4680
4857
|
if (!formatOptions) {
|
|
4681
4858
|
return value?.toString() || "";
|
|
@@ -4685,7 +4862,7 @@ function numberFormatter(value, formatOptions, locale = navigator.languages?.[0]
|
|
|
4685
4862
|
|
|
4686
4863
|
// src/components/Slider/Slider.tsx
|
|
4687
4864
|
var import_Slider = require("@simplybusiness/mobius/src/components/Slider/Slider.css");
|
|
4688
|
-
var
|
|
4865
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4689
4866
|
var Slider = (props) => {
|
|
4690
4867
|
const {
|
|
4691
4868
|
id,
|
|
@@ -4706,11 +4883,11 @@ var Slider = (props) => {
|
|
|
4706
4883
|
formatOptions,
|
|
4707
4884
|
isDisabled = false
|
|
4708
4885
|
} = props;
|
|
4709
|
-
const trackRef = (0,
|
|
4710
|
-
const [currentValue, setCurrentValue] = (0,
|
|
4886
|
+
const trackRef = (0, import_react44.useRef)(null);
|
|
4887
|
+
const [currentValue, setCurrentValue] = (0, import_react44.useState)(
|
|
4711
4888
|
value || defaultValue || 0
|
|
4712
4889
|
);
|
|
4713
|
-
const [isDragging, setIsDraggging] = (0,
|
|
4890
|
+
const [isDragging, setIsDraggging] = (0, import_react44.useState)(false);
|
|
4714
4891
|
const { labelProps, fieldProps } = useLabel({
|
|
4715
4892
|
id,
|
|
4716
4893
|
label,
|
|
@@ -4740,12 +4917,12 @@ var Slider = (props) => {
|
|
|
4740
4917
|
onChangeEnd(currentValue);
|
|
4741
4918
|
}
|
|
4742
4919
|
};
|
|
4743
|
-
return /* @__PURE__ */ (0,
|
|
4744
|
-
/* @__PURE__ */ (0,
|
|
4745
|
-
label && /* @__PURE__ */ (0,
|
|
4746
|
-
label && /* @__PURE__ */ (0,
|
|
4920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: classes, children: [
|
|
4921
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mobius-slider__label-wrapper", children: [
|
|
4922
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Label, { ...labelProps, children: label }),
|
|
4923
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("output", { style: { flex: "1 0 auto", textAlign: "end" }, children: formattedValue })
|
|
4747
4924
|
] }),
|
|
4748
|
-
/* @__PURE__ */ (0,
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: trackRef, className: "mobius-slider__track-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4749
4926
|
"input",
|
|
4750
4927
|
{
|
|
4751
4928
|
className: "mobius-slider__track",
|
|
@@ -4764,9 +4941,9 @@ var Slider = (props) => {
|
|
|
4764
4941
|
...fieldProps
|
|
4765
4942
|
}
|
|
4766
4943
|
) }),
|
|
4767
|
-
/* @__PURE__ */ (0,
|
|
4768
|
-
/* @__PURE__ */ (0,
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mobius-slider__labels", children: [
|
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mobius-slider__min-label", "data-testid": "min-label", children: minLabel }),
|
|
4946
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mobius-slider__max-label", "data-testid": "max-label", children: maxLabel })
|
|
4770
4947
|
] })
|
|
4771
4948
|
] });
|
|
4772
4949
|
};
|
|
@@ -4775,15 +4952,15 @@ var Slider = (props) => {
|
|
|
4775
4952
|
init_Stack2();
|
|
4776
4953
|
|
|
4777
4954
|
// src/components/SVG/SVG.tsx
|
|
4778
|
-
var
|
|
4955
|
+
var import_react45 = require("react");
|
|
4779
4956
|
var import_dedupe50 = __toESM(require("classnames/dedupe"));
|
|
4780
|
-
var
|
|
4957
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4781
4958
|
var SVG = ({ ref, ...props }) => {
|
|
4782
4959
|
const { children, className, ...otherProps } = props;
|
|
4783
4960
|
const classes = (0, import_dedupe50.default)("mobius", "mobius-svg", className);
|
|
4784
|
-
const svgNode =
|
|
4961
|
+
const svgNode = import_react45.Children.only(children);
|
|
4785
4962
|
const { children: svgChildren, viewBox, xmlns } = svgNode.props;
|
|
4786
|
-
return /* @__PURE__ */ (0,
|
|
4963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4787
4964
|
"svg",
|
|
4788
4965
|
{
|
|
4789
4966
|
viewBox,
|
|
@@ -4798,10 +4975,10 @@ var SVG = ({ ref, ...props }) => {
|
|
|
4798
4975
|
SVG.displayName = "SVG";
|
|
4799
4976
|
|
|
4800
4977
|
// src/components/Switch/Switch.tsx
|
|
4801
|
-
var
|
|
4978
|
+
var import_react46 = require("react");
|
|
4802
4979
|
var import_dedupe51 = __toESM(require("classnames/dedupe"));
|
|
4803
4980
|
var import_Switch = require("@simplybusiness/mobius/src/components/Switch/Switch.css");
|
|
4804
|
-
var
|
|
4981
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4805
4982
|
var Switch = ({ ref, ...props }) => {
|
|
4806
4983
|
const {
|
|
4807
4984
|
checked = false,
|
|
@@ -4810,8 +4987,8 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4810
4987
|
isDisabled = false,
|
|
4811
4988
|
...otherProps
|
|
4812
4989
|
} = props;
|
|
4813
|
-
const [enabled, setEnabled] = (0,
|
|
4814
|
-
(0,
|
|
4990
|
+
const [enabled, setEnabled] = (0, import_react46.useState)(checked);
|
|
4991
|
+
(0, import_react46.useEffect)(() => {
|
|
4815
4992
|
setEnabled(checked);
|
|
4816
4993
|
}, [checked]);
|
|
4817
4994
|
const classes = (0, import_dedupe51.default)(
|
|
@@ -4829,9 +5006,9 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4829
5006
|
onChange(event);
|
|
4830
5007
|
}
|
|
4831
5008
|
};
|
|
4832
|
-
return /* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
5009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { ref, className: classes, children: [
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: enabled ? "On" : "Off" }) }),
|
|
5011
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4835
5012
|
"input",
|
|
4836
5013
|
{
|
|
4837
5014
|
type: "checkbox",
|
|
@@ -4842,7 +5019,7 @@ var Switch = ({ ref, ...props }) => {
|
|
|
4842
5019
|
...otherProps
|
|
4843
5020
|
}
|
|
4844
5021
|
),
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
5022
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "mobius-switch__slider" })
|
|
4846
5023
|
] });
|
|
4847
5024
|
};
|
|
4848
5025
|
Switch.displayName = "Switch";
|
|
@@ -4850,72 +5027,72 @@ Switch.displayName = "Switch";
|
|
|
4850
5027
|
// src/components/Table/Table.tsx
|
|
4851
5028
|
var import_dedupe52 = __toESM(require("classnames/dedupe"));
|
|
4852
5029
|
var import_Table = require("@simplybusiness/mobius/src/components/Table/Table.css");
|
|
4853
|
-
var
|
|
5030
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4854
5031
|
var Table = ({ ref, ...props }) => {
|
|
4855
5032
|
const classes = (0, import_dedupe52.default)("mobius", "mobius-table", props.className);
|
|
4856
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("table", { ref, ...props, className: classes });
|
|
4857
5034
|
};
|
|
4858
5035
|
Table.displayName = "Table";
|
|
4859
5036
|
|
|
4860
5037
|
// src/components/Table/Head.tsx
|
|
4861
5038
|
var import_dedupe53 = __toESM(require("classnames/dedupe"));
|
|
4862
|
-
var
|
|
5039
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4863
5040
|
var Head = ({ ref, ...props }) => {
|
|
4864
5041
|
const classes = (0, import_dedupe53.default)("mobius", "mobius-table__head", props.className);
|
|
4865
|
-
return /* @__PURE__ */ (0,
|
|
5042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { ref, ...props, className: classes });
|
|
4866
5043
|
};
|
|
4867
5044
|
Head.displayName = "Table.Head";
|
|
4868
5045
|
|
|
4869
5046
|
// src/components/Table/Body.tsx
|
|
4870
5047
|
var import_dedupe54 = __toESM(require("classnames/dedupe"));
|
|
4871
|
-
var
|
|
5048
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4872
5049
|
var Body = ({ ref, ...props }) => {
|
|
4873
5050
|
const classes = (0, import_dedupe54.default)("mobius", "mobius-table__body", props.className);
|
|
4874
|
-
return /* @__PURE__ */ (0,
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("tbody", { ref, ...props, className: classes });
|
|
4875
5052
|
};
|
|
4876
5053
|
Body.displayName = "Table.Body";
|
|
4877
5054
|
|
|
4878
5055
|
// src/components/Table/Foot.tsx
|
|
4879
5056
|
var import_dedupe55 = __toESM(require("classnames/dedupe"));
|
|
4880
|
-
var
|
|
5057
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4881
5058
|
var Foot = ({ ref, ...props }) => {
|
|
4882
5059
|
const classes = (0, import_dedupe55.default)("mobius", "mobius-table__foot", props.className);
|
|
4883
|
-
return /* @__PURE__ */ (0,
|
|
5060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tfoot", { ref, ...props, className: classes });
|
|
4884
5061
|
};
|
|
4885
5062
|
Foot.displayName = "Table.Foot";
|
|
4886
5063
|
|
|
4887
5064
|
// src/components/Table/Row.tsx
|
|
4888
5065
|
var import_dedupe56 = __toESM(require("classnames/dedupe"));
|
|
4889
|
-
var
|
|
5066
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4890
5067
|
var Row = ({ ref, ...props }) => {
|
|
4891
5068
|
const classes = (0, import_dedupe56.default)("mobius", "mobius-table__row", props.className);
|
|
4892
|
-
return /* @__PURE__ */ (0,
|
|
5069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tr", { ref, ...props, className: classes });
|
|
4893
5070
|
};
|
|
4894
5071
|
Row.displayName = "Table.Row";
|
|
4895
5072
|
|
|
4896
5073
|
// src/components/Table/HeaderCell.tsx
|
|
4897
5074
|
var import_dedupe57 = __toESM(require("classnames/dedupe"));
|
|
4898
|
-
var
|
|
5075
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4899
5076
|
var HeaderCell = ({ ref, scope = "col", ...props }) => {
|
|
4900
5077
|
const classes = (0, import_dedupe57.default)(
|
|
4901
5078
|
"mobius",
|
|
4902
5079
|
"mobius-table__head-cell",
|
|
4903
5080
|
props.className
|
|
4904
5081
|
);
|
|
4905
|
-
return /* @__PURE__ */ (0,
|
|
5082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { ...props, ref, scope, className: classes });
|
|
4906
5083
|
};
|
|
4907
5084
|
HeaderCell.displayName = "Table.HeaderCell";
|
|
4908
5085
|
|
|
4909
5086
|
// src/components/Table/Cell.tsx
|
|
4910
5087
|
var import_dedupe58 = __toESM(require("classnames/dedupe"));
|
|
4911
|
-
var
|
|
5088
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4912
5089
|
var Cell = ({ ref, ...props }) => {
|
|
4913
5090
|
const classes = (0, import_dedupe58.default)(
|
|
4914
5091
|
"mobius",
|
|
4915
5092
|
"mobius-table__body-cell",
|
|
4916
5093
|
props.className
|
|
4917
5094
|
);
|
|
4918
|
-
return /* @__PURE__ */ (0,
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("td", { ref, ...props, className: classes });
|
|
4919
5096
|
};
|
|
4920
5097
|
Cell.displayName = "Table.Cell";
|
|
4921
5098
|
|
|
@@ -4939,7 +5116,7 @@ init_Stack2();
|
|
|
4939
5116
|
|
|
4940
5117
|
// src/components/TextAreaInput/TextAreaInput.tsx
|
|
4941
5118
|
var import_dedupe59 = __toESM(require("classnames/dedupe"));
|
|
4942
|
-
var
|
|
5119
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4943
5120
|
var TextAreaInput = ({ ref, ...props }) => {
|
|
4944
5121
|
const { isSelected, isDisabled, isReadOnly, isRequired, ...otherProps } = props;
|
|
4945
5122
|
const classes = (0, import_dedupe59.default)(
|
|
@@ -4952,7 +5129,7 @@ var TextAreaInput = ({ ref, ...props }) => {
|
|
|
4952
5129
|
},
|
|
4953
5130
|
otherProps.className
|
|
4954
5131
|
);
|
|
4955
|
-
return /* @__PURE__ */ (0,
|
|
5132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4956
5133
|
"textarea",
|
|
4957
5134
|
{
|
|
4958
5135
|
ref,
|
|
@@ -4967,7 +5144,7 @@ TextAreaInput.displayName = "TextAreaInput";
|
|
|
4967
5144
|
|
|
4968
5145
|
// src/components/TextArea/TextArea.tsx
|
|
4969
5146
|
var import_TextArea = require("@simplybusiness/mobius/src/components/TextArea/TextArea.css");
|
|
4970
|
-
var
|
|
5147
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4971
5148
|
var TextArea = ({ ref, ...props }) => {
|
|
4972
5149
|
const {
|
|
4973
5150
|
isDisabled,
|
|
@@ -4987,9 +5164,9 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
4987
5164
|
},
|
|
4988
5165
|
validationClasses
|
|
4989
5166
|
);
|
|
4990
|
-
return /* @__PURE__ */ (0,
|
|
4991
|
-
label && /* @__PURE__ */ (0,
|
|
4992
|
-
/* @__PURE__ */ (0,
|
|
5167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Stack, { className: classes, gap: "xs", children: [
|
|
5168
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Label, { ...labelProps, className: labelClasses, children: props.label }),
|
|
5169
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4993
5170
|
TextAreaInput,
|
|
4994
5171
|
{
|
|
4995
5172
|
...otherProps,
|
|
@@ -5000,7 +5177,7 @@ var TextArea = ({ ref, ...props }) => {
|
|
|
5000
5177
|
"aria-invalid": errorMessage != null
|
|
5001
5178
|
}
|
|
5002
5179
|
),
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5180
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorMessage, { ...errorMessageProps, errorMessage })
|
|
5004
5181
|
] });
|
|
5005
5182
|
};
|
|
5006
5183
|
TextArea.displayName = "TextArea";
|
|
@@ -5012,7 +5189,7 @@ init_TextOrHTML2();
|
|
|
5012
5189
|
// src/components/Title/Title.tsx
|
|
5013
5190
|
var import_dedupe61 = __toESM(require("classnames/dedupe"));
|
|
5014
5191
|
var import_Title = require("@simplybusiness/mobius/src/components/Title/Title.css");
|
|
5015
|
-
var
|
|
5192
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5016
5193
|
var Title = ({ ref, ...props }) => {
|
|
5017
5194
|
const {
|
|
5018
5195
|
elementType: Element = "div",
|
|
@@ -5024,9 +5201,9 @@ var Title = ({ ref, ...props }) => {
|
|
|
5024
5201
|
const headerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__header");
|
|
5025
5202
|
const contentClasses = (0, import_dedupe61.default)("mobius", "mobius-title__description");
|
|
5026
5203
|
const containerClasses = (0, import_dedupe61.default)("mobius", "mobius-title__container");
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5204
|
+
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: [
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: headerClasses, children: title }),
|
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: contentClasses, children: description })
|
|
5030
5207
|
] }) });
|
|
5031
5208
|
};
|
|
5032
5209
|
Title.displayName = "Title";
|
|
@@ -5044,7 +5221,7 @@ var toastState = {
|
|
|
5044
5221
|
|
|
5045
5222
|
// src/components/Toast/Toast.tsx
|
|
5046
5223
|
var import_Toast = require("@simplybusiness/mobius/src/components/Toast/Toast.css");
|
|
5047
|
-
var
|
|
5224
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
5048
5225
|
var variantIcons = {
|
|
5049
5226
|
info: import_icons14.circleInfo,
|
|
5050
5227
|
success: import_icons14.circleCheck,
|
|
@@ -5057,8 +5234,8 @@ var variantColors = {
|
|
|
5057
5234
|
warning: "var(--color-warning)",
|
|
5058
5235
|
error: "var(--color-error)"
|
|
5059
5236
|
};
|
|
5060
|
-
var ToastIcon = ({ variant }) => /* @__PURE__ */ (0,
|
|
5061
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
5237
|
+
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] }) });
|
|
5238
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "mobius-toast__close-icon", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { icon: import_icons14.cross }) });
|
|
5062
5239
|
var ToastContent = ({
|
|
5063
5240
|
toastId,
|
|
5064
5241
|
variant,
|
|
@@ -5067,15 +5244,15 @@ var ToastContent = ({
|
|
|
5067
5244
|
action,
|
|
5068
5245
|
cancel,
|
|
5069
5246
|
showCloseButton = toastState.showCloseButton
|
|
5070
|
-
}) => /* @__PURE__ */ (0,
|
|
5071
|
-
/* @__PURE__ */ (0,
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5073
|
-
/* @__PURE__ */ (0,
|
|
5074
|
-
title && /* @__PURE__ */ (0,
|
|
5075
|
-
description && /* @__PURE__ */ (0,
|
|
5247
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: (0, import_dedupe62.default)("mobius", "mobius-toast", `--${variant}`), children: [
|
|
5248
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ToastIcon, { variant }),
|
|
5249
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__body", children: [
|
|
5250
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__content", children: [
|
|
5251
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__title", children: title }),
|
|
5252
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mobius-toast__description", children: description })
|
|
5076
5253
|
] }),
|
|
5077
|
-
(action || cancel) && /* @__PURE__ */ (0,
|
|
5078
|
-
cancel && /* @__PURE__ */ (0,
|
|
5254
|
+
(action || cancel) && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mobius-toast__actions", children: [
|
|
5255
|
+
cancel && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5079
5256
|
"button",
|
|
5080
5257
|
{
|
|
5081
5258
|
type: "button",
|
|
@@ -5087,7 +5264,7 @@ var ToastContent = ({
|
|
|
5087
5264
|
children: cancel.label
|
|
5088
5265
|
}
|
|
5089
5266
|
),
|
|
5090
|
-
action && /* @__PURE__ */ (0,
|
|
5267
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5091
5268
|
"button",
|
|
5092
5269
|
{
|
|
5093
5270
|
type: "button",
|
|
@@ -5101,19 +5278,19 @@ var ToastContent = ({
|
|
|
5101
5278
|
)
|
|
5102
5279
|
] })
|
|
5103
5280
|
] }),
|
|
5104
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
5281
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5105
5282
|
"button",
|
|
5106
5283
|
{
|
|
5107
5284
|
type: "button",
|
|
5108
5285
|
className: "mobius-toast__close",
|
|
5109
5286
|
onClick: () => import_sonner.toast.dismiss(toastId),
|
|
5110
5287
|
"aria-label": "Close",
|
|
5111
|
-
children: /* @__PURE__ */ (0,
|
|
5288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(CloseIcon, {})
|
|
5112
5289
|
}
|
|
5113
5290
|
)
|
|
5114
5291
|
] });
|
|
5115
5292
|
var createCustomToast = (message, variant, options) => import_sonner.toast.custom(
|
|
5116
|
-
(id) => /* @__PURE__ */ (0,
|
|
5293
|
+
(id) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5117
5294
|
ToastContent,
|
|
5118
5295
|
{
|
|
5119
5296
|
toastId: id,
|
|
@@ -5145,9 +5322,9 @@ var toast = {
|
|
|
5145
5322
|
};
|
|
5146
5323
|
|
|
5147
5324
|
// src/components/Toast/Toaster.tsx
|
|
5148
|
-
var
|
|
5325
|
+
var import_react47 = require("react");
|
|
5149
5326
|
var import_sonner2 = require("sonner");
|
|
5150
|
-
var
|
|
5327
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5151
5328
|
var Toaster = ({
|
|
5152
5329
|
position = "top-right",
|
|
5153
5330
|
closeButton = true,
|
|
@@ -5156,10 +5333,10 @@ var Toaster = ({
|
|
|
5156
5333
|
visibleToasts = 3,
|
|
5157
5334
|
gap = 8
|
|
5158
5335
|
}) => {
|
|
5159
|
-
(0,
|
|
5336
|
+
(0, import_react47.useEffect)(() => {
|
|
5160
5337
|
toastState.showCloseButton = closeButton;
|
|
5161
5338
|
}, [closeButton]);
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
5339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5163
5340
|
import_sonner2.Toaster,
|
|
5164
5341
|
{
|
|
5165
5342
|
position,
|
|
@@ -5175,7 +5352,7 @@ Toaster.displayName = "Toaster";
|
|
|
5175
5352
|
|
|
5176
5353
|
// src/components/Trust/Trust.tsx
|
|
5177
5354
|
var import_dedupe63 = __toESM(require("classnames/dedupe"));
|
|
5178
|
-
var
|
|
5355
|
+
var import_react48 = require("react");
|
|
5179
5356
|
init_utils();
|
|
5180
5357
|
|
|
5181
5358
|
// src/components/Trust/constants.ts
|
|
@@ -5240,7 +5417,7 @@ var TRUSTPILOT_WIDGET = {
|
|
|
5240
5417
|
};
|
|
5241
5418
|
|
|
5242
5419
|
// src/components/Trust/Trust.tsx
|
|
5243
|
-
var
|
|
5420
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5244
5421
|
var Trust = ({ ref, ...props }) => {
|
|
5245
5422
|
const {
|
|
5246
5423
|
elementType: Element = "div",
|
|
@@ -5252,8 +5429,8 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5252
5429
|
stars,
|
|
5253
5430
|
className
|
|
5254
5431
|
} = props;
|
|
5255
|
-
const [isMounted, setIsMounted] = (0,
|
|
5256
|
-
const trustRef = (0,
|
|
5432
|
+
const [isMounted, setIsMounted] = (0, import_react48.useState)(false);
|
|
5433
|
+
const trustRef = (0, import_react48.useRef)(null);
|
|
5257
5434
|
const {
|
|
5258
5435
|
templateId,
|
|
5259
5436
|
className: variantClassName,
|
|
@@ -5280,24 +5457,24 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5280
5457
|
},
|
|
5281
5458
|
className
|
|
5282
5459
|
);
|
|
5283
|
-
(0,
|
|
5460
|
+
(0, import_react48.useEffect)(() => {
|
|
5284
5461
|
const hasTrustpilotLoaded = trustRef.current && window?.Trustpilot && window?.Trustpilot.loadFromElement;
|
|
5285
5462
|
if (isMounted && hasTrustpilotLoaded) {
|
|
5286
5463
|
window.Trustpilot.loadFromElement(trustRef.current, true);
|
|
5287
5464
|
}
|
|
5288
5465
|
}, [isMounted]);
|
|
5289
|
-
(0,
|
|
5466
|
+
(0, import_react48.useEffect)(() => {
|
|
5290
5467
|
setIsMounted(true);
|
|
5291
5468
|
}, []);
|
|
5292
|
-
if (!isMounted) return /* @__PURE__ */ (0,
|
|
5293
|
-
return /* @__PURE__ */ (0,
|
|
5469
|
+
if (!isMounted) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles });
|
|
5470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5294
5471
|
Element,
|
|
5295
5472
|
{
|
|
5296
5473
|
ref: mergeRefs([trustRef, ref]),
|
|
5297
5474
|
className: classes,
|
|
5298
5475
|
style: styles,
|
|
5299
5476
|
...dataProps,
|
|
5300
|
-
children: /* @__PURE__ */ (0,
|
|
5477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5301
5478
|
"a",
|
|
5302
5479
|
{
|
|
5303
5480
|
href: link,
|
|
@@ -5313,11 +5490,11 @@ var Trust = ({ ref, ...props }) => {
|
|
|
5313
5490
|
|
|
5314
5491
|
// src/components/ExpandableText/ExpandableText.tsx
|
|
5315
5492
|
var import_dedupe64 = __toESM(require("classnames/dedupe"));
|
|
5316
|
-
var
|
|
5493
|
+
var import_react49 = require("react");
|
|
5317
5494
|
init_hooks();
|
|
5318
5495
|
init_TextOrHTML2();
|
|
5319
5496
|
var import_ExpandableText = require("@simplybusiness/mobius/src/components/ExpandableText/ExpandableText.css");
|
|
5320
|
-
var
|
|
5497
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5321
5498
|
var ExpandableText = ({ ref, ...props }) => {
|
|
5322
5499
|
const {
|
|
5323
5500
|
text,
|
|
@@ -5331,14 +5508,14 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5331
5508
|
onToggle,
|
|
5332
5509
|
...otherProps
|
|
5333
5510
|
} = props;
|
|
5334
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
5335
|
-
const [isCollapsed, setIsCollapsed] = (0,
|
|
5336
|
-
const textRef = (0,
|
|
5511
|
+
const [isExpanded, setIsExpanded] = (0, import_react49.useState)(false);
|
|
5512
|
+
const [isCollapsed, setIsCollapsed] = (0, import_react49.useState)(false);
|
|
5513
|
+
const textRef = (0, import_react49.useRef)(null);
|
|
5337
5514
|
const { down } = useBreakpoint();
|
|
5338
|
-
const baseId = (0,
|
|
5515
|
+
const baseId = (0, import_react49.useId)();
|
|
5339
5516
|
const expandButtonId = `expandable-text-expand-${baseId}`;
|
|
5340
5517
|
const shouldCollapse = breakpoint ? down(breakpoint) : true;
|
|
5341
|
-
(0,
|
|
5518
|
+
(0, import_react49.useEffect)(() => {
|
|
5342
5519
|
if (!shouldCollapse || !textRef.current) {
|
|
5343
5520
|
setIsCollapsed(false);
|
|
5344
5521
|
return;
|
|
@@ -5348,7 +5525,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5348
5525
|
setIsCollapsed(isOverflowing);
|
|
5349
5526
|
}, [text, shouldCollapse, maxLines]);
|
|
5350
5527
|
if (breakpoint && !shouldCollapse) {
|
|
5351
|
-
return /* @__PURE__ */ (0,
|
|
5528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ref, className, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { text, textWrapper: true, ...textProps }) });
|
|
5352
5529
|
}
|
|
5353
5530
|
const handleAccordionChange = (expanded) => {
|
|
5354
5531
|
setIsExpanded(expanded);
|
|
@@ -5361,7 +5538,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5361
5538
|
const textContainerStyle = {
|
|
5362
5539
|
"--line-clamp": maxLines
|
|
5363
5540
|
};
|
|
5364
|
-
return /* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
5365
5542
|
"div",
|
|
5366
5543
|
{
|
|
5367
5544
|
ref,
|
|
@@ -5369,7 +5546,7 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5369
5546
|
"data-testid": "expandable-text",
|
|
5370
5547
|
...otherProps,
|
|
5371
5548
|
children: [
|
|
5372
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5373
5550
|
"div",
|
|
5374
5551
|
{
|
|
5375
5552
|
ref: textRef,
|
|
@@ -5377,10 +5554,10 @@ var ExpandableText = ({ ref, ...props }) => {
|
|
|
5377
5554
|
style: textContainerStyle,
|
|
5378
5555
|
"data-testid": "expandable-text-content",
|
|
5379
5556
|
"aria-describedby": isCollapsed ? expandButtonId : void 0,
|
|
5380
|
-
children: /* @__PURE__ */ (0,
|
|
5557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TextOrHTML, { elementType: "span", textWrapper: true, text, ...textProps })
|
|
5381
5558
|
}
|
|
5382
5559
|
),
|
|
5383
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
5560
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5384
5561
|
Accordion,
|
|
5385
5562
|
{
|
|
5386
5563
|
showText,
|
|
@@ -5403,7 +5580,7 @@ ExpandableText.displayName = "ExpandableText";
|
|
|
5403
5580
|
// src/components/MaskedField/index.tsx
|
|
5404
5581
|
var import_component = __toESM(require("@loadable/component"));
|
|
5405
5582
|
init_TextField2();
|
|
5406
|
-
var
|
|
5583
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5407
5584
|
var LoadableMaskedField = (0, import_component.default)(() => Promise.resolve().then(() => (init_MaskedField(), MaskedField_exports)), {
|
|
5408
5585
|
resolveComponent: (mod) => mod.MaskedField
|
|
5409
5586
|
});
|
|
@@ -5415,11 +5592,11 @@ function MaskedField2(props) {
|
|
|
5415
5592
|
ref: forwardedRef,
|
|
5416
5593
|
...textFieldProps
|
|
5417
5594
|
} = props;
|
|
5418
|
-
return /* @__PURE__ */ (0,
|
|
5595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5419
5596
|
LoadableMaskedField,
|
|
5420
5597
|
{
|
|
5421
5598
|
...props,
|
|
5422
|
-
fallback: /* @__PURE__ */ (0,
|
|
5599
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5423
5600
|
TextField,
|
|
5424
5601
|
{
|
|
5425
5602
|
...textFieldProps,
|