@mercurjs/dashboard-shared 2.4.2-canary.3 → 2.4.2-canary.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -1
- package/dist/index.js +492 -310
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10434,7 +10434,7 @@ var require_common44 = __commonJS({
|
|
|
10434
10434
|
"../types/dist/product/common.js"(exports) {
|
|
10435
10435
|
"use strict";
|
|
10436
10436
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10437
|
-
exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeType = void 0;
|
|
10437
|
+
exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeScope = exports.AttributeType = void 0;
|
|
10438
10438
|
var AttributeType3;
|
|
10439
10439
|
(function(AttributeType4) {
|
|
10440
10440
|
AttributeType4["SINGLE_SELECT"] = "single_select";
|
|
@@ -10442,7 +10442,13 @@ var require_common44 = __commonJS({
|
|
|
10442
10442
|
AttributeType4["UNIT"] = "unit";
|
|
10443
10443
|
AttributeType4["TOGGLE"] = "toggle";
|
|
10444
10444
|
AttributeType4["TEXT"] = "text";
|
|
10445
|
+
AttributeType4["DATE"] = "date";
|
|
10445
10446
|
})(AttributeType3 || (exports.AttributeType = AttributeType3 = {}));
|
|
10447
|
+
var AttributeScope;
|
|
10448
|
+
(function(AttributeScope2) {
|
|
10449
|
+
AttributeScope2["PRODUCT"] = "product";
|
|
10450
|
+
AttributeScope2["VARIANT"] = "variant";
|
|
10451
|
+
})(AttributeScope || (exports.AttributeScope = AttributeScope = {}));
|
|
10446
10452
|
var ProductChangeStatus;
|
|
10447
10453
|
(function(ProductChangeStatus2) {
|
|
10448
10454
|
ProductChangeStatus2["PENDING"] = "pending";
|
|
@@ -10460,6 +10466,9 @@ var require_common44 = __commonJS({
|
|
|
10460
10466
|
ProductChangeActionType3["ATTRIBUTE_ADD"] = "ATTRIBUTE_ADD";
|
|
10461
10467
|
ProductChangeActionType3["ATTRIBUTE_REMOVE"] = "ATTRIBUTE_REMOVE";
|
|
10462
10468
|
ProductChangeActionType3["ATTRIBUTE_UPDATE"] = "ATTRIBUTE_UPDATE";
|
|
10469
|
+
ProductChangeActionType3["VARIANT_ATTRIBUTE_ADD"] = "VARIANT_ATTRIBUTE_ADD";
|
|
10470
|
+
ProductChangeActionType3["VARIANT_ATTRIBUTE_REMOVE"] = "VARIANT_ATTRIBUTE_REMOVE";
|
|
10471
|
+
ProductChangeActionType3["VARIANT_ATTRIBUTE_UPDATE"] = "VARIANT_ATTRIBUTE_UPDATE";
|
|
10463
10472
|
ProductChangeActionType3["PRODUCT_ADD"] = "PRODUCT_ADD";
|
|
10464
10473
|
ProductChangeActionType3["PRODUCT_DELETE"] = "PRODUCT_DELETE";
|
|
10465
10474
|
ProductChangeActionType3["CHANGE_REQUESTED"] = "CHANGE_REQUESTED";
|
|
@@ -10623,7 +10632,7 @@ var require_dist2 = __commonJS({
|
|
|
10623
10632
|
};
|
|
10624
10633
|
})();
|
|
10625
10634
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10626
|
-
exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeType = exports.ProductStatus = exports.HttpTypes = void 0;
|
|
10635
|
+
exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeType = exports.AttributeScope = exports.ProductStatus = exports.HttpTypes = void 0;
|
|
10627
10636
|
__exportStar(require_dist(), exports);
|
|
10628
10637
|
__exportStar(require_seller(), exports);
|
|
10629
10638
|
__exportStar(require_order_group(), exports);
|
|
@@ -10638,6 +10647,9 @@ var require_dist2 = __commonJS({
|
|
|
10638
10647
|
return status_1.ProductStatus;
|
|
10639
10648
|
} });
|
|
10640
10649
|
var product_1 = require_product5();
|
|
10650
|
+
Object.defineProperty(exports, "AttributeScope", { enumerable: true, get: function() {
|
|
10651
|
+
return product_1.AttributeScope;
|
|
10652
|
+
} });
|
|
10641
10653
|
Object.defineProperty(exports, "AttributeType", { enumerable: true, get: function() {
|
|
10642
10654
|
return product_1.AttributeType;
|
|
10643
10655
|
} });
|
|
@@ -10807,6 +10819,20 @@ var toAttributeUpdate = (details) => {
|
|
|
10807
10819
|
scalarValue: update.value
|
|
10808
10820
|
};
|
|
10809
10821
|
};
|
|
10822
|
+
var withPrevious = (change, details) => {
|
|
10823
|
+
const previous = details.previous_value;
|
|
10824
|
+
if (!previous) {
|
|
10825
|
+
return { ...change, previousValueIds: [], previousScalar: null };
|
|
10826
|
+
}
|
|
10827
|
+
return {
|
|
10828
|
+
...change,
|
|
10829
|
+
previousValueIds: Array.isArray(previous.value_ids) ? previous.value_ids.filter(
|
|
10830
|
+
(v) => typeof v === "string"
|
|
10831
|
+
) : [],
|
|
10832
|
+
previousScalar: previous.value
|
|
10833
|
+
};
|
|
10834
|
+
};
|
|
10835
|
+
var variantIdOf = (details) => details.variant_id !== void 0 && details.variant_id !== null ? String(details.variant_id) : void 0;
|
|
10810
10836
|
var buildProductChangeView = (actions) => {
|
|
10811
10837
|
const productUpdated = [];
|
|
10812
10838
|
let productMedia = { added: [], removed: [] };
|
|
@@ -10818,7 +10844,12 @@ var buildProductChangeView = (actions) => {
|
|
|
10818
10844
|
const variantGroup = (variantId) => {
|
|
10819
10845
|
let group = variantGroupMap.get(variantId);
|
|
10820
10846
|
if (!group) {
|
|
10821
|
-
group = {
|
|
10847
|
+
group = {
|
|
10848
|
+
variantId,
|
|
10849
|
+
fieldDiffs: [],
|
|
10850
|
+
media: { added: [], removed: [] },
|
|
10851
|
+
attributes: []
|
|
10852
|
+
};
|
|
10822
10853
|
variantGroupMap.set(variantId, group);
|
|
10823
10854
|
}
|
|
10824
10855
|
return group;
|
|
@@ -10899,6 +10930,38 @@ var buildProductChangeView = (actions) => {
|
|
|
10899
10930
|
if (change) attributes.push(change);
|
|
10900
10931
|
break;
|
|
10901
10932
|
}
|
|
10933
|
+
case import_types.ProductChangeActionType.VARIANT_ATTRIBUTE_ADD: {
|
|
10934
|
+
const variantId = variantIdOf(details);
|
|
10935
|
+
if (!variantId) break;
|
|
10936
|
+
variantGroup(variantId).attributes.push(
|
|
10937
|
+
withPrevious(toAttributeAdd(details), details)
|
|
10938
|
+
);
|
|
10939
|
+
break;
|
|
10940
|
+
}
|
|
10941
|
+
case import_types.ProductChangeActionType.VARIANT_ATTRIBUTE_REMOVE: {
|
|
10942
|
+
const variantId = variantIdOf(details);
|
|
10943
|
+
if (!variantId) break;
|
|
10944
|
+
variantGroup(variantId).attributes.push(
|
|
10945
|
+
withPrevious(
|
|
10946
|
+
{
|
|
10947
|
+
kind: "removed",
|
|
10948
|
+
attributeId: typeof details.attribute_id === "string" ? details.attribute_id : void 0,
|
|
10949
|
+
addValueIds: [],
|
|
10950
|
+
addValueNames: [],
|
|
10951
|
+
removeValueIds: []
|
|
10952
|
+
},
|
|
10953
|
+
details
|
|
10954
|
+
)
|
|
10955
|
+
);
|
|
10956
|
+
break;
|
|
10957
|
+
}
|
|
10958
|
+
case import_types.ProductChangeActionType.VARIANT_ATTRIBUTE_UPDATE: {
|
|
10959
|
+
const variantId = variantIdOf(details);
|
|
10960
|
+
const change = toAttributeUpdate(details);
|
|
10961
|
+
if (!variantId || !change) break;
|
|
10962
|
+
variantGroup(variantId).attributes.push(withPrevious(change, details));
|
|
10963
|
+
break;
|
|
10964
|
+
}
|
|
10902
10965
|
case import_types.ProductChangeActionType.PRODUCT_DELETE:
|
|
10903
10966
|
deleteRequested = true;
|
|
10904
10967
|
break;
|
|
@@ -10907,7 +10970,7 @@ var buildProductChangeView = (actions) => {
|
|
|
10907
10970
|
}
|
|
10908
10971
|
}
|
|
10909
10972
|
const variantGroups = Array.from(variantGroupMap.values()).filter(
|
|
10910
|
-
(g) => g.fieldDiffs.length > 0 || hasMedia(g.media)
|
|
10973
|
+
(g) => g.fieldDiffs.length > 0 || hasMedia(g.media) || g.attributes.length > 0
|
|
10911
10974
|
);
|
|
10912
10975
|
return {
|
|
10913
10976
|
productUpdated: sortProductFieldDiffs(productUpdated),
|
|
@@ -15525,8 +15588,17 @@ var attributeDisplay = (change, lookup, booleanLabels) => {
|
|
|
15525
15588
|
const entry = change.attributeId ? lookup.get(change.attributeId) : void 0;
|
|
15526
15589
|
const name = entry?.name ?? change.inlineTitle ?? change.attributeId ?? "-";
|
|
15527
15590
|
const resolveIds = (ids) => ids.map((id) => entry?.valueNameById.get(id) ?? id);
|
|
15591
|
+
const selectedNames = () => {
|
|
15592
|
+
if (change.previousValueIds === void 0) {
|
|
15593
|
+
return entry?.selectedNames ?? [];
|
|
15594
|
+
}
|
|
15595
|
+
if (change.previousScalar !== void 0 && change.previousScalar !== null) {
|
|
15596
|
+
return [formatFieldValue(change.previousScalar, void 0, booleanLabels)];
|
|
15597
|
+
}
|
|
15598
|
+
return resolveIds(change.previousValueIds);
|
|
15599
|
+
};
|
|
15528
15600
|
if (change.kind === "removed") {
|
|
15529
|
-
const prev =
|
|
15601
|
+
const prev = selectedNames();
|
|
15530
15602
|
return { name, previous: prev.length ? prev.join(", ") : null, next: "" };
|
|
15531
15603
|
}
|
|
15532
15604
|
if (change.kind === "added") {
|
|
@@ -15541,14 +15613,14 @@ var attributeDisplay = (change, lookup, booleanLabels) => {
|
|
|
15541
15613
|
};
|
|
15542
15614
|
}
|
|
15543
15615
|
if (change.scalarValue !== void 0 && change.scalarValue !== null) {
|
|
15544
|
-
const prev =
|
|
15616
|
+
const prev = selectedNames()[0];
|
|
15545
15617
|
return {
|
|
15546
15618
|
name,
|
|
15547
15619
|
previous: prev ?? null,
|
|
15548
15620
|
next: formatFieldValue(change.scalarValue, void 0, booleanLabels)
|
|
15549
15621
|
};
|
|
15550
15622
|
}
|
|
15551
|
-
const prevNames =
|
|
15623
|
+
const prevNames = selectedNames();
|
|
15552
15624
|
const removedNames = resolveIds(change.removeValueIds);
|
|
15553
15625
|
const addedNames = [
|
|
15554
15626
|
...change.addValueNames,
|
|
@@ -15655,13 +15727,17 @@ var ProductChangePanel = ({
|
|
|
15655
15727
|
}, [view.productUpdated]);
|
|
15656
15728
|
const attributeIdsToFetch = useMemo5(() => {
|
|
15657
15729
|
const ids = /* @__PURE__ */ new Set();
|
|
15658
|
-
|
|
15730
|
+
const changes = [
|
|
15731
|
+
...view.attributes,
|
|
15732
|
+
...view.variantGroups.flatMap((group) => group.attributes)
|
|
15733
|
+
];
|
|
15734
|
+
for (const change of changes) {
|
|
15659
15735
|
if (change.attributeId && !productAttributesById.has(change.attributeId)) {
|
|
15660
15736
|
ids.add(change.attributeId);
|
|
15661
15737
|
}
|
|
15662
15738
|
}
|
|
15663
15739
|
return Array.from(ids);
|
|
15664
|
-
}, [view.attributes, productAttributesById]);
|
|
15740
|
+
}, [view.attributes, view.variantGroups, productAttributesById]);
|
|
15665
15741
|
const variantIdsToFetch = useMemo5(() => {
|
|
15666
15742
|
const ids = /* @__PURE__ */ new Set();
|
|
15667
15743
|
for (const action of view.variantsRemoved) {
|
|
@@ -15899,7 +15975,9 @@ var ProductChangePanel = ({
|
|
|
15899
15975
|
addedLabel: t2("labels.added"),
|
|
15900
15976
|
removedLabel: t2("labels.removed"),
|
|
15901
15977
|
fieldLabel,
|
|
15902
|
-
lookups
|
|
15978
|
+
lookups,
|
|
15979
|
+
attributeLabel: typeAttribute,
|
|
15980
|
+
attributeLookup
|
|
15903
15981
|
},
|
|
15904
15982
|
group.variantId
|
|
15905
15983
|
))
|
|
@@ -15926,9 +16004,15 @@ var VariantGroupBlock = ({
|
|
|
15926
16004
|
addedLabel,
|
|
15927
16005
|
removedLabel,
|
|
15928
16006
|
fieldLabel,
|
|
15929
|
-
lookups
|
|
16007
|
+
lookups,
|
|
16008
|
+
attributeLabel,
|
|
16009
|
+
attributeLookup
|
|
15930
16010
|
}) => {
|
|
15931
16011
|
const media = group.media;
|
|
16012
|
+
const attrsByKind = (kind) => group.attributes.filter((a) => a.kind === kind);
|
|
16013
|
+
const updatedAttributes = attrsByKind("updated");
|
|
16014
|
+
const addedAttributes = attrsByKind("added");
|
|
16015
|
+
const removedAttributes = attrsByKind("removed");
|
|
15932
16016
|
return /* @__PURE__ */ jsxs19("div", { className: "divide-y divide-dashed", children: [
|
|
15933
16017
|
/* @__PURE__ */ jsxs19(
|
|
15934
16018
|
"div",
|
|
@@ -15947,16 +16031,46 @@ var VariantGroupBlock = ({
|
|
|
15947
16031
|
]
|
|
15948
16032
|
}
|
|
15949
16033
|
),
|
|
15950
|
-
group.fieldDiffs.length > 0 && /* @__PURE__ */
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
16034
|
+
(group.fieldDiffs.length > 0 || updatedAttributes.length > 0) && /* @__PURE__ */ jsxs19(GroupRow, { label: updatedLabel, children: [
|
|
16035
|
+
group.fieldDiffs.map((diff, idx) => /* @__PURE__ */ jsx24(
|
|
16036
|
+
ItemRow,
|
|
16037
|
+
{
|
|
16038
|
+
label: fieldLabel(diff.field),
|
|
16039
|
+
children: /* @__PURE__ */ jsx24(FieldDiffValue, { diff, lookups })
|
|
16040
|
+
},
|
|
16041
|
+
`vu-${diff.field}-${idx}`
|
|
16042
|
+
)),
|
|
16043
|
+
updatedAttributes.map((change, idx) => /* @__PURE__ */ jsx24(
|
|
16044
|
+
ItemRow,
|
|
16045
|
+
{
|
|
16046
|
+
label: attributeLabel,
|
|
16047
|
+
children: /* @__PURE__ */ jsx24(AttributeValue, { change, lookup: attributeLookup })
|
|
16048
|
+
},
|
|
16049
|
+
`vua-${change.attributeId ?? idx}`
|
|
16050
|
+
))
|
|
16051
|
+
] }),
|
|
16052
|
+
(media.added.length > 0 || addedAttributes.length > 0) && /* @__PURE__ */ jsxs19(GroupRow, { label: addedLabel, children: [
|
|
16053
|
+
media.added.length > 0 && /* @__PURE__ */ jsx24(ItemRow, { label: mediaLabel, children: /* @__PURE__ */ jsx24(ImageStrip, { images: media.added }) }),
|
|
16054
|
+
addedAttributes.map((change, idx) => /* @__PURE__ */ jsx24(
|
|
16055
|
+
ItemRow,
|
|
16056
|
+
{
|
|
16057
|
+
label: attributeLabel,
|
|
16058
|
+
children: /* @__PURE__ */ jsx24(AttributeValue, { change, lookup: attributeLookup })
|
|
16059
|
+
},
|
|
16060
|
+
`vaa-${change.attributeId ?? idx}`
|
|
16061
|
+
))
|
|
16062
|
+
] }),
|
|
16063
|
+
(media.removed.length > 0 || removedAttributes.length > 0) && /* @__PURE__ */ jsxs19(GroupRow, { label: removedLabel, children: [
|
|
16064
|
+
media.removed.length > 0 && /* @__PURE__ */ jsx24(ItemRow, { label: mediaLabel, children: /* @__PURE__ */ jsx24(ImageStrip, { images: media.removed }) }),
|
|
16065
|
+
removedAttributes.map((change, idx) => /* @__PURE__ */ jsx24(
|
|
16066
|
+
ItemRow,
|
|
16067
|
+
{
|
|
16068
|
+
label: attributeLabel,
|
|
16069
|
+
children: /* @__PURE__ */ jsx24(AttributeValue, { change, lookup: attributeLookup })
|
|
16070
|
+
},
|
|
16071
|
+
`vra-${change.attributeId ?? idx}`
|
|
16072
|
+
))
|
|
16073
|
+
] })
|
|
15960
16074
|
] });
|
|
15961
16075
|
};
|
|
15962
16076
|
|
|
@@ -22303,7 +22417,7 @@ import * as zod from "zod";
|
|
|
22303
22417
|
|
|
22304
22418
|
// src/components/inputs/attribute-value-input/attribute-value-input.tsx
|
|
22305
22419
|
var import_types2 = __toESM(require_dist2(), 1);
|
|
22306
|
-
import { Input as Input4, Select as Select3, Textarea as Textarea4 } from "@medusajs/ui";
|
|
22420
|
+
import { DatePicker, Input as Input4, Select as Select3, Textarea as Textarea4 } from "@medusajs/ui";
|
|
22307
22421
|
import { useTranslation as useTranslation27 } from "react-i18next";
|
|
22308
22422
|
|
|
22309
22423
|
// src/components/inputs/combobox/combobox.tsx
|
|
@@ -22672,6 +22786,14 @@ var Combobox = genericForwardRef(ComboboxImpl);
|
|
|
22672
22786
|
|
|
22673
22787
|
// src/components/inputs/attribute-value-input/attribute-value-input.tsx
|
|
22674
22788
|
import { jsx as jsx58, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
22789
|
+
var toIsoDate = (date) => {
|
|
22790
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
22791
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
22792
|
+
};
|
|
22793
|
+
var fromIsoDate = (value) => {
|
|
22794
|
+
const [y, m, d] = value.split("-").map(Number);
|
|
22795
|
+
return y && m && d ? new Date(y, m - 1, d) : null;
|
|
22796
|
+
};
|
|
22675
22797
|
var AttributeValueInput = ({
|
|
22676
22798
|
type,
|
|
22677
22799
|
value,
|
|
@@ -22732,6 +22854,16 @@ var AttributeValueInput = ({
|
|
|
22732
22854
|
]
|
|
22733
22855
|
}
|
|
22734
22856
|
);
|
|
22857
|
+
case import_types2.AttributeType.DATE: {
|
|
22858
|
+
const raw = typeof value === "string" ? value : value?.[0] ?? "";
|
|
22859
|
+
return /* @__PURE__ */ jsx58(
|
|
22860
|
+
DatePicker,
|
|
22861
|
+
{
|
|
22862
|
+
value: raw ? fromIsoDate(raw) : null,
|
|
22863
|
+
onChange: (date) => onChange(date ? toIsoDate(date) : "")
|
|
22864
|
+
}
|
|
22865
|
+
);
|
|
22866
|
+
}
|
|
22735
22867
|
case import_types2.AttributeType.TEXT:
|
|
22736
22868
|
return /* @__PURE__ */ jsx58(
|
|
22737
22869
|
Textarea4,
|
|
@@ -26272,23 +26404,9 @@ var LocalizedTablePagination = forwardRef14((props, ref) => {
|
|
|
26272
26404
|
LocalizedTablePagination.displayName = "LocalizedTablePagination";
|
|
26273
26405
|
|
|
26274
26406
|
// src/components/sections/product-attribute-section/product-attribute-section.tsx
|
|
26275
|
-
import {
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
PencilSquare,
|
|
26279
|
-
Plus,
|
|
26280
|
-
Swatch,
|
|
26281
|
-
Trash as Trash2
|
|
26282
|
-
} from "@medusajs/icons";
|
|
26283
|
-
import {
|
|
26284
|
-
Badge as Badge7,
|
|
26285
|
-
Container as Container5,
|
|
26286
|
-
Heading as Heading9,
|
|
26287
|
-
Text as Text19,
|
|
26288
|
-
Tooltip as Tooltip12,
|
|
26289
|
-
usePrompt
|
|
26290
|
-
} from "@medusajs/ui";
|
|
26291
|
-
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
26407
|
+
import { DropCap, PencilSquare as PencilSquare2, Plus, Swatch } from "@medusajs/icons";
|
|
26408
|
+
import { Container as Container5, Heading as Heading9 } from "@medusajs/ui";
|
|
26409
|
+
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
26292
26410
|
|
|
26293
26411
|
// src/extensions/preferences.ts
|
|
26294
26412
|
function mergeLayoutPreferences(layers) {
|
|
@@ -27539,7 +27657,10 @@ var useExtensionActivity = (model, entity) => {
|
|
|
27539
27657
|
);
|
|
27540
27658
|
};
|
|
27541
27659
|
|
|
27542
|
-
// src/components/sections/
|
|
27660
|
+
// src/components/sections/attribute-group.tsx
|
|
27661
|
+
import { InformationCircleSolid as InformationCircleSolid2, PencilSquare, Trash as Trash2 } from "@medusajs/icons";
|
|
27662
|
+
import { Badge as Badge7, Text as Text19, Tooltip as Tooltip12, usePrompt } from "@medusajs/ui";
|
|
27663
|
+
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
27543
27664
|
import { jsx as jsx86, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
27544
27665
|
var AttributeActions = ({
|
|
27545
27666
|
attribute,
|
|
@@ -27657,6 +27778,7 @@ var AttributeGroup = ({
|
|
|
27657
27778
|
children: /* @__PURE__ */ jsxs61("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_28px] items-center gap-4 px-3 py-2 bg-ui-bg-component", children: [
|
|
27658
27779
|
/* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
|
|
27659
27780
|
/* @__PURE__ */ jsx86(Text19, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
|
|
27781
|
+
attr.is_internal && /* @__PURE__ */ jsx86(Badge7, { size: "2xsmall", color: "blue", children: t2("attributes.fields.visibility.internal") }),
|
|
27660
27782
|
attr.description && /* @__PURE__ */ jsx86(Tooltip12, { content: attr.description, children: /* @__PURE__ */ jsx86("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx86(InformationCircleSolid2, {}) }) }),
|
|
27661
27783
|
attr.is_required && /* @__PURE__ */ jsx86(
|
|
27662
27784
|
Tooltip12,
|
|
@@ -27682,6 +27804,9 @@ var AttributeGroup = ({
|
|
|
27682
27804
|
}) }) })
|
|
27683
27805
|
] });
|
|
27684
27806
|
};
|
|
27807
|
+
|
|
27808
|
+
// src/components/sections/product-attribute-section/product-attribute-section.tsx
|
|
27809
|
+
import { jsx as jsx87, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27685
27810
|
var defaultEditHref = (attribute) => `attributes/${attribute.id}/edit`;
|
|
27686
27811
|
var ProductAttributeSection = ({
|
|
27687
27812
|
product,
|
|
@@ -27691,7 +27816,7 @@ var ProductAttributeSection = ({
|
|
|
27691
27816
|
addExistingHref = "attributes/add",
|
|
27692
27817
|
createNewHref = "attributes/create"
|
|
27693
27818
|
}) => {
|
|
27694
|
-
const { t: t2 } =
|
|
27819
|
+
const { t: t2 } = useTranslation37();
|
|
27695
27820
|
const attributes = product.attributes ?? [];
|
|
27696
27821
|
const attachedIds = new Set(attributes.map((a) => a.id));
|
|
27697
27822
|
const missing = (requiredAttributes ?? []).filter((required) => !attachedIds.has(required.id)).map(
|
|
@@ -27705,14 +27830,14 @@ var ProductAttributeSection = ({
|
|
|
27705
27830
|
const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
|
|
27706
27831
|
const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
|
|
27707
27832
|
const isEmpty = !variantAttributes.length && !infoAttributes.length;
|
|
27708
|
-
return /* @__PURE__ */
|
|
27709
|
-
/* @__PURE__ */
|
|
27833
|
+
return /* @__PURE__ */ jsxs62(Container5, { className: "p-0", children: [
|
|
27834
|
+
/* @__PURE__ */ jsxs62(
|
|
27710
27835
|
"div",
|
|
27711
27836
|
{
|
|
27712
27837
|
className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
|
|
27713
27838
|
children: [
|
|
27714
|
-
/* @__PURE__ */
|
|
27715
|
-
/* @__PURE__ */
|
|
27839
|
+
/* @__PURE__ */ jsx87(Heading9, { level: "h2", children: t2("products.attributes") }),
|
|
27840
|
+
/* @__PURE__ */ jsx87(
|
|
27716
27841
|
ActionMenu,
|
|
27717
27842
|
{
|
|
27718
27843
|
groups: [
|
|
@@ -27722,13 +27847,13 @@ var ProductAttributeSection = ({
|
|
|
27722
27847
|
label: t2("products.create.attributes.addExisting"),
|
|
27723
27848
|
to: addExistingHref,
|
|
27724
27849
|
permission: "products:edit",
|
|
27725
|
-
icon: /* @__PURE__ */
|
|
27850
|
+
icon: /* @__PURE__ */ jsx87(Plus, {})
|
|
27726
27851
|
},
|
|
27727
27852
|
{
|
|
27728
27853
|
label: t2("products.create.attributes.createNew"),
|
|
27729
27854
|
to: createNewHref,
|
|
27730
27855
|
permission: "products:edit",
|
|
27731
|
-
icon: /* @__PURE__ */
|
|
27856
|
+
icon: /* @__PURE__ */ jsx87(PencilSquare2, {})
|
|
27732
27857
|
}
|
|
27733
27858
|
]
|
|
27734
27859
|
}
|
|
@@ -27738,10 +27863,10 @@ var ProductAttributeSection = ({
|
|
|
27738
27863
|
]
|
|
27739
27864
|
}
|
|
27740
27865
|
),
|
|
27741
|
-
variantAttributes.length > 0 && /* @__PURE__ */
|
|
27866
|
+
variantAttributes.length > 0 && /* @__PURE__ */ jsx87(
|
|
27742
27867
|
AttributeGroup,
|
|
27743
27868
|
{
|
|
27744
|
-
icon: /* @__PURE__ */
|
|
27869
|
+
icon: /* @__PURE__ */ jsx87(Swatch, {}),
|
|
27745
27870
|
title: t2("products.attributeVariations"),
|
|
27746
27871
|
description: t2("products.attributeVariantsDescription"),
|
|
27747
27872
|
attributes: variantAttributes,
|
|
@@ -27749,11 +27874,11 @@ var ProductAttributeSection = ({
|
|
|
27749
27874
|
onDelete: onDeleteAttribute
|
|
27750
27875
|
}
|
|
27751
27876
|
),
|
|
27752
|
-
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */
|
|
27753
|
-
infoAttributes.length > 0 && /* @__PURE__ */
|
|
27877
|
+
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx87("div", { className: "border-t border-dashed border-ui-border-base" }),
|
|
27878
|
+
infoAttributes.length > 0 && /* @__PURE__ */ jsx87(
|
|
27754
27879
|
AttributeGroup,
|
|
27755
27880
|
{
|
|
27756
|
-
icon: /* @__PURE__ */
|
|
27881
|
+
icon: /* @__PURE__ */ jsx87(DropCap, {}),
|
|
27757
27882
|
title: t2("products.attributeProductInformation"),
|
|
27758
27883
|
description: t2("products.attributeProductInformationDescription"),
|
|
27759
27884
|
attributes: infoAttributes,
|
|
@@ -27761,7 +27886,63 @@ var ProductAttributeSection = ({
|
|
|
27761
27886
|
onDelete: onDeleteAttribute
|
|
27762
27887
|
}
|
|
27763
27888
|
),
|
|
27764
|
-
/* @__PURE__ */
|
|
27889
|
+
/* @__PURE__ */ jsx87(DisplayExtensionZone, { model: "product", zone: "attributes", data: product })
|
|
27890
|
+
] });
|
|
27891
|
+
};
|
|
27892
|
+
|
|
27893
|
+
// src/components/sections/variant-attribute-section/variant-attribute-section.tsx
|
|
27894
|
+
import { Plus as Plus2, SquaresPlus } from "@medusajs/icons";
|
|
27895
|
+
import { Container as Container6, Heading as Heading10 } from "@medusajs/ui";
|
|
27896
|
+
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
27897
|
+
import { jsx as jsx88, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
27898
|
+
var defaultEditHref2 = (attribute) => `attributes/${attribute.id}/edit`;
|
|
27899
|
+
var VariantAttributeSection = ({
|
|
27900
|
+
variant,
|
|
27901
|
+
onDeleteAttribute,
|
|
27902
|
+
getEditHref = defaultEditHref2,
|
|
27903
|
+
addExistingHref = "attributes/add"
|
|
27904
|
+
}) => {
|
|
27905
|
+
const { t: t2 } = useTranslation38();
|
|
27906
|
+
const attributes = variant.attributes ?? [];
|
|
27907
|
+
const isEmpty = !attributes.length;
|
|
27908
|
+
return /* @__PURE__ */ jsxs63(Container6, { className: "p-0", "data-testid": "variant-attribute-section", children: [
|
|
27909
|
+
/* @__PURE__ */ jsxs63(
|
|
27910
|
+
"div",
|
|
27911
|
+
{
|
|
27912
|
+
className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
|
|
27913
|
+
children: [
|
|
27914
|
+
/* @__PURE__ */ jsx88(Heading10, { level: "h2", children: t2("products.variant.attributes.header") }),
|
|
27915
|
+
/* @__PURE__ */ jsx88(
|
|
27916
|
+
ActionMenu,
|
|
27917
|
+
{
|
|
27918
|
+
groups: [
|
|
27919
|
+
{
|
|
27920
|
+
actions: [
|
|
27921
|
+
{
|
|
27922
|
+
label: t2("products.create.attributes.addExisting"),
|
|
27923
|
+
to: addExistingHref,
|
|
27924
|
+
permission: "products:edit",
|
|
27925
|
+
icon: /* @__PURE__ */ jsx88(Plus2, {})
|
|
27926
|
+
}
|
|
27927
|
+
]
|
|
27928
|
+
}
|
|
27929
|
+
]
|
|
27930
|
+
}
|
|
27931
|
+
)
|
|
27932
|
+
]
|
|
27933
|
+
}
|
|
27934
|
+
),
|
|
27935
|
+
!isEmpty && /* @__PURE__ */ jsx88(
|
|
27936
|
+
AttributeGroup,
|
|
27937
|
+
{
|
|
27938
|
+
icon: /* @__PURE__ */ jsx88(SquaresPlus, {}),
|
|
27939
|
+
title: t2("products.variant.attributes.header"),
|
|
27940
|
+
description: t2("products.variant.attributes.description"),
|
|
27941
|
+
attributes,
|
|
27942
|
+
getEditHref,
|
|
27943
|
+
onDelete: onDeleteAttribute
|
|
27944
|
+
}
|
|
27945
|
+
)
|
|
27765
27946
|
] });
|
|
27766
27947
|
};
|
|
27767
27948
|
|
|
@@ -27773,7 +27954,7 @@ import {
|
|
|
27773
27954
|
useContext as useContext13,
|
|
27774
27955
|
useMemo as useMemo24
|
|
27775
27956
|
} from "react";
|
|
27776
|
-
import { useTranslation as
|
|
27957
|
+
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
27777
27958
|
|
|
27778
27959
|
// src/components/tabbed-form/use-tab-management.ts
|
|
27779
27960
|
import { useCallback as useCallback24, useEffect as useEffect20, useMemo as useMemo23, useState as useState32 } from "react";
|
|
@@ -27842,7 +28023,7 @@ var useTabManagement = ({
|
|
|
27842
28023
|
};
|
|
27843
28024
|
|
|
27844
28025
|
// src/components/tabbed-form/tabbed-form.tsx
|
|
27845
|
-
import { jsx as
|
|
28026
|
+
import { jsx as jsx89, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
27846
28027
|
var TabbedFormContext = createContext9(null);
|
|
27847
28028
|
var useTabbedForm = () => {
|
|
27848
28029
|
const form = useContext13(TabbedFormContext);
|
|
@@ -27889,7 +28070,7 @@ function Root6({
|
|
|
27889
28070
|
footer,
|
|
27890
28071
|
transformTabs
|
|
27891
28072
|
}) {
|
|
27892
|
-
const { t: t2 } =
|
|
28073
|
+
const { t: t2 } = useTranslation39();
|
|
27893
28074
|
const { tabs: rawTabs, elements } = useMemo24(
|
|
27894
28075
|
() => collectTabs(children),
|
|
27895
28076
|
[children]
|
|
@@ -27913,7 +28094,7 @@ function Root6({
|
|
|
27913
28094
|
const meta = resolveTabMeta(el);
|
|
27914
28095
|
return meta && visibleTabs.some((vt) => vt.id === meta.id);
|
|
27915
28096
|
});
|
|
27916
|
-
return /* @__PURE__ */
|
|
28097
|
+
return /* @__PURE__ */ jsx89(TabbedFormContext.Provider, { value: form, children: /* @__PURE__ */ jsx89(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs64(
|
|
27917
28098
|
KeyboundForm,
|
|
27918
28099
|
{
|
|
27919
28100
|
onKeyDown: (e) => {
|
|
@@ -27936,14 +28117,14 @@ function Root6({
|
|
|
27936
28117
|
onSubmit,
|
|
27937
28118
|
className: "flex h-full flex-col",
|
|
27938
28119
|
children: [
|
|
27939
|
-
/* @__PURE__ */
|
|
28120
|
+
/* @__PURE__ */ jsxs64(
|
|
27940
28121
|
ProgressTabs,
|
|
27941
28122
|
{
|
|
27942
28123
|
value: activeTabId,
|
|
27943
28124
|
onValueChange: onTabChange,
|
|
27944
28125
|
className: "flex h-full flex-col overflow-hidden",
|
|
27945
28126
|
children: [
|
|
27946
|
-
/* @__PURE__ */
|
|
28127
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx89("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx89(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: visibleTabs.map((tab) => /* @__PURE__ */ jsx89(
|
|
27947
28128
|
ProgressTabs.Trigger,
|
|
27948
28129
|
{
|
|
27949
28130
|
status: tabState[tab.id] ?? "not-started",
|
|
@@ -27953,9 +28134,9 @@ function Root6({
|
|
|
27953
28134
|
},
|
|
27954
28135
|
tab.id
|
|
27955
28136
|
)) }) }) }),
|
|
27956
|
-
/* @__PURE__ */
|
|
28137
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: visibleElements.map((element) => {
|
|
27957
28138
|
const meta = resolveTabMeta(element);
|
|
27958
|
-
return /* @__PURE__ */
|
|
28139
|
+
return /* @__PURE__ */ jsx89(
|
|
27959
28140
|
ProgressTabs.Content,
|
|
27960
28141
|
{
|
|
27961
28142
|
className: "size-full overflow-y-auto",
|
|
@@ -27968,7 +28149,7 @@ function Root6({
|
|
|
27968
28149
|
]
|
|
27969
28150
|
}
|
|
27970
28151
|
),
|
|
27971
|
-
/* @__PURE__ */
|
|
28152
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Footer, { children: footer ? footer({ isLastTab, onNext, isLoading }) : /* @__PURE__ */ jsx89(
|
|
27972
28153
|
DefaultFooter,
|
|
27973
28154
|
{
|
|
27974
28155
|
isLastTab,
|
|
@@ -27985,10 +28166,10 @@ var DefaultFooter = ({
|
|
|
27985
28166
|
onNext,
|
|
27986
28167
|
isLoading
|
|
27987
28168
|
}) => {
|
|
27988
|
-
const { t: t2 } =
|
|
27989
|
-
return /* @__PURE__ */
|
|
27990
|
-
/* @__PURE__ */
|
|
27991
|
-
isLastTab ? /* @__PURE__ */
|
|
28169
|
+
const { t: t2 } = useTranslation39();
|
|
28170
|
+
return /* @__PURE__ */ jsxs64("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
28171
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx89(Button13, { variant: "secondary", size: "small", children: t2("actions.cancel") }) }),
|
|
28172
|
+
isLastTab ? /* @__PURE__ */ jsx89(
|
|
27992
28173
|
Button13,
|
|
27993
28174
|
{
|
|
27994
28175
|
type: "submit",
|
|
@@ -27998,7 +28179,7 @@ var DefaultFooter = ({
|
|
|
27998
28179
|
children: t2("actions.save")
|
|
27999
28180
|
},
|
|
28000
28181
|
"submit-button"
|
|
28001
|
-
) : /* @__PURE__ */
|
|
28182
|
+
) : /* @__PURE__ */ jsx89(
|
|
28002
28183
|
Button13,
|
|
28003
28184
|
{
|
|
28004
28185
|
type: "button",
|
|
@@ -28014,7 +28195,7 @@ var DefaultFooter = ({
|
|
|
28014
28195
|
var Tab = ({
|
|
28015
28196
|
children
|
|
28016
28197
|
}) => {
|
|
28017
|
-
return /* @__PURE__ */
|
|
28198
|
+
return /* @__PURE__ */ jsx89("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsx89("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children }) });
|
|
28018
28199
|
};
|
|
28019
28200
|
var TabbedForm = Object.assign(Root6, { Tab, useForm: useTabbedForm });
|
|
28020
28201
|
|
|
@@ -28027,7 +28208,7 @@ import { Button as Button14, clx as clx49 } from "@medusajs/ui";
|
|
|
28027
28208
|
import { Popover as RadixPopover8 } from "radix-ui";
|
|
28028
28209
|
import { useCallback as useCallback27, useEffect as useEffect23, useMemo as useMemo26, useRef as useRef18, useState as useState37 } from "react";
|
|
28029
28210
|
import { useSearchParams as useSearchParams7 } from "react-router-dom";
|
|
28030
|
-
import { useTranslation as
|
|
28211
|
+
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
28031
28212
|
|
|
28032
28213
|
// src/components/table/data-table/data-table-filter/context.tsx
|
|
28033
28214
|
import { createContext as createContext10, useContext as useContext14 } from "react";
|
|
@@ -28044,12 +28225,12 @@ var useDataTableFilterContext = () => {
|
|
|
28044
28225
|
|
|
28045
28226
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
28046
28227
|
import { EllipseMiniSolid as EllipseMiniSolid2 } from "@medusajs/icons";
|
|
28047
|
-
import { DatePicker, Text as Text21, clx as clx45 } from "@medusajs/ui";
|
|
28228
|
+
import { DatePicker as DatePicker2, Text as Text21, clx as clx45 } from "@medusajs/ui";
|
|
28048
28229
|
import isEqual from "lodash.isequal";
|
|
28049
28230
|
import { Popover as RadixPopover4 } from "radix-ui";
|
|
28050
28231
|
import { useMemo as useMemo25, useState as useState33 } from "react";
|
|
28051
28232
|
import { t } from "i18next";
|
|
28052
|
-
import { useTranslation as
|
|
28233
|
+
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
28053
28234
|
|
|
28054
28235
|
// src/components/table/data-table/hooks.tsx
|
|
28055
28236
|
import { useSearchParams as useSearchParams6 } from "react-router-dom";
|
|
@@ -28122,8 +28303,8 @@ var useSelectedParams = ({
|
|
|
28122
28303
|
import { XMarkMini as XMarkMini5 } from "@medusajs/icons";
|
|
28123
28304
|
import { Text as Text20, clx as clx44 } from "@medusajs/ui";
|
|
28124
28305
|
import { Popover as RadixPopover3 } from "radix-ui";
|
|
28125
|
-
import { useTranslation as
|
|
28126
|
-
import { jsx as
|
|
28306
|
+
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
28307
|
+
import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
28127
28308
|
var FilterChip = ({
|
|
28128
28309
|
hadPreviousValue,
|
|
28129
28310
|
label,
|
|
@@ -28132,14 +28313,14 @@ var FilterChip = ({
|
|
|
28132
28313
|
hasOperator,
|
|
28133
28314
|
onRemove
|
|
28134
28315
|
}) => {
|
|
28135
|
-
const { t: t2 } =
|
|
28316
|
+
const { t: t2 } = useTranslation40();
|
|
28136
28317
|
const handleRemove = (e) => {
|
|
28137
28318
|
e.stopPropagation();
|
|
28138
28319
|
onRemove();
|
|
28139
28320
|
};
|
|
28140
|
-
return /* @__PURE__ */
|
|
28141
|
-
!hadPreviousValue && /* @__PURE__ */
|
|
28142
|
-
/* @__PURE__ */
|
|
28321
|
+
return /* @__PURE__ */ jsxs65("div", { className: "bg-ui-bg-field transition-fg shadow-borders-base text-ui-fg-subtle flex cursor-default select-none items-stretch overflow-hidden rounded-md", children: [
|
|
28322
|
+
!hadPreviousValue && /* @__PURE__ */ jsx90(RadixPopover3.Anchor, {}),
|
|
28323
|
+
/* @__PURE__ */ jsx90(
|
|
28143
28324
|
"div",
|
|
28144
28325
|
{
|
|
28145
28326
|
className: clx44(
|
|
@@ -28148,11 +28329,11 @@ var FilterChip = ({
|
|
|
28148
28329
|
"border-r": !!(value || hadPreviousValue)
|
|
28149
28330
|
}
|
|
28150
28331
|
),
|
|
28151
|
-
children: /* @__PURE__ */
|
|
28332
|
+
children: /* @__PURE__ */ jsx90(Text20, { size: "small", weight: "plus", leading: "compact", children: label })
|
|
28152
28333
|
}
|
|
28153
28334
|
),
|
|
28154
|
-
/* @__PURE__ */
|
|
28155
|
-
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28335
|
+
/* @__PURE__ */ jsxs65("div", { className: "flex w-full items-center overflow-hidden", children: [
|
|
28336
|
+
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx90("div", { className: "border-r p-1 px-2", children: /* @__PURE__ */ jsx90(
|
|
28156
28337
|
Text20,
|
|
28157
28338
|
{
|
|
28158
28339
|
size: "small",
|
|
@@ -28162,7 +28343,7 @@ var FilterChip = ({
|
|
|
28162
28343
|
children: t2("general.is")
|
|
28163
28344
|
}
|
|
28164
28345
|
) }),
|
|
28165
|
-
!!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28346
|
+
!!(value || hadPreviousValue) && /* @__PURE__ */ jsx90(
|
|
28166
28347
|
RadixPopover3.Trigger,
|
|
28167
28348
|
{
|
|
28168
28349
|
asChild: true,
|
|
@@ -28173,7 +28354,7 @@ var FilterChip = ({
|
|
|
28173
28354
|
"data-[state=open]:bg-ui-bg-field-hover": !readonly
|
|
28174
28355
|
}
|
|
28175
28356
|
),
|
|
28176
|
-
children: /* @__PURE__ */
|
|
28357
|
+
children: /* @__PURE__ */ jsx90(
|
|
28177
28358
|
Text20,
|
|
28178
28359
|
{
|
|
28179
28360
|
size: "small",
|
|
@@ -28186,7 +28367,7 @@ var FilterChip = ({
|
|
|
28186
28367
|
}
|
|
28187
28368
|
)
|
|
28188
28369
|
] }),
|
|
28189
|
-
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28370
|
+
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx90(
|
|
28190
28371
|
"button",
|
|
28191
28372
|
{
|
|
28192
28373
|
onClick: handleRemove,
|
|
@@ -28195,7 +28376,7 @@ var FilterChip = ({
|
|
|
28195
28376
|
"hover:bg-ui-bg-subtle-hover",
|
|
28196
28377
|
"active:bg-ui-bg-subtle-pressed active:text-ui-fg-base"
|
|
28197
28378
|
),
|
|
28198
|
-
children: /* @__PURE__ */
|
|
28379
|
+
children: /* @__PURE__ */ jsx90(XMarkMini5, {})
|
|
28199
28380
|
}
|
|
28200
28381
|
)
|
|
28201
28382
|
] });
|
|
@@ -28209,7 +28390,7 @@ var isCompleteDate = (date) => {
|
|
|
28209
28390
|
};
|
|
28210
28391
|
|
|
28211
28392
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
28212
|
-
import { jsx as
|
|
28393
|
+
import { jsx as jsx91, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
28213
28394
|
var DateFilter = ({
|
|
28214
28395
|
filter,
|
|
28215
28396
|
prefix,
|
|
@@ -28286,8 +28467,8 @@ var DateFilter = ({
|
|
|
28286
28467
|
}, 200);
|
|
28287
28468
|
}
|
|
28288
28469
|
};
|
|
28289
|
-
return /* @__PURE__ */
|
|
28290
|
-
/* @__PURE__ */
|
|
28470
|
+
return /* @__PURE__ */ jsxs66(RadixPopover4.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28471
|
+
/* @__PURE__ */ jsx91(
|
|
28291
28472
|
filter_chip_default,
|
|
28292
28473
|
{
|
|
28293
28474
|
hadPreviousValue: !!previousValue,
|
|
@@ -28297,7 +28478,7 @@ var DateFilter = ({
|
|
|
28297
28478
|
readonly
|
|
28298
28479
|
}
|
|
28299
28480
|
),
|
|
28300
|
-
!readonly && /* @__PURE__ */
|
|
28481
|
+
!readonly && /* @__PURE__ */ jsx91(RadixPopover4.Portal, { children: /* @__PURE__ */ jsxs66(
|
|
28301
28482
|
RadixPopover4.Content,
|
|
28302
28483
|
{
|
|
28303
28484
|
"data-name": "date_filter_content",
|
|
@@ -28315,10 +28496,10 @@ var DateFilter = ({
|
|
|
28315
28496
|
}
|
|
28316
28497
|
},
|
|
28317
28498
|
children: [
|
|
28318
|
-
/* @__PURE__ */
|
|
28499
|
+
/* @__PURE__ */ jsxs66("ul", { className: "w-full p-1", children: [
|
|
28319
28500
|
presets.map((preset) => {
|
|
28320
28501
|
const isSelected = selectedParams.get().includes(JSON.stringify(preset.value));
|
|
28321
|
-
return /* @__PURE__ */
|
|
28502
|
+
return /* @__PURE__ */ jsx91("li", { children: /* @__PURE__ */ jsxs66(
|
|
28322
28503
|
"button",
|
|
28323
28504
|
{
|
|
28324
28505
|
className: "bg-ui-bg-base hover:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled]:text-ui-fg-disabled txt-compact-small relative flex w-full cursor-pointer select-none items-center rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled]:pointer-events-none",
|
|
@@ -28327,7 +28508,7 @@ var DateFilter = ({
|
|
|
28327
28508
|
handleSelectPreset(preset.value);
|
|
28328
28509
|
},
|
|
28329
28510
|
children: [
|
|
28330
|
-
/* @__PURE__ */
|
|
28511
|
+
/* @__PURE__ */ jsx91(
|
|
28331
28512
|
"div",
|
|
28332
28513
|
{
|
|
28333
28514
|
className: clx45(
|
|
@@ -28336,7 +28517,7 @@ var DateFilter = ({
|
|
|
28336
28517
|
"[&_svg]:invisible": !isSelected
|
|
28337
28518
|
}
|
|
28338
28519
|
),
|
|
28339
|
-
children: /* @__PURE__ */
|
|
28520
|
+
children: /* @__PURE__ */ jsx91(EllipseMiniSolid2, {})
|
|
28340
28521
|
}
|
|
28341
28522
|
),
|
|
28342
28523
|
preset.label
|
|
@@ -28344,14 +28525,14 @@ var DateFilter = ({
|
|
|
28344
28525
|
}
|
|
28345
28526
|
) }, preset.label);
|
|
28346
28527
|
}),
|
|
28347
|
-
/* @__PURE__ */
|
|
28528
|
+
/* @__PURE__ */ jsx91("li", { children: /* @__PURE__ */ jsxs66(
|
|
28348
28529
|
"button",
|
|
28349
28530
|
{
|
|
28350
28531
|
className: "bg-ui-bg-base hover:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled]:text-ui-fg-disabled txt-compact-small relative flex w-full cursor-pointer select-none items-center rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled]:pointer-events-none",
|
|
28351
28532
|
type: "button",
|
|
28352
28533
|
onClick: handleSelectCustom,
|
|
28353
28534
|
children: [
|
|
28354
|
-
/* @__PURE__ */
|
|
28535
|
+
/* @__PURE__ */ jsx91(
|
|
28355
28536
|
"div",
|
|
28356
28537
|
{
|
|
28357
28538
|
className: clx45(
|
|
@@ -28360,7 +28541,7 @@ var DateFilter = ({
|
|
|
28360
28541
|
"[&_svg]:invisible": !showCustom
|
|
28361
28542
|
}
|
|
28362
28543
|
),
|
|
28363
|
-
children: /* @__PURE__ */
|
|
28544
|
+
children: /* @__PURE__ */ jsx91(EllipseMiniSolid2, {})
|
|
28364
28545
|
}
|
|
28365
28546
|
),
|
|
28366
28547
|
t("filters.date.custom")
|
|
@@ -28368,11 +28549,11 @@ var DateFilter = ({
|
|
|
28368
28549
|
}
|
|
28369
28550
|
) })
|
|
28370
28551
|
] }),
|
|
28371
|
-
showCustom && /* @__PURE__ */
|
|
28372
|
-
/* @__PURE__ */
|
|
28373
|
-
/* @__PURE__ */
|
|
28374
|
-
/* @__PURE__ */
|
|
28375
|
-
|
|
28552
|
+
showCustom && /* @__PURE__ */ jsxs66("div", { className: "border-t px-1 pb-3 pt-1", children: [
|
|
28553
|
+
/* @__PURE__ */ jsxs66("div", { children: [
|
|
28554
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(Text21, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.from") }) }),
|
|
28555
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(
|
|
28556
|
+
DatePicker2,
|
|
28376
28557
|
{
|
|
28377
28558
|
modal: true,
|
|
28378
28559
|
maxValue: customEndValue,
|
|
@@ -28381,10 +28562,10 @@ var DateFilter = ({
|
|
|
28381
28562
|
}
|
|
28382
28563
|
) })
|
|
28383
28564
|
] }),
|
|
28384
|
-
/* @__PURE__ */
|
|
28385
|
-
/* @__PURE__ */
|
|
28386
|
-
/* @__PURE__ */
|
|
28387
|
-
|
|
28565
|
+
/* @__PURE__ */ jsxs66("div", { children: [
|
|
28566
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(Text21, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.to") }) }),
|
|
28567
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(
|
|
28568
|
+
DatePicker2,
|
|
28388
28569
|
{
|
|
28389
28570
|
modal: true,
|
|
28390
28571
|
minValue: customStartValue,
|
|
@@ -28404,7 +28585,7 @@ var DateFilter = ({
|
|
|
28404
28585
|
var today = /* @__PURE__ */ new Date();
|
|
28405
28586
|
today.setHours(0, 0, 0, 0);
|
|
28406
28587
|
var usePresets = () => {
|
|
28407
|
-
const { t: t2 } =
|
|
28588
|
+
const { t: t2 } = useTranslation41();
|
|
28408
28589
|
return useMemo25(
|
|
28409
28590
|
() => [
|
|
28410
28591
|
{
|
|
@@ -28476,15 +28657,15 @@ import {
|
|
|
28476
28657
|
RadioGroup as RadixRadioGroup
|
|
28477
28658
|
} from "radix-ui";
|
|
28478
28659
|
import { useCallback as useCallback25, useEffect as useEffect21, useState as useState34 } from "react";
|
|
28479
|
-
import { useTranslation as
|
|
28480
|
-
import { jsx as
|
|
28660
|
+
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
28661
|
+
import { jsx as jsx92, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
28481
28662
|
var NumberFilter = ({
|
|
28482
28663
|
filter,
|
|
28483
28664
|
prefix,
|
|
28484
28665
|
readonly,
|
|
28485
28666
|
openOnMount
|
|
28486
28667
|
}) => {
|
|
28487
|
-
const { t: t2 } =
|
|
28668
|
+
const { t: t2 } = useTranslation42();
|
|
28488
28669
|
const [open, setOpen] = useState34(openOnMount);
|
|
28489
28670
|
const { key, label } = filter;
|
|
28490
28671
|
const { removeFilter } = useDataTableFilterContext();
|
|
@@ -28574,8 +28755,8 @@ var NumberFilter = ({
|
|
|
28574
28755
|
const EQ_KEY = key;
|
|
28575
28756
|
const displayValue = parseDisplayValue(currentValue, t2);
|
|
28576
28757
|
const previousDisplayValue = parseDisplayValue(previousValue, t2);
|
|
28577
|
-
return /* @__PURE__ */
|
|
28578
|
-
/* @__PURE__ */
|
|
28758
|
+
return /* @__PURE__ */ jsxs67(RadixPopover5.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28759
|
+
/* @__PURE__ */ jsx92(
|
|
28579
28760
|
filter_chip_default,
|
|
28580
28761
|
{
|
|
28581
28762
|
hasOperator: true,
|
|
@@ -28586,7 +28767,7 @@ var NumberFilter = ({
|
|
|
28586
28767
|
readonly
|
|
28587
28768
|
}
|
|
28588
28769
|
),
|
|
28589
|
-
!readonly && /* @__PURE__ */
|
|
28770
|
+
!readonly && /* @__PURE__ */ jsx92(RadixPopover5.Portal, { children: /* @__PURE__ */ jsxs67(
|
|
28590
28771
|
RadixPopover5.Content,
|
|
28591
28772
|
{
|
|
28592
28773
|
"data-name": "number_filter_content",
|
|
@@ -28604,30 +28785,30 @@ var NumberFilter = ({
|
|
|
28604
28785
|
}
|
|
28605
28786
|
},
|
|
28606
28787
|
children: [
|
|
28607
|
-
/* @__PURE__ */
|
|
28788
|
+
/* @__PURE__ */ jsx92("div", { className: "p-1", children: /* @__PURE__ */ jsx92(
|
|
28608
28789
|
RadixRadioGroup.Root,
|
|
28609
28790
|
{
|
|
28610
28791
|
value: operator,
|
|
28611
28792
|
onValueChange: (val) => setOperator(val),
|
|
28612
28793
|
className: "flex flex-col items-start",
|
|
28613
28794
|
orientation: "vertical",
|
|
28614
|
-
children: operators.map((o) => /* @__PURE__ */
|
|
28795
|
+
children: operators.map((o) => /* @__PURE__ */ jsxs67(
|
|
28615
28796
|
RadixRadioGroup.Item,
|
|
28616
28797
|
{
|
|
28617
28798
|
value: o.operator,
|
|
28618
28799
|
className: "txt-compact-small hover:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed transition-fg grid w-full grid-cols-[20px_1fr] gap-2 rounded-[4px] px-2 py-1.5 text-left outline-none",
|
|
28619
28800
|
children: [
|
|
28620
|
-
/* @__PURE__ */
|
|
28621
|
-
/* @__PURE__ */
|
|
28801
|
+
/* @__PURE__ */ jsx92("div", { className: "size-5", children: /* @__PURE__ */ jsx92(RadixRadioGroup.Indicator, { children: /* @__PURE__ */ jsx92(EllipseMiniSolid3, {}) }) }),
|
|
28802
|
+
/* @__PURE__ */ jsx92("span", { className: "w-full", children: o.label })
|
|
28622
28803
|
]
|
|
28623
28804
|
},
|
|
28624
28805
|
o.operator
|
|
28625
28806
|
))
|
|
28626
28807
|
}
|
|
28627
28808
|
) }),
|
|
28628
|
-
/* @__PURE__ */
|
|
28629
|
-
/* @__PURE__ */
|
|
28630
|
-
/* @__PURE__ */
|
|
28809
|
+
/* @__PURE__ */ jsx92("div", { children: operator === "range" ? /* @__PURE__ */ jsxs67("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28810
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx92(Label4, { size: "xsmall", weight: "plus", htmlFor: GT_KEY, children: t2("filters.compare.greaterThan") }) }),
|
|
28811
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28631
28812
|
Input11,
|
|
28632
28813
|
{
|
|
28633
28814
|
name: GT_KEY,
|
|
@@ -28637,8 +28818,8 @@ var NumberFilter = ({
|
|
|
28637
28818
|
onChange: (e) => debouncedOnChange(e, "gt")
|
|
28638
28819
|
}
|
|
28639
28820
|
) }),
|
|
28640
|
-
/* @__PURE__ */
|
|
28641
|
-
/* @__PURE__ */
|
|
28821
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx92(Label4, { size: "xsmall", weight: "plus", htmlFor: LT_KEY, children: t2("filters.compare.lessThan") }) }),
|
|
28822
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28642
28823
|
Input11,
|
|
28643
28824
|
{
|
|
28644
28825
|
name: LT_KEY,
|
|
@@ -28648,9 +28829,9 @@ var NumberFilter = ({
|
|
|
28648
28829
|
onChange: (e) => debouncedOnChange(e, "lt")
|
|
28649
28830
|
}
|
|
28650
28831
|
) })
|
|
28651
|
-
] }, "range") : /* @__PURE__ */
|
|
28652
|
-
/* @__PURE__ */
|
|
28653
|
-
/* @__PURE__ */
|
|
28832
|
+
] }, "range") : /* @__PURE__ */ jsxs67("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28833
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx92(Label4, { size: "xsmall", weight: "plus", htmlFor: EQ_KEY, children: label }) }),
|
|
28834
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28654
28835
|
Input11,
|
|
28655
28836
|
{
|
|
28656
28837
|
name: EQ_KEY,
|
|
@@ -28719,8 +28900,8 @@ import { clx as clx47 } from "@medusajs/ui";
|
|
|
28719
28900
|
import { Command } from "cmdk";
|
|
28720
28901
|
import { Popover as RadixPopover6 } from "radix-ui";
|
|
28721
28902
|
import { useState as useState35 } from "react";
|
|
28722
|
-
import { useTranslation as
|
|
28723
|
-
import { jsx as
|
|
28903
|
+
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
28904
|
+
import { jsx as jsx93, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
28724
28905
|
var SelectFilter = ({
|
|
28725
28906
|
filter,
|
|
28726
28907
|
prefix,
|
|
@@ -28733,7 +28914,7 @@ var SelectFilter = ({
|
|
|
28733
28914
|
const [open, setOpen] = useState35(openOnMount);
|
|
28734
28915
|
const [search, setSearch] = useState35("");
|
|
28735
28916
|
const [searchRef, setSearchRef] = useState35(null);
|
|
28736
|
-
const { t: t2 } =
|
|
28917
|
+
const { t: t2 } = useTranslation43();
|
|
28737
28918
|
const { removeFilter } = useDataTableFilterContext();
|
|
28738
28919
|
const { key, label } = filter;
|
|
28739
28920
|
const selectedParams = useSelectedParams({ param: key, prefix, multiple });
|
|
@@ -28773,8 +28954,8 @@ var SelectFilter = ({
|
|
|
28773
28954
|
};
|
|
28774
28955
|
const normalizedValues = labelValues ? Array.isArray(labelValues) ? labelValues : [labelValues] : null;
|
|
28775
28956
|
const normalizedPrev = previousValue ? Array.isArray(previousValue) ? previousValue : [previousValue] : null;
|
|
28776
|
-
return /* @__PURE__ */
|
|
28777
|
-
/* @__PURE__ */
|
|
28957
|
+
return /* @__PURE__ */ jsxs68(RadixPopover6.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28958
|
+
/* @__PURE__ */ jsx93(
|
|
28778
28959
|
filter_chip_default,
|
|
28779
28960
|
{
|
|
28780
28961
|
hasOperator: true,
|
|
@@ -28785,7 +28966,7 @@ var SelectFilter = ({
|
|
|
28785
28966
|
onRemove: handleRemove
|
|
28786
28967
|
}
|
|
28787
28968
|
),
|
|
28788
|
-
!readonly && /* @__PURE__ */
|
|
28969
|
+
!readonly && /* @__PURE__ */ jsx93(RadixPopover6.Portal, { children: /* @__PURE__ */ jsx93(
|
|
28789
28970
|
RadixPopover6.Content,
|
|
28790
28971
|
{
|
|
28791
28972
|
hideWhenDetached: true,
|
|
@@ -28803,9 +28984,9 @@ var SelectFilter = ({
|
|
|
28803
28984
|
}
|
|
28804
28985
|
}
|
|
28805
28986
|
},
|
|
28806
|
-
children: /* @__PURE__ */
|
|
28807
|
-
searchable && /* @__PURE__ */
|
|
28808
|
-
/* @__PURE__ */
|
|
28987
|
+
children: /* @__PURE__ */ jsxs68(Command, { className: "h-full", children: [
|
|
28988
|
+
searchable && /* @__PURE__ */ jsx93("div", { className: "border-b p-1", children: /* @__PURE__ */ jsxs68("div", { className: "grid grid-cols-[1fr_20px] gap-x-2 rounded-md px-2 py-1", children: [
|
|
28989
|
+
/* @__PURE__ */ jsx93(
|
|
28809
28990
|
Command.Input,
|
|
28810
28991
|
{
|
|
28811
28992
|
ref: setSearchRef,
|
|
@@ -28815,7 +28996,7 @@ var SelectFilter = ({
|
|
|
28815
28996
|
placeholder: t2("general.search")
|
|
28816
28997
|
}
|
|
28817
28998
|
),
|
|
28818
|
-
/* @__PURE__ */
|
|
28999
|
+
/* @__PURE__ */ jsx93("div", { className: "flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsx93(
|
|
28819
29000
|
"button",
|
|
28820
29001
|
{
|
|
28821
29002
|
disabled: !search,
|
|
@@ -28826,14 +29007,14 @@ var SelectFilter = ({
|
|
|
28826
29007
|
invisible: !search
|
|
28827
29008
|
}
|
|
28828
29009
|
),
|
|
28829
|
-
children: /* @__PURE__ */
|
|
29010
|
+
children: /* @__PURE__ */ jsx93(XMarkMini6, {})
|
|
28830
29011
|
}
|
|
28831
29012
|
) })
|
|
28832
29013
|
] }) }),
|
|
28833
|
-
/* @__PURE__ */
|
|
28834
|
-
/* @__PURE__ */
|
|
29014
|
+
/* @__PURE__ */ jsx93(Command.Empty, { className: "txt-compact-small flex items-center justify-center p-1", children: /* @__PURE__ */ jsx93("span", { className: "w-full px-2 py-1 text-center", children: t2("general.noResultsTitle") }) }),
|
|
29015
|
+
/* @__PURE__ */ jsx93(Command.List, { className: "h-full max-h-[163px] min-h-[0] overflow-auto p-1 outline-none", children: options.map((option) => {
|
|
28835
29016
|
const isSelected = selectedParams.get().includes(String(option.value));
|
|
28836
|
-
return /* @__PURE__ */
|
|
29017
|
+
return /* @__PURE__ */ jsxs68(
|
|
28837
29018
|
Command.Item,
|
|
28838
29019
|
{
|
|
28839
29020
|
className: "bg-ui-bg-base hover:bg-ui-bg-base-hover aria-selected:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled=true]:text-ui-fg-disabled txt-compact-small relative flex cursor-pointer select-none items-center gap-x-2 rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled=true]:pointer-events-none",
|
|
@@ -28842,7 +29023,7 @@ var SelectFilter = ({
|
|
|
28842
29023
|
handleSelect(option.value);
|
|
28843
29024
|
},
|
|
28844
29025
|
children: [
|
|
28845
|
-
/* @__PURE__ */
|
|
29026
|
+
/* @__PURE__ */ jsx93(
|
|
28846
29027
|
"div",
|
|
28847
29028
|
{
|
|
28848
29029
|
className: clx47(
|
|
@@ -28851,7 +29032,7 @@ var SelectFilter = ({
|
|
|
28851
29032
|
"[&_svg]:invisible": !isSelected
|
|
28852
29033
|
}
|
|
28853
29034
|
),
|
|
28854
|
-
children: multiple ? /* @__PURE__ */
|
|
29035
|
+
children: multiple ? /* @__PURE__ */ jsx93(CheckMini2, {}) : /* @__PURE__ */ jsx93(EllipseMiniSolid4, {})
|
|
28855
29036
|
}
|
|
28856
29037
|
),
|
|
28857
29038
|
option.label
|
|
@@ -28871,7 +29052,7 @@ import { Input as Input12, Label as Label5, clx as clx48 } from "@medusajs/ui";
|
|
|
28871
29052
|
import debounce3 from "lodash.debounce";
|
|
28872
29053
|
import { Popover as RadixPopover7 } from "radix-ui";
|
|
28873
29054
|
import { useCallback as useCallback26, useEffect as useEffect22, useState as useState36 } from "react";
|
|
28874
|
-
import { jsx as
|
|
29055
|
+
import { jsx as jsx94, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
28875
29056
|
var StringFilter = ({
|
|
28876
29057
|
filter,
|
|
28877
29058
|
prefix,
|
|
@@ -28919,8 +29100,8 @@ var StringFilter = ({
|
|
|
28919
29100
|
selectedParams.delete();
|
|
28920
29101
|
removeFilter(key);
|
|
28921
29102
|
};
|
|
28922
|
-
return /* @__PURE__ */
|
|
28923
|
-
/* @__PURE__ */
|
|
29103
|
+
return /* @__PURE__ */ jsxs69(RadixPopover7.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
29104
|
+
/* @__PURE__ */ jsx94(
|
|
28924
29105
|
filter_chip_default,
|
|
28925
29106
|
{
|
|
28926
29107
|
hasOperator: true,
|
|
@@ -28931,7 +29112,7 @@ var StringFilter = ({
|
|
|
28931
29112
|
readonly
|
|
28932
29113
|
}
|
|
28933
29114
|
),
|
|
28934
|
-
!readonly && /* @__PURE__ */
|
|
29115
|
+
!readonly && /* @__PURE__ */ jsx94(RadixPopover7.Portal, { children: /* @__PURE__ */ jsx94(
|
|
28935
29116
|
RadixPopover7.Content,
|
|
28936
29117
|
{
|
|
28937
29118
|
hideWhenDetached: true,
|
|
@@ -28949,9 +29130,9 @@ var StringFilter = ({
|
|
|
28949
29130
|
}
|
|
28950
29131
|
}
|
|
28951
29132
|
},
|
|
28952
|
-
children: /* @__PURE__ */
|
|
28953
|
-
/* @__PURE__ */
|
|
28954
|
-
/* @__PURE__ */
|
|
29133
|
+
children: /* @__PURE__ */ jsxs69("div", { className: "px-1 pb-3 pt-1", children: [
|
|
29134
|
+
/* @__PURE__ */ jsx94("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx94(Label5, { size: "xsmall", weight: "plus", htmlFor: key, children: label }) }),
|
|
29135
|
+
/* @__PURE__ */ jsx94("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx94(
|
|
28955
29136
|
Input12,
|
|
28956
29137
|
{
|
|
28957
29138
|
name: key,
|
|
@@ -28967,13 +29148,13 @@ var StringFilter = ({
|
|
|
28967
29148
|
};
|
|
28968
29149
|
|
|
28969
29150
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
28970
|
-
import { jsx as
|
|
29151
|
+
import { jsx as jsx95, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28971
29152
|
var DataTableFilter2 = ({
|
|
28972
29153
|
filters,
|
|
28973
29154
|
readonly,
|
|
28974
29155
|
prefix
|
|
28975
29156
|
}) => {
|
|
28976
|
-
const { t: t2 } =
|
|
29157
|
+
const { t: t2 } = useTranslation44();
|
|
28977
29158
|
const [searchParams] = useSearchParams7();
|
|
28978
29159
|
const [open, setOpen] = useState37(false);
|
|
28979
29160
|
const [activeFilters, setActiveFilters] = useState37(
|
|
@@ -29021,7 +29202,7 @@ var DataTableFilter2 = ({
|
|
|
29021
29202
|
const removeAllFilters = useCallback27(() => {
|
|
29022
29203
|
setActiveFilters([]);
|
|
29023
29204
|
}, []);
|
|
29024
|
-
return /* @__PURE__ */
|
|
29205
|
+
return /* @__PURE__ */ jsx95(
|
|
29025
29206
|
DataTableFilterContext.Provider,
|
|
29026
29207
|
{
|
|
29027
29208
|
value: useMemo26(
|
|
@@ -29031,11 +29212,11 @@ var DataTableFilter2 = ({
|
|
|
29031
29212
|
}),
|
|
29032
29213
|
[removeAllFilters, removeFilter]
|
|
29033
29214
|
),
|
|
29034
|
-
children: /* @__PURE__ */
|
|
29215
|
+
children: /* @__PURE__ */ jsxs70("div", { className: "max-w-2/3 flex flex-wrap items-center gap-2", children: [
|
|
29035
29216
|
activeFilters.map((filter) => {
|
|
29036
29217
|
switch (filter.type) {
|
|
29037
29218
|
case "select":
|
|
29038
|
-
return /* @__PURE__ */
|
|
29219
|
+
return /* @__PURE__ */ jsx95(
|
|
29039
29220
|
SelectFilter,
|
|
29040
29221
|
{
|
|
29041
29222
|
filter,
|
|
@@ -29049,7 +29230,7 @@ var DataTableFilter2 = ({
|
|
|
29049
29230
|
filter.key
|
|
29050
29231
|
);
|
|
29051
29232
|
case "date":
|
|
29052
|
-
return /* @__PURE__ */
|
|
29233
|
+
return /* @__PURE__ */ jsx95(
|
|
29053
29234
|
DateFilter,
|
|
29054
29235
|
{
|
|
29055
29236
|
filter,
|
|
@@ -29060,7 +29241,7 @@ var DataTableFilter2 = ({
|
|
|
29060
29241
|
filter.key
|
|
29061
29242
|
);
|
|
29062
29243
|
case "string":
|
|
29063
|
-
return /* @__PURE__ */
|
|
29244
|
+
return /* @__PURE__ */ jsx95(
|
|
29064
29245
|
StringFilter,
|
|
29065
29246
|
{
|
|
29066
29247
|
filter,
|
|
@@ -29071,7 +29252,7 @@ var DataTableFilter2 = ({
|
|
|
29071
29252
|
filter.key
|
|
29072
29253
|
);
|
|
29073
29254
|
case "number":
|
|
29074
|
-
return /* @__PURE__ */
|
|
29255
|
+
return /* @__PURE__ */ jsx95(
|
|
29075
29256
|
NumberFilter,
|
|
29076
29257
|
{
|
|
29077
29258
|
filter,
|
|
@@ -29085,9 +29266,9 @@ var DataTableFilter2 = ({
|
|
|
29085
29266
|
break;
|
|
29086
29267
|
}
|
|
29087
29268
|
}),
|
|
29088
|
-
!readonly && availableFilters.length > 0 && /* @__PURE__ */
|
|
29089
|
-
/* @__PURE__ */
|
|
29090
|
-
/* @__PURE__ */
|
|
29269
|
+
!readonly && availableFilters.length > 0 && /* @__PURE__ */ jsxs70(RadixPopover8.Root, { modal: true, open, onOpenChange: setOpen, children: [
|
|
29270
|
+
/* @__PURE__ */ jsx95(RadixPopover8.Trigger, { asChild: true, id: "filters_menu_trigger", children: /* @__PURE__ */ jsx95(Button14, { size: "small", variant: "secondary", children: t2("filters.addFilter") }) }),
|
|
29271
|
+
/* @__PURE__ */ jsx95(RadixPopover8.Portal, { children: /* @__PURE__ */ jsx95(
|
|
29091
29272
|
RadixPopover8.Content,
|
|
29092
29273
|
{
|
|
29093
29274
|
className: clx49(
|
|
@@ -29108,7 +29289,7 @@ var DataTableFilter2 = ({
|
|
|
29108
29289
|
children: availableFilters.map((filter) => {
|
|
29109
29290
|
return (
|
|
29110
29291
|
// oxlint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
29111
|
-
/* @__PURE__ */
|
|
29292
|
+
/* @__PURE__ */ jsx95(
|
|
29112
29293
|
"div",
|
|
29113
29294
|
{
|
|
29114
29295
|
tabIndex: 0,
|
|
@@ -29126,7 +29307,7 @@ var DataTableFilter2 = ({
|
|
|
29126
29307
|
}
|
|
29127
29308
|
) })
|
|
29128
29309
|
] }),
|
|
29129
|
-
!readonly && activeFilters.length > 0 && /* @__PURE__ */
|
|
29310
|
+
!readonly && activeFilters.length > 0 && /* @__PURE__ */ jsx95(ClearAllFilters, { filters, prefix })
|
|
29130
29311
|
] })
|
|
29131
29312
|
}
|
|
29132
29313
|
);
|
|
@@ -29144,7 +29325,7 @@ var ClearAllFilters = ({ filters, prefix }) => {
|
|
|
29144
29325
|
});
|
|
29145
29326
|
removeAllFilters();
|
|
29146
29327
|
};
|
|
29147
|
-
return /* @__PURE__ */
|
|
29328
|
+
return /* @__PURE__ */ jsx95(
|
|
29148
29329
|
"button",
|
|
29149
29330
|
{
|
|
29150
29331
|
type: "button",
|
|
@@ -29188,9 +29369,9 @@ var getInitialFilters = ({
|
|
|
29188
29369
|
import { DescendingSorting } from "@medusajs/icons";
|
|
29189
29370
|
import { DropdownMenu as DropdownMenu7, IconButton as IconButton11 } from "@medusajs/ui";
|
|
29190
29371
|
import { useState as useState38 } from "react";
|
|
29191
|
-
import { useTranslation as
|
|
29372
|
+
import { useTranslation as useTranslation45 } from "react-i18next";
|
|
29192
29373
|
import { useSearchParams as useSearchParams8 } from "react-router-dom";
|
|
29193
|
-
import { jsx as
|
|
29374
|
+
import { jsx as jsx96, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
29194
29375
|
var initState2 = (params, prefix) => {
|
|
29195
29376
|
const param = prefix ? `${prefix}_order` : "order";
|
|
29196
29377
|
const sortParam = params.get(param);
|
|
@@ -29213,7 +29394,7 @@ var DataTableOrderBy = ({
|
|
|
29213
29394
|
const [searchParams, setSearchParams] = useSearchParams8();
|
|
29214
29395
|
const [state, setState] = useState38(initState2(searchParams, prefix));
|
|
29215
29396
|
const param = prefix ? `${prefix}_order` : "order";
|
|
29216
|
-
const { t: t2 } =
|
|
29397
|
+
const { t: t2 } = useTranslation45();
|
|
29217
29398
|
const direction = useDocumentDirection();
|
|
29218
29399
|
const handleDirChange = (dir) => {
|
|
29219
29400
|
setState((prev) => ({
|
|
@@ -29249,17 +29430,17 @@ var DataTableOrderBy = ({
|
|
|
29249
29430
|
return prev;
|
|
29250
29431
|
});
|
|
29251
29432
|
};
|
|
29252
|
-
return /* @__PURE__ */
|
|
29253
|
-
/* @__PURE__ */
|
|
29254
|
-
/* @__PURE__ */
|
|
29255
|
-
/* @__PURE__ */
|
|
29433
|
+
return /* @__PURE__ */ jsxs71(DropdownMenu7, { dir: direction, children: [
|
|
29434
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Trigger, { asChild: true, children: /* @__PURE__ */ jsx96(IconButton11, { size: "small", children: /* @__PURE__ */ jsx96(DescendingSorting, {}) }) }),
|
|
29435
|
+
/* @__PURE__ */ jsxs71(DropdownMenu7.Content, { className: "z-[1]", align: "end", children: [
|
|
29436
|
+
/* @__PURE__ */ jsx96(
|
|
29256
29437
|
DropdownMenu7.RadioGroup,
|
|
29257
29438
|
{
|
|
29258
29439
|
value: state.key,
|
|
29259
29440
|
onValueChange: handleKeyChange,
|
|
29260
29441
|
children: keys.map((key) => {
|
|
29261
29442
|
const stringKey = String(key.key);
|
|
29262
|
-
return /* @__PURE__ */
|
|
29443
|
+
return /* @__PURE__ */ jsx96(
|
|
29263
29444
|
DropdownMenu7.RadioItem,
|
|
29264
29445
|
{
|
|
29265
29446
|
value: stringKey,
|
|
@@ -29271,14 +29452,14 @@ var DataTableOrderBy = ({
|
|
|
29271
29452
|
})
|
|
29272
29453
|
}
|
|
29273
29454
|
),
|
|
29274
|
-
/* @__PURE__ */
|
|
29275
|
-
/* @__PURE__ */
|
|
29455
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Separator, {}),
|
|
29456
|
+
/* @__PURE__ */ jsxs71(
|
|
29276
29457
|
DropdownMenu7.RadioGroup,
|
|
29277
29458
|
{
|
|
29278
29459
|
value: state.dir,
|
|
29279
29460
|
onValueChange: handleDirChange,
|
|
29280
29461
|
children: [
|
|
29281
|
-
/* @__PURE__ */
|
|
29462
|
+
/* @__PURE__ */ jsxs71(
|
|
29282
29463
|
DropdownMenu7.RadioItem,
|
|
29283
29464
|
{
|
|
29284
29465
|
className: "flex items-center justify-between",
|
|
@@ -29286,11 +29467,11 @@ var DataTableOrderBy = ({
|
|
|
29286
29467
|
onSelect: (event) => event.preventDefault(),
|
|
29287
29468
|
children: [
|
|
29288
29469
|
t2("general.ascending"),
|
|
29289
|
-
/* @__PURE__ */
|
|
29470
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Label, { children: "1 - 30" })
|
|
29290
29471
|
]
|
|
29291
29472
|
}
|
|
29292
29473
|
),
|
|
29293
|
-
/* @__PURE__ */
|
|
29474
|
+
/* @__PURE__ */ jsxs71(
|
|
29294
29475
|
DropdownMenu7.RadioItem,
|
|
29295
29476
|
{
|
|
29296
29477
|
className: "flex items-center justify-between",
|
|
@@ -29298,7 +29479,7 @@ var DataTableOrderBy = ({
|
|
|
29298
29479
|
onSelect: (event) => event.preventDefault(),
|
|
29299
29480
|
children: [
|
|
29300
29481
|
t2("general.descending"),
|
|
29301
|
-
/* @__PURE__ */
|
|
29482
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Label, { children: "30 - 1" })
|
|
29302
29483
|
]
|
|
29303
29484
|
}
|
|
29304
29485
|
)
|
|
@@ -29312,15 +29493,15 @@ var DataTableOrderBy = ({
|
|
|
29312
29493
|
// src/components/table/data-table/data-table-search/data-table-search.tsx
|
|
29313
29494
|
import { Input as Input13 } from "@medusajs/ui";
|
|
29314
29495
|
import { useCallback as useCallback28, useEffect as useEffect24 } from "react";
|
|
29315
|
-
import { useTranslation as
|
|
29496
|
+
import { useTranslation as useTranslation46 } from "react-i18next";
|
|
29316
29497
|
import debounce4 from "lodash.debounce";
|
|
29317
|
-
import { jsx as
|
|
29498
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
29318
29499
|
var DataTableSearch = ({
|
|
29319
29500
|
placeholder,
|
|
29320
29501
|
prefix,
|
|
29321
29502
|
autofocus: _autofocus
|
|
29322
29503
|
}) => {
|
|
29323
|
-
const { t: t2 } =
|
|
29504
|
+
const { t: t2 } = useTranslation46();
|
|
29324
29505
|
const placeholderText = placeholder || t2("general.search");
|
|
29325
29506
|
const selectedParams = useSelectedParams({
|
|
29326
29507
|
param: "q",
|
|
@@ -29344,7 +29525,7 @@ var DataTableSearch = ({
|
|
|
29344
29525
|
debouncedOnChange.cancel();
|
|
29345
29526
|
};
|
|
29346
29527
|
}, [debouncedOnChange]);
|
|
29347
|
-
return /* @__PURE__ */
|
|
29528
|
+
return /* @__PURE__ */ jsx97(
|
|
29348
29529
|
Input13,
|
|
29349
29530
|
{
|
|
29350
29531
|
autoComplete: "off",
|
|
@@ -29359,24 +29540,24 @@ var DataTableSearch = ({
|
|
|
29359
29540
|
};
|
|
29360
29541
|
|
|
29361
29542
|
// src/components/table/data-table/data-table-query/data-table-query.tsx
|
|
29362
|
-
import { jsx as
|
|
29543
|
+
import { jsx as jsx98, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
29363
29544
|
var DataTableQuery = ({
|
|
29364
29545
|
search,
|
|
29365
29546
|
orderBy,
|
|
29366
29547
|
filters,
|
|
29367
29548
|
prefix
|
|
29368
29549
|
}) => {
|
|
29369
|
-
return (search || orderBy || filters || prefix) && /* @__PURE__ */
|
|
29370
|
-
/* @__PURE__ */
|
|
29371
|
-
/* @__PURE__ */
|
|
29372
|
-
search && /* @__PURE__ */
|
|
29550
|
+
return (search || orderBy || filters || prefix) && /* @__PURE__ */ jsxs72("div", { className: "flex items-start justify-between gap-x-4 px-6 py-4", children: [
|
|
29551
|
+
/* @__PURE__ */ jsx98("div", { className: "w-full max-w-[60%]", children: filters && filters.length > 0 && /* @__PURE__ */ jsx98(DataTableFilter2, { filters, prefix }) }),
|
|
29552
|
+
/* @__PURE__ */ jsxs72("div", { className: "flex shrink-0 items-center gap-x-2", children: [
|
|
29553
|
+
search && /* @__PURE__ */ jsx98(
|
|
29373
29554
|
DataTableSearch,
|
|
29374
29555
|
{
|
|
29375
29556
|
prefix,
|
|
29376
29557
|
autofocus: search === "autofocus"
|
|
29377
29558
|
}
|
|
29378
29559
|
),
|
|
29379
|
-
orderBy && /* @__PURE__ */
|
|
29560
|
+
orderBy && /* @__PURE__ */ jsx98(DataTableOrderBy, { keys: orderBy, prefix })
|
|
29380
29561
|
] })
|
|
29381
29562
|
] });
|
|
29382
29563
|
};
|
|
@@ -29393,9 +29574,9 @@ import {
|
|
|
29393
29574
|
useState as useState39,
|
|
29394
29575
|
useContext as useContext15
|
|
29395
29576
|
} from "react";
|
|
29396
|
-
import { useTranslation as
|
|
29577
|
+
import { useTranslation as useTranslation47 } from "react-i18next";
|
|
29397
29578
|
import { Link as Link8 } from "react-router-dom";
|
|
29398
|
-
import { jsx as
|
|
29579
|
+
import { jsx as jsx99, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
29399
29580
|
var DataTableRoot = ({
|
|
29400
29581
|
table,
|
|
29401
29582
|
columns,
|
|
@@ -29408,7 +29589,7 @@ var DataTableRoot = ({
|
|
|
29408
29589
|
noHeader = false,
|
|
29409
29590
|
layout = "fit"
|
|
29410
29591
|
}) => {
|
|
29411
|
-
const { t: t2 } =
|
|
29592
|
+
const { t: t2 } = useTranslation47();
|
|
29412
29593
|
const [showStickyBorder, setShowStickyBorder] = useState39(false);
|
|
29413
29594
|
const scrollableRef = useRef19(null);
|
|
29414
29595
|
const hasSelect = columns.find((c) => c.id === "select");
|
|
@@ -29435,14 +29616,14 @@ var DataTableRoot = ({
|
|
|
29435
29616
|
useEffect25(() => {
|
|
29436
29617
|
scrollableRef.current?.scroll({ top: 0, left: 0 });
|
|
29437
29618
|
}, [pageIndex]);
|
|
29438
|
-
return /* @__PURE__ */
|
|
29619
|
+
return /* @__PURE__ */ jsxs73(
|
|
29439
29620
|
"div",
|
|
29440
29621
|
{
|
|
29441
29622
|
className: clx50("flex w-full flex-col overflow-hidden", {
|
|
29442
29623
|
"flex flex-1 flex-col": layout === "fill"
|
|
29443
29624
|
}),
|
|
29444
29625
|
children: [
|
|
29445
|
-
/* @__PURE__ */
|
|
29626
|
+
/* @__PURE__ */ jsx99(
|
|
29446
29627
|
"div",
|
|
29447
29628
|
{
|
|
29448
29629
|
ref: scrollableRef,
|
|
@@ -29451,9 +29632,9 @@ var DataTableRoot = ({
|
|
|
29451
29632
|
"min-h-0 flex-grow overflow-auto": layout === "fill",
|
|
29452
29633
|
"overflow-x-auto": layout === "fit"
|
|
29453
29634
|
}),
|
|
29454
|
-
children: !noResults ? /* @__PURE__ */
|
|
29455
|
-
!noHeader && /* @__PURE__ */
|
|
29456
|
-
return /* @__PURE__ */
|
|
29635
|
+
children: !noResults ? /* @__PURE__ */ jsxs73(Table2, { className: "relative w-full", children: [
|
|
29636
|
+
!noHeader && /* @__PURE__ */ jsx99(Table2.Header, { className: "border-t-0", children: table.getHeaderGroups().map((headerGroup) => {
|
|
29637
|
+
return /* @__PURE__ */ jsx99(
|
|
29457
29638
|
Table2.Row,
|
|
29458
29639
|
{
|
|
29459
29640
|
className: clx50({
|
|
@@ -29469,7 +29650,7 @@ var DataTableRoot = ({
|
|
|
29469
29650
|
);
|
|
29470
29651
|
const isFirstHeader = firstHeader !== -1 ? header.id === headerGroup.headers[firstHeader].id : index === 0;
|
|
29471
29652
|
const isStickyHeader = isSelectHeader || isFirstHeader;
|
|
29472
|
-
return /* @__PURE__ */
|
|
29653
|
+
return /* @__PURE__ */ jsx99(
|
|
29473
29654
|
Table2.HeaderCell,
|
|
29474
29655
|
{
|
|
29475
29656
|
"data-table-header-id": header.id,
|
|
@@ -29493,12 +29674,12 @@ var DataTableRoot = ({
|
|
|
29493
29674
|
headerGroup.id
|
|
29494
29675
|
);
|
|
29495
29676
|
}) }),
|
|
29496
|
-
/* @__PURE__ */
|
|
29677
|
+
/* @__PURE__ */ jsx99(Table2.Body, { className: "border-b-0", children: table.getRowModel().rows.map((row) => {
|
|
29497
29678
|
const to = navigateTo ? navigateTo(row) : void 0;
|
|
29498
29679
|
const isRowDisabled = hasSelect && !row.getCanSelect();
|
|
29499
29680
|
const isOdd = row.depth % 2 !== 0;
|
|
29500
29681
|
const cells = row.getVisibleCells();
|
|
29501
|
-
return /* @__PURE__ */
|
|
29682
|
+
return /* @__PURE__ */ jsx99(
|
|
29502
29683
|
Table2.Row,
|
|
29503
29684
|
{
|
|
29504
29685
|
"data-selected": row.getIsSelected(),
|
|
@@ -29528,7 +29709,7 @@ var DataTableRoot = ({
|
|
|
29528
29709
|
);
|
|
29529
29710
|
const isTabableLink = isFirstCell && !!to;
|
|
29530
29711
|
const shouldRenderAsLink = !!to && !isSelectCell;
|
|
29531
|
-
return /* @__PURE__ */
|
|
29712
|
+
return /* @__PURE__ */ jsx99(
|
|
29532
29713
|
Table2.Cell,
|
|
29533
29714
|
{
|
|
29534
29715
|
className: clx50({
|
|
@@ -29542,14 +29723,14 @@ var DataTableRoot = ({
|
|
|
29542
29723
|
style: {
|
|
29543
29724
|
paddingLeft: depthOffset ? `${depthOffset}px` : void 0
|
|
29544
29725
|
},
|
|
29545
|
-
children: shouldRenderAsLink ? /* @__PURE__ */
|
|
29726
|
+
children: shouldRenderAsLink ? /* @__PURE__ */ jsx99(
|
|
29546
29727
|
Link8,
|
|
29547
29728
|
{
|
|
29548
29729
|
to,
|
|
29549
29730
|
className: "size-full outline-none",
|
|
29550
29731
|
"data-row-link": true,
|
|
29551
29732
|
tabIndex: isTabableLink ? 0 : -1,
|
|
29552
|
-
children: /* @__PURE__ */
|
|
29733
|
+
children: /* @__PURE__ */ jsx99(
|
|
29553
29734
|
"div",
|
|
29554
29735
|
{
|
|
29555
29736
|
className: clx50(
|
|
@@ -29571,10 +29752,10 @@ var DataTableRoot = ({
|
|
|
29571
29752
|
row.id
|
|
29572
29753
|
);
|
|
29573
29754
|
}) })
|
|
29574
|
-
] }) : /* @__PURE__ */
|
|
29755
|
+
] }) : /* @__PURE__ */ jsx99("div", { className: clx50({ "border-b": layout === "fit" }), children: /* @__PURE__ */ jsx99(NoResults, { ...noResultsProps }) })
|
|
29575
29756
|
}
|
|
29576
29757
|
),
|
|
29577
|
-
pagination && /* @__PURE__ */
|
|
29758
|
+
pagination && /* @__PURE__ */ jsx99("div", { className: clx50({ "border-t": layout === "fill" }), children: /* @__PURE__ */ jsx99(
|
|
29578
29759
|
Pagination,
|
|
29579
29760
|
{
|
|
29580
29761
|
canNextPage: table.getCanNextPage(),
|
|
@@ -29587,14 +29768,14 @@ var DataTableRoot = ({
|
|
|
29587
29768
|
pageSize
|
|
29588
29769
|
}
|
|
29589
29770
|
) }),
|
|
29590
|
-
hasCommandBar && /* @__PURE__ */
|
|
29591
|
-
/* @__PURE__ */
|
|
29771
|
+
hasCommandBar && /* @__PURE__ */ jsx99(CommandBar, { open: !!Object.keys(rowSelection).length, children: /* @__PURE__ */ jsxs73(CommandBar.Bar, { children: [
|
|
29772
|
+
/* @__PURE__ */ jsx99(CommandBar.Value, { children: t2("general.countSelected", {
|
|
29592
29773
|
count: Object.keys(rowSelection).length
|
|
29593
29774
|
}) }),
|
|
29594
|
-
/* @__PURE__ */
|
|
29775
|
+
/* @__PURE__ */ jsx99(CommandBar.Seperator, {}),
|
|
29595
29776
|
commands?.map((command, index) => {
|
|
29596
|
-
return /* @__PURE__ */
|
|
29597
|
-
/* @__PURE__ */
|
|
29777
|
+
return /* @__PURE__ */ jsxs73(Fragment12, { children: [
|
|
29778
|
+
/* @__PURE__ */ jsx99(
|
|
29598
29779
|
CommandBar.Command,
|
|
29599
29780
|
{
|
|
29600
29781
|
label: command.label,
|
|
@@ -29607,7 +29788,7 @@ var DataTableRoot = ({
|
|
|
29607
29788
|
)
|
|
29608
29789
|
}
|
|
29609
29790
|
),
|
|
29610
|
-
index < commands.length - 1 && /* @__PURE__ */
|
|
29791
|
+
index < commands.length - 1 && /* @__PURE__ */ jsx99(CommandBar.Seperator, {})
|
|
29611
29792
|
] }, index);
|
|
29612
29793
|
})
|
|
29613
29794
|
] }) })
|
|
@@ -29616,7 +29797,7 @@ var DataTableRoot = ({
|
|
|
29616
29797
|
);
|
|
29617
29798
|
};
|
|
29618
29799
|
var Pagination = (props) => {
|
|
29619
|
-
const { t: t2 } =
|
|
29800
|
+
const { t: t2 } = useTranslation47();
|
|
29620
29801
|
const translations = {
|
|
29621
29802
|
of: t2("general.of"),
|
|
29622
29803
|
results: t2("general.results"),
|
|
@@ -29624,7 +29805,7 @@ var Pagination = (props) => {
|
|
|
29624
29805
|
prev: t2("general.prev"),
|
|
29625
29806
|
next: t2("general.next")
|
|
29626
29807
|
};
|
|
29627
|
-
return /* @__PURE__ */
|
|
29808
|
+
return /* @__PURE__ */ jsx99(
|
|
29628
29809
|
Table2.Pagination,
|
|
29629
29810
|
{
|
|
29630
29811
|
className: "flex-shrink-0",
|
|
@@ -29635,7 +29816,7 @@ var Pagination = (props) => {
|
|
|
29635
29816
|
};
|
|
29636
29817
|
|
|
29637
29818
|
// src/components/table/data-table/data-table.tsx
|
|
29638
|
-
import { jsx as
|
|
29819
|
+
import { jsx as jsx100, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
29639
29820
|
var MemoizedDataTableQuery = memo(DataTableQuery);
|
|
29640
29821
|
var _DataTable = ({
|
|
29641
29822
|
table,
|
|
@@ -29657,7 +29838,7 @@ var _DataTable = ({
|
|
|
29657
29838
|
noResults: noResultsProps = {}
|
|
29658
29839
|
}) => {
|
|
29659
29840
|
if (isLoading) {
|
|
29660
|
-
return /* @__PURE__ */
|
|
29841
|
+
return /* @__PURE__ */ jsx100(
|
|
29661
29842
|
TableSkeleton,
|
|
29662
29843
|
{
|
|
29663
29844
|
layout,
|
|
@@ -29673,7 +29854,7 @@ var _DataTable = ({
|
|
|
29673
29854
|
const showNoResults = !isLoading && count === 0 && !noQuery;
|
|
29674
29855
|
const noRecords = !isLoading && count === 0 && noQuery;
|
|
29675
29856
|
if (noRecords) {
|
|
29676
|
-
return /* @__PURE__ */
|
|
29857
|
+
return /* @__PURE__ */ jsx100(
|
|
29677
29858
|
NoRecords,
|
|
29678
29859
|
{
|
|
29679
29860
|
className: clx51({
|
|
@@ -29683,14 +29864,14 @@ var _DataTable = ({
|
|
|
29683
29864
|
}
|
|
29684
29865
|
);
|
|
29685
29866
|
}
|
|
29686
|
-
return /* @__PURE__ */
|
|
29867
|
+
return /* @__PURE__ */ jsxs74(
|
|
29687
29868
|
"div",
|
|
29688
29869
|
{
|
|
29689
29870
|
className: clx51("divide-y", {
|
|
29690
29871
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
29691
29872
|
}),
|
|
29692
29873
|
children: [
|
|
29693
|
-
/* @__PURE__ */
|
|
29874
|
+
/* @__PURE__ */ jsx100(
|
|
29694
29875
|
MemoizedDataTableQuery,
|
|
29695
29876
|
{
|
|
29696
29877
|
search,
|
|
@@ -29699,7 +29880,7 @@ var _DataTable = ({
|
|
|
29699
29880
|
prefix
|
|
29700
29881
|
}
|
|
29701
29882
|
),
|
|
29702
|
-
/* @__PURE__ */
|
|
29883
|
+
/* @__PURE__ */ jsx100(
|
|
29703
29884
|
DataTableRoot,
|
|
29704
29885
|
{
|
|
29705
29886
|
table,
|
|
@@ -29721,91 +29902,91 @@ var _DataTable = ({
|
|
|
29721
29902
|
|
|
29722
29903
|
// src/components/table/table-cells/common/code-cell/code-cell.tsx
|
|
29723
29904
|
import { Badge as Badge8 } from "@medusajs/ui";
|
|
29724
|
-
import { jsx as
|
|
29905
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
29725
29906
|
var CodeCell = ({ code }) => {
|
|
29726
|
-
return /* @__PURE__ */
|
|
29907
|
+
return /* @__PURE__ */ jsx101("div", { className: "flex h-full w-full items-center gap-x-3 overflow-hidden", children: /* @__PURE__ */ jsx101(Badge8, { size: "2xsmall", className: "truncate", children: code }) });
|
|
29727
29908
|
};
|
|
29728
29909
|
var CodeHeader = ({ text }) => {
|
|
29729
|
-
return /* @__PURE__ */
|
|
29910
|
+
return /* @__PURE__ */ jsx101("div", { className: " flex h-full w-full items-center ", children: /* @__PURE__ */ jsx101("span", { children: text }) });
|
|
29730
29911
|
};
|
|
29731
29912
|
|
|
29732
29913
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
29733
29914
|
import { Tooltip as Tooltip13 } from "@medusajs/ui";
|
|
29734
|
-
import { useTranslation as
|
|
29915
|
+
import { useTranslation as useTranslation48 } from "react-i18next";
|
|
29735
29916
|
|
|
29736
29917
|
// src/components/table/table-cells/common/placeholder-cell/placeholder-cell.tsx
|
|
29737
|
-
import { jsx as
|
|
29918
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
29738
29919
|
var PlaceholderCell = () => {
|
|
29739
|
-
return /* @__PURE__ */
|
|
29920
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx102("span", { className: "text-ui-fg-muted", children: "-" }) });
|
|
29740
29921
|
};
|
|
29741
29922
|
|
|
29742
29923
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
29743
|
-
import { jsx as
|
|
29924
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
29744
29925
|
var CreatedAtCell = ({ date }) => {
|
|
29745
29926
|
const { getFullDate } = useDate();
|
|
29746
29927
|
if (!date) {
|
|
29747
|
-
return /* @__PURE__ */
|
|
29928
|
+
return /* @__PURE__ */ jsx103(PlaceholderCell, {});
|
|
29748
29929
|
}
|
|
29749
|
-
return /* @__PURE__ */
|
|
29930
|
+
return /* @__PURE__ */ jsx103("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx103(
|
|
29750
29931
|
Tooltip13,
|
|
29751
29932
|
{
|
|
29752
29933
|
className: "z-10",
|
|
29753
|
-
content: /* @__PURE__ */
|
|
29934
|
+
content: /* @__PURE__ */ jsx103("span", { className: "text-pretty", children: `${getFullDate({
|
|
29754
29935
|
date,
|
|
29755
29936
|
includeTime: true
|
|
29756
29937
|
})}` }),
|
|
29757
|
-
children: /* @__PURE__ */
|
|
29938
|
+
children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: getFullDate({ date, includeTime: true }) })
|
|
29758
29939
|
}
|
|
29759
29940
|
) });
|
|
29760
29941
|
};
|
|
29761
29942
|
var CreatedAtHeader = () => {
|
|
29762
|
-
const { t: t2 } =
|
|
29763
|
-
return /* @__PURE__ */
|
|
29943
|
+
const { t: t2 } = useTranslation48();
|
|
29944
|
+
return /* @__PURE__ */ jsx103("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: t2("fields.createdAt") }) });
|
|
29764
29945
|
};
|
|
29765
29946
|
|
|
29766
29947
|
// src/components/table/table-cells/common/date-cell/date-cell.tsx
|
|
29767
29948
|
import { Tooltip as Tooltip14 } from "@medusajs/ui";
|
|
29768
|
-
import { useTranslation as
|
|
29769
|
-
import { jsx as
|
|
29949
|
+
import { useTranslation as useTranslation49 } from "react-i18next";
|
|
29950
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
29770
29951
|
var DateCell = ({ date }) => {
|
|
29771
29952
|
const { getFullDate } = useDate();
|
|
29772
29953
|
if (!date) {
|
|
29773
|
-
return /* @__PURE__ */
|
|
29954
|
+
return /* @__PURE__ */ jsx104(PlaceholderCell, {});
|
|
29774
29955
|
}
|
|
29775
|
-
return /* @__PURE__ */
|
|
29956
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx104(
|
|
29776
29957
|
Tooltip14,
|
|
29777
29958
|
{
|
|
29778
29959
|
className: "z-10",
|
|
29779
|
-
content: /* @__PURE__ */
|
|
29960
|
+
content: /* @__PURE__ */ jsx104("span", { className: "text-pretty", children: `${getFullDate({
|
|
29780
29961
|
date,
|
|
29781
29962
|
includeTime: true
|
|
29782
29963
|
})}` }),
|
|
29783
|
-
children: /* @__PURE__ */
|
|
29964
|
+
children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: getFullDate({ date, includeTime: false }) })
|
|
29784
29965
|
}
|
|
29785
29966
|
) });
|
|
29786
29967
|
};
|
|
29787
29968
|
var DateHeader = () => {
|
|
29788
|
-
const { t: t2 } =
|
|
29789
|
-
return /* @__PURE__ */
|
|
29969
|
+
const { t: t2 } = useTranslation49();
|
|
29970
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: t2("fields.date") }) });
|
|
29790
29971
|
};
|
|
29791
29972
|
|
|
29792
29973
|
// src/components/table/table-cells/common/email-cell/email-cell.tsx
|
|
29793
|
-
import { useTranslation as
|
|
29794
|
-
import { jsx as
|
|
29974
|
+
import { useTranslation as useTranslation50 } from "react-i18next";
|
|
29975
|
+
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
29795
29976
|
var EmailCell = ({ email }) => {
|
|
29796
29977
|
if (!email) {
|
|
29797
|
-
return /* @__PURE__ */
|
|
29978
|
+
return /* @__PURE__ */ jsx105(PlaceholderCell, {});
|
|
29798
29979
|
}
|
|
29799
|
-
return /* @__PURE__ */
|
|
29980
|
+
return /* @__PURE__ */ jsx105("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx105("span", { className: "truncate", children: email }) });
|
|
29800
29981
|
};
|
|
29801
29982
|
var EmailHeader = () => {
|
|
29802
|
-
const { t: t2 } =
|
|
29803
|
-
return /* @__PURE__ */
|
|
29983
|
+
const { t: t2 } = useTranslation50();
|
|
29984
|
+
return /* @__PURE__ */ jsx105("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx105("span", { className: "truncate", children: t2("fields.email") }) });
|
|
29804
29985
|
};
|
|
29805
29986
|
|
|
29806
29987
|
// src/components/table/table-cells/common/money-amount-cell/money-amount-cell.tsx
|
|
29807
29988
|
import { clx as clx52 } from "@medusajs/ui";
|
|
29808
|
-
import { jsx as
|
|
29989
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
29809
29990
|
var MoneyAmountCell = ({
|
|
29810
29991
|
currencyCode,
|
|
29811
29992
|
amount,
|
|
@@ -29813,10 +29994,10 @@ var MoneyAmountCell = ({
|
|
|
29813
29994
|
className
|
|
29814
29995
|
}) => {
|
|
29815
29996
|
if (typeof amount === "undefined" || amount === null) {
|
|
29816
|
-
return /* @__PURE__ */
|
|
29997
|
+
return /* @__PURE__ */ jsx106(PlaceholderCell, {});
|
|
29817
29998
|
}
|
|
29818
29999
|
const formatted = getStylizedAmount(amount, currencyCode);
|
|
29819
|
-
return /* @__PURE__ */
|
|
30000
|
+
return /* @__PURE__ */ jsx106(
|
|
29820
30001
|
"div",
|
|
29821
30002
|
{
|
|
29822
30003
|
className: clx52(
|
|
@@ -29827,37 +30008,37 @@ var MoneyAmountCell = ({
|
|
|
29827
30008
|
},
|
|
29828
30009
|
className
|
|
29829
30010
|
),
|
|
29830
|
-
children: /* @__PURE__ */
|
|
30011
|
+
children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: formatted })
|
|
29831
30012
|
}
|
|
29832
30013
|
);
|
|
29833
30014
|
};
|
|
29834
30015
|
|
|
29835
30016
|
// src/components/table/table-cells/common/name-cell/name-cell.tsx
|
|
29836
|
-
import { useTranslation as
|
|
29837
|
-
import { jsx as
|
|
30017
|
+
import { useTranslation as useTranslation51 } from "react-i18next";
|
|
30018
|
+
import { jsx as jsx107 } from "react/jsx-runtime";
|
|
29838
30019
|
var NameCell = ({ firstName, lastName }) => {
|
|
29839
30020
|
if (!firstName && !lastName) {
|
|
29840
|
-
return /* @__PURE__ */
|
|
30021
|
+
return /* @__PURE__ */ jsx107(PlaceholderCell, {});
|
|
29841
30022
|
}
|
|
29842
30023
|
const name = [firstName, lastName].filter(Boolean).join(" ");
|
|
29843
|
-
return /* @__PURE__ */
|
|
30024
|
+
return /* @__PURE__ */ jsx107("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx107("span", { className: "truncate", children: name }) });
|
|
29844
30025
|
};
|
|
29845
30026
|
var NameHeader = () => {
|
|
29846
|
-
const { t: t2 } =
|
|
29847
|
-
return /* @__PURE__ */
|
|
30027
|
+
const { t: t2 } = useTranslation51();
|
|
30028
|
+
return /* @__PURE__ */ jsx107("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx107("span", { className: "truncate", children: t2("fields.name") }) });
|
|
29848
30029
|
};
|
|
29849
30030
|
|
|
29850
30031
|
// src/components/table/table-cells/common/status-cell/status-cell.tsx
|
|
29851
30032
|
import { clx as clx53 } from "@medusajs/ui";
|
|
29852
|
-
import { jsx as
|
|
30033
|
+
import { jsx as jsx108, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
29853
30034
|
var StatusCell = ({ color, children }) => {
|
|
29854
|
-
return /* @__PURE__ */
|
|
29855
|
-
/* @__PURE__ */
|
|
30035
|
+
return /* @__PURE__ */ jsxs75("div", { className: "txt-compact-small text-ui-fg-subtle flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
|
|
30036
|
+
/* @__PURE__ */ jsx108(
|
|
29856
30037
|
"div",
|
|
29857
30038
|
{
|
|
29858
30039
|
role: "presentation",
|
|
29859
30040
|
className: "flex h-5 w-2 items-center justify-center",
|
|
29860
|
-
children: /* @__PURE__ */
|
|
30041
|
+
children: /* @__PURE__ */ jsx108(
|
|
29861
30042
|
"div",
|
|
29862
30043
|
{
|
|
29863
30044
|
className: clx53(
|
|
@@ -29875,19 +30056,19 @@ var StatusCell = ({ color, children }) => {
|
|
|
29875
30056
|
)
|
|
29876
30057
|
}
|
|
29877
30058
|
),
|
|
29878
|
-
/* @__PURE__ */
|
|
30059
|
+
/* @__PURE__ */ jsx108("span", { className: "truncate", children })
|
|
29879
30060
|
] });
|
|
29880
30061
|
};
|
|
29881
30062
|
|
|
29882
30063
|
// src/components/table/table-cells/common/text-cell/text-cell.tsx
|
|
29883
30064
|
import { clx as clx54 } from "@medusajs/ui";
|
|
29884
|
-
import { jsx as
|
|
30065
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
29885
30066
|
var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
29886
30067
|
if (!text) {
|
|
29887
|
-
return /* @__PURE__ */
|
|
30068
|
+
return /* @__PURE__ */ jsx109(PlaceholderCell, {});
|
|
29888
30069
|
}
|
|
29889
30070
|
const stringLength = text.toString().length;
|
|
29890
|
-
return /* @__PURE__ */
|
|
30071
|
+
return /* @__PURE__ */ jsx109(ConditionalTooltip, { content: text, showTooltip: stringLength > 20, children: /* @__PURE__ */ jsx109(
|
|
29891
30072
|
"div",
|
|
29892
30073
|
{
|
|
29893
30074
|
className: clx54("flex h-full w-full items-center gap-x-3 overflow-hidden", {
|
|
@@ -29898,22 +30079,22 @@ var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
|
29898
30079
|
style: {
|
|
29899
30080
|
maxWidth
|
|
29900
30081
|
},
|
|
29901
|
-
children: /* @__PURE__ */
|
|
30082
|
+
children: /* @__PURE__ */ jsx109("span", { className: "truncate", children: text })
|
|
29902
30083
|
}
|
|
29903
30084
|
) });
|
|
29904
30085
|
};
|
|
29905
30086
|
var TextHeader = ({ text, align = "left" }) => {
|
|
29906
|
-
return /* @__PURE__ */
|
|
30087
|
+
return /* @__PURE__ */ jsx109("div", { className: clx54("flex h-full w-full items-center", {
|
|
29907
30088
|
"justify-start text-start": align === "left",
|
|
29908
30089
|
"justify-center text-center": align === "center",
|
|
29909
30090
|
"justify-end text-end": align === "right"
|
|
29910
|
-
}), children: /* @__PURE__ */
|
|
30091
|
+
}), children: /* @__PURE__ */ jsx109("span", { className: "truncate", children: text }) });
|
|
29911
30092
|
};
|
|
29912
30093
|
|
|
29913
30094
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29914
30095
|
import { ExclamationCircle as ExclamationCircle4 } from "@medusajs/icons";
|
|
29915
30096
|
import { Text as Text22 } from "@medusajs/ui";
|
|
29916
|
-
import { useTranslation as
|
|
30097
|
+
import { useTranslation as useTranslation52 } from "react-i18next";
|
|
29917
30098
|
import { Navigate, useLocation as useLocation3, useRouteError } from "react-router-dom";
|
|
29918
30099
|
|
|
29919
30100
|
// src/lib/is-fetch-error.ts
|
|
@@ -29923,15 +30104,15 @@ var isClientError = (error) => {
|
|
|
29923
30104
|
};
|
|
29924
30105
|
|
|
29925
30106
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29926
|
-
import { jsx as
|
|
30107
|
+
import { jsx as jsx110, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
29927
30108
|
var ErrorBoundary = () => {
|
|
29928
30109
|
const error = useRouteError();
|
|
29929
30110
|
const location = useLocation3();
|
|
29930
|
-
const { t: t2 } =
|
|
30111
|
+
const { t: t2 } = useTranslation52();
|
|
29931
30112
|
let code = null;
|
|
29932
30113
|
if (isClientError(error)) {
|
|
29933
30114
|
if (error.status === 401) {
|
|
29934
|
-
return /* @__PURE__ */
|
|
30115
|
+
return /* @__PURE__ */ jsx110(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
29935
30116
|
}
|
|
29936
30117
|
code = error.status ?? null;
|
|
29937
30118
|
}
|
|
@@ -29958,11 +30139,11 @@ var ErrorBoundary = () => {
|
|
|
29958
30139
|
message = t2("errorBoundary.defaultMessage");
|
|
29959
30140
|
break;
|
|
29960
30141
|
}
|
|
29961
|
-
return /* @__PURE__ */
|
|
29962
|
-
/* @__PURE__ */
|
|
29963
|
-
/* @__PURE__ */
|
|
29964
|
-
/* @__PURE__ */
|
|
29965
|
-
/* @__PURE__ */
|
|
30142
|
+
return /* @__PURE__ */ jsx110("div", { className: "flex size-full min-h-[calc(100vh-57px-24px)] items-center justify-center", children: /* @__PURE__ */ jsx110("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxs76("div", { className: "text-ui-fg-subtle flex flex-col items-center gap-y-3", children: [
|
|
30143
|
+
/* @__PURE__ */ jsx110(ExclamationCircle4, {}),
|
|
30144
|
+
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
30145
|
+
/* @__PURE__ */ jsx110(Text22, { size: "small", leading: "compact", weight: "plus", children: title }),
|
|
30146
|
+
/* @__PURE__ */ jsx110(
|
|
29966
30147
|
Text22,
|
|
29967
30148
|
{
|
|
29968
30149
|
size: "small",
|
|
@@ -29975,9 +30156,9 @@ var ErrorBoundary = () => {
|
|
|
29975
30156
|
};
|
|
29976
30157
|
|
|
29977
30158
|
// src/components/utilities/visually-hidden/visually-hidden.tsx
|
|
29978
|
-
import { jsx as
|
|
30159
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
29979
30160
|
var VisuallyHidden = ({ children }) => {
|
|
29980
|
-
return /* @__PURE__ */
|
|
30161
|
+
return /* @__PURE__ */ jsx111("span", { className: "sr-only", children });
|
|
29981
30162
|
};
|
|
29982
30163
|
|
|
29983
30164
|
// src/hooks/use-data-table.tsx
|
|
@@ -30073,7 +30254,7 @@ var useDataTable2 = ({
|
|
|
30073
30254
|
|
|
30074
30255
|
// src/permissions/permissions-provider.tsx
|
|
30075
30256
|
import { useCallback as useCallback29, useMemo as useMemo28 } from "react";
|
|
30076
|
-
import { jsx as
|
|
30257
|
+
import { jsx as jsx112 } from "react/jsx-runtime";
|
|
30077
30258
|
var PermissionsProvider = ({
|
|
30078
30259
|
permissions = null,
|
|
30079
30260
|
isLoading = false,
|
|
@@ -30114,7 +30295,7 @@ var PermissionsProvider = ({
|
|
|
30114
30295
|
}),
|
|
30115
30296
|
[permissions, isLoading, isEnforced, hasPermission, hasAnyPermission, hasAllPermissions, can]
|
|
30116
30297
|
);
|
|
30117
|
-
return /* @__PURE__ */
|
|
30298
|
+
return /* @__PURE__ */ jsx112(PermissionsContext.Provider, { value, children });
|
|
30118
30299
|
};
|
|
30119
30300
|
|
|
30120
30301
|
// src/permissions/use-permissions.tsx
|
|
@@ -30128,7 +30309,7 @@ var usePermissions = () => {
|
|
|
30128
30309
|
};
|
|
30129
30310
|
|
|
30130
30311
|
// src/permissions/permission-guard.tsx
|
|
30131
|
-
import { Fragment as Fragment13, jsx as
|
|
30312
|
+
import { Fragment as Fragment13, jsx as jsx113 } from "react/jsx-runtime";
|
|
30132
30313
|
var PermissionGuard = ({
|
|
30133
30314
|
children,
|
|
30134
30315
|
permission,
|
|
@@ -30138,16 +30319,16 @@ var PermissionGuard = ({
|
|
|
30138
30319
|
const { hasAnyPermission, hasAllPermissions } = usePermissions();
|
|
30139
30320
|
const list = Array.isArray(permission) ? permission : [permission];
|
|
30140
30321
|
const allowed = requireAll ? hasAllPermissions(list) : hasAnyPermission(list);
|
|
30141
|
-
return /* @__PURE__ */
|
|
30322
|
+
return /* @__PURE__ */ jsx113(Fragment13, { children: allowed ? children : fallback });
|
|
30142
30323
|
};
|
|
30143
30324
|
|
|
30144
30325
|
// src/permissions/route-permission-guard.tsx
|
|
30145
30326
|
import { ExclamationCircle as ExclamationCircle5 } from "@medusajs/icons";
|
|
30146
|
-
import { Container as
|
|
30327
|
+
import { Container as Container7, Heading as Heading11, Text as Text23 } from "@medusajs/ui";
|
|
30147
30328
|
import { useMemo as useMemo29 } from "react";
|
|
30148
|
-
import { useTranslation as
|
|
30329
|
+
import { useTranslation as useTranslation53 } from "react-i18next";
|
|
30149
30330
|
import { Navigate as Navigate2, Outlet as Outlet3, useMatches } from "react-router-dom";
|
|
30150
|
-
import { jsx as
|
|
30331
|
+
import { jsx as jsx114, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
30151
30332
|
var readRequirementFromHandle = (handle) => {
|
|
30152
30333
|
if (!handle || typeof handle !== "object") {
|
|
30153
30334
|
return void 0;
|
|
@@ -30187,28 +30368,28 @@ var RoutePermissionGuard = () => {
|
|
|
30187
30368
|
return void 0;
|
|
30188
30369
|
}, [matches]);
|
|
30189
30370
|
if (isLoading || !requirement) {
|
|
30190
|
-
return /* @__PURE__ */
|
|
30371
|
+
return /* @__PURE__ */ jsx114(Outlet3, {});
|
|
30191
30372
|
}
|
|
30192
30373
|
const hasAccess = requirement.requireAll ? hasAllPermissions(requirement.permissions) : hasAnyPermission(requirement.permissions);
|
|
30193
30374
|
if (!hasAccess) {
|
|
30194
30375
|
if (requirement.redirectTo) {
|
|
30195
|
-
return /* @__PURE__ */
|
|
30376
|
+
return /* @__PURE__ */ jsx114(Navigate2, { to: requirement.redirectTo, replace: true });
|
|
30196
30377
|
}
|
|
30197
|
-
return /* @__PURE__ */
|
|
30378
|
+
return /* @__PURE__ */ jsx114(AccessDenied, { requirement });
|
|
30198
30379
|
}
|
|
30199
|
-
return /* @__PURE__ */
|
|
30380
|
+
return /* @__PURE__ */ jsx114(Outlet3, {});
|
|
30200
30381
|
};
|
|
30201
30382
|
var AccessDenied = ({
|
|
30202
30383
|
requirement
|
|
30203
30384
|
}) => {
|
|
30204
|
-
const { t: t2 } =
|
|
30205
|
-
return /* @__PURE__ */
|
|
30206
|
-
/* @__PURE__ */
|
|
30207
|
-
/* @__PURE__ */
|
|
30208
|
-
/* @__PURE__ */
|
|
30209
|
-
/* @__PURE__ */
|
|
30385
|
+
const { t: t2 } = useTranslation53();
|
|
30386
|
+
return /* @__PURE__ */ jsx114("div", { className: "bg-ui-bg-subtle absolute bottom-0 left-0 right-0 top-0 flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsx114(Container7, { className: "max-w-md", children: /* @__PURE__ */ jsxs77("div", { className: "flex flex-col items-center gap-y-4 py-8 text-center", children: [
|
|
30387
|
+
/* @__PURE__ */ jsx114("div", { className: "bg-ui-bg-subtle flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx114(ExclamationCircle5, { className: "text-ui-fg-muted" }) }),
|
|
30388
|
+
/* @__PURE__ */ jsxs77("div", { className: "flex flex-col gap-y-1", children: [
|
|
30389
|
+
/* @__PURE__ */ jsx114(Heading11, { level: "h2", children: t2("permissions.accessDenied.title") }),
|
|
30390
|
+
/* @__PURE__ */ jsx114(Text23, { className: "text-ui-fg-subtle", children: t2("permissions.accessDenied.description") })
|
|
30210
30391
|
] }),
|
|
30211
|
-
/* @__PURE__ */
|
|
30392
|
+
/* @__PURE__ */ jsx114(Text23, { size: "small", className: "text-ui-fg-muted", children: t2("permissions.accessDenied.requiredPermission", {
|
|
30212
30393
|
permission: requirement.permissions.join(", ")
|
|
30213
30394
|
}) })
|
|
30214
30395
|
] }) }) });
|
|
@@ -30239,7 +30420,7 @@ import {
|
|
|
30239
30420
|
cloneElement as cloneElement2,
|
|
30240
30421
|
isValidElement
|
|
30241
30422
|
} from "react";
|
|
30242
|
-
import { jsx as
|
|
30423
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
30243
30424
|
var PermissionAction = ({
|
|
30244
30425
|
permission,
|
|
30245
30426
|
requireAll = false,
|
|
@@ -30251,16 +30432,16 @@ var PermissionAction = ({
|
|
|
30251
30432
|
}
|
|
30252
30433
|
const inner = children.props.children;
|
|
30253
30434
|
const label = children.props.asChild && isValidElement(inner) ? inner.props.children : inner;
|
|
30254
|
-
return /* @__PURE__ */
|
|
30435
|
+
return /* @__PURE__ */ jsx115(Tooltip15, { content: gate.tooltip, children: /* @__PURE__ */ jsx115("span", { className: "inline-flex", children: cloneElement2(children, { disabled: true, asChild: false }, label) }) });
|
|
30255
30436
|
};
|
|
30256
30437
|
|
|
30257
30438
|
// src/permissions/section-no-access.tsx
|
|
30258
30439
|
import { Text as Text24 } from "@medusajs/ui";
|
|
30259
|
-
import { useTranslation as
|
|
30260
|
-
import { jsx as
|
|
30440
|
+
import { useTranslation as useTranslation54 } from "react-i18next";
|
|
30441
|
+
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
30261
30442
|
var SectionNoAccess = ({ className }) => {
|
|
30262
|
-
const { t: t2 } =
|
|
30263
|
-
return /* @__PURE__ */
|
|
30443
|
+
const { t: t2 } = useTranslation54();
|
|
30444
|
+
return /* @__PURE__ */ jsx116("div", { className: className ?? "px-6 py-4", "data-testid": "section-no-access", children: /* @__PURE__ */ jsx116(Text24, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t2("permissions.noAccess") }) });
|
|
30264
30445
|
};
|
|
30265
30446
|
|
|
30266
30447
|
// src/permissions/with-permission.ts
|
|
@@ -30287,7 +30468,7 @@ var SidebarContext = createContext11(null);
|
|
|
30287
30468
|
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
30288
30469
|
import { useCallback as useCallback30, useEffect as useEffect27, useMemo as useMemo31, useState as useState41 } from "react";
|
|
30289
30470
|
import { useLocation as useLocation4 } from "react-router-dom";
|
|
30290
|
-
import { jsx as
|
|
30471
|
+
import { jsx as jsx117 } from "react/jsx-runtime";
|
|
30291
30472
|
var SidebarProvider = ({ children }) => {
|
|
30292
30473
|
const [desktop, setDesktop] = useState41(true);
|
|
30293
30474
|
const [mobile, setMobile] = useState41(false);
|
|
@@ -30313,7 +30494,7 @@ var SidebarProvider = ({ children }) => {
|
|
|
30313
30494
|
}),
|
|
30314
30495
|
[desktop, mobile, toggle]
|
|
30315
30496
|
);
|
|
30316
|
-
return /* @__PURE__ */
|
|
30497
|
+
return /* @__PURE__ */ jsx117(SidebarContext.Provider, { value, children });
|
|
30317
30498
|
};
|
|
30318
30499
|
|
|
30319
30500
|
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
@@ -30370,9 +30551,9 @@ import {
|
|
|
30370
30551
|
|
|
30371
30552
|
// src/layout-composer/entry.tsx
|
|
30372
30553
|
import { Fragment as Fragment14 } from "react";
|
|
30373
|
-
import { jsx as
|
|
30554
|
+
import { jsx as jsx118 } from "react/jsx-runtime";
|
|
30374
30555
|
function LayoutEntry({ children }) {
|
|
30375
|
-
return /* @__PURE__ */
|
|
30556
|
+
return /* @__PURE__ */ jsx118(Fragment14, { children });
|
|
30376
30557
|
}
|
|
30377
30558
|
LayoutEntry.displayName = "LayoutEntry";
|
|
30378
30559
|
|
|
@@ -30488,7 +30669,7 @@ function buildDisplayEntries(raw, preference, validSections) {
|
|
|
30488
30669
|
}
|
|
30489
30670
|
|
|
30490
30671
|
// src/layout-composer/layout-composer.tsx
|
|
30491
|
-
import { jsx as
|
|
30672
|
+
import { jsx as jsx119, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
30492
30673
|
var LayoutComposerRoot = ({
|
|
30493
30674
|
widgetsZonePrefix,
|
|
30494
30675
|
preferredLayoutId,
|
|
@@ -30526,12 +30707,12 @@ var LayoutComposerRoot = ({
|
|
|
30526
30707
|
}
|
|
30527
30708
|
const rendered = {};
|
|
30528
30709
|
for (const section of layout.sections) {
|
|
30529
|
-
rendered[section.id] = (entriesBySection[section.id] ?? []).filter((entry) => !entry.hidden).map((entry) => /* @__PURE__ */
|
|
30710
|
+
rendered[section.id] = (entriesBySection[section.id] ?? []).filter((entry) => !entry.hidden).map((entry) => /* @__PURE__ */ jsx119(Fragment16, { children: entry.render(data) }, entry.entryId));
|
|
30530
30711
|
}
|
|
30531
30712
|
const LayoutComponent = layout.Component;
|
|
30532
|
-
return /* @__PURE__ */
|
|
30533
|
-
/* @__PURE__ */
|
|
30534
|
-
hasOutlet && /* @__PURE__ */
|
|
30713
|
+
return /* @__PURE__ */ jsxs78("div", { className: "flex w-full flex-col gap-y-3", "data-testid": testId, children: [
|
|
30714
|
+
/* @__PURE__ */ jsx119(LayoutComponent, { sections: rendered, data, ...layoutProps }),
|
|
30715
|
+
hasOutlet && /* @__PURE__ */ jsx119(Outlet4, {})
|
|
30535
30716
|
] });
|
|
30536
30717
|
};
|
|
30537
30718
|
var LayoutComposer = Object.assign(LayoutComposerRoot, {
|
|
@@ -30539,11 +30720,11 @@ var LayoutComposer = Object.assign(LayoutComposerRoot, {
|
|
|
30539
30720
|
});
|
|
30540
30721
|
|
|
30541
30722
|
// src/layout-composer/detail-page-defaults.tsx
|
|
30542
|
-
import { Fragment as Fragment17, jsx as
|
|
30723
|
+
import { Fragment as Fragment17, jsx as jsx120, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
30543
30724
|
function detailPageDefaultEntries(data, { metadata = true, jsonView = true } = {}) {
|
|
30544
|
-
return /* @__PURE__ */
|
|
30545
|
-
metadata && /* @__PURE__ */
|
|
30546
|
-
jsonView && /* @__PURE__ */
|
|
30725
|
+
return /* @__PURE__ */ jsxs79(Fragment17, { children: [
|
|
30726
|
+
metadata && /* @__PURE__ */ jsx120(LayoutEntry, { id: "MetadataSection", children: /* @__PURE__ */ jsx120(MetadataSection, { data }) }),
|
|
30727
|
+
jsonView && /* @__PURE__ */ jsx120(LayoutEntry, { id: "JsonViewSection", children: /* @__PURE__ */ jsx120(JsonViewSection, { data }) })
|
|
30547
30728
|
] });
|
|
30548
30729
|
}
|
|
30549
30730
|
|
|
@@ -30832,6 +31013,7 @@ export {
|
|
|
30832
31013
|
TwoColumnLayoutComponent,
|
|
30833
31014
|
TwoColumnPage,
|
|
30834
31015
|
TwoColumnPageSkeleton,
|
|
31016
|
+
VariantAttributeSection,
|
|
30835
31017
|
VisuallyHidden,
|
|
30836
31018
|
WidgetZone,
|
|
30837
31019
|
_DataTable,
|