@mercurjs/dashboard-shared 2.3.8-canary.2 → 2.3.8-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +154 -3
- package/dist/index.js +723 -318
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -13428,6 +13428,14 @@ var useDocumentDirection = () => {
|
|
|
13428
13428
|
import { useContext, useMemo } from "react";
|
|
13429
13429
|
|
|
13430
13430
|
// ../dashboard-sdk/dist/index.js
|
|
13431
|
+
var CORE_LAYOUT_IDS = {
|
|
13432
|
+
SINGLE_COLUMN: "core:single-column",
|
|
13433
|
+
TWO_COLUMN: "core:two-column"
|
|
13434
|
+
};
|
|
13435
|
+
var NAV_ZONES = {
|
|
13436
|
+
MAIN: "nav.main",
|
|
13437
|
+
SETTINGS: "nav.settings"
|
|
13438
|
+
};
|
|
13431
13439
|
var PERMISSION_RIGHT_RANK = {
|
|
13432
13440
|
view: 1,
|
|
13433
13441
|
edit: 2,
|
|
@@ -25982,6 +25990,58 @@ import {
|
|
|
25982
25990
|
} from "@medusajs/ui";
|
|
25983
25991
|
import { useTranslation as useTranslation35 } from "react-i18next";
|
|
25984
25992
|
|
|
25993
|
+
// src/extensions/preferences.ts
|
|
25994
|
+
function mergeLayoutPreferences(layers) {
|
|
25995
|
+
const result = {};
|
|
25996
|
+
for (const layer of layers) {
|
|
25997
|
+
for (const [zone, preference] of Object.entries(layer ?? {})) {
|
|
25998
|
+
const current = result[zone] ?? {};
|
|
25999
|
+
const entries = { ...current.entries ?? {} };
|
|
26000
|
+
for (const [id, entry] of Object.entries(preference.entries ?? {})) {
|
|
26001
|
+
entries[id] = { ...entries[id] ?? {}, ...entry };
|
|
26002
|
+
}
|
|
26003
|
+
const groups = new Map((current.groups ?? []).map((group) => [group.id, group]));
|
|
26004
|
+
for (const group of preference.groups ?? []) {
|
|
26005
|
+
groups.set(group.id, { ...groups.get(group.id) ?? {}, ...group });
|
|
26006
|
+
}
|
|
26007
|
+
result[zone] = {
|
|
26008
|
+
...Object.keys(entries).length ? { entries } : {},
|
|
26009
|
+
...groups.size ? { groups: [...groups.values()] } : {}
|
|
26010
|
+
};
|
|
26011
|
+
}
|
|
26012
|
+
}
|
|
26013
|
+
return result;
|
|
26014
|
+
}
|
|
26015
|
+
var NAV_ENTRY_PREFIX = "nav:";
|
|
26016
|
+
var navId = (entryId) => entryId.slice(NAV_ENTRY_PREFIX.length).replace(/^\//, "");
|
|
26017
|
+
function navOverridesFromPreferences(navigation, zones) {
|
|
26018
|
+
const items = new Map(navigation.items.map((item) => [item.id, { ...item }]));
|
|
26019
|
+
const groups = new Map(navigation.groups.map((group) => [group.id, { ...group }]));
|
|
26020
|
+
for (const zone of zones) {
|
|
26021
|
+
for (const group of zone?.groups ?? []) {
|
|
26022
|
+
groups.set(group.id, { ...groups.get(group.id) ?? {}, ...group });
|
|
26023
|
+
}
|
|
26024
|
+
for (const [entryId, entry] of Object.entries(zone?.entries ?? {})) {
|
|
26025
|
+
if (!entryId.startsWith(NAV_ENTRY_PREFIX)) continue;
|
|
26026
|
+
const id = navId(entryId);
|
|
26027
|
+
items.set(id, { ...items.get(id) ?? { id }, ...toNavOverride(id, entry) });
|
|
26028
|
+
}
|
|
26029
|
+
}
|
|
26030
|
+
return { items: [...items.values()], groups: [...groups.values()] };
|
|
26031
|
+
}
|
|
26032
|
+
function toNavOverride(id, entry) {
|
|
26033
|
+
const override2 = { id };
|
|
26034
|
+
if (entry.hidden !== void 0) override2.hidden = entry.hidden;
|
|
26035
|
+
if (entry.order !== void 0) override2.rank = entry.order;
|
|
26036
|
+
if (entry.label !== void 0) override2.label = entry.label;
|
|
26037
|
+
if (entry.icon !== void 0) override2.icon = entry.icon;
|
|
26038
|
+
if (entry.section !== void 0) override2.group = entry.section;
|
|
26039
|
+
if ("parent" in entry) {
|
|
26040
|
+
override2.nested = entry.parent === null ? null : entry.parent?.replace(/^\//, "");
|
|
26041
|
+
}
|
|
26042
|
+
return override2;
|
|
26043
|
+
}
|
|
26044
|
+
|
|
25985
26045
|
// src/extensions/registry.ts
|
|
25986
26046
|
var PLACEMENTS = ["before", "after"];
|
|
25987
26047
|
function splitZone(zone) {
|
|
@@ -25998,13 +26058,76 @@ function splitZone(zone) {
|
|
|
25998
26058
|
var ExtensionRegistry = class {
|
|
25999
26059
|
constructor(input = {}) {
|
|
26000
26060
|
__publicField(this, "widgets", /* @__PURE__ */ new Map());
|
|
26061
|
+
__publicField(this, "rawWidgets", []);
|
|
26001
26062
|
__publicField(this, "navOverrides", []);
|
|
26002
26063
|
__publicField(this, "navGroups", []);
|
|
26003
26064
|
__publicField(this, "customFields", []);
|
|
26004
|
-
this
|
|
26005
|
-
this
|
|
26006
|
-
this.
|
|
26065
|
+
__publicField(this, "layouts", /* @__PURE__ */ new Map());
|
|
26066
|
+
__publicField(this, "preferences", {});
|
|
26067
|
+
this.rawWidgets = input.widgets?.widgets ?? [];
|
|
26068
|
+
this.populateWidgets(this.rawWidgets);
|
|
26007
26069
|
this.customFields = input.customFields?.configs ?? [];
|
|
26070
|
+
for (const layout of input.layouts?.layouts ?? []) {
|
|
26071
|
+
this.layouts.set(layout.id, layout);
|
|
26072
|
+
}
|
|
26073
|
+
this.preferences = mergeLayoutPreferences(input.preferences?.layers ?? []);
|
|
26074
|
+
const nav = navOverridesFromPreferences(
|
|
26075
|
+
{ items: input.navigation?.items ?? [], groups: input.navigation?.groups ?? [] },
|
|
26076
|
+
[this.preferences[NAV_ZONES.MAIN], this.preferences[NAV_ZONES.SETTINGS]]
|
|
26077
|
+
);
|
|
26078
|
+
this.navOverrides = nav.items;
|
|
26079
|
+
this.navGroups = nav.groups;
|
|
26080
|
+
}
|
|
26081
|
+
getLayout(id) {
|
|
26082
|
+
return this.layouts.get(id);
|
|
26083
|
+
}
|
|
26084
|
+
registerLayouts(layouts) {
|
|
26085
|
+
for (const layout of layouts) {
|
|
26086
|
+
if (!this.layouts.has(layout.id)) this.layouts.set(layout.id, layout);
|
|
26087
|
+
}
|
|
26088
|
+
}
|
|
26089
|
+
getLayoutPreference(zone) {
|
|
26090
|
+
return this.preferences[zone] ?? {};
|
|
26091
|
+
}
|
|
26092
|
+
/**
|
|
26093
|
+
* Widgets for a composer page, keyed by the layout section each lands in. A
|
|
26094
|
+
* zone is the page prefix (`product.details`) or a section under it
|
|
26095
|
+
* (`product.details.side`); the legacy `.before` / `.after` suffixes map to
|
|
26096
|
+
* the first and last order of that section. An explicit `section` wins.
|
|
26097
|
+
*/
|
|
26098
|
+
getWidgetsForSections(prefix, sections) {
|
|
26099
|
+
const result = {};
|
|
26100
|
+
const defaultSection = sections.includes("main") ? "main" : sections[0];
|
|
26101
|
+
const seen = /* @__PURE__ */ new Map();
|
|
26102
|
+
for (const widget of this.rawWidgets) {
|
|
26103
|
+
for (const zone of widget.zone) {
|
|
26104
|
+
if (zone !== prefix && !zone.startsWith(`${prefix}.`)) continue;
|
|
26105
|
+
let suffix = zone === prefix ? "" : zone.slice(prefix.length + 1);
|
|
26106
|
+
let order = widget.order;
|
|
26107
|
+
if (suffix === "before" || suffix.endsWith(".before")) {
|
|
26108
|
+
suffix = suffix.replace(/\.?before$/, "");
|
|
26109
|
+
order ?? (order = Number.NEGATIVE_INFINITY);
|
|
26110
|
+
} else if (suffix === "after" || suffix.endsWith(".after")) {
|
|
26111
|
+
suffix = suffix.replace(/\.?after$/, "");
|
|
26112
|
+
order ?? (order = Number.POSITIVE_INFINITY);
|
|
26113
|
+
}
|
|
26114
|
+
if (suffix && !sections.includes(suffix)) continue;
|
|
26115
|
+
const section = widget.section ?? (suffix || defaultSection);
|
|
26116
|
+
if (!section) continue;
|
|
26117
|
+
const base = `widget:${widget.widgetId}`;
|
|
26118
|
+
const count = seen.get(base) ?? 0;
|
|
26119
|
+
seen.set(base, count + 1);
|
|
26120
|
+
result[section] ?? (result[section] = []);
|
|
26121
|
+
result[section].push({
|
|
26122
|
+
Component: widget.Component,
|
|
26123
|
+
widgetId: count === 0 ? base : `${base}#${count + 1}`,
|
|
26124
|
+
permission: widget.permission,
|
|
26125
|
+
order,
|
|
26126
|
+
replace: widget.replace
|
|
26127
|
+
});
|
|
26128
|
+
}
|
|
26129
|
+
}
|
|
26130
|
+
return result;
|
|
26008
26131
|
}
|
|
26009
26132
|
ensureSlot(slot) {
|
|
26010
26133
|
let entry = this.widgets.get(slot);
|
|
@@ -26179,9 +26302,75 @@ var ExtensionRegistry = class {
|
|
|
26179
26302
|
}
|
|
26180
26303
|
};
|
|
26181
26304
|
|
|
26305
|
+
// src/extensions/route-layers.tsx
|
|
26306
|
+
import { createElement } from "react";
|
|
26307
|
+
var normalize = (path) => {
|
|
26308
|
+
let start = 0;
|
|
26309
|
+
let end = path.length;
|
|
26310
|
+
while (start < end && path.charCodeAt(start) === 47) start++;
|
|
26311
|
+
while (end > start && path.charCodeAt(end - 1) === 47) end--;
|
|
26312
|
+
return path.slice(start, end);
|
|
26313
|
+
};
|
|
26314
|
+
function override(previous, next) {
|
|
26315
|
+
const Previous = previous.Component;
|
|
26316
|
+
const Next = next.Component;
|
|
26317
|
+
const Component = (props) => createElement(Next, {
|
|
26318
|
+
...props,
|
|
26319
|
+
renderDefault: () => createElement(Previous, { renderDefault: props.renderDefault })
|
|
26320
|
+
});
|
|
26321
|
+
Component.displayName = Next.displayName ?? Next.name ?? "RouteOverride";
|
|
26322
|
+
return {
|
|
26323
|
+
...next,
|
|
26324
|
+
path: previous.path,
|
|
26325
|
+
Component,
|
|
26326
|
+
children: next.children ? resolveRouteOverrides([...previous.children ?? [], ...next.children]) : previous.children
|
|
26327
|
+
};
|
|
26328
|
+
}
|
|
26329
|
+
function resolveRouteOverrides(routes) {
|
|
26330
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
26331
|
+
for (const route of routes) {
|
|
26332
|
+
const key = normalize(route.path);
|
|
26333
|
+
const previous = byPath.get(key);
|
|
26334
|
+
byPath.set(key, previous ? override(previous, route) : route);
|
|
26335
|
+
}
|
|
26336
|
+
return [...byPath.values()];
|
|
26337
|
+
}
|
|
26338
|
+
|
|
26182
26339
|
// src/extensions/context.tsx
|
|
26183
26340
|
import { createContext as createContext8, useContext as useContext10, useMemo as useMemo17 } from "react";
|
|
26184
|
-
|
|
26341
|
+
|
|
26342
|
+
// src/layout-composer/core-layouts.tsx
|
|
26343
|
+
import { clx as clx42 } from "@medusajs/ui";
|
|
26344
|
+
import { jsx as jsx79, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
26345
|
+
var SingleColumnLayoutComponent = ({ sections, className }) => /* @__PURE__ */ jsx79("div", { className: clx42("flex flex-col gap-y-3", className), children: sections.main });
|
|
26346
|
+
var TwoColumnLayoutComponent = ({ sections, className }) => /* @__PURE__ */ jsxs56(
|
|
26347
|
+
"div",
|
|
26348
|
+
{
|
|
26349
|
+
className: clx42(
|
|
26350
|
+
"flex w-full flex-col items-start gap-x-4 gap-y-3 xl:grid xl:grid-cols-[minmax(0,_1fr)_440px]",
|
|
26351
|
+
className
|
|
26352
|
+
),
|
|
26353
|
+
children: [
|
|
26354
|
+
/* @__PURE__ */ jsx79("div", { className: "flex w-full min-w-0 flex-col gap-y-3", children: sections.main }),
|
|
26355
|
+
/* @__PURE__ */ jsx79("div", { className: "flex w-full max-w-[100%] flex-col gap-y-3 xl:mt-0 xl:max-w-[440px]", children: sections.side })
|
|
26356
|
+
]
|
|
26357
|
+
}
|
|
26358
|
+
);
|
|
26359
|
+
var CORE_LAYOUTS = [
|
|
26360
|
+
{
|
|
26361
|
+
id: CORE_LAYOUT_IDS.SINGLE_COLUMN,
|
|
26362
|
+
sections: [{ id: "main" }],
|
|
26363
|
+
Component: SingleColumnLayoutComponent
|
|
26364
|
+
},
|
|
26365
|
+
{
|
|
26366
|
+
id: CORE_LAYOUT_IDS.TWO_COLUMN,
|
|
26367
|
+
sections: [{ id: "main" }, { id: "side" }],
|
|
26368
|
+
Component: TwoColumnLayoutComponent
|
|
26369
|
+
}
|
|
26370
|
+
];
|
|
26371
|
+
|
|
26372
|
+
// src/extensions/context.tsx
|
|
26373
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
26185
26374
|
var ExtensionContext = createContext8(null);
|
|
26186
26375
|
var activeRegistry = null;
|
|
26187
26376
|
var getExtensionRegistry = () => activeRegistry;
|
|
@@ -26189,23 +26378,33 @@ var ExtensionProvider = ({
|
|
|
26189
26378
|
widgets,
|
|
26190
26379
|
navigation,
|
|
26191
26380
|
customFields,
|
|
26381
|
+
layouts,
|
|
26382
|
+
preferences,
|
|
26192
26383
|
children
|
|
26193
26384
|
}) => {
|
|
26194
26385
|
const registry = useMemo17(() => {
|
|
26195
|
-
const next = new ExtensionRegistry({
|
|
26386
|
+
const next = new ExtensionRegistry({
|
|
26387
|
+
widgets,
|
|
26388
|
+
navigation,
|
|
26389
|
+
customFields,
|
|
26390
|
+
layouts,
|
|
26391
|
+
preferences
|
|
26392
|
+
});
|
|
26393
|
+
next.registerLayouts(CORE_LAYOUTS);
|
|
26196
26394
|
activeRegistry = next;
|
|
26197
26395
|
return next;
|
|
26198
|
-
}, [widgets, navigation, customFields]);
|
|
26199
|
-
return /* @__PURE__ */
|
|
26396
|
+
}, [widgets, navigation, customFields, layouts, preferences]);
|
|
26397
|
+
return /* @__PURE__ */ jsx80(ExtensionContext.Provider, { value: registry, children });
|
|
26200
26398
|
};
|
|
26201
26399
|
var EMPTY_REGISTRY = new ExtensionRegistry();
|
|
26400
|
+
EMPTY_REGISTRY.registerLayouts(CORE_LAYOUTS);
|
|
26202
26401
|
var useExtension = () => {
|
|
26203
26402
|
return useContext10(ExtensionContext) ?? EMPTY_REGISTRY;
|
|
26204
26403
|
};
|
|
26205
26404
|
|
|
26206
26405
|
// src/extensions/widget-zone.tsx
|
|
26207
26406
|
import { Fragment as Fragment8, useContext as useContext11 } from "react";
|
|
26208
|
-
import { jsx as
|
|
26407
|
+
import { jsx as jsx81, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
26209
26408
|
var WidgetZone = ({ id, data, children }) => {
|
|
26210
26409
|
const widgets = useExtension().getWidgets(id);
|
|
26211
26410
|
const permissions = useContext11(PermissionsContext);
|
|
@@ -26215,10 +26414,10 @@ var WidgetZone = ({ id, data, children }) => {
|
|
|
26215
26414
|
const after = widgets.after.filter(
|
|
26216
26415
|
(widget) => isPermitted(permissions, widget.permission)
|
|
26217
26416
|
);
|
|
26218
|
-
return /* @__PURE__ */
|
|
26219
|
-
before.map(({ Component, widgetId }) => /* @__PURE__ */
|
|
26417
|
+
return /* @__PURE__ */ jsxs57(Fragment8, { children: [
|
|
26418
|
+
before.map(({ Component, widgetId }) => /* @__PURE__ */ jsx81(Component, { data }, `before-${widgetId}`)),
|
|
26220
26419
|
children,
|
|
26221
|
-
after.map(({ Component, widgetId }) => /* @__PURE__ */
|
|
26420
|
+
after.map(({ Component, widgetId }) => /* @__PURE__ */ jsx81(Component, { data }, `after-${widgetId}`))
|
|
26222
26421
|
] });
|
|
26223
26422
|
};
|
|
26224
26423
|
|
|
@@ -26234,7 +26433,7 @@ var useWidgetTabs = (id) => {
|
|
|
26234
26433
|
};
|
|
26235
26434
|
|
|
26236
26435
|
// src/extensions/nav.ts
|
|
26237
|
-
import { createElement } from "react";
|
|
26436
|
+
import { createElement as createElement2 } from "react";
|
|
26238
26437
|
function applyNavOverrides(coreRoutes, overrides = []) {
|
|
26239
26438
|
const overrideById = /* @__PURE__ */ new Map();
|
|
26240
26439
|
for (const o of overrides) {
|
|
@@ -26249,7 +26448,7 @@ function applyNavOverrides(coreRoutes, overrides = []) {
|
|
|
26249
26448
|
item: {
|
|
26250
26449
|
...item,
|
|
26251
26450
|
label: o?.label ?? item.label,
|
|
26252
|
-
icon: o?.icon ?
|
|
26451
|
+
icon: o?.icon ? createElement2(o.icon) : item.icon,
|
|
26253
26452
|
items: void 0
|
|
26254
26453
|
},
|
|
26255
26454
|
parentId: reparent,
|
|
@@ -26370,7 +26569,7 @@ function groupNavItems(items, groups = []) {
|
|
|
26370
26569
|
|
|
26371
26570
|
// src/extensions/form-extension-zone.tsx
|
|
26372
26571
|
import { Input as Input10, Switch as Switch2, Textarea as Textarea4 } from "@medusajs/ui";
|
|
26373
|
-
import { jsx as
|
|
26572
|
+
import { jsx as jsx82, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
26374
26573
|
var ZOD_WRAPPER_TYPES = /* @__PURE__ */ new Set([
|
|
26375
26574
|
"optional",
|
|
26376
26575
|
"nullable",
|
|
@@ -26397,21 +26596,21 @@ function zodType(field) {
|
|
|
26397
26596
|
var ExtensionField = ({ name, field, control }) => {
|
|
26398
26597
|
const type = zodType(field);
|
|
26399
26598
|
const Component = field.component;
|
|
26400
|
-
return /* @__PURE__ */
|
|
26599
|
+
return /* @__PURE__ */ jsx82(
|
|
26401
26600
|
Form.Field,
|
|
26402
26601
|
{
|
|
26403
26602
|
control,
|
|
26404
26603
|
name: `additional_data.${name}`,
|
|
26405
|
-
render: ({ field: rhf }) => /* @__PURE__ */
|
|
26406
|
-
/* @__PURE__ */
|
|
26407
|
-
field.description && /* @__PURE__ */
|
|
26408
|
-
/* @__PURE__ */
|
|
26604
|
+
render: ({ field: rhf }) => /* @__PURE__ */ jsxs58(Form.Item, { children: [
|
|
26605
|
+
/* @__PURE__ */ jsx82(Form.Label, { children: field.label ?? name }),
|
|
26606
|
+
field.description && /* @__PURE__ */ jsx82(Form.Hint, { children: field.description }),
|
|
26607
|
+
/* @__PURE__ */ jsx82(Form.Control, { children: Component ? /* @__PURE__ */ jsx82(Component, {}) : type === "boolean" ? /* @__PURE__ */ jsx82(
|
|
26409
26608
|
Switch2,
|
|
26410
26609
|
{
|
|
26411
26610
|
checked: !!rhf.value,
|
|
26412
26611
|
onCheckedChange: rhf.onChange
|
|
26413
26612
|
}
|
|
26414
|
-
) : type === "number" ? /* @__PURE__ */
|
|
26613
|
+
) : type === "number" ? /* @__PURE__ */ jsx82(
|
|
26415
26614
|
Input10,
|
|
26416
26615
|
{
|
|
26417
26616
|
type: "number",
|
|
@@ -26419,14 +26618,14 @@ var ExtensionField = ({ name, field, control }) => {
|
|
|
26419
26618
|
...rhf,
|
|
26420
26619
|
value: rhf.value ?? ""
|
|
26421
26620
|
}
|
|
26422
|
-
) : type === "string" ? /* @__PURE__ */
|
|
26621
|
+
) : type === "string" ? /* @__PURE__ */ jsx82(
|
|
26423
26622
|
Input10,
|
|
26424
26623
|
{
|
|
26425
26624
|
placeholder: field.placeholder,
|
|
26426
26625
|
...rhf,
|
|
26427
26626
|
value: rhf.value ?? ""
|
|
26428
26627
|
}
|
|
26429
|
-
) : /* @__PURE__ */
|
|
26628
|
+
) : /* @__PURE__ */ jsx82(
|
|
26430
26629
|
Textarea4,
|
|
26431
26630
|
{
|
|
26432
26631
|
placeholder: field.placeholder,
|
|
@@ -26434,7 +26633,7 @@ var ExtensionField = ({ name, field, control }) => {
|
|
|
26434
26633
|
value: rhf.value ?? ""
|
|
26435
26634
|
}
|
|
26436
26635
|
) }),
|
|
26437
|
-
/* @__PURE__ */
|
|
26636
|
+
/* @__PURE__ */ jsx82(Form.ErrorMessage, {})
|
|
26438
26637
|
] })
|
|
26439
26638
|
}
|
|
26440
26639
|
);
|
|
@@ -26448,7 +26647,7 @@ var FormExtensionZone = ({
|
|
|
26448
26647
|
}) => {
|
|
26449
26648
|
const fields = useExtension().getFormFields(model, zone, tab);
|
|
26450
26649
|
if (fields.length === 0) return null;
|
|
26451
|
-
return /* @__PURE__ */
|
|
26650
|
+
return /* @__PURE__ */ jsx82("div", { className: "flex flex-col gap-y-4", children: fields.map(({ name, field }) => /* @__PURE__ */ jsx82(
|
|
26452
26651
|
ExtensionField,
|
|
26453
26652
|
{
|
|
26454
26653
|
name,
|
|
@@ -26462,7 +26661,7 @@ var FormExtensionZone = ({
|
|
|
26462
26661
|
|
|
26463
26662
|
// src/extensions/display-extension-zone.tsx
|
|
26464
26663
|
import { Fragment as Fragment9 } from "react";
|
|
26465
|
-
import { Fragment as Fragment10, jsx as
|
|
26664
|
+
import { Fragment as Fragment10, jsx as jsx83, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
26466
26665
|
var DisplayExtensionZone = ({
|
|
26467
26666
|
model,
|
|
26468
26667
|
zone,
|
|
@@ -26473,14 +26672,14 @@ var DisplayExtensionZone = ({
|
|
|
26473
26672
|
const builtIn = new Set(builtInFieldIds);
|
|
26474
26673
|
const added = fields.filter((f) => f.component && !builtIn.has(f.id));
|
|
26475
26674
|
if (added.length === 0 && actions.length === 0) return null;
|
|
26476
|
-
return /* @__PURE__ */
|
|
26675
|
+
return /* @__PURE__ */ jsxs59(Fragment10, { children: [
|
|
26477
26676
|
added.map(({ id, component: Component }) => {
|
|
26478
26677
|
const C = Component;
|
|
26479
|
-
return /* @__PURE__ */
|
|
26678
|
+
return /* @__PURE__ */ jsx83(C, { data }, id);
|
|
26480
26679
|
}),
|
|
26481
26680
|
actions.map(({ component: Component }, i) => {
|
|
26482
26681
|
const C = Component;
|
|
26483
|
-
return /* @__PURE__ */
|
|
26682
|
+
return /* @__PURE__ */ jsx83(C, { data }, `action-${i}`);
|
|
26484
26683
|
})
|
|
26485
26684
|
] });
|
|
26486
26685
|
};
|
|
@@ -26493,18 +26692,18 @@ var DisplayField = ({
|
|
|
26493
26692
|
}) => {
|
|
26494
26693
|
const { overridden, Component } = useDisplayFieldOverride(model, zone, id);
|
|
26495
26694
|
if (overridden) {
|
|
26496
|
-
return Component ? /* @__PURE__ */
|
|
26695
|
+
return Component ? /* @__PURE__ */ jsx83(Component, { data }) : null;
|
|
26497
26696
|
}
|
|
26498
|
-
return /* @__PURE__ */
|
|
26697
|
+
return /* @__PURE__ */ jsx83(Fragment9, { children });
|
|
26499
26698
|
};
|
|
26500
26699
|
var DisplaySection = ({
|
|
26501
26700
|
model,
|
|
26502
26701
|
zone,
|
|
26503
26702
|
data,
|
|
26504
26703
|
fields
|
|
26505
|
-
}) => /* @__PURE__ */
|
|
26506
|
-
fields.map(({ id, render }) => /* @__PURE__ */
|
|
26507
|
-
/* @__PURE__ */
|
|
26704
|
+
}) => /* @__PURE__ */ jsxs59(Fragment10, { children: [
|
|
26705
|
+
fields.map(({ id, render }) => /* @__PURE__ */ jsx83(DisplayField, { model, zone, id, data, children: render }, id)),
|
|
26706
|
+
/* @__PURE__ */ jsx83(
|
|
26508
26707
|
DisplayExtensionZone,
|
|
26509
26708
|
{
|
|
26510
26709
|
model,
|
|
@@ -26527,7 +26726,7 @@ function useDisplayFieldOverride(model, zone, id) {
|
|
|
26527
26726
|
// src/extensions/use-extendable-table.tsx
|
|
26528
26727
|
import { useMemo as useMemo18 } from "react";
|
|
26529
26728
|
import { createColumnHelper as createColumnHelper2 } from "@tanstack/react-table";
|
|
26530
|
-
import { jsx as
|
|
26729
|
+
import { jsx as jsx84 } from "react/jsx-runtime";
|
|
26531
26730
|
function columnId(col) {
|
|
26532
26731
|
return col.id ?? col.accessorKey;
|
|
26533
26732
|
}
|
|
@@ -26545,7 +26744,7 @@ function useExtendableTable({
|
|
|
26545
26744
|
const Comp = c.component;
|
|
26546
26745
|
if (!Comp) return null;
|
|
26547
26746
|
const value = row.original?.[c.id];
|
|
26548
|
-
return /* @__PURE__ */
|
|
26747
|
+
return /* @__PURE__ */ jsx84(Comp, { row: row.original, value });
|
|
26549
26748
|
}
|
|
26550
26749
|
});
|
|
26551
26750
|
const overrides = new Map((ext.columns ?? []).map((c) => [c.id, c]));
|
|
@@ -26586,11 +26785,11 @@ function mergeListFilters(base, extensions) {
|
|
|
26586
26785
|
const byKey = new Map(extensions.map((f) => [f.key, f]));
|
|
26587
26786
|
const merged = [];
|
|
26588
26787
|
for (const filter of base) {
|
|
26589
|
-
const
|
|
26590
|
-
if (!
|
|
26788
|
+
const override2 = byKey.get(filter.key);
|
|
26789
|
+
if (!override2) {
|
|
26591
26790
|
merged.push(filter);
|
|
26592
|
-
} else if (!isRemoval(
|
|
26593
|
-
merged.push(
|
|
26791
|
+
} else if (!isRemoval(override2)) {
|
|
26792
|
+
merged.push(override2);
|
|
26594
26793
|
}
|
|
26595
26794
|
}
|
|
26596
26795
|
const baseKeys = new Set(base.map((f) => f.key));
|
|
@@ -26714,7 +26913,7 @@ var useExtensionActivity = (model, entity) => {
|
|
|
26714
26913
|
};
|
|
26715
26914
|
|
|
26716
26915
|
// src/components/sections/product-attribute-section/product-attribute-section.tsx
|
|
26717
|
-
import { jsx as
|
|
26916
|
+
import { jsx as jsx85, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
26718
26917
|
var AttributeActions = ({
|
|
26719
26918
|
attribute,
|
|
26720
26919
|
editHref,
|
|
@@ -26736,7 +26935,7 @@ var AttributeActions = ({
|
|
|
26736
26935
|
}
|
|
26737
26936
|
await onDelete(attribute);
|
|
26738
26937
|
};
|
|
26739
|
-
return /* @__PURE__ */
|
|
26938
|
+
return /* @__PURE__ */ jsx85(
|
|
26740
26939
|
ActionMenu,
|
|
26741
26940
|
{
|
|
26742
26941
|
groups: [
|
|
@@ -26746,7 +26945,7 @@ var AttributeActions = ({
|
|
|
26746
26945
|
label: t2("actions.edit"),
|
|
26747
26946
|
to: editHref,
|
|
26748
26947
|
permission: "products:edit",
|
|
26749
|
-
icon: /* @__PURE__ */
|
|
26948
|
+
icon: /* @__PURE__ */ jsx85(PencilSquare, {})
|
|
26750
26949
|
}
|
|
26751
26950
|
]
|
|
26752
26951
|
},
|
|
@@ -26757,7 +26956,7 @@ var AttributeActions = ({
|
|
|
26757
26956
|
label: t2("actions.delete"),
|
|
26758
26957
|
onClick: handleDelete,
|
|
26759
26958
|
permission: "products:edit",
|
|
26760
|
-
icon: /* @__PURE__ */
|
|
26959
|
+
icon: /* @__PURE__ */ jsx85(Trash2, {})
|
|
26761
26960
|
}
|
|
26762
26961
|
]
|
|
26763
26962
|
}
|
|
@@ -26770,7 +26969,7 @@ var AttributeValue2 = ({ attribute }) => {
|
|
|
26770
26969
|
const { t: t2 } = useTranslation35();
|
|
26771
26970
|
const values = attribute.values?.map((v) => v.name) ?? [];
|
|
26772
26971
|
if (attribute.is_required && !values.length) {
|
|
26773
|
-
return /* @__PURE__ */
|
|
26972
|
+
return /* @__PURE__ */ jsx85(
|
|
26774
26973
|
Text18,
|
|
26775
26974
|
{
|
|
26776
26975
|
size: "small",
|
|
@@ -26782,7 +26981,7 @@ var AttributeValue2 = ({ attribute }) => {
|
|
|
26782
26981
|
);
|
|
26783
26982
|
}
|
|
26784
26983
|
if (["single_select", "multi_select"].includes(attribute.type)) {
|
|
26785
|
-
return /* @__PURE__ */
|
|
26984
|
+
return /* @__PURE__ */ jsx85("div", { className: "flex flex-wrap gap-1", children: values.map((val) => /* @__PURE__ */ jsx85(
|
|
26786
26985
|
Badge7,
|
|
26787
26986
|
{
|
|
26788
26987
|
size: "2xsmall",
|
|
@@ -26793,7 +26992,7 @@ var AttributeValue2 = ({ attribute }) => {
|
|
|
26793
26992
|
)) });
|
|
26794
26993
|
}
|
|
26795
26994
|
const textValue = attribute.type === "toggle" ? values.map((val) => val === "true" ? t2("general.yes") : t2("general.no")).join(", ") || "-" : values.join(", ") || "-";
|
|
26796
|
-
return /* @__PURE__ */
|
|
26995
|
+
return /* @__PURE__ */ jsx85(Tooltip12, { content: /* @__PURE__ */ jsx85("span", { className: "break-all", children: textValue }), children: /* @__PURE__ */ jsx85(
|
|
26797
26996
|
Text18,
|
|
26798
26997
|
{
|
|
26799
26998
|
size: "small",
|
|
@@ -26815,33 +27014,33 @@ var AttributeGroup = ({
|
|
|
26815
27014
|
if (!attributes.length) {
|
|
26816
27015
|
return null;
|
|
26817
27016
|
}
|
|
26818
|
-
return /* @__PURE__ */
|
|
26819
|
-
/* @__PURE__ */
|
|
26820
|
-
/* @__PURE__ */
|
|
26821
|
-
/* @__PURE__ */
|
|
26822
|
-
/* @__PURE__ */
|
|
26823
|
-
/* @__PURE__ */
|
|
27017
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
|
|
27018
|
+
/* @__PURE__ */ jsxs60("div", { className: "flex items-center gap-x-3 px-3", children: [
|
|
27019
|
+
/* @__PURE__ */ jsx85(IconAvatar, { children: icon }),
|
|
27020
|
+
/* @__PURE__ */ jsxs60("div", { children: [
|
|
27021
|
+
/* @__PURE__ */ jsx85(Text18, { size: "small", weight: "plus", leading: "compact", children: title }),
|
|
27022
|
+
/* @__PURE__ */ jsx85(Text18, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
|
|
26824
27023
|
] })
|
|
26825
27024
|
] }),
|
|
26826
|
-
/* @__PURE__ */
|
|
26827
|
-
return /* @__PURE__ */
|
|
27025
|
+
/* @__PURE__ */ jsx85("div", { className: "flex flex-col gap-y-0", children: /* @__PURE__ */ jsx85("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: attributes.map((attr, index) => {
|
|
27026
|
+
return /* @__PURE__ */ jsx85(
|
|
26828
27027
|
"div",
|
|
26829
27028
|
{
|
|
26830
27029
|
className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
|
|
26831
|
-
children: /* @__PURE__ */
|
|
26832
|
-
/* @__PURE__ */
|
|
26833
|
-
/* @__PURE__ */
|
|
26834
|
-
attr.description && /* @__PURE__ */
|
|
26835
|
-
attr.is_required && /* @__PURE__ */
|
|
27030
|
+
children: /* @__PURE__ */ jsxs60("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: [
|
|
27031
|
+
/* @__PURE__ */ jsxs60("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
|
|
27032
|
+
/* @__PURE__ */ jsx85(Text18, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
|
|
27033
|
+
attr.description && /* @__PURE__ */ jsx85(Tooltip12, { content: attr.description, children: /* @__PURE__ */ jsx85("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx85(InformationCircleSolid2, {}) }) }),
|
|
27034
|
+
attr.is_required && /* @__PURE__ */ jsx85(
|
|
26836
27035
|
Tooltip12,
|
|
26837
27036
|
{
|
|
26838
27037
|
content: t2("products.attributeRequiredByMarketplace"),
|
|
26839
|
-
children: /* @__PURE__ */
|
|
27038
|
+
children: /* @__PURE__ */ jsx85("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx85(InformationCircleSolid2, {}) })
|
|
26840
27039
|
}
|
|
26841
27040
|
)
|
|
26842
27041
|
] }),
|
|
26843
|
-
/* @__PURE__ */
|
|
26844
|
-
/* @__PURE__ */
|
|
27042
|
+
/* @__PURE__ */ jsx85(AttributeValue2, { attribute: attr }),
|
|
27043
|
+
/* @__PURE__ */ jsx85(
|
|
26845
27044
|
AttributeActions,
|
|
26846
27045
|
{
|
|
26847
27046
|
attribute: attr,
|
|
@@ -26879,14 +27078,14 @@ var ProductAttributeSection = ({
|
|
|
26879
27078
|
const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
|
|
26880
27079
|
const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
|
|
26881
27080
|
const isEmpty = !variantAttributes.length && !infoAttributes.length;
|
|
26882
|
-
return /* @__PURE__ */
|
|
26883
|
-
/* @__PURE__ */
|
|
27081
|
+
return /* @__PURE__ */ jsxs60(Container5, { className: "p-0", children: [
|
|
27082
|
+
/* @__PURE__ */ jsxs60(
|
|
26884
27083
|
"div",
|
|
26885
27084
|
{
|
|
26886
27085
|
className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
|
|
26887
27086
|
children: [
|
|
26888
|
-
/* @__PURE__ */
|
|
26889
|
-
/* @__PURE__ */
|
|
27087
|
+
/* @__PURE__ */ jsx85(Heading9, { level: "h2", children: t2("products.attributes") }),
|
|
27088
|
+
/* @__PURE__ */ jsx85(
|
|
26890
27089
|
ActionMenu,
|
|
26891
27090
|
{
|
|
26892
27091
|
groups: [
|
|
@@ -26896,13 +27095,13 @@ var ProductAttributeSection = ({
|
|
|
26896
27095
|
label: t2("products.create.attributes.addExisting"),
|
|
26897
27096
|
to: addExistingHref,
|
|
26898
27097
|
permission: "products:edit",
|
|
26899
|
-
icon: /* @__PURE__ */
|
|
27098
|
+
icon: /* @__PURE__ */ jsx85(Plus, {})
|
|
26900
27099
|
},
|
|
26901
27100
|
{
|
|
26902
27101
|
label: t2("products.create.attributes.createNew"),
|
|
26903
27102
|
to: createNewHref,
|
|
26904
27103
|
permission: "products:edit",
|
|
26905
|
-
icon: /* @__PURE__ */
|
|
27104
|
+
icon: /* @__PURE__ */ jsx85(PencilSquare, {})
|
|
26906
27105
|
}
|
|
26907
27106
|
]
|
|
26908
27107
|
}
|
|
@@ -26912,10 +27111,10 @@ var ProductAttributeSection = ({
|
|
|
26912
27111
|
]
|
|
26913
27112
|
}
|
|
26914
27113
|
),
|
|
26915
|
-
variantAttributes.length > 0 && /* @__PURE__ */
|
|
27114
|
+
variantAttributes.length > 0 && /* @__PURE__ */ jsx85(
|
|
26916
27115
|
AttributeGroup,
|
|
26917
27116
|
{
|
|
26918
|
-
icon: /* @__PURE__ */
|
|
27117
|
+
icon: /* @__PURE__ */ jsx85(Swatch, {}),
|
|
26919
27118
|
title: t2("products.attributeVariations"),
|
|
26920
27119
|
description: t2("products.attributeVariantsDescription"),
|
|
26921
27120
|
attributes: variantAttributes,
|
|
@@ -26923,11 +27122,11 @@ var ProductAttributeSection = ({
|
|
|
26923
27122
|
onDelete: onDeleteAttribute
|
|
26924
27123
|
}
|
|
26925
27124
|
),
|
|
26926
|
-
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */
|
|
26927
|
-
infoAttributes.length > 0 && /* @__PURE__ */
|
|
27125
|
+
variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx85("div", { className: "border-t border-dashed border-ui-border-base" }),
|
|
27126
|
+
infoAttributes.length > 0 && /* @__PURE__ */ jsx85(
|
|
26928
27127
|
AttributeGroup,
|
|
26929
27128
|
{
|
|
26930
|
-
icon: /* @__PURE__ */
|
|
27129
|
+
icon: /* @__PURE__ */ jsx85(DropCap, {}),
|
|
26931
27130
|
title: t2("products.attributeProductInformation"),
|
|
26932
27131
|
description: t2("products.attributeProductInformationDescription"),
|
|
26933
27132
|
attributes: infoAttributes,
|
|
@@ -26935,7 +27134,7 @@ var ProductAttributeSection = ({
|
|
|
26935
27134
|
onDelete: onDeleteAttribute
|
|
26936
27135
|
}
|
|
26937
27136
|
),
|
|
26938
|
-
/* @__PURE__ */
|
|
27137
|
+
/* @__PURE__ */ jsx85(DisplayExtensionZone, { model: "product", zone: "attributes", data: product })
|
|
26939
27138
|
] });
|
|
26940
27139
|
};
|
|
26941
27140
|
|
|
@@ -27016,7 +27215,7 @@ var useTabManagement = ({
|
|
|
27016
27215
|
};
|
|
27017
27216
|
|
|
27018
27217
|
// src/components/tabbed-form/tabbed-form.tsx
|
|
27019
|
-
import { jsx as
|
|
27218
|
+
import { jsx as jsx86, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
27020
27219
|
var TabbedFormContext = createContext9(null);
|
|
27021
27220
|
var useTabbedForm = () => {
|
|
27022
27221
|
const form = useContext13(TabbedFormContext);
|
|
@@ -27087,7 +27286,7 @@ function Root6({
|
|
|
27087
27286
|
const meta = resolveTabMeta(el);
|
|
27088
27287
|
return meta && visibleTabs.some((vt) => vt.id === meta.id);
|
|
27089
27288
|
});
|
|
27090
|
-
return /* @__PURE__ */
|
|
27289
|
+
return /* @__PURE__ */ jsx86(TabbedFormContext.Provider, { value: form, children: /* @__PURE__ */ jsx86(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs61(
|
|
27091
27290
|
KeyboundForm,
|
|
27092
27291
|
{
|
|
27093
27292
|
onKeyDown: (e) => {
|
|
@@ -27110,14 +27309,14 @@ function Root6({
|
|
|
27110
27309
|
onSubmit,
|
|
27111
27310
|
className: "flex h-full flex-col",
|
|
27112
27311
|
children: [
|
|
27113
|
-
/* @__PURE__ */
|
|
27312
|
+
/* @__PURE__ */ jsxs61(
|
|
27114
27313
|
ProgressTabs,
|
|
27115
27314
|
{
|
|
27116
27315
|
value: activeTabId,
|
|
27117
27316
|
onValueChange: onTabChange,
|
|
27118
27317
|
className: "flex h-full flex-col overflow-hidden",
|
|
27119
27318
|
children: [
|
|
27120
|
-
/* @__PURE__ */
|
|
27319
|
+
/* @__PURE__ */ jsx86(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx86("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx86(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: visibleTabs.map((tab) => /* @__PURE__ */ jsx86(
|
|
27121
27320
|
ProgressTabs.Trigger,
|
|
27122
27321
|
{
|
|
27123
27322
|
status: tabState[tab.id] ?? "not-started",
|
|
@@ -27127,9 +27326,9 @@ function Root6({
|
|
|
27127
27326
|
},
|
|
27128
27327
|
tab.id
|
|
27129
27328
|
)) }) }) }),
|
|
27130
|
-
/* @__PURE__ */
|
|
27329
|
+
/* @__PURE__ */ jsx86(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: visibleElements.map((element) => {
|
|
27131
27330
|
const meta = resolveTabMeta(element);
|
|
27132
|
-
return /* @__PURE__ */
|
|
27331
|
+
return /* @__PURE__ */ jsx86(
|
|
27133
27332
|
ProgressTabs.Content,
|
|
27134
27333
|
{
|
|
27135
27334
|
className: "size-full overflow-y-auto",
|
|
@@ -27142,7 +27341,7 @@ function Root6({
|
|
|
27142
27341
|
]
|
|
27143
27342
|
}
|
|
27144
27343
|
),
|
|
27145
|
-
/* @__PURE__ */
|
|
27344
|
+
/* @__PURE__ */ jsx86(RouteFocusModal.Footer, { children: footer ? footer({ isLastTab, onNext, isLoading }) : /* @__PURE__ */ jsx86(
|
|
27146
27345
|
DefaultFooter,
|
|
27147
27346
|
{
|
|
27148
27347
|
isLastTab,
|
|
@@ -27160,9 +27359,9 @@ var DefaultFooter = ({
|
|
|
27160
27359
|
isLoading
|
|
27161
27360
|
}) => {
|
|
27162
27361
|
const { t: t2 } = useTranslation36();
|
|
27163
|
-
return /* @__PURE__ */
|
|
27164
|
-
/* @__PURE__ */
|
|
27165
|
-
isLastTab ? /* @__PURE__ */
|
|
27362
|
+
return /* @__PURE__ */ jsxs61("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
27363
|
+
/* @__PURE__ */ jsx86(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx86(Button12, { variant: "secondary", size: "small", children: t2("actions.cancel") }) }),
|
|
27364
|
+
isLastTab ? /* @__PURE__ */ jsx86(
|
|
27166
27365
|
Button12,
|
|
27167
27366
|
{
|
|
27168
27367
|
type: "submit",
|
|
@@ -27172,7 +27371,7 @@ var DefaultFooter = ({
|
|
|
27172
27371
|
children: t2("actions.save")
|
|
27173
27372
|
},
|
|
27174
27373
|
"submit-button"
|
|
27175
|
-
) : /* @__PURE__ */
|
|
27374
|
+
) : /* @__PURE__ */ jsx86(
|
|
27176
27375
|
Button12,
|
|
27177
27376
|
{
|
|
27178
27377
|
type: "button",
|
|
@@ -27188,16 +27387,16 @@ var DefaultFooter = ({
|
|
|
27188
27387
|
var Tab = ({
|
|
27189
27388
|
children
|
|
27190
27389
|
}) => {
|
|
27191
|
-
return /* @__PURE__ */
|
|
27390
|
+
return /* @__PURE__ */ jsx86("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsx86("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children }) });
|
|
27192
27391
|
};
|
|
27193
27392
|
var TabbedForm = Object.assign(Root6, { Tab, useForm: useTabbedForm });
|
|
27194
27393
|
|
|
27195
27394
|
// src/components/table/data-table/data-table.tsx
|
|
27196
|
-
import { clx as
|
|
27395
|
+
import { clx as clx50 } from "@medusajs/ui";
|
|
27197
27396
|
import { memo } from "react";
|
|
27198
27397
|
|
|
27199
27398
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
27200
|
-
import { Button as Button13, clx as
|
|
27399
|
+
import { Button as Button13, clx as clx48 } from "@medusajs/ui";
|
|
27201
27400
|
import { Popover as RadixPopover8 } from "radix-ui";
|
|
27202
27401
|
import { useCallback as useCallback26, useEffect as useEffect23, useMemo as useMemo24, useRef as useRef18, useState as useState36 } from "react";
|
|
27203
27402
|
import { useSearchParams as useSearchParams7 } from "react-router-dom";
|
|
@@ -27218,7 +27417,7 @@ var useDataTableFilterContext = () => {
|
|
|
27218
27417
|
|
|
27219
27418
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
27220
27419
|
import { EllipseMiniSolid as EllipseMiniSolid2 } from "@medusajs/icons";
|
|
27221
|
-
import { DatePicker, Text as Text20, clx as
|
|
27420
|
+
import { DatePicker, Text as Text20, clx as clx44 } from "@medusajs/ui";
|
|
27222
27421
|
import isEqual from "lodash.isequal";
|
|
27223
27422
|
import { Popover as RadixPopover4 } from "radix-ui";
|
|
27224
27423
|
import { useMemo as useMemo23, useState as useState32 } from "react";
|
|
@@ -27294,10 +27493,10 @@ var useSelectedParams = ({
|
|
|
27294
27493
|
|
|
27295
27494
|
// src/components/table/data-table/data-table-filter/filter-chip.tsx
|
|
27296
27495
|
import { XMarkMini as XMarkMini5 } from "@medusajs/icons";
|
|
27297
|
-
import { Text as Text19, clx as
|
|
27496
|
+
import { Text as Text19, clx as clx43 } from "@medusajs/ui";
|
|
27298
27497
|
import { Popover as RadixPopover3 } from "radix-ui";
|
|
27299
27498
|
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
27300
|
-
import { jsx as
|
|
27499
|
+
import { jsx as jsx87, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27301
27500
|
var FilterChip = ({
|
|
27302
27501
|
hadPreviousValue,
|
|
27303
27502
|
label,
|
|
@@ -27311,22 +27510,22 @@ var FilterChip = ({
|
|
|
27311
27510
|
e.stopPropagation();
|
|
27312
27511
|
onRemove();
|
|
27313
27512
|
};
|
|
27314
|
-
return /* @__PURE__ */
|
|
27315
|
-
!hadPreviousValue && /* @__PURE__ */
|
|
27316
|
-
/* @__PURE__ */
|
|
27513
|
+
return /* @__PURE__ */ jsxs62("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: [
|
|
27514
|
+
!hadPreviousValue && /* @__PURE__ */ jsx87(RadixPopover3.Anchor, {}),
|
|
27515
|
+
/* @__PURE__ */ jsx87(
|
|
27317
27516
|
"div",
|
|
27318
27517
|
{
|
|
27319
|
-
className:
|
|
27518
|
+
className: clx43(
|
|
27320
27519
|
"flex items-center justify-center whitespace-nowrap px-2 py-1",
|
|
27321
27520
|
{
|
|
27322
27521
|
"border-r": !!(value || hadPreviousValue)
|
|
27323
27522
|
}
|
|
27324
27523
|
),
|
|
27325
|
-
children: /* @__PURE__ */
|
|
27524
|
+
children: /* @__PURE__ */ jsx87(Text19, { size: "small", weight: "plus", leading: "compact", children: label })
|
|
27326
27525
|
}
|
|
27327
27526
|
),
|
|
27328
|
-
/* @__PURE__ */
|
|
27329
|
-
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
27527
|
+
/* @__PURE__ */ jsxs62("div", { className: "flex w-full items-center overflow-hidden", children: [
|
|
27528
|
+
hasOperator && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx87("div", { className: "border-r p-1 px-2", children: /* @__PURE__ */ jsx87(
|
|
27330
27529
|
Text19,
|
|
27331
27530
|
{
|
|
27332
27531
|
size: "small",
|
|
@@ -27336,18 +27535,18 @@ var FilterChip = ({
|
|
|
27336
27535
|
children: t2("general.is")
|
|
27337
27536
|
}
|
|
27338
27537
|
) }),
|
|
27339
|
-
!!(value || hadPreviousValue) && /* @__PURE__ */
|
|
27538
|
+
!!(value || hadPreviousValue) && /* @__PURE__ */ jsx87(
|
|
27340
27539
|
RadixPopover3.Trigger,
|
|
27341
27540
|
{
|
|
27342
27541
|
asChild: true,
|
|
27343
|
-
className:
|
|
27542
|
+
className: clx43(
|
|
27344
27543
|
"flex-1 cursor-pointer overflow-hidden border-r p-1 px-2",
|
|
27345
27544
|
{
|
|
27346
27545
|
"hover:bg-ui-bg-field-hover": !readonly,
|
|
27347
27546
|
"data-[state=open]:bg-ui-bg-field-hover": !readonly
|
|
27348
27547
|
}
|
|
27349
27548
|
),
|
|
27350
|
-
children: /* @__PURE__ */
|
|
27549
|
+
children: /* @__PURE__ */ jsx87(
|
|
27351
27550
|
Text19,
|
|
27352
27551
|
{
|
|
27353
27552
|
size: "small",
|
|
@@ -27360,16 +27559,16 @@ var FilterChip = ({
|
|
|
27360
27559
|
}
|
|
27361
27560
|
)
|
|
27362
27561
|
] }),
|
|
27363
|
-
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */
|
|
27562
|
+
!readonly && !!(value || hadPreviousValue) && /* @__PURE__ */ jsx87(
|
|
27364
27563
|
"button",
|
|
27365
27564
|
{
|
|
27366
27565
|
onClick: handleRemove,
|
|
27367
|
-
className:
|
|
27566
|
+
className: clx43(
|
|
27368
27567
|
"text-ui-fg-muted transition-fg flex items-center justify-center p-1",
|
|
27369
27568
|
"hover:bg-ui-bg-subtle-hover",
|
|
27370
27569
|
"active:bg-ui-bg-subtle-pressed active:text-ui-fg-base"
|
|
27371
27570
|
),
|
|
27372
|
-
children: /* @__PURE__ */
|
|
27571
|
+
children: /* @__PURE__ */ jsx87(XMarkMini5, {})
|
|
27373
27572
|
}
|
|
27374
27573
|
)
|
|
27375
27574
|
] });
|
|
@@ -27383,7 +27582,7 @@ var isCompleteDate = (date) => {
|
|
|
27383
27582
|
};
|
|
27384
27583
|
|
|
27385
27584
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
27386
|
-
import { jsx as
|
|
27585
|
+
import { jsx as jsx88, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
27387
27586
|
var DateFilter = ({
|
|
27388
27587
|
filter,
|
|
27389
27588
|
prefix,
|
|
@@ -27460,8 +27659,8 @@ var DateFilter = ({
|
|
|
27460
27659
|
}, 200);
|
|
27461
27660
|
}
|
|
27462
27661
|
};
|
|
27463
|
-
return /* @__PURE__ */
|
|
27464
|
-
/* @__PURE__ */
|
|
27662
|
+
return /* @__PURE__ */ jsxs63(RadixPopover4.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
27663
|
+
/* @__PURE__ */ jsx88(
|
|
27465
27664
|
filter_chip_default,
|
|
27466
27665
|
{
|
|
27467
27666
|
hadPreviousValue: !!previousValue,
|
|
@@ -27471,14 +27670,14 @@ var DateFilter = ({
|
|
|
27471
27670
|
readonly
|
|
27472
27671
|
}
|
|
27473
27672
|
),
|
|
27474
|
-
!readonly && /* @__PURE__ */
|
|
27673
|
+
!readonly && /* @__PURE__ */ jsx88(RadixPopover4.Portal, { children: /* @__PURE__ */ jsxs63(
|
|
27475
27674
|
RadixPopover4.Content,
|
|
27476
27675
|
{
|
|
27477
27676
|
"data-name": "date_filter_content",
|
|
27478
27677
|
align: "start",
|
|
27479
27678
|
sideOffset: 8,
|
|
27480
27679
|
collisionPadding: 24,
|
|
27481
|
-
className:
|
|
27680
|
+
className: clx44(
|
|
27482
27681
|
"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout h-full max-h-[var(--radix-popper-available-height)] w-[300px] overflow-auto rounded-lg"
|
|
27483
27682
|
),
|
|
27484
27683
|
onInteractOutside: (e) => {
|
|
@@ -27489,10 +27688,10 @@ var DateFilter = ({
|
|
|
27489
27688
|
}
|
|
27490
27689
|
},
|
|
27491
27690
|
children: [
|
|
27492
|
-
/* @__PURE__ */
|
|
27691
|
+
/* @__PURE__ */ jsxs63("ul", { className: "w-full p-1", children: [
|
|
27493
27692
|
presets.map((preset) => {
|
|
27494
27693
|
const isSelected = selectedParams.get().includes(JSON.stringify(preset.value));
|
|
27495
|
-
return /* @__PURE__ */
|
|
27694
|
+
return /* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs63(
|
|
27496
27695
|
"button",
|
|
27497
27696
|
{
|
|
27498
27697
|
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",
|
|
@@ -27501,16 +27700,16 @@ var DateFilter = ({
|
|
|
27501
27700
|
handleSelectPreset(preset.value);
|
|
27502
27701
|
},
|
|
27503
27702
|
children: [
|
|
27504
|
-
/* @__PURE__ */
|
|
27703
|
+
/* @__PURE__ */ jsx88(
|
|
27505
27704
|
"div",
|
|
27506
27705
|
{
|
|
27507
|
-
className:
|
|
27706
|
+
className: clx44(
|
|
27508
27707
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
27509
27708
|
{
|
|
27510
27709
|
"[&_svg]:invisible": !isSelected
|
|
27511
27710
|
}
|
|
27512
27711
|
),
|
|
27513
|
-
children: /* @__PURE__ */
|
|
27712
|
+
children: /* @__PURE__ */ jsx88(EllipseMiniSolid2, {})
|
|
27514
27713
|
}
|
|
27515
27714
|
),
|
|
27516
27715
|
preset.label
|
|
@@ -27518,23 +27717,23 @@ var DateFilter = ({
|
|
|
27518
27717
|
}
|
|
27519
27718
|
) }, preset.label);
|
|
27520
27719
|
}),
|
|
27521
|
-
/* @__PURE__ */
|
|
27720
|
+
/* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs63(
|
|
27522
27721
|
"button",
|
|
27523
27722
|
{
|
|
27524
27723
|
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",
|
|
27525
27724
|
type: "button",
|
|
27526
27725
|
onClick: handleSelectCustom,
|
|
27527
27726
|
children: [
|
|
27528
|
-
/* @__PURE__ */
|
|
27727
|
+
/* @__PURE__ */ jsx88(
|
|
27529
27728
|
"div",
|
|
27530
27729
|
{
|
|
27531
|
-
className:
|
|
27730
|
+
className: clx44(
|
|
27532
27731
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
27533
27732
|
{
|
|
27534
27733
|
"[&_svg]:invisible": !showCustom
|
|
27535
27734
|
}
|
|
27536
27735
|
),
|
|
27537
|
-
children: /* @__PURE__ */
|
|
27736
|
+
children: /* @__PURE__ */ jsx88(EllipseMiniSolid2, {})
|
|
27538
27737
|
}
|
|
27539
27738
|
),
|
|
27540
27739
|
t("filters.date.custom")
|
|
@@ -27542,10 +27741,10 @@ var DateFilter = ({
|
|
|
27542
27741
|
}
|
|
27543
27742
|
) })
|
|
27544
27743
|
] }),
|
|
27545
|
-
showCustom && /* @__PURE__ */
|
|
27546
|
-
/* @__PURE__ */
|
|
27547
|
-
/* @__PURE__ */
|
|
27548
|
-
/* @__PURE__ */
|
|
27744
|
+
showCustom && /* @__PURE__ */ jsxs63("div", { className: "border-t px-1 pb-3 pt-1", children: [
|
|
27745
|
+
/* @__PURE__ */ jsxs63("div", { children: [
|
|
27746
|
+
/* @__PURE__ */ jsx88("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx88(Text20, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.from") }) }),
|
|
27747
|
+
/* @__PURE__ */ jsx88("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx88(
|
|
27549
27748
|
DatePicker,
|
|
27550
27749
|
{
|
|
27551
27750
|
modal: true,
|
|
@@ -27555,9 +27754,9 @@ var DateFilter = ({
|
|
|
27555
27754
|
}
|
|
27556
27755
|
) })
|
|
27557
27756
|
] }),
|
|
27558
|
-
/* @__PURE__ */
|
|
27559
|
-
/* @__PURE__ */
|
|
27560
|
-
/* @__PURE__ */
|
|
27757
|
+
/* @__PURE__ */ jsxs63("div", { children: [
|
|
27758
|
+
/* @__PURE__ */ jsx88("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx88(Text20, { size: "xsmall", leading: "compact", weight: "plus", children: t("filters.date.to") }) }),
|
|
27759
|
+
/* @__PURE__ */ jsx88("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx88(
|
|
27561
27760
|
DatePicker,
|
|
27562
27761
|
{
|
|
27563
27762
|
modal: true,
|
|
@@ -27643,7 +27842,7 @@ var getDateFromComparison = (comparison, key) => {
|
|
|
27643
27842
|
|
|
27644
27843
|
// src/components/table/data-table/data-table-filter/number-filter.tsx
|
|
27645
27844
|
import { EllipseMiniSolid as EllipseMiniSolid3 } from "@medusajs/icons";
|
|
27646
|
-
import { Input as Input11, Label as Label4, clx as
|
|
27845
|
+
import { Input as Input11, Label as Label4, clx as clx45 } from "@medusajs/ui";
|
|
27647
27846
|
import debounce2 from "lodash.debounce";
|
|
27648
27847
|
import {
|
|
27649
27848
|
Popover as RadixPopover5,
|
|
@@ -27651,7 +27850,7 @@ import {
|
|
|
27651
27850
|
} from "radix-ui";
|
|
27652
27851
|
import { useCallback as useCallback24, useEffect as useEffect21, useState as useState33 } from "react";
|
|
27653
27852
|
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
27654
|
-
import { jsx as
|
|
27853
|
+
import { jsx as jsx89, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
27655
27854
|
var NumberFilter = ({
|
|
27656
27855
|
filter,
|
|
27657
27856
|
prefix,
|
|
@@ -27748,8 +27947,8 @@ var NumberFilter = ({
|
|
|
27748
27947
|
const EQ_KEY = key;
|
|
27749
27948
|
const displayValue = parseDisplayValue(currentValue, t2);
|
|
27750
27949
|
const previousDisplayValue = parseDisplayValue(previousValue, t2);
|
|
27751
|
-
return /* @__PURE__ */
|
|
27752
|
-
/* @__PURE__ */
|
|
27950
|
+
return /* @__PURE__ */ jsxs64(RadixPopover5.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
27951
|
+
/* @__PURE__ */ jsx89(
|
|
27753
27952
|
filter_chip_default,
|
|
27754
27953
|
{
|
|
27755
27954
|
hasOperator: true,
|
|
@@ -27760,14 +27959,14 @@ var NumberFilter = ({
|
|
|
27760
27959
|
readonly
|
|
27761
27960
|
}
|
|
27762
27961
|
),
|
|
27763
|
-
!readonly && /* @__PURE__ */
|
|
27962
|
+
!readonly && /* @__PURE__ */ jsx89(RadixPopover5.Portal, { children: /* @__PURE__ */ jsxs64(
|
|
27764
27963
|
RadixPopover5.Content,
|
|
27765
27964
|
{
|
|
27766
27965
|
"data-name": "number_filter_content",
|
|
27767
27966
|
align: "start",
|
|
27768
27967
|
sideOffset: 8,
|
|
27769
27968
|
collisionPadding: 24,
|
|
27770
|
-
className:
|
|
27969
|
+
className: clx45(
|
|
27771
27970
|
"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout max-h-[var(--radix-popper-available-height)] w-[300px] divide-y overflow-y-auto rounded-lg outline-none"
|
|
27772
27971
|
),
|
|
27773
27972
|
onInteractOutside: (e) => {
|
|
@@ -27778,30 +27977,30 @@ var NumberFilter = ({
|
|
|
27778
27977
|
}
|
|
27779
27978
|
},
|
|
27780
27979
|
children: [
|
|
27781
|
-
/* @__PURE__ */
|
|
27980
|
+
/* @__PURE__ */ jsx89("div", { className: "p-1", children: /* @__PURE__ */ jsx89(
|
|
27782
27981
|
RadixRadioGroup.Root,
|
|
27783
27982
|
{
|
|
27784
27983
|
value: operator,
|
|
27785
27984
|
onValueChange: (val) => setOperator(val),
|
|
27786
27985
|
className: "flex flex-col items-start",
|
|
27787
27986
|
orientation: "vertical",
|
|
27788
|
-
children: operators.map((o) => /* @__PURE__ */
|
|
27987
|
+
children: operators.map((o) => /* @__PURE__ */ jsxs64(
|
|
27789
27988
|
RadixRadioGroup.Item,
|
|
27790
27989
|
{
|
|
27791
27990
|
value: o.operator,
|
|
27792
27991
|
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",
|
|
27793
27992
|
children: [
|
|
27794
|
-
/* @__PURE__ */
|
|
27795
|
-
/* @__PURE__ */
|
|
27993
|
+
/* @__PURE__ */ jsx89("div", { className: "size-5", children: /* @__PURE__ */ jsx89(RadixRadioGroup.Indicator, { children: /* @__PURE__ */ jsx89(EllipseMiniSolid3, {}) }) }),
|
|
27994
|
+
/* @__PURE__ */ jsx89("span", { className: "w-full", children: o.label })
|
|
27796
27995
|
]
|
|
27797
27996
|
},
|
|
27798
27997
|
o.operator
|
|
27799
27998
|
))
|
|
27800
27999
|
}
|
|
27801
28000
|
) }),
|
|
27802
|
-
/* @__PURE__ */
|
|
27803
|
-
/* @__PURE__ */
|
|
27804
|
-
/* @__PURE__ */
|
|
28001
|
+
/* @__PURE__ */ jsx89("div", { children: operator === "range" ? /* @__PURE__ */ jsxs64("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28002
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx89(Label4, { size: "xsmall", weight: "plus", htmlFor: GT_KEY, children: t2("filters.compare.greaterThan") }) }),
|
|
28003
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx89(
|
|
27805
28004
|
Input11,
|
|
27806
28005
|
{
|
|
27807
28006
|
name: GT_KEY,
|
|
@@ -27811,8 +28010,8 @@ var NumberFilter = ({
|
|
|
27811
28010
|
onChange: (e) => debouncedOnChange(e, "gt")
|
|
27812
28011
|
}
|
|
27813
28012
|
) }),
|
|
27814
|
-
/* @__PURE__ */
|
|
27815
|
-
/* @__PURE__ */
|
|
28013
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx89(Label4, { size: "xsmall", weight: "plus", htmlFor: LT_KEY, children: t2("filters.compare.lessThan") }) }),
|
|
28014
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx89(
|
|
27816
28015
|
Input11,
|
|
27817
28016
|
{
|
|
27818
28017
|
name: LT_KEY,
|
|
@@ -27822,9 +28021,9 @@ var NumberFilter = ({
|
|
|
27822
28021
|
onChange: (e) => debouncedOnChange(e, "lt")
|
|
27823
28022
|
}
|
|
27824
28023
|
) })
|
|
27825
|
-
] }, "range") : /* @__PURE__ */
|
|
27826
|
-
/* @__PURE__ */
|
|
27827
|
-
/* @__PURE__ */
|
|
28024
|
+
] }, "range") : /* @__PURE__ */ jsxs64("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28025
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx89(Label4, { size: "xsmall", weight: "plus", htmlFor: EQ_KEY, children: label }) }),
|
|
28026
|
+
/* @__PURE__ */ jsx89("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx89(
|
|
27828
28027
|
Input11,
|
|
27829
28028
|
{
|
|
27830
28029
|
name: EQ_KEY,
|
|
@@ -27889,12 +28088,12 @@ var getOperator = (value) => {
|
|
|
27889
28088
|
|
|
27890
28089
|
// src/components/table/data-table/data-table-filter/select-filter.tsx
|
|
27891
28090
|
import { CheckMini as CheckMini2, EllipseMiniSolid as EllipseMiniSolid4, XMarkMini as XMarkMini6 } from "@medusajs/icons";
|
|
27892
|
-
import { clx as
|
|
28091
|
+
import { clx as clx46 } from "@medusajs/ui";
|
|
27893
28092
|
import { Command } from "cmdk";
|
|
27894
28093
|
import { Popover as RadixPopover6 } from "radix-ui";
|
|
27895
28094
|
import { useState as useState34 } from "react";
|
|
27896
28095
|
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
27897
|
-
import { jsx as
|
|
28096
|
+
import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
27898
28097
|
var SelectFilter = ({
|
|
27899
28098
|
filter,
|
|
27900
28099
|
prefix,
|
|
@@ -27947,8 +28146,8 @@ var SelectFilter = ({
|
|
|
27947
28146
|
};
|
|
27948
28147
|
const normalizedValues = labelValues ? Array.isArray(labelValues) ? labelValues : [labelValues] : null;
|
|
27949
28148
|
const normalizedPrev = previousValue ? Array.isArray(previousValue) ? previousValue : [previousValue] : null;
|
|
27950
|
-
return /* @__PURE__ */
|
|
27951
|
-
/* @__PURE__ */
|
|
28149
|
+
return /* @__PURE__ */ jsxs65(RadixPopover6.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28150
|
+
/* @__PURE__ */ jsx90(
|
|
27952
28151
|
filter_chip_default,
|
|
27953
28152
|
{
|
|
27954
28153
|
hasOperator: true,
|
|
@@ -27959,14 +28158,14 @@ var SelectFilter = ({
|
|
|
27959
28158
|
onRemove: handleRemove
|
|
27960
28159
|
}
|
|
27961
28160
|
),
|
|
27962
|
-
!readonly && /* @__PURE__ */
|
|
28161
|
+
!readonly && /* @__PURE__ */ jsx90(RadixPopover6.Portal, { children: /* @__PURE__ */ jsx90(
|
|
27963
28162
|
RadixPopover6.Content,
|
|
27964
28163
|
{
|
|
27965
28164
|
hideWhenDetached: true,
|
|
27966
28165
|
align: "start",
|
|
27967
28166
|
sideOffset: 8,
|
|
27968
28167
|
collisionPadding: 8,
|
|
27969
|
-
className:
|
|
28168
|
+
className: clx46(
|
|
27970
28169
|
"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout z-[1] h-full max-h-[200px] w-[300px] overflow-hidden rounded-lg outline-none"
|
|
27971
28170
|
),
|
|
27972
28171
|
onInteractOutside: (e) => {
|
|
@@ -27977,9 +28176,9 @@ var SelectFilter = ({
|
|
|
27977
28176
|
}
|
|
27978
28177
|
}
|
|
27979
28178
|
},
|
|
27980
|
-
children: /* @__PURE__ */
|
|
27981
|
-
searchable && /* @__PURE__ */
|
|
27982
|
-
/* @__PURE__ */
|
|
28179
|
+
children: /* @__PURE__ */ jsxs65(Command, { className: "h-full", children: [
|
|
28180
|
+
searchable && /* @__PURE__ */ jsx90("div", { className: "border-b p-1", children: /* @__PURE__ */ jsxs65("div", { className: "grid grid-cols-[1fr_20px] gap-x-2 rounded-md px-2 py-1", children: [
|
|
28181
|
+
/* @__PURE__ */ jsx90(
|
|
27983
28182
|
Command.Input,
|
|
27984
28183
|
{
|
|
27985
28184
|
ref: setSearchRef,
|
|
@@ -27989,25 +28188,25 @@ var SelectFilter = ({
|
|
|
27989
28188
|
placeholder: t2("general.search")
|
|
27990
28189
|
}
|
|
27991
28190
|
),
|
|
27992
|
-
/* @__PURE__ */
|
|
28191
|
+
/* @__PURE__ */ jsx90("div", { className: "flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsx90(
|
|
27993
28192
|
"button",
|
|
27994
28193
|
{
|
|
27995
28194
|
disabled: !search,
|
|
27996
28195
|
onClick: handleClearSearch,
|
|
27997
|
-
className:
|
|
28196
|
+
className: clx46(
|
|
27998
28197
|
"transition-fg text-ui-fg-muted focus-visible:bg-ui-bg-base-pressed rounded-md outline-none",
|
|
27999
28198
|
{
|
|
28000
28199
|
invisible: !search
|
|
28001
28200
|
}
|
|
28002
28201
|
),
|
|
28003
|
-
children: /* @__PURE__ */
|
|
28202
|
+
children: /* @__PURE__ */ jsx90(XMarkMini6, {})
|
|
28004
28203
|
}
|
|
28005
28204
|
) })
|
|
28006
28205
|
] }) }),
|
|
28007
|
-
/* @__PURE__ */
|
|
28008
|
-
/* @__PURE__ */
|
|
28206
|
+
/* @__PURE__ */ jsx90(Command.Empty, { className: "txt-compact-small flex items-center justify-center p-1", children: /* @__PURE__ */ jsx90("span", { className: "w-full px-2 py-1 text-center", children: t2("general.noResultsTitle") }) }),
|
|
28207
|
+
/* @__PURE__ */ jsx90(Command.List, { className: "h-full max-h-[163px] min-h-[0] overflow-auto p-1 outline-none", children: options.map((option) => {
|
|
28009
28208
|
const isSelected = selectedParams.get().includes(String(option.value));
|
|
28010
|
-
return /* @__PURE__ */
|
|
28209
|
+
return /* @__PURE__ */ jsxs65(
|
|
28011
28210
|
Command.Item,
|
|
28012
28211
|
{
|
|
28013
28212
|
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",
|
|
@@ -28016,16 +28215,16 @@ var SelectFilter = ({
|
|
|
28016
28215
|
handleSelect(option.value);
|
|
28017
28216
|
},
|
|
28018
28217
|
children: [
|
|
28019
|
-
/* @__PURE__ */
|
|
28218
|
+
/* @__PURE__ */ jsx90(
|
|
28020
28219
|
"div",
|
|
28021
28220
|
{
|
|
28022
|
-
className:
|
|
28221
|
+
className: clx46(
|
|
28023
28222
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
28024
28223
|
{
|
|
28025
28224
|
"[&_svg]:invisible": !isSelected
|
|
28026
28225
|
}
|
|
28027
28226
|
),
|
|
28028
|
-
children: multiple ? /* @__PURE__ */
|
|
28227
|
+
children: multiple ? /* @__PURE__ */ jsx90(CheckMini2, {}) : /* @__PURE__ */ jsx90(EllipseMiniSolid4, {})
|
|
28029
28228
|
}
|
|
28030
28229
|
),
|
|
28031
28230
|
option.label
|
|
@@ -28041,11 +28240,11 @@ var SelectFilter = ({
|
|
|
28041
28240
|
};
|
|
28042
28241
|
|
|
28043
28242
|
// src/components/table/data-table/data-table-filter/string-filter.tsx
|
|
28044
|
-
import { Input as Input12, Label as Label5, clx as
|
|
28243
|
+
import { Input as Input12, Label as Label5, clx as clx47 } from "@medusajs/ui";
|
|
28045
28244
|
import debounce3 from "lodash.debounce";
|
|
28046
28245
|
import { Popover as RadixPopover7 } from "radix-ui";
|
|
28047
28246
|
import { useCallback as useCallback25, useEffect as useEffect22, useState as useState35 } from "react";
|
|
28048
|
-
import { jsx as
|
|
28247
|
+
import { jsx as jsx91, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
28049
28248
|
var StringFilter = ({
|
|
28050
28249
|
filter,
|
|
28051
28250
|
prefix,
|
|
@@ -28093,8 +28292,8 @@ var StringFilter = ({
|
|
|
28093
28292
|
selectedParams.delete();
|
|
28094
28293
|
removeFilter(key);
|
|
28095
28294
|
};
|
|
28096
|
-
return /* @__PURE__ */
|
|
28097
|
-
/* @__PURE__ */
|
|
28295
|
+
return /* @__PURE__ */ jsxs66(RadixPopover7.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28296
|
+
/* @__PURE__ */ jsx91(
|
|
28098
28297
|
filter_chip_default,
|
|
28099
28298
|
{
|
|
28100
28299
|
hasOperator: true,
|
|
@@ -28105,14 +28304,14 @@ var StringFilter = ({
|
|
|
28105
28304
|
readonly
|
|
28106
28305
|
}
|
|
28107
28306
|
),
|
|
28108
|
-
!readonly && /* @__PURE__ */
|
|
28307
|
+
!readonly && /* @__PURE__ */ jsx91(RadixPopover7.Portal, { children: /* @__PURE__ */ jsx91(
|
|
28109
28308
|
RadixPopover7.Content,
|
|
28110
28309
|
{
|
|
28111
28310
|
hideWhenDetached: true,
|
|
28112
28311
|
align: "start",
|
|
28113
28312
|
sideOffset: 8,
|
|
28114
28313
|
collisionPadding: 8,
|
|
28115
|
-
className:
|
|
28314
|
+
className: clx47(
|
|
28116
28315
|
"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout z-[1] h-full max-h-[200px] w-[300px] overflow-hidden rounded-lg outline-none"
|
|
28117
28316
|
),
|
|
28118
28317
|
onInteractOutside: (e) => {
|
|
@@ -28123,9 +28322,9 @@ var StringFilter = ({
|
|
|
28123
28322
|
}
|
|
28124
28323
|
}
|
|
28125
28324
|
},
|
|
28126
|
-
children: /* @__PURE__ */
|
|
28127
|
-
/* @__PURE__ */
|
|
28128
|
-
/* @__PURE__ */
|
|
28325
|
+
children: /* @__PURE__ */ jsxs66("div", { className: "px-1 pb-3 pt-1", children: [
|
|
28326
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx91(Label5, { size: "xsmall", weight: "plus", htmlFor: key, children: label }) }),
|
|
28327
|
+
/* @__PURE__ */ jsx91("div", { className: "px-2 py-0.5", children: /* @__PURE__ */ jsx91(
|
|
28129
28328
|
Input12,
|
|
28130
28329
|
{
|
|
28131
28330
|
name: key,
|
|
@@ -28141,7 +28340,7 @@ var StringFilter = ({
|
|
|
28141
28340
|
};
|
|
28142
28341
|
|
|
28143
28342
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
28144
|
-
import { jsx as
|
|
28343
|
+
import { jsx as jsx92, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
28145
28344
|
var DataTableFilter2 = ({
|
|
28146
28345
|
filters,
|
|
28147
28346
|
readonly,
|
|
@@ -28195,7 +28394,7 @@ var DataTableFilter2 = ({
|
|
|
28195
28394
|
const removeAllFilters = useCallback26(() => {
|
|
28196
28395
|
setActiveFilters([]);
|
|
28197
28396
|
}, []);
|
|
28198
|
-
return /* @__PURE__ */
|
|
28397
|
+
return /* @__PURE__ */ jsx92(
|
|
28199
28398
|
DataTableFilterContext.Provider,
|
|
28200
28399
|
{
|
|
28201
28400
|
value: useMemo24(
|
|
@@ -28205,11 +28404,11 @@ var DataTableFilter2 = ({
|
|
|
28205
28404
|
}),
|
|
28206
28405
|
[removeAllFilters, removeFilter]
|
|
28207
28406
|
),
|
|
28208
|
-
children: /* @__PURE__ */
|
|
28407
|
+
children: /* @__PURE__ */ jsxs67("div", { className: "max-w-2/3 flex flex-wrap items-center gap-2", children: [
|
|
28209
28408
|
activeFilters.map((filter) => {
|
|
28210
28409
|
switch (filter.type) {
|
|
28211
28410
|
case "select":
|
|
28212
|
-
return /* @__PURE__ */
|
|
28411
|
+
return /* @__PURE__ */ jsx92(
|
|
28213
28412
|
SelectFilter,
|
|
28214
28413
|
{
|
|
28215
28414
|
filter,
|
|
@@ -28223,7 +28422,7 @@ var DataTableFilter2 = ({
|
|
|
28223
28422
|
filter.key
|
|
28224
28423
|
);
|
|
28225
28424
|
case "date":
|
|
28226
|
-
return /* @__PURE__ */
|
|
28425
|
+
return /* @__PURE__ */ jsx92(
|
|
28227
28426
|
DateFilter,
|
|
28228
28427
|
{
|
|
28229
28428
|
filter,
|
|
@@ -28234,7 +28433,7 @@ var DataTableFilter2 = ({
|
|
|
28234
28433
|
filter.key
|
|
28235
28434
|
);
|
|
28236
28435
|
case "string":
|
|
28237
|
-
return /* @__PURE__ */
|
|
28436
|
+
return /* @__PURE__ */ jsx92(
|
|
28238
28437
|
StringFilter,
|
|
28239
28438
|
{
|
|
28240
28439
|
filter,
|
|
@@ -28245,7 +28444,7 @@ var DataTableFilter2 = ({
|
|
|
28245
28444
|
filter.key
|
|
28246
28445
|
);
|
|
28247
28446
|
case "number":
|
|
28248
|
-
return /* @__PURE__ */
|
|
28447
|
+
return /* @__PURE__ */ jsx92(
|
|
28249
28448
|
NumberFilter,
|
|
28250
28449
|
{
|
|
28251
28450
|
filter,
|
|
@@ -28259,12 +28458,12 @@ var DataTableFilter2 = ({
|
|
|
28259
28458
|
break;
|
|
28260
28459
|
}
|
|
28261
28460
|
}),
|
|
28262
|
-
!readonly && availableFilters.length > 0 && /* @__PURE__ */
|
|
28263
|
-
/* @__PURE__ */
|
|
28264
|
-
/* @__PURE__ */
|
|
28461
|
+
!readonly && availableFilters.length > 0 && /* @__PURE__ */ jsxs67(RadixPopover8.Root, { modal: true, open, onOpenChange: setOpen, children: [
|
|
28462
|
+
/* @__PURE__ */ jsx92(RadixPopover8.Trigger, { asChild: true, id: "filters_menu_trigger", children: /* @__PURE__ */ jsx92(Button13, { size: "small", variant: "secondary", children: t2("filters.addFilter") }) }),
|
|
28463
|
+
/* @__PURE__ */ jsx92(RadixPopover8.Portal, { children: /* @__PURE__ */ jsx92(
|
|
28265
28464
|
RadixPopover8.Content,
|
|
28266
28465
|
{
|
|
28267
|
-
className:
|
|
28466
|
+
className: clx48(
|
|
28268
28467
|
"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout z-[1] h-full max-h-[200px] w-[300px] overflow-auto rounded-lg p-1 outline-none"
|
|
28269
28468
|
),
|
|
28270
28469
|
"data-name": "filters_menu_content",
|
|
@@ -28282,7 +28481,7 @@ var DataTableFilter2 = ({
|
|
|
28282
28481
|
children: availableFilters.map((filter) => {
|
|
28283
28482
|
return (
|
|
28284
28483
|
// oxlint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
28285
|
-
/* @__PURE__ */
|
|
28484
|
+
/* @__PURE__ */ jsx92(
|
|
28286
28485
|
"div",
|
|
28287
28486
|
{
|
|
28288
28487
|
tabIndex: 0,
|
|
@@ -28300,7 +28499,7 @@ var DataTableFilter2 = ({
|
|
|
28300
28499
|
}
|
|
28301
28500
|
) })
|
|
28302
28501
|
] }),
|
|
28303
|
-
!readonly && activeFilters.length > 0 && /* @__PURE__ */
|
|
28502
|
+
!readonly && activeFilters.length > 0 && /* @__PURE__ */ jsx92(ClearAllFilters, { filters, prefix })
|
|
28304
28503
|
] })
|
|
28305
28504
|
}
|
|
28306
28505
|
);
|
|
@@ -28318,12 +28517,12 @@ var ClearAllFilters = ({ filters, prefix }) => {
|
|
|
28318
28517
|
});
|
|
28319
28518
|
removeAllFilters();
|
|
28320
28519
|
};
|
|
28321
|
-
return /* @__PURE__ */
|
|
28520
|
+
return /* @__PURE__ */ jsx92(
|
|
28322
28521
|
"button",
|
|
28323
28522
|
{
|
|
28324
28523
|
type: "button",
|
|
28325
28524
|
onClick: handleRemoveAll,
|
|
28326
|
-
className:
|
|
28525
|
+
className: clx48(
|
|
28327
28526
|
"text-ui-fg-muted transition-fg txt-compact-small-plus rounded-md px-2 py-1",
|
|
28328
28527
|
"hover:text-ui-fg-subtle",
|
|
28329
28528
|
"focus-visible:shadow-borders-focus"
|
|
@@ -28364,7 +28563,7 @@ import { DropdownMenu as DropdownMenu7, IconButton as IconButton11 } from "@medu
|
|
|
28364
28563
|
import { useState as useState37 } from "react";
|
|
28365
28564
|
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
28366
28565
|
import { useSearchParams as useSearchParams8 } from "react-router-dom";
|
|
28367
|
-
import { jsx as
|
|
28566
|
+
import { jsx as jsx93, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
28368
28567
|
var initState2 = (params, prefix) => {
|
|
28369
28568
|
const param = prefix ? `${prefix}_order` : "order";
|
|
28370
28569
|
const sortParam = params.get(param);
|
|
@@ -28423,17 +28622,17 @@ var DataTableOrderBy = ({
|
|
|
28423
28622
|
return prev;
|
|
28424
28623
|
});
|
|
28425
28624
|
};
|
|
28426
|
-
return /* @__PURE__ */
|
|
28427
|
-
/* @__PURE__ */
|
|
28428
|
-
/* @__PURE__ */
|
|
28429
|
-
/* @__PURE__ */
|
|
28625
|
+
return /* @__PURE__ */ jsxs68(DropdownMenu7, { dir: direction, children: [
|
|
28626
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Trigger, { asChild: true, children: /* @__PURE__ */ jsx93(IconButton11, { size: "small", children: /* @__PURE__ */ jsx93(DescendingSorting, {}) }) }),
|
|
28627
|
+
/* @__PURE__ */ jsxs68(DropdownMenu7.Content, { className: "z-[1]", align: "end", children: [
|
|
28628
|
+
/* @__PURE__ */ jsx93(
|
|
28430
28629
|
DropdownMenu7.RadioGroup,
|
|
28431
28630
|
{
|
|
28432
28631
|
value: state.key,
|
|
28433
28632
|
onValueChange: handleKeyChange,
|
|
28434
28633
|
children: keys.map((key) => {
|
|
28435
28634
|
const stringKey = String(key.key);
|
|
28436
|
-
return /* @__PURE__ */
|
|
28635
|
+
return /* @__PURE__ */ jsx93(
|
|
28437
28636
|
DropdownMenu7.RadioItem,
|
|
28438
28637
|
{
|
|
28439
28638
|
value: stringKey,
|
|
@@ -28445,14 +28644,14 @@ var DataTableOrderBy = ({
|
|
|
28445
28644
|
})
|
|
28446
28645
|
}
|
|
28447
28646
|
),
|
|
28448
|
-
/* @__PURE__ */
|
|
28449
|
-
/* @__PURE__ */
|
|
28647
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Separator, {}),
|
|
28648
|
+
/* @__PURE__ */ jsxs68(
|
|
28450
28649
|
DropdownMenu7.RadioGroup,
|
|
28451
28650
|
{
|
|
28452
28651
|
value: state.dir,
|
|
28453
28652
|
onValueChange: handleDirChange,
|
|
28454
28653
|
children: [
|
|
28455
|
-
/* @__PURE__ */
|
|
28654
|
+
/* @__PURE__ */ jsxs68(
|
|
28456
28655
|
DropdownMenu7.RadioItem,
|
|
28457
28656
|
{
|
|
28458
28657
|
className: "flex items-center justify-between",
|
|
@@ -28460,11 +28659,11 @@ var DataTableOrderBy = ({
|
|
|
28460
28659
|
onSelect: (event) => event.preventDefault(),
|
|
28461
28660
|
children: [
|
|
28462
28661
|
t2("general.ascending"),
|
|
28463
|
-
/* @__PURE__ */
|
|
28662
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Label, { children: "1 - 30" })
|
|
28464
28663
|
]
|
|
28465
28664
|
}
|
|
28466
28665
|
),
|
|
28467
|
-
/* @__PURE__ */
|
|
28666
|
+
/* @__PURE__ */ jsxs68(
|
|
28468
28667
|
DropdownMenu7.RadioItem,
|
|
28469
28668
|
{
|
|
28470
28669
|
className: "flex items-center justify-between",
|
|
@@ -28472,7 +28671,7 @@ var DataTableOrderBy = ({
|
|
|
28472
28671
|
onSelect: (event) => event.preventDefault(),
|
|
28473
28672
|
children: [
|
|
28474
28673
|
t2("general.descending"),
|
|
28475
|
-
/* @__PURE__ */
|
|
28674
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Label, { children: "30 - 1" })
|
|
28476
28675
|
]
|
|
28477
28676
|
}
|
|
28478
28677
|
)
|
|
@@ -28488,7 +28687,7 @@ import { Input as Input13 } from "@medusajs/ui";
|
|
|
28488
28687
|
import { useCallback as useCallback27, useEffect as useEffect24 } from "react";
|
|
28489
28688
|
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
28490
28689
|
import debounce4 from "lodash.debounce";
|
|
28491
|
-
import { jsx as
|
|
28690
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
28492
28691
|
var DataTableSearch = ({
|
|
28493
28692
|
placeholder,
|
|
28494
28693
|
prefix,
|
|
@@ -28518,7 +28717,7 @@ var DataTableSearch = ({
|
|
|
28518
28717
|
debouncedOnChange.cancel();
|
|
28519
28718
|
};
|
|
28520
28719
|
}, [debouncedOnChange]);
|
|
28521
|
-
return /* @__PURE__ */
|
|
28720
|
+
return /* @__PURE__ */ jsx94(
|
|
28522
28721
|
Input13,
|
|
28523
28722
|
{
|
|
28524
28723
|
autoComplete: "off",
|
|
@@ -28533,30 +28732,30 @@ var DataTableSearch = ({
|
|
|
28533
28732
|
};
|
|
28534
28733
|
|
|
28535
28734
|
// src/components/table/data-table/data-table-query/data-table-query.tsx
|
|
28536
|
-
import { jsx as
|
|
28735
|
+
import { jsx as jsx95, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
28537
28736
|
var DataTableQuery = ({
|
|
28538
28737
|
search,
|
|
28539
28738
|
orderBy,
|
|
28540
28739
|
filters,
|
|
28541
28740
|
prefix
|
|
28542
28741
|
}) => {
|
|
28543
|
-
return (search || orderBy || filters || prefix) && /* @__PURE__ */
|
|
28544
|
-
/* @__PURE__ */
|
|
28545
|
-
/* @__PURE__ */
|
|
28546
|
-
search && /* @__PURE__ */
|
|
28742
|
+
return (search || orderBy || filters || prefix) && /* @__PURE__ */ jsxs69("div", { className: "flex items-start justify-between gap-x-4 px-6 py-4", children: [
|
|
28743
|
+
/* @__PURE__ */ jsx95("div", { className: "w-full max-w-[60%]", children: filters && filters.length > 0 && /* @__PURE__ */ jsx95(DataTableFilter2, { filters, prefix }) }),
|
|
28744
|
+
/* @__PURE__ */ jsxs69("div", { className: "flex shrink-0 items-center gap-x-2", children: [
|
|
28745
|
+
search && /* @__PURE__ */ jsx95(
|
|
28547
28746
|
DataTableSearch,
|
|
28548
28747
|
{
|
|
28549
28748
|
prefix,
|
|
28550
28749
|
autofocus: search === "autofocus"
|
|
28551
28750
|
}
|
|
28552
28751
|
),
|
|
28553
|
-
orderBy && /* @__PURE__ */
|
|
28752
|
+
orderBy && /* @__PURE__ */ jsx95(DataTableOrderBy, { keys: orderBy, prefix })
|
|
28554
28753
|
] })
|
|
28555
28754
|
] });
|
|
28556
28755
|
};
|
|
28557
28756
|
|
|
28558
28757
|
// src/components/table/data-table/data-table-root/data-table-root.tsx
|
|
28559
|
-
import { CommandBar, Table as Table2, clx as
|
|
28758
|
+
import { CommandBar, Table as Table2, clx as clx49 } from "@medusajs/ui";
|
|
28560
28759
|
import {
|
|
28561
28760
|
flexRender as flexRender2
|
|
28562
28761
|
} from "@tanstack/react-table";
|
|
@@ -28569,7 +28768,7 @@ import {
|
|
|
28569
28768
|
} from "react";
|
|
28570
28769
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
28571
28770
|
import { Link as Link8 } from "react-router-dom";
|
|
28572
|
-
import { jsx as
|
|
28771
|
+
import { jsx as jsx96, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28573
28772
|
var DataTableRoot = ({
|
|
28574
28773
|
table,
|
|
28575
28774
|
columns,
|
|
@@ -28609,28 +28808,28 @@ var DataTableRoot = ({
|
|
|
28609
28808
|
useEffect25(() => {
|
|
28610
28809
|
scrollableRef.current?.scroll({ top: 0, left: 0 });
|
|
28611
28810
|
}, [pageIndex]);
|
|
28612
|
-
return /* @__PURE__ */
|
|
28811
|
+
return /* @__PURE__ */ jsxs70(
|
|
28613
28812
|
"div",
|
|
28614
28813
|
{
|
|
28615
|
-
className:
|
|
28814
|
+
className: clx49("flex w-full flex-col overflow-hidden", {
|
|
28616
28815
|
"flex flex-1 flex-col": layout === "fill"
|
|
28617
28816
|
}),
|
|
28618
28817
|
children: [
|
|
28619
|
-
/* @__PURE__ */
|
|
28818
|
+
/* @__PURE__ */ jsx96(
|
|
28620
28819
|
"div",
|
|
28621
28820
|
{
|
|
28622
28821
|
ref: scrollableRef,
|
|
28623
28822
|
onScroll: handleHorizontalScroll,
|
|
28624
|
-
className:
|
|
28823
|
+
className: clx49("w-full", {
|
|
28625
28824
|
"min-h-0 flex-grow overflow-auto": layout === "fill",
|
|
28626
28825
|
"overflow-x-auto": layout === "fit"
|
|
28627
28826
|
}),
|
|
28628
|
-
children: !noResults ? /* @__PURE__ */
|
|
28629
|
-
!noHeader && /* @__PURE__ */
|
|
28630
|
-
return /* @__PURE__ */
|
|
28827
|
+
children: !noResults ? /* @__PURE__ */ jsxs70(Table2, { className: "relative w-full", children: [
|
|
28828
|
+
!noHeader && /* @__PURE__ */ jsx96(Table2.Header, { className: "border-t-0", children: table.getHeaderGroups().map((headerGroup) => {
|
|
28829
|
+
return /* @__PURE__ */ jsx96(
|
|
28631
28830
|
Table2.Row,
|
|
28632
28831
|
{
|
|
28633
|
-
className:
|
|
28832
|
+
className: clx49({
|
|
28634
28833
|
"relative border-b-0 [&_th:last-of-type]:w-[1%] [&_th:last-of-type]:whitespace-nowrap": hasActions,
|
|
28635
28834
|
"[&_th:first-of-type]:w-[1%] [&_th:first-of-type]:whitespace-nowrap": hasSelect
|
|
28636
28835
|
}),
|
|
@@ -28643,14 +28842,14 @@ var DataTableRoot = ({
|
|
|
28643
28842
|
);
|
|
28644
28843
|
const isFirstHeader = firstHeader !== -1 ? header.id === headerGroup.headers[firstHeader].id : index === 0;
|
|
28645
28844
|
const isStickyHeader = isSelectHeader || isFirstHeader;
|
|
28646
|
-
return /* @__PURE__ */
|
|
28845
|
+
return /* @__PURE__ */ jsx96(
|
|
28647
28846
|
Table2.HeaderCell,
|
|
28648
28847
|
{
|
|
28649
28848
|
"data-table-header-id": header.id,
|
|
28650
28849
|
style: {
|
|
28651
28850
|
width: !isSpecialHeader ? `${colWidth}%` : void 0
|
|
28652
28851
|
},
|
|
28653
|
-
className:
|
|
28852
|
+
className: clx49({
|
|
28654
28853
|
"bg-ui-bg-subtle sticky start-0 after:absolute after:inset-y-0 after:right-0 after:h-full after:w-px after:bg-transparent after:content-['']": isStickyHeader,
|
|
28655
28854
|
"start-[68px]": isStickyHeader && hasSelect && !isSelectHeader,
|
|
28656
28855
|
"after:bg-ui-border-base": showStickyBorder && isStickyHeader && !isSpecialHeader
|
|
@@ -28667,16 +28866,16 @@ var DataTableRoot = ({
|
|
|
28667
28866
|
headerGroup.id
|
|
28668
28867
|
);
|
|
28669
28868
|
}) }),
|
|
28670
|
-
/* @__PURE__ */
|
|
28869
|
+
/* @__PURE__ */ jsx96(Table2.Body, { className: "border-b-0", children: table.getRowModel().rows.map((row) => {
|
|
28671
28870
|
const to = navigateTo ? navigateTo(row) : void 0;
|
|
28672
28871
|
const isRowDisabled = hasSelect && !row.getCanSelect();
|
|
28673
28872
|
const isOdd = row.depth % 2 !== 0;
|
|
28674
28873
|
const cells = row.getVisibleCells();
|
|
28675
|
-
return /* @__PURE__ */
|
|
28874
|
+
return /* @__PURE__ */ jsx96(
|
|
28676
28875
|
Table2.Row,
|
|
28677
28876
|
{
|
|
28678
28877
|
"data-selected": row.getIsSelected(),
|
|
28679
|
-
className:
|
|
28878
|
+
className: clx49(
|
|
28680
28879
|
"transition-fg group/row group relative [&_td:last-of-type]:w-[1%] [&_td:last-of-type]:whitespace-nowrap",
|
|
28681
28880
|
"has-[[data-row-link]:focus-visible]:bg-ui-bg-base-hover",
|
|
28682
28881
|
{
|
|
@@ -28702,10 +28901,10 @@ var DataTableRoot = ({
|
|
|
28702
28901
|
);
|
|
28703
28902
|
const isTabableLink = isFirstCell && !!to;
|
|
28704
28903
|
const shouldRenderAsLink = !!to && !isSelectCell;
|
|
28705
|
-
return /* @__PURE__ */
|
|
28904
|
+
return /* @__PURE__ */ jsx96(
|
|
28706
28905
|
Table2.Cell,
|
|
28707
28906
|
{
|
|
28708
|
-
className:
|
|
28907
|
+
className: clx49({
|
|
28709
28908
|
"!ps-0 !pe-0": shouldRenderAsLink,
|
|
28710
28909
|
"bg-ui-bg-base group-data-[selected=true]/row:bg-ui-bg-highlight group-data-[selected=true]/row:group-hover/row:bg-ui-bg-highlight-hover group-hover/row:bg-ui-bg-base-hover transition-fg group-has-[[data-row-link]:focus-visible]:bg-ui-bg-base-hover sticky start-0 after:absolute after:inset-y-0 after:right-0 after:h-full after:w-px after:bg-transparent after:content-['']": isStickyCell,
|
|
28711
28910
|
"bg-ui-bg-subtle group-hover/row:bg-ui-bg-subtle-hover": isOdd && isStickyCell,
|
|
@@ -28716,17 +28915,17 @@ var DataTableRoot = ({
|
|
|
28716
28915
|
style: {
|
|
28717
28916
|
paddingLeft: depthOffset ? `${depthOffset}px` : void 0
|
|
28718
28917
|
},
|
|
28719
|
-
children: shouldRenderAsLink ? /* @__PURE__ */
|
|
28918
|
+
children: shouldRenderAsLink ? /* @__PURE__ */ jsx96(
|
|
28720
28919
|
Link8,
|
|
28721
28920
|
{
|
|
28722
28921
|
to,
|
|
28723
28922
|
className: "size-full outline-none",
|
|
28724
28923
|
"data-row-link": true,
|
|
28725
28924
|
tabIndex: isTabableLink ? 0 : -1,
|
|
28726
|
-
children: /* @__PURE__ */
|
|
28925
|
+
children: /* @__PURE__ */ jsx96(
|
|
28727
28926
|
"div",
|
|
28728
28927
|
{
|
|
28729
|
-
className:
|
|
28928
|
+
className: clx49(
|
|
28730
28929
|
"flex size-full items-center pe-6",
|
|
28731
28930
|
{
|
|
28732
28931
|
"ps-6": isTabableLink && !hasLeftOffset
|
|
@@ -28745,10 +28944,10 @@ var DataTableRoot = ({
|
|
|
28745
28944
|
row.id
|
|
28746
28945
|
);
|
|
28747
28946
|
}) })
|
|
28748
|
-
] }) : /* @__PURE__ */
|
|
28947
|
+
] }) : /* @__PURE__ */ jsx96("div", { className: clx49({ "border-b": layout === "fit" }), children: /* @__PURE__ */ jsx96(NoResults, { ...noResultsProps }) })
|
|
28749
28948
|
}
|
|
28750
28949
|
),
|
|
28751
|
-
pagination && /* @__PURE__ */
|
|
28950
|
+
pagination && /* @__PURE__ */ jsx96("div", { className: clx49({ "border-t": layout === "fill" }), children: /* @__PURE__ */ jsx96(
|
|
28752
28951
|
Pagination,
|
|
28753
28952
|
{
|
|
28754
28953
|
canNextPage: table.getCanNextPage(),
|
|
@@ -28761,14 +28960,14 @@ var DataTableRoot = ({
|
|
|
28761
28960
|
pageSize
|
|
28762
28961
|
}
|
|
28763
28962
|
) }),
|
|
28764
|
-
hasCommandBar && /* @__PURE__ */
|
|
28765
|
-
/* @__PURE__ */
|
|
28963
|
+
hasCommandBar && /* @__PURE__ */ jsx96(CommandBar, { open: !!Object.keys(rowSelection).length, children: /* @__PURE__ */ jsxs70(CommandBar.Bar, { children: [
|
|
28964
|
+
/* @__PURE__ */ jsx96(CommandBar.Value, { children: t2("general.countSelected", {
|
|
28766
28965
|
count: Object.keys(rowSelection).length
|
|
28767
28966
|
}) }),
|
|
28768
|
-
/* @__PURE__ */
|
|
28967
|
+
/* @__PURE__ */ jsx96(CommandBar.Seperator, {}),
|
|
28769
28968
|
commands?.map((command, index) => {
|
|
28770
|
-
return /* @__PURE__ */
|
|
28771
|
-
/* @__PURE__ */
|
|
28969
|
+
return /* @__PURE__ */ jsxs70(Fragment11, { children: [
|
|
28970
|
+
/* @__PURE__ */ jsx96(
|
|
28772
28971
|
CommandBar.Command,
|
|
28773
28972
|
{
|
|
28774
28973
|
label: command.label,
|
|
@@ -28781,7 +28980,7 @@ var DataTableRoot = ({
|
|
|
28781
28980
|
)
|
|
28782
28981
|
}
|
|
28783
28982
|
),
|
|
28784
|
-
index < commands.length - 1 && /* @__PURE__ */
|
|
28983
|
+
index < commands.length - 1 && /* @__PURE__ */ jsx96(CommandBar.Seperator, {})
|
|
28785
28984
|
] }, index);
|
|
28786
28985
|
})
|
|
28787
28986
|
] }) })
|
|
@@ -28798,7 +28997,7 @@ var Pagination = (props) => {
|
|
|
28798
28997
|
prev: t2("general.prev"),
|
|
28799
28998
|
next: t2("general.next")
|
|
28800
28999
|
};
|
|
28801
|
-
return /* @__PURE__ */
|
|
29000
|
+
return /* @__PURE__ */ jsx96(
|
|
28802
29001
|
Table2.Pagination,
|
|
28803
29002
|
{
|
|
28804
29003
|
className: "flex-shrink-0",
|
|
@@ -28809,7 +29008,7 @@ var Pagination = (props) => {
|
|
|
28809
29008
|
};
|
|
28810
29009
|
|
|
28811
29010
|
// src/components/table/data-table/data-table.tsx
|
|
28812
|
-
import { jsx as
|
|
29011
|
+
import { jsx as jsx97, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
28813
29012
|
var MemoizedDataTableQuery = memo(DataTableQuery);
|
|
28814
29013
|
var _DataTable = ({
|
|
28815
29014
|
table,
|
|
@@ -28831,7 +29030,7 @@ var _DataTable = ({
|
|
|
28831
29030
|
noResults: noResultsProps = {}
|
|
28832
29031
|
}) => {
|
|
28833
29032
|
if (isLoading) {
|
|
28834
|
-
return /* @__PURE__ */
|
|
29033
|
+
return /* @__PURE__ */ jsx97(
|
|
28835
29034
|
TableSkeleton,
|
|
28836
29035
|
{
|
|
28837
29036
|
layout,
|
|
@@ -28847,24 +29046,24 @@ var _DataTable = ({
|
|
|
28847
29046
|
const showNoResults = !isLoading && count === 0 && !noQuery;
|
|
28848
29047
|
const noRecords = !isLoading && count === 0 && noQuery;
|
|
28849
29048
|
if (noRecords) {
|
|
28850
|
-
return /* @__PURE__ */
|
|
29049
|
+
return /* @__PURE__ */ jsx97(
|
|
28851
29050
|
NoRecords,
|
|
28852
29051
|
{
|
|
28853
|
-
className:
|
|
29052
|
+
className: clx50({
|
|
28854
29053
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
28855
29054
|
}),
|
|
28856
29055
|
...noRecordsProps
|
|
28857
29056
|
}
|
|
28858
29057
|
);
|
|
28859
29058
|
}
|
|
28860
|
-
return /* @__PURE__ */
|
|
29059
|
+
return /* @__PURE__ */ jsxs71(
|
|
28861
29060
|
"div",
|
|
28862
29061
|
{
|
|
28863
|
-
className:
|
|
29062
|
+
className: clx50("divide-y", {
|
|
28864
29063
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
28865
29064
|
}),
|
|
28866
29065
|
children: [
|
|
28867
|
-
/* @__PURE__ */
|
|
29066
|
+
/* @__PURE__ */ jsx97(
|
|
28868
29067
|
MemoizedDataTableQuery,
|
|
28869
29068
|
{
|
|
28870
29069
|
search,
|
|
@@ -28873,7 +29072,7 @@ var _DataTable = ({
|
|
|
28873
29072
|
prefix
|
|
28874
29073
|
}
|
|
28875
29074
|
),
|
|
28876
|
-
/* @__PURE__ */
|
|
29075
|
+
/* @__PURE__ */ jsx97(
|
|
28877
29076
|
DataTableRoot,
|
|
28878
29077
|
{
|
|
28879
29078
|
table,
|
|
@@ -28895,12 +29094,12 @@ var _DataTable = ({
|
|
|
28895
29094
|
|
|
28896
29095
|
// src/components/table/table-cells/common/code-cell/code-cell.tsx
|
|
28897
29096
|
import { Badge as Badge8 } from "@medusajs/ui";
|
|
28898
|
-
import { jsx as
|
|
29097
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
28899
29098
|
var CodeCell = ({ code }) => {
|
|
28900
|
-
return /* @__PURE__ */
|
|
29099
|
+
return /* @__PURE__ */ jsx98("div", { className: "flex h-full w-full items-center gap-x-3 overflow-hidden", children: /* @__PURE__ */ jsx98(Badge8, { size: "2xsmall", className: "truncate", children: code }) });
|
|
28901
29100
|
};
|
|
28902
29101
|
var CodeHeader = ({ text }) => {
|
|
28903
|
-
return /* @__PURE__ */
|
|
29102
|
+
return /* @__PURE__ */ jsx98("div", { className: " flex h-full w-full items-center ", children: /* @__PURE__ */ jsx98("span", { children: text }) });
|
|
28904
29103
|
};
|
|
28905
29104
|
|
|
28906
29105
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
@@ -28908,78 +29107,78 @@ import { Tooltip as Tooltip13 } from "@medusajs/ui";
|
|
|
28908
29107
|
import { useTranslation as useTranslation45 } from "react-i18next";
|
|
28909
29108
|
|
|
28910
29109
|
// src/components/table/table-cells/common/placeholder-cell/placeholder-cell.tsx
|
|
28911
|
-
import { jsx as
|
|
29110
|
+
import { jsx as jsx99 } from "react/jsx-runtime";
|
|
28912
29111
|
var PlaceholderCell = () => {
|
|
28913
|
-
return /* @__PURE__ */
|
|
29112
|
+
return /* @__PURE__ */ jsx99("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx99("span", { className: "text-ui-fg-muted", children: "-" }) });
|
|
28914
29113
|
};
|
|
28915
29114
|
|
|
28916
29115
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
28917
|
-
import { jsx as
|
|
29116
|
+
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
28918
29117
|
var CreatedAtCell = ({ date }) => {
|
|
28919
29118
|
const { getFullDate } = useDate();
|
|
28920
29119
|
if (!date) {
|
|
28921
|
-
return /* @__PURE__ */
|
|
29120
|
+
return /* @__PURE__ */ jsx100(PlaceholderCell, {});
|
|
28922
29121
|
}
|
|
28923
|
-
return /* @__PURE__ */
|
|
29122
|
+
return /* @__PURE__ */ jsx100("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx100(
|
|
28924
29123
|
Tooltip13,
|
|
28925
29124
|
{
|
|
28926
29125
|
className: "z-10",
|
|
28927
|
-
content: /* @__PURE__ */
|
|
29126
|
+
content: /* @__PURE__ */ jsx100("span", { className: "text-pretty", children: `${getFullDate({
|
|
28928
29127
|
date,
|
|
28929
29128
|
includeTime: true
|
|
28930
29129
|
})}` }),
|
|
28931
|
-
children: /* @__PURE__ */
|
|
29130
|
+
children: /* @__PURE__ */ jsx100("span", { className: "truncate", children: getFullDate({ date, includeTime: true }) })
|
|
28932
29131
|
}
|
|
28933
29132
|
) });
|
|
28934
29133
|
};
|
|
28935
29134
|
var CreatedAtHeader = () => {
|
|
28936
29135
|
const { t: t2 } = useTranslation45();
|
|
28937
|
-
return /* @__PURE__ */
|
|
29136
|
+
return /* @__PURE__ */ jsx100("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx100("span", { className: "truncate", children: t2("fields.createdAt") }) });
|
|
28938
29137
|
};
|
|
28939
29138
|
|
|
28940
29139
|
// src/components/table/table-cells/common/date-cell/date-cell.tsx
|
|
28941
29140
|
import { Tooltip as Tooltip14 } from "@medusajs/ui";
|
|
28942
29141
|
import { useTranslation as useTranslation46 } from "react-i18next";
|
|
28943
|
-
import { jsx as
|
|
29142
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
28944
29143
|
var DateCell = ({ date }) => {
|
|
28945
29144
|
const { getFullDate } = useDate();
|
|
28946
29145
|
if (!date) {
|
|
28947
|
-
return /* @__PURE__ */
|
|
29146
|
+
return /* @__PURE__ */ jsx101(PlaceholderCell, {});
|
|
28948
29147
|
}
|
|
28949
|
-
return /* @__PURE__ */
|
|
29148
|
+
return /* @__PURE__ */ jsx101("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx101(
|
|
28950
29149
|
Tooltip14,
|
|
28951
29150
|
{
|
|
28952
29151
|
className: "z-10",
|
|
28953
|
-
content: /* @__PURE__ */
|
|
29152
|
+
content: /* @__PURE__ */ jsx101("span", { className: "text-pretty", children: `${getFullDate({
|
|
28954
29153
|
date,
|
|
28955
29154
|
includeTime: true
|
|
28956
29155
|
})}` }),
|
|
28957
|
-
children: /* @__PURE__ */
|
|
29156
|
+
children: /* @__PURE__ */ jsx101("span", { className: "truncate", children: getFullDate({ date, includeTime: false }) })
|
|
28958
29157
|
}
|
|
28959
29158
|
) });
|
|
28960
29159
|
};
|
|
28961
29160
|
var DateHeader = () => {
|
|
28962
29161
|
const { t: t2 } = useTranslation46();
|
|
28963
|
-
return /* @__PURE__ */
|
|
29162
|
+
return /* @__PURE__ */ jsx101("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx101("span", { className: "truncate", children: t2("fields.date") }) });
|
|
28964
29163
|
};
|
|
28965
29164
|
|
|
28966
29165
|
// src/components/table/table-cells/common/email-cell/email-cell.tsx
|
|
28967
29166
|
import { useTranslation as useTranslation47 } from "react-i18next";
|
|
28968
|
-
import { jsx as
|
|
29167
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
28969
29168
|
var EmailCell = ({ email }) => {
|
|
28970
29169
|
if (!email) {
|
|
28971
|
-
return /* @__PURE__ */
|
|
29170
|
+
return /* @__PURE__ */ jsx102(PlaceholderCell, {});
|
|
28972
29171
|
}
|
|
28973
|
-
return /* @__PURE__ */
|
|
29172
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx102("span", { className: "truncate", children: email }) });
|
|
28974
29173
|
};
|
|
28975
29174
|
var EmailHeader = () => {
|
|
28976
29175
|
const { t: t2 } = useTranslation47();
|
|
28977
|
-
return /* @__PURE__ */
|
|
29176
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx102("span", { className: "truncate", children: t2("fields.email") }) });
|
|
28978
29177
|
};
|
|
28979
29178
|
|
|
28980
29179
|
// src/components/table/table-cells/common/money-amount-cell/money-amount-cell.tsx
|
|
28981
|
-
import { clx as
|
|
28982
|
-
import { jsx as
|
|
29180
|
+
import { clx as clx51 } from "@medusajs/ui";
|
|
29181
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
28983
29182
|
var MoneyAmountCell = ({
|
|
28984
29183
|
currencyCode,
|
|
28985
29184
|
amount,
|
|
@@ -28987,13 +29186,13 @@ var MoneyAmountCell = ({
|
|
|
28987
29186
|
className
|
|
28988
29187
|
}) => {
|
|
28989
29188
|
if (typeof amount === "undefined" || amount === null) {
|
|
28990
|
-
return /* @__PURE__ */
|
|
29189
|
+
return /* @__PURE__ */ jsx103(PlaceholderCell, {});
|
|
28991
29190
|
}
|
|
28992
29191
|
const formatted = getStylizedAmount(amount, currencyCode);
|
|
28993
|
-
return /* @__PURE__ */
|
|
29192
|
+
return /* @__PURE__ */ jsx103(
|
|
28994
29193
|
"div",
|
|
28995
29194
|
{
|
|
28996
|
-
className:
|
|
29195
|
+
className: clx51(
|
|
28997
29196
|
"flex h-full w-full items-center overflow-hidden",
|
|
28998
29197
|
{
|
|
28999
29198
|
"justify-start text-left": align === "left",
|
|
@@ -29001,40 +29200,40 @@ var MoneyAmountCell = ({
|
|
|
29001
29200
|
},
|
|
29002
29201
|
className
|
|
29003
29202
|
),
|
|
29004
|
-
children: /* @__PURE__ */
|
|
29203
|
+
children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: formatted })
|
|
29005
29204
|
}
|
|
29006
29205
|
);
|
|
29007
29206
|
};
|
|
29008
29207
|
|
|
29009
29208
|
// src/components/table/table-cells/common/name-cell/name-cell.tsx
|
|
29010
29209
|
import { useTranslation as useTranslation48 } from "react-i18next";
|
|
29011
|
-
import { jsx as
|
|
29210
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
29012
29211
|
var NameCell = ({ firstName, lastName }) => {
|
|
29013
29212
|
if (!firstName && !lastName) {
|
|
29014
|
-
return /* @__PURE__ */
|
|
29213
|
+
return /* @__PURE__ */ jsx104(PlaceholderCell, {});
|
|
29015
29214
|
}
|
|
29016
29215
|
const name = [firstName, lastName].filter(Boolean).join(" ");
|
|
29017
|
-
return /* @__PURE__ */
|
|
29216
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: name }) });
|
|
29018
29217
|
};
|
|
29019
29218
|
var NameHeader = () => {
|
|
29020
29219
|
const { t: t2 } = useTranslation48();
|
|
29021
|
-
return /* @__PURE__ */
|
|
29220
|
+
return /* @__PURE__ */ jsx104("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx104("span", { className: "truncate", children: t2("fields.name") }) });
|
|
29022
29221
|
};
|
|
29023
29222
|
|
|
29024
29223
|
// src/components/table/table-cells/common/status-cell/status-cell.tsx
|
|
29025
|
-
import { clx as
|
|
29026
|
-
import { jsx as
|
|
29224
|
+
import { clx as clx52 } from "@medusajs/ui";
|
|
29225
|
+
import { jsx as jsx105, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
29027
29226
|
var StatusCell = ({ color, children }) => {
|
|
29028
|
-
return /* @__PURE__ */
|
|
29029
|
-
/* @__PURE__ */
|
|
29227
|
+
return /* @__PURE__ */ jsxs72("div", { className: "txt-compact-small text-ui-fg-subtle flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
|
|
29228
|
+
/* @__PURE__ */ jsx105(
|
|
29030
29229
|
"div",
|
|
29031
29230
|
{
|
|
29032
29231
|
role: "presentation",
|
|
29033
29232
|
className: "flex h-5 w-2 items-center justify-center",
|
|
29034
|
-
children: /* @__PURE__ */
|
|
29233
|
+
children: /* @__PURE__ */ jsx105(
|
|
29035
29234
|
"div",
|
|
29036
29235
|
{
|
|
29037
|
-
className:
|
|
29236
|
+
className: clx52(
|
|
29038
29237
|
"h-2 w-2 rounded-sm shadow-[0px_0px_0px_1px_rgba(0,0,0,0.12)_inset]",
|
|
29039
29238
|
{
|
|
29040
29239
|
"bg-ui-tag-neutral-icon": color === "grey",
|
|
@@ -29049,22 +29248,22 @@ var StatusCell = ({ color, children }) => {
|
|
|
29049
29248
|
)
|
|
29050
29249
|
}
|
|
29051
29250
|
),
|
|
29052
|
-
/* @__PURE__ */
|
|
29251
|
+
/* @__PURE__ */ jsx105("span", { className: "truncate", children })
|
|
29053
29252
|
] });
|
|
29054
29253
|
};
|
|
29055
29254
|
|
|
29056
29255
|
// src/components/table/table-cells/common/text-cell/text-cell.tsx
|
|
29057
|
-
import { clx as
|
|
29058
|
-
import { jsx as
|
|
29256
|
+
import { clx as clx53 } from "@medusajs/ui";
|
|
29257
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
29059
29258
|
var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
29060
29259
|
if (!text) {
|
|
29061
|
-
return /* @__PURE__ */
|
|
29260
|
+
return /* @__PURE__ */ jsx106(PlaceholderCell, {});
|
|
29062
29261
|
}
|
|
29063
29262
|
const stringLength = text.toString().length;
|
|
29064
|
-
return /* @__PURE__ */
|
|
29263
|
+
return /* @__PURE__ */ jsx106(ConditionalTooltip, { content: text, showTooltip: stringLength > 20, children: /* @__PURE__ */ jsx106(
|
|
29065
29264
|
"div",
|
|
29066
29265
|
{
|
|
29067
|
-
className:
|
|
29266
|
+
className: clx53("flex h-full w-full items-center gap-x-3 overflow-hidden", {
|
|
29068
29267
|
"justify-start text-start": align === "left",
|
|
29069
29268
|
"justify-center text-center": align === "center",
|
|
29070
29269
|
"justify-end text-end": align === "right"
|
|
@@ -29072,16 +29271,16 @@ var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
|
29072
29271
|
style: {
|
|
29073
29272
|
maxWidth
|
|
29074
29273
|
},
|
|
29075
|
-
children: /* @__PURE__ */
|
|
29274
|
+
children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: text })
|
|
29076
29275
|
}
|
|
29077
29276
|
) });
|
|
29078
29277
|
};
|
|
29079
29278
|
var TextHeader = ({ text, align = "left" }) => {
|
|
29080
|
-
return /* @__PURE__ */
|
|
29279
|
+
return /* @__PURE__ */ jsx106("div", { className: clx53("flex h-full w-full items-center", {
|
|
29081
29280
|
"justify-start text-start": align === "left",
|
|
29082
29281
|
"justify-center text-center": align === "center",
|
|
29083
29282
|
"justify-end text-end": align === "right"
|
|
29084
|
-
}), children: /* @__PURE__ */
|
|
29283
|
+
}), children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: text }) });
|
|
29085
29284
|
};
|
|
29086
29285
|
|
|
29087
29286
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
@@ -29097,7 +29296,7 @@ var isClientError = (error) => {
|
|
|
29097
29296
|
};
|
|
29098
29297
|
|
|
29099
29298
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29100
|
-
import { jsx as
|
|
29299
|
+
import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
29101
29300
|
var ErrorBoundary = () => {
|
|
29102
29301
|
const error = useRouteError();
|
|
29103
29302
|
const location = useLocation3();
|
|
@@ -29105,7 +29304,7 @@ var ErrorBoundary = () => {
|
|
|
29105
29304
|
let code = null;
|
|
29106
29305
|
if (isClientError(error)) {
|
|
29107
29306
|
if (error.status === 401) {
|
|
29108
|
-
return /* @__PURE__ */
|
|
29307
|
+
return /* @__PURE__ */ jsx107(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
29109
29308
|
}
|
|
29110
29309
|
code = error.status ?? null;
|
|
29111
29310
|
}
|
|
@@ -29132,11 +29331,11 @@ var ErrorBoundary = () => {
|
|
|
29132
29331
|
message = t2("errorBoundary.defaultMessage");
|
|
29133
29332
|
break;
|
|
29134
29333
|
}
|
|
29135
|
-
return /* @__PURE__ */
|
|
29136
|
-
/* @__PURE__ */
|
|
29137
|
-
/* @__PURE__ */
|
|
29138
|
-
/* @__PURE__ */
|
|
29139
|
-
/* @__PURE__ */
|
|
29334
|
+
return /* @__PURE__ */ jsx107("div", { className: "flex size-full min-h-[calc(100vh-57px-24px)] items-center justify-center", children: /* @__PURE__ */ jsx107("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxs73("div", { className: "text-ui-fg-subtle flex flex-col items-center gap-y-3", children: [
|
|
29335
|
+
/* @__PURE__ */ jsx107(ExclamationCircle4, {}),
|
|
29336
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
29337
|
+
/* @__PURE__ */ jsx107(Text21, { size: "small", leading: "compact", weight: "plus", children: title }),
|
|
29338
|
+
/* @__PURE__ */ jsx107(
|
|
29140
29339
|
Text21,
|
|
29141
29340
|
{
|
|
29142
29341
|
size: "small",
|
|
@@ -29149,9 +29348,9 @@ var ErrorBoundary = () => {
|
|
|
29149
29348
|
};
|
|
29150
29349
|
|
|
29151
29350
|
// src/components/utilities/visually-hidden/visually-hidden.tsx
|
|
29152
|
-
import { jsx as
|
|
29351
|
+
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
29153
29352
|
var VisuallyHidden = ({ children }) => {
|
|
29154
|
-
return /* @__PURE__ */
|
|
29353
|
+
return /* @__PURE__ */ jsx108("span", { className: "sr-only", children });
|
|
29155
29354
|
};
|
|
29156
29355
|
|
|
29157
29356
|
// src/hooks/use-data-table.tsx
|
|
@@ -29247,7 +29446,7 @@ var useDataTable2 = ({
|
|
|
29247
29446
|
|
|
29248
29447
|
// src/permissions/permissions-provider.tsx
|
|
29249
29448
|
import { useCallback as useCallback28, useMemo as useMemo26 } from "react";
|
|
29250
|
-
import { jsx as
|
|
29449
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
29251
29450
|
var PermissionsProvider = ({
|
|
29252
29451
|
permissions = null,
|
|
29253
29452
|
isLoading = false,
|
|
@@ -29288,7 +29487,7 @@ var PermissionsProvider = ({
|
|
|
29288
29487
|
}),
|
|
29289
29488
|
[permissions, isLoading, isEnforced, hasPermission, hasAnyPermission, hasAllPermissions, can]
|
|
29290
29489
|
);
|
|
29291
|
-
return /* @__PURE__ */
|
|
29490
|
+
return /* @__PURE__ */ jsx109(PermissionsContext.Provider, { value, children });
|
|
29292
29491
|
};
|
|
29293
29492
|
|
|
29294
29493
|
// src/permissions/use-permissions.tsx
|
|
@@ -29302,7 +29501,7 @@ var usePermissions = () => {
|
|
|
29302
29501
|
};
|
|
29303
29502
|
|
|
29304
29503
|
// src/permissions/permission-guard.tsx
|
|
29305
|
-
import { Fragment as Fragment12, jsx as
|
|
29504
|
+
import { Fragment as Fragment12, jsx as jsx110 } from "react/jsx-runtime";
|
|
29306
29505
|
var PermissionGuard = ({
|
|
29307
29506
|
children,
|
|
29308
29507
|
permission,
|
|
@@ -29312,7 +29511,7 @@ var PermissionGuard = ({
|
|
|
29312
29511
|
const { hasAnyPermission, hasAllPermissions } = usePermissions();
|
|
29313
29512
|
const list = Array.isArray(permission) ? permission : [permission];
|
|
29314
29513
|
const allowed = requireAll ? hasAllPermissions(list) : hasAnyPermission(list);
|
|
29315
|
-
return /* @__PURE__ */
|
|
29514
|
+
return /* @__PURE__ */ jsx110(Fragment12, { children: allowed ? children : fallback });
|
|
29316
29515
|
};
|
|
29317
29516
|
|
|
29318
29517
|
// src/permissions/route-permission-guard.tsx
|
|
@@ -29321,7 +29520,7 @@ import { Container as Container6, Heading as Heading10, Text as Text22 } from "@
|
|
|
29321
29520
|
import { useMemo as useMemo27 } from "react";
|
|
29322
29521
|
import { useTranslation as useTranslation50 } from "react-i18next";
|
|
29323
29522
|
import { Navigate as Navigate2, Outlet as Outlet3, useMatches } from "react-router-dom";
|
|
29324
|
-
import { jsx as
|
|
29523
|
+
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
29325
29524
|
var readRequirementFromHandle = (handle) => {
|
|
29326
29525
|
if (!handle || typeof handle !== "object") {
|
|
29327
29526
|
return void 0;
|
|
@@ -29361,28 +29560,28 @@ var RoutePermissionGuard = () => {
|
|
|
29361
29560
|
return void 0;
|
|
29362
29561
|
}, [matches]);
|
|
29363
29562
|
if (isLoading || !requirement) {
|
|
29364
|
-
return /* @__PURE__ */
|
|
29563
|
+
return /* @__PURE__ */ jsx111(Outlet3, {});
|
|
29365
29564
|
}
|
|
29366
29565
|
const hasAccess = requirement.requireAll ? hasAllPermissions(requirement.permissions) : hasAnyPermission(requirement.permissions);
|
|
29367
29566
|
if (!hasAccess) {
|
|
29368
29567
|
if (requirement.redirectTo) {
|
|
29369
|
-
return /* @__PURE__ */
|
|
29568
|
+
return /* @__PURE__ */ jsx111(Navigate2, { to: requirement.redirectTo, replace: true });
|
|
29370
29569
|
}
|
|
29371
|
-
return /* @__PURE__ */
|
|
29570
|
+
return /* @__PURE__ */ jsx111(AccessDenied, { requirement });
|
|
29372
29571
|
}
|
|
29373
|
-
return /* @__PURE__ */
|
|
29572
|
+
return /* @__PURE__ */ jsx111(Outlet3, {});
|
|
29374
29573
|
};
|
|
29375
29574
|
var AccessDenied = ({
|
|
29376
29575
|
requirement
|
|
29377
29576
|
}) => {
|
|
29378
29577
|
const { t: t2 } = useTranslation50();
|
|
29379
|
-
return /* @__PURE__ */
|
|
29380
|
-
/* @__PURE__ */
|
|
29381
|
-
/* @__PURE__ */
|
|
29382
|
-
/* @__PURE__ */
|
|
29383
|
-
/* @__PURE__ */
|
|
29578
|
+
return /* @__PURE__ */ jsx111("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__ */ jsx111(Container6, { className: "max-w-md", children: /* @__PURE__ */ jsxs74("div", { className: "flex flex-col items-center gap-y-4 py-8 text-center", children: [
|
|
29579
|
+
/* @__PURE__ */ jsx111("div", { className: "bg-ui-bg-subtle flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx111(ExclamationCircle5, { className: "text-ui-fg-muted" }) }),
|
|
29580
|
+
/* @__PURE__ */ jsxs74("div", { className: "flex flex-col gap-y-1", children: [
|
|
29581
|
+
/* @__PURE__ */ jsx111(Heading10, { level: "h2", children: t2("permissions.accessDenied.title") }),
|
|
29582
|
+
/* @__PURE__ */ jsx111(Text22, { className: "text-ui-fg-subtle", children: t2("permissions.accessDenied.description") })
|
|
29384
29583
|
] }),
|
|
29385
|
-
/* @__PURE__ */
|
|
29584
|
+
/* @__PURE__ */ jsx111(Text22, { size: "small", className: "text-ui-fg-muted", children: t2("permissions.accessDenied.requiredPermission", {
|
|
29386
29585
|
permission: requirement.permissions.join(", ")
|
|
29387
29586
|
}) })
|
|
29388
29587
|
] }) }) });
|
|
@@ -29413,7 +29612,7 @@ import {
|
|
|
29413
29612
|
cloneElement as cloneElement2,
|
|
29414
29613
|
isValidElement
|
|
29415
29614
|
} from "react";
|
|
29416
|
-
import { jsx as
|
|
29615
|
+
import { jsx as jsx112 } from "react/jsx-runtime";
|
|
29417
29616
|
var PermissionAction = ({
|
|
29418
29617
|
permission,
|
|
29419
29618
|
requireAll = false,
|
|
@@ -29425,16 +29624,16 @@ var PermissionAction = ({
|
|
|
29425
29624
|
}
|
|
29426
29625
|
const inner = children.props.children;
|
|
29427
29626
|
const label = children.props.asChild && isValidElement(inner) ? inner.props.children : inner;
|
|
29428
|
-
return /* @__PURE__ */
|
|
29627
|
+
return /* @__PURE__ */ jsx112(Tooltip15, { content: gate.tooltip, children: /* @__PURE__ */ jsx112("span", { className: "inline-flex", children: cloneElement2(children, { disabled: true, asChild: false }, label) }) });
|
|
29429
29628
|
};
|
|
29430
29629
|
|
|
29431
29630
|
// src/permissions/section-no-access.tsx
|
|
29432
29631
|
import { Text as Text23 } from "@medusajs/ui";
|
|
29433
29632
|
import { useTranslation as useTranslation51 } from "react-i18next";
|
|
29434
|
-
import { jsx as
|
|
29633
|
+
import { jsx as jsx113 } from "react/jsx-runtime";
|
|
29435
29634
|
var SectionNoAccess = ({ className }) => {
|
|
29436
29635
|
const { t: t2 } = useTranslation51();
|
|
29437
|
-
return /* @__PURE__ */
|
|
29636
|
+
return /* @__PURE__ */ jsx113("div", { className: className ?? "px-6 py-4", "data-testid": "section-no-access", children: /* @__PURE__ */ jsx113(Text23, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t2("permissions.noAccess") }) });
|
|
29438
29637
|
};
|
|
29439
29638
|
|
|
29440
29639
|
// src/permissions/with-permission.ts
|
|
@@ -29461,7 +29660,7 @@ var SidebarContext = createContext11(null);
|
|
|
29461
29660
|
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
29462
29661
|
import { useCallback as useCallback29, useEffect as useEffect27, useMemo as useMemo29, useState as useState40 } from "react";
|
|
29463
29662
|
import { useLocation as useLocation4 } from "react-router-dom";
|
|
29464
|
-
import { jsx as
|
|
29663
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
29465
29664
|
var SidebarProvider = ({ children }) => {
|
|
29466
29665
|
const [desktop, setDesktop] = useState40(true);
|
|
29467
29666
|
const [mobile, setMobile] = useState40(false);
|
|
@@ -29487,7 +29686,7 @@ var SidebarProvider = ({ children }) => {
|
|
|
29487
29686
|
}),
|
|
29488
29687
|
[desktop, mobile, toggle]
|
|
29489
29688
|
);
|
|
29490
|
-
return /* @__PURE__ */
|
|
29689
|
+
return /* @__PURE__ */ jsx114(SidebarContext.Provider, { value, children });
|
|
29491
29690
|
};
|
|
29492
29691
|
|
|
29493
29692
|
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
@@ -29530,6 +29729,197 @@ var useSidebarMenuPlacement = (align) => {
|
|
|
29530
29729
|
return state === "collapsed" ? { side: "right", align } : {};
|
|
29531
29730
|
};
|
|
29532
29731
|
|
|
29732
|
+
// src/layout-composer/layout-composer.tsx
|
|
29733
|
+
import { Fragment as Fragment15, useContext as useContext18, useMemo as useMemo30 } from "react";
|
|
29734
|
+
import { Outlet as Outlet4 } from "react-router-dom";
|
|
29735
|
+
|
|
29736
|
+
// src/layout-composer/entries.ts
|
|
29737
|
+
import {
|
|
29738
|
+
Children as Children4,
|
|
29739
|
+
Fragment as Fragment14,
|
|
29740
|
+
createElement as createElement3,
|
|
29741
|
+
isValidElement as isValidElement2
|
|
29742
|
+
} from "react";
|
|
29743
|
+
|
|
29744
|
+
// src/layout-composer/entry.tsx
|
|
29745
|
+
import { Fragment as Fragment13 } from "react";
|
|
29746
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
29747
|
+
function LayoutEntry({ children }) {
|
|
29748
|
+
return /* @__PURE__ */ jsx115(Fragment13, { children });
|
|
29749
|
+
}
|
|
29750
|
+
LayoutEntry.displayName = "LayoutEntry";
|
|
29751
|
+
|
|
29752
|
+
// src/layout-composer/entries.ts
|
|
29753
|
+
var CORE_ENTRY_PREFIX = "core:";
|
|
29754
|
+
function getElementName(element) {
|
|
29755
|
+
const { type } = element;
|
|
29756
|
+
if (typeof type === "string") return type;
|
|
29757
|
+
return type.displayName ?? type.name ?? "unknown";
|
|
29758
|
+
}
|
|
29759
|
+
function isLayoutEntry(element) {
|
|
29760
|
+
return element.type === LayoutEntry;
|
|
29761
|
+
}
|
|
29762
|
+
function getCoreEntryKey(element) {
|
|
29763
|
+
return isLayoutEntry(element) ? element.props.id : getElementName(element);
|
|
29764
|
+
}
|
|
29765
|
+
function collectElements(node) {
|
|
29766
|
+
const elements = [];
|
|
29767
|
+
Children4.forEach(node, (child) => {
|
|
29768
|
+
if (!isValidElement2(child)) return;
|
|
29769
|
+
if (child.type === Fragment14) {
|
|
29770
|
+
elements.push(...collectElements(child.props.children));
|
|
29771
|
+
return;
|
|
29772
|
+
}
|
|
29773
|
+
elements.push(child);
|
|
29774
|
+
});
|
|
29775
|
+
return elements;
|
|
29776
|
+
}
|
|
29777
|
+
function extractSectionElements(sections) {
|
|
29778
|
+
const result = {};
|
|
29779
|
+
for (const [section, node] of Object.entries(sections)) {
|
|
29780
|
+
result[section] = collectElements(node);
|
|
29781
|
+
}
|
|
29782
|
+
return result;
|
|
29783
|
+
}
|
|
29784
|
+
function buildCoreEntries(elementsBySection) {
|
|
29785
|
+
const entries = [];
|
|
29786
|
+
const seen = /* @__PURE__ */ new Map();
|
|
29787
|
+
for (const [section, elements] of Object.entries(elementsBySection)) {
|
|
29788
|
+
for (const element of elements) {
|
|
29789
|
+
const base = `${CORE_ENTRY_PREFIX}${getCoreEntryKey(element)}`;
|
|
29790
|
+
const count = seen.get(base) ?? 0;
|
|
29791
|
+
seen.set(base, count + 1);
|
|
29792
|
+
entries.push({
|
|
29793
|
+
entryId: count === 0 ? base : `${base}#${count + 1}`,
|
|
29794
|
+
render: () => element,
|
|
29795
|
+
naturalSection: section
|
|
29796
|
+
});
|
|
29797
|
+
}
|
|
29798
|
+
}
|
|
29799
|
+
return entries;
|
|
29800
|
+
}
|
|
29801
|
+
function buildWidgetEntries(widgets) {
|
|
29802
|
+
const entries = [];
|
|
29803
|
+
for (const [section, list] of Object.entries(widgets)) {
|
|
29804
|
+
for (const widget of list) {
|
|
29805
|
+
const Component = widget.Component;
|
|
29806
|
+
entries.push({
|
|
29807
|
+
entryId: widget.widgetId,
|
|
29808
|
+
render: (data, renderDefault) => createElement3(Component, { data, renderDefault }),
|
|
29809
|
+
naturalSection: section,
|
|
29810
|
+
order: widget.order,
|
|
29811
|
+
replace: widget.replace
|
|
29812
|
+
});
|
|
29813
|
+
}
|
|
29814
|
+
}
|
|
29815
|
+
return entries;
|
|
29816
|
+
}
|
|
29817
|
+
var warned = /* @__PURE__ */ new Set();
|
|
29818
|
+
function applyReplacements(core, widgets) {
|
|
29819
|
+
const result = [...core];
|
|
29820
|
+
for (const widget of widgets) {
|
|
29821
|
+
const target = widget.replace ? result.findIndex((e) => e.entryId === widget.replace) : -1;
|
|
29822
|
+
if (target === -1) {
|
|
29823
|
+
if (widget.replace && !warned.has(widget.replace)) {
|
|
29824
|
+
warned.add(widget.replace);
|
|
29825
|
+
console.warn(
|
|
29826
|
+
`[mercur] Widget "${widget.entryId}" replaces "${widget.replace}", which this page does not render; rendering it after the section instead.`
|
|
29827
|
+
);
|
|
29828
|
+
}
|
|
29829
|
+
result.push(widget);
|
|
29830
|
+
continue;
|
|
29831
|
+
}
|
|
29832
|
+
const replaced = result[target];
|
|
29833
|
+
const render = widget.render;
|
|
29834
|
+
result[target] = {
|
|
29835
|
+
entryId: widget.entryId,
|
|
29836
|
+
naturalSection: replaced.naturalSection,
|
|
29837
|
+
order: replaced.order,
|
|
29838
|
+
render: (data) => render(data, () => replaced.render(data))
|
|
29839
|
+
};
|
|
29840
|
+
}
|
|
29841
|
+
return result;
|
|
29842
|
+
}
|
|
29843
|
+
function buildDisplayEntries(raw, preference, validSections) {
|
|
29844
|
+
const result = {};
|
|
29845
|
+
for (const entry of raw) {
|
|
29846
|
+
const pref = preference.entries?.[entry.entryId];
|
|
29847
|
+
const section = pref?.section && validSections.has(pref.section) ? pref.section : entry.naturalSection;
|
|
29848
|
+
if (!validSections.has(section)) continue;
|
|
29849
|
+
result[section] ?? (result[section] = []);
|
|
29850
|
+
result[section].push({
|
|
29851
|
+
entryId: entry.entryId,
|
|
29852
|
+
render: entry.render,
|
|
29853
|
+
order: pref?.order ?? entry.order ?? 0,
|
|
29854
|
+
hidden: pref?.hidden ?? false
|
|
29855
|
+
});
|
|
29856
|
+
}
|
|
29857
|
+
for (const section of Object.keys(result)) {
|
|
29858
|
+
result[section].sort((a, b) => a.order - b.order);
|
|
29859
|
+
}
|
|
29860
|
+
return result;
|
|
29861
|
+
}
|
|
29862
|
+
|
|
29863
|
+
// src/layout-composer/layout-composer.tsx
|
|
29864
|
+
import { jsx as jsx116, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
29865
|
+
var LayoutComposerRoot = ({
|
|
29866
|
+
widgetsZonePrefix,
|
|
29867
|
+
preferredLayoutId,
|
|
29868
|
+
sections,
|
|
29869
|
+
data,
|
|
29870
|
+
hasOutlet = true,
|
|
29871
|
+
disableWidgets = false,
|
|
29872
|
+
layoutProps = {},
|
|
29873
|
+
"data-testid": testId
|
|
29874
|
+
}) => {
|
|
29875
|
+
const registry = useExtension();
|
|
29876
|
+
const permissions = useContext18(PermissionsContext);
|
|
29877
|
+
const layout = registry.getLayout(preferredLayoutId);
|
|
29878
|
+
const entriesBySection = useMemo30(() => {
|
|
29879
|
+
const sectionIds = layout?.sections.map((section) => section.id) ?? [];
|
|
29880
|
+
const validSections = new Set(sectionIds);
|
|
29881
|
+
const core = buildCoreEntries(extractSectionElements(sections));
|
|
29882
|
+
const widgets = disableWidgets ? {} : registry.getWidgetsForSections(widgetsZonePrefix, sectionIds);
|
|
29883
|
+
for (const section of Object.keys(widgets)) {
|
|
29884
|
+
widgets[section] = widgets[section].filter(
|
|
29885
|
+
(widget) => isPermitted(permissions, widget.permission)
|
|
29886
|
+
);
|
|
29887
|
+
}
|
|
29888
|
+
return buildDisplayEntries(
|
|
29889
|
+
applyReplacements(core, buildWidgetEntries(widgets)),
|
|
29890
|
+
registry.getLayoutPreference(widgetsZonePrefix),
|
|
29891
|
+
validSections
|
|
29892
|
+
);
|
|
29893
|
+
}, [sections, widgetsZonePrefix, layout, disableWidgets, registry, permissions]);
|
|
29894
|
+
if (!layout) {
|
|
29895
|
+
if (process.env.NODE_ENV === "development") {
|
|
29896
|
+
console.warn(`[mercur] Unknown layout "${preferredLayoutId}".`);
|
|
29897
|
+
}
|
|
29898
|
+
return null;
|
|
29899
|
+
}
|
|
29900
|
+
const rendered = {};
|
|
29901
|
+
for (const section of layout.sections) {
|
|
29902
|
+
rendered[section.id] = (entriesBySection[section.id] ?? []).filter((entry) => !entry.hidden).map((entry) => /* @__PURE__ */ jsx116(Fragment15, { children: entry.render(data) }, entry.entryId));
|
|
29903
|
+
}
|
|
29904
|
+
const LayoutComponent = layout.Component;
|
|
29905
|
+
return /* @__PURE__ */ jsxs75("div", { className: "flex w-full flex-col gap-y-3", "data-testid": testId, children: [
|
|
29906
|
+
/* @__PURE__ */ jsx116(LayoutComponent, { sections: rendered, data, ...layoutProps }),
|
|
29907
|
+
hasOutlet && /* @__PURE__ */ jsx116(Outlet4, {})
|
|
29908
|
+
] });
|
|
29909
|
+
};
|
|
29910
|
+
var LayoutComposer = Object.assign(LayoutComposerRoot, {
|
|
29911
|
+
Entry: LayoutEntry
|
|
29912
|
+
});
|
|
29913
|
+
|
|
29914
|
+
// src/layout-composer/detail-page-defaults.tsx
|
|
29915
|
+
import { Fragment as Fragment16, jsx as jsx117, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
29916
|
+
function detailPageDefaultEntries(data, { metadata = true, jsonView = true } = {}) {
|
|
29917
|
+
return /* @__PURE__ */ jsxs76(Fragment16, { children: [
|
|
29918
|
+
metadata && /* @__PURE__ */ jsx117(LayoutEntry, { id: "MetadataSection", children: /* @__PURE__ */ jsx117(MetadataSection, { data }) }),
|
|
29919
|
+
jsonView && /* @__PURE__ */ jsx117(LayoutEntry, { id: "JsonViewSection", children: /* @__PURE__ */ jsx117(JsonViewSection, { data }) })
|
|
29920
|
+
] });
|
|
29921
|
+
}
|
|
29922
|
+
|
|
29533
29923
|
// src/price-lists/constants.ts
|
|
29534
29924
|
var PriceListStatus = /* @__PURE__ */ ((PriceListStatus2) => {
|
|
29535
29925
|
PriceListStatus2["ACTIVE"] = "active";
|
|
@@ -29692,6 +30082,8 @@ export {
|
|
|
29692
30082
|
AddressSchema,
|
|
29693
30083
|
AttributeValueInput,
|
|
29694
30084
|
BadgeListSummary,
|
|
30085
|
+
CORE_ENTRY_PREFIX,
|
|
30086
|
+
CORE_LAYOUTS,
|
|
29695
30087
|
ChipGroup,
|
|
29696
30088
|
ChipInput,
|
|
29697
30089
|
CodeCell,
|
|
@@ -29736,6 +30128,8 @@ export {
|
|
|
29736
30128
|
JsonViewSection,
|
|
29737
30129
|
JsonViewSectionSkeleton,
|
|
29738
30130
|
KeyboundForm,
|
|
30131
|
+
LayoutComposer,
|
|
30132
|
+
LayoutEntry,
|
|
29739
30133
|
LinkButton,
|
|
29740
30134
|
ListBadge,
|
|
29741
30135
|
ListSummary,
|
|
@@ -29779,6 +30173,7 @@ export {
|
|
|
29779
30173
|
SidebarContext,
|
|
29780
30174
|
SidebarLink,
|
|
29781
30175
|
SidebarProvider,
|
|
30176
|
+
SingleColumnLayoutComponent,
|
|
29782
30177
|
SingleColumnPage,
|
|
29783
30178
|
SingleColumnPageSkeleton,
|
|
29784
30179
|
Skeleton,
|
|
@@ -29797,6 +30192,7 @@ export {
|
|
|
29797
30192
|
TextSkeleton,
|
|
29798
30193
|
Thumbnail,
|
|
29799
30194
|
TransferOwnershipSchema,
|
|
30195
|
+
TwoColumnLayoutComponent,
|
|
29800
30196
|
TwoColumnPage,
|
|
29801
30197
|
TwoColumnPageSkeleton,
|
|
29802
30198
|
VisuallyHidden,
|
|
@@ -29805,18 +30201,24 @@ export {
|
|
|
29805
30201
|
applyActionPermissions,
|
|
29806
30202
|
applyNavGroups,
|
|
29807
30203
|
applyNavOverrides,
|
|
30204
|
+
applyReplacements,
|
|
29808
30205
|
buildAdditionalDataDefaults,
|
|
29809
30206
|
buildAdditionalDataSchema,
|
|
30207
|
+
buildCoreEntries,
|
|
30208
|
+
buildDisplayEntries,
|
|
29810
30209
|
buildOfferGridData,
|
|
29811
30210
|
buildProductChangeView,
|
|
30211
|
+
buildWidgetEntries,
|
|
29812
30212
|
countries,
|
|
29813
30213
|
createDataGridHelper,
|
|
29814
30214
|
createDataGridPriceColumns,
|
|
29815
30215
|
createFormHelper,
|
|
29816
30216
|
createWithPermission,
|
|
29817
30217
|
currencies,
|
|
30218
|
+
detailPageDefaultEntries,
|
|
29818
30219
|
extractPricesFromOffers,
|
|
29819
30220
|
extractReferenceIds,
|
|
30221
|
+
extractSectionElements,
|
|
29820
30222
|
filterCommandsByPermission,
|
|
29821
30223
|
formatFieldValue,
|
|
29822
30224
|
genericForwardRef,
|
|
@@ -29845,12 +30247,15 @@ export {
|
|
|
29845
30247
|
isReferenceField,
|
|
29846
30248
|
isSameAddress,
|
|
29847
30249
|
linkFields,
|
|
30250
|
+
mergeLayoutPreferences,
|
|
29848
30251
|
mergeListFilters,
|
|
30252
|
+
navOverridesFromPreferences,
|
|
29849
30253
|
permissionMapAllows,
|
|
29850
30254
|
plainTextToHtml,
|
|
29851
30255
|
productChangeViewHasContent,
|
|
29852
30256
|
queryClient,
|
|
29853
30257
|
queryKeysFactory,
|
|
30258
|
+
resolveRouteOverrides,
|
|
29854
30259
|
richTextContentClasses,
|
|
29855
30260
|
sanitizeRichText,
|
|
29856
30261
|
toPermissionList,
|