@aivenio/aquarium 1.1.0 → 1.2.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/_variables.scss +20 -2
- package/dist/_variables_timescale.scss +20 -2
- package/dist/atoms.cjs +4102 -76
- package/dist/atoms.mjs +4094 -74
- package/dist/src/common/Banner/Banner.js +7 -4
- package/dist/src/common/DataList/DataList.d.ts +24 -0
- package/dist/src/common/DataList/DataList.js +54 -0
- package/dist/src/common/DropdownMenu/DropdownMenu.d.ts +3 -1
- package/dist/src/common/DropdownMenu/DropdownMenu.js +5 -3
- package/dist/src/common/Table/Table.d.ts +8 -3
- package/dist/src/common/Table/Table.js +20 -10
- package/dist/src/components/Carousel/Carousel.d.ts +16 -0
- package/dist/src/components/Carousel/Carousel.js +89 -0
- package/dist/src/components/Chip/Chip.d.ts +1 -0
- package/dist/src/components/Chip/Chip.js +2 -2
- package/dist/src/components/DataList/DataList.d.ts +13 -0
- package/dist/src/components/DataList/DataList.js +24 -0
- package/dist/src/components/DataTable/DataTable.d.ts +5 -92
- package/dist/src/components/DataTable/DataTable.js +9 -28
- package/dist/src/components/Dropdown/Dropdown.js +1 -1
- package/dist/src/components/DropdownMenu/DropdownMenu.d.ts +8 -0
- package/dist/src/components/DropdownMenu/DropdownMenu.js +18 -15
- package/dist/src/components/Section/Section.js +2 -2
- package/dist/src/components/Table/Table.js +2 -2
- package/dist/src/components/Template/Template.d.ts +6 -1
- package/dist/src/components/Template/Template.js +7 -2
- package/dist/src/components/index.d.ts +6 -1
- package/dist/src/components/index.js +7 -2
- package/dist/src/utils/Blueprint.d.ts +6 -1
- package/dist/src/utils/Blueprint.js +4 -2
- package/dist/src/utils/table/types.d.ts +129 -0
- package/dist/src/utils/table/types.js +6 -0
- package/dist/src/utils/table/useScrollTarget.d.ts +2 -0
- package/dist/src/utils/table/useScrollTarget.js +16 -0
- package/dist/src/{common/Table/Table.utils.d.ts → utils/table/useTableSelect.d.ts} +0 -3
- package/dist/src/utils/table/useTableSelect.js +27 -0
- package/dist/src/utils/table/useTableSort.d.ts +2 -0
- package/dist/src/utils/table/useTableSort.js +19 -0
- package/dist/styles.css +63 -6
- package/dist/styles_timescaledb.css +63 -6
- package/dist/system.cjs +937 -675
- package/dist/system.mjs +931 -673
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/ActionType.d.ts +2 -0
- package/dist/types/tailwindGenerated.d.ts +1 -1
- package/dist/types/utils.d.ts +3 -0
- package/package.json +3 -3
- package/dist/src/common/Table/Table.utils.js +0 -41
package/dist/atoms.mjs
CHANGED
@@ -1112,13 +1112,173 @@ var require_search = __commonJS({
|
|
1112
1112
|
}
|
1113
1113
|
});
|
1114
1114
|
|
1115
|
+
// src/icons/slash.js
|
1116
|
+
var require_slash = __commonJS({
|
1117
|
+
"src/icons/slash.js"(exports) {
|
1118
|
+
"use strict";
|
1119
|
+
var data = {
|
1120
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="M12 2c-.46 0-.85.32-.97.74L7.04 16.7c-.02.1-.04.2-.04.3 0 .55.45 1 1 1 .46 0 .85-.32.97-.74L12.96 3.3c.02-.1.04-.2.04-.3 0-.55-.45-1-1-1Z" clip-rule="evenodd"/>',
|
1121
|
+
"left": 0,
|
1122
|
+
"top": 0,
|
1123
|
+
"width": 20,
|
1124
|
+
"height": 20
|
1125
|
+
};
|
1126
|
+
exports.__esModule = true;
|
1127
|
+
exports.default = data;
|
1128
|
+
}
|
1129
|
+
});
|
1130
|
+
|
1131
|
+
// src/icons/lock.js
|
1132
|
+
var require_lock = __commonJS({
|
1133
|
+
"src/icons/lock.js"(exports) {
|
1134
|
+
"use strict";
|
1135
|
+
var data = {
|
1136
|
+
"body": '<path fill="currentColor" d="M15.93 9H14V4.99c0-2.21-1.79-4-4-4s-4 1.79-4 4V9H3.93c-.55 0-.93.44-.93.99v8c0 .55.38 1.01.93 1.01h12c.55 0 1.07-.46 1.07-1.01v-8c0-.55-.52-.99-1.07-.99ZM8 9V4.99c0-1.1.9-2 2-2s2 .9 2 2V9H8Z"/>',
|
1137
|
+
"left": 0,
|
1138
|
+
"top": 0,
|
1139
|
+
"width": 20,
|
1140
|
+
"height": 20
|
1141
|
+
};
|
1142
|
+
exports.__esModule = true;
|
1143
|
+
exports.default = data;
|
1144
|
+
}
|
1145
|
+
});
|
1146
|
+
|
1147
|
+
// src/icons/chevronLeft.js
|
1148
|
+
var require_chevronLeft = __commonJS({
|
1149
|
+
"src/icons/chevronLeft.js"(exports) {
|
1150
|
+
"use strict";
|
1151
|
+
var data = {
|
1152
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="m8.41 10 5.29-5.29c.19-.18.3-.43.3-.71a1.003 1.003 0 00-1.71-.71l-6 6c-.18.18-.29.43-.29.71 0 .28.11.53.29.71l6 6a1.003 1.003 0 001.42-1.42L8.41 10Z" clip-rule="evenodd"/>',
|
1153
|
+
"left": 0,
|
1154
|
+
"top": 0,
|
1155
|
+
"width": 20,
|
1156
|
+
"height": 20
|
1157
|
+
};
|
1158
|
+
exports.__esModule = true;
|
1159
|
+
exports.default = data;
|
1160
|
+
}
|
1161
|
+
});
|
1162
|
+
|
1163
|
+
// src/icons/chevronRight.js
|
1164
|
+
var require_chevronRight = __commonJS({
|
1165
|
+
"src/icons/chevronRight.js"(exports) {
|
1166
|
+
"use strict";
|
1167
|
+
var data = {
|
1168
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="m13.71 9.29-6-6a1.003 1.003 0 00-1.42 1.42l5.3 5.29-5.29 5.29c-.19.18-.3.43-.3.71a1.003 1.003 0 001.71.71l6-6c.18-.18.29-.43.29-.71 0-.28-.11-.53-.29-.71Z" clip-rule="evenodd"/>',
|
1169
|
+
"left": 0,
|
1170
|
+
"top": 0,
|
1171
|
+
"width": 20,
|
1172
|
+
"height": 20
|
1173
|
+
};
|
1174
|
+
exports.__esModule = true;
|
1175
|
+
exports.default = data;
|
1176
|
+
}
|
1177
|
+
});
|
1178
|
+
|
1179
|
+
// src/icons/questionMark.js
|
1180
|
+
var require_questionMark = __commonJS({
|
1181
|
+
"src/icons/questionMark.js"(exports) {
|
1182
|
+
"use strict";
|
1183
|
+
var data = {
|
1184
|
+
"body": '<path fill="currentColor" d="M7 0C3.136 0 0 3.136 0 7s3.136 7 7 7 7-3.136 7-7-3.136-7-7-7ZM5.187 3.234c.455-.378 1.057-.574 1.792-.574a2.9 2.9 0 011.036.175c.308.119.581.273.798.476.224.203.392.441.518.714.119.273.182.574.182.889 0 .315-.056.609-.168.861-.112.259-.28.511-.497.777l-.847 1.106c-.098.119-.196.231-.224.336a1.285 1.285 0 00-.077.42v.679H6.3v-1.4s.042-.406.168-.567l.847-1.148c.175-.21.287-.392.357-.539.07-.147.098-.308.098-.469a.825.825 0 00-.224-.595c-.147-.154-.35-.231-.616-.231-.259 0-.469.077-.623.231-.154.161-.259.378-.322.658-.021.084-.077.119-.161.112l-1.365-.203c-.084-.007-.112-.056-.098-.154.091-.651.364-1.169.826-1.554ZM6.3 9.8h1.414L7.7 11.2H6.3V9.8Z"/>',
|
1185
|
+
"left": 0,
|
1186
|
+
"top": 0,
|
1187
|
+
"width": 14,
|
1188
|
+
"height": 14
|
1189
|
+
};
|
1190
|
+
exports.__esModule = true;
|
1191
|
+
exports.default = data;
|
1192
|
+
}
|
1193
|
+
});
|
1194
|
+
|
1195
|
+
// src/icons/smallCross.js
|
1196
|
+
var require_smallCross = __commonJS({
|
1197
|
+
"src/icons/smallCross.js"(exports) {
|
1198
|
+
"use strict";
|
1199
|
+
var data = {
|
1200
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="m11.41 10 3.29-3.29c.19-.18.3-.43.3-.71a1.003 1.003 0 00-1.71-.71L10 8.59l-3.29-3.3a1.003 1.003 0 00-1.42 1.42L8.59 10 5.3 13.29c-.19.18-.3.43-.3.71a1.003 1.003 0 001.71.71l3.29-3.3 3.29 3.29c.18.19.43.3.71.3a1.003 1.003 0 00.71-1.71L11.41 10Z" clip-rule="evenodd"/>',
|
1201
|
+
"left": 0,
|
1202
|
+
"top": 0,
|
1203
|
+
"width": 20,
|
1204
|
+
"height": 20
|
1205
|
+
};
|
1206
|
+
exports.__esModule = true;
|
1207
|
+
exports.default = data;
|
1208
|
+
}
|
1209
|
+
});
|
1210
|
+
|
1211
|
+
// src/icons/caretDown.js
|
1212
|
+
var require_caretDown = __commonJS({
|
1213
|
+
"src/icons/caretDown.js"(exports) {
|
1214
|
+
"use strict";
|
1215
|
+
var data = {
|
1216
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="M16 7c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1 0 .24.1.46.24.63l-.01.01 5 6 .01-.01c.19.22.45.37.76.37s.57-.15.76-.37l.01.01 5-6-.01-.01c.14-.17.24-.39.24-.63Z" clip-rule="evenodd"/>',
|
1217
|
+
"left": 0,
|
1218
|
+
"top": 0,
|
1219
|
+
"width": 20,
|
1220
|
+
"height": 20
|
1221
|
+
};
|
1222
|
+
exports.__esModule = true;
|
1223
|
+
exports.default = data;
|
1224
|
+
}
|
1225
|
+
});
|
1226
|
+
|
1227
|
+
// src/icons/chevronForward.js
|
1228
|
+
var require_chevronForward = __commonJS({
|
1229
|
+
"src/icons/chevronForward.js"(exports) {
|
1230
|
+
"use strict";
|
1231
|
+
var data = {
|
1232
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="M13 3c-.55 0-1 .45-1 1v4.59l-5.29-5.3a1.003 1.003 0 00-1.42 1.42l5.3 5.29-5.29 5.29c-.19.18-.3.43-.3.71a1.003 1.003 0 001.71.71l5.29-5.3V16c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1Z" clip-rule="evenodd"/>',
|
1233
|
+
"left": 0,
|
1234
|
+
"top": 0,
|
1235
|
+
"width": 20,
|
1236
|
+
"height": 20
|
1237
|
+
};
|
1238
|
+
exports.__esModule = true;
|
1239
|
+
exports.default = data;
|
1240
|
+
}
|
1241
|
+
});
|
1242
|
+
|
1243
|
+
// src/icons/chevronBackward.js
|
1244
|
+
var require_chevronBackward = __commonJS({
|
1245
|
+
"src/icons/chevronBackward.js"(exports) {
|
1246
|
+
"use strict";
|
1247
|
+
var data = {
|
1248
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="m8.41 10 5.29-5.29c.19-.18.3-.43.3-.71a1.003 1.003 0 00-1.71-.71L7 8.59V4c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55.45 1 1 1s1-.45 1-1v-4.59l5.29 5.29c.18.19.43.3.71.3a1.003 1.003 0 00.71-1.71L8.41 10Z" clip-rule="evenodd"/>',
|
1249
|
+
"left": 0,
|
1250
|
+
"top": 0,
|
1251
|
+
"width": 20,
|
1252
|
+
"height": 20
|
1253
|
+
};
|
1254
|
+
exports.__esModule = true;
|
1255
|
+
exports.default = data;
|
1256
|
+
}
|
1257
|
+
});
|
1258
|
+
|
1259
|
+
// src/icons/time.js
|
1260
|
+
var require_time = __commonJS({
|
1261
|
+
"src/icons/time.js"(exports) {
|
1262
|
+
"use strict";
|
1263
|
+
var data = {
|
1264
|
+
"body": '<path fill="currentColor" fill-rule="evenodd" d="M11 9.59V4c0-.55-.45-1-1-1s-1 .45-1 1v6c0 .28.11.53.29.71l3 3a1.003 1.003 0 001.42-1.42L11 9.59ZM10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0Zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8Z" clip-rule="evenodd"/>',
|
1265
|
+
"left": 0,
|
1266
|
+
"top": 0,
|
1267
|
+
"width": 20,
|
1268
|
+
"height": 20
|
1269
|
+
};
|
1270
|
+
exports.__esModule = true;
|
1271
|
+
exports.default = data;
|
1272
|
+
}
|
1273
|
+
});
|
1274
|
+
|
1115
1275
|
// src/common/Alert/Alert.tsx
|
1116
1276
|
import React8 from "react";
|
1117
1277
|
|
1118
1278
|
// src/utils/tailwind.ts
|
1119
1279
|
import originalClassNames from "classnames";
|
1120
|
-
function cleanClassNames(
|
1121
|
-
const tokens =
|
1280
|
+
function cleanClassNames(classNames4) {
|
1281
|
+
const tokens = classNames4.split(/\s+/);
|
1122
1282
|
return tokens.filter((item) => item).join(" ");
|
1123
1283
|
}
|
1124
1284
|
function tw(classesOrModifiers1, classesOrModifiers2, classesOrModifiers3, classesOrModifiers4, classesOrModifiers5, classesOrModifiers6, classesOrModifiers7, classesOrModifiers8, classesOrModifiers9, classesOrModifiers10) {
|
@@ -2678,11 +2838,15 @@ var DropdownMenu = React12.forwardRef(
|
|
2678
2838
|
style: { maxHeight, minWidth, maxWidth },
|
2679
2839
|
className: classNames(
|
2680
2840
|
className,
|
2681
|
-
"
|
2841
|
+
"bg-white w-full overflow-y-auto overflow-x-hidden typography-body-small-medium text-grey-70"
|
2682
2842
|
)
|
2683
2843
|
}, props), children);
|
2684
2844
|
}
|
2685
2845
|
);
|
2846
|
+
var ContentContainer = ({ children }) => /* @__PURE__ */ React12.createElement("div", {
|
2847
|
+
className: tw("p-3")
|
2848
|
+
}, children);
|
2849
|
+
DropdownMenu.ContentContainer = ContentContainer;
|
2686
2850
|
var List = React12.forwardRef(
|
2687
2851
|
(_a, ref) => {
|
2688
2852
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
@@ -3190,98 +3354,3948 @@ var Select = {
|
|
3190
3354
|
};
|
3191
3355
|
|
3192
3356
|
// src/common/Table/Table.tsx
|
3357
|
+
import React86 from "react";
|
3358
|
+
var import_chevronUp3 = __toESM(require_chevronUp());
|
3359
|
+
var import_chevronDown4 = __toESM(require_chevronDown());
|
3360
|
+
|
3361
|
+
// src/components/Badge/Badge.tsx
|
3362
|
+
import React21 from "react";
|
3363
|
+
import omit from "lodash/omit";
|
3364
|
+
|
3365
|
+
// src/components/Skeleton/Skeleton.tsx
|
3193
3366
|
import React20 from "react";
|
3194
|
-
|
3195
|
-
var
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3367
|
+
import isNumber from "lodash/isNumber";
|
3368
|
+
var Skeleton = ({
|
3369
|
+
width,
|
3370
|
+
height,
|
3371
|
+
display = "block",
|
3372
|
+
className,
|
3373
|
+
animate = true,
|
3374
|
+
rounded = false
|
3375
|
+
}) => {
|
3376
|
+
const styles = {
|
3377
|
+
width: isNumber(width) ? `${width}px` : width,
|
3378
|
+
height: isNumber(height) ? `${height}px` : height
|
3379
|
+
};
|
3380
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
3381
|
+
style: styles,
|
3382
|
+
className: classNames(
|
3383
|
+
tw("bg-grey-5", {
|
3384
|
+
"rounded-full": rounded,
|
3385
|
+
"block": display === "block",
|
3386
|
+
"inline-block": display === "inline-block",
|
3387
|
+
"animate-pulse": animate
|
3388
|
+
}),
|
3389
|
+
className
|
3390
|
+
)
|
3391
|
+
});
|
3392
|
+
};
|
3393
|
+
|
3394
|
+
// src/components/Badge/Badge.tsx
|
3395
|
+
var isChipBadgeProps = (props) => "dense" in props;
|
3396
|
+
var createBadge = (type, displayName) => {
|
3397
|
+
const Component = (props) => {
|
3398
|
+
var _b;
|
3399
|
+
const _a = props, { kind = "filled", value, textClassname } = _a, rest = __objRest(_a, ["kind", "value", "textClassname"]);
|
3400
|
+
const valueStr = value.toString();
|
3401
|
+
const dense = isChipBadgeProps(props) ? (_b = props.dense) != null ? _b : false : false;
|
3402
|
+
return /* @__PURE__ */ React21.createElement("span", __spreadProps(__spreadValues({}, omit(rest, "dense")), {
|
3403
|
+
className: tw("inline-block text-center", {
|
3404
|
+
"rounded-full": type === "default" || type === "chip",
|
3405
|
+
"rounded": type === "tab",
|
3406
|
+
"border border-current": kind === "outlined",
|
3407
|
+
"bg-current": kind === "filled" && type !== "chip",
|
3408
|
+
"bg-white": type === "chip",
|
3409
|
+
"typography-caption-small leading-none py-1 px-2": !dense,
|
3410
|
+
"text-[8px]": dense,
|
3411
|
+
"px-1": dense && valueStr.length > 1,
|
3412
|
+
"px-[4px]": dense && valueStr.length === 1
|
3413
|
+
})
|
3414
|
+
}), /* @__PURE__ */ React21.createElement("span", {
|
3415
|
+
className: classNames(
|
3416
|
+
textClassname,
|
3417
|
+
tw("inline-block", {
|
3418
|
+
"text-white": !textClassname && kind === "filled",
|
3419
|
+
"m-[1px]": kind === "filled"
|
3420
|
+
})
|
3421
|
+
)
|
3422
|
+
}, valueStr));
|
3423
|
+
};
|
3424
|
+
Component.displayName = displayName;
|
3425
|
+
Component.Skeleton = () => /* @__PURE__ */ React21.createElement(Skeleton, {
|
3426
|
+
height: 16,
|
3427
|
+
width: 16,
|
3428
|
+
display: "inline-block",
|
3429
|
+
className: tw(type === "tab" ? "rounded" : "rounded-full")
|
3430
|
+
});
|
3431
|
+
return Component;
|
3432
|
+
};
|
3433
|
+
var Badge = createBadge("default", "Badge");
|
3434
|
+
var TabBadge = createBadge("tab", "TabBadge");
|
3435
|
+
var ChipBadge = createBadge("chip", "ChipBadge");
|
3436
|
+
|
3437
|
+
// src/components/Alert/Alert.tsx
|
3438
|
+
import React22 from "react";
|
3439
|
+
import omit2 from "lodash/omit";
|
3440
|
+
|
3441
|
+
// src/components/Avatar/Avatar.tsx
|
3442
|
+
import React26 from "react";
|
3443
|
+
|
3444
|
+
// src/components/Box/Box.tsx
|
3445
|
+
import React25 from "react";
|
3446
|
+
|
3447
|
+
// src/components/Element/Element.tsx
|
3448
|
+
import React23 from "react";
|
3449
|
+
var Element = (_a) => {
|
3450
|
+
var _b = _a, { component } = _b, rest = __objRest(_b, ["component"]);
|
3451
|
+
const Component = component || "div";
|
3452
|
+
return React23.createElement(Component, rest);
|
3453
|
+
};
|
3454
|
+
|
3455
|
+
// src/components/Box/Box.tsx
|
3456
|
+
import isUndefined6 from "lodash/isUndefined";
|
3457
|
+
|
3458
|
+
// src/utils/createComponent.tsx
|
3459
|
+
import React24 from "react";
|
3460
|
+
var hasClassName = (val) => {
|
3461
|
+
return val.className !== void 0;
|
3462
|
+
};
|
3463
|
+
var createSimpleComponent = (Component, defaultProps, displayName) => {
|
3464
|
+
const defaultClassName = hasClassName(defaultProps) ? defaultProps.className : "";
|
3465
|
+
const Curried = (props) => {
|
3466
|
+
const propsClassName = hasClassName(props) ? props.className : "";
|
3467
|
+
const className = defaultClassName || propsClassName ? classNames(defaultClassName, propsClassName) : void 0;
|
3468
|
+
return /* @__PURE__ */ React24.createElement(Component, __spreadProps(__spreadValues(__spreadValues({}, defaultProps), props), {
|
3469
|
+
className
|
3470
|
+
}));
|
3471
|
+
};
|
3472
|
+
Curried.displayName = displayName;
|
3473
|
+
return Curried;
|
3474
|
+
};
|
3475
|
+
|
3476
|
+
// src/components/Box/Box.tsx
|
3477
|
+
var Box = (_a) => {
|
3478
|
+
var _b = _a, {
|
3479
|
+
style,
|
3480
|
+
color,
|
3481
|
+
borderColor,
|
3482
|
+
borderRadius,
|
3483
|
+
borderWidth,
|
3484
|
+
justifyContent,
|
3485
|
+
alignContent,
|
3486
|
+
alignItems,
|
3487
|
+
alignSelf,
|
3488
|
+
flexDirection,
|
3489
|
+
flexWrap,
|
3490
|
+
flex,
|
3491
|
+
grow,
|
3492
|
+
shrink,
|
3493
|
+
display,
|
3494
|
+
padding,
|
3495
|
+
paddingX,
|
3496
|
+
paddingY,
|
3497
|
+
paddingTop,
|
3498
|
+
paddingRight,
|
3499
|
+
paddingBottom,
|
3500
|
+
paddingLeft,
|
3501
|
+
margin,
|
3502
|
+
marginX,
|
3503
|
+
marginY,
|
3504
|
+
marginTop,
|
3505
|
+
marginRight,
|
3506
|
+
marginBottom,
|
3507
|
+
marginLeft,
|
3508
|
+
backgroundColor,
|
3509
|
+
width,
|
3510
|
+
height,
|
3511
|
+
maxWidth,
|
3512
|
+
maxHeight,
|
3513
|
+
minWidth,
|
3514
|
+
minHeight,
|
3515
|
+
gap,
|
3516
|
+
colGap,
|
3517
|
+
rowGap
|
3518
|
+
} = _b, rest = __objRest(_b, [
|
3519
|
+
"style",
|
3520
|
+
"color",
|
3521
|
+
"borderColor",
|
3522
|
+
"borderRadius",
|
3523
|
+
"borderWidth",
|
3524
|
+
"justifyContent",
|
3525
|
+
"alignContent",
|
3526
|
+
"alignItems",
|
3527
|
+
"alignSelf",
|
3528
|
+
"flexDirection",
|
3529
|
+
"flexWrap",
|
3530
|
+
"flex",
|
3531
|
+
"grow",
|
3532
|
+
"shrink",
|
3533
|
+
"display",
|
3534
|
+
"padding",
|
3535
|
+
"paddingX",
|
3536
|
+
"paddingY",
|
3537
|
+
"paddingTop",
|
3538
|
+
"paddingRight",
|
3539
|
+
"paddingBottom",
|
3540
|
+
"paddingLeft",
|
3541
|
+
"margin",
|
3542
|
+
"marginX",
|
3543
|
+
"marginY",
|
3544
|
+
"marginTop",
|
3545
|
+
"marginRight",
|
3546
|
+
"marginBottom",
|
3547
|
+
"marginLeft",
|
3548
|
+
"backgroundColor",
|
3549
|
+
"width",
|
3550
|
+
"height",
|
3551
|
+
"maxWidth",
|
3552
|
+
"maxHeight",
|
3553
|
+
"minWidth",
|
3554
|
+
"minHeight",
|
3555
|
+
"gap",
|
3556
|
+
"colGap",
|
3557
|
+
"rowGap"
|
3558
|
+
]);
|
3559
|
+
const styles = useStyle({
|
3560
|
+
padding,
|
3561
|
+
display,
|
3562
|
+
color,
|
3563
|
+
borderColor: borderColor ? tailwind_theme_default.backgroundColor[borderColor] : "",
|
3564
|
+
borderRadius,
|
3565
|
+
borderWidth,
|
3566
|
+
justifyContent,
|
3567
|
+
alignContent,
|
3568
|
+
alignItems,
|
3569
|
+
alignSelf,
|
3570
|
+
flexDirection,
|
3571
|
+
flexWrap,
|
3572
|
+
paddingTop: isUndefined6(paddingY) ? paddingTop : paddingY,
|
3573
|
+
paddingRight: isUndefined6(paddingX) ? paddingRight : paddingX,
|
3574
|
+
paddingBottom: isUndefined6(paddingY) ? paddingBottom : paddingY,
|
3575
|
+
paddingLeft: isUndefined6(paddingX) ? paddingLeft : paddingX,
|
3576
|
+
margin,
|
3577
|
+
marginTop: isUndefined6(marginY) ? marginTop : marginY,
|
3578
|
+
marginRight: isUndefined6(marginX) ? marginRight : marginX,
|
3579
|
+
marginBottom: isUndefined6(marginY) ? marginBottom : marginY,
|
3580
|
+
marginLeft: isUndefined6(marginX) ? marginLeft : marginX,
|
3581
|
+
backgroundColor,
|
3582
|
+
width,
|
3583
|
+
height,
|
3584
|
+
maxWidth,
|
3585
|
+
maxHeight,
|
3586
|
+
minWidth,
|
3587
|
+
minHeight,
|
3588
|
+
flexGrow: grow,
|
3589
|
+
flexShrink: shrink,
|
3590
|
+
flex,
|
3591
|
+
gap,
|
3592
|
+
columnGap: colGap,
|
3593
|
+
rowGap
|
3594
|
+
});
|
3595
|
+
return /* @__PURE__ */ React25.createElement(Element, __spreadValues({
|
3596
|
+
style: __spreadValues(__spreadValues({}, styles), style)
|
3597
|
+
}, rest));
|
3598
|
+
};
|
3599
|
+
var BorderBox = createSimpleComponent(
|
3600
|
+
Box,
|
3601
|
+
{ className: "rounded border", borderColor: "grey-10" },
|
3602
|
+
"BorderBox"
|
3603
|
+
);
|
3604
|
+
|
3605
|
+
// src/components/Avatar/Avatar.tsx
|
3606
|
+
var AvatarStack = ({ images }) => /* @__PURE__ */ React26.createElement(Box, {
|
3607
|
+
display: "flex",
|
3608
|
+
className: tw("[&>*:not(:first-child)]:-ml-3")
|
3609
|
+
}, images.map((image) => image ? /* @__PURE__ */ React26.createElement(Avatar, {
|
3610
|
+
key: image,
|
3611
|
+
image
|
3612
|
+
}) : /* @__PURE__ */ React26.createElement(Avatar.Skeleton, {
|
3613
|
+
key: image
|
3614
|
+
})));
|
3615
|
+
var Avatar = ({ image }) => /* @__PURE__ */ React26.createElement("img", {
|
3616
|
+
src: image,
|
3617
|
+
className: classNames(tw("w-[32px] h-[32px]"))
|
3618
|
+
});
|
3619
|
+
var AvatarSkeleton = () => /* @__PURE__ */ React26.createElement(Skeleton, {
|
3620
|
+
height: 32,
|
3621
|
+
width: 32,
|
3622
|
+
className: tw("rounded-full")
|
3623
|
+
});
|
3624
|
+
Avatar.Skeleton = AvatarSkeleton;
|
3625
|
+
|
3626
|
+
// src/components/Banner/Banner.tsx
|
3627
|
+
import React28 from "react";
|
3628
|
+
|
3629
|
+
// src/common/Banner/Banner.tsx
|
3630
|
+
import React27 from "react";
|
3631
|
+
var spacing = {
|
3632
|
+
spacingAroundBanner: "p-6",
|
3633
|
+
omitSpacingAroundBanner: "-6"
|
3634
|
+
};
|
3635
|
+
var Banner = (_a) => {
|
3636
|
+
var _b = _a, {
|
3637
|
+
children,
|
3638
|
+
className,
|
3639
|
+
layout,
|
3640
|
+
variant
|
3641
|
+
} = _b, rest = __objRest(_b, [
|
3642
|
+
"children",
|
3643
|
+
"className",
|
3644
|
+
"layout",
|
3645
|
+
"variant"
|
3646
|
+
]);
|
3647
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
3648
|
+
className: classNames(
|
3649
|
+
className,
|
3650
|
+
tw(`rounded flex justify-between gap-7 flex-nowrap ${spacing.spacingAroundBanner}`, {
|
3651
|
+
"items-center": layout === "horizontal",
|
3652
|
+
"bg-grey-0": variant === "default",
|
3653
|
+
"bg-white border border-grey-5": variant === "outlined"
|
3654
|
+
})
|
3655
|
+
)
|
3203
3656
|
}), children);
|
3204
3657
|
};
|
3205
|
-
|
3206
|
-
var _b = _a, { children,
|
3207
|
-
return /* @__PURE__ */
|
3208
|
-
|
3209
|
-
|
3658
|
+
Banner.Title = (_a) => {
|
3659
|
+
var _b = _a, { children, className, layout, titleVariant = "primary" } = _b, rest = __objRest(_b, ["children", "className", "layout", "titleVariant"]);
|
3660
|
+
return /* @__PURE__ */ React27.createElement(Typography, __spreadProps(__spreadValues({}, rest), {
|
3661
|
+
variant: "heading-large",
|
3662
|
+
fontWeight: 600,
|
3663
|
+
color: titleVariant === "secondary" ? "primary-80" : "grey-100",
|
3664
|
+
className: classNames(
|
3665
|
+
className,
|
3666
|
+
tw("whitespace-nowrap", {
|
3667
|
+
"mb-3": layout === "vertical"
|
3668
|
+
})
|
3669
|
+
)
|
3670
|
+
}), children);
|
3210
3671
|
};
|
3211
|
-
|
3212
|
-
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
3213
|
-
return /* @__PURE__ */
|
3672
|
+
Banner.Description = (_a) => {
|
3673
|
+
var _b = _a, { flexGrow, children, className } = _b, rest = __objRest(_b, ["flexGrow", "children", "className"]);
|
3674
|
+
return /* @__PURE__ */ React27.createElement(Typography, __spreadProps(__spreadValues({}, rest), {
|
3675
|
+
variant: "body-default",
|
3676
|
+
color: "grey-90",
|
3677
|
+
className: classNames(className, tw({ "flex-grow": flexGrow }))
|
3678
|
+
}), children);
|
3214
3679
|
};
|
3215
|
-
|
3216
|
-
var
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3680
|
+
Banner.ContentContainer = (_a) => {
|
3681
|
+
var _b = _a, { layout, children, className } = _b, rest = __objRest(_b, ["layout", "children", "className"]);
|
3682
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
3683
|
+
className: classNames(
|
3684
|
+
className,
|
3685
|
+
tw("flex w-full", {
|
3686
|
+
"flex-col": layout === "vertical",
|
3687
|
+
"flex-row flex-nowrap gap-7 items-center": layout === "horizontal"
|
3688
|
+
})
|
3689
|
+
)
|
3220
3690
|
}), children);
|
3221
3691
|
};
|
3222
|
-
|
3223
|
-
var
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3692
|
+
Banner.ImageContainer = (_a) => {
|
3693
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
3694
|
+
return /* @__PURE__ */ React27.createElement(Box, __spreadProps(__spreadValues({}, rest), {
|
3695
|
+
display: "inline-flex",
|
3696
|
+
alignItems: "center",
|
3697
|
+
margin: spacing.omitSpacingAroundBanner,
|
3698
|
+
marginLeft: "0"
|
3699
|
+
}), children);
|
3228
3700
|
};
|
3229
|
-
|
3230
|
-
var _b = _a, { children, className,
|
3231
|
-
|
3232
|
-
|
3701
|
+
Banner.Actions = (_a) => {
|
3702
|
+
var _b = _a, { children, className, layout } = _b, rest = __objRest(_b, ["children", "className", "layout"]);
|
3703
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
3704
|
+
className: classNames(className, tw("flex gap-4", { "mt-5": layout === "vertical" }))
|
3705
|
+
}), children);
|
3706
|
+
};
|
3707
|
+
Banner.DismissContainer = (_a) => {
|
3708
|
+
var _b = _a, { layout, children, className } = _b, rest = __objRest(_b, ["layout", "children", "className"]);
|
3709
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
3233
3710
|
className: classNames(
|
3234
|
-
|
3235
|
-
|
3236
|
-
getAlignClassNames(align),
|
3237
|
-
className
|
3711
|
+
className,
|
3712
|
+
tw({ "self-start": layout === "vertical", "self-center": layout === "horizontal" })
|
3238
3713
|
)
|
3239
|
-
}), children) : /* @__PURE__ */ React20.createElement("td", __spreadProps(__spreadValues({}, rest), {
|
3240
|
-
className: classNames(cellClassNames, bodyCellClassNames, getAlignClassNames(align), className)
|
3241
3714
|
}), children);
|
3242
3715
|
};
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3716
|
+
|
3717
|
+
// src/components/Banner/Banner.tsx
|
3718
|
+
var import_cross2 = __toESM(require_cross());
|
3719
|
+
import omit3 from "lodash/omit";
|
3720
|
+
var BannerImageSkeleton = () => /* @__PURE__ */ React28.createElement(Skeleton, {
|
3721
|
+
width: 225,
|
3722
|
+
className: tw("h-full")
|
3723
|
+
});
|
3724
|
+
var createBanner = (displayName, opts = {}) => {
|
3725
|
+
const BannerComponent = (props) => {
|
3726
|
+
const { title, description, layout: layoutProp, action, onDismiss, variant = "default" } = props;
|
3727
|
+
const layout = opts.isOneLineBanner ? "horizontal" : layoutProp || "vertical";
|
3728
|
+
const isDismissable = onDismiss !== void 0;
|
3729
|
+
return /* @__PURE__ */ React28.createElement(Banner, {
|
3730
|
+
layout,
|
3731
|
+
variant
|
3732
|
+
}, /* @__PURE__ */ React28.createElement(Banner.ContentContainer, {
|
3733
|
+
layout
|
3734
|
+
}, /* @__PURE__ */ React28.createElement(Banner.Title, {
|
3735
|
+
layout,
|
3736
|
+
titleVariant: opts.isOneLineBanner ? "secondary" : "primary"
|
3737
|
+
}, title), /* @__PURE__ */ React28.createElement(Banner.Description, {
|
3738
|
+
flexGrow: isDismissable ? false : true
|
3739
|
+
}, description), action && /* @__PURE__ */ React28.createElement(Banner.Actions, {
|
3740
|
+
layout
|
3741
|
+
}, /* @__PURE__ */ React28.createElement(GhostButton, __spreadValues({
|
3742
|
+
dense: true
|
3743
|
+
}, omit3(action, "text")), action.text))), (props.layout === "vertical" || props.layout === void 0) && props.image !== void 0 && /* @__PURE__ */ React28.createElement(Banner.ImageContainer, null, props.image ? /* @__PURE__ */ React28.createElement("img", {
|
3744
|
+
src: props.image,
|
3745
|
+
alt: props.imageAlt,
|
3746
|
+
className: tw("w-full bg-cover object-cover"),
|
3747
|
+
style: { width: props.imageWidth, height: props.imageHeight }
|
3748
|
+
}) : /* @__PURE__ */ React28.createElement(BannerImageSkeleton, null)), isDismissable && /* @__PURE__ */ React28.createElement(Banner.DismissContainer, {
|
3749
|
+
layout
|
3750
|
+
}, /* @__PURE__ */ React28.createElement(IconButton, {
|
3751
|
+
type: "button",
|
3752
|
+
tooltip: "Dismiss",
|
3753
|
+
icon: import_cross2.default,
|
3754
|
+
onClick: onDismiss
|
3755
|
+
})));
|
3756
|
+
};
|
3757
|
+
BannerComponent.displayName = displayName;
|
3758
|
+
return BannerComponent;
|
3252
3759
|
};
|
3253
|
-
var
|
3254
|
-
var
|
3255
|
-
|
3760
|
+
var Banner2 = createBanner("Banner");
|
3761
|
+
var OneLineBannerBase = createBanner("OneLineBanner", {
|
3762
|
+
isOneLineBanner: true
|
3763
|
+
});
|
3764
|
+
|
3765
|
+
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
3766
|
+
import React29 from "react";
|
3767
|
+
var import_slash = __toESM(require_slash());
|
3768
|
+
import classNames2 from "classnames";
|
3769
|
+
var Breadcrumbs = (props) => {
|
3770
|
+
const { children, className } = props;
|
3771
|
+
const crumbs = React29.Children.toArray(children).filter(
|
3772
|
+
(c) => Boolean(c)
|
3773
|
+
);
|
3774
|
+
return /* @__PURE__ */ React29.createElement("nav", {
|
3775
|
+
className,
|
3776
|
+
"aria-label": "Breadcrumbs"
|
3777
|
+
}, /* @__PURE__ */ React29.createElement("ol", {
|
3778
|
+
className: tw("flex flex-row flex-nowrap items-center typography-caption-default")
|
3779
|
+
}, crumbs.map((crumb, index) => {
|
3780
|
+
const isLast = index === crumbs.length - 1;
|
3781
|
+
return /* @__PURE__ */ React29.createElement("li", {
|
3782
|
+
key: index,
|
3783
|
+
className: tw("flex flex-row items-center")
|
3784
|
+
}, !!index && /* @__PURE__ */ React29.createElement(Icon, {
|
3785
|
+
"aria-hidden": true,
|
3786
|
+
className: tw("mx-2 text-grey-30"),
|
3787
|
+
icon: import_slash.default
|
3788
|
+
}), !isLast && crumb, isLast && /* @__PURE__ */ React29.createElement(ActiveCrumb, {
|
3789
|
+
"aria-disabled": true,
|
3790
|
+
"aria-current": "page",
|
3791
|
+
icon: crumb.props.icon
|
3792
|
+
}, crumb.props.children));
|
3793
|
+
})));
|
3256
3794
|
};
|
3257
|
-
var
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3795
|
+
var asCrumb = (Component, displayName, options = { isActive: false }) => {
|
3796
|
+
const Crumb2 = React29.forwardRef((_a, ref) => {
|
3797
|
+
var _b = _a, { icon, children } = _b, rest = __objRest(_b, ["icon", "children"]);
|
3798
|
+
return /* @__PURE__ */ React29.createElement(Component, __spreadProps(__spreadValues({
|
3799
|
+
ref
|
3800
|
+
}, rest), {
|
3801
|
+
role: "link"
|
3802
|
+
}), /* @__PURE__ */ React29.createElement("span", {
|
3803
|
+
className: classNames2(
|
3804
|
+
tw("flex flex-row flex-nowrap items-center gap-x-3 ", {
|
3805
|
+
"text-primary-80 underline underline-offset-2 hover:no-underline hover:text-primary-70": !options.isActive,
|
3806
|
+
"text-grey-90": options.isActive
|
3807
|
+
})
|
3808
|
+
)
|
3809
|
+
}, icon && /* @__PURE__ */ React29.createElement(Icon, {
|
3810
|
+
icon
|
3811
|
+
}), children));
|
3812
|
+
});
|
3813
|
+
Crumb2.displayName = displayName;
|
3814
|
+
return Crumb2;
|
3815
|
+
};
|
3816
|
+
var Crumb = asCrumb("a", "Crumb");
|
3817
|
+
var ActiveCrumb = asCrumb("span", "ActiveCrumb", { isActive: true });
|
3818
|
+
Breadcrumbs.Crumb = Crumb;
|
3819
|
+
|
3820
|
+
// src/components/Card/Card.tsx
|
3821
|
+
import React31 from "react";
|
3822
|
+
|
3823
|
+
// src/components/Chip/Chip.tsx
|
3824
|
+
import React30 from "react";
|
3825
|
+
import isNumber2 from "lodash/isNumber";
|
3826
|
+
var import_cross3 = __toESM(require_cross());
|
3827
|
+
var import_lock = __toESM(require_lock());
|
3828
|
+
|
3829
|
+
// types/utils.ts
|
3830
|
+
import { isValidElement } from "react";
|
3831
|
+
var isComponentType = (c, type) => isValidElement(c) && c.type === type;
|
3832
|
+
|
3833
|
+
// src/components/Chip/Chip.tsx
|
3834
|
+
var getStatusClassNames = (status = "neutral") => {
|
3835
|
+
switch (status) {
|
3836
|
+
case "info":
|
3837
|
+
return tw("text-info-100 bg-info-5");
|
3838
|
+
case "warning":
|
3839
|
+
return tw("text-secondary-80 bg-secondary-5");
|
3840
|
+
case "danger":
|
3841
|
+
return tw("text-error-100 bg-error-5");
|
3842
|
+
case "success":
|
3843
|
+
return tw("text-success-100 bg-success-5");
|
3844
|
+
case "neutral":
|
3845
|
+
default:
|
3846
|
+
return tw("text-grey-70 bg-grey-5");
|
3847
|
+
}
|
3848
|
+
};
|
3849
|
+
var Chip2 = (_a) => {
|
3850
|
+
var _b = _a, {
|
3851
|
+
icon,
|
3852
|
+
text,
|
3853
|
+
dense = false,
|
3854
|
+
locked = false,
|
3855
|
+
badge,
|
3856
|
+
onClose
|
3857
|
+
} = _b, rest = __objRest(_b, [
|
3858
|
+
"icon",
|
3859
|
+
"text",
|
3860
|
+
"dense",
|
3861
|
+
"locked",
|
3862
|
+
"badge",
|
3863
|
+
"onClose"
|
3864
|
+
]);
|
3865
|
+
return /* @__PURE__ */ React30.createElement(Chip.Container, __spreadValues({
|
3866
|
+
dense,
|
3867
|
+
className: tw({
|
3868
|
+
"bg-grey-0 text-grey-70": !locked,
|
3869
|
+
"bg-grey-5 text-grey-40": locked
|
3870
|
+
})
|
3871
|
+
}, rest), icon && /* @__PURE__ */ React30.createElement(InlineIcon, {
|
3872
|
+
icon
|
3873
|
+
}), text, isNumber2(badge) && /* @__PURE__ */ React30.createElement(ChipBadge, {
|
3874
|
+
dense,
|
3875
|
+
value: badge,
|
3876
|
+
textClassname: tw("text-grey-50")
|
3877
|
+
}), onClose && /* @__PURE__ */ React30.createElement(InlineIcon, {
|
3878
|
+
role: "button",
|
3879
|
+
"aria-hidden": false,
|
3880
|
+
icon: import_cross3.default,
|
3881
|
+
className: tw({ "cursor-pointer": onClose !== void 0 }),
|
3882
|
+
onClick: () => onClose == null ? void 0 : onClose()
|
3883
|
+
}), locked && /* @__PURE__ */ React30.createElement(InlineIcon, {
|
3884
|
+
icon: import_lock.default
|
3885
|
+
}));
|
3886
|
+
};
|
3887
|
+
var ChipSkeleton = ({ dense = false, width = dense ? 34 : 56 }) => /* @__PURE__ */ React30.createElement(Skeleton, {
|
3888
|
+
width,
|
3889
|
+
height: dense ? 20 : 28
|
3890
|
+
});
|
3891
|
+
Chip2.Skeleton = ChipSkeleton;
|
3892
|
+
var StatusChip = React30.forwardRef(
|
3893
|
+
(_a, ref) => {
|
3894
|
+
var _b = _a, { UNSAFE_icon: icon, text, dense = false, status } = _b, rest = __objRest(_b, ["UNSAFE_icon", "text", "dense", "status"]);
|
3895
|
+
return /* @__PURE__ */ React30.createElement(Chip.Container, __spreadProps(__spreadValues({
|
3896
|
+
ref,
|
3897
|
+
dense
|
3898
|
+
}, rest), {
|
3899
|
+
className: getStatusClassNames(status)
|
3900
|
+
}), icon && /* @__PURE__ */ React30.createElement(InlineIcon, {
|
3901
|
+
icon
|
3902
|
+
}), text);
|
3903
|
+
}
|
3904
|
+
);
|
3905
|
+
var ChipContainer = ({ dense, children }) => /* @__PURE__ */ React30.createElement("div", {
|
3906
|
+
className: tw("flex items-center", {
|
3907
|
+
"gap-x-3": !dense,
|
3908
|
+
"gap-x-2": Boolean(dense)
|
3909
|
+
})
|
3910
|
+
}, React30.Children.map(
|
3911
|
+
children,
|
3912
|
+
(child) => isComponentType(child, Chip2) || isComponentType(child, StatusChip) ? React30.cloneElement(child, { dense }) : void 0
|
3913
|
+
));
|
3914
|
+
|
3915
|
+
// src/components/Card/Card.tsx
|
3916
|
+
import omit4 from "lodash/omit";
|
3917
|
+
var Card = ({
|
3918
|
+
title,
|
3919
|
+
description,
|
3920
|
+
chips = [],
|
3921
|
+
icons = [],
|
3922
|
+
image,
|
3923
|
+
imageAlt,
|
3924
|
+
color,
|
3925
|
+
action,
|
3926
|
+
link,
|
3927
|
+
onClick,
|
3928
|
+
disabled
|
3929
|
+
}) => /* @__PURE__ */ React31.createElement(CardContainer, {
|
3930
|
+
onClick,
|
3931
|
+
color,
|
3932
|
+
disabled
|
3933
|
+
}, chips.length > 0 && /* @__PURE__ */ React31.createElement(ChipContainer, {
|
3934
|
+
dense: true
|
3935
|
+
}, chips.map((chip) => /* @__PURE__ */ React31.createElement(Chip2, {
|
3936
|
+
key: chip,
|
3937
|
+
text: chip
|
3938
|
+
}))), icons.length > 0 && /* @__PURE__ */ React31.createElement(AvatarStack, {
|
3939
|
+
images: icons
|
3940
|
+
}), image !== void 0 && /* @__PURE__ */ React31.createElement(CardImage, {
|
3941
|
+
image,
|
3942
|
+
imageAlt,
|
3943
|
+
fullSize: chips.length === 0
|
3944
|
+
}), /* @__PURE__ */ React31.createElement(CardContent, null, /* @__PURE__ */ React31.createElement(CardTitle, null, title), /* @__PURE__ */ React31.createElement(CardBody, null, description)), (action || link) && /* @__PURE__ */ React31.createElement(CardActions, null, action && /* @__PURE__ */ React31.createElement(SecondaryButton, __spreadValues({
|
3945
|
+
dense: true
|
3946
|
+
}, omit4(action, "text")), action.text), link && /* @__PURE__ */ React31.createElement(ExternalLinkButton, __spreadValues({
|
3947
|
+
dense: true,
|
3948
|
+
kind: "ghost"
|
3949
|
+
}, omit4(link, "text")), link.text)));
|
3950
|
+
var CardSkeleton = ({ chips = true, icons = false, image = !icons, actions = true }) => /* @__PURE__ */ React31.createElement(CardContainer, null, chips && /* @__PURE__ */ React31.createElement(ChipContainer, {
|
3951
|
+
dense: true
|
3952
|
+
}, Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ React31.createElement(Chip2.Skeleton, {
|
3953
|
+
key: idx
|
3954
|
+
}))), icons && /* @__PURE__ */ React31.createElement(AvatarStack, {
|
3955
|
+
images: [null]
|
3956
|
+
}), image && /* @__PURE__ */ React31.createElement(CardImage, {
|
3957
|
+
image: null,
|
3958
|
+
fullSize: !chips
|
3959
|
+
}), /* @__PURE__ */ React31.createElement(CardContent, null, /* @__PURE__ */ React31.createElement(Skeleton, {
|
3960
|
+
width: 145,
|
3961
|
+
height: 25
|
3962
|
+
}), /* @__PURE__ */ React31.createElement(Skeleton, {
|
3963
|
+
width: 145,
|
3964
|
+
height: 16
|
3965
|
+
})), actions && /* @__PURE__ */ React31.createElement(CardActions, null, /* @__PURE__ */ React31.createElement(Skeleton, {
|
3966
|
+
width: 115,
|
3967
|
+
height: 25
|
3968
|
+
}), /* @__PURE__ */ React31.createElement(Skeleton, {
|
3969
|
+
width: 60,
|
3970
|
+
height: 25
|
3971
|
+
})));
|
3972
|
+
Card.Skeleton = CardSkeleton;
|
3973
|
+
var CardContainer = ({
|
3974
|
+
children,
|
3975
|
+
onClick,
|
3976
|
+
color,
|
3977
|
+
disabled
|
3978
|
+
}) => /* @__PURE__ */ React31.createElement(Box, {
|
3979
|
+
borderWidth: 1,
|
3980
|
+
borderRadius: 2,
|
3981
|
+
className: classNames(
|
3982
|
+
tw("w-[280px] border-grey-5 focus:border-info-70", {
|
3983
|
+
"active:bg-grey-5 cursor-pointer hover:border-grey-50": Boolean(onClick && !disabled),
|
3984
|
+
"bg-grey-0 cursor-not-allowed focus:border-transparent": Boolean(disabled)
|
3985
|
+
})
|
3986
|
+
),
|
3987
|
+
onClick: disabled ? void 0 : onClick,
|
3988
|
+
tabIndex: onClick ? 0 : -1,
|
3989
|
+
disabled
|
3990
|
+
}, color && /* @__PURE__ */ React31.createElement(Box, {
|
3991
|
+
backgroundColor: color,
|
3992
|
+
height: "1",
|
3993
|
+
width: "full"
|
3994
|
+
}), /* @__PURE__ */ React31.createElement(Box, {
|
3995
|
+
padding: "5",
|
3996
|
+
display: "flex",
|
3997
|
+
flexDirection: "column",
|
3998
|
+
gap: "5"
|
3999
|
+
}, children));
|
4000
|
+
var CardImage = ({ image, imageAlt, fullSize }) => /* @__PURE__ */ React31.createElement(Box, {
|
4001
|
+
marginX: "-4",
|
4002
|
+
marginTop: fullSize ? "-4" : void 0
|
4003
|
+
}, image ? /* @__PURE__ */ React31.createElement("img", {
|
4004
|
+
src: image,
|
4005
|
+
alt: imageAlt,
|
4006
|
+
className: tw("w-full bg-cover object-cover h-[174px]", {
|
4007
|
+
"h-[225px]": fullSize
|
4008
|
+
})
|
4009
|
+
}) : /* @__PURE__ */ React31.createElement(CardImage.Skeleton, {
|
4010
|
+
fullSize
|
4011
|
+
}));
|
4012
|
+
var CardImageSkeleton = ({ fullSize }) => /* @__PURE__ */ React31.createElement(Skeleton, {
|
4013
|
+
height: fullSize ? 225 : 174,
|
4014
|
+
className: tw("w-full")
|
4015
|
+
});
|
4016
|
+
CardImage.Skeleton = CardImageSkeleton;
|
4017
|
+
var CardContent = ({ children }) => /* @__PURE__ */ React31.createElement(Box, {
|
4018
|
+
display: "flex",
|
4019
|
+
flexDirection: "column",
|
4020
|
+
gap: "4"
|
4021
|
+
}, children);
|
4022
|
+
var CardBody = ({ children }) => /* @__PURE__ */ React31.createElement(Typography2, {
|
4023
|
+
variant: "caption-default",
|
4024
|
+
color: "grey-70"
|
4025
|
+
}, children);
|
4026
|
+
var CardTitle = ({ children }) => /* @__PURE__ */ React31.createElement(Typography2, {
|
4027
|
+
variant: "body-default-medium",
|
4028
|
+
fontWeight: 500
|
4029
|
+
}, children);
|
4030
|
+
var CardActions = ({ children }) => /* @__PURE__ */ React31.createElement(Box, {
|
4031
|
+
paddingTop: "3",
|
4032
|
+
display: "flex",
|
4033
|
+
gap: "3",
|
4034
|
+
alignItems: "center"
|
4035
|
+
}, children);
|
4036
|
+
|
4037
|
+
// src/components/Carousel/Carousel.tsx
|
4038
|
+
import React32, { useRef as useRef2, useLayoutEffect, useState as useState2, useEffect as useEffect3 } from "react";
|
4039
|
+
var import_chevronLeft = __toESM(require_chevronLeft());
|
4040
|
+
var import_chevronRight = __toESM(require_chevronRight());
|
4041
|
+
|
4042
|
+
// src/components/Checkbox/Checkbox.tsx
|
4043
|
+
import React34 from "react";
|
4044
|
+
|
4045
|
+
// src/components/ControlLabel/ControlLabel.tsx
|
4046
|
+
import React33 from "react";
|
4047
|
+
var ControlLabel = (_a) => {
|
4048
|
+
var _b = _a, {
|
4049
|
+
label,
|
4050
|
+
caption,
|
4051
|
+
disabled = false,
|
4052
|
+
readOnly = false,
|
4053
|
+
children,
|
4054
|
+
style
|
4055
|
+
} = _b, rest = __objRest(_b, [
|
4056
|
+
"label",
|
4057
|
+
"caption",
|
4058
|
+
"disabled",
|
4059
|
+
"readOnly",
|
4060
|
+
"children",
|
4061
|
+
"style"
|
4062
|
+
]);
|
4063
|
+
const textClass = disabled ? "text-grey-40" : "text-grey-100";
|
4064
|
+
return /* @__PURE__ */ React33.createElement("label", __spreadValues({
|
4065
|
+
className: tw(
|
4066
|
+
"inline-grid grid-cols-[auto_1fr]",
|
4067
|
+
{
|
4068
|
+
"cursor-pointer": !disabled && !readOnly,
|
4069
|
+
"cursor-not-allowed": disabled
|
4070
|
+
},
|
4071
|
+
textClass
|
4072
|
+
),
|
4073
|
+
style: __spreadValues({}, style)
|
4074
|
+
}, rest), children, label && /* @__PURE__ */ React33.createElement("span", {
|
4075
|
+
className: tw("typography-body-small self-center")
|
4076
|
+
}, label), caption && /* @__PURE__ */ React33.createElement(Typography2, {
|
4077
|
+
className: tw("col-start-2"),
|
4078
|
+
variant: "caption-default",
|
4079
|
+
color: disabled ? "grey-40" : "grey-50"
|
4080
|
+
}, caption));
|
4081
|
+
};
|
4082
|
+
|
4083
|
+
// src/components/Checkbox/Checkbox.tsx
|
4084
|
+
var Checkbox2 = React34.forwardRef(
|
4085
|
+
(_a, ref) => {
|
4086
|
+
var _b = _a, {
|
4087
|
+
id,
|
4088
|
+
name,
|
4089
|
+
caption,
|
4090
|
+
checked: _checked,
|
4091
|
+
defaultChecked,
|
4092
|
+
onChange,
|
4093
|
+
readOnly = false,
|
4094
|
+
disabled = false,
|
4095
|
+
children,
|
4096
|
+
"aria-label": ariaLabel
|
4097
|
+
} = _b, props = __objRest(_b, [
|
4098
|
+
"id",
|
4099
|
+
"name",
|
4100
|
+
"caption",
|
4101
|
+
"checked",
|
4102
|
+
"defaultChecked",
|
4103
|
+
"onChange",
|
4104
|
+
"readOnly",
|
4105
|
+
"disabled",
|
4106
|
+
"children",
|
4107
|
+
"aria-label"
|
4108
|
+
]);
|
4109
|
+
var _a2;
|
4110
|
+
const [checked, setChecked] = React34.useState((_a2 = _checked != null ? _checked : defaultChecked) != null ? _a2 : false);
|
4111
|
+
if (_checked !== void 0 && checked !== _checked) {
|
4112
|
+
setChecked(_checked);
|
4113
|
+
}
|
4114
|
+
return !readOnly || checked ? /* @__PURE__ */ React34.createElement(ControlLabel, {
|
4115
|
+
htmlFor: id,
|
4116
|
+
label: children,
|
4117
|
+
"aria-label": ariaLabel,
|
4118
|
+
caption,
|
4119
|
+
readOnly,
|
4120
|
+
disabled,
|
4121
|
+
style: { gap: "0 8px" }
|
4122
|
+
}, !readOnly && /* @__PURE__ */ React34.createElement(Checkbox, __spreadProps(__spreadValues({
|
4123
|
+
id,
|
4124
|
+
ref,
|
4125
|
+
name
|
4126
|
+
}, props), {
|
4127
|
+
checked,
|
4128
|
+
readOnly,
|
4129
|
+
disabled,
|
4130
|
+
onChange: (e) => {
|
4131
|
+
setChecked(e.target.checked);
|
4132
|
+
onChange == null ? void 0 : onChange(e);
|
4133
|
+
}
|
4134
|
+
}))) : null;
|
4135
|
+
}
|
4136
|
+
);
|
4137
|
+
var CheckboxSkeleton = () => /* @__PURE__ */ React34.createElement("div", {
|
4138
|
+
className: tw("flex gap-3")
|
4139
|
+
}, /* @__PURE__ */ React34.createElement(Skeleton, {
|
4140
|
+
height: 20,
|
4141
|
+
width: 20
|
4142
|
+
}), /* @__PURE__ */ React34.createElement(Skeleton, {
|
4143
|
+
height: 20,
|
4144
|
+
width: 150
|
4145
|
+
}));
|
4146
|
+
Checkbox2.Skeleton = CheckboxSkeleton;
|
4147
|
+
|
4148
|
+
// src/components/CheckboxGroup/CheckboxGroup.tsx
|
4149
|
+
import React39, { useState as useState3 } from "react";
|
4150
|
+
import uniqueId from "lodash/uniqueId";
|
4151
|
+
|
4152
|
+
// src/utils/form/Label/Label.tsx
|
4153
|
+
import React38 from "react";
|
4154
|
+
var import_questionMark = __toESM(require_questionMark());
|
4155
|
+
|
4156
|
+
// src/utils/form/FormControl/FormControl.tsx
|
4157
|
+
import React35 from "react";
|
4158
|
+
var FormControl = ({ className, inline, children }) => {
|
4159
|
+
return /* @__PURE__ */ React35.createElement(Flexbox, {
|
4160
|
+
direction: "column",
|
4161
|
+
display: inline ? "inline-flex" : "flex",
|
4162
|
+
className
|
4163
|
+
}, children);
|
4164
|
+
};
|
4165
|
+
|
4166
|
+
// src/utils/form/HelperText/HelperText.tsx
|
4167
|
+
import React37 from "react";
|
4168
|
+
import isNumber3 from "lodash/isNumber";
|
4169
|
+
|
4170
|
+
// src/utils/form/CharCounter/CharCounter.tsx
|
4171
|
+
import React36 from "react";
|
4172
|
+
var CharCounter = ({ dense = true, length, maxLength, valid = true }) => {
|
4173
|
+
return /* @__PURE__ */ React36.createElement("span", {
|
4174
|
+
className: tw(
|
4175
|
+
`whitespace-nowrap`,
|
4176
|
+
valid ? "text-grey-50" : "text-error-70",
|
4177
|
+
dense ? "typography-caption-default" : "typography-body-small"
|
4178
|
+
)
|
4179
|
+
}, `${length} / ${maxLength}`);
|
4180
|
+
};
|
4181
|
+
|
4182
|
+
// src/utils/form/HelperText/HelperText.tsx
|
4183
|
+
import classNames3 from "classnames";
|
4184
|
+
var HelperText = ({
|
4185
|
+
messageId,
|
4186
|
+
error: error2 = false,
|
4187
|
+
helperText,
|
4188
|
+
length,
|
4189
|
+
maxLength,
|
4190
|
+
reserveSpaceForError = true
|
4191
|
+
}) => {
|
4192
|
+
const hasError = error2 && helperText;
|
4193
|
+
const hasMaxLength = isNumber3(maxLength) && maxLength > 0;
|
4194
|
+
const showMessage = hasError || hasMaxLength;
|
4195
|
+
if (!showMessage) {
|
4196
|
+
return reserveSpaceForError ? /* @__PURE__ */ React37.createElement("p", {
|
4197
|
+
className: tw("block mt-1 mb-3 typography-caption-default")
|
4198
|
+
}, "\xA0") : null;
|
4199
|
+
}
|
4200
|
+
return /* @__PURE__ */ React37.createElement(Grid, {
|
4201
|
+
cols: "1",
|
4202
|
+
rows: "1",
|
4203
|
+
colGap: "3",
|
4204
|
+
alignItems: "start",
|
4205
|
+
autoCols: "min",
|
4206
|
+
className: tw("mt-1 mb-3")
|
4207
|
+
}, /* @__PURE__ */ React37.createElement(GridItem, {
|
4208
|
+
colStart: "1",
|
4209
|
+
colEnd: "2"
|
4210
|
+
}, hasError && /* @__PURE__ */ React37.createElement("p", {
|
4211
|
+
id: messageId,
|
4212
|
+
className: tw("text-error-50 block typography-caption-default")
|
4213
|
+
}, helperText)), /* @__PURE__ */ React37.createElement(GridItem, {
|
4214
|
+
colStart: "2",
|
4215
|
+
colEnd: "3",
|
4216
|
+
display: "flex"
|
4217
|
+
}, isNumber3(length) && hasMaxLength && /* @__PURE__ */ React37.createElement(CharCounter, {
|
4218
|
+
length,
|
4219
|
+
maxLength,
|
4220
|
+
valid: !error2
|
4221
|
+
})));
|
4222
|
+
};
|
4223
|
+
var Skeleton2 = ({ className, children }) => /* @__PURE__ */ React37.createElement("div", {
|
4224
|
+
className: classNames3(className, "h-[25px]")
|
4225
|
+
}, children);
|
4226
|
+
HelperText.Skeleton = Skeleton2;
|
4227
|
+
|
4228
|
+
// src/utils/form/Label/Label.tsx
|
4229
|
+
var LabelText = ({
|
4230
|
+
variant = "default",
|
4231
|
+
labelText,
|
4232
|
+
required,
|
4233
|
+
helpTooltip,
|
4234
|
+
helpTooltipPlacement
|
4235
|
+
}) => {
|
4236
|
+
return /* @__PURE__ */ React38.createElement("span", {
|
4237
|
+
className: tw("inline-block mb-2 font-medium typography-body-small", {
|
4238
|
+
"text-grey-60": variant === "default",
|
4239
|
+
"text-error-50": variant === "error",
|
4240
|
+
"text-grey-40": variant === "disabled"
|
4241
|
+
})
|
4242
|
+
}, labelText, required && /* @__PURE__ */ React38.createElement("span", {
|
4243
|
+
className: tw("text-error-50")
|
4244
|
+
}, "*"), helpTooltip && /* @__PURE__ */ React38.createElement(Tooltip, {
|
4245
|
+
content: helpTooltip,
|
4246
|
+
placement: helpTooltipPlacement
|
4247
|
+
}, /* @__PURE__ */ React38.createElement("span", {
|
4248
|
+
className: tw("text-grey-30 flex items-center cursor-pointer ml-2")
|
4249
|
+
}, /* @__PURE__ */ React38.createElement(InlineIcon, {
|
4250
|
+
icon: import_questionMark.default,
|
4251
|
+
"data-testid": "icon-info"
|
4252
|
+
}))));
|
4253
|
+
};
|
4254
|
+
var Label = (props) => {
|
4255
|
+
const _a = props, { id, htmlFor, labelText, labelProps: _b = {} } = _a, labelProps = __objRest(_b, []), { "data-testid": dataTestid, children } = _a;
|
4256
|
+
return /* @__PURE__ */ React38.createElement("label", __spreadValues({
|
4257
|
+
id,
|
4258
|
+
className: tw("w-full"),
|
4259
|
+
"data-testid": dataTestid,
|
4260
|
+
htmlFor
|
4261
|
+
}, labelProps), labelText && /* @__PURE__ */ React38.createElement(LabelText, __spreadValues({}, props)), children);
|
4262
|
+
};
|
4263
|
+
var LabelSkeleton = () => {
|
4264
|
+
return /* @__PURE__ */ React38.createElement(Skeleton, {
|
4265
|
+
height: 20,
|
4266
|
+
width: 100,
|
4267
|
+
className: tw("mb-[7px]")
|
4268
|
+
});
|
4269
|
+
};
|
4270
|
+
Label.Skeleton = LabelSkeleton;
|
4271
|
+
var LabelControl = (_a) => {
|
4272
|
+
var _b = _a, {
|
4273
|
+
messageId,
|
4274
|
+
error: error2,
|
4275
|
+
helperText = error2,
|
4276
|
+
length,
|
4277
|
+
maxLength,
|
4278
|
+
reserveSpaceForError,
|
4279
|
+
fieldset = false,
|
4280
|
+
children,
|
4281
|
+
valid,
|
4282
|
+
disabled
|
4283
|
+
} = _b, rest = __objRest(_b, [
|
4284
|
+
"messageId",
|
4285
|
+
"error",
|
4286
|
+
"helperText",
|
4287
|
+
"length",
|
4288
|
+
"maxLength",
|
4289
|
+
"reserveSpaceForError",
|
4290
|
+
"fieldset",
|
4291
|
+
"children",
|
4292
|
+
"valid",
|
4293
|
+
"disabled"
|
4294
|
+
]);
|
4295
|
+
const legacyError = error2 !== void 0 && valid === false;
|
4296
|
+
const variant = !valid || legacyError ? "error" : disabled ? "disabled" : "default";
|
4297
|
+
return /* @__PURE__ */ React38.createElement(FormControl, null, !fieldset && /* @__PURE__ */ React38.createElement(Label, __spreadProps(__spreadValues({}, rest), {
|
4298
|
+
variant
|
4299
|
+
}), children), fieldset && /* @__PURE__ */ React38.createElement("fieldset", {
|
4300
|
+
id: rest.id
|
4301
|
+
}, /* @__PURE__ */ React38.createElement("legend", {
|
4302
|
+
className: tw("w-full mb-2")
|
4303
|
+
}, /* @__PURE__ */ React38.createElement(LabelText, __spreadProps(__spreadValues({}, rest), {
|
4304
|
+
variant
|
4305
|
+
}))), children), /* @__PURE__ */ React38.createElement(HelperText, {
|
4306
|
+
messageId,
|
4307
|
+
error: !valid,
|
4308
|
+
helperText,
|
4309
|
+
length,
|
4310
|
+
maxLength,
|
4311
|
+
reserveSpaceForError
|
4312
|
+
}));
|
4313
|
+
};
|
4314
|
+
var LabelControlSkeleton = ({ children }) => /* @__PURE__ */ React38.createElement("div", null, /* @__PURE__ */ React38.createElement(Label.Skeleton, null), children, /* @__PURE__ */ React38.createElement(HelperText.Skeleton, null));
|
4315
|
+
LabelControl.Skeleton = LabelControlSkeleton;
|
4316
|
+
var getLabelControlProps = (_a) => {
|
4317
|
+
var _b = _a, {
|
4318
|
+
labelText,
|
4319
|
+
required,
|
4320
|
+
valid = true,
|
4321
|
+
disabled = false,
|
4322
|
+
labelProps: _c = {}
|
4323
|
+
} = _b, labelProps = __objRest(_c, []), {
|
4324
|
+
helpTooltip,
|
4325
|
+
helpTooltipPlacement,
|
4326
|
+
maxLength,
|
4327
|
+
error: error2,
|
4328
|
+
helperText,
|
4329
|
+
reserveSpaceForError,
|
4330
|
+
"data-testid": dataTestId
|
4331
|
+
} = _b;
|
4332
|
+
return {
|
4333
|
+
labelText,
|
4334
|
+
required,
|
4335
|
+
valid,
|
4336
|
+
disabled,
|
4337
|
+
labelProps,
|
4338
|
+
helpTooltip,
|
4339
|
+
helpTooltipPlacement,
|
4340
|
+
error: error2,
|
4341
|
+
helperText,
|
4342
|
+
maxLength,
|
4343
|
+
reserveSpaceForError,
|
4344
|
+
"data-testid": dataTestId
|
4345
|
+
};
|
4346
|
+
};
|
4347
|
+
|
4348
|
+
// src/components/CheckboxGroup/CheckboxGroup.tsx
|
4349
|
+
var isCheckbox = (c) => {
|
4350
|
+
return React39.isValidElement(c) && c.type === Checkbox2;
|
4351
|
+
};
|
4352
|
+
var CheckboxGroup = (_a) => {
|
4353
|
+
var _b = _a, {
|
4354
|
+
value,
|
4355
|
+
defaultValue,
|
4356
|
+
onChange,
|
4357
|
+
readOnly = false,
|
4358
|
+
cols,
|
4359
|
+
children
|
4360
|
+
} = _b, props = __objRest(_b, [
|
4361
|
+
"value",
|
4362
|
+
"defaultValue",
|
4363
|
+
"onChange",
|
4364
|
+
"readOnly",
|
4365
|
+
"cols",
|
4366
|
+
"children"
|
4367
|
+
]);
|
4368
|
+
var _a2;
|
4369
|
+
const [selectedItems, setSelectedItems] = useState3((_a2 = value != null ? value : defaultValue) != null ? _a2 : []);
|
4370
|
+
if (value !== void 0 && value !== selectedItems) {
|
4371
|
+
setSelectedItems(value);
|
4372
|
+
}
|
4373
|
+
const errorMessageId = uniqueId();
|
4374
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
4375
|
+
const labelControlProps = getLabelControlProps(props);
|
4376
|
+
const handleChange = (e) => {
|
4377
|
+
const { value: value2 } = e.target;
|
4378
|
+
const updated = e.target.checked ? [...selectedItems, value2] : selectedItems.filter((v) => v !== value2);
|
4379
|
+
setSelectedItems(updated);
|
4380
|
+
onChange == null ? void 0 : onChange(updated);
|
4381
|
+
};
|
4382
|
+
return /* @__PURE__ */ React39.createElement(LabelControl, __spreadValues(__spreadValues({
|
4383
|
+
fieldset: true
|
4384
|
+
}, labelControlProps), errorProps), /* @__PURE__ */ React39.createElement(InputGroup, {
|
4385
|
+
cols
|
4386
|
+
}, React39.Children.map(children, (c) => {
|
4387
|
+
var _a3, _b2;
|
4388
|
+
if (!isCheckbox(c)) {
|
4389
|
+
return null;
|
4390
|
+
}
|
4391
|
+
const str = (_a3 = c.props.value) == null ? void 0 : _a3.toString();
|
4392
|
+
const defaultChecked = defaultValue === void 0 ? void 0 : str !== void 0 && defaultValue.includes(str);
|
4393
|
+
const checked = value === void 0 ? void 0 : str !== void 0 && value.includes(str);
|
4394
|
+
return React39.cloneElement(c, {
|
4395
|
+
defaultChecked,
|
4396
|
+
checked,
|
4397
|
+
onChange: (_b2 = c.props.onChange) != null ? _b2 : handleChange,
|
4398
|
+
disabled: props.disabled || c.props.disabled,
|
4399
|
+
readOnly
|
4400
|
+
});
|
4401
|
+
})));
|
4402
|
+
};
|
4403
|
+
var CheckboxGroupSkeleton = ({ options = 2 }) => {
|
4404
|
+
return /* @__PURE__ */ React39.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React39.createElement("div", {
|
4405
|
+
className: tw("flex flex-wrap flex-col gap-2")
|
4406
|
+
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */ React39.createElement(Checkbox2.Skeleton, {
|
4407
|
+
key
|
4408
|
+
}))));
|
4409
|
+
};
|
4410
|
+
CheckboxGroup.Skeleton = CheckboxGroupSkeleton;
|
4411
|
+
|
4412
|
+
// src/components/ChoiceChip/ChoiceChip.tsx
|
4413
|
+
import React40, { useState as useState4 } from "react";
|
4414
|
+
|
4415
|
+
// src/components/Combobox/Combobox.tsx
|
4416
|
+
import React42, { useState as useState5, useEffect as useEffect4, useRef as useRef3 } from "react";
|
4417
|
+
import { useCombobox } from "downshift";
|
4418
|
+
import { matchSorter } from "match-sorter";
|
4419
|
+
import uniqueId2 from "lodash/uniqueId";
|
4420
|
+
import omit5 from "lodash/omit";
|
4421
|
+
import { useOverlayPosition as useOverlayPosition2 } from "@react-aria/overlays";
|
4422
|
+
|
4423
|
+
// src/components/Popover/PopoverWrapper.tsx
|
4424
|
+
import React41 from "react";
|
4425
|
+
import { FocusScope } from "@react-aria/focus";
|
4426
|
+
import { DismissButton, OverlayContainer as OverlayContainer2, useModal, useOverlay } from "@react-aria/overlays";
|
4427
|
+
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
4428
|
+
var PopoverWrapper = React41.forwardRef((props, ref) => {
|
4429
|
+
const _a = props, {
|
4430
|
+
id,
|
4431
|
+
children,
|
4432
|
+
placement,
|
4433
|
+
arrowProps,
|
4434
|
+
isOpen,
|
4435
|
+
hideArrow,
|
4436
|
+
shouldCloseOnBlur,
|
4437
|
+
isKeyboardDismissDisabled,
|
4438
|
+
isNonModal = true,
|
4439
|
+
isDismissable,
|
4440
|
+
autoFocus,
|
4441
|
+
containFocus
|
4442
|
+
} = _a, otherProps = __objRest(_a, [
|
4443
|
+
"id",
|
4444
|
+
"children",
|
4445
|
+
"placement",
|
4446
|
+
"arrowProps",
|
4447
|
+
"isOpen",
|
4448
|
+
"hideArrow",
|
4449
|
+
"shouldCloseOnBlur",
|
4450
|
+
"isKeyboardDismissDisabled",
|
4451
|
+
"isNonModal",
|
4452
|
+
"isDismissable",
|
4453
|
+
"autoFocus",
|
4454
|
+
"containFocus"
|
4455
|
+
]);
|
4456
|
+
const { overlayProps } = useOverlay(
|
4457
|
+
__spreadProps(__spreadValues({}, props), { isDismissable: isDismissable && isOpen }),
|
4458
|
+
ref
|
4459
|
+
);
|
4460
|
+
const { modalProps } = useModal({
|
4461
|
+
isDisabled: isNonModal
|
4462
|
+
});
|
4463
|
+
if (!props.isOpen) {
|
4464
|
+
return null;
|
4465
|
+
}
|
4466
|
+
return /* @__PURE__ */ React41.createElement(OverlayContainer2, null, /* @__PURE__ */ React41.createElement(FocusScope, {
|
4467
|
+
restoreFocus: true,
|
4468
|
+
autoFocus,
|
4469
|
+
contain: containFocus
|
4470
|
+
}, /* @__PURE__ */ React41.createElement(Popover.Panel, __spreadProps(__spreadValues({
|
4471
|
+
ref,
|
4472
|
+
role: "dialog"
|
4473
|
+
}, mergeProps2(otherProps, modalProps, overlayProps)), {
|
4474
|
+
id: id != null ? id : overlayProps.id
|
4475
|
+
}), children, /* @__PURE__ */ React41.createElement(DismissButton, {
|
4476
|
+
onDismiss: props.onClose
|
4477
|
+
}))));
|
4478
|
+
});
|
4479
|
+
|
4480
|
+
// src/components/Combobox/Combobox.tsx
|
4481
|
+
var ComboboxBase = (_a) => {
|
4482
|
+
var _b = _a, {
|
4483
|
+
id,
|
4484
|
+
name,
|
4485
|
+
placeholder,
|
4486
|
+
maxHeight,
|
4487
|
+
options,
|
4488
|
+
optionKeys = ["label", "value"],
|
4489
|
+
noResults,
|
4490
|
+
optionToString: itemToString = getOptionLabelBuiltin,
|
4491
|
+
createOption,
|
4492
|
+
renderOption = (opt) => itemToString(opt),
|
4493
|
+
isOptionDisabled = isOptionDisabledBuiltin,
|
4494
|
+
defaultValue,
|
4495
|
+
value,
|
4496
|
+
onChange,
|
4497
|
+
children,
|
4498
|
+
valid = true,
|
4499
|
+
disabled = false,
|
4500
|
+
readOnly = false
|
4501
|
+
} = _b, props = __objRest(_b, [
|
4502
|
+
"id",
|
4503
|
+
"name",
|
4504
|
+
"placeholder",
|
4505
|
+
"maxHeight",
|
4506
|
+
"options",
|
4507
|
+
"optionKeys",
|
4508
|
+
"noResults",
|
4509
|
+
"optionToString",
|
4510
|
+
"createOption",
|
4511
|
+
"renderOption",
|
4512
|
+
"isOptionDisabled",
|
4513
|
+
"defaultValue",
|
4514
|
+
"value",
|
4515
|
+
"onChange",
|
4516
|
+
"children",
|
4517
|
+
"valid",
|
4518
|
+
"disabled",
|
4519
|
+
"readOnly"
|
4520
|
+
]);
|
4521
|
+
var _a2;
|
4522
|
+
const targetRef = useRef3(null);
|
4523
|
+
const overlayRef = useRef3(null);
|
4524
|
+
const [inputItems, setInputItems] = useState5(options);
|
4525
|
+
const [hasFocus, setFocus] = useState5(false);
|
4526
|
+
const updateInputItems = (query) => {
|
4527
|
+
const keys = typeof options[0] === "string" ? void 0 : optionKeys;
|
4528
|
+
setInputItems(query ? matchSorter(options, query, { keys }) : options);
|
4529
|
+
};
|
4530
|
+
const {
|
4531
|
+
isOpen,
|
4532
|
+
getToggleButtonProps,
|
4533
|
+
getMenuProps,
|
4534
|
+
getInputProps,
|
4535
|
+
highlightedIndex,
|
4536
|
+
inputValue,
|
4537
|
+
getItemProps,
|
4538
|
+
selectedItem,
|
4539
|
+
closeMenu
|
4540
|
+
} = useCombobox({
|
4541
|
+
id,
|
4542
|
+
selectedItem: value,
|
4543
|
+
defaultSelectedItem: defaultValue,
|
4544
|
+
itemToString,
|
4545
|
+
items: inputItems,
|
4546
|
+
stateReducer: (_, actionChanges) => {
|
4547
|
+
const { changes, type } = actionChanges;
|
4548
|
+
switch (type) {
|
4549
|
+
case useCombobox.stateChangeTypes.InputBlur: {
|
4550
|
+
return __spreadProps(__spreadValues({}, changes), {
|
4551
|
+
selectedItem: createOption ? createOption == null ? void 0 : createOption(changes.inputValue) : changes.selectedItem
|
4552
|
+
});
|
4553
|
+
}
|
4554
|
+
}
|
4555
|
+
return changes;
|
4556
|
+
},
|
4557
|
+
onSelectedItemChange: (e) => onChange == null ? void 0 : onChange(e.selectedItem),
|
4558
|
+
onInputValueChange: ({ inputValue: inputValue2 }) => updateInputItems(inputValue2)
|
4559
|
+
});
|
4560
|
+
const { overlayProps } = useOverlayPosition2({
|
4561
|
+
targetRef,
|
4562
|
+
overlayRef,
|
4563
|
+
placement: "bottom start",
|
4564
|
+
shouldFlip: true,
|
4565
|
+
isOpen
|
4566
|
+
});
|
4567
|
+
useEffect4(() => {
|
4568
|
+
updateInputItems(inputValue);
|
4569
|
+
}, [JSON.stringify(options)]);
|
4570
|
+
const inputProps = getInputProps({ disabled: disabled || readOnly });
|
4571
|
+
const hasNoResults = options.length === 0 || inputItems.length === 0;
|
4572
|
+
const width = (_a2 = targetRef.current) == null ? void 0 : _a2.offsetWidth;
|
4573
|
+
const style = isOpen ? __spreadProps(__spreadValues({}, overlayProps.style), { width }) : { display: "none" };
|
4574
|
+
return /* @__PURE__ */ React42.createElement("div", {
|
4575
|
+
className: tw("relative")
|
4576
|
+
}, /* @__PURE__ */ React42.createElement(Select.InputContainer, {
|
4577
|
+
ref: targetRef,
|
4578
|
+
variant: disabled ? "disabled" : !valid ? "error" : readOnly ? "readOnly" : hasFocus ? "focused" : "default"
|
4579
|
+
}, /* @__PURE__ */ React42.createElement(Select.Input, __spreadProps(__spreadValues(__spreadValues({
|
4580
|
+
id,
|
4581
|
+
name,
|
4582
|
+
placeholder: readOnly ? void 0 : placeholder
|
4583
|
+
}, inputProps), props), {
|
4584
|
+
disabled,
|
4585
|
+
readOnly,
|
4586
|
+
onFocus: (e) => {
|
4587
|
+
var _a3;
|
4588
|
+
setFocus(true);
|
4589
|
+
(_a3 = inputProps.onFocus) == null ? void 0 : _a3.call(inputProps, e);
|
4590
|
+
},
|
4591
|
+
onBlur: (e) => {
|
4592
|
+
var _a3;
|
4593
|
+
setFocus(false);
|
4594
|
+
(_a3 = inputProps.onBlur) == null ? void 0 : _a3.call(inputProps, e);
|
4595
|
+
},
|
4596
|
+
onKeyDown: (e) => {
|
4597
|
+
var _a3;
|
4598
|
+
e.stopPropagation();
|
4599
|
+
(_a3 = inputProps.onKeyDown) == null ? void 0 : _a3.call(inputProps, e);
|
4600
|
+
},
|
4601
|
+
onKeyUp: (e) => e.stopPropagation()
|
4602
|
+
})), !readOnly && /* @__PURE__ */ React42.createElement(Select.Toggle, __spreadValues({
|
4603
|
+
hasFocus,
|
4604
|
+
isOpen
|
4605
|
+
}, getToggleButtonProps({ disabled })))), /* @__PURE__ */ React42.createElement(PopoverWrapper, __spreadProps(__spreadValues({
|
4606
|
+
isOpen: true,
|
4607
|
+
isDismissable: true,
|
4608
|
+
autoFocus: true
|
4609
|
+
}, getMenuProps({ ref: overlayRef })), {
|
4610
|
+
style,
|
4611
|
+
onClose: closeMenu
|
4612
|
+
}), /* @__PURE__ */ React42.createElement(Select.Menu, {
|
4613
|
+
maxHeight
|
4614
|
+
}, isOpen && hasNoResults && /* @__PURE__ */ React42.createElement(Select.NoResults, null, noResults), isOpen && inputItems.map((item, index) => /* @__PURE__ */ React42.createElement(Select.Item, __spreadValues({
|
4615
|
+
key: itemToString(item),
|
4616
|
+
selected: item === selectedItem,
|
4617
|
+
highlighted: index === highlightedIndex
|
4618
|
+
}, getItemProps({ item, index, disabled: isOptionDisabled(item, index) })), renderOption(item))))));
|
4619
|
+
};
|
4620
|
+
var ComboboxSkeleton = () => /* @__PURE__ */ React42.createElement(Skeleton, {
|
4621
|
+
height: 38
|
4622
|
+
});
|
4623
|
+
ComboboxBase.Skeleton = ComboboxSkeleton;
|
4624
|
+
var Combobox = (_a) => {
|
4625
|
+
var _b = _a, {
|
4626
|
+
options,
|
4627
|
+
noResults
|
4628
|
+
} = _b, props = __objRest(_b, [
|
4629
|
+
"options",
|
4630
|
+
"noResults"
|
4631
|
+
]);
|
4632
|
+
var _a2;
|
4633
|
+
const id = useRef3((_a2 = props.id) != null ? _a2 : `combobox-${uniqueId2()}`);
|
4634
|
+
const errorMessageId = uniqueId2();
|
4635
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
4636
|
+
const labelControlProps = getLabelControlProps(props);
|
4637
|
+
const baseProps = omit5(props, Object.keys(labelControlProps));
|
4638
|
+
return /* @__PURE__ */ React42.createElement(LabelControl, __spreadValues({
|
4639
|
+
id: `${id.current}-label`,
|
4640
|
+
htmlFor: `${id.current}-input`,
|
4641
|
+
messageId: errorMessageId
|
4642
|
+
}, labelControlProps), /* @__PURE__ */ React42.createElement(ComboboxBase, __spreadProps(__spreadValues(__spreadValues({}, baseProps), errorProps), {
|
4643
|
+
id: id.current,
|
4644
|
+
options,
|
4645
|
+
noResults,
|
4646
|
+
disabled: props.disabled,
|
4647
|
+
valid: props.valid
|
4648
|
+
})));
|
4649
|
+
};
|
4650
|
+
Combobox.Skeleton = () => /* @__PURE__ */ React42.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React42.createElement(ComboboxBase.Skeleton, null));
|
4651
|
+
|
4652
|
+
// src/components/DataList/DataList.tsx
|
4653
|
+
import React46 from "react";
|
4654
|
+
|
4655
|
+
// src/common/DataList/DataList.tsx
|
4656
|
+
import React43 from "react";
|
4657
|
+
var import_chevronUp2 = __toESM(require_chevronUp());
|
4658
|
+
var import_chevronDown3 = __toESM(require_chevronDown());
|
4659
|
+
var getAlignClassNames = (align) => tw("flex items-center", {
|
4660
|
+
"justify-end": align === "right",
|
4661
|
+
"justify-center": align === "center",
|
4662
|
+
"justify-start": align === "left" || align === void 0
|
4663
|
+
});
|
4664
|
+
var DataList = (_a) => {
|
4665
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
4666
|
+
return /* @__PURE__ */ React43.createElement("div", __spreadValues({}, rest));
|
4667
|
+
};
|
4668
|
+
var HeadCell = (_a) => {
|
4669
|
+
var _b = _a, {
|
4670
|
+
className,
|
4671
|
+
sticky,
|
4672
|
+
align
|
4673
|
+
} = _b, rest = __objRest(_b, [
|
4674
|
+
"className",
|
4675
|
+
"sticky",
|
4676
|
+
"align"
|
4677
|
+
]);
|
4678
|
+
return /* @__PURE__ */ React43.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
4679
|
+
role: "cell",
|
4680
|
+
className: classNames(cellClassNames, getHeadCellClassNames(sticky), getAlignClassNames(align), className)
|
4681
|
+
}));
|
4682
|
+
};
|
4683
|
+
var Cell = (_a) => {
|
4684
|
+
var _b = _a, { className, align } = _b, rest = __objRest(_b, ["className", "align"]);
|
4685
|
+
return /* @__PURE__ */ React43.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
4686
|
+
role: "cell",
|
4687
|
+
className: classNames(
|
4688
|
+
cellClassNames,
|
4689
|
+
getBodyCellClassNames(false),
|
4690
|
+
getAlignClassNames(align),
|
4691
|
+
tw("border-grey-10 group-hover:bg-grey-0 group-last:border-b-0"),
|
4692
|
+
className
|
4693
|
+
)
|
4694
|
+
}));
|
4695
|
+
};
|
4696
|
+
var Row = (_a) => {
|
4697
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
4698
|
+
return /* @__PURE__ */ React43.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
4699
|
+
className: classNames(tw("contents group"), className),
|
4700
|
+
role: "row"
|
4701
|
+
}));
|
4702
|
+
};
|
4703
|
+
var SortCell = (_a) => {
|
4704
|
+
var _b = _a, { children, direction = "none", onClick } = _b, rest = __objRest(_b, ["children", "direction", "onClick"]);
|
4705
|
+
return /* @__PURE__ */ React43.createElement(HeadCell, __spreadProps(__spreadValues({}, rest), {
|
4706
|
+
"aria-sort": direction,
|
4707
|
+
role: "cell"
|
4708
|
+
}), /* @__PURE__ */ React43.createElement("span", {
|
4709
|
+
className: getSortCellButtonClassNames(rest.align),
|
4710
|
+
role: "button",
|
4711
|
+
tabIndex: -1,
|
4712
|
+
onClick
|
4713
|
+
}, children, /* @__PURE__ */ React43.createElement("div", {
|
3267
4714
|
"data-sort-icons": true,
|
3268
|
-
className: tw("flex flex-col
|
4715
|
+
className: tw("flex flex-col", {
|
3269
4716
|
"invisible group-hover:visible": direction === "none"
|
3270
4717
|
})
|
3271
|
-
}, /* @__PURE__ */
|
4718
|
+
}, /* @__PURE__ */ React43.createElement(InlineIcon, {
|
3272
4719
|
icon: import_chevronUp2.default,
|
3273
4720
|
className: getSortCellIconClassNames(direction === "descending")
|
3274
|
-
}), /* @__PURE__ */
|
4721
|
+
}), /* @__PURE__ */ React43.createElement(InlineIcon, {
|
3275
4722
|
icon: import_chevronDown3.default,
|
3276
4723
|
className: getSortCellIconClassNames(direction === "ascending")
|
3277
4724
|
}))));
|
3278
4725
|
};
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
4726
|
+
DataList.HeadCell = HeadCell;
|
4727
|
+
DataList.SortCell = SortCell;
|
4728
|
+
DataList.Cell = Cell;
|
4729
|
+
DataList.Row = Row;
|
4730
|
+
|
4731
|
+
// src/components/Template/Template.tsx
|
4732
|
+
import React44 from "react";
|
4733
|
+
|
4734
|
+
// src/components/DataList/DataList.tsx
|
4735
|
+
import orderBy2 from "lodash/orderBy";
|
4736
|
+
|
4737
|
+
// src/utils/table/useTableSort.tsx
|
4738
|
+
import React45 from "react";
|
4739
|
+
|
4740
|
+
// src/components/DataTable/DataTable.tsx
|
4741
|
+
import React49 from "react";
|
4742
|
+
|
4743
|
+
// src/components/Table/Table.tsx
|
4744
|
+
import React48 from "react";
|
4745
|
+
|
4746
|
+
// src/utils/table/useScrollTarget.ts
|
4747
|
+
import React47 from "react";
|
4748
|
+
var useScrollTarget = (callback) => {
|
4749
|
+
const targetRef = React47.useRef(null);
|
4750
|
+
React47.useLayoutEffect(() => {
|
4751
|
+
const observer = new IntersectionObserver((entries) => entries[0].isIntersecting && callback && callback(), {
|
4752
|
+
root: null,
|
4753
|
+
rootMargin: `0px 0px 200px 0px`
|
4754
|
+
});
|
4755
|
+
if (targetRef.current) {
|
4756
|
+
observer.observe(targetRef.current);
|
4757
|
+
}
|
4758
|
+
return () => observer.disconnect();
|
4759
|
+
}, []);
|
4760
|
+
return targetRef;
|
4761
|
+
};
|
4762
|
+
|
4763
|
+
// src/components/Table/Table.tsx
|
4764
|
+
var Table2 = (_a) => {
|
4765
|
+
var _b = _a, { children, onPrev, onNext } = _b, rest = __objRest(_b, ["children", "onPrev", "onNext"]);
|
4766
|
+
const bottomRef = useScrollTarget(onNext);
|
4767
|
+
const topRef = useScrollTarget(onPrev);
|
4768
|
+
return /* @__PURE__ */ React48.createElement("div", {
|
4769
|
+
className: "relative w-full"
|
4770
|
+
}, /* @__PURE__ */ React48.createElement("div", {
|
4771
|
+
ref: topRef,
|
4772
|
+
className: tw("absolute top-0 h-1 w-full left-0 bg-transparent")
|
4773
|
+
}), /* @__PURE__ */ React48.createElement(Table, __spreadValues({}, rest), children), /* @__PURE__ */ React48.createElement("div", {
|
4774
|
+
ref: bottomRef,
|
4775
|
+
className: tw("absolute bottom-0 h-1 w-full left-0 bg-transparent")
|
4776
|
+
}));
|
4777
|
+
};
|
4778
|
+
Table2.Head = Table.Head;
|
4779
|
+
Table2.Body = Table.Body;
|
4780
|
+
Table2.Row = Table.Row;
|
4781
|
+
Table2.Cell = Table.Cell;
|
4782
|
+
Table2.SortCell = Table.SortCell;
|
4783
|
+
Table2.SelectCell = Table.SelectCell;
|
4784
|
+
|
4785
|
+
// src/components/DataTable/DataTable.tsx
|
4786
|
+
import orderBy3 from "lodash/orderBy";
|
4787
|
+
|
4788
|
+
// src/components/Dialog/Dialog.tsx
|
4789
|
+
import React50 from "react";
|
4790
|
+
import omit6 from "lodash/omit";
|
4791
|
+
import { Overlay, useModalOverlay } from "@react-aria/overlays";
|
4792
|
+
import { useDialog } from "@react-aria/dialog";
|
4793
|
+
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
4794
|
+
import { useId } from "@react-aria/utils";
|
4795
|
+
import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
|
4796
|
+
|
4797
|
+
// src/components/Divider/Divider.tsx
|
4798
|
+
import React51 from "react";
|
4799
|
+
|
4800
|
+
// src/components/Dropdown/Dropdown.tsx
|
4801
|
+
import React53 from "react";
|
4802
|
+
|
4803
|
+
// src/components/Popover/Popover.tsx
|
4804
|
+
import React52, { useRef as useRef4 } from "react";
|
4805
|
+
import { usePress, PressResponder } from "@react-aria/interactions";
|
4806
|
+
import { useOverlayPosition as useOverlayPosition3, useOverlayTrigger } from "@react-aria/overlays";
|
4807
|
+
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
4808
|
+
import { useOverlayTriggerState as useOverlayTriggerState3 } from "@react-stately/overlays";
|
4809
|
+
|
4810
|
+
// src/components/Popover/PopoverContext.tsx
|
4811
|
+
import { createContext, useContext as useContext2 } from "react";
|
4812
|
+
var PopoverContext = createContext(null);
|
4813
|
+
var usePopoverContext = () => {
|
4814
|
+
const ctx = useContext2(PopoverContext);
|
4815
|
+
if (ctx === null) {
|
4816
|
+
throw new Error("PopoverContext was used outside of provider.");
|
4817
|
+
}
|
4818
|
+
return ctx;
|
4819
|
+
};
|
4820
|
+
|
4821
|
+
// src/components/Popover/Popover.tsx
|
4822
|
+
var Popover2 = (props) => {
|
4823
|
+
var _a;
|
4824
|
+
const {
|
4825
|
+
id,
|
4826
|
+
placement: _placement = "bottom-left",
|
4827
|
+
isDismissable = true,
|
4828
|
+
isKeyboardDismissDisabled,
|
4829
|
+
autoFocus = true,
|
4830
|
+
containFocus = false,
|
4831
|
+
targetRef
|
4832
|
+
} = props;
|
4833
|
+
const triggerRef = useRef4(null);
|
4834
|
+
const overlayRef = useRef4(null);
|
4835
|
+
const state = useOverlayTriggerState3(props);
|
4836
|
+
const {
|
4837
|
+
overlayProps: popoverProps,
|
4838
|
+
placement,
|
4839
|
+
arrowProps
|
4840
|
+
} = useOverlayPosition3({
|
4841
|
+
targetRef: targetRef != null ? targetRef : triggerRef,
|
4842
|
+
overlayRef,
|
4843
|
+
placement: _placement.replace("-", " "),
|
4844
|
+
offset: props.offset,
|
4845
|
+
shouldFlip: props.shouldFlip,
|
4846
|
+
isOpen: state.isOpen
|
4847
|
+
});
|
4848
|
+
const { triggerProps, overlayProps: otherOverlayProps } = useOverlayTrigger(
|
4849
|
+
{ type: (_a = props.type) != null ? _a : "dialog" },
|
4850
|
+
state,
|
4851
|
+
triggerRef
|
4852
|
+
);
|
4853
|
+
return /* @__PURE__ */ React52.createElement(PopoverContext.Provider, {
|
4854
|
+
value: {
|
4855
|
+
state
|
4856
|
+
}
|
4857
|
+
}, React52.Children.map(props.children, (child) => {
|
4858
|
+
if (isComponentType(child, Popover2.Trigger)) {
|
4859
|
+
return /* @__PURE__ */ React52.createElement(PressResponder, __spreadValues({
|
4860
|
+
ref: triggerRef,
|
4861
|
+
onPress: state.toggle
|
4862
|
+
}, triggerProps), /* @__PURE__ */ React52.createElement(PopoverTriggerWrapper, {
|
4863
|
+
"data-testid": props["data-testid"],
|
4864
|
+
"aria-controls": id
|
4865
|
+
}, child.props.children));
|
4866
|
+
}
|
4867
|
+
if (isComponentType(child, Popover2.Panel)) {
|
4868
|
+
return /* @__PURE__ */ React52.createElement(PopoverWrapper, __spreadProps(__spreadValues(__spreadValues({
|
4869
|
+
ref: overlayRef,
|
4870
|
+
isOpen: state.isOpen,
|
4871
|
+
onClose: state.close,
|
4872
|
+
placement,
|
4873
|
+
arrowProps,
|
4874
|
+
isDismissable,
|
4875
|
+
isKeyboardDismissDisabled,
|
4876
|
+
autoFocus,
|
4877
|
+
containFocus
|
4878
|
+
}, popoverProps), otherOverlayProps), {
|
4879
|
+
id
|
4880
|
+
}), child.props.children);
|
4881
|
+
}
|
4882
|
+
throw new Error("Invalid children element type");
|
4883
|
+
}));
|
4884
|
+
};
|
4885
|
+
var Trigger = () => null;
|
4886
|
+
Trigger.displayName = "Popover.Trigger";
|
4887
|
+
Popover2.Trigger = Trigger;
|
4888
|
+
var Panel = () => null;
|
4889
|
+
Panel.displayName = "Popover.Panel";
|
4890
|
+
Popover2.Panel = Panel;
|
4891
|
+
var asPopoverButton = (Component, displayName) => {
|
4892
|
+
const PopoverButton2 = (props) => {
|
4893
|
+
const { onClick } = props;
|
4894
|
+
const { state } = usePopoverContext();
|
4895
|
+
const handleClick = (e) => {
|
4896
|
+
state.close();
|
4897
|
+
onClick == null ? void 0 : onClick(e);
|
4898
|
+
};
|
4899
|
+
return /* @__PURE__ */ React52.createElement(Component, __spreadProps(__spreadValues({}, props), {
|
4900
|
+
onClick: handleClick
|
4901
|
+
}));
|
4902
|
+
};
|
4903
|
+
PopoverButton2.displayName = displayName;
|
4904
|
+
return PopoverButton2;
|
4905
|
+
};
|
4906
|
+
var PopoverButton = asPopoverButton(Button, "PopoverButton");
|
4907
|
+
Popover2.Button = PopoverButton;
|
4908
|
+
var PopoverTriggerWrapper = (_a) => {
|
4909
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
4910
|
+
var _a2;
|
4911
|
+
const ref = useRef4(null);
|
4912
|
+
const trigger = React52.Children.only(children);
|
4913
|
+
const { pressProps } = usePress(__spreadProps(__spreadValues({}, rest), { ref }));
|
4914
|
+
return React52.cloneElement(trigger, __spreadProps(__spreadValues({
|
4915
|
+
"ref": ref
|
4916
|
+
}, mergeProps3(pressProps, trigger.props)), {
|
4917
|
+
"aria-controls": (_a2 = rest["aria-controls"]) != null ? _a2 : pressProps["aria-controls"]
|
4918
|
+
}));
|
4919
|
+
};
|
4920
|
+
|
4921
|
+
// src/components/Dropdown/Dropdown.tsx
|
4922
|
+
var Dropdown = ({ children, content, placement = "bottom-left" }) => {
|
4923
|
+
return /* @__PURE__ */ React53.createElement(Popover2, {
|
4924
|
+
type: "menu",
|
4925
|
+
placement,
|
4926
|
+
autoFocus: true
|
4927
|
+
}, /* @__PURE__ */ React53.createElement(Popover2.Trigger, null, children), /* @__PURE__ */ React53.createElement(Popover2.Panel, null, content));
|
4928
|
+
};
|
4929
|
+
var DropdownMenu2 = ({
|
4930
|
+
title,
|
4931
|
+
children,
|
4932
|
+
contentId,
|
4933
|
+
triggerId,
|
4934
|
+
setClose = () => void 0
|
4935
|
+
}) => {
|
4936
|
+
const menuRef = React53.useRef(null);
|
4937
|
+
React53.useEffect(() => {
|
4938
|
+
const id = setTimeout(() => {
|
4939
|
+
var _a, _b, _c;
|
4940
|
+
return (_c = (_b = (_a = menuRef.current) == null ? void 0 : _a.children) == null ? void 0 : _b[0]) == null ? void 0 : _c.focus();
|
4941
|
+
});
|
4942
|
+
return () => clearTimeout(id);
|
4943
|
+
}, [menuRef.current]);
|
4944
|
+
return /* @__PURE__ */ React53.createElement("div", {
|
4945
|
+
style: { minWidth: "250px" },
|
4946
|
+
className: tw("py-3 bg-white")
|
4947
|
+
}, !!title && /* @__PURE__ */ React53.createElement("div", {
|
4948
|
+
className: tw("px-4 py-4 text-left text-grey-100 typography-body-default-medium font-semibold")
|
4949
|
+
}, title), /* @__PURE__ */ React53.createElement("ol", {
|
4950
|
+
role: "menu",
|
4951
|
+
ref: menuRef,
|
4952
|
+
id: contentId,
|
4953
|
+
"aria-labelledby": triggerId
|
4954
|
+
}, React53.Children.map(children, (child) => {
|
4955
|
+
return React53.cloneElement(child, { setClose });
|
4956
|
+
})));
|
4957
|
+
};
|
4958
|
+
var DropdownItem = (_a) => {
|
4959
|
+
var _b = _a, {
|
4960
|
+
children,
|
4961
|
+
disabled = false,
|
4962
|
+
tooltip,
|
4963
|
+
tooltipPlacement,
|
4964
|
+
color = "default",
|
4965
|
+
onSelect,
|
4966
|
+
setClose = () => void 0
|
4967
|
+
} = _b, props = __objRest(_b, [
|
4968
|
+
"children",
|
4969
|
+
"disabled",
|
4970
|
+
"tooltip",
|
4971
|
+
"tooltipPlacement",
|
4972
|
+
"color",
|
4973
|
+
"onSelect",
|
4974
|
+
"setClose"
|
4975
|
+
]);
|
4976
|
+
const { state } = usePopoverContext();
|
4977
|
+
const handleSelect = () => {
|
4978
|
+
onSelect == null ? void 0 : onSelect();
|
4979
|
+
state.close();
|
4980
|
+
setClose();
|
4981
|
+
};
|
4982
|
+
const handleKeyDown = (event) => {
|
4983
|
+
const target = event.target;
|
4984
|
+
const parent = target.parentElement;
|
4985
|
+
const first = parent.firstChild;
|
4986
|
+
const last = parent.lastChild;
|
4987
|
+
const next = target.nextElementSibling;
|
4988
|
+
const prev = target.previousElementSibling;
|
4989
|
+
if (event.key === "ArrowUp") {
|
4990
|
+
prev ? prev.focus() : last.focus();
|
4991
|
+
} else if (event.key === "ArrowDown") {
|
4992
|
+
next ? next.focus() : first.focus();
|
4993
|
+
} else if (event.key === "Tab") {
|
4994
|
+
event.preventDefault();
|
4995
|
+
event.stopPropagation();
|
4996
|
+
} else if (event.key === "Home" || event.key === "PageUp") {
|
4997
|
+
first.focus();
|
4998
|
+
} else if (event.key === "End" || event.key === "PageDown") {
|
4999
|
+
last.focus();
|
5000
|
+
} else if (event.key === "Enter") {
|
5001
|
+
!disabled && handleSelect();
|
5002
|
+
}
|
5003
|
+
};
|
5004
|
+
const handleClick = (e) => {
|
5005
|
+
e.stopPropagation();
|
5006
|
+
if (!disabled) {
|
5007
|
+
handleSelect();
|
5008
|
+
}
|
5009
|
+
};
|
5010
|
+
const itemContent = /* @__PURE__ */ React53.createElement("div", {
|
5011
|
+
className: tw("py-3 px-4")
|
5012
|
+
}, children);
|
5013
|
+
return /* @__PURE__ */ React53.createElement("li", __spreadProps(__spreadValues({
|
5014
|
+
role: "menuitem",
|
5015
|
+
tabIndex: -1,
|
5016
|
+
onClick: handleClick,
|
5017
|
+
onKeyDown: handleKeyDown
|
5018
|
+
}, props), {
|
5019
|
+
className: tw("typography-body-small flex items-center focus:ring-0", {
|
5020
|
+
"text-grey-70 cursor-pointer hover:bg-grey-0": !disabled,
|
5021
|
+
"text-grey-10 cursor-not-allowed": disabled,
|
5022
|
+
"text-primary-70 hover:text-primary-80": color === "danger" && !disabled
|
5023
|
+
})
|
5024
|
+
}), tooltip ? /* @__PURE__ */ React53.createElement(Tooltip, {
|
5025
|
+
content: tooltip,
|
5026
|
+
placement: tooltipPlacement,
|
5027
|
+
inline: false
|
5028
|
+
}, itemContent) : itemContent);
|
5029
|
+
};
|
5030
|
+
Dropdown.Menu = DropdownMenu2;
|
5031
|
+
Dropdown.Item = DropdownItem;
|
5032
|
+
|
5033
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
5034
|
+
import React56 from "react";
|
5035
|
+
import { useFilter } from "@react-aria/i18n";
|
5036
|
+
import { Item as Item4, Section } from "@react-stately/collections";
|
5037
|
+
import { useTreeState } from "@react-stately/tree";
|
5038
|
+
import { useMenuTriggerState } from "@react-stately/menu";
|
5039
|
+
import { useOverlayPosition as useOverlayPosition4 } from "@react-aria/overlays";
|
5040
|
+
import { useMenuTrigger, useMenu, useMenuItem, useMenuSection } from "@react-aria/menu";
|
5041
|
+
import { useSeparator } from "@react-aria/separator";
|
5042
|
+
import { usePress as usePress2, PressResponder as PressResponder2 } from "@react-aria/interactions";
|
5043
|
+
import { mergeProps as mergeProps4 } from "@react-aria/utils";
|
5044
|
+
|
5045
|
+
// src/components/Input/Input.tsx
|
5046
|
+
import uniqueId3 from "lodash/uniqueId";
|
5047
|
+
import toString from "lodash/toString";
|
5048
|
+
import omit7 from "lodash/omit";
|
5049
|
+
import React55, { forwardRef, useState as useState6, useImperativeHandle, useRef as useRef5 } from "react";
|
5050
|
+
|
5051
|
+
// src/utils/constants.ts
|
5052
|
+
var getCommonInputStyles = ({ readOnly, valid }) => tw(
|
5053
|
+
"block w-full rounded-sm disabled:cursor-not-allowed disabled:border-grey-20 disabled:bg-grey-5 typography-body-small text-grey-70 disabled:text-grey-40 placeholder:text-grey-40 focus:outline-none",
|
5054
|
+
{
|
5055
|
+
"px-3 py-3": !readOnly,
|
5056
|
+
"border-none resize-none cursor-default": readOnly,
|
5057
|
+
"border border-error-50": !valid && !readOnly,
|
5058
|
+
"border border-grey-20 hover:border-grey-50 focus:border-info-70": valid && !readOnly
|
5059
|
+
}
|
5060
|
+
);
|
5061
|
+
|
5062
|
+
// src/utils/form/InputAdornment/InputAdornment.tsx
|
5063
|
+
import React54 from "react";
|
5064
|
+
var import_tick4 = __toESM(require_tick());
|
5065
|
+
var import_error3 = __toESM(require_error());
|
5066
|
+
var import_search2 = __toESM(require_search());
|
5067
|
+
var import_cross4 = __toESM(require_cross());
|
5068
|
+
var InputAdornment = ({ placement = "right", className, dense, children }) => {
|
5069
|
+
return /* @__PURE__ */ React54.createElement("span", {
|
5070
|
+
className: classNames(className, "absolute inset-y-0 grow-0 text-grey-40 flex items-center mx-3", {
|
5071
|
+
"right-0": placement === "right",
|
5072
|
+
"left-0": placement === "left",
|
5073
|
+
"typography-body-small": dense,
|
5074
|
+
"typography-body-default-medium": !dense
|
5075
|
+
})
|
5076
|
+
}, /* @__PURE__ */ React54.createElement(Flexbox, {
|
5077
|
+
gap: "3",
|
5078
|
+
wrap: "wrap"
|
5079
|
+
}, children));
|
5080
|
+
};
|
5081
|
+
var SearchIcon = ({ onClick }) => /* @__PURE__ */ React54.createElement(Icon, {
|
5082
|
+
icon: import_search2.default,
|
5083
|
+
color: "grey-30",
|
5084
|
+
"data-testid": "icon-search",
|
5085
|
+
onClick
|
5086
|
+
});
|
5087
|
+
var ResetIcon = ({ onClick }) => /* @__PURE__ */ React54.createElement(Icon, {
|
5088
|
+
className: "hover:cursor-pointer",
|
5089
|
+
icon: import_cross4.default,
|
5090
|
+
color: "grey-30",
|
5091
|
+
"data-testid": "icon-reset",
|
5092
|
+
onClick
|
5093
|
+
});
|
5094
|
+
|
5095
|
+
// src/components/Input/Input.tsx
|
5096
|
+
var createInput = (displayName, opts = {}) => {
|
5097
|
+
const InputComponent = forwardRef(
|
5098
|
+
(_a, ref) => {
|
5099
|
+
var _b = _a, {
|
5100
|
+
type = "text",
|
5101
|
+
maxLength,
|
5102
|
+
valid = true,
|
5103
|
+
required = false,
|
5104
|
+
endAdornment,
|
5105
|
+
disabled = false,
|
5106
|
+
readOnly = false
|
5107
|
+
} = _b, props = __objRest(_b, [
|
5108
|
+
"type",
|
5109
|
+
"maxLength",
|
5110
|
+
"valid",
|
5111
|
+
"required",
|
5112
|
+
"endAdornment",
|
5113
|
+
"disabled",
|
5114
|
+
"readOnly"
|
5115
|
+
]);
|
5116
|
+
var _a2;
|
5117
|
+
const inputRef = React55.useRef(null);
|
5118
|
+
useImperativeHandle(ref, () => inputRef.current);
|
5119
|
+
const handleReset = () => {
|
5120
|
+
var _a3;
|
5121
|
+
const el = inputRef.current;
|
5122
|
+
if (el) {
|
5123
|
+
const lastValue = el.value;
|
5124
|
+
el.value = "";
|
5125
|
+
(_a3 = el._valueTracker) == null ? void 0 : _a3.setValue(lastValue);
|
5126
|
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
5127
|
+
el.focus();
|
5128
|
+
}
|
5129
|
+
};
|
5130
|
+
return /* @__PURE__ */ React55.createElement("span", {
|
5131
|
+
className: tw("relative block")
|
5132
|
+
}, opts.adornment && /* @__PURE__ */ React55.createElement(InputAdornment, {
|
5133
|
+
placement: "left"
|
5134
|
+
}, opts.adornment), /* @__PURE__ */ React55.createElement("input", __spreadProps(__spreadValues({
|
5135
|
+
ref: inputRef,
|
5136
|
+
type
|
5137
|
+
}, props), {
|
5138
|
+
disabled,
|
5139
|
+
maxLength,
|
5140
|
+
required,
|
5141
|
+
readOnly,
|
5142
|
+
className: classNames(
|
5143
|
+
{
|
5144
|
+
"pl-7": opts.adornment
|
5145
|
+
},
|
5146
|
+
getCommonInputStyles({ readOnly, valid }),
|
5147
|
+
props.className
|
5148
|
+
)
|
5149
|
+
})), opts.canReset && (props.value || ((_a2 = inputRef.current) == null ? void 0 : _a2.value)) && /* @__PURE__ */ React55.createElement(InputAdornment, null, /* @__PURE__ */ React55.createElement(ResetIcon, {
|
5150
|
+
onClick: handleReset
|
5151
|
+
})), !opts.canReset && endAdornment && /* @__PURE__ */ React55.createElement(InputAdornment, null, endAdornment));
|
5152
|
+
}
|
5153
|
+
);
|
5154
|
+
InputComponent.displayName = displayName;
|
5155
|
+
InputComponent.Skeleton = () => /* @__PURE__ */ React55.createElement(Skeleton, {
|
5156
|
+
height: 38
|
5157
|
+
});
|
5158
|
+
return InputComponent;
|
5159
|
+
};
|
5160
|
+
var InputBase = createInput("InputBase");
|
5161
|
+
var SearchInput = createInput("SearchInput", { adornment: /* @__PURE__ */ React55.createElement(SearchIcon, null), canReset: true });
|
5162
|
+
var Input2 = React55.forwardRef((_a, ref) => {
|
5163
|
+
var _b = _a, { readOnly = false } = _b, props = __objRest(_b, ["readOnly"]);
|
5164
|
+
var _a2, _b2, _c;
|
5165
|
+
const [value, setValue] = useState6((_b2 = (_a2 = props.value) != null ? _a2 : props.defaultValue) != null ? _b2 : "");
|
5166
|
+
const id = useRef5((_c = props.id) != null ? _c : `input-${uniqueId3()}`);
|
5167
|
+
const errorMessageId = uniqueId3();
|
5168
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
5169
|
+
const _d = getLabelControlProps(props), { "data-testid": dataTestId } = _d, labelControlProps = __objRest(_d, ["data-testid"]);
|
5170
|
+
const baseProps = omit7(props, Object.keys(labelControlProps));
|
5171
|
+
return /* @__PURE__ */ React55.createElement(LabelControl, __spreadValues({
|
5172
|
+
id: `${id.current}-label`,
|
5173
|
+
htmlFor: id.current,
|
5174
|
+
messageId: errorMessageId,
|
5175
|
+
length: value !== void 0 ? toString(value).length : void 0
|
5176
|
+
}, labelControlProps), /* @__PURE__ */ React55.createElement(InputBase, __spreadProps(__spreadValues(__spreadValues({
|
5177
|
+
ref
|
5178
|
+
}, baseProps), errorProps), {
|
5179
|
+
id: id.current,
|
5180
|
+
"data-testid": dataTestId,
|
5181
|
+
onChange: (e) => {
|
5182
|
+
var _a3;
|
5183
|
+
setValue(e.currentTarget.value);
|
5184
|
+
(_a3 = props.onChange) == null ? void 0 : _a3.call(props, e);
|
5185
|
+
},
|
5186
|
+
disabled: props.disabled,
|
5187
|
+
maxLength: props.maxLength,
|
5188
|
+
required: props.required,
|
5189
|
+
valid: props.valid,
|
5190
|
+
readOnly
|
5191
|
+
})));
|
5192
|
+
});
|
5193
|
+
Input2.displayName = "Input";
|
5194
|
+
Input2.Skeleton = () => /* @__PURE__ */ React55.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React55.createElement(InputBase.Skeleton, null));
|
5195
|
+
Input2.Skeleton.displayName = "Input.Skeleton";
|
5196
|
+
|
5197
|
+
// src/components/DropdownMenu/utils.ts
|
5198
|
+
import { ListCollection } from "@react-stately/list";
|
5199
|
+
var filterCollection = (collection, inputValue, filter) => {
|
5200
|
+
return new ListCollection(filterNodes(collection, inputValue, filter));
|
5201
|
+
};
|
5202
|
+
var filterNodes = (nodes, inputValue, filter) => {
|
5203
|
+
const filteredNode = [];
|
5204
|
+
for (const node of nodes) {
|
5205
|
+
if (node.type === "section" && node.hasChildNodes) {
|
5206
|
+
const filtered = filterNodes(node.childNodes, inputValue, filter);
|
5207
|
+
if ([...filtered].length > 0) {
|
5208
|
+
filteredNode.push(__spreadProps(__spreadValues({}, node), { childNodes: filtered }));
|
5209
|
+
}
|
5210
|
+
} else if (node.type !== "section" && filter(node.textValue, inputValue)) {
|
5211
|
+
filteredNode.push(__spreadValues({}, node));
|
5212
|
+
}
|
5213
|
+
}
|
5214
|
+
return filteredNode;
|
5215
|
+
};
|
5216
|
+
|
5217
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
5218
|
+
var DropdownMenu3 = (_a) => {
|
5219
|
+
var _b = _a, {
|
5220
|
+
onAction,
|
5221
|
+
selectionMode,
|
5222
|
+
selection,
|
5223
|
+
onSelectionChange,
|
5224
|
+
placement = "bottom-left",
|
5225
|
+
minWidth,
|
5226
|
+
maxWidth,
|
5227
|
+
searchable = false,
|
5228
|
+
emptyState,
|
5229
|
+
header,
|
5230
|
+
footer,
|
5231
|
+
children
|
5232
|
+
} = _b, props = __objRest(_b, [
|
5233
|
+
"onAction",
|
5234
|
+
"selectionMode",
|
5235
|
+
"selection",
|
5236
|
+
"onSelectionChange",
|
5237
|
+
"placement",
|
5238
|
+
"minWidth",
|
5239
|
+
"maxWidth",
|
5240
|
+
"searchable",
|
5241
|
+
"emptyState",
|
5242
|
+
"header",
|
5243
|
+
"footer",
|
5244
|
+
"children"
|
5245
|
+
]);
|
5246
|
+
const triggerRef = React56.useRef(null);
|
5247
|
+
const overlayRef = React56.useRef(null);
|
5248
|
+
const [trigger, items] = extractTriggerAndItems(children);
|
5249
|
+
const state = useMenuTriggerState(props);
|
5250
|
+
const { menuTriggerProps, menuProps } = useMenuTrigger({}, state, triggerRef);
|
5251
|
+
const { overlayProps } = useOverlayPosition4({
|
5252
|
+
targetRef: triggerRef,
|
5253
|
+
overlayRef,
|
5254
|
+
placement: placement.replace("-", " "),
|
5255
|
+
shouldFlip: true,
|
5256
|
+
isOpen: state.isOpen
|
5257
|
+
});
|
5258
|
+
return /* @__PURE__ */ React56.createElement("div", null, /* @__PURE__ */ React56.createElement(PressResponder2, __spreadValues({
|
5259
|
+
ref: triggerRef,
|
5260
|
+
onPress: () => state.toggle()
|
5261
|
+
}, menuTriggerProps), /* @__PURE__ */ React56.createElement(TriggerWrapper, null, trigger.props.children)), /* @__PURE__ */ React56.createElement(PopoverWrapper, __spreadValues({
|
5262
|
+
ref: overlayRef,
|
5263
|
+
isDismissable: true,
|
5264
|
+
autoFocus: true,
|
5265
|
+
containFocus: true,
|
5266
|
+
isOpen: state.isOpen,
|
5267
|
+
onClose: state.close
|
5268
|
+
}, overlayProps), /* @__PURE__ */ React56.createElement(MenuWrapper, __spreadValues({
|
5269
|
+
onAction,
|
5270
|
+
selectionMode,
|
5271
|
+
selection,
|
5272
|
+
onSelectionChange,
|
5273
|
+
searchable,
|
5274
|
+
emptyState,
|
5275
|
+
minWidth,
|
5276
|
+
maxWidth,
|
5277
|
+
header,
|
5278
|
+
footer
|
5279
|
+
}, menuProps), items.props.children)));
|
5280
|
+
};
|
5281
|
+
var MenuTrigger = () => null;
|
5282
|
+
var MenuItems = () => null;
|
5283
|
+
DropdownMenu3.Trigger = MenuTrigger;
|
5284
|
+
DropdownMenu3.Items = MenuItems;
|
5285
|
+
DropdownMenu3.Item = Item4;
|
5286
|
+
DropdownMenu3.Section = Section;
|
5287
|
+
var TriggerWrapper = (_a) => {
|
5288
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
5289
|
+
const ref = React56.useRef(null);
|
5290
|
+
const { pressProps } = usePress2(__spreadProps(__spreadValues({}, props), { ref }));
|
5291
|
+
const trigger = React56.Children.only(children);
|
5292
|
+
if (!trigger || !React56.isValidElement(trigger)) {
|
5293
|
+
throw new Error("<DropdownMenu.Trigger> must have valid child");
|
5294
|
+
}
|
5295
|
+
return React56.cloneElement(trigger, __spreadValues({ ref }, mergeProps4(pressProps, props)));
|
5296
|
+
};
|
5297
|
+
var isSectionNode = (item) => item.type === "section";
|
5298
|
+
var isItemNode = (item) => item.type === "item";
|
5299
|
+
var MenuWrapper = (_a) => {
|
5300
|
+
var _b = _a, {
|
5301
|
+
selection: selectedKeys,
|
5302
|
+
minWidth,
|
5303
|
+
maxWidth,
|
5304
|
+
searchable,
|
5305
|
+
emptyState,
|
5306
|
+
header,
|
5307
|
+
footer
|
5308
|
+
} = _b, props = __objRest(_b, [
|
5309
|
+
"selection",
|
5310
|
+
"minWidth",
|
5311
|
+
"maxWidth",
|
5312
|
+
"searchable",
|
5313
|
+
"emptyState",
|
5314
|
+
"header",
|
5315
|
+
"footer"
|
5316
|
+
]);
|
5317
|
+
const ref = React56.useRef(null);
|
5318
|
+
const disabledKeys = getDisabledItemKeys(props.children);
|
5319
|
+
const state = useTreeState(__spreadValues({
|
5320
|
+
disabledKeys,
|
5321
|
+
selectedKeys
|
5322
|
+
}, props));
|
5323
|
+
const { menuProps } = useMenu(props, state, ref);
|
5324
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
5325
|
+
const [search, setSearch] = React56.useState("");
|
5326
|
+
const filteredCollection = React56.useMemo(
|
5327
|
+
() => searchable ? filterCollection(state.collection, search, contains) : state.collection,
|
5328
|
+
[state.collection, search, contains]
|
5329
|
+
);
|
5330
|
+
return /* @__PURE__ */ React56.createElement(DropdownMenu, {
|
5331
|
+
minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
|
5332
|
+
maxWidth: maxWidth !== void 0 ? `${maxWidth}px` : void 0
|
5333
|
+
}, header, /* @__PURE__ */ React56.createElement(DropdownMenu.ContentContainer, null, searchable && /* @__PURE__ */ React56.createElement(SearchInput, {
|
5334
|
+
"aria-label": "search",
|
5335
|
+
value: search,
|
5336
|
+
onChange: (e) => setSearch(e.target.value),
|
5337
|
+
className: tw("mb-5")
|
5338
|
+
}), filteredCollection.size === 0 && emptyState && /* @__PURE__ */ React56.createElement(DropdownMenu.EmptyStateContainer, null, emptyState), /* @__PURE__ */ React56.createElement(DropdownMenu.List, __spreadValues({
|
5339
|
+
ref
|
5340
|
+
}, menuProps), Array.from(filteredCollection).map((item) => {
|
5341
|
+
if (isSectionNode(item)) {
|
5342
|
+
return /* @__PURE__ */ React56.createElement(SectionWrapper, {
|
5343
|
+
key: item.key,
|
5344
|
+
section: item,
|
5345
|
+
state
|
5346
|
+
});
|
5347
|
+
} else if (isItemNode(item)) {
|
5348
|
+
return /* @__PURE__ */ React56.createElement(ItemWrapper, {
|
5349
|
+
key: item.key,
|
5350
|
+
item,
|
5351
|
+
state
|
5352
|
+
});
|
5353
|
+
}
|
5354
|
+
}))), footer);
|
5355
|
+
};
|
5356
|
+
var ItemWrapper = ({ item, state }) => {
|
5357
|
+
const ref = React56.useRef(null);
|
5358
|
+
const { menuItemProps, descriptionProps, isSelected, isFocused, isDisabled } = useMenuItem(
|
5359
|
+
{ key: item.key },
|
5360
|
+
state,
|
5361
|
+
ref
|
5362
|
+
);
|
5363
|
+
const { icon, description, kind = "default" } = item.props;
|
5364
|
+
return /* @__PURE__ */ React56.createElement(DropdownMenu.Item, __spreadProps(__spreadValues({
|
5365
|
+
ref
|
5366
|
+
}, menuItemProps), {
|
5367
|
+
kind,
|
5368
|
+
selected: isSelected,
|
5369
|
+
highlighted: isFocused,
|
5370
|
+
disabled: isDisabled,
|
5371
|
+
icon
|
5372
|
+
}), item.rendered, description && /* @__PURE__ */ React56.createElement(DropdownMenu.Description, __spreadValues({
|
5373
|
+
disabled: isDisabled
|
5374
|
+
}, descriptionProps), description));
|
5375
|
+
};
|
5376
|
+
var SectionWrapper = ({ section, state }) => {
|
5377
|
+
const { itemProps, headingProps, groupProps } = useMenuSection({
|
5378
|
+
"heading": section.rendered,
|
5379
|
+
"aria-label": section["aria-label"]
|
5380
|
+
});
|
5381
|
+
const { separatorProps } = useSeparator({
|
5382
|
+
elementType: "li"
|
5383
|
+
});
|
5384
|
+
return /* @__PURE__ */ React56.createElement(React56.Fragment, null, section.key !== state.collection.getFirstKey() && /* @__PURE__ */ React56.createElement(DropdownMenu.Separator, __spreadValues({}, separatorProps)), /* @__PURE__ */ React56.createElement(DropdownMenu.Group, __spreadValues({
|
5385
|
+
title: section.rendered,
|
5386
|
+
titleProps: headingProps
|
5387
|
+
}, itemProps), /* @__PURE__ */ React56.createElement("ul", __spreadValues({}, groupProps), Array.from(section.childNodes).map((node) => /* @__PURE__ */ React56.createElement(ItemWrapper, {
|
5388
|
+
key: node.key,
|
5389
|
+
item: node,
|
5390
|
+
state
|
5391
|
+
})))));
|
5392
|
+
};
|
5393
|
+
var extractTriggerAndItems = (children) => {
|
5394
|
+
const [trigger, items] = React56.Children.toArray(children);
|
5395
|
+
if (!isComponentType(trigger, MenuTrigger) || !isComponentType(items, MenuItems)) {
|
5396
|
+
throw new Error("<DropdownMenu> must have <DropdownMenu.Trigger> and <DropdownMenu.Items> defined");
|
5397
|
+
}
|
5398
|
+
return [trigger, items];
|
5399
|
+
};
|
5400
|
+
var getDisabledItemKeys = (children) => {
|
5401
|
+
const keys = React56.Children.map(children, (child) => {
|
5402
|
+
var _a, _b;
|
5403
|
+
if (!child || typeof child === "function") {
|
5404
|
+
return null;
|
5405
|
+
}
|
5406
|
+
if (isComponentType(child, Item4) && child.props.disabled) {
|
5407
|
+
return (_b = (_a = child.key) == null ? void 0 : _a.toString()) != null ? _b : null;
|
5408
|
+
}
|
5409
|
+
if (isComponentType(child, Section)) {
|
5410
|
+
return getDisabledItemKeys(child.props.children);
|
5411
|
+
}
|
5412
|
+
return null;
|
5413
|
+
});
|
5414
|
+
return keys.flat().filter((key) => key !== null);
|
5415
|
+
};
|
5416
|
+
|
5417
|
+
// src/components/EmptyState/EmptyState.tsx
|
5418
|
+
import React58 from "react";
|
5419
|
+
|
5420
|
+
// src/components/Flexbox/FlexboxItem.tsx
|
5421
|
+
import React57 from "react";
|
5422
|
+
var FlexboxItem = Tailwindify(
|
5423
|
+
({ htmlTag = "div", className, style, children, display, flex, grow, shrink, order, alignSelf }) => {
|
5424
|
+
const hookStyle = useStyle({
|
5425
|
+
display,
|
5426
|
+
flex,
|
5427
|
+
flexGrow: grow,
|
5428
|
+
flexShrink: shrink,
|
5429
|
+
order,
|
5430
|
+
alignSelf
|
5431
|
+
});
|
5432
|
+
const HtmlElement = htmlTag;
|
5433
|
+
return /* @__PURE__ */ React57.createElement(HtmlElement, {
|
5434
|
+
style: __spreadValues(__spreadValues({}, hookStyle), style),
|
5435
|
+
className
|
5436
|
+
}, children);
|
5437
|
+
}
|
5438
|
+
);
|
5439
|
+
|
5440
|
+
// src/components/EmptyState/EmptyState.tsx
|
5441
|
+
import omit8 from "lodash/omit";
|
5442
|
+
|
5443
|
+
// src/components/Grid/GridItem.tsx
|
5444
|
+
import React59 from "react";
|
5445
|
+
var GridItem = Tailwindify(
|
5446
|
+
({
|
5447
|
+
htmlTag = "div",
|
5448
|
+
className,
|
5449
|
+
style,
|
5450
|
+
children,
|
5451
|
+
display,
|
5452
|
+
justifySelf,
|
5453
|
+
alignSelf,
|
5454
|
+
placeSelf,
|
5455
|
+
colSpan,
|
5456
|
+
colStart,
|
5457
|
+
colEnd,
|
5458
|
+
rowSpan,
|
5459
|
+
rowStart,
|
5460
|
+
rowEnd
|
5461
|
+
}) => {
|
5462
|
+
const hookStyle = useStyle({
|
5463
|
+
display,
|
5464
|
+
justifySelf,
|
5465
|
+
alignSelf,
|
5466
|
+
placeSelf,
|
5467
|
+
gridColumn: colSpan,
|
5468
|
+
gridColumnStart: colStart,
|
5469
|
+
gridColumnEnd: colEnd,
|
5470
|
+
gridRow: rowSpan,
|
5471
|
+
gridRowStart: rowStart,
|
5472
|
+
gridRowEnd: rowEnd
|
5473
|
+
});
|
5474
|
+
const HtmlElement = htmlTag;
|
5475
|
+
return /* @__PURE__ */ React59.createElement(HtmlElement, {
|
5476
|
+
style: __spreadValues(__spreadValues({}, hookStyle), style),
|
5477
|
+
className
|
5478
|
+
}, children);
|
5479
|
+
}
|
5480
|
+
);
|
5481
|
+
|
5482
|
+
// src/components/List/List.tsx
|
5483
|
+
import React60 from "react";
|
5484
|
+
|
5485
|
+
// src/components/ListItem/ListItem.tsx
|
5486
|
+
import React61 from "react";
|
5487
|
+
|
5488
|
+
// src/components/Modal/Modal.tsx
|
5489
|
+
import React63 from "react";
|
5490
|
+
import castArray from "lodash/castArray";
|
5491
|
+
import omit9 from "lodash/omit";
|
5492
|
+
import { Overlay as Overlay2, useModalOverlay as useModalOverlay2 } from "@react-aria/overlays";
|
5493
|
+
import { useDialog as useDialog2 } from "@react-aria/dialog";
|
5494
|
+
import { FocusScope as FocusScope3 } from "@react-aria/focus";
|
5495
|
+
import { useId as useId2 } from "@react-aria/utils";
|
5496
|
+
import { useOverlayTriggerState as useOverlayTriggerState4 } from "@react-stately/overlays";
|
5497
|
+
|
5498
|
+
// src/components/Tabs/Tabs.tsx
|
5499
|
+
import React62, { useRef as useRef6, useState as useState7, useEffect as useEffect5, useLayoutEffect as useLayoutEffect2 } from "react";
|
5500
|
+
import kebabCase from "lodash/kebabCase";
|
5501
|
+
import isNumber4 from "lodash/isNumber";
|
5502
|
+
var import_warningSign3 = __toESM(require_warningSign());
|
5503
|
+
var import_chevronLeft2 = __toESM(require_chevronLeft());
|
5504
|
+
var import_chevronRight2 = __toESM(require_chevronRight());
|
5505
|
+
var isTabComponent = (c) => {
|
5506
|
+
return React62.isValidElement(c) && (c.type === Tab || c.type === ModalTab);
|
5507
|
+
};
|
5508
|
+
var Tab = React62.forwardRef(
|
5509
|
+
({ className, id, title, children }, ref) => {
|
5510
|
+
return /* @__PURE__ */ React62.createElement("div", {
|
5511
|
+
ref,
|
5512
|
+
id: `${id != null ? id : kebabCase(title)}-panel`,
|
5513
|
+
className,
|
5514
|
+
role: "tabpanel",
|
5515
|
+
tabIndex: 0,
|
5516
|
+
"aria-labelledby": `${id != null ? id : kebabCase(title)}-tab`
|
5517
|
+
}, children);
|
5518
|
+
}
|
5519
|
+
);
|
5520
|
+
var TabContainer = (_a) => {
|
5521
|
+
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
5522
|
+
return /* @__PURE__ */ React62.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
5523
|
+
className: classNames("py-6 z-0", className)
|
5524
|
+
}), children);
|
5525
|
+
};
|
5526
|
+
var ModalTab = Tab;
|
5527
|
+
var ModalTabContainer = TabContainer;
|
5528
|
+
var asTabItem = (Component, displayName, { defaultUnderlineHidden } = {}) => {
|
5529
|
+
const Tab2 = React62.forwardRef(
|
5530
|
+
(_a, ref) => {
|
5531
|
+
var _b = _a, {
|
5532
|
+
id,
|
5533
|
+
value,
|
5534
|
+
status = "default",
|
5535
|
+
disabled,
|
5536
|
+
badge,
|
5537
|
+
tooltip,
|
5538
|
+
title,
|
5539
|
+
index,
|
5540
|
+
selected,
|
5541
|
+
onSelected,
|
5542
|
+
className
|
5543
|
+
} = _b, rest = __objRest(_b, [
|
5544
|
+
"id",
|
5545
|
+
"value",
|
5546
|
+
"status",
|
5547
|
+
"disabled",
|
5548
|
+
"badge",
|
5549
|
+
"tooltip",
|
5550
|
+
"title",
|
5551
|
+
"index",
|
5552
|
+
"selected",
|
5553
|
+
"onSelected",
|
5554
|
+
"className"
|
5555
|
+
]);
|
5556
|
+
const _id = id != null ? id : kebabCase(title);
|
5557
|
+
let statusIcon = void 0;
|
5558
|
+
if (status === "warning") {
|
5559
|
+
statusIcon = /* @__PURE__ */ React62.createElement(InlineIcon, {
|
5560
|
+
icon: import_warningSign3.default,
|
5561
|
+
color: "warning-80"
|
5562
|
+
});
|
5563
|
+
} else if (status === "error") {
|
5564
|
+
statusIcon = /* @__PURE__ */ React62.createElement(InlineIcon, {
|
5565
|
+
icon: import_warningSign3.default,
|
5566
|
+
color: "error-50"
|
5567
|
+
});
|
5568
|
+
}
|
5569
|
+
const tab = /* @__PURE__ */ React62.createElement(Component, __spreadValues({
|
5570
|
+
ref,
|
5571
|
+
id: `${_id}-tab`,
|
5572
|
+
onClick: () => !disabled && onSelected(value != null ? value : index),
|
5573
|
+
className: classNames(className, "px-5 py-3 z-10 no-underline appearance-none outline-none h-full", {
|
5574
|
+
"cursor-default": disabled,
|
5575
|
+
"text-grey-80 focus:text-primary-80": !selected,
|
5576
|
+
"hover:bg-grey-0 hover:border-grey-20": !selected && !disabled,
|
5577
|
+
"border-b-2": !defaultUnderlineHidden || selected,
|
5578
|
+
"border-grey-10": !selected,
|
5579
|
+
"border-primary-80": selected
|
5580
|
+
}),
|
5581
|
+
type: "button",
|
5582
|
+
role: "tab",
|
5583
|
+
"aria-selected": selected,
|
5584
|
+
"aria-controls": `${_id}-panel`,
|
5585
|
+
tabIndex: disabled ? void 0 : 0
|
5586
|
+
}, rest), /* @__PURE__ */ React62.createElement(Typography2, {
|
5587
|
+
htmlTag: "div",
|
5588
|
+
variant: "body-small",
|
5589
|
+
color: selected ? "primary-80" : disabled ? "grey-20" : "current",
|
5590
|
+
className: tw("inline-flex items-center gap-3")
|
5591
|
+
}, /* @__PURE__ */ React62.createElement("span", {
|
5592
|
+
className: tw("whitespace-nowrap")
|
5593
|
+
}, title), isNumber4(badge) && /* @__PURE__ */ React62.createElement(Typography2, {
|
5594
|
+
htmlTag: "span",
|
5595
|
+
variant: "body-small",
|
5596
|
+
color: selected ? "primary-80" : "grey-5",
|
5597
|
+
className: "leading-none"
|
5598
|
+
}, /* @__PURE__ */ React62.createElement(TabBadge, {
|
5599
|
+
kind: "filled",
|
5600
|
+
value: badge,
|
5601
|
+
textClassname: classNames({ "text-white": selected, "text-grey-50": !selected })
|
5602
|
+
})), statusIcon));
|
5603
|
+
return tooltip ? /* @__PURE__ */ React62.createElement(Tooltip, {
|
5604
|
+
content: tooltip
|
5605
|
+
}, tab) : tab;
|
5606
|
+
}
|
5607
|
+
);
|
5608
|
+
Tab2.displayName = displayName;
|
5609
|
+
return Tab2;
|
5610
|
+
};
|
5611
|
+
var TabItem = asTabItem("button", "TabItem");
|
5612
|
+
var createTabsComponent = (TabComponent, TabItemComponent, displayName, renderChildren) => {
|
5613
|
+
const Tabs2 = (props) => {
|
5614
|
+
var _a, _b;
|
5615
|
+
const { className, value, defaultValue, onChange, children } = props;
|
5616
|
+
const childArr = React62.Children.toArray(children);
|
5617
|
+
const firstTab = childArr[0];
|
5618
|
+
const firstTabValue = isTabComponent(firstTab) ? firstTab.props.value : -1;
|
5619
|
+
const [selected, setSelected] = useState7((_b = (_a = value != null ? value : defaultValue) != null ? _a : firstTabValue) != null ? _b : 0);
|
5620
|
+
const [leftCaret, showLeftCaret] = useState7(false);
|
5621
|
+
const [rightCaret, showRightCaret] = useState7(false);
|
5622
|
+
const parentRef = useRef6(null);
|
5623
|
+
const containerRef = useRef6(null);
|
5624
|
+
const tabsRef = useRef6(null);
|
5625
|
+
useEffect5(() => {
|
5626
|
+
if (value !== void 0) {
|
5627
|
+
setSelected(value);
|
5628
|
+
}
|
5629
|
+
}, [value]);
|
5630
|
+
useLayoutEffect2(() => {
|
5631
|
+
var _a2;
|
5632
|
+
const updateCarets = () => {
|
5633
|
+
const pEl = parentRef.current;
|
5634
|
+
const el = containerRef.current;
|
5635
|
+
if (!pEl || !el) {
|
5636
|
+
return;
|
5637
|
+
}
|
5638
|
+
const { width } = pEl.getBoundingClientRect();
|
5639
|
+
showLeftCaret(el.scrollWidth > width && el.scrollLeft !== 0);
|
5640
|
+
showRightCaret(
|
5641
|
+
el.scrollWidth > width && Math.round(el.scrollLeft + el.getBoundingClientRect().width) !== Math.round(el.scrollWidth)
|
5642
|
+
);
|
5643
|
+
};
|
5644
|
+
updateCarets();
|
5645
|
+
(_a2 = containerRef.current) == null ? void 0 : _a2.addEventListener("scroll", updateCarets);
|
5646
|
+
window.addEventListener("resize", updateCarets);
|
5647
|
+
return () => {
|
5648
|
+
var _a3;
|
5649
|
+
(_a3 = containerRef.current) == null ? void 0 : _a3.removeEventListener("scroll", updateCarets);
|
5650
|
+
window.removeEventListener("resize", updateCarets);
|
5651
|
+
};
|
5652
|
+
}, [parentRef.current, containerRef.current]);
|
5653
|
+
const handleScrollToNext = (direction) => {
|
5654
|
+
const container = containerRef.current;
|
5655
|
+
const tabs = tabsRef.current;
|
5656
|
+
if (!container || !tabs) {
|
5657
|
+
return;
|
5658
|
+
}
|
5659
|
+
const { width: containerWidth, x: containerX } = container.getBoundingClientRect();
|
5660
|
+
const children2 = Array.from(tabs.childNodes).filter(
|
5661
|
+
(c) => c instanceof HTMLElement
|
5662
|
+
);
|
5663
|
+
if (direction === "right") {
|
5664
|
+
const next = children2.find((c) => {
|
5665
|
+
const { x, width } = c.getBoundingClientRect();
|
5666
|
+
return Math.round(x + width - containerX - containerWidth) > 0;
|
5667
|
+
});
|
5668
|
+
if (next instanceof HTMLElement) {
|
5669
|
+
const { x, width } = next.getBoundingClientRect();
|
5670
|
+
container.scrollTo({
|
5671
|
+
left: container.scrollLeft + Math.ceil(x + width - containerX - containerWidth),
|
5672
|
+
behavior: "smooth"
|
5673
|
+
});
|
5674
|
+
}
|
5675
|
+
} else {
|
5676
|
+
const next = children2.find((c) => {
|
5677
|
+
const { x, width } = c.getBoundingClientRect();
|
5678
|
+
return Math.round(x + width - containerX) >= 0;
|
5679
|
+
});
|
5680
|
+
if (next instanceof HTMLElement) {
|
5681
|
+
const { x } = next.getBoundingClientRect();
|
5682
|
+
container.scrollTo({ left: container.scrollLeft - Math.abs(x - containerX), behavior: "smooth" });
|
5683
|
+
}
|
5684
|
+
}
|
5685
|
+
};
|
5686
|
+
const handleKeyDown = (event) => {
|
5687
|
+
const target = event.target;
|
5688
|
+
const parent = target.parentElement;
|
5689
|
+
const first = parent.firstChild;
|
5690
|
+
const last = parent.lastChild;
|
5691
|
+
const next = target.nextElementSibling;
|
5692
|
+
const prev = target.previousElementSibling;
|
5693
|
+
if (event.key === "ArrowRight") {
|
5694
|
+
(next != null ? next : first).focus();
|
5695
|
+
} else if (event.key === "ArrowLeft") {
|
5696
|
+
(prev != null ? prev : last).focus();
|
5697
|
+
}
|
5698
|
+
};
|
5699
|
+
const handleSelected = (key) => {
|
5700
|
+
(onChange != null ? onChange : setSelected)(key);
|
5701
|
+
};
|
5702
|
+
React62.Children.forEach(children, (c) => {
|
5703
|
+
if (c && !isTabComponent(c)) {
|
5704
|
+
throw new Error("<Tabs> can only have <Tabs.Tab> components as children");
|
5705
|
+
}
|
5706
|
+
});
|
5707
|
+
return /* @__PURE__ */ React62.createElement("div", {
|
5708
|
+
ref: parentRef,
|
5709
|
+
className: classNames(tw("h-full"), className)
|
5710
|
+
}, /* @__PURE__ */ React62.createElement("div", {
|
5711
|
+
className: tw("relative flex items-center h-full border-b-2 border-grey-10")
|
5712
|
+
}, /* @__PURE__ */ React62.createElement("div", {
|
5713
|
+
ref: containerRef,
|
5714
|
+
className: tw("overflow-y-auto scrollbar-hide h-full mb-[-2px]")
|
5715
|
+
}, /* @__PURE__ */ React62.createElement("div", {
|
5716
|
+
ref: tabsRef,
|
5717
|
+
role: "tablist",
|
5718
|
+
"aria-label": "tabs",
|
5719
|
+
className: tw("inline-flex items-center cursor-pointer font-normal h-full")
|
5720
|
+
}, React62.Children.map(
|
5721
|
+
children,
|
5722
|
+
(tab, index) => tab ? /* @__PURE__ */ React62.createElement(TabItemComponent, __spreadProps(__spreadValues({
|
5723
|
+
key: tab.props.value
|
5724
|
+
}, tab.props), {
|
5725
|
+
index,
|
5726
|
+
selected: tab.props.value !== void 0 ? tab.props.value === selected : index === selected,
|
5727
|
+
onKeyDown: handleKeyDown,
|
5728
|
+
onSelected: handleSelected
|
5729
|
+
})) : void 0
|
5730
|
+
))), leftCaret && /* @__PURE__ */ React62.createElement("div", {
|
5731
|
+
className: tw("absolute left-0 bg-gradient-to-r from-white via-white z-20 py-3 pr-4")
|
5732
|
+
}, /* @__PURE__ */ React62.createElement("div", {
|
5733
|
+
onClick: () => handleScrollToNext("left"),
|
5734
|
+
className: tw("hover:bg-grey-0 p-2 leading-none cursor-pointer")
|
5735
|
+
}, /* @__PURE__ */ React62.createElement(InlineIcon, {
|
5736
|
+
icon: import_chevronLeft2.default
|
5737
|
+
}))), rightCaret && /* @__PURE__ */ React62.createElement("div", {
|
5738
|
+
onClick: () => handleScrollToNext("right"),
|
5739
|
+
className: tw("absolute right-0 bg-gradient-to-l from-white via-white z-20 py-3 pl-4")
|
5740
|
+
}, /* @__PURE__ */ React62.createElement("div", {
|
5741
|
+
onClick: () => handleScrollToNext("right"),
|
5742
|
+
className: tw("hover:bg-grey-0 p-2 leading-none cursor-pointer")
|
5743
|
+
}, /* @__PURE__ */ React62.createElement(InlineIcon, {
|
5744
|
+
icon: import_chevronRight2.default
|
5745
|
+
})))), renderChildren(children, selected, props));
|
5746
|
+
};
|
5747
|
+
Tabs2.displayName = displayName;
|
5748
|
+
Tabs2.Tab = TabComponent;
|
5749
|
+
return Tabs2;
|
5750
|
+
};
|
5751
|
+
var Tabs = createTabsComponent(Tab, TabItem, "Tabs", (children, selected) => /* @__PURE__ */ React62.createElement(TabContainer, null, children.find(
|
5752
|
+
(node, index) => (node == null ? void 0 : node.props.value) === selected || index === selected
|
5753
|
+
)));
|
5754
|
+
|
5755
|
+
// src/components/Modal/Modal.tsx
|
5756
|
+
var import_cross5 = __toESM(require_cross());
|
5757
|
+
var ModalTabs = createTabsComponent(
|
5758
|
+
ModalTab,
|
5759
|
+
TabItem,
|
5760
|
+
"ModalTabs",
|
5761
|
+
(children, selected, props) => /* @__PURE__ */ React63.createElement(Modal.Body, {
|
5762
|
+
maxHeight: props.maxHeight
|
5763
|
+
}, /* @__PURE__ */ React63.createElement(ModalTabContainer, null, children.find(
|
5764
|
+
(node, index) => (node == null ? void 0 : node.props.value) === selected || index === selected
|
5765
|
+
)))
|
5766
|
+
);
|
5767
|
+
|
5768
|
+
// src/components/MultiInput/MultiInput.tsx
|
5769
|
+
import castArray2 from "lodash/castArray";
|
5770
|
+
import identity from "lodash/identity";
|
5771
|
+
import uniqueId4 from "lodash/uniqueId";
|
5772
|
+
import omit10 from "lodash/omit";
|
5773
|
+
import React65, { useEffect as useEffect6, useRef as useRef7, useState as useState8 } from "react";
|
5774
|
+
|
5775
|
+
// src/components/MultiInput/InputChip.tsx
|
5776
|
+
var import_smallCross = __toESM(require_smallCross());
|
5777
|
+
import React64 from "react";
|
5778
|
+
var InputChip = React64.forwardRef(
|
5779
|
+
(_a, ref) => {
|
5780
|
+
var _b = _a, { invalid = false, disabled, readOnly, className, onClick: _onClick, children } = _b, props = __objRest(_b, ["invalid", "disabled", "readOnly", "className", "onClick", "children"]);
|
5781
|
+
const onClick = (e) => {
|
5782
|
+
if (!disabled && !readOnly) {
|
5783
|
+
_onClick == null ? void 0 : _onClick(e);
|
5784
|
+
}
|
5785
|
+
};
|
5786
|
+
return /* @__PURE__ */ React64.createElement("div", __spreadValues({
|
5787
|
+
ref,
|
5788
|
+
role: "button",
|
5789
|
+
className: classNames(className, "inline-flex align-middle mx-1 px-2 py-1 items-center rounded-sm break-all", {
|
5790
|
+
"bg-error-0 ": invalid,
|
5791
|
+
"bg-grey-0": !invalid && !disabled,
|
5792
|
+
"cursor-default": readOnly,
|
5793
|
+
"bg-grey-5 pointer-events-none": disabled
|
5794
|
+
}),
|
5795
|
+
onClick
|
5796
|
+
}, props), /* @__PURE__ */ React64.createElement(Typography2, {
|
5797
|
+
variant: "body-small",
|
5798
|
+
color: invalid ? "error-80" : disabled ? "grey-40" : "grey-70"
|
5799
|
+
}, children), !readOnly && /* @__PURE__ */ React64.createElement("div", null, /* @__PURE__ */ React64.createElement(Icon, {
|
5800
|
+
icon: import_smallCross.default,
|
5801
|
+
className: tw("ml-2", {
|
5802
|
+
"text-error-70": invalid,
|
5803
|
+
"text-grey-70": !invalid
|
5804
|
+
})
|
5805
|
+
})));
|
5806
|
+
}
|
5807
|
+
);
|
5808
|
+
|
5809
|
+
// src/components/MultiInput/MultiInput.tsx
|
5810
|
+
var MultiInputBase = (_a) => {
|
5811
|
+
var _b = _a, {
|
5812
|
+
id,
|
5813
|
+
name,
|
5814
|
+
type,
|
5815
|
+
placeholder,
|
5816
|
+
autoFocus,
|
5817
|
+
delimiter = "enter",
|
5818
|
+
defaultValue,
|
5819
|
+
value,
|
5820
|
+
endAdornment,
|
5821
|
+
max,
|
5822
|
+
maxLength = max,
|
5823
|
+
inline = true,
|
5824
|
+
itemToString = (val) => String(val),
|
5825
|
+
createItem = (val) => val,
|
5826
|
+
onChange,
|
5827
|
+
onInputChange,
|
5828
|
+
isItemValid,
|
5829
|
+
disabled = false,
|
5830
|
+
readOnly = false,
|
5831
|
+
valid = true
|
5832
|
+
} = _b, props = __objRest(_b, [
|
5833
|
+
"id",
|
5834
|
+
"name",
|
5835
|
+
"type",
|
5836
|
+
"placeholder",
|
5837
|
+
"autoFocus",
|
5838
|
+
"delimiter",
|
5839
|
+
"defaultValue",
|
5840
|
+
"value",
|
5841
|
+
"endAdornment",
|
5842
|
+
"max",
|
5843
|
+
"maxLength",
|
5844
|
+
"inline",
|
5845
|
+
"itemToString",
|
5846
|
+
"createItem",
|
5847
|
+
"onChange",
|
5848
|
+
"onInputChange",
|
5849
|
+
"isItemValid",
|
5850
|
+
"disabled",
|
5851
|
+
"readOnly",
|
5852
|
+
"valid"
|
5853
|
+
]);
|
5854
|
+
var _a2;
|
5855
|
+
const inputRef = useRef7(null);
|
5856
|
+
const [items, setItems] = useState8((_a2 = value != null ? value : defaultValue) != null ? _a2 : []);
|
5857
|
+
const [hasFocus, setFocus] = useState8(false);
|
5858
|
+
const keyCodes = [delimiter !== "enter" ? " " : null, delimiter !== "space" ? "Enter" : null].filter(identity);
|
5859
|
+
useEffect6(() => {
|
5860
|
+
const requiresUpdate = value !== void 0 || defaultValue === void 0;
|
5861
|
+
if (requiresUpdate && JSON.stringify(value) !== JSON.stringify(items)) {
|
5862
|
+
setItems(value != null ? value : []);
|
5863
|
+
}
|
5864
|
+
}, [JSON.stringify(value)]);
|
5865
|
+
const handleKeyDown = (e) => {
|
5866
|
+
var _a3, _b2, _c;
|
5867
|
+
switch (e.key) {
|
5868
|
+
case "Enter":
|
5869
|
+
case " ": {
|
5870
|
+
if (keyCodes.includes(e.key) && inputRef.current) {
|
5871
|
+
e.stopPropagation();
|
5872
|
+
const value2 = inputRef.current.value.trim();
|
5873
|
+
handleAddItem(value2);
|
5874
|
+
}
|
5875
|
+
break;
|
5876
|
+
}
|
5877
|
+
case "Backspace": {
|
5878
|
+
const length = (_a3 = items == null ? void 0 : items.length) != null ? _a3 : 0;
|
5879
|
+
if (inline && !((_c = (_b2 = inputRef.current) == null ? void 0 : _b2.value) == null ? void 0 : _c.length) && length > 0) {
|
5880
|
+
handleRemoveItem(length - 1);
|
5881
|
+
}
|
5882
|
+
break;
|
5883
|
+
}
|
5884
|
+
default:
|
5885
|
+
break;
|
5886
|
+
}
|
5887
|
+
};
|
5888
|
+
const handleKeyUp = (e) => {
|
5889
|
+
if (keyCodes.includes(e.key)) {
|
5890
|
+
e.stopPropagation();
|
5891
|
+
}
|
5892
|
+
};
|
5893
|
+
const handleAddItem = (value2) => {
|
5894
|
+
if (inputRef.current) {
|
5895
|
+
inputRef.current.value = "";
|
5896
|
+
}
|
5897
|
+
if (value2) {
|
5898
|
+
const newItems = castArray2(value2).map(createItem).filter((item) => !items.includes(item));
|
5899
|
+
if (newItems.length > 0 && items.length + newItems.length <= (maxLength != null ? maxLength : Number.MAX_SAFE_INTEGER)) {
|
5900
|
+
const updated = (items != null ? items : []).concat(newItems);
|
5901
|
+
setItems(updated);
|
5902
|
+
onChange == null ? void 0 : onChange(updated);
|
5903
|
+
}
|
5904
|
+
}
|
5905
|
+
};
|
5906
|
+
const handleRemoveItem = (idx) => {
|
5907
|
+
const updated = [...items != null ? items : []];
|
5908
|
+
updated.splice(idx, 1);
|
5909
|
+
setItems(updated);
|
5910
|
+
onChange == null ? void 0 : onChange(updated);
|
5911
|
+
};
|
5912
|
+
const handlePaste = (e) => {
|
5913
|
+
e.preventDefault();
|
5914
|
+
const copiedText = e.clipboardData.getData("text/plain");
|
5915
|
+
const spaceSeparated = copiedText.split(" ");
|
5916
|
+
const newLineSeparated = copiedText.split("\n");
|
5917
|
+
const commaSeparated = copiedText.split(",");
|
5918
|
+
const separatedText = [spaceSeparated, newLineSeparated, commaSeparated].filter((items2) => items2.length > 1).shift() || [copiedText];
|
5919
|
+
const itemsToAdd = separatedText.map((value2) => value2.trim()).filter(identity);
|
5920
|
+
handleAddItem(itemsToAdd);
|
5921
|
+
};
|
5922
|
+
const handleFocus = () => {
|
5923
|
+
setFocus(true);
|
5924
|
+
};
|
5925
|
+
const handleBlur = () => {
|
5926
|
+
var _a3;
|
5927
|
+
setFocus(false);
|
5928
|
+
const value2 = (_a3 = inputRef.current) == null ? void 0 : _a3.value;
|
5929
|
+
if (value2) {
|
5930
|
+
handleAddItem(value2);
|
5931
|
+
}
|
5932
|
+
};
|
5933
|
+
const renderChips = () => items == null ? void 0 : items.map((item, index) => {
|
5934
|
+
var _a3;
|
5935
|
+
return /* @__PURE__ */ React65.createElement(InputChip, {
|
5936
|
+
key: `${itemToString(item)}.${index}`,
|
5937
|
+
invalid: !((_a3 = isItemValid == null ? void 0 : isItemValid(item, index)) != null ? _a3 : true),
|
5938
|
+
readOnly,
|
5939
|
+
disabled,
|
5940
|
+
onClick: (e) => {
|
5941
|
+
e.stopPropagation();
|
5942
|
+
handleRemoveItem(index);
|
5943
|
+
}
|
5944
|
+
}, itemToString(item));
|
5945
|
+
});
|
5946
|
+
return /* @__PURE__ */ React65.createElement("div", null, /* @__PURE__ */ React65.createElement(Select.InputContainer, {
|
5947
|
+
variant: disabled ? "disabled" : valid === false ? "error" : readOnly ? "readOnly" : hasFocus ? "focused" : "default"
|
5948
|
+
}, /* @__PURE__ */ React65.createElement("div", {
|
5949
|
+
className: "grow inline-flex flex-row flex-wrap gap-y-2"
|
5950
|
+
}, inline && renderChips(), /* @__PURE__ */ React65.createElement(Select.Input, __spreadProps(__spreadValues({
|
5951
|
+
ref: inputRef,
|
5952
|
+
id: id != null ? id : name,
|
5953
|
+
name,
|
5954
|
+
type
|
5955
|
+
}, props), {
|
5956
|
+
onChange: onInputChange,
|
5957
|
+
autoFocus,
|
5958
|
+
disabled,
|
5959
|
+
readOnly,
|
5960
|
+
placeholder: !inline || (items == null ? void 0 : items.length) === 0 ? placeholder : "",
|
5961
|
+
onKeyDown: handleKeyDown,
|
5962
|
+
onKeyUp: handleKeyUp,
|
5963
|
+
onPaste: handlePaste,
|
5964
|
+
onFocus: handleFocus,
|
5965
|
+
onBlur: handleBlur,
|
5966
|
+
autoComplete: "off"
|
5967
|
+
}))), endAdornment && /* @__PURE__ */ React65.createElement(InputAdornment, null, endAdornment)), !inline && /* @__PURE__ */ React65.createElement("div", {
|
5968
|
+
className: tw("flex flex-row flex-wrap gap-y-2 mt-2")
|
5969
|
+
}, renderChips()));
|
5970
|
+
};
|
5971
|
+
var BaseMultiInputSkeleton = () => /* @__PURE__ */ React65.createElement(Skeleton, {
|
5972
|
+
height: 38
|
5973
|
+
});
|
5974
|
+
MultiInputBase.Skeleton = BaseMultiInputSkeleton;
|
5975
|
+
var MultiInput = (props) => {
|
5976
|
+
var _a, _b, _c, _d, _e;
|
5977
|
+
const maxLength = (_a = props.maxLength) != null ? _a : props.max;
|
5978
|
+
const [value, setValue] = useState8((_c = (_b = props.value) != null ? _b : props.defaultValue) != null ? _c : []);
|
5979
|
+
useEffect6(() => {
|
5980
|
+
var _a2;
|
5981
|
+
setValue((_a2 = props.value) != null ? _a2 : []);
|
5982
|
+
}, [JSON.stringify(props.value)]);
|
5983
|
+
const id = useRef7((_e = (_d = props.id) != null ? _d : props.name) != null ? _e : `multiinput-${uniqueId4()}`);
|
5984
|
+
const errorMessageId = uniqueId4();
|
5985
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
5986
|
+
const labelControlProps = getLabelControlProps(props);
|
5987
|
+
const baseProps = omit10(props, Object.keys(labelControlProps));
|
5988
|
+
return /* @__PURE__ */ React65.createElement(LabelControl, __spreadProps(__spreadValues({
|
5989
|
+
id: `${id.current}-label`,
|
5990
|
+
htmlFor: `${id.current}-input`,
|
5991
|
+
messageId: errorMessageId
|
5992
|
+
}, labelControlProps), {
|
5993
|
+
length: value.length,
|
5994
|
+
maxLength
|
5995
|
+
}), /* @__PURE__ */ React65.createElement(MultiInputBase, __spreadProps(__spreadValues(__spreadValues({}, baseProps), errorProps), {
|
5996
|
+
id: `${id.current}-input`,
|
5997
|
+
onChange: (value2) => {
|
5998
|
+
var _a2;
|
5999
|
+
setValue(value2 != null ? value2 : []);
|
6000
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, value2);
|
6001
|
+
},
|
6002
|
+
disabled: props.disabled,
|
6003
|
+
maxLength: props.maxLength,
|
6004
|
+
valid: props.valid
|
6005
|
+
})));
|
6006
|
+
};
|
6007
|
+
var MultiInputSkeleton = () => /* @__PURE__ */ React65.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React65.createElement(MultiInputBase.Skeleton, null));
|
6008
|
+
MultiInput.Skeleton = MultiInputSkeleton;
|
6009
|
+
MultiInput.Skeleton.displayName = "MultiInput.Skeleton";
|
6010
|
+
|
6011
|
+
// src/components/MultiSelect/MultiSelect.tsx
|
6012
|
+
import { useCombobox as useCombobox2, useMultipleSelection } from "downshift";
|
6013
|
+
import isNil from "lodash/isNil";
|
6014
|
+
import omit11 from "lodash/omit";
|
6015
|
+
import omitBy from "lodash/omitBy";
|
6016
|
+
import uniqueId5 from "lodash/uniqueId";
|
6017
|
+
import { matchSorter as matchSorter2 } from "match-sorter";
|
6018
|
+
import React66, { useRef as useRef8, useState as useState9 } from "react";
|
6019
|
+
import { useOverlayPosition as useOverlayPosition5 } from "@react-aria/overlays";
|
6020
|
+
var MultiSelectBase = (_a) => {
|
6021
|
+
var _b = _a, {
|
6022
|
+
id,
|
6023
|
+
name,
|
6024
|
+
placeholder,
|
6025
|
+
maxHeight,
|
6026
|
+
closeOnSelect = true,
|
6027
|
+
hideChips = false,
|
6028
|
+
inline = true,
|
6029
|
+
options,
|
6030
|
+
optionKeys = ["label", "value"],
|
6031
|
+
noResults,
|
6032
|
+
optionToString: itemToString = getOptionLabelBuiltin,
|
6033
|
+
renderOption = (opt) => itemToString(opt),
|
6034
|
+
isOptionDisabled = isOptionDisabledBuiltin,
|
6035
|
+
createOption,
|
6036
|
+
defaultValue,
|
6037
|
+
value,
|
6038
|
+
onChange,
|
6039
|
+
valid = true,
|
6040
|
+
disabled = false,
|
6041
|
+
readOnly = false,
|
6042
|
+
children
|
6043
|
+
} = _b, props = __objRest(_b, [
|
6044
|
+
"id",
|
6045
|
+
"name",
|
6046
|
+
"placeholder",
|
6047
|
+
"maxHeight",
|
6048
|
+
"closeOnSelect",
|
6049
|
+
"hideChips",
|
6050
|
+
"inline",
|
6051
|
+
"options",
|
6052
|
+
"optionKeys",
|
6053
|
+
"noResults",
|
6054
|
+
"optionToString",
|
6055
|
+
"renderOption",
|
6056
|
+
"isOptionDisabled",
|
6057
|
+
"createOption",
|
6058
|
+
"defaultValue",
|
6059
|
+
"value",
|
6060
|
+
"onChange",
|
6061
|
+
"valid",
|
6062
|
+
"disabled",
|
6063
|
+
"readOnly",
|
6064
|
+
"children"
|
6065
|
+
]);
|
6066
|
+
var _a2;
|
6067
|
+
const targetRef = useRef8(null);
|
6068
|
+
const overlayRef = useRef8(null);
|
6069
|
+
const [inputValue, setInputValue] = useState9("");
|
6070
|
+
const [hasFocus, setFocus] = useState9(false);
|
6071
|
+
const { selectedItems, addSelectedItem, removeSelectedItem, getDropdownProps, getSelectedItemProps } = useMultipleSelection(
|
6072
|
+
omitBy(
|
6073
|
+
{
|
6074
|
+
selectedItems: value,
|
6075
|
+
defaultSelectedItems: defaultValue,
|
6076
|
+
onSelectedItemsChange: (e) => onChange == null ? void 0 : onChange(e.selectedItems)
|
6077
|
+
},
|
6078
|
+
isNil
|
6079
|
+
)
|
6080
|
+
);
|
6081
|
+
const keys = typeof options[0] === "string" ? void 0 : optionKeys;
|
6082
|
+
const selectedItemsAsStrings = selectedItems.map(itemToString);
|
6083
|
+
const filteredOptions = (inputValue ? matchSorter2(options, inputValue, { keys }) : options).filter(
|
6084
|
+
(opt) => !selectedItemsAsStrings.includes(itemToString(opt))
|
6085
|
+
);
|
6086
|
+
const { isOpen, closeMenu, highlightedIndex, getInputProps, getMenuProps, getToggleButtonProps, getItemProps } = useCombobox2({
|
6087
|
+
id,
|
6088
|
+
inputValue,
|
6089
|
+
defaultHighlightedIndex: 0,
|
6090
|
+
selectedItem: null,
|
6091
|
+
items: filteredOptions,
|
6092
|
+
stateReducer: (_, actionChanges) => {
|
6093
|
+
const { changes, type } = actionChanges;
|
6094
|
+
switch (type) {
|
6095
|
+
case useCombobox2.stateChangeTypes.InputKeyDownEnter:
|
6096
|
+
case useCombobox2.stateChangeTypes.ItemClick: {
|
6097
|
+
return __spreadProps(__spreadValues({}, changes), {
|
6098
|
+
isOpen: !closeOnSelect
|
6099
|
+
});
|
6100
|
+
}
|
6101
|
+
}
|
6102
|
+
return changes;
|
6103
|
+
},
|
6104
|
+
onStateChange: ({ inputValue: inputValue2, selectedItem, type }) => {
|
6105
|
+
switch (type) {
|
6106
|
+
case useCombobox2.stateChangeTypes.InputChange: {
|
6107
|
+
setInputValue(inputValue2 != null ? inputValue2 : "");
|
6108
|
+
break;
|
6109
|
+
}
|
6110
|
+
case useCombobox2.stateChangeTypes.InputKeyDownEnter:
|
6111
|
+
case useCombobox2.stateChangeTypes.ItemClick:
|
6112
|
+
case useCombobox2.stateChangeTypes.InputBlur: {
|
6113
|
+
if (selectedItem && !isOptionDisabled(selectedItem, options.indexOf(selectedItem))) {
|
6114
|
+
setInputValue("");
|
6115
|
+
addSelectedItem(selectedItem);
|
6116
|
+
}
|
6117
|
+
break;
|
6118
|
+
}
|
6119
|
+
}
|
6120
|
+
}
|
6121
|
+
});
|
6122
|
+
const { overlayProps } = useOverlayPosition5({
|
6123
|
+
targetRef,
|
6124
|
+
overlayRef,
|
6125
|
+
placement: "bottom start",
|
6126
|
+
shouldFlip: true,
|
6127
|
+
isOpen
|
6128
|
+
});
|
6129
|
+
const inputProps = getInputProps(getDropdownProps({ preventKeyAction: isOpen, disabled: disabled || readOnly }));
|
6130
|
+
const renderChips = () => {
|
6131
|
+
return selectedItems.map((selectedItem, index) => /* @__PURE__ */ React66.createElement(InputChip, __spreadProps(__spreadValues({
|
6132
|
+
key: `${itemToString(selectedItem)}.chip`,
|
6133
|
+
className: tw("mx-0"),
|
6134
|
+
disabled,
|
6135
|
+
readOnly
|
6136
|
+
}, getSelectedItemProps({ selectedItem, index })), {
|
6137
|
+
onClick: (e) => {
|
6138
|
+
e.stopPropagation();
|
6139
|
+
removeSelectedItem(selectedItem);
|
6140
|
+
}
|
6141
|
+
}), itemToString(selectedItem)));
|
6142
|
+
};
|
6143
|
+
const hasNoResults = options.length === 0 || filteredOptions.length === 0;
|
6144
|
+
const width = (_a2 = targetRef.current) == null ? void 0 : _a2.offsetWidth;
|
6145
|
+
const style = isOpen ? __spreadProps(__spreadValues({}, overlayProps.style), { width }) : { display: "none" };
|
6146
|
+
return /* @__PURE__ */ React66.createElement("div", {
|
6147
|
+
className: tw("relative")
|
6148
|
+
}, /* @__PURE__ */ React66.createElement(Select.InputContainer, {
|
6149
|
+
ref: targetRef,
|
6150
|
+
variant: disabled ? "disabled" : !valid ? "error" : readOnly ? "readOnly" : hasFocus ? "focused" : "default"
|
6151
|
+
}, /* @__PURE__ */ React66.createElement("div", {
|
6152
|
+
className: "grow inline-flex flex-row flex-wrap gap-2"
|
6153
|
+
}, !hideChips && inline && renderChips(), /* @__PURE__ */ React66.createElement(Select.Input, __spreadProps(__spreadValues(__spreadValues({
|
6154
|
+
id,
|
6155
|
+
name,
|
6156
|
+
placeholder: selectedItems.length === 0 && !readOnly ? placeholder : "",
|
6157
|
+
value: inputValue != null ? inputValue : ""
|
6158
|
+
}, inputProps), props), {
|
6159
|
+
disabled,
|
6160
|
+
readOnly,
|
6161
|
+
onKeyDown: (e) => {
|
6162
|
+
var _a3;
|
6163
|
+
e.stopPropagation();
|
6164
|
+
(_a3 = inputProps.onKeyDown) == null ? void 0 : _a3.call(inputProps, e);
|
6165
|
+
},
|
6166
|
+
onKeyUp: (e) => e.stopPropagation(),
|
6167
|
+
onFocus: () => setFocus(true),
|
6168
|
+
onBlur: () => setFocus(false)
|
6169
|
+
}))), !readOnly && /* @__PURE__ */ React66.createElement(Select.Toggle, __spreadValues({
|
6170
|
+
hasFocus,
|
6171
|
+
isOpen
|
6172
|
+
}, getToggleButtonProps({ disabled })))), !hideChips && !inline && /* @__PURE__ */ React66.createElement("div", {
|
6173
|
+
className: tw("flex flex-row flex-wrap gap-2 mt-2")
|
6174
|
+
}, renderChips()), /* @__PURE__ */ React66.createElement(PopoverWrapper, __spreadProps(__spreadValues({
|
6175
|
+
isOpen: true,
|
6176
|
+
isDismissable: true,
|
6177
|
+
autoFocus: true
|
6178
|
+
}, getMenuProps({ ref: overlayRef })), {
|
6179
|
+
style,
|
6180
|
+
onClose: closeMenu
|
6181
|
+
}), /* @__PURE__ */ React66.createElement(Select.Menu, {
|
6182
|
+
maxHeight
|
6183
|
+
}, isOpen && hasNoResults && /* @__PURE__ */ React66.createElement(Select.NoResults, null, noResults), isOpen && filteredOptions.map((item, index) => /* @__PURE__ */ React66.createElement(Select.Item, __spreadValues({
|
6184
|
+
key: itemToString(item),
|
6185
|
+
highlighted: index === highlightedIndex,
|
6186
|
+
selected: selectedItems.includes(item)
|
6187
|
+
}, getItemProps({ item, index, disabled: isOptionDisabled(item, index) })), renderOption(item))))));
|
6188
|
+
};
|
6189
|
+
var MultiSelectBaseSkeleton = () => /* @__PURE__ */ React66.createElement(Skeleton, {
|
6190
|
+
height: 38
|
6191
|
+
});
|
6192
|
+
MultiSelectBase.Skeleton = MultiSelectBaseSkeleton;
|
6193
|
+
var MultiSelect = (_a) => {
|
6194
|
+
var _b = _a, {
|
6195
|
+
options,
|
6196
|
+
noResults
|
6197
|
+
} = _b, props = __objRest(_b, [
|
6198
|
+
"options",
|
6199
|
+
"noResults"
|
6200
|
+
]);
|
6201
|
+
var _a2;
|
6202
|
+
const id = useRef8((_a2 = props.id) != null ? _a2 : `multiselect-${uniqueId5()}`);
|
6203
|
+
const errorMessageId = uniqueId5();
|
6204
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
6205
|
+
const labelControlProps = getLabelControlProps(props);
|
6206
|
+
const baseProps = omit11(props, Object.keys(labelControlProps));
|
6207
|
+
return /* @__PURE__ */ React66.createElement(LabelControl, __spreadValues({
|
6208
|
+
id: `${id.current}-label`,
|
6209
|
+
htmlFor: `${id.current}-input`,
|
6210
|
+
messageId: errorMessageId
|
6211
|
+
}, labelControlProps), /* @__PURE__ */ React66.createElement(MultiSelectBase, __spreadProps(__spreadValues(__spreadValues({}, baseProps), errorProps), {
|
6212
|
+
id: id.current,
|
6213
|
+
options,
|
6214
|
+
noResults,
|
6215
|
+
disabled: props.disabled,
|
6216
|
+
valid: props.valid
|
6217
|
+
})));
|
6218
|
+
};
|
6219
|
+
var MultiSelectSkeleton = () => /* @__PURE__ */ React66.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React66.createElement(MultiSelectBase.Skeleton, null));
|
6220
|
+
MultiSelect.Skeleton = MultiSelectSkeleton;
|
6221
|
+
MultiSelect.Skeleton.displayName = "MultiSelect.Skeleton";
|
6222
|
+
|
6223
|
+
// src/components/NativeSelect/NativeSelect.tsx
|
6224
|
+
import React67, { useRef as useRef9 } from "react";
|
6225
|
+
import uniqueId6 from "lodash/uniqueId";
|
6226
|
+
import omit12 from "lodash/omit";
|
6227
|
+
var import_caretDown = __toESM(require_caretDown());
|
6228
|
+
var NativeSelectBase = React67.forwardRef(
|
6229
|
+
(_a, ref) => {
|
6230
|
+
var _b = _a, { children, disabled = false, required = false, valid = true, readOnly = false, emptyDefault } = _b, props = __objRest(_b, ["children", "disabled", "required", "valid", "readOnly", "emptyDefault"]);
|
6231
|
+
return /* @__PURE__ */ React67.createElement("span", {
|
6232
|
+
className: tw("relative block")
|
6233
|
+
}, !readOnly && /* @__PURE__ */ React67.createElement("span", {
|
6234
|
+
className: tw(
|
6235
|
+
"absolute right-0 inset-y-0 mr-4 text-grey-40 flex ml-3 pointer-events-none typography-body-default-medium mt-4"
|
6236
|
+
)
|
6237
|
+
}, /* @__PURE__ */ React67.createElement(Icon, {
|
6238
|
+
icon: import_caretDown.default,
|
6239
|
+
"data-testid": "icon-dropdown"
|
6240
|
+
})), /* @__PURE__ */ React67.createElement("select", __spreadProps(__spreadValues({
|
6241
|
+
ref,
|
6242
|
+
disabled: disabled || readOnly,
|
6243
|
+
required
|
6244
|
+
}, props), {
|
6245
|
+
className: classNames(
|
6246
|
+
tw(
|
6247
|
+
"block w-full rounded-sm appearance-none disabled:cursor-not-allowed typography-body-small text-grey-70 placeholder:text-grey-40 focus:outline-none",
|
6248
|
+
{
|
6249
|
+
"px-3 py-3 disabled:border-grey-20 disabled:bg-grey-5 disabled:text-grey-40": !readOnly,
|
6250
|
+
"px-0 py-3 border-none": readOnly,
|
6251
|
+
"border border-error-50": !valid && !readOnly,
|
6252
|
+
"border border-grey-20 hover:border-grey-50 focus:border-info-70": valid && !readOnly
|
6253
|
+
}
|
6254
|
+
),
|
6255
|
+
props.className
|
6256
|
+
)
|
6257
|
+
}), emptyDefault && /* @__PURE__ */ React67.createElement("option", {
|
6258
|
+
value: "",
|
6259
|
+
className: tw("hidden")
|
6260
|
+
}), children));
|
6261
|
+
}
|
6262
|
+
);
|
6263
|
+
NativeSelectBase.Skeleton = () => /* @__PURE__ */ React67.createElement(Skeleton, {
|
6264
|
+
height: 38
|
6265
|
+
});
|
6266
|
+
var NativeSelect = React67.forwardRef(
|
6267
|
+
(_a, ref) => {
|
6268
|
+
var _b = _a, { readOnly } = _b, props = __objRest(_b, ["readOnly"]);
|
6269
|
+
var _a2;
|
6270
|
+
const id = useRef9((_a2 = props.id) != null ? _a2 : `nativeselect-${uniqueId6()}`);
|
6271
|
+
const errorMessageId = uniqueId6();
|
6272
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
6273
|
+
const _b2 = getLabelControlProps(props), { "data-testid": dataTestId } = _b2, labelControlProps = __objRest(_b2, ["data-testid"]);
|
6274
|
+
const baseProps = omit12(props, Object.keys(labelControlProps));
|
6275
|
+
return /* @__PURE__ */ React67.createElement(LabelControl, __spreadValues({
|
6276
|
+
id: `${id.current}-label`,
|
6277
|
+
htmlFor: id.current,
|
6278
|
+
messageId: errorMessageId
|
6279
|
+
}, labelControlProps), /* @__PURE__ */ React67.createElement(NativeSelectBase, __spreadProps(__spreadValues(__spreadValues({
|
6280
|
+
ref
|
6281
|
+
}, baseProps), errorProps), {
|
6282
|
+
id: id.current,
|
6283
|
+
"data-testid": dataTestId,
|
6284
|
+
disabled: props.disabled,
|
6285
|
+
required: props.required,
|
6286
|
+
valid: props.valid,
|
6287
|
+
readOnly
|
6288
|
+
})));
|
6289
|
+
}
|
6290
|
+
);
|
6291
|
+
var Option = React67.forwardRef((_a, ref) => {
|
6292
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
6293
|
+
return /* @__PURE__ */ React67.createElement("option", __spreadValues({
|
6294
|
+
ref
|
6295
|
+
}, props), children);
|
6296
|
+
});
|
6297
|
+
var NativeSelectSkeleton = () => /* @__PURE__ */ React67.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React67.createElement(NativeSelectBase.Skeleton, null), /* @__PURE__ */ React67.createElement("div", {
|
6298
|
+
style: { height: "1px" }
|
6299
|
+
}));
|
6300
|
+
NativeSelect.Skeleton = NativeSelectSkeleton;
|
6301
|
+
NativeSelect.Skeleton.displayName = "NativeSelect.Skeleton";
|
6302
|
+
|
6303
|
+
// src/components/PageHeader/PageHeader.tsx
|
6304
|
+
import React68 from "react";
|
6305
|
+
import castArray3 from "lodash/castArray";
|
6306
|
+
import omit13 from "lodash/omit";
|
6307
|
+
|
6308
|
+
// src/components/Pagination/Pagination.tsx
|
6309
|
+
import React70 from "react";
|
6310
|
+
|
6311
|
+
// src/components/Select/Select.tsx
|
6312
|
+
import React69, { useRef as useRef10, useState as useState10 } from "react";
|
6313
|
+
import isNil2 from "lodash/isNil";
|
6314
|
+
import isArray from "lodash/isArray";
|
6315
|
+
import defaults from "lodash/defaults";
|
6316
|
+
import uniqueId7 from "lodash/uniqueId";
|
6317
|
+
import omit14 from "lodash/omit";
|
6318
|
+
import { useSelect } from "downshift";
|
6319
|
+
import { useOverlayPosition as useOverlayPosition6 } from "@react-aria/overlays";
|
6320
|
+
var hasIconProperty = (val) => {
|
6321
|
+
var _a;
|
6322
|
+
return typeof val === "string" || ((_a = val == null ? void 0 : val.icon) == null ? void 0 : _a.body) !== void 0;
|
6323
|
+
};
|
6324
|
+
var hasOptionGroups = (val) => {
|
6325
|
+
return !val.some((opt) => (opt == null ? void 0 : opt.label) === void 0 || !isArray(opt == null ? void 0 : opt.options));
|
6326
|
+
};
|
6327
|
+
var defaultRenderOption = (item, props, { selectedItem }, { getOptionKey, getValue, optionToString = getOptionLabelBuiltin }) => {
|
6328
|
+
var _a, _b;
|
6329
|
+
return /* @__PURE__ */ React69.createElement(Select.Item, __spreadValues({
|
6330
|
+
key: (_b = (_a = getOptionKey == null ? void 0 : getOptionKey(item)) != null ? _a : getValue == null ? void 0 : getValue(item)) != null ? _b : optionToString(item),
|
6331
|
+
selected: item === selectedItem
|
6332
|
+
}, props), hasIconProperty(item) && /* @__PURE__ */ React69.createElement(InlineIcon, {
|
6333
|
+
icon: item.icon
|
6334
|
+
}), optionToString(item));
|
6335
|
+
};
|
6336
|
+
var defaultGetValue = (opt) => {
|
6337
|
+
if (typeof opt === "string") {
|
6338
|
+
return opt;
|
6339
|
+
}
|
6340
|
+
if (typeof opt.value === "string") {
|
6341
|
+
return opt.value;
|
6342
|
+
}
|
6343
|
+
return "";
|
6344
|
+
};
|
6345
|
+
var _SelectBase = (props) => {
|
6346
|
+
var _b;
|
6347
|
+
const withDefaults = defaults({}, props, {
|
6348
|
+
disabled: false,
|
6349
|
+
valid: true,
|
6350
|
+
readOnly: false,
|
6351
|
+
required: false,
|
6352
|
+
optionToString: getOptionLabelBuiltin,
|
6353
|
+
getValue: defaultGetValue,
|
6354
|
+
UNSAFE_renderOption: defaultRenderOption,
|
6355
|
+
isOptionDisabled: isOptionDisabledBuiltin,
|
6356
|
+
actions: []
|
6357
|
+
});
|
6358
|
+
const _a = withDefaults, {
|
6359
|
+
id,
|
6360
|
+
name,
|
6361
|
+
placeholder,
|
6362
|
+
disabled,
|
6363
|
+
readOnly,
|
6364
|
+
maxHeight,
|
6365
|
+
options,
|
6366
|
+
optionToString: itemToString,
|
6367
|
+
getValue,
|
6368
|
+
getOptionKey,
|
6369
|
+
UNSAFE_renderOption,
|
6370
|
+
isOptionDisabled,
|
6371
|
+
defaultValue,
|
6372
|
+
value,
|
6373
|
+
onChange,
|
6374
|
+
valid,
|
6375
|
+
emptyState,
|
6376
|
+
actions,
|
6377
|
+
required,
|
6378
|
+
children,
|
6379
|
+
labelWrapper
|
6380
|
+
} = _a, rest = __objRest(_a, [
|
6381
|
+
"id",
|
6382
|
+
"name",
|
6383
|
+
"placeholder",
|
6384
|
+
"disabled",
|
6385
|
+
"readOnly",
|
6386
|
+
"maxHeight",
|
6387
|
+
"options",
|
6388
|
+
"optionToString",
|
6389
|
+
"getValue",
|
6390
|
+
"getOptionKey",
|
6391
|
+
"UNSAFE_renderOption",
|
6392
|
+
"isOptionDisabled",
|
6393
|
+
"defaultValue",
|
6394
|
+
"value",
|
6395
|
+
"onChange",
|
6396
|
+
"valid",
|
6397
|
+
"emptyState",
|
6398
|
+
"actions",
|
6399
|
+
"required",
|
6400
|
+
"children",
|
6401
|
+
"labelWrapper"
|
6402
|
+
]);
|
6403
|
+
const [hasFocus, setFocus] = useState10(false);
|
6404
|
+
const targetRef = useRef10(null);
|
6405
|
+
const overlayRef = useRef10(null);
|
6406
|
+
const items = hasOptionGroups(options) ? options.flatMap((g) => g.options) : options;
|
6407
|
+
const findItemByValue = (val) => {
|
6408
|
+
if (val === null) {
|
6409
|
+
return null;
|
6410
|
+
}
|
6411
|
+
return val === void 0 ? void 0 : items.find((opt) => getValue(opt) === getValue(val));
|
6412
|
+
};
|
6413
|
+
const {
|
6414
|
+
isOpen,
|
6415
|
+
closeMenu,
|
6416
|
+
selectItem,
|
6417
|
+
selectedItem,
|
6418
|
+
highlightedIndex,
|
6419
|
+
getToggleButtonProps,
|
6420
|
+
getMenuProps,
|
6421
|
+
getItemProps,
|
6422
|
+
setHighlightedIndex
|
6423
|
+
} = useSelect({
|
6424
|
+
selectedItem: findItemByValue(value),
|
6425
|
+
defaultSelectedItem: findItemByValue(defaultValue),
|
6426
|
+
items,
|
6427
|
+
itemToString,
|
6428
|
+
onSelectedItemChange: (e) => onChange == null ? void 0 : onChange(e.selectedItem)
|
6429
|
+
});
|
6430
|
+
const { overlayProps } = useOverlayPosition6({
|
6431
|
+
targetRef,
|
6432
|
+
overlayRef,
|
6433
|
+
placement: "bottom start",
|
6434
|
+
shouldFlip: true,
|
6435
|
+
isOpen
|
6436
|
+
});
|
6437
|
+
const renderItem = (item, index) => UNSAFE_renderOption(
|
6438
|
+
item,
|
6439
|
+
__spreadValues({
|
6440
|
+
highlighted: index === highlightedIndex
|
6441
|
+
}, getItemProps({ item, index, disabled: isOptionDisabled(item, index) })),
|
6442
|
+
{
|
6443
|
+
selectedItem,
|
6444
|
+
closeMenu,
|
6445
|
+
selectOption: selectItem
|
6446
|
+
},
|
6447
|
+
withDefaults
|
6448
|
+
);
|
6449
|
+
const renderGroup = (group) => /* @__PURE__ */ React69.createElement(React69.Fragment, {
|
6450
|
+
key: group.label
|
6451
|
+
}, /* @__PURE__ */ React69.createElement(Select.Group, null, group.label), group.options.map((opt) => renderItem(opt, items.indexOf(opt))));
|
6452
|
+
const input = /* @__PURE__ */ React69.createElement(Select.InputContainer, __spreadProps(__spreadValues({}, getToggleButtonProps({ disabled: disabled || readOnly, ref: targetRef })), {
|
6453
|
+
variant: disabled ? "disabled" : !valid ? "error" : readOnly ? "readOnly" : hasFocus ? "focused" : "default",
|
6454
|
+
tabIndex: 0
|
6455
|
+
}), /* @__PURE__ */ React69.createElement(Select.Input, __spreadProps(__spreadValues({
|
6456
|
+
id,
|
6457
|
+
name
|
6458
|
+
}, rest), {
|
6459
|
+
className: !disabled && !readOnly ? "cursor-pointer" : void 0,
|
6460
|
+
disabled,
|
6461
|
+
readOnly: true,
|
6462
|
+
placeholder: readOnly ? void 0 : placeholder,
|
6463
|
+
value: !isNil2(selectedItem) ? itemToString(selectedItem) : "",
|
6464
|
+
tabIndex: -1,
|
6465
|
+
onFocus: () => setFocus(true),
|
6466
|
+
onBlur: () => setFocus(false)
|
6467
|
+
})), !readOnly && /* @__PURE__ */ React69.createElement(Select.Toggle, {
|
6468
|
+
disabled,
|
6469
|
+
isOpen,
|
6470
|
+
tabIndex: -1
|
6471
|
+
}));
|
6472
|
+
const width = (_b = targetRef.current) == null ? void 0 : _b.offsetWidth;
|
6473
|
+
const style = isOpen ? __spreadProps(__spreadValues({}, overlayProps.style), { width }) : { display: "none" };
|
6474
|
+
return /* @__PURE__ */ React69.createElement("div", {
|
6475
|
+
className: tw("relative")
|
6476
|
+
}, labelWrapper ? React69.cloneElement(labelWrapper, { children: input }) : input, /* @__PURE__ */ React69.createElement(PopoverWrapper, __spreadProps(__spreadValues({
|
6477
|
+
isOpen: true,
|
6478
|
+
isDismissable: true,
|
6479
|
+
autoFocus: true
|
6480
|
+
}, getMenuProps({ ref: overlayRef })), {
|
6481
|
+
style,
|
6482
|
+
onClose: closeMenu
|
6483
|
+
}), /* @__PURE__ */ React69.createElement(Select.Menu, {
|
6484
|
+
maxHeight
|
6485
|
+
}, isOpen && options.length === 0 && /* @__PURE__ */ React69.createElement(Select.EmptyStateContainer, null, emptyState), isOpen && options.length > 0 && !hasOptionGroups(options) && options.map(renderItem), isOpen && options.length > 0 && hasOptionGroups(options) && options.map(renderGroup), isOpen && actions.length > 0 && /* @__PURE__ */ React69.createElement(React69.Fragment, null, /* @__PURE__ */ React69.createElement(Select.Divider, {
|
6486
|
+
onMouseOver: () => setHighlightedIndex(-1)
|
6487
|
+
}), actions.map((act, index) => /* @__PURE__ */ React69.createElement(Select.ActionItem, __spreadProps(__spreadValues({
|
6488
|
+
key: `${index}`
|
6489
|
+
}, act), {
|
6490
|
+
onMouseOver: () => setHighlightedIndex(-1),
|
6491
|
+
onClick: () => {
|
6492
|
+
act.onClick();
|
6493
|
+
closeMenu();
|
6494
|
+
}
|
6495
|
+
}), act.label))))));
|
6496
|
+
};
|
6497
|
+
var SelectBase = (props) => /* @__PURE__ */ React69.createElement(_SelectBase, __spreadProps(__spreadValues({}, props), {
|
6498
|
+
labelWrapper: void 0
|
6499
|
+
}));
|
6500
|
+
var SelectBaseSkeleton = () => /* @__PURE__ */ React69.createElement(Skeleton, {
|
6501
|
+
height: 38
|
6502
|
+
});
|
6503
|
+
SelectBase.Skeleton = SelectBaseSkeleton;
|
6504
|
+
var Select2 = (_a) => {
|
6505
|
+
var _b = _a, {
|
6506
|
+
options
|
6507
|
+
} = _b, props = __objRest(_b, [
|
6508
|
+
"options"
|
6509
|
+
]);
|
6510
|
+
var _a2;
|
6511
|
+
const id = useRef10((_a2 = props.id) != null ? _a2 : `select-${uniqueId7()}`);
|
6512
|
+
const errorMessageId = uniqueId7();
|
6513
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
6514
|
+
const labelProps = getLabelControlProps(props);
|
6515
|
+
const baseProps = omit14(props, Object.keys(labelProps));
|
6516
|
+
const legacyError = labelProps.error !== void 0 && labelProps.valid === false;
|
6517
|
+
const variant = !labelProps.valid || legacyError ? "error" : labelProps.disabled ? "disabled" : "default";
|
6518
|
+
const label = /* @__PURE__ */ React69.createElement(Label, __spreadValues({
|
6519
|
+
id: `${id.current}-label`,
|
6520
|
+
htmlFor: `${id.current}-input`,
|
6521
|
+
variant,
|
6522
|
+
messageId: errorMessageId
|
6523
|
+
}, labelProps));
|
6524
|
+
return /* @__PURE__ */ React69.createElement(FormControl, null, /* @__PURE__ */ React69.createElement(_SelectBase, __spreadProps(__spreadValues(__spreadValues({}, baseProps), errorProps), {
|
6525
|
+
id: `${id.current}-input`,
|
6526
|
+
options,
|
6527
|
+
disabled: props.disabled,
|
6528
|
+
valid: props.valid,
|
6529
|
+
labelWrapper: label
|
6530
|
+
})), /* @__PURE__ */ React69.createElement(HelperText, {
|
6531
|
+
messageId: errorMessageId,
|
6532
|
+
error: !labelProps.valid,
|
6533
|
+
helperText: labelProps.helperText,
|
6534
|
+
length: labelProps.length,
|
6535
|
+
maxLength: labelProps.maxLength,
|
6536
|
+
reserveSpaceForError: labelProps.reserveSpaceForError
|
6537
|
+
}));
|
6538
|
+
};
|
6539
|
+
var SelectSkeleton = () => /* @__PURE__ */ React69.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React69.createElement(SelectBase.Skeleton, null));
|
6540
|
+
Select2.Skeleton = SelectSkeleton;
|
6541
|
+
|
6542
|
+
// src/components/Pagination/Pagination.tsx
|
6543
|
+
var import_chevronLeft3 = __toESM(require_chevronLeft());
|
6544
|
+
var import_chevronRight3 = __toESM(require_chevronRight());
|
6545
|
+
var import_chevronForward = __toESM(require_chevronForward());
|
6546
|
+
var import_chevronBackward = __toESM(require_chevronBackward());
|
6547
|
+
import clamp from "lodash/clamp";
|
6548
|
+
|
6549
|
+
// src/components/PopoverDialog/PopoverDialog.tsx
|
6550
|
+
import React71 from "react";
|
6551
|
+
import omit15 from "lodash/omit";
|
6552
|
+
var PopoverDialog2 = ({ placement, open, title, secondaryAction, primaryAction, children }) => {
|
6553
|
+
const wrapPromptWithBody = (child) => {
|
6554
|
+
if (isComponentType(child, PopoverDialog2.Prompt)) {
|
6555
|
+
return /* @__PURE__ */ React71.createElement(Popover2.Panel, {
|
6556
|
+
className: tw("max-w-[300px]")
|
6557
|
+
}, /* @__PURE__ */ React71.createElement(PopoverDialog.Header, null, /* @__PURE__ */ React71.createElement(PopoverDialog.Title, null, title)), child, /* @__PURE__ */ React71.createElement(PopoverDialog.Footer, null, /* @__PURE__ */ React71.createElement(PopoverDialog.Actions, null, secondaryAction && /* @__PURE__ */ React71.createElement(Popover2.Button, __spreadValues({
|
6558
|
+
kind: "secondary-ghost",
|
6559
|
+
key: secondaryAction.text,
|
6560
|
+
dense: true
|
6561
|
+
}, omit15(secondaryAction, "text")), secondaryAction.text), /* @__PURE__ */ React71.createElement(Popover2.Button, __spreadValues({
|
6562
|
+
kind: "ghost",
|
6563
|
+
key: primaryAction.text,
|
6564
|
+
dense: true
|
6565
|
+
}, omit15(primaryAction, "text")), primaryAction.text))));
|
6566
|
+
}
|
6567
|
+
return child;
|
6568
|
+
};
|
6569
|
+
return /* @__PURE__ */ React71.createElement(Popover2, {
|
6570
|
+
type: "dialog",
|
6571
|
+
isOpen: open,
|
6572
|
+
placement,
|
6573
|
+
isDismissable: true,
|
6574
|
+
isKeyboardDismissDisabled: false,
|
6575
|
+
autoFocus: true,
|
6576
|
+
containFocus: true
|
6577
|
+
}, React71.Children.map(children, wrapPromptWithBody));
|
6578
|
+
};
|
6579
|
+
PopoverDialog2.Trigger = Popover2.Trigger;
|
6580
|
+
var Prompt = ({ children }) => /* @__PURE__ */ React71.createElement(PopoverDialog.Body, null, children);
|
6581
|
+
Prompt.displayName = "PopoverDialog.Prompt";
|
6582
|
+
PopoverDialog2.Prompt = Prompt;
|
6583
|
+
|
6584
|
+
// src/components/Portal/Portal.tsx
|
6585
|
+
import { createPortal } from "react-dom";
|
6586
|
+
|
6587
|
+
// src/components/ProgressBar/ProgressBar.tsx
|
6588
|
+
import React73 from "react";
|
6589
|
+
|
6590
|
+
// src/common/ProgressBar/ProgressBar.tsx
|
6591
|
+
import React72 from "react";
|
6592
|
+
import clamp2 from "lodash/clamp";
|
6593
|
+
var ProgressBar = (_a) => {
|
6594
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
6595
|
+
return /* @__PURE__ */ React72.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6596
|
+
className: classNames(
|
6597
|
+
tw("relative flex items-center w-full bg-grey-0 h-2 rounded-full overflow-hidden"),
|
6598
|
+
className
|
6599
|
+
)
|
6600
|
+
}), children);
|
6601
|
+
};
|
6602
|
+
var STATUS_COLORS = {
|
6603
|
+
info: tw("bg-info-50"),
|
6604
|
+
warning: tw("bg-warning-70"),
|
6605
|
+
success: tw("bg-success-70"),
|
6606
|
+
error: tw("bg-error-70")
|
6607
|
+
};
|
6608
|
+
ProgressBar.Indicator = (_a) => {
|
6609
|
+
var _b = _a, { min, max, value, "aria-label": ariaLabel, status, className } = _b, rest = __objRest(_b, ["min", "max", "value", "aria-label", "status", "className"]);
|
6610
|
+
const completedPercentage = clamp2((value - min) / (max - min) * 100, 0, 100);
|
6611
|
+
return /* @__PURE__ */ React72.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6612
|
+
className: classNames(
|
6613
|
+
tw("h-2 rounded-full transition-all ease-in-out delay-150"),
|
6614
|
+
STATUS_COLORS[status],
|
6615
|
+
className
|
6616
|
+
),
|
6617
|
+
style: { width: `${completedPercentage}%` },
|
6618
|
+
role: "progressbar",
|
6619
|
+
"aria-label": ariaLabel || value.toString(),
|
6620
|
+
"aria-valuenow": value,
|
6621
|
+
"aria-valuemin": min,
|
6622
|
+
"aria-valuemax": max
|
6623
|
+
}));
|
6624
|
+
};
|
6625
|
+
ProgressBar.Labels = (_a) => {
|
6626
|
+
var _b = _a, { children, startLabel, endLabel, className } = _b, rest = __objRest(_b, ["children", "startLabel", "endLabel", "className"]);
|
6627
|
+
return /* @__PURE__ */ React72.createElement("div", {
|
6628
|
+
className: classNames(tw("flex flex-row"), className)
|
6629
|
+
}, /* @__PURE__ */ React72.createElement("span", __spreadProps(__spreadValues({}, rest), {
|
6630
|
+
className: tw("grow text-grey-70 typography-caption-default")
|
6631
|
+
}), startLabel), /* @__PURE__ */ React72.createElement("span", __spreadProps(__spreadValues({}, rest), {
|
6632
|
+
className: tw("grow text-grey-70 typography-caption-default text-right")
|
6633
|
+
}), endLabel));
|
6634
|
+
};
|
6635
|
+
|
6636
|
+
// src/components/ProgressBar/ProgressBar.tsx
|
6637
|
+
var ProgressBar2 = (props) => {
|
6638
|
+
const {
|
6639
|
+
value,
|
6640
|
+
"aria-label": ariaLabel,
|
6641
|
+
min = 0,
|
6642
|
+
max = 100,
|
6643
|
+
progresStatus = "info",
|
6644
|
+
completedStatus = "success"
|
6645
|
+
} = props;
|
6646
|
+
if (min > max) {
|
6647
|
+
throw new Error("`min` value provided to `ProgressBar` is greater than `max` value.");
|
6648
|
+
}
|
6649
|
+
const progress = /* @__PURE__ */ React73.createElement(ProgressBar, null, /* @__PURE__ */ React73.createElement(ProgressBar.Indicator, {
|
6650
|
+
status: value === max ? completedStatus : progresStatus,
|
6651
|
+
min,
|
6652
|
+
max,
|
6653
|
+
value,
|
6654
|
+
"aria-label": ariaLabel
|
6655
|
+
}));
|
6656
|
+
if (props.dense) {
|
6657
|
+
return progress;
|
6658
|
+
}
|
6659
|
+
return /* @__PURE__ */ React73.createElement("div", null, progress, /* @__PURE__ */ React73.createElement(ProgressBar.Labels, {
|
6660
|
+
className: tw("py-2"),
|
6661
|
+
startLabel: props.startLabel,
|
6662
|
+
endLabel: props.endLabel
|
6663
|
+
}));
|
6664
|
+
};
|
6665
|
+
ProgressBar2.Skeleton = () => /* @__PURE__ */ React73.createElement(Skeleton, {
|
6666
|
+
height: 4,
|
6667
|
+
display: "block"
|
6668
|
+
});
|
6669
|
+
|
6670
|
+
// src/components/RadioButton/RadioButton.tsx
|
6671
|
+
import React74 from "react";
|
6672
|
+
var RadioButton2 = React74.forwardRef(
|
6673
|
+
(_a, ref) => {
|
6674
|
+
var _b = _a, {
|
6675
|
+
name,
|
6676
|
+
id,
|
6677
|
+
checked: _checked,
|
6678
|
+
defaultChecked,
|
6679
|
+
onChange,
|
6680
|
+
readOnly = false,
|
6681
|
+
disabled = false,
|
6682
|
+
caption,
|
6683
|
+
children,
|
6684
|
+
"aria-label": ariaLabel
|
6685
|
+
} = _b, props = __objRest(_b, [
|
6686
|
+
"name",
|
6687
|
+
"id",
|
6688
|
+
"checked",
|
6689
|
+
"defaultChecked",
|
6690
|
+
"onChange",
|
6691
|
+
"readOnly",
|
6692
|
+
"disabled",
|
6693
|
+
"caption",
|
6694
|
+
"children",
|
6695
|
+
"aria-label"
|
6696
|
+
]);
|
6697
|
+
var _a2;
|
6698
|
+
const [checked, setChecked] = React74.useState((_a2 = _checked != null ? _checked : defaultChecked) != null ? _a2 : false);
|
6699
|
+
if (_checked !== void 0 && checked !== _checked) {
|
6700
|
+
setChecked(_checked);
|
6701
|
+
}
|
6702
|
+
return !readOnly || checked ? /* @__PURE__ */ React74.createElement(ControlLabel, {
|
6703
|
+
htmlFor: id,
|
6704
|
+
label: children,
|
6705
|
+
"aria-label": ariaLabel,
|
6706
|
+
caption,
|
6707
|
+
readOnly,
|
6708
|
+
disabled,
|
6709
|
+
style: { gap: "0 8px" }
|
6710
|
+
}, !readOnly && /* @__PURE__ */ React74.createElement(RadioButton, __spreadProps(__spreadValues({
|
6711
|
+
id,
|
6712
|
+
ref,
|
6713
|
+
name
|
6714
|
+
}, props), {
|
6715
|
+
checked,
|
6716
|
+
readOnly,
|
6717
|
+
disabled,
|
6718
|
+
onChange: (e) => {
|
6719
|
+
setChecked(e.target.checked);
|
6720
|
+
onChange == null ? void 0 : onChange(e);
|
6721
|
+
}
|
6722
|
+
}))) : null;
|
6723
|
+
}
|
6724
|
+
);
|
6725
|
+
var RadioButtonSkeleton = () => /* @__PURE__ */ React74.createElement("div", {
|
6726
|
+
className: tw("flex gap-3")
|
6727
|
+
}, /* @__PURE__ */ React74.createElement(Skeleton, {
|
6728
|
+
height: 20,
|
6729
|
+
width: 20
|
6730
|
+
}), /* @__PURE__ */ React74.createElement(Skeleton, {
|
6731
|
+
height: 20,
|
6732
|
+
width: 150
|
6733
|
+
}));
|
6734
|
+
RadioButton2.Skeleton = RadioButtonSkeleton;
|
6735
|
+
|
6736
|
+
// src/components/RadioButtonGroup/RadioButtonGroup.tsx
|
6737
|
+
import React75 from "react";
|
6738
|
+
import uniqueId8 from "lodash/uniqueId";
|
6739
|
+
var isRadioButton = (c) => {
|
6740
|
+
return React75.isValidElement(c) && c.type === RadioButton2;
|
6741
|
+
};
|
6742
|
+
var RadioButtonGroup = (_a) => {
|
6743
|
+
var _b = _a, {
|
6744
|
+
name,
|
6745
|
+
value: _value,
|
6746
|
+
defaultValue,
|
6747
|
+
onChange,
|
6748
|
+
direction = "row",
|
6749
|
+
cols,
|
6750
|
+
readOnly,
|
6751
|
+
children
|
6752
|
+
} = _b, props = __objRest(_b, [
|
6753
|
+
"name",
|
6754
|
+
"value",
|
6755
|
+
"defaultValue",
|
6756
|
+
"onChange",
|
6757
|
+
"direction",
|
6758
|
+
"cols",
|
6759
|
+
"readOnly",
|
6760
|
+
"children"
|
6761
|
+
]);
|
6762
|
+
var _a2;
|
6763
|
+
const [value, setValue] = React75.useState((_a2 = _value != null ? _value : defaultValue) != null ? _a2 : "");
|
6764
|
+
const errorMessageId = uniqueId8();
|
6765
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
6766
|
+
const labelControlProps = getLabelControlProps(props);
|
6767
|
+
if (_value !== void 0 && _value !== value) {
|
6768
|
+
setValue(_value);
|
6769
|
+
}
|
6770
|
+
const handleChange = (e) => {
|
6771
|
+
setValue(e.target.value);
|
6772
|
+
onChange == null ? void 0 : onChange(e.target.value);
|
6773
|
+
};
|
6774
|
+
const content = React75.Children.map(children, (c) => {
|
6775
|
+
var _a3, _b2, _c;
|
6776
|
+
if (!isRadioButton(c)) {
|
6777
|
+
return null;
|
6778
|
+
}
|
6779
|
+
const defaultChecked = defaultValue === void 0 ? void 0 : c.props.value === defaultValue;
|
6780
|
+
const checked = value === void 0 ? void 0 : c.props.value === value;
|
6781
|
+
return React75.cloneElement(c, {
|
6782
|
+
name,
|
6783
|
+
defaultChecked: (_a3 = c.props.defaultChecked) != null ? _a3 : defaultChecked,
|
6784
|
+
checked: (_b2 = c.props.checked) != null ? _b2 : checked,
|
6785
|
+
onChange: (_c = c.props.onChange) != null ? _c : handleChange,
|
6786
|
+
disabled: props.disabled || c.props.disabled,
|
6787
|
+
readOnly
|
6788
|
+
});
|
6789
|
+
});
|
6790
|
+
return /* @__PURE__ */ React75.createElement(LabelControl, __spreadValues(__spreadValues({
|
6791
|
+
fieldset: true
|
6792
|
+
}, labelControlProps), errorProps), cols && /* @__PURE__ */ React75.createElement(InputGroup, {
|
6793
|
+
cols
|
6794
|
+
}, content), !cols && /* @__PURE__ */ React75.createElement(Flexbox, {
|
6795
|
+
direction,
|
6796
|
+
alignItems: "flex-start",
|
6797
|
+
colGap: "8",
|
6798
|
+
rowGap: "3",
|
6799
|
+
wrap: "wrap"
|
6800
|
+
}, content));
|
6801
|
+
};
|
6802
|
+
var RadioButtonGroupSkeleton = ({ direction = "row", options = 2 }) => {
|
6803
|
+
return /* @__PURE__ */ React75.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React75.createElement("div", {
|
6804
|
+
className: tw("flex flex-wrap", {
|
6805
|
+
"flex-row gap-8": direction === "row",
|
6806
|
+
"flex-col gap-2": direction === "column"
|
6807
|
+
})
|
6808
|
+
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */ React75.createElement(RadioButton2.Skeleton, {
|
6809
|
+
key
|
6810
|
+
}))));
|
6811
|
+
};
|
6812
|
+
RadioButtonGroup.Skeleton = RadioButtonGroupSkeleton;
|
6813
|
+
|
6814
|
+
// src/components/Section/Section.tsx
|
6815
|
+
import React77 from "react";
|
6816
|
+
|
6817
|
+
// src/common/Section/Section.tsx
|
6818
|
+
import React76 from "react";
|
6819
|
+
var Section2 = (_a) => {
|
6820
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
6821
|
+
return /* @__PURE__ */ React76.createElement(Box, __spreadValues({
|
6822
|
+
borderColor: "grey-5",
|
6823
|
+
borderWidth: "1px"
|
6824
|
+
}, rest), children);
|
6825
|
+
};
|
6826
|
+
Section2.Header = (_a) => {
|
6827
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
6828
|
+
return /* @__PURE__ */ React76.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6829
|
+
className: classNames(tw("px-6 py-5 flex gap-5 justify-between items-center"), className)
|
6830
|
+
}), children);
|
6831
|
+
};
|
6832
|
+
Section2.TitleContainer = (_a) => {
|
6833
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
6834
|
+
return /* @__PURE__ */ React76.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6835
|
+
className: classNames(tw("flex flex-col grow gap-2"), className)
|
6836
|
+
}), children);
|
6837
|
+
};
|
6838
|
+
Section2.Title = (_a) => {
|
6839
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
6840
|
+
return /* @__PURE__ */ React76.createElement(Typography2.Subheading, __spreadProps(__spreadValues({}, rest), {
|
6841
|
+
color: "black"
|
6842
|
+
}), children);
|
6843
|
+
};
|
6844
|
+
Section2.Subtitle = (_a) => {
|
6845
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
6846
|
+
return /* @__PURE__ */ React76.createElement(Typography2.SmallText, __spreadProps(__spreadValues({}, rest), {
|
6847
|
+
color: "grey-70"
|
6848
|
+
}), children);
|
6849
|
+
};
|
6850
|
+
Section2.Actions = (_a) => {
|
6851
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
6852
|
+
return /* @__PURE__ */ React76.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6853
|
+
className: classNames(tw("flex gap-4 justify-end"), className)
|
6854
|
+
}), children);
|
6855
|
+
};
|
6856
|
+
Section2.Body = (_a) => {
|
6857
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
6858
|
+
return /* @__PURE__ */ React76.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
6859
|
+
className: classNames(tw("p-6"), className)
|
6860
|
+
}), /* @__PURE__ */ React76.createElement(Typography, {
|
6861
|
+
htmlTag: "div",
|
6862
|
+
color: "grey-70"
|
6863
|
+
}, children));
|
6864
|
+
};
|
6865
|
+
|
6866
|
+
// src/components/Section/Section.tsx
|
6867
|
+
import castArray4 from "lodash/castArray";
|
6868
|
+
|
6869
|
+
// src/components/SegmentedControl/SegmentedControl.tsx
|
6870
|
+
import React78 from "react";
|
6871
|
+
|
6872
|
+
// src/components/Switch/Switch.tsx
|
6873
|
+
import React79 from "react";
|
6874
|
+
var Switch = React79.forwardRef(
|
6875
|
+
(_a, ref) => {
|
6876
|
+
var _b = _a, {
|
6877
|
+
id,
|
6878
|
+
name,
|
6879
|
+
caption,
|
6880
|
+
checked: _checked,
|
6881
|
+
defaultChecked,
|
6882
|
+
onChange,
|
6883
|
+
readOnly = false,
|
6884
|
+
disabled = false,
|
6885
|
+
children,
|
6886
|
+
"aria-label": ariaLabel
|
6887
|
+
} = _b, props = __objRest(_b, [
|
6888
|
+
"id",
|
6889
|
+
"name",
|
6890
|
+
"caption",
|
6891
|
+
"checked",
|
6892
|
+
"defaultChecked",
|
6893
|
+
"onChange",
|
6894
|
+
"readOnly",
|
6895
|
+
"disabled",
|
6896
|
+
"children",
|
6897
|
+
"aria-label"
|
6898
|
+
]);
|
6899
|
+
var _a2;
|
6900
|
+
const [checked, setChecked] = React79.useState((_a2 = _checked != null ? _checked : defaultChecked) != null ? _a2 : false);
|
6901
|
+
if (_checked !== void 0 && checked !== _checked) {
|
6902
|
+
setChecked(_checked);
|
6903
|
+
}
|
6904
|
+
return !readOnly || checked ? /* @__PURE__ */ React79.createElement(ControlLabel, {
|
6905
|
+
htmlFor: id,
|
6906
|
+
label: children,
|
6907
|
+
"aria-label": ariaLabel,
|
6908
|
+
caption,
|
6909
|
+
readOnly,
|
6910
|
+
disabled,
|
6911
|
+
style: { gap: "0 8px" }
|
6912
|
+
}, !readOnly && /* @__PURE__ */ React79.createElement(Box, {
|
6913
|
+
component: "span",
|
6914
|
+
display: "inline-flex",
|
6915
|
+
justifyContent: "center",
|
6916
|
+
alignItems: "center",
|
6917
|
+
className: classNames(
|
6918
|
+
tw("relative flex self-center group", {
|
6919
|
+
"text-grey-30": disabled,
|
6920
|
+
"text-grey-100 cursor-pointer": !disabled
|
6921
|
+
})
|
6922
|
+
)
|
6923
|
+
}, /* @__PURE__ */ React79.createElement("input", __spreadProps(__spreadValues({
|
6924
|
+
id,
|
6925
|
+
ref,
|
6926
|
+
type: "checkbox",
|
6927
|
+
name
|
6928
|
+
}, props), {
|
6929
|
+
checked,
|
6930
|
+
onChange: (e) => {
|
6931
|
+
setChecked(e.target.checked);
|
6932
|
+
onChange == null ? void 0 : onChange(e);
|
6933
|
+
},
|
6934
|
+
className: tw("appearance-none peer"),
|
6935
|
+
readOnly,
|
6936
|
+
disabled
|
6937
|
+
})), /* @__PURE__ */ React79.createElement("span", {
|
6938
|
+
className: tw(
|
6939
|
+
"rounded-full inline-block w-[34px] h-[20px] transition duration-300 peer-focus:border border-info-70",
|
6940
|
+
{
|
6941
|
+
"bg-navyBlue-100": checked,
|
6942
|
+
"bg-grey-20 group-hover:bg-grey-30": !disabled && !checked,
|
6943
|
+
"bg-grey-5": disabled && !checked,
|
6944
|
+
"opacity-40": disabled && checked
|
6945
|
+
}
|
6946
|
+
)
|
6947
|
+
}), /* @__PURE__ */ React79.createElement("span", {
|
6948
|
+
style: {
|
6949
|
+
right: checked ? "20px" : void 0,
|
6950
|
+
left: checked ? void 0 : "4px"
|
6951
|
+
},
|
6952
|
+
className: tw("rounded-full absolute inline-block transition duration-300 h-4 w-4", {
|
6953
|
+
"transform translate-x-5": checked,
|
6954
|
+
"bg-grey-0": disabled,
|
6955
|
+
"bg-white shadow-4dp": !disabled
|
6956
|
+
})
|
6957
|
+
}))) : null;
|
6958
|
+
}
|
6959
|
+
);
|
6960
|
+
var SwitchSkeleton = () => /* @__PURE__ */ React79.createElement("div", {
|
6961
|
+
className: tw("flex gap-3")
|
6962
|
+
}, /* @__PURE__ */ React79.createElement(Skeleton, {
|
6963
|
+
height: 20,
|
6964
|
+
width: 35
|
6965
|
+
}), /* @__PURE__ */ React79.createElement(Skeleton, {
|
6966
|
+
height: 20,
|
6967
|
+
width: 150
|
6968
|
+
}));
|
6969
|
+
Switch.Skeleton = SwitchSkeleton;
|
6970
|
+
|
6971
|
+
// src/components/SwitchGroup/SwitchGroup.tsx
|
6972
|
+
import React80, { useState as useState11 } from "react";
|
6973
|
+
import uniqueId9 from "lodash/uniqueId";
|
6974
|
+
var SwitchGroup = (_a) => {
|
6975
|
+
var _b = _a, {
|
6976
|
+
value,
|
6977
|
+
defaultValue,
|
6978
|
+
onChange,
|
6979
|
+
readOnly = false,
|
6980
|
+
cols,
|
6981
|
+
children
|
6982
|
+
} = _b, props = __objRest(_b, [
|
6983
|
+
"value",
|
6984
|
+
"defaultValue",
|
6985
|
+
"onChange",
|
6986
|
+
"readOnly",
|
6987
|
+
"cols",
|
6988
|
+
"children"
|
6989
|
+
]);
|
6990
|
+
var _a2;
|
6991
|
+
const [selectedItems, setSelectedItems] = useState11((_a2 = value != null ? value : defaultValue) != null ? _a2 : []);
|
6992
|
+
if (value !== void 0 && value !== selectedItems) {
|
6993
|
+
setSelectedItems(value);
|
6994
|
+
}
|
6995
|
+
const errorMessageId = uniqueId9();
|
6996
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
6997
|
+
const labelControlProps = getLabelControlProps(props);
|
6998
|
+
const handleChange = (e) => {
|
6999
|
+
const { value: value2 } = e.target;
|
7000
|
+
const updated = e.target.checked ? [...selectedItems, value2] : selectedItems.filter((v) => v !== value2);
|
7001
|
+
setSelectedItems(updated);
|
7002
|
+
onChange == null ? void 0 : onChange(updated);
|
7003
|
+
};
|
7004
|
+
return /* @__PURE__ */ React80.createElement(LabelControl, __spreadValues(__spreadValues({
|
7005
|
+
fieldset: true
|
7006
|
+
}, labelControlProps), errorProps), /* @__PURE__ */ React80.createElement(InputGroup, {
|
7007
|
+
cols
|
7008
|
+
}, React80.Children.map(children, (c) => {
|
7009
|
+
var _a3, _b2, _c, _d;
|
7010
|
+
if (!isComponentType(c, Switch)) {
|
7011
|
+
return null;
|
7012
|
+
}
|
7013
|
+
const str = (_a3 = c.props.value) == null ? void 0 : _a3.toString();
|
7014
|
+
const defaultChecked = defaultValue === void 0 ? void 0 : str !== void 0 && defaultValue.includes(str);
|
7015
|
+
const checked = value === void 0 ? void 0 : str !== void 0 && value.includes(str);
|
7016
|
+
return React80.cloneElement(c, {
|
7017
|
+
defaultChecked: (_b2 = c.props.defaultChecked) != null ? _b2 : defaultChecked,
|
7018
|
+
checked: (_c = c.props.checked) != null ? _c : checked,
|
7019
|
+
onChange: (_d = c.props.onChange) != null ? _d : handleChange,
|
7020
|
+
disabled: props.disabled || c.props.disabled,
|
7021
|
+
readOnly
|
7022
|
+
});
|
7023
|
+
})));
|
7024
|
+
};
|
7025
|
+
var SwitchGroupSkeleton = ({ options = 2 }) => {
|
7026
|
+
return /* @__PURE__ */ React80.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React80.createElement("div", {
|
7027
|
+
className: tw("flex flex-wrap flex-col gap-2")
|
7028
|
+
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */ React80.createElement(Switch.Skeleton, {
|
7029
|
+
key
|
7030
|
+
}))));
|
7031
|
+
};
|
7032
|
+
SwitchGroup.Skeleton = SwitchGroupSkeleton;
|
7033
|
+
|
7034
|
+
// src/components/TagLabel/TagLabel.tsx
|
7035
|
+
import React81 from "react";
|
7036
|
+
|
7037
|
+
// src/components/Textarea/Textarea.tsx
|
7038
|
+
import React82, { useRef as useRef11, useState as useState12 } from "react";
|
7039
|
+
import uniqueId10 from "lodash/uniqueId";
|
7040
|
+
import toString2 from "lodash/toString";
|
7041
|
+
import omit16 from "lodash/omit";
|
7042
|
+
var TextareaBase = React82.forwardRef(
|
7043
|
+
(_a, ref) => {
|
7044
|
+
var _b = _a, { readOnly = false, valid = true } = _b, props = __objRest(_b, ["readOnly", "valid"]);
|
7045
|
+
return /* @__PURE__ */ React82.createElement("textarea", __spreadProps(__spreadValues({
|
7046
|
+
ref
|
7047
|
+
}, props), {
|
7048
|
+
readOnly,
|
7049
|
+
className: classNames(getCommonInputStyles({ readOnly, valid }), props.className)
|
7050
|
+
}));
|
7051
|
+
}
|
7052
|
+
);
|
7053
|
+
TextareaBase.Skeleton = () => /* @__PURE__ */ React82.createElement(Skeleton, {
|
7054
|
+
height: 58
|
7055
|
+
});
|
7056
|
+
var Textarea = React82.forwardRef((props, ref) => {
|
7057
|
+
var _a, _b, _c;
|
7058
|
+
const [value, setValue] = useState12((_b = (_a = props.value) != null ? _a : props.defaultValue) != null ? _b : "");
|
7059
|
+
const id = useRef11((_c = props.id) != null ? _c : `textarea-${uniqueId10()}`);
|
7060
|
+
const errorMessageId = uniqueId10();
|
7061
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
7062
|
+
const _d = getLabelControlProps(props), { "data-testid": dataTestId } = _d, labelControlProps = __objRest(_d, ["data-testid"]);
|
7063
|
+
const baseProps = omit16(props, Object.keys(labelControlProps));
|
7064
|
+
return /* @__PURE__ */ React82.createElement(LabelControl, __spreadValues({
|
7065
|
+
id: `${id.current}-label`,
|
7066
|
+
htmlFor: id.current,
|
7067
|
+
messageId: errorMessageId,
|
7068
|
+
length: value !== void 0 ? toString2(value).length : void 0
|
7069
|
+
}, labelControlProps), /* @__PURE__ */ React82.createElement(TextareaBase, __spreadProps(__spreadValues(__spreadValues({
|
7070
|
+
ref
|
7071
|
+
}, baseProps), errorProps), {
|
7072
|
+
id: id.current,
|
7073
|
+
"data-testid": dataTestId,
|
7074
|
+
onChange: (e) => {
|
7075
|
+
var _a2;
|
7076
|
+
setValue(e.currentTarget.value);
|
7077
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, e);
|
7078
|
+
},
|
7079
|
+
disabled: props.disabled,
|
7080
|
+
maxLength: props.maxLength,
|
7081
|
+
required: props.required,
|
7082
|
+
valid: props.valid
|
7083
|
+
})));
|
7084
|
+
});
|
7085
|
+
var TextAreaSkeleton = () => /* @__PURE__ */ React82.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React82.createElement(TextareaBase.Skeleton, null));
|
7086
|
+
Textarea.Skeleton = TextAreaSkeleton;
|
7087
|
+
|
7088
|
+
// src/components/Timeline/Timeline.tsx
|
7089
|
+
import React84 from "react";
|
7090
|
+
|
7091
|
+
// src/common/Timeline/Timeline.tsx
|
7092
|
+
import React83 from "react";
|
7093
|
+
var Timeline = (_a) => {
|
7094
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7095
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7096
|
+
className: classNames(tw("grid grid-cols-[16px_1fr] gap-x-4"), className)
|
7097
|
+
}));
|
7098
|
+
};
|
7099
|
+
var Content = (_a) => {
|
7100
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7101
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7102
|
+
className: classNames(tw("pb-6"), className)
|
7103
|
+
}));
|
7104
|
+
};
|
7105
|
+
var Separator2 = (_a) => {
|
7106
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7107
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7108
|
+
className: classNames(tw("flex items-center justify-center h-5 w-5"), className)
|
7109
|
+
}));
|
7110
|
+
};
|
7111
|
+
var LineContainer = (_a) => {
|
7112
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7113
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7114
|
+
className: classNames(tw("flex justify-center py-1"), className)
|
7115
|
+
}));
|
7116
|
+
};
|
7117
|
+
var Line = (_a) => {
|
7118
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7119
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7120
|
+
className: classNames(tw("w-1 bg-grey-5 h-full justify-self-center"), className)
|
7121
|
+
}));
|
7122
|
+
};
|
7123
|
+
var Dot = (_a) => {
|
7124
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
7125
|
+
return /* @__PURE__ */ React83.createElement("div", __spreadProps(__spreadValues({}, rest), {
|
7126
|
+
className: classNames(tw("bg-grey-30 h-[6px] w-[6px] rounded"), className)
|
7127
|
+
}));
|
7128
|
+
};
|
7129
|
+
Separator2.Dot = Dot;
|
7130
|
+
LineContainer.Line = Line;
|
7131
|
+
Timeline.Separator = Separator2;
|
7132
|
+
Timeline.LineContainer = LineContainer;
|
7133
|
+
Timeline.Content = Content;
|
7134
|
+
|
7135
|
+
// src/components/Timeline/Timeline.tsx
|
7136
|
+
var import_time = __toESM(require_time());
|
7137
|
+
var import_warningSign4 = __toESM(require_warningSign());
|
7138
|
+
var import_error4 = __toESM(require_error());
|
7139
|
+
var TimelineItem = () => null;
|
7140
|
+
var Timeline2 = ({ children }) => /* @__PURE__ */ React84.createElement("div", null, React84.Children.map(children, (item) => {
|
7141
|
+
if (!isComponentType(item, TimelineItem)) {
|
7142
|
+
throw new Error("<Timeline> can only have <Timeline.Item> components as children");
|
7143
|
+
} else {
|
7144
|
+
const { props, key } = item;
|
7145
|
+
return /* @__PURE__ */ React84.createElement(Timeline, {
|
7146
|
+
key: key != null ? key : props.title
|
7147
|
+
}, /* @__PURE__ */ React84.createElement(Timeline.Separator, null, props.variant === "error" ? /* @__PURE__ */ React84.createElement(Icon, {
|
7148
|
+
icon: import_error4.default,
|
7149
|
+
color: "error-30"
|
7150
|
+
}) : props.variant === "warning" ? /* @__PURE__ */ React84.createElement(Icon, {
|
7151
|
+
icon: import_warningSign4.default,
|
7152
|
+
color: "warning-30"
|
7153
|
+
}) : props.variant === "info" ? /* @__PURE__ */ React84.createElement(Icon, {
|
7154
|
+
icon: import_time.default,
|
7155
|
+
color: "info-30"
|
7156
|
+
}) : /* @__PURE__ */ React84.createElement(Timeline.Separator.Dot, null)), /* @__PURE__ */ React84.createElement(Typography2.Caption, {
|
7157
|
+
fontWeight: 600
|
7158
|
+
}, props.title), /* @__PURE__ */ React84.createElement(Timeline.LineContainer, null, /* @__PURE__ */ React84.createElement(Timeline.LineContainer.Line, null)), /* @__PURE__ */ React84.createElement(Timeline.Content, null, /* @__PURE__ */ React84.createElement(Typography2, null, props.children)));
|
7159
|
+
}
|
7160
|
+
}));
|
7161
|
+
var TimelineItemSkeleton = () => /* @__PURE__ */ React84.createElement(Timeline, null, /* @__PURE__ */ React84.createElement(Timeline.Separator, null, /* @__PURE__ */ React84.createElement(Skeleton, {
|
7162
|
+
width: 6,
|
7163
|
+
height: 6,
|
7164
|
+
rounded: true
|
7165
|
+
})), /* @__PURE__ */ React84.createElement(Skeleton, {
|
7166
|
+
height: 12,
|
7167
|
+
width: 120
|
7168
|
+
}), /* @__PURE__ */ React84.createElement(Timeline.LineContainer, null, /* @__PURE__ */ React84.createElement(Skeleton, {
|
7169
|
+
width: 2
|
7170
|
+
})), /* @__PURE__ */ React84.createElement(Timeline.Content, null, /* @__PURE__ */ React84.createElement(Box, {
|
7171
|
+
display: "flex",
|
7172
|
+
flexDirection: "column",
|
7173
|
+
gap: "3"
|
7174
|
+
}, /* @__PURE__ */ React84.createElement(Skeleton, {
|
7175
|
+
height: 32,
|
7176
|
+
width: "100%"
|
7177
|
+
}), /* @__PURE__ */ React84.createElement(Skeleton, {
|
7178
|
+
height: 32,
|
7179
|
+
width: "73%"
|
7180
|
+
}), /* @__PURE__ */ React84.createElement(Skeleton, {
|
7181
|
+
height: 32,
|
7182
|
+
width: "80%"
|
7183
|
+
}))));
|
7184
|
+
var TimelineSkeleton = ({ items = 3 }) => /* @__PURE__ */ React84.createElement("div", null, Array.from({ length: items }).map((_, key) => /* @__PURE__ */ React84.createElement(TimelineItemSkeleton, {
|
7185
|
+
key
|
7186
|
+
})));
|
7187
|
+
Timeline2.Item = TimelineItem;
|
7188
|
+
Timeline2.Skeleton = TimelineSkeleton;
|
7189
|
+
|
7190
|
+
// src/utils/table/useTableSelect.ts
|
7191
|
+
import React85 from "react";
|
7192
|
+
|
7193
|
+
// src/components/Pagination/usePagination.tsx
|
7194
|
+
import { useState as useState13, useEffect as useEffect7 } from "react";
|
7195
|
+
|
7196
|
+
// src/components/index.ts
|
7197
|
+
var SelectItem = Select.Item;
|
7198
|
+
|
7199
|
+
// src/common/Table/Table.tsx
|
7200
|
+
var HeadContext = React86.createContext(null);
|
7201
|
+
var tableClassNames = tw("w-full relative typography-body-default border-spacing-0");
|
7202
|
+
var Table = (_a) => {
|
7203
|
+
var _b = _a, { children, ariaLabel, className } = _b, rest = __objRest(_b, ["children", "ariaLabel", "className"]);
|
7204
|
+
return /* @__PURE__ */ React86.createElement("table", __spreadProps(__spreadValues({}, rest), {
|
7205
|
+
className: classNames(tableClassNames, className),
|
7206
|
+
"aria-label": ariaLabel
|
7207
|
+
}), children);
|
7208
|
+
};
|
7209
|
+
var TableHead = (_a) => {
|
7210
|
+
var _b = _a, { children, sticky } = _b, rest = __objRest(_b, ["children", "sticky"]);
|
7211
|
+
return /* @__PURE__ */ React86.createElement("thead", __spreadValues({}, rest), /* @__PURE__ */ React86.createElement("tr", null, /* @__PURE__ */ React86.createElement(HeadContext.Provider, {
|
7212
|
+
value: { children, sticky }
|
7213
|
+
}, children)));
|
7214
|
+
};
|
7215
|
+
var TableBody = (_a) => {
|
7216
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
7217
|
+
return /* @__PURE__ */ React86.createElement("tbody", __spreadValues({}, rest), children);
|
7218
|
+
};
|
7219
|
+
var rowClassNames = tw("children:border-grey-10 children:last:border-b-0 hover:bg-grey-0");
|
7220
|
+
var TableRow = (_a) => {
|
7221
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
7222
|
+
return /* @__PURE__ */ React86.createElement("tr", __spreadProps(__spreadValues({}, rest), {
|
7223
|
+
className: classNames(rowClassNames, className)
|
7224
|
+
}), children);
|
7225
|
+
};
|
7226
|
+
var cellClassNames = tw("px-4 border-b typography-body-small leading-[18px]");
|
7227
|
+
var getBodyCellClassNames = (table = true) => tw("text-grey-70 py-3", {
|
7228
|
+
"h-[50px]": table,
|
7229
|
+
"min-h-[50px]": !table
|
7230
|
+
});
|
7231
|
+
var getAlignClassNames2 = (align) => tw({ "text-right": align === "right", "text-center": align === "center" });
|
7232
|
+
var getHeadCellClassNames = (sticky = true) => {
|
7233
|
+
const common = tw("py-[14px] text-left bg-white border-grey-40 text-grey-50 font-normal");
|
7234
|
+
return sticky ? classNames(common, tw("sticky top-0")) : common;
|
7235
|
+
};
|
7236
|
+
var TableCell = (_a) => {
|
7237
|
+
var _b = _a, { children, className, align = "left" } = _b, rest = __objRest(_b, ["children", "className", "align"]);
|
7238
|
+
const headContext = React86.useContext(HeadContext);
|
7239
|
+
return headContext ? /* @__PURE__ */ React86.createElement("th", __spreadProps(__spreadValues({}, rest), {
|
7240
|
+
className: classNames(
|
7241
|
+
cellClassNames,
|
7242
|
+
getHeadCellClassNames(headContext.sticky),
|
7243
|
+
getAlignClassNames2(align),
|
7244
|
+
className
|
7245
|
+
)
|
7246
|
+
}), children) : /* @__PURE__ */ React86.createElement("td", __spreadProps(__spreadValues({}, rest), {
|
7247
|
+
className: classNames(cellClassNames, getBodyCellClassNames(), getAlignClassNames2(align), className)
|
7248
|
+
}), children);
|
7249
|
+
};
|
7250
|
+
var TableSelectCell = (_a) => {
|
7251
|
+
var _b = _a, { ariaLabel } = _b, props = __objRest(_b, ["ariaLabel"]);
|
7252
|
+
return /* @__PURE__ */ React86.createElement(Table.Cell, {
|
7253
|
+
className: tw("leading-[0px]")
|
7254
|
+
}, props.type === "radio" ? /* @__PURE__ */ React86.createElement(RadioButton, __spreadValues({
|
7255
|
+
"aria-label": ariaLabel
|
7256
|
+
}, props)) : /* @__PURE__ */ React86.createElement(Checkbox, __spreadValues({
|
7257
|
+
"aria-label": ariaLabel
|
7258
|
+
}, props)));
|
7259
|
+
};
|
7260
|
+
var getSortCellButtonClassNames = (align) => tw("group flex items-center gap-x-4 text-grey-50", { "flex-row-reverse": align === "right" });
|
7261
|
+
var getSortCellIconClassNames = (active) => {
|
7262
|
+
return tw("text-[9px]", active ? "text-grey-70" : "text-grey-30");
|
7263
|
+
};
|
7264
|
+
var TableSortCell = (_a) => {
|
7265
|
+
var _b = _a, { children, direction = "none", onClick } = _b, rest = __objRest(_b, ["children", "direction", "onClick"]);
|
7266
|
+
return /* @__PURE__ */ React86.createElement(Table.Cell, __spreadProps(__spreadValues({}, rest), {
|
7267
|
+
"aria-sort": direction
|
7268
|
+
}), /* @__PURE__ */ React86.createElement("span", {
|
7269
|
+
className: getSortCellButtonClassNames(rest.align),
|
7270
|
+
role: "button",
|
7271
|
+
tabIndex: -1,
|
7272
|
+
onClick
|
7273
|
+
}, children, /* @__PURE__ */ React86.createElement("div", {
|
7274
|
+
"data-sort-icons": true,
|
7275
|
+
className: tw("flex flex-col", {
|
7276
|
+
"invisible group-hover:visible": direction === "none"
|
7277
|
+
})
|
7278
|
+
}, /* @__PURE__ */ React86.createElement(InlineIcon, {
|
7279
|
+
icon: import_chevronUp3.default,
|
7280
|
+
className: getSortCellIconClassNames(direction === "descending")
|
7281
|
+
}), /* @__PURE__ */ React86.createElement(InlineIcon, {
|
7282
|
+
icon: import_chevronDown4.default,
|
7283
|
+
className: getSortCellIconClassNames(direction === "ascending")
|
7284
|
+
}))));
|
7285
|
+
};
|
7286
|
+
var Item3 = ({ image, imageAlt, imageSize = 35, title, caption }) => /* @__PURE__ */ React86.createElement("div", {
|
7287
|
+
className: tw("flex gap-4 items-center")
|
7288
|
+
}, image && /* @__PURE__ */ React86.createElement("img", {
|
7289
|
+
src: image,
|
7290
|
+
alt: imageAlt,
|
7291
|
+
style: { width: imageSize, height: imageSize }
|
7292
|
+
}), /* @__PURE__ */ React86.createElement("div", null, title, caption && /* @__PURE__ */ React86.createElement(Typography2.Caption, null, caption)));
|
7293
|
+
Table.Head = React86.memo(TableHead);
|
7294
|
+
Table.Body = React86.memo(TableBody);
|
7295
|
+
Table.Row = React86.memo(TableRow);
|
7296
|
+
Table.Cell = React86.memo(TableCell);
|
7297
|
+
Table.SortCell = React86.memo(TableSortCell);
|
7298
|
+
Table.SelectCell = React86.memo(TableSelectCell);
|
3285
7299
|
export {
|
3286
7300
|
Alert,
|
3287
7301
|
Checkbox,
|
@@ -3289,15 +7303,21 @@ export {
|
|
3289
7303
|
DIALOG_ICONS_AND_COLORS,
|
3290
7304
|
DropdownMenu,
|
3291
7305
|
InputGroup,
|
3292
|
-
|
7306
|
+
Item3 as Item,
|
3293
7307
|
Modal,
|
3294
7308
|
Popover,
|
3295
7309
|
PopoverDialog,
|
3296
7310
|
RadioButton,
|
3297
7311
|
Select,
|
3298
7312
|
Table,
|
7313
|
+
cellClassNames,
|
7314
|
+
getAlignClassNames2 as getAlignClassNames,
|
7315
|
+
getBodyCellClassNames,
|
3299
7316
|
getHeadCellClassNames,
|
3300
7317
|
getOptionLabelBuiltin,
|
7318
|
+
getSortCellButtonClassNames,
|
7319
|
+
getSortCellIconClassNames,
|
3301
7320
|
getValues,
|
3302
|
-
isOptionDisabledBuiltin
|
7321
|
+
isOptionDisabledBuiltin,
|
7322
|
+
rowClassNames
|
3303
7323
|
};
|