@marigold/components 1.0.0-beta.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +76 -41
- package/dist/index.js +537 -350
- package/dist/index.mjs +513 -320
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -344,7 +344,6 @@ var IndeterminateMark = () => /* @__PURE__ */ React10.createElement("svg", {
|
|
|
344
344
|
}));
|
|
345
345
|
var Icon = (_a) => {
|
|
346
346
|
var _b = _a, { css, checked, indeterminate } = _b, props = __objRest(_b, ["css", "checked", "indeterminate"]);
|
|
347
|
-
const icon = indeterminate ? /* @__PURE__ */ React10.createElement(IndeterminateMark, null) : /* @__PURE__ */ React10.createElement(CheckMark, null);
|
|
348
347
|
return /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
|
|
349
348
|
"aria-hidden": "true",
|
|
350
349
|
__baseCSS: {
|
|
@@ -359,7 +358,7 @@ var Icon = (_a) => {
|
|
|
359
358
|
p: 1
|
|
360
359
|
},
|
|
361
360
|
css
|
|
362
|
-
}, props), checked ?
|
|
361
|
+
}, props), indeterminate ? /* @__PURE__ */ React10.createElement(IndeterminateMark, null) : checked ? /* @__PURE__ */ React10.createElement(CheckMark, null) : null);
|
|
363
362
|
};
|
|
364
363
|
var Checkbox = (_a) => {
|
|
365
364
|
var _b = _a, {
|
|
@@ -439,7 +438,7 @@ var Checkbox = (_a) => {
|
|
|
439
438
|
checked: inputProps.checked,
|
|
440
439
|
indeterminate,
|
|
441
440
|
css: styles.checkbox
|
|
442
|
-
}, stateProps)), /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
|
|
441
|
+
}, stateProps)), props.children && /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
|
|
443
442
|
css: styles.label
|
|
444
443
|
}, stateProps), props.children));
|
|
445
444
|
};
|
|
@@ -821,12 +820,12 @@ Dialog.Trigger = DialogTrigger;
|
|
|
821
820
|
// src/Divider/Divider.tsx
|
|
822
821
|
import React22 from "react";
|
|
823
822
|
import { useSeparator } from "@react-aria/separator";
|
|
824
|
-
import { useComponentStyles as useComponentStyles12 } from "@marigold/system";
|
|
823
|
+
import { Box as Box11, useComponentStyles as useComponentStyles12 } from "@marigold/system";
|
|
825
824
|
var Divider = (_a) => {
|
|
826
825
|
var _b = _a, { variant } = _b, props = __objRest(_b, ["variant"]);
|
|
827
826
|
const { separatorProps } = useSeparator(props);
|
|
828
827
|
const styles = useComponentStyles12("Divider", { variant });
|
|
829
|
-
return /* @__PURE__ */ React22.createElement(
|
|
828
|
+
return /* @__PURE__ */ React22.createElement(Box11, __spreadValues(__spreadValues({
|
|
830
829
|
css: styles
|
|
831
830
|
}, props), separatorProps));
|
|
832
831
|
};
|
|
@@ -860,7 +859,12 @@ var Image = (_a) => {
|
|
|
860
859
|
|
|
861
860
|
// src/Inline/Inline.tsx
|
|
862
861
|
import React25 from "react";
|
|
863
|
-
var
|
|
862
|
+
var ALIGNMENT_X = {
|
|
863
|
+
left: "flex-start",
|
|
864
|
+
center: "center",
|
|
865
|
+
right: "flex-end"
|
|
866
|
+
};
|
|
867
|
+
var ALIGNMENT_Y = {
|
|
864
868
|
top: "flex-start",
|
|
865
869
|
center: "center",
|
|
866
870
|
bottom: "flex-end"
|
|
@@ -868,27 +872,33 @@ var ALIGNMENT2 = {
|
|
|
868
872
|
var Inline = (_a) => {
|
|
869
873
|
var _b = _a, {
|
|
870
874
|
space = "none",
|
|
871
|
-
|
|
875
|
+
alignX = "left",
|
|
876
|
+
alignY = "center",
|
|
872
877
|
children
|
|
873
878
|
} = _b, props = __objRest(_b, [
|
|
874
879
|
"space",
|
|
875
|
-
"
|
|
880
|
+
"alignX",
|
|
881
|
+
"alignY",
|
|
876
882
|
"children"
|
|
877
883
|
]);
|
|
878
884
|
return /* @__PURE__ */ React25.createElement(Box, __spreadValues({
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
885
|
+
css: {
|
|
886
|
+
display: "flex",
|
|
887
|
+
flexWrap: "wrap",
|
|
888
|
+
gap: space,
|
|
889
|
+
alignItems: ALIGNMENT_Y[alignY],
|
|
890
|
+
justifyContent: ALIGNMENT_X[alignX]
|
|
891
|
+
}
|
|
882
892
|
}, props), children);
|
|
883
893
|
};
|
|
884
894
|
|
|
885
895
|
// src/Input/Input.tsx
|
|
886
896
|
import React26, { forwardRef as forwardRef4 } from "react";
|
|
887
|
-
import { Box as
|
|
897
|
+
import { Box as Box12, useComponentStyles as useComponentStyles15 } from "@marigold/system";
|
|
888
898
|
var Input = forwardRef4((_a, ref) => {
|
|
889
899
|
var _b = _a, { variant, size, type = "text" } = _b, props = __objRest(_b, ["variant", "size", "type"]);
|
|
890
900
|
const styles = useComponentStyles15("Input", { variant, size });
|
|
891
|
-
return /* @__PURE__ */ React26.createElement(
|
|
901
|
+
return /* @__PURE__ */ React26.createElement(Box12, __spreadProps(__spreadValues({}, props), {
|
|
892
902
|
ref,
|
|
893
903
|
as: "input",
|
|
894
904
|
type,
|
|
@@ -935,7 +945,7 @@ import { DismissButton } from "@react-aria/overlays";
|
|
|
935
945
|
import { Item } from "@react-stately/collections";
|
|
936
946
|
import { useTreeState } from "@react-stately/tree";
|
|
937
947
|
import {
|
|
938
|
-
Box as
|
|
948
|
+
Box as Box14,
|
|
939
949
|
useComponentStyles as useComponentStyles17
|
|
940
950
|
} from "@marigold/system";
|
|
941
951
|
|
|
@@ -986,7 +996,7 @@ import React29, { useRef as useRef7 } from "react";
|
|
|
986
996
|
import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
|
|
987
997
|
import { useMenuItem } from "@react-aria/menu";
|
|
988
998
|
import { mergeProps as mergeProps4 } from "@react-aria/utils";
|
|
989
|
-
import { Box as
|
|
999
|
+
import { Box as Box13, useStateProps as useStateProps3 } from "@marigold/system";
|
|
990
1000
|
var MenuItem = ({ item, state, onAction, css }) => {
|
|
991
1001
|
const ref = useRef7(null);
|
|
992
1002
|
const { onClose } = useMenuContext();
|
|
@@ -999,7 +1009,7 @@ var MenuItem = ({ item, state, onAction, css }) => {
|
|
|
999
1009
|
const stateProps = useStateProps3({
|
|
1000
1010
|
focus: isFocusVisible
|
|
1001
1011
|
});
|
|
1002
|
-
return /* @__PURE__ */ React29.createElement(
|
|
1012
|
+
return /* @__PURE__ */ React29.createElement(Box13, __spreadValues(__spreadValues({
|
|
1003
1013
|
as: "li",
|
|
1004
1014
|
ref,
|
|
1005
1015
|
__baseCSS: {
|
|
@@ -1024,7 +1034,7 @@ var Menu = (_a) => {
|
|
|
1024
1034
|
restoreFocus: true
|
|
1025
1035
|
}, /* @__PURE__ */ React30.createElement("div", null, /* @__PURE__ */ React30.createElement(DismissButton, {
|
|
1026
1036
|
onDismiss: ownProps.onClose
|
|
1027
|
-
}), /* @__PURE__ */ React30.createElement(
|
|
1037
|
+
}), /* @__PURE__ */ React30.createElement(Box14, __spreadValues({
|
|
1028
1038
|
as: "ul",
|
|
1029
1039
|
ref,
|
|
1030
1040
|
style: { width: triggerWidth },
|
|
@@ -1097,20 +1107,20 @@ import { useNumberField } from "@react-aria/numberfield";
|
|
|
1097
1107
|
import { mergeProps as mergeProps6, useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
1098
1108
|
import { useNumberFieldState } from "@react-stately/numberfield";
|
|
1099
1109
|
import {
|
|
1100
|
-
Box as
|
|
1110
|
+
Box as Box18,
|
|
1101
1111
|
useComponentStyles as useComponentStyles20,
|
|
1102
1112
|
useStateProps as useStateProps5
|
|
1103
1113
|
} from "@marigold/system";
|
|
1104
1114
|
|
|
1105
1115
|
// src/FieldBase/FieldBase.tsx
|
|
1106
1116
|
import React33 from "react";
|
|
1107
|
-
import { Box as
|
|
1117
|
+
import { Box as Box16 } from "@marigold/system";
|
|
1108
1118
|
|
|
1109
1119
|
// src/HelpText/HelpText.tsx
|
|
1110
1120
|
import React32 from "react";
|
|
1111
1121
|
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
1112
1122
|
import {
|
|
1113
|
-
Box as
|
|
1123
|
+
Box as Box15,
|
|
1114
1124
|
useComponentStyles as useComponentStyles19
|
|
1115
1125
|
} from "@marigold/system";
|
|
1116
1126
|
var HelpText = (_a) => {
|
|
@@ -1136,7 +1146,7 @@ var HelpText = (_a) => {
|
|
|
1136
1146
|
var _a2;
|
|
1137
1147
|
const hasErrorMessage = errorMessage && error;
|
|
1138
1148
|
const styles = useComponentStyles19("HelpText", { variant, size }, { parts: ["container", "icon"] });
|
|
1139
|
-
return /* @__PURE__ */ React32.createElement(
|
|
1149
|
+
return /* @__PURE__ */ React32.createElement(Box15, __spreadProps(__spreadValues(__spreadValues({}, hasErrorMessage ? errorMessageProps : descriptionProps), props), {
|
|
1140
1150
|
__baseCSS: { display: "flex", alignItems: "center", gap: 4 },
|
|
1141
1151
|
css: styles.container
|
|
1142
1152
|
}), hasErrorMessage ? /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Exclamation2, {
|
|
@@ -1147,9 +1157,10 @@ var HelpText = (_a) => {
|
|
|
1147
1157
|
|
|
1148
1158
|
// src/FieldBase/FieldBase.tsx
|
|
1149
1159
|
var FieldBase = ({
|
|
1160
|
+
children,
|
|
1150
1161
|
variant,
|
|
1151
1162
|
size,
|
|
1152
|
-
|
|
1163
|
+
width = "100%",
|
|
1153
1164
|
disabled,
|
|
1154
1165
|
required,
|
|
1155
1166
|
label,
|
|
@@ -1162,8 +1173,8 @@ var FieldBase = ({
|
|
|
1162
1173
|
stateProps
|
|
1163
1174
|
}) => {
|
|
1164
1175
|
const hasHelpText = !!description || errorMessage && error;
|
|
1165
|
-
return /* @__PURE__ */ React33.createElement(
|
|
1166
|
-
css: { display: "flex", flexDirection: "column", width
|
|
1176
|
+
return /* @__PURE__ */ React33.createElement(Box16, {
|
|
1177
|
+
css: { display: "flex", flexDirection: "column", width }
|
|
1167
1178
|
}, label && /* @__PURE__ */ React33.createElement(Label, __spreadValues(__spreadValues({
|
|
1168
1179
|
required,
|
|
1169
1180
|
variant,
|
|
@@ -1185,8 +1196,8 @@ import React34, { useRef as useRef9 } from "react";
|
|
|
1185
1196
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
1186
1197
|
import { useHover as useHover2 } from "@react-aria/interactions";
|
|
1187
1198
|
import { mergeProps as mergeProps5 } from "@react-aria/utils";
|
|
1188
|
-
import { Box as
|
|
1189
|
-
var Plus = () => /* @__PURE__ */ React34.createElement(
|
|
1199
|
+
import { Box as Box17, useStateProps as useStateProps4 } from "@marigold/system";
|
|
1200
|
+
var Plus = () => /* @__PURE__ */ React34.createElement(Box17, {
|
|
1190
1201
|
as: "svg",
|
|
1191
1202
|
__baseCSS: { width: 16, height: 16 },
|
|
1192
1203
|
viewBox: "0 0 20 20",
|
|
@@ -1196,7 +1207,7 @@ var Plus = () => /* @__PURE__ */ React34.createElement(Box16, {
|
|
|
1196
1207
|
clipRule: "evenodd",
|
|
1197
1208
|
d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"
|
|
1198
1209
|
}));
|
|
1199
|
-
var Minus = () => /* @__PURE__ */ React34.createElement(
|
|
1210
|
+
var Minus = () => /* @__PURE__ */ React34.createElement(Box17, {
|
|
1200
1211
|
as: "svg",
|
|
1201
1212
|
__baseCSS: { width: 16, height: 16 },
|
|
1202
1213
|
viewBox: "0 0 20 20",
|
|
@@ -1217,7 +1228,7 @@ var StepButton = (_a) => {
|
|
|
1217
1228
|
disabled: props.isDisabled
|
|
1218
1229
|
});
|
|
1219
1230
|
const Icon3 = direction === "up" ? Plus : Minus;
|
|
1220
|
-
return /* @__PURE__ */ React34.createElement(
|
|
1231
|
+
return /* @__PURE__ */ React34.createElement(Box17, __spreadValues(__spreadValues({
|
|
1221
1232
|
__baseCSS: {
|
|
1222
1233
|
display: "flex",
|
|
1223
1234
|
alignItems: "center",
|
|
@@ -1231,20 +1242,22 @@ var StepButton = (_a) => {
|
|
|
1231
1242
|
// src/NumberField/NumberField.tsx
|
|
1232
1243
|
var NumberField = forwardRef5((_a, ref) => {
|
|
1233
1244
|
var _b = _a, {
|
|
1245
|
+
variant,
|
|
1246
|
+
size,
|
|
1247
|
+
width,
|
|
1234
1248
|
disabled,
|
|
1235
1249
|
required,
|
|
1236
1250
|
readOnly,
|
|
1237
1251
|
error,
|
|
1238
|
-
variant,
|
|
1239
|
-
size,
|
|
1240
1252
|
hideStepper
|
|
1241
1253
|
} = _b, rest = __objRest(_b, [
|
|
1254
|
+
"variant",
|
|
1255
|
+
"size",
|
|
1256
|
+
"width",
|
|
1242
1257
|
"disabled",
|
|
1243
1258
|
"required",
|
|
1244
1259
|
"readOnly",
|
|
1245
1260
|
"error",
|
|
1246
|
-
"variant",
|
|
1247
|
-
"size",
|
|
1248
1261
|
"hideStepper"
|
|
1249
1262
|
]);
|
|
1250
1263
|
const props = __spreadValues({
|
|
@@ -1291,8 +1304,9 @@ var NumberField = forwardRef5((_a, ref) => {
|
|
|
1291
1304
|
errorMessageProps,
|
|
1292
1305
|
stateProps,
|
|
1293
1306
|
variant,
|
|
1294
|
-
size
|
|
1295
|
-
|
|
1307
|
+
size,
|
|
1308
|
+
width
|
|
1309
|
+
}, /* @__PURE__ */ React35.createElement(Box18, __spreadValues(__spreadValues({
|
|
1296
1310
|
"data-group": true,
|
|
1297
1311
|
__baseCSS: {
|
|
1298
1312
|
display: "flex",
|
|
@@ -1341,29 +1355,35 @@ function MarigoldProvider({
|
|
|
1341
1355
|
|
|
1342
1356
|
// src/Radio/Radio.tsx
|
|
1343
1357
|
import React38, { useRef as useRef10 } from "react";
|
|
1358
|
+
import { useHover as useHover4 } from "@react-aria/interactions";
|
|
1359
|
+
import { useFocusRing as useFocusRing5 } from "@react-aria/focus";
|
|
1344
1360
|
import { useRadio } from "@react-aria/radio";
|
|
1345
1361
|
import {
|
|
1346
|
-
Box as
|
|
1362
|
+
Box as Box20,
|
|
1347
1363
|
useComponentStyles as useComponentStyles22,
|
|
1348
1364
|
useStateProps as useStateProps6
|
|
1349
1365
|
} from "@marigold/system";
|
|
1350
1366
|
|
|
1367
|
+
// src/Radio/Context.ts
|
|
1368
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1369
|
+
var RadioGroupContext = createContext4(null);
|
|
1370
|
+
var useRadioGroupContext = () => useContext4(RadioGroupContext);
|
|
1371
|
+
|
|
1351
1372
|
// src/Radio/RadioGroup.tsx
|
|
1352
|
-
import React37
|
|
1373
|
+
import React37 from "react";
|
|
1353
1374
|
import { useRadioGroup } from "@react-aria/radio";
|
|
1354
1375
|
import { useRadioGroupState } from "@react-stately/radio";
|
|
1355
1376
|
import {
|
|
1356
|
-
Box as
|
|
1377
|
+
Box as Box19,
|
|
1357
1378
|
useComponentStyles as useComponentStyles21
|
|
1358
1379
|
} from "@marigold/system";
|
|
1359
|
-
var RadioGroupContext = React37.createContext(null);
|
|
1360
|
-
var useRadioGroupContext = () => useContext4(RadioGroupContext);
|
|
1361
1380
|
var RadioGroup = (_a) => {
|
|
1362
1381
|
var _b = _a, {
|
|
1363
1382
|
children,
|
|
1364
1383
|
orientation = "vertical",
|
|
1365
1384
|
size,
|
|
1366
1385
|
variant,
|
|
1386
|
+
width,
|
|
1367
1387
|
required,
|
|
1368
1388
|
disabled,
|
|
1369
1389
|
readOnly,
|
|
@@ -1373,6 +1393,7 @@ var RadioGroup = (_a) => {
|
|
|
1373
1393
|
"orientation",
|
|
1374
1394
|
"size",
|
|
1375
1395
|
"variant",
|
|
1396
|
+
"width",
|
|
1376
1397
|
"required",
|
|
1377
1398
|
"disabled",
|
|
1378
1399
|
"readOnly",
|
|
@@ -1387,12 +1408,12 @@ var RadioGroup = (_a) => {
|
|
|
1387
1408
|
const state = useRadioGroupState(props);
|
|
1388
1409
|
const { radioGroupProps, labelProps } = useRadioGroup(props, state);
|
|
1389
1410
|
const styles = useComponentStyles21("RadioGroup", { variant, size }, { parts: ["container", "group"] });
|
|
1390
|
-
return /* @__PURE__ */ React37.createElement(
|
|
1411
|
+
return /* @__PURE__ */ React37.createElement(Box19, __spreadProps(__spreadValues({}, radioGroupProps), {
|
|
1391
1412
|
css: styles.container
|
|
1392
1413
|
}), props.label && /* @__PURE__ */ React37.createElement(Label, __spreadValues({
|
|
1393
1414
|
as: "span",
|
|
1394
1415
|
required
|
|
1395
|
-
}, labelProps), props.label), /* @__PURE__ */ React37.createElement(
|
|
1416
|
+
}, labelProps), props.label), /* @__PURE__ */ React37.createElement(Box19, {
|
|
1396
1417
|
role: "presentation",
|
|
1397
1418
|
"data-orientation": orientation,
|
|
1398
1419
|
__baseCSS: {
|
|
@@ -1403,13 +1424,11 @@ var RadioGroup = (_a) => {
|
|
|
1403
1424
|
},
|
|
1404
1425
|
css: styles.group
|
|
1405
1426
|
}, /* @__PURE__ */ React37.createElement(RadioGroupContext.Provider, {
|
|
1406
|
-
value: __spreadValues({ variant, size, error }, state)
|
|
1427
|
+
value: __spreadValues({ variant, size, width, error }, state)
|
|
1407
1428
|
}, children)));
|
|
1408
1429
|
};
|
|
1409
1430
|
|
|
1410
1431
|
// src/Radio/Radio.tsx
|
|
1411
|
-
import { useHover as useHover4 } from "@react-aria/interactions";
|
|
1412
|
-
import { useFocusRing as useFocusRing5 } from "@react-aria/focus";
|
|
1413
1432
|
var Dot = () => /* @__PURE__ */ React38.createElement("svg", {
|
|
1414
1433
|
viewBox: "0 0 6 6"
|
|
1415
1434
|
}, /* @__PURE__ */ React38.createElement("circle", {
|
|
@@ -1420,7 +1439,7 @@ var Dot = () => /* @__PURE__ */ React38.createElement("svg", {
|
|
|
1420
1439
|
}));
|
|
1421
1440
|
var Icon2 = (_a) => {
|
|
1422
1441
|
var _b = _a, { checked, css } = _b, props = __objRest(_b, ["checked", "css"]);
|
|
1423
|
-
return /* @__PURE__ */ React38.createElement(
|
|
1442
|
+
return /* @__PURE__ */ React38.createElement(Box20, __spreadValues({
|
|
1424
1443
|
"aria-hidden": "true",
|
|
1425
1444
|
__baseCSS: {
|
|
1426
1445
|
width: 16,
|
|
@@ -1437,8 +1456,18 @@ var Icon2 = (_a) => {
|
|
|
1437
1456
|
}, props), checked ? /* @__PURE__ */ React38.createElement(Dot, null) : null);
|
|
1438
1457
|
};
|
|
1439
1458
|
var Radio = (_a) => {
|
|
1440
|
-
var _b = _a, { disabled } = _b, props = __objRest(_b, ["disabled"]);
|
|
1441
|
-
const _a2 = useRadioGroupContext(), {
|
|
1459
|
+
var _b = _a, { width, disabled } = _b, props = __objRest(_b, ["width", "disabled"]);
|
|
1460
|
+
const _a2 = useRadioGroupContext(), {
|
|
1461
|
+
variant,
|
|
1462
|
+
size,
|
|
1463
|
+
error,
|
|
1464
|
+
width: groupWidth
|
|
1465
|
+
} = _a2, state = __objRest(_a2, [
|
|
1466
|
+
"variant",
|
|
1467
|
+
"size",
|
|
1468
|
+
"error",
|
|
1469
|
+
"width"
|
|
1470
|
+
]);
|
|
1442
1471
|
const ref = useRef10(null);
|
|
1443
1472
|
const { inputProps } = useRadio(__spreadValues({ isDisabled: disabled }, props), state, ref);
|
|
1444
1473
|
const styles = useComponentStyles22("Radio", { variant: variant || props.variant, size: size || props.size }, { parts: ["container", "label", "radio"] });
|
|
@@ -1452,16 +1481,17 @@ var Radio = (_a) => {
|
|
|
1452
1481
|
readOnly: props.readOnly,
|
|
1453
1482
|
error
|
|
1454
1483
|
});
|
|
1455
|
-
return /* @__PURE__ */ React38.createElement(
|
|
1484
|
+
return /* @__PURE__ */ React38.createElement(Box20, __spreadValues(__spreadValues({
|
|
1456
1485
|
as: "label",
|
|
1457
1486
|
__baseCSS: {
|
|
1458
1487
|
display: "flex",
|
|
1459
1488
|
alignItems: "center",
|
|
1460
1489
|
gap: "1ch",
|
|
1461
|
-
position: "relative"
|
|
1490
|
+
position: "relative",
|
|
1491
|
+
width: width || groupWidth || "100%"
|
|
1462
1492
|
},
|
|
1463
1493
|
css: styles.container
|
|
1464
|
-
}, hoverProps), stateProps), /* @__PURE__ */ React38.createElement(
|
|
1494
|
+
}, hoverProps), stateProps), /* @__PURE__ */ React38.createElement(Box20, __spreadValues(__spreadValues({
|
|
1465
1495
|
as: "input",
|
|
1466
1496
|
ref,
|
|
1467
1497
|
css: {
|
|
@@ -1477,7 +1507,7 @@ var Radio = (_a) => {
|
|
|
1477
1507
|
}, inputProps), focusProps)), /* @__PURE__ */ React38.createElement(Icon2, __spreadValues({
|
|
1478
1508
|
checked: inputProps.checked,
|
|
1479
1509
|
css: styles.radio
|
|
1480
|
-
}, stateProps)), /* @__PURE__ */ React38.createElement(
|
|
1510
|
+
}, stateProps)), /* @__PURE__ */ React38.createElement(Box20, __spreadValues({
|
|
1481
1511
|
css: styles.label
|
|
1482
1512
|
}, stateProps), props.children));
|
|
1483
1513
|
};
|
|
@@ -1494,7 +1524,7 @@ import { useSelectState } from "@react-stately/select";
|
|
|
1494
1524
|
import { Item as Item2, Section } from "@react-stately/collections";
|
|
1495
1525
|
import { mergeProps as mergeProps7 } from "@react-aria/utils";
|
|
1496
1526
|
import {
|
|
1497
|
-
Box as
|
|
1527
|
+
Box as Box24,
|
|
1498
1528
|
useComponentStyles as useComponentStyles24,
|
|
1499
1529
|
useStateProps as useStateProps8
|
|
1500
1530
|
} from "@marigold/system";
|
|
@@ -1503,25 +1533,25 @@ import {
|
|
|
1503
1533
|
import React41, { forwardRef as forwardRef6 } from "react";
|
|
1504
1534
|
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
1505
1535
|
import {
|
|
1506
|
-
Box as
|
|
1536
|
+
Box as Box23,
|
|
1507
1537
|
useComponentStyles as useComponentStyles23
|
|
1508
1538
|
} from "@marigold/system";
|
|
1509
1539
|
import { useListBox } from "@react-aria/listbox";
|
|
1510
1540
|
|
|
1511
1541
|
// src/ListBox/Context.ts
|
|
1512
|
-
import { createContext as
|
|
1513
|
-
var ListBoxContext =
|
|
1542
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1543
|
+
var ListBoxContext = createContext5({});
|
|
1514
1544
|
var useListBoxContext = () => useContext5(ListBoxContext);
|
|
1515
1545
|
|
|
1516
1546
|
// src/ListBox/ListBoxSection.tsx
|
|
1517
1547
|
import React40 from "react";
|
|
1518
1548
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1519
|
-
import { Box as
|
|
1549
|
+
import { Box as Box22 } from "@marigold/system";
|
|
1520
1550
|
|
|
1521
1551
|
// src/ListBox/ListBoxOption.tsx
|
|
1522
1552
|
import React39, { useRef as useRef11 } from "react";
|
|
1523
1553
|
import { useOption } from "@react-aria/listbox";
|
|
1524
|
-
import { Box as
|
|
1554
|
+
import { Box as Box21, useStateProps as useStateProps7 } from "@marigold/system";
|
|
1525
1555
|
var ListBoxOption = ({ item, state }) => {
|
|
1526
1556
|
const ref = useRef11(null);
|
|
1527
1557
|
const { optionProps, isSelected, isDisabled, isFocused } = useOption({
|
|
@@ -1533,7 +1563,7 @@ var ListBoxOption = ({ item, state }) => {
|
|
|
1533
1563
|
disabled: isDisabled,
|
|
1534
1564
|
focusVisible: isFocused
|
|
1535
1565
|
});
|
|
1536
|
-
return /* @__PURE__ */ React39.createElement(
|
|
1566
|
+
return /* @__PURE__ */ React39.createElement(Box21, __spreadValues(__spreadValues({
|
|
1537
1567
|
as: "li",
|
|
1538
1568
|
ref,
|
|
1539
1569
|
css: styles.option
|
|
@@ -1547,12 +1577,12 @@ var ListBoxSection = ({ section, state }) => {
|
|
|
1547
1577
|
"aria-label": section["aria-label"]
|
|
1548
1578
|
});
|
|
1549
1579
|
const { styles } = useListBoxContext();
|
|
1550
|
-
return /* @__PURE__ */ React40.createElement(
|
|
1580
|
+
return /* @__PURE__ */ React40.createElement(Box22, __spreadValues({
|
|
1551
1581
|
as: "li",
|
|
1552
1582
|
css: styles.section
|
|
1553
|
-
}, itemProps), section.rendered && /* @__PURE__ */ React40.createElement(
|
|
1583
|
+
}, itemProps), section.rendered && /* @__PURE__ */ React40.createElement(Box22, __spreadValues({
|
|
1554
1584
|
css: styles.sectionTitle
|
|
1555
|
-
}, headingProps), section.rendered), /* @__PURE__ */ React40.createElement(
|
|
1585
|
+
}, headingProps), section.rendered), /* @__PURE__ */ React40.createElement(Box22, __spreadValues({
|
|
1556
1586
|
as: "ul",
|
|
1557
1587
|
__baseCSS: { listStyle: "none", p: 0 },
|
|
1558
1588
|
css: styles.list
|
|
@@ -1571,9 +1601,9 @@ var ListBox = forwardRef6((_a, ref) => {
|
|
|
1571
1601
|
const styles = useComponentStyles23("ListBox", { variant, size }, { parts: ["container", "list", "option", "section", "sectionTitle"] });
|
|
1572
1602
|
return /* @__PURE__ */ React41.createElement(ListBoxContext.Provider, {
|
|
1573
1603
|
value: { styles }
|
|
1574
|
-
}, /* @__PURE__ */ React41.createElement(
|
|
1604
|
+
}, /* @__PURE__ */ React41.createElement(Box23, {
|
|
1575
1605
|
css: styles.container
|
|
1576
|
-
}, /* @__PURE__ */ React41.createElement(
|
|
1606
|
+
}, /* @__PURE__ */ React41.createElement(Box23, __spreadValues({
|
|
1577
1607
|
as: "ul",
|
|
1578
1608
|
ref: innerRef,
|
|
1579
1609
|
__baseCSS: { listStyle: "none", p: 0 },
|
|
@@ -1600,7 +1630,7 @@ var messages = {
|
|
|
1600
1630
|
};
|
|
1601
1631
|
|
|
1602
1632
|
// src/Select/Select.tsx
|
|
1603
|
-
var Chevron = ({ css }) => /* @__PURE__ */ React42.createElement(
|
|
1633
|
+
var Chevron = ({ css }) => /* @__PURE__ */ React42.createElement(Box24, {
|
|
1604
1634
|
as: "svg",
|
|
1605
1635
|
__baseCSS: { width: 16, height: 16 },
|
|
1606
1636
|
css,
|
|
@@ -1615,21 +1645,21 @@ var Chevron = ({ css }) => /* @__PURE__ */ React42.createElement(Box23, {
|
|
|
1615
1645
|
}));
|
|
1616
1646
|
var Select = (_a) => {
|
|
1617
1647
|
var _b = _a, {
|
|
1648
|
+
variant,
|
|
1649
|
+
size,
|
|
1650
|
+
width,
|
|
1618
1651
|
open,
|
|
1619
1652
|
disabled,
|
|
1620
1653
|
required,
|
|
1621
|
-
error
|
|
1622
|
-
variant,
|
|
1623
|
-
size,
|
|
1624
|
-
css
|
|
1654
|
+
error
|
|
1625
1655
|
} = _b, rest = __objRest(_b, [
|
|
1656
|
+
"variant",
|
|
1657
|
+
"size",
|
|
1658
|
+
"width",
|
|
1626
1659
|
"open",
|
|
1627
1660
|
"disabled",
|
|
1628
1661
|
"required",
|
|
1629
|
-
"error"
|
|
1630
|
-
"variant",
|
|
1631
|
-
"size",
|
|
1632
|
-
"css"
|
|
1662
|
+
"error"
|
|
1633
1663
|
]);
|
|
1634
1664
|
const formatMessage = useMessageFormatter(messages);
|
|
1635
1665
|
const props = __spreadValues({
|
|
@@ -1668,6 +1698,7 @@ var Select = (_a) => {
|
|
|
1668
1698
|
return /* @__PURE__ */ React42.createElement(FieldBase, {
|
|
1669
1699
|
variant,
|
|
1670
1700
|
size,
|
|
1701
|
+
width,
|
|
1671
1702
|
label: props.label,
|
|
1672
1703
|
labelProps: __spreadValues({ as: "span" }, labelProps),
|
|
1673
1704
|
description: props.description,
|
|
@@ -1684,7 +1715,7 @@ var Select = (_a) => {
|
|
|
1684
1715
|
label: props.label,
|
|
1685
1716
|
name: props.name,
|
|
1686
1717
|
isDisabled: disabled
|
|
1687
|
-
}), /* @__PURE__ */ React42.createElement(
|
|
1718
|
+
}), /* @__PURE__ */ React42.createElement(Box24, __spreadValues(__spreadValues({
|
|
1688
1719
|
as: "button",
|
|
1689
1720
|
__baseCSS: {
|
|
1690
1721
|
display: "flex",
|
|
@@ -1695,7 +1726,7 @@ var Select = (_a) => {
|
|
|
1695
1726
|
},
|
|
1696
1727
|
css: styles.button,
|
|
1697
1728
|
ref: buttonRef
|
|
1698
|
-
}, mergeProps7(buttonProps, focusProps)), stateProps), /* @__PURE__ */ React42.createElement(
|
|
1729
|
+
}, mergeProps7(buttonProps, focusProps)), stateProps), /* @__PURE__ */ React42.createElement(Box24, __spreadValues({
|
|
1699
1730
|
css: {
|
|
1700
1731
|
overflow: "hidden",
|
|
1701
1732
|
whiteSpace: "nowrap"
|
|
@@ -1779,7 +1810,15 @@ var Thumb = (_a) => {
|
|
|
1779
1810
|
|
|
1780
1811
|
// src/Slider/Slider.tsx
|
|
1781
1812
|
var Slider = (_a) => {
|
|
1782
|
-
var _b = _a, {
|
|
1813
|
+
var _b = _a, {
|
|
1814
|
+
variant,
|
|
1815
|
+
size,
|
|
1816
|
+
width = "100%"
|
|
1817
|
+
} = _b, props = __objRest(_b, [
|
|
1818
|
+
"variant",
|
|
1819
|
+
"size",
|
|
1820
|
+
"width"
|
|
1821
|
+
]);
|
|
1783
1822
|
const { formatOptions } = props;
|
|
1784
1823
|
const trackRef = useRef13(null);
|
|
1785
1824
|
const numberFormatter = useNumberFormatter(formatOptions);
|
|
@@ -1792,7 +1831,8 @@ var Slider = (_a) => {
|
|
|
1792
1831
|
__baseCSS: {
|
|
1793
1832
|
display: "flex",
|
|
1794
1833
|
flexDirection: "column",
|
|
1795
|
-
touchAction: "none"
|
|
1834
|
+
touchAction: "none",
|
|
1835
|
+
width
|
|
1796
1836
|
}
|
|
1797
1837
|
}, groupProps), /* @__PURE__ */ React44.createElement(Box, {
|
|
1798
1838
|
__baseCSS: { display: "flex", alignSelf: "stretch" }
|
|
@@ -1824,28 +1864,41 @@ var Slider = (_a) => {
|
|
|
1824
1864
|
|
|
1825
1865
|
// src/Stack/Stack.tsx
|
|
1826
1866
|
import React45 from "react";
|
|
1827
|
-
var
|
|
1867
|
+
var ALIGNMENT_X2 = {
|
|
1828
1868
|
left: "flex-start",
|
|
1829
1869
|
center: "center",
|
|
1830
1870
|
right: "flex-end"
|
|
1831
1871
|
};
|
|
1872
|
+
var ALIGNMENT_Y2 = {
|
|
1873
|
+
top: "flex-start",
|
|
1874
|
+
center: "center",
|
|
1875
|
+
bottom: "flex-end"
|
|
1876
|
+
};
|
|
1832
1877
|
var Stack = (_a) => {
|
|
1833
1878
|
var _b = _a, {
|
|
1879
|
+
children,
|
|
1834
1880
|
space = "none",
|
|
1835
|
-
|
|
1836
|
-
|
|
1881
|
+
alignX = "left",
|
|
1882
|
+
alignY = "top",
|
|
1883
|
+
stretch = false
|
|
1837
1884
|
} = _b, props = __objRest(_b, [
|
|
1885
|
+
"children",
|
|
1838
1886
|
"space",
|
|
1839
|
-
"
|
|
1840
|
-
"
|
|
1887
|
+
"alignX",
|
|
1888
|
+
"alignY",
|
|
1889
|
+
"stretch"
|
|
1841
1890
|
]);
|
|
1842
|
-
return /* @__PURE__ */ React45.createElement(Box,
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1891
|
+
return /* @__PURE__ */ React45.createElement(Box, __spreadValues({
|
|
1892
|
+
css: {
|
|
1893
|
+
display: "flex",
|
|
1894
|
+
flexDirection: "column",
|
|
1895
|
+
p: 0,
|
|
1896
|
+
gap: space,
|
|
1897
|
+
alignItems: ALIGNMENT_X2[alignX],
|
|
1898
|
+
justifyContent: ALIGNMENT_Y2[alignY],
|
|
1899
|
+
blockSize: stretch ? "100%" : "auto"
|
|
1900
|
+
}
|
|
1901
|
+
}, props), children);
|
|
1849
1902
|
};
|
|
1850
1903
|
|
|
1851
1904
|
// src/Switch/Switch.tsx
|
|
@@ -1861,6 +1914,7 @@ var Switch = (_a) => {
|
|
|
1861
1914
|
var _b = _a, {
|
|
1862
1915
|
variant,
|
|
1863
1916
|
size,
|
|
1917
|
+
width = "100%",
|
|
1864
1918
|
checked,
|
|
1865
1919
|
disabled,
|
|
1866
1920
|
readOnly,
|
|
@@ -1868,6 +1922,7 @@ var Switch = (_a) => {
|
|
|
1868
1922
|
} = _b, rest = __objRest(_b, [
|
|
1869
1923
|
"variant",
|
|
1870
1924
|
"size",
|
|
1925
|
+
"width",
|
|
1871
1926
|
"checked",
|
|
1872
1927
|
"disabled",
|
|
1873
1928
|
"readOnly",
|
|
@@ -1897,7 +1952,8 @@ var Switch = (_a) => {
|
|
|
1897
1952
|
alignItems: "center",
|
|
1898
1953
|
justifyContent: "space-between",
|
|
1899
1954
|
gap: "1ch",
|
|
1900
|
-
position: "relative"
|
|
1955
|
+
position: "relative",
|
|
1956
|
+
width
|
|
1901
1957
|
},
|
|
1902
1958
|
css: styles.container
|
|
1903
1959
|
}, /* @__PURE__ */ React46.createElement(Box, __spreadValues(__spreadValues({
|
|
@@ -1946,249 +2002,338 @@ var Switch = (_a) => {
|
|
|
1946
2002
|
};
|
|
1947
2003
|
|
|
1948
2004
|
// src/Table/Table.tsx
|
|
1949
|
-
import
|
|
2005
|
+
import React55, { useRef as useRef21 } from "react";
|
|
1950
2006
|
import { useTable } from "@react-aria/table";
|
|
1951
2007
|
import {
|
|
1952
2008
|
Cell,
|
|
1953
2009
|
Column,
|
|
1954
2010
|
Row,
|
|
1955
|
-
TableBody,
|
|
1956
|
-
TableHeader,
|
|
2011
|
+
TableBody as Body,
|
|
2012
|
+
TableHeader as Header2,
|
|
1957
2013
|
useTableState
|
|
1958
2014
|
} from "@react-stately/table";
|
|
1959
|
-
import {
|
|
2015
|
+
import {
|
|
2016
|
+
Box as Box30,
|
|
2017
|
+
useComponentStyles as useComponentStyles27
|
|
2018
|
+
} from "@marigold/system";
|
|
2019
|
+
|
|
2020
|
+
// src/Table/Context.tsx
|
|
2021
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
2022
|
+
var TableContext = createContext6({});
|
|
2023
|
+
var useTableContext = () => useContext6(TableContext);
|
|
2024
|
+
|
|
2025
|
+
// src/Table/TableBody.tsx
|
|
2026
|
+
import React47 from "react";
|
|
2027
|
+
import { useTableRowGroup } from "@react-aria/table";
|
|
2028
|
+
var TableBody = ({ children }) => {
|
|
2029
|
+
const { rowGroupProps } = useTableRowGroup();
|
|
2030
|
+
return /* @__PURE__ */ React47.createElement("tbody", __spreadValues({}, rowGroupProps), children);
|
|
2031
|
+
};
|
|
1960
2032
|
|
|
1961
2033
|
// src/Table/TableCell.tsx
|
|
1962
|
-
import
|
|
1963
|
-
import {
|
|
2034
|
+
import React48, { useRef as useRef15 } from "react";
|
|
2035
|
+
import { useTableCell } from "@react-aria/table";
|
|
1964
2036
|
import { useFocusRing as useFocusRing9 } from "@react-aria/focus";
|
|
1965
|
-
import { useTableCell, useTableSelectionCheckbox } from "@react-aria/table";
|
|
1966
2037
|
import { mergeProps as mergeProps9 } from "@react-aria/utils";
|
|
1967
|
-
import {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
state
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
}
|
|
1975
|
-
const cellRef = useRef15(null);
|
|
1976
|
-
const { gridCellProps } = useTableCell({ node: cell }, state, cellRef);
|
|
1977
|
-
const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey }, state);
|
|
1978
|
-
const inputRef = useRef15(null);
|
|
1979
|
-
const { inputProps } = useCheckbox2(checkboxProps, useToggleState3(checkboxProps), inputRef);
|
|
2038
|
+
import { Box as Box25, useStateProps as useStateProps11 } from "@marigold/system";
|
|
2039
|
+
var TableCell = ({ cell }) => {
|
|
2040
|
+
const ref = useRef15(null);
|
|
2041
|
+
const { state, styles } = useTableContext();
|
|
2042
|
+
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
2043
|
+
const { gridCellProps } = useTableCell({
|
|
2044
|
+
node: cell
|
|
2045
|
+
}, state, ref);
|
|
1980
2046
|
const { focusProps, isFocusVisible } = useFocusRing9();
|
|
1981
|
-
const stateProps = useStateProps11({
|
|
1982
|
-
return /* @__PURE__ */
|
|
2047
|
+
const stateProps = useStateProps11({ disabled, focusVisible: isFocusVisible });
|
|
2048
|
+
return /* @__PURE__ */ React48.createElement(Box25, __spreadValues(__spreadValues({
|
|
1983
2049
|
as: "td",
|
|
1984
|
-
ref
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
},
|
|
1988
|
-
css
|
|
1989
|
-
}, mergeProps9(gridCellProps, focusProps)), stateProps), isSelectionCell ? /* @__PURE__ */ React47.createElement("input", __spreadValues({}, inputProps)) : /* @__PURE__ */ React47.createElement(React47.Fragment, null, cell.rendered));
|
|
2050
|
+
ref,
|
|
2051
|
+
css: styles.cell
|
|
2052
|
+
}, mergeProps9(gridCellProps, focusProps)), stateProps), cell.rendered);
|
|
1990
2053
|
};
|
|
1991
2054
|
|
|
1992
|
-
// src/Table/
|
|
2055
|
+
// src/Table/TableCheckboxCell.tsx
|
|
1993
2056
|
import React49, { useRef as useRef16 } from "react";
|
|
1994
|
-
import {
|
|
2057
|
+
import { useTableCell as useTableCell2, useTableSelectionCheckbox } from "@react-aria/table";
|
|
1995
2058
|
import { useFocusRing as useFocusRing10 } from "@react-aria/focus";
|
|
1996
|
-
import {
|
|
1997
|
-
useTableSelectAllCheckbox,
|
|
1998
|
-
useTableColumnHeader
|
|
1999
|
-
} from "@react-aria/table";
|
|
2000
2059
|
import { mergeProps as mergeProps10 } from "@react-aria/utils";
|
|
2001
|
-
import {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
cursor,
|
|
2018
|
-
outline,
|
|
2019
|
-
children
|
|
2020
|
-
} = _b, props = __objRest(_b, [
|
|
2021
|
-
"variant",
|
|
2022
|
-
"size",
|
|
2023
|
-
"align",
|
|
2024
|
-
"color",
|
|
2025
|
-
"fontSize",
|
|
2026
|
-
"cursor",
|
|
2027
|
-
"outline",
|
|
2028
|
-
"children"
|
|
2060
|
+
import { Box as Box26, useStateProps as useStateProps12 } from "@marigold/system";
|
|
2061
|
+
|
|
2062
|
+
// src/Table/utils.ts
|
|
2063
|
+
var mapCheckboxProps = (_a) => {
|
|
2064
|
+
var {
|
|
2065
|
+
checkboxProps: _b
|
|
2066
|
+
} = _a, _c = _b, {
|
|
2067
|
+
isIndeterminate,
|
|
2068
|
+
isSelected,
|
|
2069
|
+
isDisabled,
|
|
2070
|
+
defaultSelected
|
|
2071
|
+
} = _c, rest = __objRest(_c, [
|
|
2072
|
+
"isIndeterminate",
|
|
2073
|
+
"isSelected",
|
|
2074
|
+
"isDisabled",
|
|
2075
|
+
"defaultSelected"
|
|
2029
2076
|
]);
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
css: __spreadValues({ color, cursor, outline, fontSize, textAlign: align }, styles)
|
|
2038
|
-
}), children);
|
|
2077
|
+
const checkboxProps = __spreadValues({
|
|
2078
|
+
disabled: isDisabled,
|
|
2079
|
+
checked: isSelected,
|
|
2080
|
+
defaultChecked: defaultSelected,
|
|
2081
|
+
indeterminate: isIndeterminate
|
|
2082
|
+
}, rest);
|
|
2083
|
+
return { checkboxProps };
|
|
2039
2084
|
};
|
|
2040
2085
|
|
|
2041
|
-
// src/Table/
|
|
2042
|
-
var
|
|
2043
|
-
item: column,
|
|
2044
|
-
state,
|
|
2045
|
-
isSelectionColumn,
|
|
2046
|
-
css
|
|
2047
|
-
}) => {
|
|
2086
|
+
// src/Table/TableCheckboxCell.tsx
|
|
2087
|
+
var TableCheckboxCell = ({ cell }) => {
|
|
2048
2088
|
const ref = useRef16(null);
|
|
2049
|
-
const {
|
|
2050
|
-
const
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2089
|
+
const { state, styles } = useTableContext();
|
|
2090
|
+
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
2091
|
+
const { gridCellProps } = useTableCell2({
|
|
2092
|
+
node: cell
|
|
2093
|
+
}, state, ref);
|
|
2094
|
+
const { checkboxProps } = mapCheckboxProps(useTableSelectionCheckbox({ key: cell.parentKey }, state));
|
|
2053
2095
|
const { focusProps, isFocusVisible } = useFocusRing10();
|
|
2054
|
-
const stateProps = useStateProps12({
|
|
2055
|
-
return /* @__PURE__ */ React49.createElement(
|
|
2096
|
+
const stateProps = useStateProps12({ disabled, focusVisible: isFocusVisible });
|
|
2097
|
+
return /* @__PURE__ */ React49.createElement(Box26, __spreadValues(__spreadValues({
|
|
2098
|
+
as: "td",
|
|
2099
|
+
ref,
|
|
2100
|
+
__baseCSS: {
|
|
2101
|
+
textAlign: "center",
|
|
2102
|
+
verticalAlign: "middle",
|
|
2103
|
+
lineHeight: 1
|
|
2104
|
+
},
|
|
2105
|
+
css: styles.cell
|
|
2106
|
+
}, mergeProps10(gridCellProps, focusProps)), stateProps), /* @__PURE__ */ React49.createElement(Checkbox, __spreadValues({}, checkboxProps)));
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
// src/Table/TableColumnHeader.tsx
|
|
2110
|
+
import React50, { useRef as useRef17 } from "react";
|
|
2111
|
+
import { useFocusRing as useFocusRing11 } from "@react-aria/focus";
|
|
2112
|
+
import { useHover as useHover5 } from "@react-aria/interactions";
|
|
2113
|
+
import { useTableColumnHeader } from "@react-aria/table";
|
|
2114
|
+
import { mergeProps as mergeProps11 } from "@react-aria/utils";
|
|
2115
|
+
import { Box as Box27, useStateProps as useStateProps13 } from "@marigold/system";
|
|
2116
|
+
var TableColumnHeader = ({ column }) => {
|
|
2117
|
+
const ref = useRef17(null);
|
|
2118
|
+
const { state, styles } = useTableContext();
|
|
2119
|
+
const { columnHeaderProps } = useTableColumnHeader({
|
|
2120
|
+
node: column
|
|
2121
|
+
}, state, ref);
|
|
2122
|
+
const { hoverProps, isHovered } = useHover5({});
|
|
2123
|
+
const { focusProps, isFocusVisible } = useFocusRing11();
|
|
2124
|
+
const stateProps = useStateProps13({
|
|
2125
|
+
hover: isHovered,
|
|
2126
|
+
focusVisible: isFocusVisible
|
|
2127
|
+
});
|
|
2128
|
+
return /* @__PURE__ */ React50.createElement(Box27, __spreadValues(__spreadValues({
|
|
2056
2129
|
as: "th",
|
|
2130
|
+
colSpan: column.colspan,
|
|
2057
2131
|
ref,
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2132
|
+
css: styles.header
|
|
2133
|
+
}, mergeProps11(columnHeaderProps, hoverProps, focusProps)), stateProps), column.rendered);
|
|
2134
|
+
};
|
|
2135
|
+
|
|
2136
|
+
// src/Table/TableHeader.tsx
|
|
2137
|
+
import React51 from "react";
|
|
2138
|
+
import { useTableRowGroup as useTableRowGroup2 } from "@react-aria/table";
|
|
2139
|
+
var TableHeader = ({ children }) => {
|
|
2140
|
+
const { rowGroupProps } = useTableRowGroup2();
|
|
2141
|
+
return /* @__PURE__ */ React51.createElement("thead", __spreadValues({}, rowGroupProps), children);
|
|
2065
2142
|
};
|
|
2066
2143
|
|
|
2067
2144
|
// src/Table/TableHeaderRow.tsx
|
|
2068
|
-
import
|
|
2145
|
+
import React52, { useRef as useRef18 } from "react";
|
|
2069
2146
|
import { useTableHeaderRow } from "@react-aria/table";
|
|
2070
|
-
var TableHeaderRow = ({
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
children
|
|
2074
|
-
}) => {
|
|
2075
|
-
const ref = useRef17(null);
|
|
2147
|
+
var TableHeaderRow = ({ item, children }) => {
|
|
2148
|
+
const { state } = useTableContext();
|
|
2149
|
+
const ref = useRef18(null);
|
|
2076
2150
|
const { rowProps } = useTableHeaderRow({ node: item }, state, ref);
|
|
2077
|
-
return /* @__PURE__ */
|
|
2151
|
+
return /* @__PURE__ */ React52.createElement("tr", __spreadProps(__spreadValues({}, rowProps), {
|
|
2078
2152
|
ref
|
|
2079
2153
|
}), children);
|
|
2080
2154
|
};
|
|
2081
2155
|
|
|
2082
2156
|
// src/Table/TableRow.tsx
|
|
2083
|
-
import
|
|
2084
|
-
import { useFocusRing as
|
|
2157
|
+
import React53, { useRef as useRef19 } from "react";
|
|
2158
|
+
import { useFocusRing as useFocusRing12 } from "@react-aria/focus";
|
|
2159
|
+
import { useHover as useHover6 } from "@react-aria/interactions";
|
|
2085
2160
|
import { useTableRow } from "@react-aria/table";
|
|
2086
|
-
import { mergeProps as
|
|
2087
|
-
import { useStateProps as
|
|
2088
|
-
var TableRow = ({
|
|
2089
|
-
const ref =
|
|
2090
|
-
const
|
|
2091
|
-
const { rowProps } = useTableRow({
|
|
2092
|
-
node:
|
|
2161
|
+
import { mergeProps as mergeProps12 } from "@react-aria/utils";
|
|
2162
|
+
import { Box as Box28, useStateProps as useStateProps14 } from "@marigold/system";
|
|
2163
|
+
var TableRow = ({ children, row }) => {
|
|
2164
|
+
const ref = useRef19(null);
|
|
2165
|
+
const { state, styles } = useTableContext();
|
|
2166
|
+
const { rowProps, isPressed } = useTableRow({
|
|
2167
|
+
node: row
|
|
2093
2168
|
}, state, ref);
|
|
2094
|
-
const
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
|
|
2169
|
+
const disabled = state.disabledKeys.has(row.key);
|
|
2170
|
+
const selected = state.selectionManager.isSelected(row.key);
|
|
2171
|
+
const { focusProps, isFocusVisible } = useFocusRing12({ within: true });
|
|
2172
|
+
const { hoverProps, isHovered } = useHover6({ isDisabled: disabled });
|
|
2173
|
+
const stateProps = useStateProps14({
|
|
2174
|
+
disabled,
|
|
2175
|
+
selected,
|
|
2176
|
+
hover: isHovered,
|
|
2177
|
+
focusVisible: isFocusVisible,
|
|
2178
|
+
active: isPressed
|
|
2098
2179
|
});
|
|
2099
|
-
return /* @__PURE__ */
|
|
2180
|
+
return /* @__PURE__ */ React53.createElement(Box28, __spreadValues(__spreadValues({
|
|
2100
2181
|
as: "tr",
|
|
2101
2182
|
ref,
|
|
2102
|
-
css
|
|
2103
|
-
},
|
|
2183
|
+
css: styles.row
|
|
2184
|
+
}, mergeProps12(rowProps, focusProps, hoverProps)), stateProps), children);
|
|
2104
2185
|
};
|
|
2105
2186
|
|
|
2106
|
-
// src/Table/
|
|
2107
|
-
import
|
|
2108
|
-
import {
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2187
|
+
// src/Table/TableSelectAllCell.tsx
|
|
2188
|
+
import React54, { useRef as useRef20 } from "react";
|
|
2189
|
+
import { useFocusRing as useFocusRing13 } from "@react-aria/focus";
|
|
2190
|
+
import { useHover as useHover7 } from "@react-aria/interactions";
|
|
2191
|
+
import {
|
|
2192
|
+
useTableColumnHeader as useTableColumnHeader2,
|
|
2193
|
+
useTableSelectAllCheckbox
|
|
2194
|
+
} from "@react-aria/table";
|
|
2195
|
+
import { mergeProps as mergeProps13 } from "@react-aria/utils";
|
|
2196
|
+
import { Box as Box29, useStateProps as useStateProps15 } from "@marigold/system";
|
|
2197
|
+
var TableSelectAllCell = ({ column }) => {
|
|
2198
|
+
const ref = useRef20(null);
|
|
2199
|
+
const { state, styles } = useTableContext();
|
|
2200
|
+
const { columnHeaderProps } = useTableColumnHeader2({
|
|
2201
|
+
node: column
|
|
2202
|
+
}, state, ref);
|
|
2203
|
+
const { checkboxProps } = mapCheckboxProps(useTableSelectAllCheckbox(state));
|
|
2204
|
+
const { hoverProps, isHovered } = useHover7({});
|
|
2205
|
+
const { focusProps, isFocusVisible } = useFocusRing13();
|
|
2206
|
+
const stateProps = useStateProps15({
|
|
2207
|
+
hover: isHovered,
|
|
2208
|
+
focusVisible: isFocusVisible
|
|
2209
|
+
});
|
|
2210
|
+
return /* @__PURE__ */ React54.createElement(Box29, __spreadValues(__spreadValues({
|
|
2211
|
+
as: "th",
|
|
2212
|
+
ref,
|
|
2213
|
+
__baseCSS: {
|
|
2214
|
+
textAlign: "center",
|
|
2215
|
+
verticalAlign: "middle",
|
|
2216
|
+
lineHeight: 1
|
|
2217
|
+
},
|
|
2218
|
+
css: styles.header
|
|
2219
|
+
}, mergeProps13(columnHeaderProps, hoverProps, focusProps)), stateProps), /* @__PURE__ */ React54.createElement(Checkbox, __spreadValues({}, checkboxProps)));
|
|
2115
2220
|
};
|
|
2116
2221
|
|
|
2117
2222
|
// src/Table/Table.tsx
|
|
2118
2223
|
var Table = (_a) => {
|
|
2119
2224
|
var _b = _a, { variant, size } = _b, props = __objRest(_b, ["variant", "size"]);
|
|
2120
|
-
const
|
|
2225
|
+
const tableRef = useRef21(null);
|
|
2121
2226
|
const state = useTableState(__spreadProps(__spreadValues({}, props), {
|
|
2122
|
-
showSelectionCheckboxes
|
|
2227
|
+
showSelectionCheckboxes: props.selectionMode === "multiple" && props.selectionBehavior !== "replace"
|
|
2123
2228
|
}));
|
|
2124
|
-
const
|
|
2125
|
-
const {
|
|
2126
|
-
const
|
|
2127
|
-
return /* @__PURE__ */
|
|
2229
|
+
const { gridProps } = useTable(props, state, tableRef);
|
|
2230
|
+
const styles = useComponentStyles27("Table", { variant, size }, { parts: ["table", "header", "row", "cell"] });
|
|
2231
|
+
const { collection } = state;
|
|
2232
|
+
return /* @__PURE__ */ React55.createElement(TableContext.Provider, {
|
|
2233
|
+
value: { state, styles }
|
|
2234
|
+
}, /* @__PURE__ */ React55.createElement(Box30, __spreadValues({
|
|
2128
2235
|
as: "table",
|
|
2129
|
-
ref,
|
|
2130
|
-
|
|
2131
|
-
}, gridProps), /* @__PURE__ */
|
|
2132
|
-
as: "thead"
|
|
2133
|
-
}, state.collection.headerRows.map((headerRow) => /* @__PURE__ */ React53.createElement(TableHeaderRow, {
|
|
2236
|
+
ref: tableRef,
|
|
2237
|
+
css: styles.table
|
|
2238
|
+
}, gridProps), /* @__PURE__ */ React55.createElement(TableHeader, null, collection.headerRows.map((headerRow) => /* @__PURE__ */ React55.createElement(TableHeaderRow, {
|
|
2134
2239
|
key: headerRow.key,
|
|
2135
|
-
item: headerRow
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
}, [...
|
|
2146
|
-
css: styles.row,
|
|
2240
|
+
item: headerRow
|
|
2241
|
+
}, [...headerRow.childNodes].map((column) => {
|
|
2242
|
+
var _a2;
|
|
2243
|
+
return ((_a2 = column.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ React55.createElement(TableSelectAllCell, {
|
|
2244
|
+
key: column.key,
|
|
2245
|
+
column
|
|
2246
|
+
}) : /* @__PURE__ */ React55.createElement(TableColumnHeader, {
|
|
2247
|
+
key: column.key,
|
|
2248
|
+
column
|
|
2249
|
+
});
|
|
2250
|
+
})))), /* @__PURE__ */ React55.createElement(TableBody, null, [...collection.body.childNodes].map((row) => /* @__PURE__ */ React55.createElement(TableRow, {
|
|
2147
2251
|
key: row.key,
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2252
|
+
row
|
|
2253
|
+
}, [...row.childNodes].map((cell) => {
|
|
2254
|
+
var _a2;
|
|
2255
|
+
return ((_a2 = cell.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ React55.createElement(TableCheckboxCell, {
|
|
2256
|
+
key: cell.key,
|
|
2257
|
+
cell
|
|
2258
|
+
}) : /* @__PURE__ */ React55.createElement(TableCell, {
|
|
2259
|
+
key: cell.key,
|
|
2260
|
+
cell
|
|
2261
|
+
});
|
|
2156
2262
|
}))))));
|
|
2157
2263
|
};
|
|
2158
|
-
Table.Body =
|
|
2264
|
+
Table.Body = Body;
|
|
2159
2265
|
Table.Cell = Cell;
|
|
2160
2266
|
Table.Column = Column;
|
|
2161
|
-
Table.Header =
|
|
2267
|
+
Table.Header = Header2;
|
|
2162
2268
|
Table.Row = Row;
|
|
2163
2269
|
|
|
2270
|
+
// src/Text/Text.tsx
|
|
2271
|
+
import React56 from "react";
|
|
2272
|
+
import {
|
|
2273
|
+
useComponentStyles as useComponentStyles28
|
|
2274
|
+
} from "@marigold/system";
|
|
2275
|
+
import { Box as Box31 } from "@marigold/system";
|
|
2276
|
+
var Text = (_a) => {
|
|
2277
|
+
var _b = _a, {
|
|
2278
|
+
variant,
|
|
2279
|
+
size,
|
|
2280
|
+
align,
|
|
2281
|
+
color,
|
|
2282
|
+
fontSize,
|
|
2283
|
+
cursor,
|
|
2284
|
+
outline,
|
|
2285
|
+
children
|
|
2286
|
+
} = _b, props = __objRest(_b, [
|
|
2287
|
+
"variant",
|
|
2288
|
+
"size",
|
|
2289
|
+
"align",
|
|
2290
|
+
"color",
|
|
2291
|
+
"fontSize",
|
|
2292
|
+
"cursor",
|
|
2293
|
+
"outline",
|
|
2294
|
+
"children"
|
|
2295
|
+
]);
|
|
2296
|
+
const styles = useComponentStyles28("Text", {
|
|
2297
|
+
variant,
|
|
2298
|
+
size
|
|
2299
|
+
});
|
|
2300
|
+
return /* @__PURE__ */ React56.createElement(Box31, __spreadProps(__spreadValues({
|
|
2301
|
+
as: "p"
|
|
2302
|
+
}, props), {
|
|
2303
|
+
css: __spreadValues({ color, cursor, outline, fontSize, textAlign: align }, styles)
|
|
2304
|
+
}), children);
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2164
2307
|
// src/TextArea/TextArea.tsx
|
|
2165
|
-
import
|
|
2308
|
+
import React57, { useRef as useRef22 } from "react";
|
|
2166
2309
|
import { useTextField } from "@react-aria/textfield";
|
|
2167
2310
|
import {
|
|
2168
|
-
Box as
|
|
2311
|
+
Box as Box32,
|
|
2169
2312
|
useComponentStyles as useComponentStyles29,
|
|
2170
|
-
useStateProps as
|
|
2313
|
+
useStateProps as useStateProps16
|
|
2171
2314
|
} from "@marigold/system";
|
|
2172
|
-
import { useHover as
|
|
2173
|
-
import { useFocusRing as
|
|
2315
|
+
import { useHover as useHover8 } from "@react-aria/interactions";
|
|
2316
|
+
import { useFocusRing as useFocusRing14 } from "@react-aria/focus";
|
|
2174
2317
|
var TextArea = (_a) => {
|
|
2175
2318
|
var _b = _a, {
|
|
2319
|
+
variant,
|
|
2320
|
+
size,
|
|
2321
|
+
width,
|
|
2176
2322
|
disabled,
|
|
2177
2323
|
required,
|
|
2178
2324
|
readOnly,
|
|
2179
|
-
error
|
|
2180
|
-
variant,
|
|
2181
|
-
size
|
|
2325
|
+
error
|
|
2182
2326
|
} = _b, props = __objRest(_b, [
|
|
2327
|
+
"variant",
|
|
2328
|
+
"size",
|
|
2329
|
+
"width",
|
|
2183
2330
|
"disabled",
|
|
2184
2331
|
"required",
|
|
2185
2332
|
"readOnly",
|
|
2186
|
-
"error"
|
|
2187
|
-
"variant",
|
|
2188
|
-
"size"
|
|
2333
|
+
"error"
|
|
2189
2334
|
]);
|
|
2190
2335
|
const { label, description, errorMessage } = props;
|
|
2191
|
-
const ref =
|
|
2336
|
+
const ref = useRef22(null);
|
|
2192
2337
|
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField(__spreadValues({
|
|
2193
2338
|
inputElementType: "textarea",
|
|
2194
2339
|
isDisabled: disabled,
|
|
@@ -2196,9 +2341,9 @@ var TextArea = (_a) => {
|
|
|
2196
2341
|
isReadOnly: readOnly,
|
|
2197
2342
|
validationState: error ? "invalid" : "valid"
|
|
2198
2343
|
}, props), ref);
|
|
2199
|
-
const { hoverProps, isHovered } =
|
|
2200
|
-
const { focusProps, isFocusVisible } =
|
|
2201
|
-
const stateProps =
|
|
2344
|
+
const { hoverProps, isHovered } = useHover8({});
|
|
2345
|
+
const { focusProps, isFocusVisible } = useFocusRing14();
|
|
2346
|
+
const stateProps = useStateProps16({
|
|
2202
2347
|
hover: isHovered,
|
|
2203
2348
|
focus: isFocusVisible,
|
|
2204
2349
|
disabled,
|
|
@@ -2206,7 +2351,7 @@ var TextArea = (_a) => {
|
|
|
2206
2351
|
error
|
|
2207
2352
|
});
|
|
2208
2353
|
const styles = useComponentStyles29("TextArea", { variant, size });
|
|
2209
|
-
return /* @__PURE__ */
|
|
2354
|
+
return /* @__PURE__ */ React57.createElement(FieldBase, {
|
|
2210
2355
|
label,
|
|
2211
2356
|
labelProps,
|
|
2212
2357
|
required,
|
|
@@ -2217,8 +2362,9 @@ var TextArea = (_a) => {
|
|
|
2217
2362
|
errorMessageProps,
|
|
2218
2363
|
stateProps,
|
|
2219
2364
|
variant,
|
|
2220
|
-
size
|
|
2221
|
-
|
|
2365
|
+
size,
|
|
2366
|
+
width
|
|
2367
|
+
}, /* @__PURE__ */ React57.createElement(Box32, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
2222
2368
|
as: "textarea",
|
|
2223
2369
|
css: styles,
|
|
2224
2370
|
ref
|
|
@@ -2226,48 +2372,50 @@ var TextArea = (_a) => {
|
|
|
2226
2372
|
};
|
|
2227
2373
|
|
|
2228
2374
|
// src/TextField/TextField.tsx
|
|
2229
|
-
import
|
|
2230
|
-
import { useHover as
|
|
2231
|
-
import { useFocusRing as
|
|
2375
|
+
import React58, { useRef as useRef23 } from "react";
|
|
2376
|
+
import { useHover as useHover9 } from "@react-aria/interactions";
|
|
2377
|
+
import { useFocusRing as useFocusRing15 } from "@react-aria/focus";
|
|
2232
2378
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
2233
|
-
import { useStateProps as
|
|
2379
|
+
import { useStateProps as useStateProps17 } from "@marigold/system";
|
|
2234
2380
|
var TextField = (_a) => {
|
|
2235
2381
|
var _b = _a, {
|
|
2382
|
+
variant,
|
|
2383
|
+
size,
|
|
2384
|
+
width,
|
|
2236
2385
|
disabled,
|
|
2237
2386
|
required,
|
|
2238
2387
|
readOnly,
|
|
2239
|
-
error
|
|
2240
|
-
variant,
|
|
2241
|
-
size
|
|
2388
|
+
error
|
|
2242
2389
|
} = _b, props = __objRest(_b, [
|
|
2390
|
+
"variant",
|
|
2391
|
+
"size",
|
|
2392
|
+
"width",
|
|
2243
2393
|
"disabled",
|
|
2244
2394
|
"required",
|
|
2245
2395
|
"readOnly",
|
|
2246
|
-
"error"
|
|
2247
|
-
"variant",
|
|
2248
|
-
"size"
|
|
2396
|
+
"error"
|
|
2249
2397
|
]);
|
|
2250
2398
|
const { label, description, errorMessage, autoFocus } = props;
|
|
2251
|
-
const ref =
|
|
2399
|
+
const ref = useRef23(null);
|
|
2252
2400
|
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField2(__spreadValues({
|
|
2253
2401
|
isDisabled: disabled,
|
|
2254
2402
|
isRequired: required,
|
|
2255
2403
|
isReadOnly: readOnly,
|
|
2256
2404
|
validationState: error ? "invalid" : "valid"
|
|
2257
2405
|
}, props), ref);
|
|
2258
|
-
const { hoverProps, isHovered } =
|
|
2259
|
-
const { focusProps, isFocusVisible } =
|
|
2406
|
+
const { hoverProps, isHovered } = useHover9({});
|
|
2407
|
+
const { focusProps, isFocusVisible } = useFocusRing15({
|
|
2260
2408
|
isTextInput: true,
|
|
2261
2409
|
autoFocus
|
|
2262
2410
|
});
|
|
2263
|
-
const stateProps =
|
|
2411
|
+
const stateProps = useStateProps17({
|
|
2264
2412
|
hover: isHovered,
|
|
2265
2413
|
focus: isFocusVisible,
|
|
2266
2414
|
disabled,
|
|
2267
2415
|
readOnly,
|
|
2268
2416
|
error
|
|
2269
2417
|
});
|
|
2270
|
-
return /* @__PURE__ */
|
|
2418
|
+
return /* @__PURE__ */ React58.createElement(FieldBase, {
|
|
2271
2419
|
label,
|
|
2272
2420
|
labelProps,
|
|
2273
2421
|
required,
|
|
@@ -2278,8 +2426,9 @@ var TextField = (_a) => {
|
|
|
2278
2426
|
errorMessageProps,
|
|
2279
2427
|
stateProps,
|
|
2280
2428
|
variant,
|
|
2281
|
-
size
|
|
2282
|
-
|
|
2429
|
+
size,
|
|
2430
|
+
width
|
|
2431
|
+
}, /* @__PURE__ */ React58.createElement(Input, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
2283
2432
|
ref,
|
|
2284
2433
|
variant,
|
|
2285
2434
|
size
|
|
@@ -2287,10 +2436,10 @@ var TextField = (_a) => {
|
|
|
2287
2436
|
};
|
|
2288
2437
|
|
|
2289
2438
|
// src/Tiles/Tiles.tsx
|
|
2290
|
-
import
|
|
2291
|
-
var Tiles =
|
|
2439
|
+
import React59 from "react";
|
|
2440
|
+
var Tiles = React59.forwardRef(function Tiles2(_a, ref) {
|
|
2292
2441
|
var _b = _a, { space = "none", itemMinWidth = "250px", children } = _b, props = __objRest(_b, ["space", "itemMinWidth", "children"]);
|
|
2293
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ React59.createElement(Box, __spreadValues({
|
|
2294
2443
|
ref,
|
|
2295
2444
|
display: "grid",
|
|
2296
2445
|
__baseCSS: {
|
|
@@ -2301,52 +2450,98 @@ var Tiles = React56.forwardRef(function Tiles2(_a, ref) {
|
|
|
2301
2450
|
});
|
|
2302
2451
|
|
|
2303
2452
|
// src/Tooltip/Tooltip.tsx
|
|
2304
|
-
import
|
|
2453
|
+
import React61 from "react";
|
|
2305
2454
|
import { useTooltip } from "@react-aria/tooltip";
|
|
2306
|
-
import {
|
|
2455
|
+
import {
|
|
2456
|
+
Box as Box33,
|
|
2457
|
+
useComponentStyles as useComponentStyles30
|
|
2458
|
+
} from "@marigold/system";
|
|
2459
|
+
|
|
2460
|
+
// src/Tooltip/Context.ts
|
|
2461
|
+
import { createContext as createContext7, useContext as useContext7 } from "react";
|
|
2462
|
+
var TooltipContext = createContext7({});
|
|
2463
|
+
var useTooltipContext = () => useContext7(TooltipContext);
|
|
2307
2464
|
|
|
2308
2465
|
// src/Tooltip/TooltipTrigger.tsx
|
|
2309
|
-
import
|
|
2466
|
+
import React60, { useRef as useRef24 } from "react";
|
|
2310
2467
|
import { FocusableProvider } from "@react-aria/focus";
|
|
2468
|
+
import { useOverlayPosition as useOverlayPosition3 } from "@react-aria/overlays";
|
|
2311
2469
|
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
2312
|
-
import {
|
|
2313
|
-
useTooltipTriggerState
|
|
2314
|
-
} from "@react-stately/tooltip";
|
|
2315
|
-
var TooltipContext = React57.createContext({});
|
|
2470
|
+
import { useTooltipTriggerState } from "@react-stately/tooltip";
|
|
2316
2471
|
var TooltipTrigger = (_a) => {
|
|
2317
|
-
var _b = _a, {
|
|
2318
|
-
|
|
2472
|
+
var _b = _a, {
|
|
2473
|
+
disabled,
|
|
2474
|
+
open,
|
|
2475
|
+
delay = 1e3,
|
|
2476
|
+
placement = "top",
|
|
2477
|
+
children
|
|
2478
|
+
} = _b, rest = __objRest(_b, [
|
|
2479
|
+
"disabled",
|
|
2480
|
+
"open",
|
|
2481
|
+
"delay",
|
|
2482
|
+
"placement",
|
|
2483
|
+
"children"
|
|
2484
|
+
]);
|
|
2485
|
+
const [tooltipTrigger, tooltip] = React60.Children.toArray(children);
|
|
2486
|
+
const props = __spreadProps(__spreadValues({}, rest), {
|
|
2487
|
+
isDisabled: disabled,
|
|
2488
|
+
isOpen: open,
|
|
2489
|
+
delay,
|
|
2490
|
+
placement
|
|
2491
|
+
});
|
|
2492
|
+
const tooltipTriggerRef = useRef24(null);
|
|
2493
|
+
const overlayRef = useRef24(null);
|
|
2319
2494
|
const state = useTooltipTriggerState(props);
|
|
2320
|
-
const
|
|
2321
|
-
const {
|
|
2322
|
-
|
|
2495
|
+
const { triggerProps, tooltipProps } = useTooltipTrigger(props, state, tooltipTriggerRef);
|
|
2496
|
+
const {
|
|
2497
|
+
overlayProps: positionProps,
|
|
2498
|
+
placement: overlayPlacement,
|
|
2499
|
+
arrowProps
|
|
2500
|
+
} = useOverlayPosition3({
|
|
2501
|
+
placement: props.placement,
|
|
2502
|
+
targetRef: tooltipTriggerRef,
|
|
2503
|
+
offset: props.offset,
|
|
2504
|
+
crossOffset: props.crossOffset,
|
|
2505
|
+
isOpen: state.isOpen,
|
|
2506
|
+
overlayRef
|
|
2507
|
+
});
|
|
2508
|
+
return /* @__PURE__ */ React60.createElement(FocusableProvider, __spreadValues({
|
|
2323
2509
|
ref: tooltipTriggerRef
|
|
2324
|
-
}),
|
|
2325
|
-
value: __spreadValues({
|
|
2326
|
-
state
|
|
2327
|
-
|
|
2328
|
-
|
|
2510
|
+
}, triggerProps), tooltipTrigger, /* @__PURE__ */ React60.createElement(TooltipContext.Provider, {
|
|
2511
|
+
value: __spreadValues(__spreadValues({
|
|
2512
|
+
state,
|
|
2513
|
+
overlayRef,
|
|
2514
|
+
arrowProps,
|
|
2515
|
+
placement: overlayPlacement
|
|
2516
|
+
}, tooltipProps), positionProps)
|
|
2517
|
+
}, /* @__PURE__ */ React60.createElement(Overlay, {
|
|
2518
|
+
open: state.isOpen
|
|
2519
|
+
}, tooltip)));
|
|
2329
2520
|
};
|
|
2330
2521
|
|
|
2331
2522
|
// src/Tooltip/Tooltip.tsx
|
|
2332
|
-
var Tooltip = (
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2523
|
+
var Tooltip = ({ children, variant, size }) => {
|
|
2524
|
+
const _a = useTooltipContext(), { arrowProps, state, overlayRef, placement } = _a, rest = __objRest(_a, ["arrowProps", "state", "overlayRef", "placement"]);
|
|
2525
|
+
const { tooltipProps } = useTooltip({}, state);
|
|
2526
|
+
const styles = useComponentStyles30("Tooltip", { variant, size }, { parts: ["container", "arrow"] });
|
|
2527
|
+
return /* @__PURE__ */ React61.createElement(Box33, __spreadProps(__spreadValues(__spreadValues({}, tooltipProps), rest), {
|
|
2528
|
+
ref: overlayRef,
|
|
2529
|
+
css: styles.container,
|
|
2530
|
+
"data-placement": placement
|
|
2531
|
+
}), /* @__PURE__ */ React61.createElement("div", null, children), /* @__PURE__ */ React61.createElement(Box33, __spreadProps(__spreadValues({}, arrowProps), {
|
|
2532
|
+
__baseCSS: {
|
|
2533
|
+
position: "absolute",
|
|
2534
|
+
height: 0,
|
|
2535
|
+
width: 0,
|
|
2536
|
+
borderStyle: "solid",
|
|
2537
|
+
borderLeftColor: "transparent",
|
|
2538
|
+
borderRightColor: "transparent",
|
|
2539
|
+
borderBottomColor: "transparent"
|
|
2540
|
+
},
|
|
2541
|
+
css: styles.arrow
|
|
2542
|
+
})));
|
|
2349
2543
|
};
|
|
2544
|
+
Tooltip.Trigger = TooltipTrigger;
|
|
2350
2545
|
export {
|
|
2351
2546
|
Aside,
|
|
2352
2547
|
Aspect,
|
|
@@ -2391,8 +2586,6 @@ export {
|
|
|
2391
2586
|
ThemeProvider2 as ThemeProvider,
|
|
2392
2587
|
Tiles,
|
|
2393
2588
|
Tooltip,
|
|
2394
|
-
TooltipContext,
|
|
2395
|
-
TooltipTrigger,
|
|
2396
2589
|
Underlay,
|
|
2397
2590
|
VisuallyHidden,
|
|
2398
2591
|
useCheckboxGroupContext,
|