@mercurjs/dashboard-shared 2.4.2-canary.4 → 2.4.2-canary.6
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 +495 -312
- 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) {
|
|
@@ -26508,11 +26626,12 @@ var ExtensionRegistry = class {
|
|
|
26508
26626
|
return [...byKey.values()];
|
|
26509
26627
|
}
|
|
26510
26628
|
// An entry without a tab belongs to every tab of its zone, unless the host
|
|
26511
|
-
// asks for `exactTab` (a data grid tab only takes fields aimed at it).
|
|
26629
|
+
// asks for `exactTab` (a data grid tab only takes fields aimed at it). A host
|
|
26630
|
+
// without a tab is the whole zone, so untabbed entries are its exact match.
|
|
26512
26631
|
formEntriesFor(model, zone, tab, exactTab = false) {
|
|
26513
26632
|
return this.resolveFormFields(model).filter((entry) => {
|
|
26514
26633
|
if (entry.zone !== zone) return false;
|
|
26515
|
-
if (!entry.tab) return !exactTab;
|
|
26634
|
+
if (!entry.tab) return !exactTab || !tab;
|
|
26516
26635
|
return !!tab && entry.tab === tab;
|
|
26517
26636
|
});
|
|
26518
26637
|
}
|
|
@@ -27539,7 +27658,10 @@ var useExtensionActivity = (model, entity) => {
|
|
|
27539
27658
|
);
|
|
27540
27659
|
};
|
|
27541
27660
|
|
|
27542
|
-
// src/components/sections/
|
|
27661
|
+
// src/components/sections/attribute-group.tsx
|
|
27662
|
+
import { InformationCircleSolid as InformationCircleSolid2, PencilSquare, Trash as Trash2 } from "@medusajs/icons";
|
|
27663
|
+
import { Badge as Badge7, Text as Text19, Tooltip as Tooltip12, usePrompt } from "@medusajs/ui";
|
|
27664
|
+
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
27543
27665
|
import { jsx as jsx86, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
27544
27666
|
var AttributeActions = ({
|
|
27545
27667
|
attribute,
|
|
@@ -27657,6 +27779,7 @@ var AttributeGroup = ({
|
|
|
27657
27779
|
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
27780
|
/* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
|
|
27659
27781
|
/* @__PURE__ */ jsx86(Text19, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
|
|
27782
|
+
attr.is_internal && /* @__PURE__ */ jsx86(Badge7, { size: "2xsmall", color: "blue", children: t2("attributes.fields.visibility.internal") }),
|
|
27660
27783
|
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
27784
|
attr.is_required && /* @__PURE__ */ jsx86(
|
|
27662
27785
|
Tooltip12,
|
|
@@ -27682,6 +27805,9 @@ var AttributeGroup = ({
|
|
|
27682
27805
|
}) }) })
|
|
27683
27806
|
] });
|
|
27684
27807
|
};
|
|
27808
|
+
|
|
27809
|
+
// src/components/sections/product-attribute-section/product-attribute-section.tsx
|
|
27810
|
+
import { jsx as jsx87, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27685
27811
|
var defaultEditHref = (attribute) => `attributes/${attribute.id}/edit`;
|
|
27686
27812
|
var ProductAttributeSection = ({
|
|
27687
27813
|
product,
|
|
@@ -27691,7 +27817,7 @@ var ProductAttributeSection = ({
|
|
|
27691
27817
|
addExistingHref = "attributes/add",
|
|
27692
27818
|
createNewHref = "attributes/create"
|
|
27693
27819
|
}) => {
|
|
27694
|
-
const { t: t2 } =
|
|
27820
|
+
const { t: t2 } = useTranslation37();
|
|
27695
27821
|
const attributes = product.attributes ?? [];
|
|
27696
27822
|
const attachedIds = new Set(attributes.map((a) => a.id));
|
|
27697
27823
|
const missing = (requiredAttributes ?? []).filter((required) => !attachedIds.has(required.id)).map(
|
|
@@ -27705,14 +27831,14 @@ var ProductAttributeSection = ({
|
|
|
27705
27831
|
const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
|
|
27706
27832
|
const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
|
|
27707
27833
|
const isEmpty = !variantAttributes.length && !infoAttributes.length;
|
|
27708
|
-
return /* @__PURE__ */
|
|
27709
|
-
/* @__PURE__ */
|
|
27834
|
+
return /* @__PURE__ */ jsxs62(Container5, { className: "p-0", children: [
|
|
27835
|
+
/* @__PURE__ */ jsxs62(
|
|
27710
27836
|
"div",
|
|
27711
27837
|
{
|
|
27712
27838
|
className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
|
|
27713
27839
|
children: [
|
|
27714
|
-
/* @__PURE__ */
|
|
27715
|
-
/* @__PURE__ */
|
|
27840
|
+
/* @__PURE__ */ jsx87(Heading9, { level: "h2", children: t2("products.attributes") }),
|
|
27841
|
+
/* @__PURE__ */ jsx87(
|
|
27716
27842
|
ActionMenu,
|
|
27717
27843
|
{
|
|
27718
27844
|
groups: [
|
|
@@ -27722,13 +27848,13 @@ var ProductAttributeSection = ({
|
|
|
27722
27848
|
label: t2("products.create.attributes.addExisting"),
|
|
27723
27849
|
to: addExistingHref,
|
|
27724
27850
|
permission: "products:edit",
|
|
27725
|
-
icon: /* @__PURE__ */
|
|
27851
|
+
icon: /* @__PURE__ */ jsx87(Plus, {})
|
|
27726
27852
|
},
|
|
27727
27853
|
{
|
|
27728
27854
|
label: t2("products.create.attributes.createNew"),
|
|
27729
27855
|
to: createNewHref,
|
|
27730
27856
|
permission: "products:edit",
|
|
27731
|
-
icon: /* @__PURE__ */
|
|
27857
|
+
icon: /* @__PURE__ */ jsx87(PencilSquare2, {})
|
|
27732
27858
|
}
|
|
27733
27859
|
]
|
|
27734
27860
|
}
|
|
@@ -27738,10 +27864,10 @@ var ProductAttributeSection = ({
|
|
|
27738
27864
|
]
|
|
27739
27865
|
}
|
|
27740
27866
|
),
|
|
27741
|
-
variantAttributes.length > 0 && /* @__PURE__ */
|
|
27867
|
+
variantAttributes.length > 0 && /* @__PURE__ */ jsx87(
|
|
27742
27868
|
AttributeGroup,
|
|
27743
27869
|
{
|
|
27744
|
-
icon: /* @__PURE__ */
|
|
27870
|
+
icon: /* @__PURE__ */ jsx87(Swatch, {}),
|
|
27745
27871
|
title: t2("products.attributeVariations"),
|
|
27746
27872
|
description: t2("products.attributeVariantsDescription"),
|
|
27747
27873
|
attributes: variantAttributes,
|
|
@@ -27749,11 +27875,11 @@ var ProductAttributeSection = ({
|
|
|
27749
27875
|
onDelete: onDeleteAttribute
|
|
27750
27876
|
}
|
|
27751
27877
|
),
|
|
27752
|
-
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */
|
|
27753
|
-
infoAttributes.length > 0 && /* @__PURE__ */
|
|
27878
|
+
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx87("div", { className: "border-t border-dashed border-ui-border-base" }),
|
|
27879
|
+
infoAttributes.length > 0 && /* @__PURE__ */ jsx87(
|
|
27754
27880
|
AttributeGroup,
|
|
27755
27881
|
{
|
|
27756
|
-
icon: /* @__PURE__ */
|
|
27882
|
+
icon: /* @__PURE__ */ jsx87(DropCap, {}),
|
|
27757
27883
|
title: t2("products.attributeProductInformation"),
|
|
27758
27884
|
description: t2("products.attributeProductInformationDescription"),
|
|
27759
27885
|
attributes: infoAttributes,
|
|
@@ -27761,7 +27887,63 @@ var ProductAttributeSection = ({
|
|
|
27761
27887
|
onDelete: onDeleteAttribute
|
|
27762
27888
|
}
|
|
27763
27889
|
),
|
|
27764
|
-
/* @__PURE__ */
|
|
27890
|
+
/* @__PURE__ */ jsx87(DisplayExtensionZone, { model: "product", zone: "attributes", data: product })
|
|
27891
|
+
] });
|
|
27892
|
+
};
|
|
27893
|
+
|
|
27894
|
+
// src/components/sections/variant-attribute-section/variant-attribute-section.tsx
|
|
27895
|
+
import { Plus as Plus2, SquaresPlus } from "@medusajs/icons";
|
|
27896
|
+
import { Container as Container6, Heading as Heading10 } from "@medusajs/ui";
|
|
27897
|
+
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
27898
|
+
import { jsx as jsx88, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
27899
|
+
var defaultEditHref2 = (attribute) => `attributes/${attribute.id}/edit`;
|
|
27900
|
+
var VariantAttributeSection = ({
|
|
27901
|
+
variant,
|
|
27902
|
+
onDeleteAttribute,
|
|
27903
|
+
getEditHref = defaultEditHref2,
|
|
27904
|
+
addExistingHref = "attributes/add"
|
|
27905
|
+
}) => {
|
|
27906
|
+
const { t: t2 } = useTranslation38();
|
|
27907
|
+
const attributes = variant.attributes ?? [];
|
|
27908
|
+
const isEmpty = !attributes.length;
|
|
27909
|
+
return /* @__PURE__ */ jsxs63(Container6, { className: "p-0", "data-testid": "variant-attribute-section", children: [
|
|
27910
|
+
/* @__PURE__ */ jsxs63(
|
|
27911
|
+
"div",
|
|
27912
|
+
{
|
|
27913
|
+
className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
|
|
27914
|
+
children: [
|
|
27915
|
+
/* @__PURE__ */ jsx88(Heading10, { level: "h2", children: t2("products.variant.attributes.header") }),
|
|
27916
|
+
/* @__PURE__ */ jsx88(
|
|
27917
|
+
ActionMenu,
|
|
27918
|
+
{
|
|
27919
|
+
groups: [
|
|
27920
|
+
{
|
|
27921
|
+
actions: [
|
|
27922
|
+
{
|
|
27923
|
+
label: t2("products.create.attributes.addExisting"),
|
|
27924
|
+
to: addExistingHref,
|
|
27925
|
+
permission: "products:edit",
|
|
27926
|
+
icon: /* @__PURE__ */ jsx88(Plus2, {})
|
|
27927
|
+
}
|
|
27928
|
+
]
|
|
27929
|
+
}
|
|
27930
|
+
]
|
|
27931
|
+
}
|
|
27932
|
+
)
|
|
27933
|
+
]
|
|
27934
|
+
}
|
|
27935
|
+
),
|
|
27936
|
+
!isEmpty && /* @__PURE__ */ jsx88(
|
|
27937
|
+
AttributeGroup,
|
|
27938
|
+
{
|
|
27939
|
+
icon: /* @__PURE__ */ jsx88(SquaresPlus, {}),
|
|
27940
|
+
title: t2("products.variant.attributes.header"),
|
|
27941
|
+
description: t2("products.variant.attributes.description"),
|
|
27942
|
+
attributes,
|
|
27943
|
+
getEditHref,
|
|
27944
|
+
onDelete: onDeleteAttribute
|
|
27945
|
+
}
|
|
27946
|
+
)
|
|
27765
27947
|
] });
|
|
27766
27948
|
};
|
|
27767
27949
|
|
|
@@ -27773,7 +27955,7 @@ import {
|
|
|
27773
27955
|
useContext as useContext13,
|
|
27774
27956
|
useMemo as useMemo24
|
|
27775
27957
|
} from "react";
|
|
27776
|
-
import { useTranslation as
|
|
27958
|
+
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
27777
27959
|
|
|
27778
27960
|
// src/components/tabbed-form/use-tab-management.ts
|
|
27779
27961
|
import { useCallback as useCallback24, useEffect as useEffect20, useMemo as useMemo23, useState as useState32 } from "react";
|
|
@@ -27842,7 +28024,7 @@ var useTabManagement = ({
|
|
|
27842
28024
|
};
|
|
27843
28025
|
|
|
27844
28026
|
// src/components/tabbed-form/tabbed-form.tsx
|
|
27845
|
-
import { jsx as
|
|
28027
|
+
import { jsx as jsx89, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
27846
28028
|
var TabbedFormContext = createContext9(null);
|
|
27847
28029
|
var useTabbedForm = () => {
|
|
27848
28030
|
const form = useContext13(TabbedFormContext);
|
|
@@ -27889,7 +28071,7 @@ function Root6({
|
|
|
27889
28071
|
footer,
|
|
27890
28072
|
transformTabs
|
|
27891
28073
|
}) {
|
|
27892
|
-
const { t: t2 } =
|
|
28074
|
+
const { t: t2 } = useTranslation39();
|
|
27893
28075
|
const { tabs: rawTabs, elements } = useMemo24(
|
|
27894
28076
|
() => collectTabs(children),
|
|
27895
28077
|
[children]
|
|
@@ -27913,7 +28095,7 @@ function Root6({
|
|
|
27913
28095
|
const meta = resolveTabMeta(el);
|
|
27914
28096
|
return meta && visibleTabs.some((vt) => vt.id === meta.id);
|
|
27915
28097
|
});
|
|
27916
|
-
return /* @__PURE__ */
|
|
28098
|
+
return /* @__PURE__ */ jsx89(TabbedFormContext.Provider, { value: form, children: /* @__PURE__ */ jsx89(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs64(
|
|
27917
28099
|
KeyboundForm,
|
|
27918
28100
|
{
|
|
27919
28101
|
onKeyDown: (e) => {
|
|
@@ -27936,14 +28118,14 @@ function Root6({
|
|
|
27936
28118
|
onSubmit,
|
|
27937
28119
|
className: "flex h-full flex-col",
|
|
27938
28120
|
children: [
|
|
27939
|
-
/* @__PURE__ */
|
|
28121
|
+
/* @__PURE__ */ jsxs64(
|
|
27940
28122
|
ProgressTabs,
|
|
27941
28123
|
{
|
|
27942
28124
|
value: activeTabId,
|
|
27943
28125
|
onValueChange: onTabChange,
|
|
27944
28126
|
className: "flex h-full flex-col overflow-hidden",
|
|
27945
28127
|
children: [
|
|
27946
|
-
/* @__PURE__ */
|
|
28128
|
+
/* @__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
28129
|
ProgressTabs.Trigger,
|
|
27948
28130
|
{
|
|
27949
28131
|
status: tabState[tab.id] ?? "not-started",
|
|
@@ -27953,9 +28135,9 @@ function Root6({
|
|
|
27953
28135
|
},
|
|
27954
28136
|
tab.id
|
|
27955
28137
|
)) }) }) }),
|
|
27956
|
-
/* @__PURE__ */
|
|
28138
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: visibleElements.map((element) => {
|
|
27957
28139
|
const meta = resolveTabMeta(element);
|
|
27958
|
-
return /* @__PURE__ */
|
|
28140
|
+
return /* @__PURE__ */ jsx89(
|
|
27959
28141
|
ProgressTabs.Content,
|
|
27960
28142
|
{
|
|
27961
28143
|
className: "size-full overflow-y-auto",
|
|
@@ -27968,7 +28150,7 @@ function Root6({
|
|
|
27968
28150
|
]
|
|
27969
28151
|
}
|
|
27970
28152
|
),
|
|
27971
|
-
/* @__PURE__ */
|
|
28153
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Footer, { children: footer ? footer({ isLastTab, onNext, isLoading }) : /* @__PURE__ */ jsx89(
|
|
27972
28154
|
DefaultFooter,
|
|
27973
28155
|
{
|
|
27974
28156
|
isLastTab,
|
|
@@ -27985,10 +28167,10 @@ var DefaultFooter = ({
|
|
|
27985
28167
|
onNext,
|
|
27986
28168
|
isLoading
|
|
27987
28169
|
}) => {
|
|
27988
|
-
const { t: t2 } =
|
|
27989
|
-
return /* @__PURE__ */
|
|
27990
|
-
/* @__PURE__ */
|
|
27991
|
-
isLastTab ? /* @__PURE__ */
|
|
28170
|
+
const { t: t2 } = useTranslation39();
|
|
28171
|
+
return /* @__PURE__ */ jsxs64("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
28172
|
+
/* @__PURE__ */ jsx89(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx89(Button13, { variant: "secondary", size: "small", children: t2("actions.cancel") }) }),
|
|
28173
|
+
isLastTab ? /* @__PURE__ */ jsx89(
|
|
27992
28174
|
Button13,
|
|
27993
28175
|
{
|
|
27994
28176
|
type: "submit",
|
|
@@ -27998,7 +28180,7 @@ var DefaultFooter = ({
|
|
|
27998
28180
|
children: t2("actions.save")
|
|
27999
28181
|
},
|
|
28000
28182
|
"submit-button"
|
|
28001
|
-
) : /* @__PURE__ */
|
|
28183
|
+
) : /* @__PURE__ */ jsx89(
|
|
28002
28184
|
Button13,
|
|
28003
28185
|
{
|
|
28004
28186
|
type: "button",
|
|
@@ -28014,7 +28196,7 @@ var DefaultFooter = ({
|
|
|
28014
28196
|
var Tab = ({
|
|
28015
28197
|
children
|
|
28016
28198
|
}) => {
|
|
28017
|
-
return /* @__PURE__ */
|
|
28199
|
+
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
28200
|
};
|
|
28019
28201
|
var TabbedForm = Object.assign(Root6, { Tab, useForm: useTabbedForm });
|
|
28020
28202
|
|
|
@@ -28027,7 +28209,7 @@ import { Button as Button14, clx as clx49 } from "@medusajs/ui";
|
|
|
28027
28209
|
import { Popover as RadixPopover8 } from "radix-ui";
|
|
28028
28210
|
import { useCallback as useCallback27, useEffect as useEffect23, useMemo as useMemo26, useRef as useRef18, useState as useState37 } from "react";
|
|
28029
28211
|
import { useSearchParams as useSearchParams7 } from "react-router-dom";
|
|
28030
|
-
import { useTranslation as
|
|
28212
|
+
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
28031
28213
|
|
|
28032
28214
|
// src/components/table/data-table/data-table-filter/context.tsx
|
|
28033
28215
|
import { createContext as createContext10, useContext as useContext14 } from "react";
|
|
@@ -28044,12 +28226,12 @@ var useDataTableFilterContext = () => {
|
|
|
28044
28226
|
|
|
28045
28227
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
28046
28228
|
import { EllipseMiniSolid as EllipseMiniSolid2 } from "@medusajs/icons";
|
|
28047
|
-
import { DatePicker, Text as Text21, clx as clx45 } from "@medusajs/ui";
|
|
28229
|
+
import { DatePicker as DatePicker2, Text as Text21, clx as clx45 } from "@medusajs/ui";
|
|
28048
28230
|
import isEqual from "lodash.isequal";
|
|
28049
28231
|
import { Popover as RadixPopover4 } from "radix-ui";
|
|
28050
28232
|
import { useMemo as useMemo25, useState as useState33 } from "react";
|
|
28051
28233
|
import { t } from "i18next";
|
|
28052
|
-
import { useTranslation as
|
|
28234
|
+
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
28053
28235
|
|
|
28054
28236
|
// src/components/table/data-table/hooks.tsx
|
|
28055
28237
|
import { useSearchParams as useSearchParams6 } from "react-router-dom";
|
|
@@ -28122,8 +28304,8 @@ var useSelectedParams = ({
|
|
|
28122
28304
|
import { XMarkMini as XMarkMini5 } from "@medusajs/icons";
|
|
28123
28305
|
import { Text as Text20, clx as clx44 } from "@medusajs/ui";
|
|
28124
28306
|
import { Popover as RadixPopover3 } from "radix-ui";
|
|
28125
|
-
import { useTranslation as
|
|
28126
|
-
import { jsx as
|
|
28307
|
+
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
28308
|
+
import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
28127
28309
|
var FilterChip = ({
|
|
28128
28310
|
hadPreviousValue,
|
|
28129
28311
|
label,
|
|
@@ -28132,14 +28314,14 @@ var FilterChip = ({
|
|
|
28132
28314
|
hasOperator,
|
|
28133
28315
|
onRemove
|
|
28134
28316
|
}) => {
|
|
28135
|
-
const { t: t2 } =
|
|
28317
|
+
const { t: t2 } = useTranslation40();
|
|
28136
28318
|
const handleRemove = (e) => {
|
|
28137
28319
|
e.stopPropagation();
|
|
28138
28320
|
onRemove();
|
|
28139
28321
|
};
|
|
28140
|
-
return /* @__PURE__ */
|
|
28141
|
-
!hadPreviousValue && /* @__PURE__ */
|
|
28142
|
-
/* @__PURE__ */
|
|
28322
|
+
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: [
|
|
28323
|
+
!hadPreviousValue && /* @__PURE__ */ jsx90(RadixPopover3.Anchor, {}),
|
|
28324
|
+
/* @__PURE__ */ jsx90(
|
|
28143
28325
|
"div",
|
|
28144
28326
|
{
|
|
28145
28327
|
className: clx44(
|
|
@@ -28148,11 +28330,11 @@ var FilterChip = ({
|
|
|
28148
28330
|
"border-r": !!(value || hadPreviousValue)
|
|
28149
28331
|
}
|
|
28150
28332
|
),
|
|
28151
|
-
children: /* @__PURE__ */
|
|
28333
|
+
children: /* @__PURE__ */ jsx90(Text20, { size: "small", weight: "plus", leading: "compact", children: label })
|
|
28152
28334
|
}
|
|
28153
28335
|
),
|
|
28154
|
-
/* @__PURE__ */
|
|
28155
|
-
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28336
|
+
/* @__PURE__ */ jsxs65("div", { className: "flex w-full items-center overflow-hidden", children: [
|
|
28337
|
+
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx90("div", { className: "border-r p-1 px-2", children: /* @__PURE__ */ jsx90(
|
|
28156
28338
|
Text20,
|
|
28157
28339
|
{
|
|
28158
28340
|
size: "small",
|
|
@@ -28162,7 +28344,7 @@ var FilterChip = ({
|
|
|
28162
28344
|
children: t2("general.is")
|
|
28163
28345
|
}
|
|
28164
28346
|
) }),
|
|
28165
|
-
!!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28347
|
+
!!(value || hadPreviousValue) && /* @__PURE__ */ jsx90(
|
|
28166
28348
|
RadixPopover3.Trigger,
|
|
28167
28349
|
{
|
|
28168
28350
|
asChild: true,
|
|
@@ -28173,7 +28355,7 @@ var FilterChip = ({
|
|
|
28173
28355
|
"data-[state=open]:bg-ui-bg-field-hover": !readonly
|
|
28174
28356
|
}
|
|
28175
28357
|
),
|
|
28176
|
-
children: /* @__PURE__ */
|
|
28358
|
+
children: /* @__PURE__ */ jsx90(
|
|
28177
28359
|
Text20,
|
|
28178
28360
|
{
|
|
28179
28361
|
size: "small",
|
|
@@ -28186,7 +28368,7 @@ var FilterChip = ({
|
|
|
28186
28368
|
}
|
|
28187
28369
|
)
|
|
28188
28370
|
] }),
|
|
28189
|
-
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
28371
|
+
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx90(
|
|
28190
28372
|
"button",
|
|
28191
28373
|
{
|
|
28192
28374
|
onClick: handleRemove,
|
|
@@ -28195,7 +28377,7 @@ var FilterChip = ({
|
|
|
28195
28377
|
"hover:bg-ui-bg-subtle-hover",
|
|
28196
28378
|
"active:bg-ui-bg-subtle-pressed active:text-ui-fg-base"
|
|
28197
28379
|
),
|
|
28198
|
-
children: /* @__PURE__ */
|
|
28380
|
+
children: /* @__PURE__ */ jsx90(XMarkMini5, {})
|
|
28199
28381
|
}
|
|
28200
28382
|
)
|
|
28201
28383
|
] });
|
|
@@ -28209,7 +28391,7 @@ var isCompleteDate = (date) => {
|
|
|
28209
28391
|
};
|
|
28210
28392
|
|
|
28211
28393
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
28212
|
-
import { jsx as
|
|
28394
|
+
import { jsx as jsx91, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
28213
28395
|
var DateFilter = ({
|
|
28214
28396
|
filter,
|
|
28215
28397
|
prefix,
|
|
@@ -28286,8 +28468,8 @@ var DateFilter = ({
|
|
|
28286
28468
|
}, 200);
|
|
28287
28469
|
}
|
|
28288
28470
|
};
|
|
28289
|
-
return /* @__PURE__ */
|
|
28290
|
-
/* @__PURE__ */
|
|
28471
|
+
return /* @__PURE__ */ jsxs66(RadixPopover4.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28472
|
+
/* @__PURE__ */ jsx91(
|
|
28291
28473
|
filter_chip_default,
|
|
28292
28474
|
{
|
|
28293
28475
|
hadPreviousValue: !!previousValue,
|
|
@@ -28297,7 +28479,7 @@ var DateFilter = ({
|
|
|
28297
28479
|
readonly
|
|
28298
28480
|
}
|
|
28299
28481
|
),
|
|
28300
|
-
!readonly && /* @__PURE__ */
|
|
28482
|
+
!readonly && /* @__PURE__ */ jsx91(RadixPopover4.Portal, { children: /* @__PURE__ */ jsxs66(
|
|
28301
28483
|
RadixPopover4.Content,
|
|
28302
28484
|
{
|
|
28303
28485
|
"data-name": "date_filter_content",
|
|
@@ -28315,10 +28497,10 @@ var DateFilter = ({
|
|
|
28315
28497
|
}
|
|
28316
28498
|
},
|
|
28317
28499
|
children: [
|
|
28318
|
-
/* @__PURE__ */
|
|
28500
|
+
/* @__PURE__ */ jsxs66("ul", { className: "w-full p-1", children: [
|
|
28319
28501
|
presets.map((preset) => {
|
|
28320
28502
|
const isSelected = selectedParams.get().includes(JSON.stringify(preset.value));
|
|
28321
|
-
return /* @__PURE__ */
|
|
28503
|
+
return /* @__PURE__ */ jsx91("li", { children: /* @__PURE__ */ jsxs66(
|
|
28322
28504
|
"button",
|
|
28323
28505
|
{
|
|
28324
28506
|
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 +28509,7 @@ var DateFilter = ({
|
|
|
28327
28509
|
handleSelectPreset(preset.value);
|
|
28328
28510
|
},
|
|
28329
28511
|
children: [
|
|
28330
|
-
/* @__PURE__ */
|
|
28512
|
+
/* @__PURE__ */ jsx91(
|
|
28331
28513
|
"div",
|
|
28332
28514
|
{
|
|
28333
28515
|
className: clx45(
|
|
@@ -28336,7 +28518,7 @@ var DateFilter = ({
|
|
|
28336
28518
|
"[&_svg]:invisible": !isSelected
|
|
28337
28519
|
}
|
|
28338
28520
|
),
|
|
28339
|
-
children: /* @__PURE__ */
|
|
28521
|
+
children: /* @__PURE__ */ jsx91(EllipseMiniSolid2, {})
|
|
28340
28522
|
}
|
|
28341
28523
|
),
|
|
28342
28524
|
preset.label
|
|
@@ -28344,14 +28526,14 @@ var DateFilter = ({
|
|
|
28344
28526
|
}
|
|
28345
28527
|
) }, preset.label);
|
|
28346
28528
|
}),
|
|
28347
|
-
/* @__PURE__ */
|
|
28529
|
+
/* @__PURE__ */ jsx91("li", { children: /* @__PURE__ */ jsxs66(
|
|
28348
28530
|
"button",
|
|
28349
28531
|
{
|
|
28350
28532
|
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
28533
|
type: "button",
|
|
28352
28534
|
onClick: handleSelectCustom,
|
|
28353
28535
|
children: [
|
|
28354
|
-
/* @__PURE__ */
|
|
28536
|
+
/* @__PURE__ */ jsx91(
|
|
28355
28537
|
"div",
|
|
28356
28538
|
{
|
|
28357
28539
|
className: clx45(
|
|
@@ -28360,7 +28542,7 @@ var DateFilter = ({
|
|
|
28360
28542
|
"[&_svg]:invisible": !showCustom
|
|
28361
28543
|
}
|
|
28362
28544
|
),
|
|
28363
|
-
children: /* @__PURE__ */
|
|
28545
|
+
children: /* @__PURE__ */ jsx91(EllipseMiniSolid2, {})
|
|
28364
28546
|
}
|
|
28365
28547
|
),
|
|
28366
28548
|
t("filters.date.custom")
|
|
@@ -28368,11 +28550,11 @@ var DateFilter = ({
|
|
|
28368
28550
|
}
|
|
28369
28551
|
) })
|
|
28370
28552
|
] }),
|
|
28371
|
-
showCustom && /* @__PURE__ */
|
|
28372
|
-
/* @__PURE__ */
|
|
28373
|
-
/* @__PURE__ */
|
|
28374
|
-
/* @__PURE__ */
|
|
28375
|
-
|
|
28553
|
+
showCustom && /* @__PURE__ */ jsxs66("div", { className: "border-t px-1 pb-3 pt-1", children: [
|
|
28554
|
+
/* @__PURE__ */ jsxs66("div", { children: [
|
|
28555
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(Text21, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.from") }) }),
|
|
28556
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(
|
|
28557
|
+
DatePicker2,
|
|
28376
28558
|
{
|
|
28377
28559
|
modal: true,
|
|
28378
28560
|
maxValue: customEndValue,
|
|
@@ -28381,10 +28563,10 @@ var DateFilter = ({
|
|
|
28381
28563
|
}
|
|
28382
28564
|
) })
|
|
28383
28565
|
] }),
|
|
28384
|
-
/* @__PURE__ */
|
|
28385
|
-
/* @__PURE__ */
|
|
28386
|
-
/* @__PURE__ */
|
|
28387
|
-
|
|
28566
|
+
/* @__PURE__ */ jsxs66("div", { children: [
|
|
28567
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(Text21, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.to") }) }),
|
|
28568
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx91(
|
|
28569
|
+
DatePicker2,
|
|
28388
28570
|
{
|
|
28389
28571
|
modal: true,
|
|
28390
28572
|
minValue: customStartValue,
|
|
@@ -28404,7 +28586,7 @@ var DateFilter = ({
|
|
|
28404
28586
|
var today = /* @__PURE__ */ new Date();
|
|
28405
28587
|
today.setHours(0, 0, 0, 0);
|
|
28406
28588
|
var usePresets = () => {
|
|
28407
|
-
const { t: t2 } =
|
|
28589
|
+
const { t: t2 } = useTranslation41();
|
|
28408
28590
|
return useMemo25(
|
|
28409
28591
|
() => [
|
|
28410
28592
|
{
|
|
@@ -28476,15 +28658,15 @@ import {
|
|
|
28476
28658
|
RadioGroup as RadixRadioGroup
|
|
28477
28659
|
} from "radix-ui";
|
|
28478
28660
|
import { useCallback as useCallback25, useEffect as useEffect21, useState as useState34 } from "react";
|
|
28479
|
-
import { useTranslation as
|
|
28480
|
-
import { jsx as
|
|
28661
|
+
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
28662
|
+
import { jsx as jsx92, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
28481
28663
|
var NumberFilter = ({
|
|
28482
28664
|
filter,
|
|
28483
28665
|
prefix,
|
|
28484
28666
|
readonly,
|
|
28485
28667
|
openOnMount
|
|
28486
28668
|
}) => {
|
|
28487
|
-
const { t: t2 } =
|
|
28669
|
+
const { t: t2 } = useTranslation42();
|
|
28488
28670
|
const [open, setOpen] = useState34(openOnMount);
|
|
28489
28671
|
const { key, label } = filter;
|
|
28490
28672
|
const { removeFilter } = useDataTableFilterContext();
|
|
@@ -28574,8 +28756,8 @@ var NumberFilter = ({
|
|
|
28574
28756
|
const EQ_KEY = key;
|
|
28575
28757
|
const displayValue = parseDisplayValue(currentValue, t2);
|
|
28576
28758
|
const previousDisplayValue = parseDisplayValue(previousValue, t2);
|
|
28577
|
-
return /* @__PURE__ */
|
|
28578
|
-
/* @__PURE__ */
|
|
28759
|
+
return /* @__PURE__ */ jsxs67(RadixPopover5.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28760
|
+
/* @__PURE__ */ jsx92(
|
|
28579
28761
|
filter_chip_default,
|
|
28580
28762
|
{
|
|
28581
28763
|
hasOperator: true,
|
|
@@ -28586,7 +28768,7 @@ var NumberFilter = ({
|
|
|
28586
28768
|
readonly
|
|
28587
28769
|
}
|
|
28588
28770
|
),
|
|
28589
|
-
!readonly && /* @__PURE__ */
|
|
28771
|
+
!readonly && /* @__PURE__ */ jsx92(RadixPopover5.Portal, { children: /* @__PURE__ */ jsxs67(
|
|
28590
28772
|
RadixPopover5.Content,
|
|
28591
28773
|
{
|
|
28592
28774
|
"data-name": "number_filter_content",
|
|
@@ -28604,30 +28786,30 @@ var NumberFilter = ({
|
|
|
28604
28786
|
}
|
|
28605
28787
|
},
|
|
28606
28788
|
children: [
|
|
28607
|
-
/* @__PURE__ */
|
|
28789
|
+
/* @__PURE__ */ jsx92("div", { className: "p-1", children: /* @__PURE__ */ jsx92(
|
|
28608
28790
|
RadixRadioGroup.Root,
|
|
28609
28791
|
{
|
|
28610
28792
|
value: operator,
|
|
28611
28793
|
onValueChange: (val) => setOperator(val),
|
|
28612
28794
|
className: "flex flex-col items-start",
|
|
28613
28795
|
orientation: "vertical",
|
|
28614
|
-
children: operators.map((o) => /* @__PURE__ */
|
|
28796
|
+
children: operators.map((o) => /* @__PURE__ */ jsxs67(
|
|
28615
28797
|
RadixRadioGroup.Item,
|
|
28616
28798
|
{
|
|
28617
28799
|
value: o.operator,
|
|
28618
28800
|
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
28801
|
children: [
|
|
28620
|
-
/* @__PURE__ */
|
|
28621
|
-
/* @__PURE__ */
|
|
28802
|
+
/* @__PURE__ */ jsx92("div", { className: "size-5", children: /* @__PURE__ */ jsx92(RadixRadioGroup.Indicator, { children: /* @__PURE__ */ jsx92(EllipseMiniSolid3, {}) }) }),
|
|
28803
|
+
/* @__PURE__ */ jsx92("span", { className: "w-full", children: o.label })
|
|
28622
28804
|
]
|
|
28623
28805
|
},
|
|
28624
28806
|
o.operator
|
|
28625
28807
|
))
|
|
28626
28808
|
}
|
|
28627
28809
|
) }),
|
|
28628
|
-
/* @__PURE__ */
|
|
28629
|
-
/* @__PURE__ */
|
|
28630
|
-
/* @__PURE__ */
|
|
28810
|
+
/* @__PURE__ */ jsx92("div", { children: operator === "range" ? /* @__PURE__ */ jsxs67("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28811
|
+
/* @__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") }) }),
|
|
28812
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28631
28813
|
Input11,
|
|
28632
28814
|
{
|
|
28633
28815
|
name: GT_KEY,
|
|
@@ -28637,8 +28819,8 @@ var NumberFilter = ({
|
|
|
28637
28819
|
onChange: (e) => debouncedOnChange(e, "gt")
|
|
28638
28820
|
}
|
|
28639
28821
|
) }),
|
|
28640
|
-
/* @__PURE__ */
|
|
28641
|
-
/* @__PURE__ */
|
|
28822
|
+
/* @__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") }) }),
|
|
28823
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28642
28824
|
Input11,
|
|
28643
28825
|
{
|
|
28644
28826
|
name: LT_KEY,
|
|
@@ -28648,9 +28830,9 @@ var NumberFilter = ({
|
|
|
28648
28830
|
onChange: (e) => debouncedOnChange(e, "lt")
|
|
28649
28831
|
}
|
|
28650
28832
|
) })
|
|
28651
|
-
] }, "range") : /* @__PURE__ */
|
|
28652
|
-
/* @__PURE__ */
|
|
28653
|
-
/* @__PURE__ */
|
|
28833
|
+
] }, "range") : /* @__PURE__ */ jsxs67("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28834
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx92(Label4, { size: "xsmall", weight: "plus", htmlFor: EQ_KEY, children: label }) }),
|
|
28835
|
+
/* @__PURE__ */ jsx92("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx92(
|
|
28654
28836
|
Input11,
|
|
28655
28837
|
{
|
|
28656
28838
|
name: EQ_KEY,
|
|
@@ -28719,8 +28901,8 @@ import { clx as clx47 } from "@medusajs/ui";
|
|
|
28719
28901
|
import { Command } from "cmdk";
|
|
28720
28902
|
import { Popover as RadixPopover6 } from "radix-ui";
|
|
28721
28903
|
import { useState as useState35 } from "react";
|
|
28722
|
-
import { useTranslation as
|
|
28723
|
-
import { jsx as
|
|
28904
|
+
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
28905
|
+
import { jsx as jsx93, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
28724
28906
|
var SelectFilter = ({
|
|
28725
28907
|
filter,
|
|
28726
28908
|
prefix,
|
|
@@ -28733,7 +28915,7 @@ var SelectFilter = ({
|
|
|
28733
28915
|
const [open, setOpen] = useState35(openOnMount);
|
|
28734
28916
|
const [search, setSearch] = useState35("");
|
|
28735
28917
|
const [searchRef, setSearchRef] = useState35(null);
|
|
28736
|
-
const { t: t2 } =
|
|
28918
|
+
const { t: t2 } = useTranslation43();
|
|
28737
28919
|
const { removeFilter } = useDataTableFilterContext();
|
|
28738
28920
|
const { key, label } = filter;
|
|
28739
28921
|
const selectedParams = useSelectedParams({ param: key, prefix, multiple });
|
|
@@ -28773,8 +28955,8 @@ var SelectFilter = ({
|
|
|
28773
28955
|
};
|
|
28774
28956
|
const normalizedValues = labelValues ? Array.isArray(labelValues) ? labelValues : [labelValues] : null;
|
|
28775
28957
|
const normalizedPrev = previousValue ? Array.isArray(previousValue) ? previousValue : [previousValue] : null;
|
|
28776
|
-
return /* @__PURE__ */
|
|
28777
|
-
/* @__PURE__ */
|
|
28958
|
+
return /* @__PURE__ */ jsxs68(RadixPopover6.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28959
|
+
/* @__PURE__ */ jsx93(
|
|
28778
28960
|
filter_chip_default,
|
|
28779
28961
|
{
|
|
28780
28962
|
hasOperator: true,
|
|
@@ -28785,7 +28967,7 @@ var SelectFilter = ({
|
|
|
28785
28967
|
onRemove: handleRemove
|
|
28786
28968
|
}
|
|
28787
28969
|
),
|
|
28788
|
-
!readonly && /* @__PURE__ */
|
|
28970
|
+
!readonly && /* @__PURE__ */ jsx93(RadixPopover6.Portal, { children: /* @__PURE__ */ jsx93(
|
|
28789
28971
|
RadixPopover6.Content,
|
|
28790
28972
|
{
|
|
28791
28973
|
hideWhenDetached: true,
|
|
@@ -28803,9 +28985,9 @@ var SelectFilter = ({
|
|
|
28803
28985
|
}
|
|
28804
28986
|
}
|
|
28805
28987
|
},
|
|
28806
|
-
children: /* @__PURE__ */
|
|
28807
|
-
searchable && /* @__PURE__ */
|
|
28808
|
-
/* @__PURE__ */
|
|
28988
|
+
children: /* @__PURE__ */ jsxs68(Command, { className: "h-full", children: [
|
|
28989
|
+
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: [
|
|
28990
|
+
/* @__PURE__ */ jsx93(
|
|
28809
28991
|
Command.Input,
|
|
28810
28992
|
{
|
|
28811
28993
|
ref: setSearchRef,
|
|
@@ -28815,7 +28997,7 @@ var SelectFilter = ({
|
|
|
28815
28997
|
placeholder: t2("general.search")
|
|
28816
28998
|
}
|
|
28817
28999
|
),
|
|
28818
|
-
/* @__PURE__ */
|
|
29000
|
+
/* @__PURE__ */ jsx93("div", { className: "flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsx93(
|
|
28819
29001
|
"button",
|
|
28820
29002
|
{
|
|
28821
29003
|
disabled: !search,
|
|
@@ -28826,14 +29008,14 @@ var SelectFilter = ({
|
|
|
28826
29008
|
invisible: !search
|
|
28827
29009
|
}
|
|
28828
29010
|
),
|
|
28829
|
-
children: /* @__PURE__ */
|
|
29011
|
+
children: /* @__PURE__ */ jsx93(XMarkMini6, {})
|
|
28830
29012
|
}
|
|
28831
29013
|
) })
|
|
28832
29014
|
] }) }),
|
|
28833
|
-
/* @__PURE__ */
|
|
28834
|
-
/* @__PURE__ */
|
|
29015
|
+
/* @__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") }) }),
|
|
29016
|
+
/* @__PURE__ */ jsx93(Command.List, { className: "h-full max-h-[163px] min-h-[0] overflow-auto p-1 outline-none", children: options.map((option) => {
|
|
28835
29017
|
const isSelected = selectedParams.get().includes(String(option.value));
|
|
28836
|
-
return /* @__PURE__ */
|
|
29018
|
+
return /* @__PURE__ */ jsxs68(
|
|
28837
29019
|
Command.Item,
|
|
28838
29020
|
{
|
|
28839
29021
|
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 +29024,7 @@ var SelectFilter = ({
|
|
|
28842
29024
|
handleSelect(option.value);
|
|
28843
29025
|
},
|
|
28844
29026
|
children: [
|
|
28845
|
-
/* @__PURE__ */
|
|
29027
|
+
/* @__PURE__ */ jsx93(
|
|
28846
29028
|
"div",
|
|
28847
29029
|
{
|
|
28848
29030
|
className: clx47(
|
|
@@ -28851,7 +29033,7 @@ var SelectFilter = ({
|
|
|
28851
29033
|
"[&_svg]:invisible": !isSelected
|
|
28852
29034
|
}
|
|
28853
29035
|
),
|
|
28854
|
-
children: multiple ? /* @__PURE__ */
|
|
29036
|
+
children: multiple ? /* @__PURE__ */ jsx93(CheckMini2, {}) : /* @__PURE__ */ jsx93(EllipseMiniSolid4, {})
|
|
28855
29037
|
}
|
|
28856
29038
|
),
|
|
28857
29039
|
option.label
|
|
@@ -28871,7 +29053,7 @@ import { Input as Input12, Label as Label5, clx as clx48 } from "@medusajs/ui";
|
|
|
28871
29053
|
import debounce3 from "lodash.debounce";
|
|
28872
29054
|
import { Popover as RadixPopover7 } from "radix-ui";
|
|
28873
29055
|
import { useCallback as useCallback26, useEffect as useEffect22, useState as useState36 } from "react";
|
|
28874
|
-
import { jsx as
|
|
29056
|
+
import { jsx as jsx94, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
28875
29057
|
var StringFilter = ({
|
|
28876
29058
|
filter,
|
|
28877
29059
|
prefix,
|
|
@@ -28919,8 +29101,8 @@ var StringFilter = ({
|
|
|
28919
29101
|
selectedParams.delete();
|
|
28920
29102
|
removeFilter(key);
|
|
28921
29103
|
};
|
|
28922
|
-
return /* @__PURE__ */
|
|
28923
|
-
/* @__PURE__ */
|
|
29104
|
+
return /* @__PURE__ */ jsxs69(RadixPopover7.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
29105
|
+
/* @__PURE__ */ jsx94(
|
|
28924
29106
|
filter_chip_default,
|
|
28925
29107
|
{
|
|
28926
29108
|
hasOperator: true,
|
|
@@ -28931,7 +29113,7 @@ var StringFilter = ({
|
|
|
28931
29113
|
readonly
|
|
28932
29114
|
}
|
|
28933
29115
|
),
|
|
28934
|
-
!readonly && /* @__PURE__ */
|
|
29116
|
+
!readonly && /* @__PURE__ */ jsx94(RadixPopover7.Portal, { children: /* @__PURE__ */ jsx94(
|
|
28935
29117
|
RadixPopover7.Content,
|
|
28936
29118
|
{
|
|
28937
29119
|
hideWhenDetached: true,
|
|
@@ -28949,9 +29131,9 @@ var StringFilter = ({
|
|
|
28949
29131
|
}
|
|
28950
29132
|
}
|
|
28951
29133
|
},
|
|
28952
|
-
children: /* @__PURE__ */
|
|
28953
|
-
/* @__PURE__ */
|
|
28954
|
-
/* @__PURE__ */
|
|
29134
|
+
children: /* @__PURE__ */ jsxs69("div", { className: "px-1 pb-3 pt-1", children: [
|
|
29135
|
+
/* @__PURE__ */ jsx94("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx94(Label5, { size: "xsmall", weight: "plus", htmlFor: key, children: label }) }),
|
|
29136
|
+
/* @__PURE__ */ jsx94("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx94(
|
|
28955
29137
|
Input12,
|
|
28956
29138
|
{
|
|
28957
29139
|
name: key,
|
|
@@ -28967,13 +29149,13 @@ var StringFilter = ({
|
|
|
28967
29149
|
};
|
|
28968
29150
|
|
|
28969
29151
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
28970
|
-
import { jsx as
|
|
29152
|
+
import { jsx as jsx95, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28971
29153
|
var DataTableFilter2 = ({
|
|
28972
29154
|
filters,
|
|
28973
29155
|
readonly,
|
|
28974
29156
|
prefix
|
|
28975
29157
|
}) => {
|
|
28976
|
-
const { t: t2 } =
|
|
29158
|
+
const { t: t2 } = useTranslation44();
|
|
28977
29159
|
const [searchParams] = useSearchParams7();
|
|
28978
29160
|
const [open, setOpen] = useState37(false);
|
|
28979
29161
|
const [activeFilters, setActiveFilters] = useState37(
|
|
@@ -29021,7 +29203,7 @@ var DataTableFilter2 = ({
|
|
|
29021
29203
|
const removeAllFilters = useCallback27(() => {
|
|
29022
29204
|
setActiveFilters([]);
|
|
29023
29205
|
}, []);
|
|
29024
|
-
return /* @__PURE__ */
|
|
29206
|
+
return /* @__PURE__ */ jsx95(
|
|
29025
29207
|
DataTableFilterContext.Provider,
|
|
29026
29208
|
{
|
|
29027
29209
|
value: useMemo26(
|
|
@@ -29031,11 +29213,11 @@ var DataTableFilter2 = ({
|
|
|
29031
29213
|
}),
|
|
29032
29214
|
[removeAllFilters, removeFilter]
|
|
29033
29215
|
),
|
|
29034
|
-
children: /* @__PURE__ */
|
|
29216
|
+
children: /* @__PURE__ */ jsxs70("div", { className: "max-w-2/3 flex flex-wrap items-center gap-2", children: [
|
|
29035
29217
|
activeFilters.map((filter) => {
|
|
29036
29218
|
switch (filter.type) {
|
|
29037
29219
|
case "select":
|
|
29038
|
-
return /* @__PURE__ */
|
|
29220
|
+
return /* @__PURE__ */ jsx95(
|
|
29039
29221
|
SelectFilter,
|
|
29040
29222
|
{
|
|
29041
29223
|
filter,
|
|
@@ -29049,7 +29231,7 @@ var DataTableFilter2 = ({
|
|
|
29049
29231
|
filter.key
|
|
29050
29232
|
);
|
|
29051
29233
|
case "date":
|
|
29052
|
-
return /* @__PURE__ */
|
|
29234
|
+
return /* @__PURE__ */ jsx95(
|
|
29053
29235
|
DateFilter,
|
|
29054
29236
|
{
|
|
29055
29237
|
filter,
|
|
@@ -29060,7 +29242,7 @@ var DataTableFilter2 = ({
|
|
|
29060
29242
|
filter.key
|
|
29061
29243
|
);
|
|
29062
29244
|
case "string":
|
|
29063
|
-
return /* @__PURE__ */
|
|
29245
|
+
return /* @__PURE__ */ jsx95(
|
|
29064
29246
|
StringFilter,
|
|
29065
29247
|
{
|
|
29066
29248
|
filter,
|
|
@@ -29071,7 +29253,7 @@ var DataTableFilter2 = ({
|
|
|
29071
29253
|
filter.key
|
|
29072
29254
|
);
|
|
29073
29255
|
case "number":
|
|
29074
|
-
return /* @__PURE__ */
|
|
29256
|
+
return /* @__PURE__ */ jsx95(
|
|
29075
29257
|
NumberFilter,
|
|
29076
29258
|
{
|
|
29077
29259
|
filter,
|
|
@@ -29085,9 +29267,9 @@ var DataTableFilter2 = ({
|
|
|
29085
29267
|
break;
|
|
29086
29268
|
}
|
|
29087
29269
|
}),
|
|
29088
|
-
!readonly && availableFilters.length > 0 && /* @__PURE__ */
|
|
29089
|
-
/* @__PURE__ */
|
|
29090
|
-
/* @__PURE__ */
|
|
29270
|
+
!readonly && availableFilters.length > 0 && /* @__PURE__ */ jsxs70(RadixPopover8.Root, { modal: true, open, onOpenChange: setOpen, children: [
|
|
29271
|
+
/* @__PURE__ */ jsx95(RadixPopover8.Trigger, { asChild: true, id: "filters_menu_trigger", children: /* @__PURE__ */ jsx95(Button14, { size: "small", variant: "secondary", children: t2("filters.addFilter") }) }),
|
|
29272
|
+
/* @__PURE__ */ jsx95(RadixPopover8.Portal, { children: /* @__PURE__ */ jsx95(
|
|
29091
29273
|
RadixPopover8.Content,
|
|
29092
29274
|
{
|
|
29093
29275
|
className: clx49(
|
|
@@ -29108,7 +29290,7 @@ var DataTableFilter2 = ({
|
|
|
29108
29290
|
children: availableFilters.map((filter) => {
|
|
29109
29291
|
return (
|
|
29110
29292
|
// oxlint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
29111
|
-
/* @__PURE__ */
|
|
29293
|
+
/* @__PURE__ */ jsx95(
|
|
29112
29294
|
"div",
|
|
29113
29295
|
{
|
|
29114
29296
|
tabIndex: 0,
|
|
@@ -29126,7 +29308,7 @@ var DataTableFilter2 = ({
|
|
|
29126
29308
|
}
|
|
29127
29309
|
) })
|
|
29128
29310
|
] }),
|
|
29129
|
-
!readonly && activeFilters.length > 0 && /* @__PURE__ */
|
|
29311
|
+
!readonly && activeFilters.length > 0 && /* @__PURE__ */ jsx95(ClearAllFilters, { filters, prefix })
|
|
29130
29312
|
] })
|
|
29131
29313
|
}
|
|
29132
29314
|
);
|
|
@@ -29144,7 +29326,7 @@ var ClearAllFilters = ({ filters, prefix }) => {
|
|
|
29144
29326
|
});
|
|
29145
29327
|
removeAllFilters();
|
|
29146
29328
|
};
|
|
29147
|
-
return /* @__PURE__ */
|
|
29329
|
+
return /* @__PURE__ */ jsx95(
|
|
29148
29330
|
"button",
|
|
29149
29331
|
{
|
|
29150
29332
|
type: "button",
|
|
@@ -29188,9 +29370,9 @@ var getInitialFilters = ({
|
|
|
29188
29370
|
import { DescendingSorting } from "@medusajs/icons";
|
|
29189
29371
|
import { DropdownMenu as DropdownMenu7, IconButton as IconButton11 } from "@medusajs/ui";
|
|
29190
29372
|
import { useState as useState38 } from "react";
|
|
29191
|
-
import { useTranslation as
|
|
29373
|
+
import { useTranslation as useTranslation45 } from "react-i18next";
|
|
29192
29374
|
import { useSearchParams as useSearchParams8 } from "react-router-dom";
|
|
29193
|
-
import { jsx as
|
|
29375
|
+
import { jsx as jsx96, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
29194
29376
|
var initState2 = (params, prefix) => {
|
|
29195
29377
|
const param = prefix ? `${prefix}_order` : "order";
|
|
29196
29378
|
const sortParam = params.get(param);
|
|
@@ -29213,7 +29395,7 @@ var DataTableOrderBy = ({
|
|
|
29213
29395
|
const [searchParams, setSearchParams] = useSearchParams8();
|
|
29214
29396
|
const [state, setState] = useState38(initState2(searchParams, prefix));
|
|
29215
29397
|
const param = prefix ? `${prefix}_order` : "order";
|
|
29216
|
-
const { t: t2 } =
|
|
29398
|
+
const { t: t2 } = useTranslation45();
|
|
29217
29399
|
const direction = useDocumentDirection();
|
|
29218
29400
|
const handleDirChange = (dir) => {
|
|
29219
29401
|
setState((prev) => ({
|
|
@@ -29249,17 +29431,17 @@ var DataTableOrderBy = ({
|
|
|
29249
29431
|
return prev;
|
|
29250
29432
|
});
|
|
29251
29433
|
};
|
|
29252
|
-
return /* @__PURE__ */
|
|
29253
|
-
/* @__PURE__ */
|
|
29254
|
-
/* @__PURE__ */
|
|
29255
|
-
/* @__PURE__ */
|
|
29434
|
+
return /* @__PURE__ */ jsxs71(DropdownMenu7, { dir: direction, children: [
|
|
29435
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Trigger, { asChild: true, children: /* @__PURE__ */ jsx96(IconButton11, { size: "small", children: /* @__PURE__ */ jsx96(DescendingSorting, {}) }) }),
|
|
29436
|
+
/* @__PURE__ */ jsxs71(DropdownMenu7.Content, { className: "z-[1]", align: "end", children: [
|
|
29437
|
+
/* @__PURE__ */ jsx96(
|
|
29256
29438
|
DropdownMenu7.RadioGroup,
|
|
29257
29439
|
{
|
|
29258
29440
|
value: state.key,
|
|
29259
29441
|
onValueChange: handleKeyChange,
|
|
29260
29442
|
children: keys.map((key) => {
|
|
29261
29443
|
const stringKey = String(key.key);
|
|
29262
|
-
return /* @__PURE__ */
|
|
29444
|
+
return /* @__PURE__ */ jsx96(
|
|
29263
29445
|
DropdownMenu7.RadioItem,
|
|
29264
29446
|
{
|
|
29265
29447
|
value: stringKey,
|
|
@@ -29271,14 +29453,14 @@ var DataTableOrderBy = ({
|
|
|
29271
29453
|
})
|
|
29272
29454
|
}
|
|
29273
29455
|
),
|
|
29274
|
-
/* @__PURE__ */
|
|
29275
|
-
/* @__PURE__ */
|
|
29456
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Separator, {}),
|
|
29457
|
+
/* @__PURE__ */ jsxs71(
|
|
29276
29458
|
DropdownMenu7.RadioGroup,
|
|
29277
29459
|
{
|
|
29278
29460
|
value: state.dir,
|
|
29279
29461
|
onValueChange: handleDirChange,
|
|
29280
29462
|
children: [
|
|
29281
|
-
/* @__PURE__ */
|
|
29463
|
+
/* @__PURE__ */ jsxs71(
|
|
29282
29464
|
DropdownMenu7.RadioItem,
|
|
29283
29465
|
{
|
|
29284
29466
|
className: "flex items-center justify-between",
|
|
@@ -29286,11 +29468,11 @@ var DataTableOrderBy = ({
|
|
|
29286
29468
|
onSelect: (event) => event.preventDefault(),
|
|
29287
29469
|
children: [
|
|
29288
29470
|
t2("general.ascending"),
|
|
29289
|
-
/* @__PURE__ */
|
|
29471
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Label, { children: "1 - 30" })
|
|
29290
29472
|
]
|
|
29291
29473
|
}
|
|
29292
29474
|
),
|
|
29293
|
-
/* @__PURE__ */
|
|
29475
|
+
/* @__PURE__ */ jsxs71(
|
|
29294
29476
|
DropdownMenu7.RadioItem,
|
|
29295
29477
|
{
|
|
29296
29478
|
className: "flex items-center justify-between",
|
|
@@ -29298,7 +29480,7 @@ var DataTableOrderBy = ({
|
|
|
29298
29480
|
onSelect: (event) => event.preventDefault(),
|
|
29299
29481
|
children: [
|
|
29300
29482
|
t2("general.descending"),
|
|
29301
|
-
/* @__PURE__ */
|
|
29483
|
+
/* @__PURE__ */ jsx96(DropdownMenu7.Label, { children: "30 - 1" })
|
|
29302
29484
|
]
|
|
29303
29485
|
}
|
|
29304
29486
|
)
|
|
@@ -29312,15 +29494,15 @@ var DataTableOrderBy = ({
|
|
|
29312
29494
|
// src/components/table/data-table/data-table-search/data-table-search.tsx
|
|
29313
29495
|
import { Input as Input13 } from "@medusajs/ui";
|
|
29314
29496
|
import { useCallback as useCallback28, useEffect as useEffect24 } from "react";
|
|
29315
|
-
import { useTranslation as
|
|
29497
|
+
import { useTranslation as useTranslation46 } from "react-i18next";
|
|
29316
29498
|
import debounce4 from "lodash.debounce";
|
|
29317
|
-
import { jsx as
|
|
29499
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
29318
29500
|
var DataTableSearch = ({
|
|
29319
29501
|
placeholder,
|
|
29320
29502
|
prefix,
|
|
29321
29503
|
autofocus: _autofocus
|
|
29322
29504
|
}) => {
|
|
29323
|
-
const { t: t2 } =
|
|
29505
|
+
const { t: t2 } = useTranslation46();
|
|
29324
29506
|
const placeholderText = placeholder || t2("general.search");
|
|
29325
29507
|
const selectedParams = useSelectedParams({
|
|
29326
29508
|
param: "q",
|
|
@@ -29344,7 +29526,7 @@ var DataTableSearch = ({
|
|
|
29344
29526
|
debouncedOnChange.cancel();
|
|
29345
29527
|
};
|
|
29346
29528
|
}, [debouncedOnChange]);
|
|
29347
|
-
return /* @__PURE__ */
|
|
29529
|
+
return /* @__PURE__ */ jsx97(
|
|
29348
29530
|
Input13,
|
|
29349
29531
|
{
|
|
29350
29532
|
autoComplete: "off",
|
|
@@ -29359,24 +29541,24 @@ var DataTableSearch = ({
|
|
|
29359
29541
|
};
|
|
29360
29542
|
|
|
29361
29543
|
// src/components/table/data-table/data-table-query/data-table-query.tsx
|
|
29362
|
-
import { jsx as
|
|
29544
|
+
import { jsx as jsx98, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
29363
29545
|
var DataTableQuery = ({
|
|
29364
29546
|
search,
|
|
29365
29547
|
orderBy,
|
|
29366
29548
|
filters,
|
|
29367
29549
|
prefix
|
|
29368
29550
|
}) => {
|
|
29369
|
-
return (search || orderBy || filters || prefix) && /* @__PURE__ */
|
|
29370
|
-
/* @__PURE__ */
|
|
29371
|
-
/* @__PURE__ */
|
|
29372
|
-
search && /* @__PURE__ */
|
|
29551
|
+
return (search || orderBy || filters || prefix) && /* @__PURE__ */ jsxs72("div", { className: "flex items-start justify-between gap-x-4 px-6 py-4", children: [
|
|
29552
|
+
/* @__PURE__ */ jsx98("div", { className: "w-full max-w-[60%]", children: filters && filters.length > 0 && /* @__PURE__ */ jsx98(DataTableFilter2, { filters, prefix }) }),
|
|
29553
|
+
/* @__PURE__ */ jsxs72("div", { className: "flex shrink-0 items-center gap-x-2", children: [
|
|
29554
|
+
search && /* @__PURE__ */ jsx98(
|
|
29373
29555
|
DataTableSearch,
|
|
29374
29556
|
{
|
|
29375
29557
|
prefix,
|
|
29376
29558
|
autofocus: search === "autofocus"
|
|
29377
29559
|
}
|
|
29378
29560
|
),
|
|
29379
|
-
orderBy && /* @__PURE__ */
|
|
29561
|
+
orderBy && /* @__PURE__ */ jsx98(DataTableOrderBy, { keys: orderBy, prefix })
|
|
29380
29562
|
] })
|
|
29381
29563
|
] });
|
|
29382
29564
|
};
|
|
@@ -29393,9 +29575,9 @@ import {
|
|
|
29393
29575
|
useState as useState39,
|
|
29394
29576
|
useContext as useContext15
|
|
29395
29577
|
} from "react";
|
|
29396
|
-
import { useTranslation as
|
|
29578
|
+
import { useTranslation as useTranslation47 } from "react-i18next";
|
|
29397
29579
|
import { Link as Link8 } from "react-router-dom";
|
|
29398
|
-
import { jsx as
|
|
29580
|
+
import { jsx as jsx99, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
29399
29581
|
var DataTableRoot = ({
|
|
29400
29582
|
table,
|
|
29401
29583
|
columns,
|
|
@@ -29408,7 +29590,7 @@ var DataTableRoot = ({
|
|
|
29408
29590
|
noHeader = false,
|
|
29409
29591
|
layout = "fit"
|
|
29410
29592
|
}) => {
|
|
29411
|
-
const { t: t2 } =
|
|
29593
|
+
const { t: t2 } = useTranslation47();
|
|
29412
29594
|
const [showStickyBorder, setShowStickyBorder] = useState39(false);
|
|
29413
29595
|
const scrollableRef = useRef19(null);
|
|
29414
29596
|
const hasSelect = columns.find((c) => c.id === "select");
|
|
@@ -29435,14 +29617,14 @@ var DataTableRoot = ({
|
|
|
29435
29617
|
useEffect25(() => {
|
|
29436
29618
|
scrollableRef.current?.scroll({ top: 0, left: 0 });
|
|
29437
29619
|
}, [pageIndex]);
|
|
29438
|
-
return /* @__PURE__ */
|
|
29620
|
+
return /* @__PURE__ */ jsxs73(
|
|
29439
29621
|
"div",
|
|
29440
29622
|
{
|
|
29441
29623
|
className: clx50("flex w-full flex-col overflow-hidden", {
|
|
29442
29624
|
"flex flex-1 flex-col": layout === "fill"
|
|
29443
29625
|
}),
|
|
29444
29626
|
children: [
|
|
29445
|
-
/* @__PURE__ */
|
|
29627
|
+
/* @__PURE__ */ jsx99(
|
|
29446
29628
|
"div",
|
|
29447
29629
|
{
|
|
29448
29630
|
ref: scrollableRef,
|
|
@@ -29451,9 +29633,9 @@ var DataTableRoot = ({
|
|
|
29451
29633
|
"min-h-0 flex-grow overflow-auto": layout === "fill",
|
|
29452
29634
|
"overflow-x-auto": layout === "fit"
|
|
29453
29635
|
}),
|
|
29454
|
-
children: !noResults ? /* @__PURE__ */
|
|
29455
|
-
!noHeader && /* @__PURE__ */
|
|
29456
|
-
return /* @__PURE__ */
|
|
29636
|
+
children: !noResults ? /* @__PURE__ */ jsxs73(Table2, { className: "relative w-full", children: [
|
|
29637
|
+
!noHeader && /* @__PURE__ */ jsx99(Table2.Header, { className: "border-t-0", children: table.getHeaderGroups().map((headerGroup) => {
|
|
29638
|
+
return /* @__PURE__ */ jsx99(
|
|
29457
29639
|
Table2.Row,
|
|
29458
29640
|
{
|
|
29459
29641
|
className: clx50({
|
|
@@ -29469,7 +29651,7 @@ var DataTableRoot = ({
|
|
|
29469
29651
|
);
|
|
29470
29652
|
const isFirstHeader = firstHeader !== -1 ? header.id === headerGroup.headers[firstHeader].id : index === 0;
|
|
29471
29653
|
const isStickyHeader = isSelectHeader || isFirstHeader;
|
|
29472
|
-
return /* @__PURE__ */
|
|
29654
|
+
return /* @__PURE__ */ jsx99(
|
|
29473
29655
|
Table2.HeaderCell,
|
|
29474
29656
|
{
|
|
29475
29657
|
"data-table-header-id": header.id,
|
|
@@ -29493,12 +29675,12 @@ var DataTableRoot = ({
|
|
|
29493
29675
|
headerGroup.id
|
|
29494
29676
|
);
|
|
29495
29677
|
}) }),
|
|
29496
|
-
/* @__PURE__ */
|
|
29678
|
+
/* @__PURE__ */ jsx99(Table2.Body, { className: "border-b-0", children: table.getRowModel().rows.map((row) => {
|
|
29497
29679
|
const to = navigateTo ? navigateTo(row) : void 0;
|
|
29498
29680
|
const isRowDisabled = hasSelect && !row.getCanSelect();
|
|
29499
29681
|
const isOdd = row.depth % 2 !== 0;
|
|
29500
29682
|
const cells = row.getVisibleCells();
|
|
29501
|
-
return /* @__PURE__ */
|
|
29683
|
+
return /* @__PURE__ */ jsx99(
|
|
29502
29684
|
Table2.Row,
|
|
29503
29685
|
{
|
|
29504
29686
|
"data-selected": row.getIsSelected(),
|
|
@@ -29528,7 +29710,7 @@ var DataTableRoot = ({
|
|
|
29528
29710
|
);
|
|
29529
29711
|
const isTabableLink = isFirstCell && !!to;
|
|
29530
29712
|
const shouldRenderAsLink = !!to && !isSelectCell;
|
|
29531
|
-
return /* @__PURE__ */
|
|
29713
|
+
return /* @__PURE__ */ jsx99(
|
|
29532
29714
|
Table2.Cell,
|
|
29533
29715
|
{
|
|
29534
29716
|
className: clx50({
|
|
@@ -29542,14 +29724,14 @@ var DataTableRoot = ({
|
|
|
29542
29724
|
style: {
|
|
29543
29725
|
paddingLeft: depthOffset ? `${depthOffset}px` : void 0
|
|
29544
29726
|
},
|
|
29545
|
-
children: shouldRenderAsLink ? /* @__PURE__ */
|
|
29727
|
+
children: shouldRenderAsLink ? /* @__PURE__ */ jsx99(
|
|
29546
29728
|
Link8,
|
|
29547
29729
|
{
|
|
29548
29730
|
to,
|
|
29549
29731
|
className: "size-full outline-none",
|
|
29550
29732
|
"data-row-link": true,
|
|
29551
29733
|
tabIndex: isTabableLink ? 0 : -1,
|
|
29552
|
-
children: /* @__PURE__ */
|
|
29734
|
+
children: /* @__PURE__ */ jsx99(
|
|
29553
29735
|
"div",
|
|
29554
29736
|
{
|
|
29555
29737
|
className: clx50(
|
|
@@ -29571,10 +29753,10 @@ var DataTableRoot = ({
|
|
|
29571
29753
|
row.id
|
|
29572
29754
|
);
|
|
29573
29755
|
}) })
|
|
29574
|
-
] }) : /* @__PURE__ */
|
|
29756
|
+
] }) : /* @__PURE__ */ jsx99("div", { className: clx50({ "border-b": layout === "fit" }), children: /* @__PURE__ */ jsx99(NoResults, { ...noResultsProps }) })
|
|
29575
29757
|
}
|
|
29576
29758
|
),
|
|
29577
|
-
pagination && /* @__PURE__ */
|
|
29759
|
+
pagination && /* @__PURE__ */ jsx99("div", { className: clx50({ "border-t": layout === "fill" }), children: /* @__PURE__ */ jsx99(
|
|
29578
29760
|
Pagination,
|
|
29579
29761
|
{
|
|
29580
29762
|
canNextPage: table.getCanNextPage(),
|
|
@@ -29587,14 +29769,14 @@ var DataTableRoot = ({
|
|
|
29587
29769
|
pageSize
|
|
29588
29770
|
}
|
|
29589
29771
|
) }),
|
|
29590
|
-
hasCommandBar && /* @__PURE__ */
|
|
29591
|
-
/* @__PURE__ */
|
|
29772
|
+
hasCommandBar && /* @__PURE__ */ jsx99(CommandBar, { open: !!Object.keys(rowSelection).length, children: /* @__PURE__ */ jsxs73(CommandBar.Bar, { children: [
|
|
29773
|
+
/* @__PURE__ */ jsx99(CommandBar.Value, { children: t2("general.countSelected", {
|
|
29592
29774
|
count: Object.keys(rowSelection).length
|
|
29593
29775
|
}) }),
|
|
29594
|
-
/* @__PURE__ */
|
|
29776
|
+
/* @__PURE__ */ jsx99(CommandBar.Seperator, {}),
|
|
29595
29777
|
commands?.map((command, index) => {
|
|
29596
|
-
return /* @__PURE__ */
|
|
29597
|
-
/* @__PURE__ */
|
|
29778
|
+
return /* @__PURE__ */ jsxs73(Fragment12, { children: [
|
|
29779
|
+
/* @__PURE__ */ jsx99(
|
|
29598
29780
|
CommandBar.Command,
|
|
29599
29781
|
{
|
|
29600
29782
|
label: command.label,
|
|
@@ -29607,7 +29789,7 @@ var DataTableRoot = ({
|
|
|
29607
29789
|
)
|
|
29608
29790
|
}
|
|
29609
29791
|
),
|
|
29610
|
-
index < commands.length - 1 && /* @__PURE__ */
|
|
29792
|
+
index < commands.length - 1 && /* @__PURE__ */ jsx99(CommandBar.Seperator, {})
|
|
29611
29793
|
] }, index);
|
|
29612
29794
|
})
|
|
29613
29795
|
] }) })
|
|
@@ -29616,7 +29798,7 @@ var DataTableRoot = ({
|
|
|
29616
29798
|
);
|
|
29617
29799
|
};
|
|
29618
29800
|
var Pagination = (props) => {
|
|
29619
|
-
const { t: t2 } =
|
|
29801
|
+
const { t: t2 } = useTranslation47();
|
|
29620
29802
|
const translations = {
|
|
29621
29803
|
of: t2("general.of"),
|
|
29622
29804
|
results: t2("general.results"),
|
|
@@ -29624,7 +29806,7 @@ var Pagination = (props) => {
|
|
|
29624
29806
|
prev: t2("general.prev"),
|
|
29625
29807
|
next: t2("general.next")
|
|
29626
29808
|
};
|
|
29627
|
-
return /* @__PURE__ */
|
|
29809
|
+
return /* @__PURE__ */ jsx99(
|
|
29628
29810
|
Table2.Pagination,
|
|
29629
29811
|
{
|
|
29630
29812
|
className: "flex-shrink-0",
|
|
@@ -29635,7 +29817,7 @@ var Pagination = (props) => {
|
|
|
29635
29817
|
};
|
|
29636
29818
|
|
|
29637
29819
|
// src/components/table/data-table/data-table.tsx
|
|
29638
|
-
import { jsx as
|
|
29820
|
+
import { jsx as jsx100, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
29639
29821
|
var MemoizedDataTableQuery = memo(DataTableQuery);
|
|
29640
29822
|
var _DataTable = ({
|
|
29641
29823
|
table,
|
|
@@ -29657,7 +29839,7 @@ var _DataTable = ({
|
|
|
29657
29839
|
noResults: noResultsProps = {}
|
|
29658
29840
|
}) => {
|
|
29659
29841
|
if (isLoading) {
|
|
29660
|
-
return /* @__PURE__ */
|
|
29842
|
+
return /* @__PURE__ */ jsx100(
|
|
29661
29843
|
TableSkeleton,
|
|
29662
29844
|
{
|
|
29663
29845
|
layout,
|
|
@@ -29673,7 +29855,7 @@ var _DataTable = ({
|
|
|
29673
29855
|
const showNoResults = !isLoading && count === 0 && !noQuery;
|
|
29674
29856
|
const noRecords = !isLoading && count === 0 && noQuery;
|
|
29675
29857
|
if (noRecords) {
|
|
29676
|
-
return /* @__PURE__ */
|
|
29858
|
+
return /* @__PURE__ */ jsx100(
|
|
29677
29859
|
NoRecords,
|
|
29678
29860
|
{
|
|
29679
29861
|
className: clx51({
|
|
@@ -29683,14 +29865,14 @@ var _DataTable = ({
|
|
|
29683
29865
|
}
|
|
29684
29866
|
);
|
|
29685
29867
|
}
|
|
29686
|
-
return /* @__PURE__ */
|
|
29868
|
+
return /* @__PURE__ */ jsxs74(
|
|
29687
29869
|
"div",
|
|
29688
29870
|
{
|
|
29689
29871
|
className: clx51("divide-y", {
|
|
29690
29872
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
29691
29873
|
}),
|
|
29692
29874
|
children: [
|
|
29693
|
-
/* @__PURE__ */
|
|
29875
|
+
/* @__PURE__ */ jsx100(
|
|
29694
29876
|
MemoizedDataTableQuery,
|
|
29695
29877
|
{
|
|
29696
29878
|
search,
|
|
@@ -29699,7 +29881,7 @@ var _DataTable = ({
|
|
|
29699
29881
|
prefix
|
|
29700
29882
|
}
|
|
29701
29883
|
),
|
|
29702
|
-
/* @__PURE__ */
|
|
29884
|
+
/* @__PURE__ */ jsx100(
|
|
29703
29885
|
DataTableRoot,
|
|
29704
29886
|
{
|
|
29705
29887
|
table,
|
|
@@ -29721,91 +29903,91 @@ var _DataTable = ({
|
|
|
29721
29903
|
|
|
29722
29904
|
// src/components/table/table-cells/common/code-cell/code-cell.tsx
|
|
29723
29905
|
import { Badge as Badge8 } from "@medusajs/ui";
|
|
29724
|
-
import { jsx as
|
|
29906
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
29725
29907
|
var CodeCell = ({ code }) => {
|
|
29726
|
-
return /* @__PURE__ */
|
|
29908
|
+
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
29909
|
};
|
|
29728
29910
|
var CodeHeader = ({ text }) => {
|
|
29729
|
-
return /* @__PURE__ */
|
|
29911
|
+
return /* @__PURE__ */ jsx101("div", { className: " flex h-full w-full items-center ", children: /* @__PURE__ */ jsx101("span", { children: text }) });
|
|
29730
29912
|
};
|
|
29731
29913
|
|
|
29732
29914
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
29733
29915
|
import { Tooltip as Tooltip13 } from "@medusajs/ui";
|
|
29734
|
-
import { useTranslation as
|
|
29916
|
+
import { useTranslation as useTranslation48 } from "react-i18next";
|
|
29735
29917
|
|
|
29736
29918
|
// src/components/table/table-cells/common/placeholder-cell/placeholder-cell.tsx
|
|
29737
|
-
import { jsx as
|
|
29919
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
29738
29920
|
var PlaceholderCell = () => {
|
|
29739
|
-
return /* @__PURE__ */
|
|
29921
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx102("span", { className: "text-ui-fg-muted", children: "-" }) });
|
|
29740
29922
|
};
|
|
29741
29923
|
|
|
29742
29924
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
29743
|
-
import { jsx as
|
|
29925
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
29744
29926
|
var CreatedAtCell = ({ date }) => {
|
|
29745
29927
|
const { getFullDate } = useDate();
|
|
29746
29928
|
if (!date) {
|
|
29747
|
-
return /* @__PURE__ */
|
|
29929
|
+
return /* @__PURE__ */ jsx103(PlaceholderCell, {});
|
|
29748
29930
|
}
|
|
29749
|
-
return /* @__PURE__ */
|
|
29931
|
+
return /* @__PURE__ */ jsx103("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx103(
|
|
29750
29932
|
Tooltip13,
|
|
29751
29933
|
{
|
|
29752
29934
|
className: "z-10",
|
|
29753
|
-
content: /* @__PURE__ */
|
|
29935
|
+
content: /* @__PURE__ */ jsx103("span", { className: "text-pretty", children: `${getFullDate({
|
|
29754
29936
|
date,
|
|
29755
29937
|
includeTime: true
|
|
29756
29938
|
})}` }),
|
|
29757
|
-
children: /* @__PURE__ */
|
|
29939
|
+
children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: getFullDate({ date, includeTime: true }) })
|
|
29758
29940
|
}
|
|
29759
29941
|
) });
|
|
29760
29942
|
};
|
|
29761
29943
|
var CreatedAtHeader = () => {
|
|
29762
|
-
const { t: t2 } =
|
|
29763
|
-
return /* @__PURE__ */
|
|
29944
|
+
const { t: t2 } = useTranslation48();
|
|
29945
|
+
return /* @__PURE__ */ jsx103("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: t2("fields.createdAt") }) });
|
|
29764
29946
|
};
|
|
29765
29947
|
|
|
29766
29948
|
// src/components/table/table-cells/common/date-cell/date-cell.tsx
|
|
29767
29949
|
import { Tooltip as Tooltip14 } from "@medusajs/ui";
|
|
29768
|
-
import { useTranslation as
|
|
29769
|
-
import { jsx as
|
|
29950
|
+
import { useTranslation as useTranslation49 } from "react-i18next";
|
|
29951
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
29770
29952
|
var DateCell = ({ date }) => {
|
|
29771
29953
|
const { getFullDate } = useDate();
|
|
29772
29954
|
if (!date) {
|
|
29773
|
-
return /* @__PURE__ */
|
|
29955
|
+
return /* @__PURE__ */ jsx104(PlaceholderCell, {});
|
|
29774
29956
|
}
|
|
29775
|
-
return /* @__PURE__ */
|
|
29957
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx104(
|
|
29776
29958
|
Tooltip14,
|
|
29777
29959
|
{
|
|
29778
29960
|
className: "z-10",
|
|
29779
|
-
content: /* @__PURE__ */
|
|
29961
|
+
content: /* @__PURE__ */ jsx104("span", { className: "text-pretty", children: `${getFullDate({
|
|
29780
29962
|
date,
|
|
29781
29963
|
includeTime: true
|
|
29782
29964
|
})}` }),
|
|
29783
|
-
children: /* @__PURE__ */
|
|
29965
|
+
children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: getFullDate({ date, includeTime: false }) })
|
|
29784
29966
|
}
|
|
29785
29967
|
) });
|
|
29786
29968
|
};
|
|
29787
29969
|
var DateHeader = () => {
|
|
29788
|
-
const { t: t2 } =
|
|
29789
|
-
return /* @__PURE__ */
|
|
29970
|
+
const { t: t2 } = useTranslation49();
|
|
29971
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: t2("fields.date") }) });
|
|
29790
29972
|
};
|
|
29791
29973
|
|
|
29792
29974
|
// src/components/table/table-cells/common/email-cell/email-cell.tsx
|
|
29793
|
-
import { useTranslation as
|
|
29794
|
-
import { jsx as
|
|
29975
|
+
import { useTranslation as useTranslation50 } from "react-i18next";
|
|
29976
|
+
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
29795
29977
|
var EmailCell = ({ email }) => {
|
|
29796
29978
|
if (!email) {
|
|
29797
|
-
return /* @__PURE__ */
|
|
29979
|
+
return /* @__PURE__ */ jsx105(PlaceholderCell, {});
|
|
29798
29980
|
}
|
|
29799
|
-
return /* @__PURE__ */
|
|
29981
|
+
return /* @__PURE__ */ jsx105("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx105("span", { className: "truncate", children: email }) });
|
|
29800
29982
|
};
|
|
29801
29983
|
var EmailHeader = () => {
|
|
29802
|
-
const { t: t2 } =
|
|
29803
|
-
return /* @__PURE__ */
|
|
29984
|
+
const { t: t2 } = useTranslation50();
|
|
29985
|
+
return /* @__PURE__ */ jsx105("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx105("span", { className: "truncate", children: t2("fields.email") }) });
|
|
29804
29986
|
};
|
|
29805
29987
|
|
|
29806
29988
|
// src/components/table/table-cells/common/money-amount-cell/money-amount-cell.tsx
|
|
29807
29989
|
import { clx as clx52 } from "@medusajs/ui";
|
|
29808
|
-
import { jsx as
|
|
29990
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
29809
29991
|
var MoneyAmountCell = ({
|
|
29810
29992
|
currencyCode,
|
|
29811
29993
|
amount,
|
|
@@ -29813,10 +29995,10 @@ var MoneyAmountCell = ({
|
|
|
29813
29995
|
className
|
|
29814
29996
|
}) => {
|
|
29815
29997
|
if (typeof amount === "undefined" || amount === null) {
|
|
29816
|
-
return /* @__PURE__ */
|
|
29998
|
+
return /* @__PURE__ */ jsx106(PlaceholderCell, {});
|
|
29817
29999
|
}
|
|
29818
30000
|
const formatted = getStylizedAmount(amount, currencyCode);
|
|
29819
|
-
return /* @__PURE__ */
|
|
30001
|
+
return /* @__PURE__ */ jsx106(
|
|
29820
30002
|
"div",
|
|
29821
30003
|
{
|
|
29822
30004
|
className: clx52(
|
|
@@ -29827,37 +30009,37 @@ var MoneyAmountCell = ({
|
|
|
29827
30009
|
},
|
|
29828
30010
|
className
|
|
29829
30011
|
),
|
|
29830
|
-
children: /* @__PURE__ */
|
|
30012
|
+
children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: formatted })
|
|
29831
30013
|
}
|
|
29832
30014
|
);
|
|
29833
30015
|
};
|
|
29834
30016
|
|
|
29835
30017
|
// src/components/table/table-cells/common/name-cell/name-cell.tsx
|
|
29836
|
-
import { useTranslation as
|
|
29837
|
-
import { jsx as
|
|
30018
|
+
import { useTranslation as useTranslation51 } from "react-i18next";
|
|
30019
|
+
import { jsx as jsx107 } from "react/jsx-runtime";
|
|
29838
30020
|
var NameCell = ({ firstName, lastName }) => {
|
|
29839
30021
|
if (!firstName && !lastName) {
|
|
29840
|
-
return /* @__PURE__ */
|
|
30022
|
+
return /* @__PURE__ */ jsx107(PlaceholderCell, {});
|
|
29841
30023
|
}
|
|
29842
30024
|
const name = [firstName, lastName].filter(Boolean).join(" ");
|
|
29843
|
-
return /* @__PURE__ */
|
|
30025
|
+
return /* @__PURE__ */ jsx107("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx107("span", { className: "truncate", children: name }) });
|
|
29844
30026
|
};
|
|
29845
30027
|
var NameHeader = () => {
|
|
29846
|
-
const { t: t2 } =
|
|
29847
|
-
return /* @__PURE__ */
|
|
30028
|
+
const { t: t2 } = useTranslation51();
|
|
30029
|
+
return /* @__PURE__ */ jsx107("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx107("span", { className: "truncate", children: t2("fields.name") }) });
|
|
29848
30030
|
};
|
|
29849
30031
|
|
|
29850
30032
|
// src/components/table/table-cells/common/status-cell/status-cell.tsx
|
|
29851
30033
|
import { clx as clx53 } from "@medusajs/ui";
|
|
29852
|
-
import { jsx as
|
|
30034
|
+
import { jsx as jsx108, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
29853
30035
|
var StatusCell = ({ color, children }) => {
|
|
29854
|
-
return /* @__PURE__ */
|
|
29855
|
-
/* @__PURE__ */
|
|
30036
|
+
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: [
|
|
30037
|
+
/* @__PURE__ */ jsx108(
|
|
29856
30038
|
"div",
|
|
29857
30039
|
{
|
|
29858
30040
|
role: "presentation",
|
|
29859
30041
|
className: "flex h-5 w-2 items-center justify-center",
|
|
29860
|
-
children: /* @__PURE__ */
|
|
30042
|
+
children: /* @__PURE__ */ jsx108(
|
|
29861
30043
|
"div",
|
|
29862
30044
|
{
|
|
29863
30045
|
className: clx53(
|
|
@@ -29875,19 +30057,19 @@ var StatusCell = ({ color, children }) => {
|
|
|
29875
30057
|
)
|
|
29876
30058
|
}
|
|
29877
30059
|
),
|
|
29878
|
-
/* @__PURE__ */
|
|
30060
|
+
/* @__PURE__ */ jsx108("span", { className: "truncate", children })
|
|
29879
30061
|
] });
|
|
29880
30062
|
};
|
|
29881
30063
|
|
|
29882
30064
|
// src/components/table/table-cells/common/text-cell/text-cell.tsx
|
|
29883
30065
|
import { clx as clx54 } from "@medusajs/ui";
|
|
29884
|
-
import { jsx as
|
|
30066
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
29885
30067
|
var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
29886
30068
|
if (!text) {
|
|
29887
|
-
return /* @__PURE__ */
|
|
30069
|
+
return /* @__PURE__ */ jsx109(PlaceholderCell, {});
|
|
29888
30070
|
}
|
|
29889
30071
|
const stringLength = text.toString().length;
|
|
29890
|
-
return /* @__PURE__ */
|
|
30072
|
+
return /* @__PURE__ */ jsx109(ConditionalTooltip, { content: text, showTooltip: stringLength > 20, children: /* @__PURE__ */ jsx109(
|
|
29891
30073
|
"div",
|
|
29892
30074
|
{
|
|
29893
30075
|
className: clx54("flex h-full w-full items-center gap-x-3 overflow-hidden", {
|
|
@@ -29898,22 +30080,22 @@ var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
|
29898
30080
|
style: {
|
|
29899
30081
|
maxWidth
|
|
29900
30082
|
},
|
|
29901
|
-
children: /* @__PURE__ */
|
|
30083
|
+
children: /* @__PURE__ */ jsx109("span", { className: "truncate", children: text })
|
|
29902
30084
|
}
|
|
29903
30085
|
) });
|
|
29904
30086
|
};
|
|
29905
30087
|
var TextHeader = ({ text, align = "left" }) => {
|
|
29906
|
-
return /* @__PURE__ */
|
|
30088
|
+
return /* @__PURE__ */ jsx109("div", { className: clx54("flex h-full w-full items-center", {
|
|
29907
30089
|
"justify-start text-start": align === "left",
|
|
29908
30090
|
"justify-center text-center": align === "center",
|
|
29909
30091
|
"justify-end text-end": align === "right"
|
|
29910
|
-
}), children: /* @__PURE__ */
|
|
30092
|
+
}), children: /* @__PURE__ */ jsx109("span", { className: "truncate", children: text }) });
|
|
29911
30093
|
};
|
|
29912
30094
|
|
|
29913
30095
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29914
30096
|
import { ExclamationCircle as ExclamationCircle4 } from "@medusajs/icons";
|
|
29915
30097
|
import { Text as Text22 } from "@medusajs/ui";
|
|
29916
|
-
import { useTranslation as
|
|
30098
|
+
import { useTranslation as useTranslation52 } from "react-i18next";
|
|
29917
30099
|
import { Navigate, useLocation as useLocation3, useRouteError } from "react-router-dom";
|
|
29918
30100
|
|
|
29919
30101
|
// src/lib/is-fetch-error.ts
|
|
@@ -29923,15 +30105,15 @@ var isClientError = (error) => {
|
|
|
29923
30105
|
};
|
|
29924
30106
|
|
|
29925
30107
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29926
|
-
import { jsx as
|
|
30108
|
+
import { jsx as jsx110, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
29927
30109
|
var ErrorBoundary = () => {
|
|
29928
30110
|
const error = useRouteError();
|
|
29929
30111
|
const location = useLocation3();
|
|
29930
|
-
const { t: t2 } =
|
|
30112
|
+
const { t: t2 } = useTranslation52();
|
|
29931
30113
|
let code = null;
|
|
29932
30114
|
if (isClientError(error)) {
|
|
29933
30115
|
if (error.status === 401) {
|
|
29934
|
-
return /* @__PURE__ */
|
|
30116
|
+
return /* @__PURE__ */ jsx110(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
29935
30117
|
}
|
|
29936
30118
|
code = error.status ?? null;
|
|
29937
30119
|
}
|
|
@@ -29958,11 +30140,11 @@ var ErrorBoundary = () => {
|
|
|
29958
30140
|
message = t2("errorBoundary.defaultMessage");
|
|
29959
30141
|
break;
|
|
29960
30142
|
}
|
|
29961
|
-
return /* @__PURE__ */
|
|
29962
|
-
/* @__PURE__ */
|
|
29963
|
-
/* @__PURE__ */
|
|
29964
|
-
/* @__PURE__ */
|
|
29965
|
-
/* @__PURE__ */
|
|
30143
|
+
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: [
|
|
30144
|
+
/* @__PURE__ */ jsx110(ExclamationCircle4, {}),
|
|
30145
|
+
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
30146
|
+
/* @__PURE__ */ jsx110(Text22, { size: "small", leading: "compact", weight: "plus", children: title }),
|
|
30147
|
+
/* @__PURE__ */ jsx110(
|
|
29966
30148
|
Text22,
|
|
29967
30149
|
{
|
|
29968
30150
|
size: "small",
|
|
@@ -29975,9 +30157,9 @@ var ErrorBoundary = () => {
|
|
|
29975
30157
|
};
|
|
29976
30158
|
|
|
29977
30159
|
// src/components/utilities/visually-hidden/visually-hidden.tsx
|
|
29978
|
-
import { jsx as
|
|
30160
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
29979
30161
|
var VisuallyHidden = ({ children }) => {
|
|
29980
|
-
return /* @__PURE__ */
|
|
30162
|
+
return /* @__PURE__ */ jsx111("span", { className: "sr-only", children });
|
|
29981
30163
|
};
|
|
29982
30164
|
|
|
29983
30165
|
// src/hooks/use-data-table.tsx
|
|
@@ -30073,7 +30255,7 @@ var useDataTable2 = ({
|
|
|
30073
30255
|
|
|
30074
30256
|
// src/permissions/permissions-provider.tsx
|
|
30075
30257
|
import { useCallback as useCallback29, useMemo as useMemo28 } from "react";
|
|
30076
|
-
import { jsx as
|
|
30258
|
+
import { jsx as jsx112 } from "react/jsx-runtime";
|
|
30077
30259
|
var PermissionsProvider = ({
|
|
30078
30260
|
permissions = null,
|
|
30079
30261
|
isLoading = false,
|
|
@@ -30114,7 +30296,7 @@ var PermissionsProvider = ({
|
|
|
30114
30296
|
}),
|
|
30115
30297
|
[permissions, isLoading, isEnforced, hasPermission, hasAnyPermission, hasAllPermissions, can]
|
|
30116
30298
|
);
|
|
30117
|
-
return /* @__PURE__ */
|
|
30299
|
+
return /* @__PURE__ */ jsx112(PermissionsContext.Provider, { value, children });
|
|
30118
30300
|
};
|
|
30119
30301
|
|
|
30120
30302
|
// src/permissions/use-permissions.tsx
|
|
@@ -30128,7 +30310,7 @@ var usePermissions = () => {
|
|
|
30128
30310
|
};
|
|
30129
30311
|
|
|
30130
30312
|
// src/permissions/permission-guard.tsx
|
|
30131
|
-
import { Fragment as Fragment13, jsx as
|
|
30313
|
+
import { Fragment as Fragment13, jsx as jsx113 } from "react/jsx-runtime";
|
|
30132
30314
|
var PermissionGuard = ({
|
|
30133
30315
|
children,
|
|
30134
30316
|
permission,
|
|
@@ -30138,16 +30320,16 @@ var PermissionGuard = ({
|
|
|
30138
30320
|
const { hasAnyPermission, hasAllPermissions } = usePermissions();
|
|
30139
30321
|
const list = Array.isArray(permission) ? permission : [permission];
|
|
30140
30322
|
const allowed = requireAll ? hasAllPermissions(list) : hasAnyPermission(list);
|
|
30141
|
-
return /* @__PURE__ */
|
|
30323
|
+
return /* @__PURE__ */ jsx113(Fragment13, { children: allowed ? children : fallback });
|
|
30142
30324
|
};
|
|
30143
30325
|
|
|
30144
30326
|
// src/permissions/route-permission-guard.tsx
|
|
30145
30327
|
import { ExclamationCircle as ExclamationCircle5 } from "@medusajs/icons";
|
|
30146
|
-
import { Container as
|
|
30328
|
+
import { Container as Container7, Heading as Heading11, Text as Text23 } from "@medusajs/ui";
|
|
30147
30329
|
import { useMemo as useMemo29 } from "react";
|
|
30148
|
-
import { useTranslation as
|
|
30330
|
+
import { useTranslation as useTranslation53 } from "react-i18next";
|
|
30149
30331
|
import { Navigate as Navigate2, Outlet as Outlet3, useMatches } from "react-router-dom";
|
|
30150
|
-
import { jsx as
|
|
30332
|
+
import { jsx as jsx114, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
30151
30333
|
var readRequirementFromHandle = (handle) => {
|
|
30152
30334
|
if (!handle || typeof handle !== "object") {
|
|
30153
30335
|
return void 0;
|
|
@@ -30187,28 +30369,28 @@ var RoutePermissionGuard = () => {
|
|
|
30187
30369
|
return void 0;
|
|
30188
30370
|
}, [matches]);
|
|
30189
30371
|
if (isLoading || !requirement) {
|
|
30190
|
-
return /* @__PURE__ */
|
|
30372
|
+
return /* @__PURE__ */ jsx114(Outlet3, {});
|
|
30191
30373
|
}
|
|
30192
30374
|
const hasAccess = requirement.requireAll ? hasAllPermissions(requirement.permissions) : hasAnyPermission(requirement.permissions);
|
|
30193
30375
|
if (!hasAccess) {
|
|
30194
30376
|
if (requirement.redirectTo) {
|
|
30195
|
-
return /* @__PURE__ */
|
|
30377
|
+
return /* @__PURE__ */ jsx114(Navigate2, { to: requirement.redirectTo, replace: true });
|
|
30196
30378
|
}
|
|
30197
|
-
return /* @__PURE__ */
|
|
30379
|
+
return /* @__PURE__ */ jsx114(AccessDenied, { requirement });
|
|
30198
30380
|
}
|
|
30199
|
-
return /* @__PURE__ */
|
|
30381
|
+
return /* @__PURE__ */ jsx114(Outlet3, {});
|
|
30200
30382
|
};
|
|
30201
30383
|
var AccessDenied = ({
|
|
30202
30384
|
requirement
|
|
30203
30385
|
}) => {
|
|
30204
|
-
const { t: t2 } =
|
|
30205
|
-
return /* @__PURE__ */
|
|
30206
|
-
/* @__PURE__ */
|
|
30207
|
-
/* @__PURE__ */
|
|
30208
|
-
/* @__PURE__ */
|
|
30209
|
-
/* @__PURE__ */
|
|
30386
|
+
const { t: t2 } = useTranslation53();
|
|
30387
|
+
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: [
|
|
30388
|
+
/* @__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" }) }),
|
|
30389
|
+
/* @__PURE__ */ jsxs77("div", { className: "flex flex-col gap-y-1", children: [
|
|
30390
|
+
/* @__PURE__ */ jsx114(Heading11, { level: "h2", children: t2("permissions.accessDenied.title") }),
|
|
30391
|
+
/* @__PURE__ */ jsx114(Text23, { className: "text-ui-fg-subtle", children: t2("permissions.accessDenied.description") })
|
|
30210
30392
|
] }),
|
|
30211
|
-
/* @__PURE__ */
|
|
30393
|
+
/* @__PURE__ */ jsx114(Text23, { size: "small", className: "text-ui-fg-muted", children: t2("permissions.accessDenied.requiredPermission", {
|
|
30212
30394
|
permission: requirement.permissions.join(", ")
|
|
30213
30395
|
}) })
|
|
30214
30396
|
] }) }) });
|
|
@@ -30239,7 +30421,7 @@ import {
|
|
|
30239
30421
|
cloneElement as cloneElement2,
|
|
30240
30422
|
isValidElement
|
|
30241
30423
|
} from "react";
|
|
30242
|
-
import { jsx as
|
|
30424
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
30243
30425
|
var PermissionAction = ({
|
|
30244
30426
|
permission,
|
|
30245
30427
|
requireAll = false,
|
|
@@ -30251,16 +30433,16 @@ var PermissionAction = ({
|
|
|
30251
30433
|
}
|
|
30252
30434
|
const inner = children.props.children;
|
|
30253
30435
|
const label = children.props.asChild && isValidElement(inner) ? inner.props.children : inner;
|
|
30254
|
-
return /* @__PURE__ */
|
|
30436
|
+
return /* @__PURE__ */ jsx115(Tooltip15, { content: gate.tooltip, children: /* @__PURE__ */ jsx115("span", { className: "inline-flex", children: cloneElement2(children, { disabled: true, asChild: false }, label) }) });
|
|
30255
30437
|
};
|
|
30256
30438
|
|
|
30257
30439
|
// src/permissions/section-no-access.tsx
|
|
30258
30440
|
import { Text as Text24 } from "@medusajs/ui";
|
|
30259
|
-
import { useTranslation as
|
|
30260
|
-
import { jsx as
|
|
30441
|
+
import { useTranslation as useTranslation54 } from "react-i18next";
|
|
30442
|
+
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
30261
30443
|
var SectionNoAccess = ({ className }) => {
|
|
30262
|
-
const { t: t2 } =
|
|
30263
|
-
return /* @__PURE__ */
|
|
30444
|
+
const { t: t2 } = useTranslation54();
|
|
30445
|
+
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
30446
|
};
|
|
30265
30447
|
|
|
30266
30448
|
// src/permissions/with-permission.ts
|
|
@@ -30287,7 +30469,7 @@ var SidebarContext = createContext11(null);
|
|
|
30287
30469
|
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
30288
30470
|
import { useCallback as useCallback30, useEffect as useEffect27, useMemo as useMemo31, useState as useState41 } from "react";
|
|
30289
30471
|
import { useLocation as useLocation4 } from "react-router-dom";
|
|
30290
|
-
import { jsx as
|
|
30472
|
+
import { jsx as jsx117 } from "react/jsx-runtime";
|
|
30291
30473
|
var SidebarProvider = ({ children }) => {
|
|
30292
30474
|
const [desktop, setDesktop] = useState41(true);
|
|
30293
30475
|
const [mobile, setMobile] = useState41(false);
|
|
@@ -30313,7 +30495,7 @@ var SidebarProvider = ({ children }) => {
|
|
|
30313
30495
|
}),
|
|
30314
30496
|
[desktop, mobile, toggle]
|
|
30315
30497
|
);
|
|
30316
|
-
return /* @__PURE__ */
|
|
30498
|
+
return /* @__PURE__ */ jsx117(SidebarContext.Provider, { value, children });
|
|
30317
30499
|
};
|
|
30318
30500
|
|
|
30319
30501
|
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
@@ -30370,9 +30552,9 @@ import {
|
|
|
30370
30552
|
|
|
30371
30553
|
// src/layout-composer/entry.tsx
|
|
30372
30554
|
import { Fragment as Fragment14 } from "react";
|
|
30373
|
-
import { jsx as
|
|
30555
|
+
import { jsx as jsx118 } from "react/jsx-runtime";
|
|
30374
30556
|
function LayoutEntry({ children }) {
|
|
30375
|
-
return /* @__PURE__ */
|
|
30557
|
+
return /* @__PURE__ */ jsx118(Fragment14, { children });
|
|
30376
30558
|
}
|
|
30377
30559
|
LayoutEntry.displayName = "LayoutEntry";
|
|
30378
30560
|
|
|
@@ -30488,7 +30670,7 @@ function buildDisplayEntries(raw, preference, validSections) {
|
|
|
30488
30670
|
}
|
|
30489
30671
|
|
|
30490
30672
|
// src/layout-composer/layout-composer.tsx
|
|
30491
|
-
import { jsx as
|
|
30673
|
+
import { jsx as jsx119, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
30492
30674
|
var LayoutComposerRoot = ({
|
|
30493
30675
|
widgetsZonePrefix,
|
|
30494
30676
|
preferredLayoutId,
|
|
@@ -30526,12 +30708,12 @@ var LayoutComposerRoot = ({
|
|
|
30526
30708
|
}
|
|
30527
30709
|
const rendered = {};
|
|
30528
30710
|
for (const section of layout.sections) {
|
|
30529
|
-
rendered[section.id] = (entriesBySection[section.id] ?? []).filter((entry) => !entry.hidden).map((entry) => /* @__PURE__ */
|
|
30711
|
+
rendered[section.id] = (entriesBySection[section.id] ?? []).filter((entry) => !entry.hidden).map((entry) => /* @__PURE__ */ jsx119(Fragment16, { children: entry.render(data) }, entry.entryId));
|
|
30530
30712
|
}
|
|
30531
30713
|
const LayoutComponent = layout.Component;
|
|
30532
|
-
return /* @__PURE__ */
|
|
30533
|
-
/* @__PURE__ */
|
|
30534
|
-
hasOutlet && /* @__PURE__ */
|
|
30714
|
+
return /* @__PURE__ */ jsxs78("div", { className: "flex w-full flex-col gap-y-3", "data-testid": testId, children: [
|
|
30715
|
+
/* @__PURE__ */ jsx119(LayoutComponent, { sections: rendered, data, ...layoutProps }),
|
|
30716
|
+
hasOutlet && /* @__PURE__ */ jsx119(Outlet4, {})
|
|
30535
30717
|
] });
|
|
30536
30718
|
};
|
|
30537
30719
|
var LayoutComposer = Object.assign(LayoutComposerRoot, {
|
|
@@ -30539,11 +30721,11 @@ var LayoutComposer = Object.assign(LayoutComposerRoot, {
|
|
|
30539
30721
|
});
|
|
30540
30722
|
|
|
30541
30723
|
// src/layout-composer/detail-page-defaults.tsx
|
|
30542
|
-
import { Fragment as Fragment17, jsx as
|
|
30724
|
+
import { Fragment as Fragment17, jsx as jsx120, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
30543
30725
|
function detailPageDefaultEntries(data, { metadata = true, jsonView = true } = {}) {
|
|
30544
|
-
return /* @__PURE__ */
|
|
30545
|
-
metadata && /* @__PURE__ */
|
|
30546
|
-
jsonView && /* @__PURE__ */
|
|
30726
|
+
return /* @__PURE__ */ jsxs79(Fragment17, { children: [
|
|
30727
|
+
metadata && /* @__PURE__ */ jsx120(LayoutEntry, { id: "MetadataSection", children: /* @__PURE__ */ jsx120(MetadataSection, { data }) }),
|
|
30728
|
+
jsonView && /* @__PURE__ */ jsx120(LayoutEntry, { id: "JsonViewSection", children: /* @__PURE__ */ jsx120(JsonViewSection, { data }) })
|
|
30547
30729
|
] });
|
|
30548
30730
|
}
|
|
30549
30731
|
|
|
@@ -30832,6 +31014,7 @@ export {
|
|
|
30832
31014
|
TwoColumnLayoutComponent,
|
|
30833
31015
|
TwoColumnPage,
|
|
30834
31016
|
TwoColumnPageSkeleton,
|
|
31017
|
+
VariantAttributeSection,
|
|
30835
31018
|
VisuallyHidden,
|
|
30836
31019
|
WidgetZone,
|
|
30837
31020
|
_DataTable,
|