@mercurjs/dashboard-shared 2.3.8-canary.1 → 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 +732 -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,24 +27559,30 @@ 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
|
] });
|
|
27376
27575
|
};
|
|
27377
27576
|
var filter_chip_default = FilterChip;
|
|
27378
27577
|
|
|
27578
|
+
// src/components/table/data-table/data-table-filter/is-complete-date.ts
|
|
27579
|
+
var MIN_FULL_YEAR = 1e3;
|
|
27580
|
+
var isCompleteDate = (date) => {
|
|
27581
|
+
return !!date && !Number.isNaN(date.getTime()) && date.getFullYear() >= MIN_FULL_YEAR;
|
|
27582
|
+
};
|
|
27583
|
+
|
|
27379
27584
|
// src/components/table/data-table/data-table-filter/date-filter.tsx
|
|
27380
|
-
import { jsx as
|
|
27585
|
+
import { jsx as jsx88, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
27381
27586
|
var DateFilter = ({
|
|
27382
27587
|
filter,
|
|
27383
27588
|
prefix,
|
|
@@ -27404,6 +27609,9 @@ var DateFilter = ({
|
|
|
27404
27609
|
const customStartValue = getDateFromComparison(currentDateComparison, "$gte");
|
|
27405
27610
|
const customEndValue = getDateFromComparison(currentDateComparison, "$lte");
|
|
27406
27611
|
const handleCustomDateChange = (value, pos) => {
|
|
27612
|
+
if (value && !isCompleteDate(value)) {
|
|
27613
|
+
return;
|
|
27614
|
+
}
|
|
27407
27615
|
const key2 = pos === "start" ? "$gte" : "$lte";
|
|
27408
27616
|
let dateValue = value;
|
|
27409
27617
|
if (key2 === "$lte" && value) {
|
|
@@ -27451,8 +27659,8 @@ var DateFilter = ({
|
|
|
27451
27659
|
}, 200);
|
|
27452
27660
|
}
|
|
27453
27661
|
};
|
|
27454
|
-
return /* @__PURE__ */
|
|
27455
|
-
/* @__PURE__ */
|
|
27662
|
+
return /* @__PURE__ */ jsxs63(RadixPopover4.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
27663
|
+
/* @__PURE__ */ jsx88(
|
|
27456
27664
|
filter_chip_default,
|
|
27457
27665
|
{
|
|
27458
27666
|
hadPreviousValue: !!previousValue,
|
|
@@ -27462,14 +27670,14 @@ var DateFilter = ({
|
|
|
27462
27670
|
readonly
|
|
27463
27671
|
}
|
|
27464
27672
|
),
|
|
27465
|
-
!readonly && /* @__PURE__ */
|
|
27673
|
+
!readonly && /* @__PURE__ */ jsx88(RadixPopover4.Portal, { children: /* @__PURE__ */ jsxs63(
|
|
27466
27674
|
RadixPopover4.Content,
|
|
27467
27675
|
{
|
|
27468
27676
|
"data-name": "date_filter_content",
|
|
27469
27677
|
align: "start",
|
|
27470
27678
|
sideOffset: 8,
|
|
27471
27679
|
collisionPadding: 24,
|
|
27472
|
-
className:
|
|
27680
|
+
className: clx44(
|
|
27473
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"
|
|
27474
27682
|
),
|
|
27475
27683
|
onInteractOutside: (e) => {
|
|
@@ -27480,10 +27688,10 @@ var DateFilter = ({
|
|
|
27480
27688
|
}
|
|
27481
27689
|
},
|
|
27482
27690
|
children: [
|
|
27483
|
-
/* @__PURE__ */
|
|
27691
|
+
/* @__PURE__ */ jsxs63("ul", { className: "w-full p-1", children: [
|
|
27484
27692
|
presets.map((preset) => {
|
|
27485
27693
|
const isSelected = selectedParams.get().includes(JSON.stringify(preset.value));
|
|
27486
|
-
return /* @__PURE__ */
|
|
27694
|
+
return /* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs63(
|
|
27487
27695
|
"button",
|
|
27488
27696
|
{
|
|
27489
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",
|
|
@@ -27492,16 +27700,16 @@ var DateFilter = ({
|
|
|
27492
27700
|
handleSelectPreset(preset.value);
|
|
27493
27701
|
},
|
|
27494
27702
|
children: [
|
|
27495
|
-
/* @__PURE__ */
|
|
27703
|
+
/* @__PURE__ */ jsx88(
|
|
27496
27704
|
"div",
|
|
27497
27705
|
{
|
|
27498
|
-
className:
|
|
27706
|
+
className: clx44(
|
|
27499
27707
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
27500
27708
|
{
|
|
27501
27709
|
"[&_svg]:invisible": !isSelected
|
|
27502
27710
|
}
|
|
27503
27711
|
),
|
|
27504
|
-
children: /* @__PURE__ */
|
|
27712
|
+
children: /* @__PURE__ */ jsx88(EllipseMiniSolid2, {})
|
|
27505
27713
|
}
|
|
27506
27714
|
),
|
|
27507
27715
|
preset.label
|
|
@@ -27509,23 +27717,23 @@ var DateFilter = ({
|
|
|
27509
27717
|
}
|
|
27510
27718
|
) }, preset.label);
|
|
27511
27719
|
}),
|
|
27512
|
-
/* @__PURE__ */
|
|
27720
|
+
/* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs63(
|
|
27513
27721
|
"button",
|
|
27514
27722
|
{
|
|
27515
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",
|
|
27516
27724
|
type: "button",
|
|
27517
27725
|
onClick: handleSelectCustom,
|
|
27518
27726
|
children: [
|
|
27519
|
-
/* @__PURE__ */
|
|
27727
|
+
/* @__PURE__ */ jsx88(
|
|
27520
27728
|
"div",
|
|
27521
27729
|
{
|
|
27522
|
-
className:
|
|
27730
|
+
className: clx44(
|
|
27523
27731
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
27524
27732
|
{
|
|
27525
27733
|
"[&_svg]:invisible": !showCustom
|
|
27526
27734
|
}
|
|
27527
27735
|
),
|
|
27528
|
-
children: /* @__PURE__ */
|
|
27736
|
+
children: /* @__PURE__ */ jsx88(EllipseMiniSolid2, {})
|
|
27529
27737
|
}
|
|
27530
27738
|
),
|
|
27531
27739
|
t("filters.date.custom")
|
|
@@ -27533,10 +27741,10 @@ var DateFilter = ({
|
|
|
27533
27741
|
}
|
|
27534
27742
|
) })
|
|
27535
27743
|
] }),
|
|
27536
|
-
showCustom && /* @__PURE__ */
|
|
27537
|
-
/* @__PURE__ */
|
|
27538
|
-
/* @__PURE__ */
|
|
27539
|
-
/* @__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(
|
|
27540
27748
|
DatePicker,
|
|
27541
27749
|
{
|
|
27542
27750
|
modal: true,
|
|
@@ -27546,9 +27754,9 @@ var DateFilter = ({
|
|
|
27546
27754
|
}
|
|
27547
27755
|
) })
|
|
27548
27756
|
] }),
|
|
27549
|
-
/* @__PURE__ */
|
|
27550
|
-
/* @__PURE__ */
|
|
27551
|
-
/* @__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(
|
|
27552
27760
|
DatePicker,
|
|
27553
27761
|
{
|
|
27554
27762
|
modal: true,
|
|
@@ -27634,7 +27842,7 @@ var getDateFromComparison = (comparison, key) => {
|
|
|
27634
27842
|
|
|
27635
27843
|
// src/components/table/data-table/data-table-filter/number-filter.tsx
|
|
27636
27844
|
import { EllipseMiniSolid as EllipseMiniSolid3 } from "@medusajs/icons";
|
|
27637
|
-
import { Input as Input11, Label as Label4, clx as
|
|
27845
|
+
import { Input as Input11, Label as Label4, clx as clx45 } from "@medusajs/ui";
|
|
27638
27846
|
import debounce2 from "lodash.debounce";
|
|
27639
27847
|
import {
|
|
27640
27848
|
Popover as RadixPopover5,
|
|
@@ -27642,7 +27850,7 @@ import {
|
|
|
27642
27850
|
} from "radix-ui";
|
|
27643
27851
|
import { useCallback as useCallback24, useEffect as useEffect21, useState as useState33 } from "react";
|
|
27644
27852
|
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
27645
|
-
import { jsx as
|
|
27853
|
+
import { jsx as jsx89, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
27646
27854
|
var NumberFilter = ({
|
|
27647
27855
|
filter,
|
|
27648
27856
|
prefix,
|
|
@@ -27739,8 +27947,8 @@ var NumberFilter = ({
|
|
|
27739
27947
|
const EQ_KEY = key;
|
|
27740
27948
|
const displayValue = parseDisplayValue(currentValue, t2);
|
|
27741
27949
|
const previousDisplayValue = parseDisplayValue(previousValue, t2);
|
|
27742
|
-
return /* @__PURE__ */
|
|
27743
|
-
/* @__PURE__ */
|
|
27950
|
+
return /* @__PURE__ */ jsxs64(RadixPopover5.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
27951
|
+
/* @__PURE__ */ jsx89(
|
|
27744
27952
|
filter_chip_default,
|
|
27745
27953
|
{
|
|
27746
27954
|
hasOperator: true,
|
|
@@ -27751,14 +27959,14 @@ var NumberFilter = ({
|
|
|
27751
27959
|
readonly
|
|
27752
27960
|
}
|
|
27753
27961
|
),
|
|
27754
|
-
!readonly && /* @__PURE__ */
|
|
27962
|
+
!readonly && /* @__PURE__ */ jsx89(RadixPopover5.Portal, { children: /* @__PURE__ */ jsxs64(
|
|
27755
27963
|
RadixPopover5.Content,
|
|
27756
27964
|
{
|
|
27757
27965
|
"data-name": "number_filter_content",
|
|
27758
27966
|
align: "start",
|
|
27759
27967
|
sideOffset: 8,
|
|
27760
27968
|
collisionPadding: 24,
|
|
27761
|
-
className:
|
|
27969
|
+
className: clx45(
|
|
27762
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"
|
|
27763
27971
|
),
|
|
27764
27972
|
onInteractOutside: (e) => {
|
|
@@ -27769,30 +27977,30 @@ var NumberFilter = ({
|
|
|
27769
27977
|
}
|
|
27770
27978
|
},
|
|
27771
27979
|
children: [
|
|
27772
|
-
/* @__PURE__ */
|
|
27980
|
+
/* @__PURE__ */ jsx89("div", { className: "p-1", children: /* @__PURE__ */ jsx89(
|
|
27773
27981
|
RadixRadioGroup.Root,
|
|
27774
27982
|
{
|
|
27775
27983
|
value: operator,
|
|
27776
27984
|
onValueChange: (val) => setOperator(val),
|
|
27777
27985
|
className: "flex flex-col items-start",
|
|
27778
27986
|
orientation: "vertical",
|
|
27779
|
-
children: operators.map((o) => /* @__PURE__ */
|
|
27987
|
+
children: operators.map((o) => /* @__PURE__ */ jsxs64(
|
|
27780
27988
|
RadixRadioGroup.Item,
|
|
27781
27989
|
{
|
|
27782
27990
|
value: o.operator,
|
|
27783
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",
|
|
27784
27992
|
children: [
|
|
27785
|
-
/* @__PURE__ */
|
|
27786
|
-
/* @__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 })
|
|
27787
27995
|
]
|
|
27788
27996
|
},
|
|
27789
27997
|
o.operator
|
|
27790
27998
|
))
|
|
27791
27999
|
}
|
|
27792
28000
|
) }),
|
|
27793
|
-
/* @__PURE__ */
|
|
27794
|
-
/* @__PURE__ */
|
|
27795
|
-
/* @__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(
|
|
27796
28004
|
Input11,
|
|
27797
28005
|
{
|
|
27798
28006
|
name: GT_KEY,
|
|
@@ -27802,8 +28010,8 @@ var NumberFilter = ({
|
|
|
27802
28010
|
onChange: (e) => debouncedOnChange(e, "gt")
|
|
27803
28011
|
}
|
|
27804
28012
|
) }),
|
|
27805
|
-
/* @__PURE__ */
|
|
27806
|
-
/* @__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(
|
|
27807
28015
|
Input11,
|
|
27808
28016
|
{
|
|
27809
28017
|
name: LT_KEY,
|
|
@@ -27813,9 +28021,9 @@ var NumberFilter = ({
|
|
|
27813
28021
|
onChange: (e) => debouncedOnChange(e, "lt")
|
|
27814
28022
|
}
|
|
27815
28023
|
) })
|
|
27816
|
-
] }, "range") : /* @__PURE__ */
|
|
27817
|
-
/* @__PURE__ */
|
|
27818
|
-
/* @__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(
|
|
27819
28027
|
Input11,
|
|
27820
28028
|
{
|
|
27821
28029
|
name: EQ_KEY,
|
|
@@ -27880,12 +28088,12 @@ var getOperator = (value) => {
|
|
|
27880
28088
|
|
|
27881
28089
|
// src/components/table/data-table/data-table-filter/select-filter.tsx
|
|
27882
28090
|
import { CheckMini as CheckMini2, EllipseMiniSolid as EllipseMiniSolid4, XMarkMini as XMarkMini6 } from "@medusajs/icons";
|
|
27883
|
-
import { clx as
|
|
28091
|
+
import { clx as clx46 } from "@medusajs/ui";
|
|
27884
28092
|
import { Command } from "cmdk";
|
|
27885
28093
|
import { Popover as RadixPopover6 } from "radix-ui";
|
|
27886
28094
|
import { useState as useState34 } from "react";
|
|
27887
28095
|
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
27888
|
-
import { jsx as
|
|
28096
|
+
import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
27889
28097
|
var SelectFilter = ({
|
|
27890
28098
|
filter,
|
|
27891
28099
|
prefix,
|
|
@@ -27938,8 +28146,8 @@ var SelectFilter = ({
|
|
|
27938
28146
|
};
|
|
27939
28147
|
const normalizedValues = labelValues ? Array.isArray(labelValues) ? labelValues : [labelValues] : null;
|
|
27940
28148
|
const normalizedPrev = previousValue ? Array.isArray(previousValue) ? previousValue : [previousValue] : null;
|
|
27941
|
-
return /* @__PURE__ */
|
|
27942
|
-
/* @__PURE__ */
|
|
28149
|
+
return /* @__PURE__ */ jsxs65(RadixPopover6.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28150
|
+
/* @__PURE__ */ jsx90(
|
|
27943
28151
|
filter_chip_default,
|
|
27944
28152
|
{
|
|
27945
28153
|
hasOperator: true,
|
|
@@ -27950,14 +28158,14 @@ var SelectFilter = ({
|
|
|
27950
28158
|
onRemove: handleRemove
|
|
27951
28159
|
}
|
|
27952
28160
|
),
|
|
27953
|
-
!readonly && /* @__PURE__ */
|
|
28161
|
+
!readonly && /* @__PURE__ */ jsx90(RadixPopover6.Portal, { children: /* @__PURE__ */ jsx90(
|
|
27954
28162
|
RadixPopover6.Content,
|
|
27955
28163
|
{
|
|
27956
28164
|
hideWhenDetached: true,
|
|
27957
28165
|
align: "start",
|
|
27958
28166
|
sideOffset: 8,
|
|
27959
28167
|
collisionPadding: 8,
|
|
27960
|
-
className:
|
|
28168
|
+
className: clx46(
|
|
27961
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"
|
|
27962
28170
|
),
|
|
27963
28171
|
onInteractOutside: (e) => {
|
|
@@ -27968,9 +28176,9 @@ var SelectFilter = ({
|
|
|
27968
28176
|
}
|
|
27969
28177
|
}
|
|
27970
28178
|
},
|
|
27971
|
-
children: /* @__PURE__ */
|
|
27972
|
-
searchable && /* @__PURE__ */
|
|
27973
|
-
/* @__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(
|
|
27974
28182
|
Command.Input,
|
|
27975
28183
|
{
|
|
27976
28184
|
ref: setSearchRef,
|
|
@@ -27980,25 +28188,25 @@ var SelectFilter = ({
|
|
|
27980
28188
|
placeholder: t2("general.search")
|
|
27981
28189
|
}
|
|
27982
28190
|
),
|
|
27983
|
-
/* @__PURE__ */
|
|
28191
|
+
/* @__PURE__ */ jsx90("div", { className: "flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsx90(
|
|
27984
28192
|
"button",
|
|
27985
28193
|
{
|
|
27986
28194
|
disabled: !search,
|
|
27987
28195
|
onClick: handleClearSearch,
|
|
27988
|
-
className:
|
|
28196
|
+
className: clx46(
|
|
27989
28197
|
"transition-fg text-ui-fg-muted focus-visible:bg-ui-bg-base-pressed rounded-md outline-none",
|
|
27990
28198
|
{
|
|
27991
28199
|
invisible: !search
|
|
27992
28200
|
}
|
|
27993
28201
|
),
|
|
27994
|
-
children: /* @__PURE__ */
|
|
28202
|
+
children: /* @__PURE__ */ jsx90(XMarkMini6, {})
|
|
27995
28203
|
}
|
|
27996
28204
|
) })
|
|
27997
28205
|
] }) }),
|
|
27998
|
-
/* @__PURE__ */
|
|
27999
|
-
/* @__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) => {
|
|
28000
28208
|
const isSelected = selectedParams.get().includes(String(option.value));
|
|
28001
|
-
return /* @__PURE__ */
|
|
28209
|
+
return /* @__PURE__ */ jsxs65(
|
|
28002
28210
|
Command.Item,
|
|
28003
28211
|
{
|
|
28004
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",
|
|
@@ -28007,16 +28215,16 @@ var SelectFilter = ({
|
|
|
28007
28215
|
handleSelect(option.value);
|
|
28008
28216
|
},
|
|
28009
28217
|
children: [
|
|
28010
|
-
/* @__PURE__ */
|
|
28218
|
+
/* @__PURE__ */ jsx90(
|
|
28011
28219
|
"div",
|
|
28012
28220
|
{
|
|
28013
|
-
className:
|
|
28221
|
+
className: clx46(
|
|
28014
28222
|
"transition-fg flex h-5 w-5 items-center justify-center",
|
|
28015
28223
|
{
|
|
28016
28224
|
"[&_svg]:invisible": !isSelected
|
|
28017
28225
|
}
|
|
28018
28226
|
),
|
|
28019
|
-
children: multiple ? /* @__PURE__ */
|
|
28227
|
+
children: multiple ? /* @__PURE__ */ jsx90(CheckMini2, {}) : /* @__PURE__ */ jsx90(EllipseMiniSolid4, {})
|
|
28020
28228
|
}
|
|
28021
28229
|
),
|
|
28022
28230
|
option.label
|
|
@@ -28032,11 +28240,11 @@ var SelectFilter = ({
|
|
|
28032
28240
|
};
|
|
28033
28241
|
|
|
28034
28242
|
// src/components/table/data-table/data-table-filter/string-filter.tsx
|
|
28035
|
-
import { Input as Input12, Label as Label5, clx as
|
|
28243
|
+
import { Input as Input12, Label as Label5, clx as clx47 } from "@medusajs/ui";
|
|
28036
28244
|
import debounce3 from "lodash.debounce";
|
|
28037
28245
|
import { Popover as RadixPopover7 } from "radix-ui";
|
|
28038
28246
|
import { useCallback as useCallback25, useEffect as useEffect22, useState as useState35 } from "react";
|
|
28039
|
-
import { jsx as
|
|
28247
|
+
import { jsx as jsx91, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
28040
28248
|
var StringFilter = ({
|
|
28041
28249
|
filter,
|
|
28042
28250
|
prefix,
|
|
@@ -28084,8 +28292,8 @@ var StringFilter = ({
|
|
|
28084
28292
|
selectedParams.delete();
|
|
28085
28293
|
removeFilter(key);
|
|
28086
28294
|
};
|
|
28087
|
-
return /* @__PURE__ */
|
|
28088
|
-
/* @__PURE__ */
|
|
28295
|
+
return /* @__PURE__ */ jsxs66(RadixPopover7.Root, { modal: true, open, onOpenChange: handleOpenChange, children: [
|
|
28296
|
+
/* @__PURE__ */ jsx91(
|
|
28089
28297
|
filter_chip_default,
|
|
28090
28298
|
{
|
|
28091
28299
|
hasOperator: true,
|
|
@@ -28096,14 +28304,14 @@ var StringFilter = ({
|
|
|
28096
28304
|
readonly
|
|
28097
28305
|
}
|
|
28098
28306
|
),
|
|
28099
|
-
!readonly && /* @__PURE__ */
|
|
28307
|
+
!readonly && /* @__PURE__ */ jsx91(RadixPopover7.Portal, { children: /* @__PURE__ */ jsx91(
|
|
28100
28308
|
RadixPopover7.Content,
|
|
28101
28309
|
{
|
|
28102
28310
|
hideWhenDetached: true,
|
|
28103
28311
|
align: "start",
|
|
28104
28312
|
sideOffset: 8,
|
|
28105
28313
|
collisionPadding: 8,
|
|
28106
|
-
className:
|
|
28314
|
+
className: clx47(
|
|
28107
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"
|
|
28108
28316
|
),
|
|
28109
28317
|
onInteractOutside: (e) => {
|
|
@@ -28114,9 +28322,9 @@ var StringFilter = ({
|
|
|
28114
28322
|
}
|
|
28115
28323
|
}
|
|
28116
28324
|
},
|
|
28117
|
-
children: /* @__PURE__ */
|
|
28118
|
-
/* @__PURE__ */
|
|
28119
|
-
/* @__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(
|
|
28120
28328
|
Input12,
|
|
28121
28329
|
{
|
|
28122
28330
|
name: key,
|
|
@@ -28132,7 +28340,7 @@ var StringFilter = ({
|
|
|
28132
28340
|
};
|
|
28133
28341
|
|
|
28134
28342
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
28135
|
-
import { jsx as
|
|
28343
|
+
import { jsx as jsx92, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
28136
28344
|
var DataTableFilter2 = ({
|
|
28137
28345
|
filters,
|
|
28138
28346
|
readonly,
|
|
@@ -28186,7 +28394,7 @@ var DataTableFilter2 = ({
|
|
|
28186
28394
|
const removeAllFilters = useCallback26(() => {
|
|
28187
28395
|
setActiveFilters([]);
|
|
28188
28396
|
}, []);
|
|
28189
|
-
return /* @__PURE__ */
|
|
28397
|
+
return /* @__PURE__ */ jsx92(
|
|
28190
28398
|
DataTableFilterContext.Provider,
|
|
28191
28399
|
{
|
|
28192
28400
|
value: useMemo24(
|
|
@@ -28196,11 +28404,11 @@ var DataTableFilter2 = ({
|
|
|
28196
28404
|
}),
|
|
28197
28405
|
[removeAllFilters, removeFilter]
|
|
28198
28406
|
),
|
|
28199
|
-
children: /* @__PURE__ */
|
|
28407
|
+
children: /* @__PURE__ */ jsxs67("div", { className: "max-w-2/3 flex flex-wrap items-center gap-2", children: [
|
|
28200
28408
|
activeFilters.map((filter) => {
|
|
28201
28409
|
switch (filter.type) {
|
|
28202
28410
|
case "select":
|
|
28203
|
-
return /* @__PURE__ */
|
|
28411
|
+
return /* @__PURE__ */ jsx92(
|
|
28204
28412
|
SelectFilter,
|
|
28205
28413
|
{
|
|
28206
28414
|
filter,
|
|
@@ -28214,7 +28422,7 @@ var DataTableFilter2 = ({
|
|
|
28214
28422
|
filter.key
|
|
28215
28423
|
);
|
|
28216
28424
|
case "date":
|
|
28217
|
-
return /* @__PURE__ */
|
|
28425
|
+
return /* @__PURE__ */ jsx92(
|
|
28218
28426
|
DateFilter,
|
|
28219
28427
|
{
|
|
28220
28428
|
filter,
|
|
@@ -28225,7 +28433,7 @@ var DataTableFilter2 = ({
|
|
|
28225
28433
|
filter.key
|
|
28226
28434
|
);
|
|
28227
28435
|
case "string":
|
|
28228
|
-
return /* @__PURE__ */
|
|
28436
|
+
return /* @__PURE__ */ jsx92(
|
|
28229
28437
|
StringFilter,
|
|
28230
28438
|
{
|
|
28231
28439
|
filter,
|
|
@@ -28236,7 +28444,7 @@ var DataTableFilter2 = ({
|
|
|
28236
28444
|
filter.key
|
|
28237
28445
|
);
|
|
28238
28446
|
case "number":
|
|
28239
|
-
return /* @__PURE__ */
|
|
28447
|
+
return /* @__PURE__ */ jsx92(
|
|
28240
28448
|
NumberFilter,
|
|
28241
28449
|
{
|
|
28242
28450
|
filter,
|
|
@@ -28250,12 +28458,12 @@ var DataTableFilter2 = ({
|
|
|
28250
28458
|
break;
|
|
28251
28459
|
}
|
|
28252
28460
|
}),
|
|
28253
|
-
!readonly && availableFilters.length > 0 && /* @__PURE__ */
|
|
28254
|
-
/* @__PURE__ */
|
|
28255
|
-
/* @__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(
|
|
28256
28464
|
RadixPopover8.Content,
|
|
28257
28465
|
{
|
|
28258
|
-
className:
|
|
28466
|
+
className: clx48(
|
|
28259
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"
|
|
28260
28468
|
),
|
|
28261
28469
|
"data-name": "filters_menu_content",
|
|
@@ -28273,7 +28481,7 @@ var DataTableFilter2 = ({
|
|
|
28273
28481
|
children: availableFilters.map((filter) => {
|
|
28274
28482
|
return (
|
|
28275
28483
|
// oxlint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
28276
|
-
/* @__PURE__ */
|
|
28484
|
+
/* @__PURE__ */ jsx92(
|
|
28277
28485
|
"div",
|
|
28278
28486
|
{
|
|
28279
28487
|
tabIndex: 0,
|
|
@@ -28291,7 +28499,7 @@ var DataTableFilter2 = ({
|
|
|
28291
28499
|
}
|
|
28292
28500
|
) })
|
|
28293
28501
|
] }),
|
|
28294
|
-
!readonly && activeFilters.length > 0 && /* @__PURE__ */
|
|
28502
|
+
!readonly && activeFilters.length > 0 && /* @__PURE__ */ jsx92(ClearAllFilters, { filters, prefix })
|
|
28295
28503
|
] })
|
|
28296
28504
|
}
|
|
28297
28505
|
);
|
|
@@ -28309,12 +28517,12 @@ var ClearAllFilters = ({ filters, prefix }) => {
|
|
|
28309
28517
|
});
|
|
28310
28518
|
removeAllFilters();
|
|
28311
28519
|
};
|
|
28312
|
-
return /* @__PURE__ */
|
|
28520
|
+
return /* @__PURE__ */ jsx92(
|
|
28313
28521
|
"button",
|
|
28314
28522
|
{
|
|
28315
28523
|
type: "button",
|
|
28316
28524
|
onClick: handleRemoveAll,
|
|
28317
|
-
className:
|
|
28525
|
+
className: clx48(
|
|
28318
28526
|
"text-ui-fg-muted transition-fg txt-compact-small-plus rounded-md px-2 py-1",
|
|
28319
28527
|
"hover:text-ui-fg-subtle",
|
|
28320
28528
|
"focus-visible:shadow-borders-focus"
|
|
@@ -28355,7 +28563,7 @@ import { DropdownMenu as DropdownMenu7, IconButton as IconButton11 } from "@medu
|
|
|
28355
28563
|
import { useState as useState37 } from "react";
|
|
28356
28564
|
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
28357
28565
|
import { useSearchParams as useSearchParams8 } from "react-router-dom";
|
|
28358
|
-
import { jsx as
|
|
28566
|
+
import { jsx as jsx93, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
28359
28567
|
var initState2 = (params, prefix) => {
|
|
28360
28568
|
const param = prefix ? `${prefix}_order` : "order";
|
|
28361
28569
|
const sortParam = params.get(param);
|
|
@@ -28414,17 +28622,17 @@ var DataTableOrderBy = ({
|
|
|
28414
28622
|
return prev;
|
|
28415
28623
|
});
|
|
28416
28624
|
};
|
|
28417
|
-
return /* @__PURE__ */
|
|
28418
|
-
/* @__PURE__ */
|
|
28419
|
-
/* @__PURE__ */
|
|
28420
|
-
/* @__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(
|
|
28421
28629
|
DropdownMenu7.RadioGroup,
|
|
28422
28630
|
{
|
|
28423
28631
|
value: state.key,
|
|
28424
28632
|
onValueChange: handleKeyChange,
|
|
28425
28633
|
children: keys.map((key) => {
|
|
28426
28634
|
const stringKey = String(key.key);
|
|
28427
|
-
return /* @__PURE__ */
|
|
28635
|
+
return /* @__PURE__ */ jsx93(
|
|
28428
28636
|
DropdownMenu7.RadioItem,
|
|
28429
28637
|
{
|
|
28430
28638
|
value: stringKey,
|
|
@@ -28436,14 +28644,14 @@ var DataTableOrderBy = ({
|
|
|
28436
28644
|
})
|
|
28437
28645
|
}
|
|
28438
28646
|
),
|
|
28439
|
-
/* @__PURE__ */
|
|
28440
|
-
/* @__PURE__ */
|
|
28647
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Separator, {}),
|
|
28648
|
+
/* @__PURE__ */ jsxs68(
|
|
28441
28649
|
DropdownMenu7.RadioGroup,
|
|
28442
28650
|
{
|
|
28443
28651
|
value: state.dir,
|
|
28444
28652
|
onValueChange: handleDirChange,
|
|
28445
28653
|
children: [
|
|
28446
|
-
/* @__PURE__ */
|
|
28654
|
+
/* @__PURE__ */ jsxs68(
|
|
28447
28655
|
DropdownMenu7.RadioItem,
|
|
28448
28656
|
{
|
|
28449
28657
|
className: "flex items-center justify-between",
|
|
@@ -28451,11 +28659,11 @@ var DataTableOrderBy = ({
|
|
|
28451
28659
|
onSelect: (event) => event.preventDefault(),
|
|
28452
28660
|
children: [
|
|
28453
28661
|
t2("general.ascending"),
|
|
28454
|
-
/* @__PURE__ */
|
|
28662
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Label, { children: "1 - 30" })
|
|
28455
28663
|
]
|
|
28456
28664
|
}
|
|
28457
28665
|
),
|
|
28458
|
-
/* @__PURE__ */
|
|
28666
|
+
/* @__PURE__ */ jsxs68(
|
|
28459
28667
|
DropdownMenu7.RadioItem,
|
|
28460
28668
|
{
|
|
28461
28669
|
className: "flex items-center justify-between",
|
|
@@ -28463,7 +28671,7 @@ var DataTableOrderBy = ({
|
|
|
28463
28671
|
onSelect: (event) => event.preventDefault(),
|
|
28464
28672
|
children: [
|
|
28465
28673
|
t2("general.descending"),
|
|
28466
|
-
/* @__PURE__ */
|
|
28674
|
+
/* @__PURE__ */ jsx93(DropdownMenu7.Label, { children: "30 - 1" })
|
|
28467
28675
|
]
|
|
28468
28676
|
}
|
|
28469
28677
|
)
|
|
@@ -28479,7 +28687,7 @@ import { Input as Input13 } from "@medusajs/ui";
|
|
|
28479
28687
|
import { useCallback as useCallback27, useEffect as useEffect24 } from "react";
|
|
28480
28688
|
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
28481
28689
|
import debounce4 from "lodash.debounce";
|
|
28482
|
-
import { jsx as
|
|
28690
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
28483
28691
|
var DataTableSearch = ({
|
|
28484
28692
|
placeholder,
|
|
28485
28693
|
prefix,
|
|
@@ -28509,7 +28717,7 @@ var DataTableSearch = ({
|
|
|
28509
28717
|
debouncedOnChange.cancel();
|
|
28510
28718
|
};
|
|
28511
28719
|
}, [debouncedOnChange]);
|
|
28512
|
-
return /* @__PURE__ */
|
|
28720
|
+
return /* @__PURE__ */ jsx94(
|
|
28513
28721
|
Input13,
|
|
28514
28722
|
{
|
|
28515
28723
|
autoComplete: "off",
|
|
@@ -28524,30 +28732,30 @@ var DataTableSearch = ({
|
|
|
28524
28732
|
};
|
|
28525
28733
|
|
|
28526
28734
|
// src/components/table/data-table/data-table-query/data-table-query.tsx
|
|
28527
|
-
import { jsx as
|
|
28735
|
+
import { jsx as jsx95, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
28528
28736
|
var DataTableQuery = ({
|
|
28529
28737
|
search,
|
|
28530
28738
|
orderBy,
|
|
28531
28739
|
filters,
|
|
28532
28740
|
prefix
|
|
28533
28741
|
}) => {
|
|
28534
|
-
return (search || orderBy || filters || prefix) && /* @__PURE__ */
|
|
28535
|
-
/* @__PURE__ */
|
|
28536
|
-
/* @__PURE__ */
|
|
28537
|
-
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(
|
|
28538
28746
|
DataTableSearch,
|
|
28539
28747
|
{
|
|
28540
28748
|
prefix,
|
|
28541
28749
|
autofocus: search === "autofocus"
|
|
28542
28750
|
}
|
|
28543
28751
|
),
|
|
28544
|
-
orderBy && /* @__PURE__ */
|
|
28752
|
+
orderBy && /* @__PURE__ */ jsx95(DataTableOrderBy, { keys: orderBy, prefix })
|
|
28545
28753
|
] })
|
|
28546
28754
|
] });
|
|
28547
28755
|
};
|
|
28548
28756
|
|
|
28549
28757
|
// src/components/table/data-table/data-table-root/data-table-root.tsx
|
|
28550
|
-
import { CommandBar, Table as Table2, clx as
|
|
28758
|
+
import { CommandBar, Table as Table2, clx as clx49 } from "@medusajs/ui";
|
|
28551
28759
|
import {
|
|
28552
28760
|
flexRender as flexRender2
|
|
28553
28761
|
} from "@tanstack/react-table";
|
|
@@ -28560,7 +28768,7 @@ import {
|
|
|
28560
28768
|
} from "react";
|
|
28561
28769
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
28562
28770
|
import { Link as Link8 } from "react-router-dom";
|
|
28563
|
-
import { jsx as
|
|
28771
|
+
import { jsx as jsx96, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28564
28772
|
var DataTableRoot = ({
|
|
28565
28773
|
table,
|
|
28566
28774
|
columns,
|
|
@@ -28600,28 +28808,28 @@ var DataTableRoot = ({
|
|
|
28600
28808
|
useEffect25(() => {
|
|
28601
28809
|
scrollableRef.current?.scroll({ top: 0, left: 0 });
|
|
28602
28810
|
}, [pageIndex]);
|
|
28603
|
-
return /* @__PURE__ */
|
|
28811
|
+
return /* @__PURE__ */ jsxs70(
|
|
28604
28812
|
"div",
|
|
28605
28813
|
{
|
|
28606
|
-
className:
|
|
28814
|
+
className: clx49("flex w-full flex-col overflow-hidden", {
|
|
28607
28815
|
"flex flex-1 flex-col": layout === "fill"
|
|
28608
28816
|
}),
|
|
28609
28817
|
children: [
|
|
28610
|
-
/* @__PURE__ */
|
|
28818
|
+
/* @__PURE__ */ jsx96(
|
|
28611
28819
|
"div",
|
|
28612
28820
|
{
|
|
28613
28821
|
ref: scrollableRef,
|
|
28614
28822
|
onScroll: handleHorizontalScroll,
|
|
28615
|
-
className:
|
|
28823
|
+
className: clx49("w-full", {
|
|
28616
28824
|
"min-h-0 flex-grow overflow-auto": layout === "fill",
|
|
28617
28825
|
"overflow-x-auto": layout === "fit"
|
|
28618
28826
|
}),
|
|
28619
|
-
children: !noResults ? /* @__PURE__ */
|
|
28620
|
-
!noHeader && /* @__PURE__ */
|
|
28621
|
-
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(
|
|
28622
28830
|
Table2.Row,
|
|
28623
28831
|
{
|
|
28624
|
-
className:
|
|
28832
|
+
className: clx49({
|
|
28625
28833
|
"relative border-b-0 [&_th:last-of-type]:w-[1%] [&_th:last-of-type]:whitespace-nowrap": hasActions,
|
|
28626
28834
|
"[&_th:first-of-type]:w-[1%] [&_th:first-of-type]:whitespace-nowrap": hasSelect
|
|
28627
28835
|
}),
|
|
@@ -28634,14 +28842,14 @@ var DataTableRoot = ({
|
|
|
28634
28842
|
);
|
|
28635
28843
|
const isFirstHeader = firstHeader !== -1 ? header.id === headerGroup.headers[firstHeader].id : index === 0;
|
|
28636
28844
|
const isStickyHeader = isSelectHeader || isFirstHeader;
|
|
28637
|
-
return /* @__PURE__ */
|
|
28845
|
+
return /* @__PURE__ */ jsx96(
|
|
28638
28846
|
Table2.HeaderCell,
|
|
28639
28847
|
{
|
|
28640
28848
|
"data-table-header-id": header.id,
|
|
28641
28849
|
style: {
|
|
28642
28850
|
width: !isSpecialHeader ? `${colWidth}%` : void 0
|
|
28643
28851
|
},
|
|
28644
|
-
className:
|
|
28852
|
+
className: clx49({
|
|
28645
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,
|
|
28646
28854
|
"start-[68px]": isStickyHeader && hasSelect && !isSelectHeader,
|
|
28647
28855
|
"after:bg-ui-border-base": showStickyBorder && isStickyHeader && !isSpecialHeader
|
|
@@ -28658,16 +28866,16 @@ var DataTableRoot = ({
|
|
|
28658
28866
|
headerGroup.id
|
|
28659
28867
|
);
|
|
28660
28868
|
}) }),
|
|
28661
|
-
/* @__PURE__ */
|
|
28869
|
+
/* @__PURE__ */ jsx96(Table2.Body, { className: "border-b-0", children: table.getRowModel().rows.map((row) => {
|
|
28662
28870
|
const to = navigateTo ? navigateTo(row) : void 0;
|
|
28663
28871
|
const isRowDisabled = hasSelect && !row.getCanSelect();
|
|
28664
28872
|
const isOdd = row.depth % 2 !== 0;
|
|
28665
28873
|
const cells = row.getVisibleCells();
|
|
28666
|
-
return /* @__PURE__ */
|
|
28874
|
+
return /* @__PURE__ */ jsx96(
|
|
28667
28875
|
Table2.Row,
|
|
28668
28876
|
{
|
|
28669
28877
|
"data-selected": row.getIsSelected(),
|
|
28670
|
-
className:
|
|
28878
|
+
className: clx49(
|
|
28671
28879
|
"transition-fg group/row group relative [&_td:last-of-type]:w-[1%] [&_td:last-of-type]:whitespace-nowrap",
|
|
28672
28880
|
"has-[[data-row-link]:focus-visible]:bg-ui-bg-base-hover",
|
|
28673
28881
|
{
|
|
@@ -28693,10 +28901,10 @@ var DataTableRoot = ({
|
|
|
28693
28901
|
);
|
|
28694
28902
|
const isTabableLink = isFirstCell && !!to;
|
|
28695
28903
|
const shouldRenderAsLink = !!to && !isSelectCell;
|
|
28696
|
-
return /* @__PURE__ */
|
|
28904
|
+
return /* @__PURE__ */ jsx96(
|
|
28697
28905
|
Table2.Cell,
|
|
28698
28906
|
{
|
|
28699
|
-
className:
|
|
28907
|
+
className: clx49({
|
|
28700
28908
|
"!ps-0 !pe-0": shouldRenderAsLink,
|
|
28701
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,
|
|
28702
28910
|
"bg-ui-bg-subtle group-hover/row:bg-ui-bg-subtle-hover": isOdd && isStickyCell,
|
|
@@ -28707,17 +28915,17 @@ var DataTableRoot = ({
|
|
|
28707
28915
|
style: {
|
|
28708
28916
|
paddingLeft: depthOffset ? `${depthOffset}px` : void 0
|
|
28709
28917
|
},
|
|
28710
|
-
children: shouldRenderAsLink ? /* @__PURE__ */
|
|
28918
|
+
children: shouldRenderAsLink ? /* @__PURE__ */ jsx96(
|
|
28711
28919
|
Link8,
|
|
28712
28920
|
{
|
|
28713
28921
|
to,
|
|
28714
28922
|
className: "size-full outline-none",
|
|
28715
28923
|
"data-row-link": true,
|
|
28716
28924
|
tabIndex: isTabableLink ? 0 : -1,
|
|
28717
|
-
children: /* @__PURE__ */
|
|
28925
|
+
children: /* @__PURE__ */ jsx96(
|
|
28718
28926
|
"div",
|
|
28719
28927
|
{
|
|
28720
|
-
className:
|
|
28928
|
+
className: clx49(
|
|
28721
28929
|
"flex size-full items-center pe-6",
|
|
28722
28930
|
{
|
|
28723
28931
|
"ps-6": isTabableLink && !hasLeftOffset
|
|
@@ -28736,10 +28944,10 @@ var DataTableRoot = ({
|
|
|
28736
28944
|
row.id
|
|
28737
28945
|
);
|
|
28738
28946
|
}) })
|
|
28739
|
-
] }) : /* @__PURE__ */
|
|
28947
|
+
] }) : /* @__PURE__ */ jsx96("div", { className: clx49({ "border-b": layout === "fit" }), children: /* @__PURE__ */ jsx96(NoResults, { ...noResultsProps }) })
|
|
28740
28948
|
}
|
|
28741
28949
|
),
|
|
28742
|
-
pagination && /* @__PURE__ */
|
|
28950
|
+
pagination && /* @__PURE__ */ jsx96("div", { className: clx49({ "border-t": layout === "fill" }), children: /* @__PURE__ */ jsx96(
|
|
28743
28951
|
Pagination,
|
|
28744
28952
|
{
|
|
28745
28953
|
canNextPage: table.getCanNextPage(),
|
|
@@ -28752,14 +28960,14 @@ var DataTableRoot = ({
|
|
|
28752
28960
|
pageSize
|
|
28753
28961
|
}
|
|
28754
28962
|
) }),
|
|
28755
|
-
hasCommandBar && /* @__PURE__ */
|
|
28756
|
-
/* @__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", {
|
|
28757
28965
|
count: Object.keys(rowSelection).length
|
|
28758
28966
|
}) }),
|
|
28759
|
-
/* @__PURE__ */
|
|
28967
|
+
/* @__PURE__ */ jsx96(CommandBar.Seperator, {}),
|
|
28760
28968
|
commands?.map((command, index) => {
|
|
28761
|
-
return /* @__PURE__ */
|
|
28762
|
-
/* @__PURE__ */
|
|
28969
|
+
return /* @__PURE__ */ jsxs70(Fragment11, { children: [
|
|
28970
|
+
/* @__PURE__ */ jsx96(
|
|
28763
28971
|
CommandBar.Command,
|
|
28764
28972
|
{
|
|
28765
28973
|
label: command.label,
|
|
@@ -28772,7 +28980,7 @@ var DataTableRoot = ({
|
|
|
28772
28980
|
)
|
|
28773
28981
|
}
|
|
28774
28982
|
),
|
|
28775
|
-
index < commands.length - 1 && /* @__PURE__ */
|
|
28983
|
+
index < commands.length - 1 && /* @__PURE__ */ jsx96(CommandBar.Seperator, {})
|
|
28776
28984
|
] }, index);
|
|
28777
28985
|
})
|
|
28778
28986
|
] }) })
|
|
@@ -28789,7 +28997,7 @@ var Pagination = (props) => {
|
|
|
28789
28997
|
prev: t2("general.prev"),
|
|
28790
28998
|
next: t2("general.next")
|
|
28791
28999
|
};
|
|
28792
|
-
return /* @__PURE__ */
|
|
29000
|
+
return /* @__PURE__ */ jsx96(
|
|
28793
29001
|
Table2.Pagination,
|
|
28794
29002
|
{
|
|
28795
29003
|
className: "flex-shrink-0",
|
|
@@ -28800,7 +29008,7 @@ var Pagination = (props) => {
|
|
|
28800
29008
|
};
|
|
28801
29009
|
|
|
28802
29010
|
// src/components/table/data-table/data-table.tsx
|
|
28803
|
-
import { jsx as
|
|
29011
|
+
import { jsx as jsx97, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
28804
29012
|
var MemoizedDataTableQuery = memo(DataTableQuery);
|
|
28805
29013
|
var _DataTable = ({
|
|
28806
29014
|
table,
|
|
@@ -28822,7 +29030,7 @@ var _DataTable = ({
|
|
|
28822
29030
|
noResults: noResultsProps = {}
|
|
28823
29031
|
}) => {
|
|
28824
29032
|
if (isLoading) {
|
|
28825
|
-
return /* @__PURE__ */
|
|
29033
|
+
return /* @__PURE__ */ jsx97(
|
|
28826
29034
|
TableSkeleton,
|
|
28827
29035
|
{
|
|
28828
29036
|
layout,
|
|
@@ -28838,24 +29046,24 @@ var _DataTable = ({
|
|
|
28838
29046
|
const showNoResults = !isLoading && count === 0 && !noQuery;
|
|
28839
29047
|
const noRecords = !isLoading && count === 0 && noQuery;
|
|
28840
29048
|
if (noRecords) {
|
|
28841
|
-
return /* @__PURE__ */
|
|
29049
|
+
return /* @__PURE__ */ jsx97(
|
|
28842
29050
|
NoRecords,
|
|
28843
29051
|
{
|
|
28844
|
-
className:
|
|
29052
|
+
className: clx50({
|
|
28845
29053
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
28846
29054
|
}),
|
|
28847
29055
|
...noRecordsProps
|
|
28848
29056
|
}
|
|
28849
29057
|
);
|
|
28850
29058
|
}
|
|
28851
|
-
return /* @__PURE__ */
|
|
29059
|
+
return /* @__PURE__ */ jsxs71(
|
|
28852
29060
|
"div",
|
|
28853
29061
|
{
|
|
28854
|
-
className:
|
|
29062
|
+
className: clx50("divide-y", {
|
|
28855
29063
|
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
28856
29064
|
}),
|
|
28857
29065
|
children: [
|
|
28858
|
-
/* @__PURE__ */
|
|
29066
|
+
/* @__PURE__ */ jsx97(
|
|
28859
29067
|
MemoizedDataTableQuery,
|
|
28860
29068
|
{
|
|
28861
29069
|
search,
|
|
@@ -28864,7 +29072,7 @@ var _DataTable = ({
|
|
|
28864
29072
|
prefix
|
|
28865
29073
|
}
|
|
28866
29074
|
),
|
|
28867
|
-
/* @__PURE__ */
|
|
29075
|
+
/* @__PURE__ */ jsx97(
|
|
28868
29076
|
DataTableRoot,
|
|
28869
29077
|
{
|
|
28870
29078
|
table,
|
|
@@ -28886,12 +29094,12 @@ var _DataTable = ({
|
|
|
28886
29094
|
|
|
28887
29095
|
// src/components/table/table-cells/common/code-cell/code-cell.tsx
|
|
28888
29096
|
import { Badge as Badge8 } from "@medusajs/ui";
|
|
28889
|
-
import { jsx as
|
|
29097
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
28890
29098
|
var CodeCell = ({ code }) => {
|
|
28891
|
-
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 }) });
|
|
28892
29100
|
};
|
|
28893
29101
|
var CodeHeader = ({ text }) => {
|
|
28894
|
-
return /* @__PURE__ */
|
|
29102
|
+
return /* @__PURE__ */ jsx98("div", { className: " flex h-full w-full items-center ", children: /* @__PURE__ */ jsx98("span", { children: text }) });
|
|
28895
29103
|
};
|
|
28896
29104
|
|
|
28897
29105
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
@@ -28899,78 +29107,78 @@ import { Tooltip as Tooltip13 } from "@medusajs/ui";
|
|
|
28899
29107
|
import { useTranslation as useTranslation45 } from "react-i18next";
|
|
28900
29108
|
|
|
28901
29109
|
// src/components/table/table-cells/common/placeholder-cell/placeholder-cell.tsx
|
|
28902
|
-
import { jsx as
|
|
29110
|
+
import { jsx as jsx99 } from "react/jsx-runtime";
|
|
28903
29111
|
var PlaceholderCell = () => {
|
|
28904
|
-
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: "-" }) });
|
|
28905
29113
|
};
|
|
28906
29114
|
|
|
28907
29115
|
// src/components/table/table-cells/common/created-at-cell/created-at-cell.tsx
|
|
28908
|
-
import { jsx as
|
|
29116
|
+
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
28909
29117
|
var CreatedAtCell = ({ date }) => {
|
|
28910
29118
|
const { getFullDate } = useDate();
|
|
28911
29119
|
if (!date) {
|
|
28912
|
-
return /* @__PURE__ */
|
|
29120
|
+
return /* @__PURE__ */ jsx100(PlaceholderCell, {});
|
|
28913
29121
|
}
|
|
28914
|
-
return /* @__PURE__ */
|
|
29122
|
+
return /* @__PURE__ */ jsx100("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx100(
|
|
28915
29123
|
Tooltip13,
|
|
28916
29124
|
{
|
|
28917
29125
|
className: "z-10",
|
|
28918
|
-
content: /* @__PURE__ */
|
|
29126
|
+
content: /* @__PURE__ */ jsx100("span", { className: "text-pretty", children: `${getFullDate({
|
|
28919
29127
|
date,
|
|
28920
29128
|
includeTime: true
|
|
28921
29129
|
})}` }),
|
|
28922
|
-
children: /* @__PURE__ */
|
|
29130
|
+
children: /* @__PURE__ */ jsx100("span", { className: "truncate", children: getFullDate({ date, includeTime: true }) })
|
|
28923
29131
|
}
|
|
28924
29132
|
) });
|
|
28925
29133
|
};
|
|
28926
29134
|
var CreatedAtHeader = () => {
|
|
28927
29135
|
const { t: t2 } = useTranslation45();
|
|
28928
|
-
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") }) });
|
|
28929
29137
|
};
|
|
28930
29138
|
|
|
28931
29139
|
// src/components/table/table-cells/common/date-cell/date-cell.tsx
|
|
28932
29140
|
import { Tooltip as Tooltip14 } from "@medusajs/ui";
|
|
28933
29141
|
import { useTranslation as useTranslation46 } from "react-i18next";
|
|
28934
|
-
import { jsx as
|
|
29142
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
28935
29143
|
var DateCell = ({ date }) => {
|
|
28936
29144
|
const { getFullDate } = useDate();
|
|
28937
29145
|
if (!date) {
|
|
28938
|
-
return /* @__PURE__ */
|
|
29146
|
+
return /* @__PURE__ */ jsx101(PlaceholderCell, {});
|
|
28939
29147
|
}
|
|
28940
|
-
return /* @__PURE__ */
|
|
29148
|
+
return /* @__PURE__ */ jsx101("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx101(
|
|
28941
29149
|
Tooltip14,
|
|
28942
29150
|
{
|
|
28943
29151
|
className: "z-10",
|
|
28944
|
-
content: /* @__PURE__ */
|
|
29152
|
+
content: /* @__PURE__ */ jsx101("span", { className: "text-pretty", children: `${getFullDate({
|
|
28945
29153
|
date,
|
|
28946
29154
|
includeTime: true
|
|
28947
29155
|
})}` }),
|
|
28948
|
-
children: /* @__PURE__ */
|
|
29156
|
+
children: /* @__PURE__ */ jsx101("span", { className: "truncate", children: getFullDate({ date, includeTime: false }) })
|
|
28949
29157
|
}
|
|
28950
29158
|
) });
|
|
28951
29159
|
};
|
|
28952
29160
|
var DateHeader = () => {
|
|
28953
29161
|
const { t: t2 } = useTranslation46();
|
|
28954
|
-
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") }) });
|
|
28955
29163
|
};
|
|
28956
29164
|
|
|
28957
29165
|
// src/components/table/table-cells/common/email-cell/email-cell.tsx
|
|
28958
29166
|
import { useTranslation as useTranslation47 } from "react-i18next";
|
|
28959
|
-
import { jsx as
|
|
29167
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
28960
29168
|
var EmailCell = ({ email }) => {
|
|
28961
29169
|
if (!email) {
|
|
28962
|
-
return /* @__PURE__ */
|
|
29170
|
+
return /* @__PURE__ */ jsx102(PlaceholderCell, {});
|
|
28963
29171
|
}
|
|
28964
|
-
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 }) });
|
|
28965
29173
|
};
|
|
28966
29174
|
var EmailHeader = () => {
|
|
28967
29175
|
const { t: t2 } = useTranslation47();
|
|
28968
|
-
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") }) });
|
|
28969
29177
|
};
|
|
28970
29178
|
|
|
28971
29179
|
// src/components/table/table-cells/common/money-amount-cell/money-amount-cell.tsx
|
|
28972
|
-
import { clx as
|
|
28973
|
-
import { jsx as
|
|
29180
|
+
import { clx as clx51 } from "@medusajs/ui";
|
|
29181
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
28974
29182
|
var MoneyAmountCell = ({
|
|
28975
29183
|
currencyCode,
|
|
28976
29184
|
amount,
|
|
@@ -28978,13 +29186,13 @@ var MoneyAmountCell = ({
|
|
|
28978
29186
|
className
|
|
28979
29187
|
}) => {
|
|
28980
29188
|
if (typeof amount === "undefined" || amount === null) {
|
|
28981
|
-
return /* @__PURE__ */
|
|
29189
|
+
return /* @__PURE__ */ jsx103(PlaceholderCell, {});
|
|
28982
29190
|
}
|
|
28983
29191
|
const formatted = getStylizedAmount(amount, currencyCode);
|
|
28984
|
-
return /* @__PURE__ */
|
|
29192
|
+
return /* @__PURE__ */ jsx103(
|
|
28985
29193
|
"div",
|
|
28986
29194
|
{
|
|
28987
|
-
className:
|
|
29195
|
+
className: clx51(
|
|
28988
29196
|
"flex h-full w-full items-center overflow-hidden",
|
|
28989
29197
|
{
|
|
28990
29198
|
"justify-start text-left": align === "left",
|
|
@@ -28992,40 +29200,40 @@ var MoneyAmountCell = ({
|
|
|
28992
29200
|
},
|
|
28993
29201
|
className
|
|
28994
29202
|
),
|
|
28995
|
-
children: /* @__PURE__ */
|
|
29203
|
+
children: /* @__PURE__ */ jsx103("span", { className: "truncate", children: formatted })
|
|
28996
29204
|
}
|
|
28997
29205
|
);
|
|
28998
29206
|
};
|
|
28999
29207
|
|
|
29000
29208
|
// src/components/table/table-cells/common/name-cell/name-cell.tsx
|
|
29001
29209
|
import { useTranslation as useTranslation48 } from "react-i18next";
|
|
29002
|
-
import { jsx as
|
|
29210
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
29003
29211
|
var NameCell = ({ firstName, lastName }) => {
|
|
29004
29212
|
if (!firstName && !lastName) {
|
|
29005
|
-
return /* @__PURE__ */
|
|
29213
|
+
return /* @__PURE__ */ jsx104(PlaceholderCell, {});
|
|
29006
29214
|
}
|
|
29007
29215
|
const name = [firstName, lastName].filter(Boolean).join(" ");
|
|
29008
|
-
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 }) });
|
|
29009
29217
|
};
|
|
29010
29218
|
var NameHeader = () => {
|
|
29011
29219
|
const { t: t2 } = useTranslation48();
|
|
29012
|
-
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") }) });
|
|
29013
29221
|
};
|
|
29014
29222
|
|
|
29015
29223
|
// src/components/table/table-cells/common/status-cell/status-cell.tsx
|
|
29016
|
-
import { clx as
|
|
29017
|
-
import { jsx as
|
|
29224
|
+
import { clx as clx52 } from "@medusajs/ui";
|
|
29225
|
+
import { jsx as jsx105, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
29018
29226
|
var StatusCell = ({ color, children }) => {
|
|
29019
|
-
return /* @__PURE__ */
|
|
29020
|
-
/* @__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(
|
|
29021
29229
|
"div",
|
|
29022
29230
|
{
|
|
29023
29231
|
role: "presentation",
|
|
29024
29232
|
className: "flex h-5 w-2 items-center justify-center",
|
|
29025
|
-
children: /* @__PURE__ */
|
|
29233
|
+
children: /* @__PURE__ */ jsx105(
|
|
29026
29234
|
"div",
|
|
29027
29235
|
{
|
|
29028
|
-
className:
|
|
29236
|
+
className: clx52(
|
|
29029
29237
|
"h-2 w-2 rounded-sm shadow-[0px_0px_0px_1px_rgba(0,0,0,0.12)_inset]",
|
|
29030
29238
|
{
|
|
29031
29239
|
"bg-ui-tag-neutral-icon": color === "grey",
|
|
@@ -29040,22 +29248,22 @@ var StatusCell = ({ color, children }) => {
|
|
|
29040
29248
|
)
|
|
29041
29249
|
}
|
|
29042
29250
|
),
|
|
29043
|
-
/* @__PURE__ */
|
|
29251
|
+
/* @__PURE__ */ jsx105("span", { className: "truncate", children })
|
|
29044
29252
|
] });
|
|
29045
29253
|
};
|
|
29046
29254
|
|
|
29047
29255
|
// src/components/table/table-cells/common/text-cell/text-cell.tsx
|
|
29048
|
-
import { clx as
|
|
29049
|
-
import { jsx as
|
|
29256
|
+
import { clx as clx53 } from "@medusajs/ui";
|
|
29257
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
29050
29258
|
var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
29051
29259
|
if (!text) {
|
|
29052
|
-
return /* @__PURE__ */
|
|
29260
|
+
return /* @__PURE__ */ jsx106(PlaceholderCell, {});
|
|
29053
29261
|
}
|
|
29054
29262
|
const stringLength = text.toString().length;
|
|
29055
|
-
return /* @__PURE__ */
|
|
29263
|
+
return /* @__PURE__ */ jsx106(ConditionalTooltip, { content: text, showTooltip: stringLength > 20, children: /* @__PURE__ */ jsx106(
|
|
29056
29264
|
"div",
|
|
29057
29265
|
{
|
|
29058
|
-
className:
|
|
29266
|
+
className: clx53("flex h-full w-full items-center gap-x-3 overflow-hidden", {
|
|
29059
29267
|
"justify-start text-start": align === "left",
|
|
29060
29268
|
"justify-center text-center": align === "center",
|
|
29061
29269
|
"justify-end text-end": align === "right"
|
|
@@ -29063,16 +29271,16 @@ var TextCell = ({ text, align = "left", maxWidth = 220 }) => {
|
|
|
29063
29271
|
style: {
|
|
29064
29272
|
maxWidth
|
|
29065
29273
|
},
|
|
29066
|
-
children: /* @__PURE__ */
|
|
29274
|
+
children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: text })
|
|
29067
29275
|
}
|
|
29068
29276
|
) });
|
|
29069
29277
|
};
|
|
29070
29278
|
var TextHeader = ({ text, align = "left" }) => {
|
|
29071
|
-
return /* @__PURE__ */
|
|
29279
|
+
return /* @__PURE__ */ jsx106("div", { className: clx53("flex h-full w-full items-center", {
|
|
29072
29280
|
"justify-start text-start": align === "left",
|
|
29073
29281
|
"justify-center text-center": align === "center",
|
|
29074
29282
|
"justify-end text-end": align === "right"
|
|
29075
|
-
}), children: /* @__PURE__ */
|
|
29283
|
+
}), children: /* @__PURE__ */ jsx106("span", { className: "truncate", children: text }) });
|
|
29076
29284
|
};
|
|
29077
29285
|
|
|
29078
29286
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
@@ -29088,7 +29296,7 @@ var isClientError = (error) => {
|
|
|
29088
29296
|
};
|
|
29089
29297
|
|
|
29090
29298
|
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
29091
|
-
import { jsx as
|
|
29299
|
+
import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
29092
29300
|
var ErrorBoundary = () => {
|
|
29093
29301
|
const error = useRouteError();
|
|
29094
29302
|
const location = useLocation3();
|
|
@@ -29096,7 +29304,7 @@ var ErrorBoundary = () => {
|
|
|
29096
29304
|
let code = null;
|
|
29097
29305
|
if (isClientError(error)) {
|
|
29098
29306
|
if (error.status === 401) {
|
|
29099
|
-
return /* @__PURE__ */
|
|
29307
|
+
return /* @__PURE__ */ jsx107(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
29100
29308
|
}
|
|
29101
29309
|
code = error.status ?? null;
|
|
29102
29310
|
}
|
|
@@ -29123,11 +29331,11 @@ var ErrorBoundary = () => {
|
|
|
29123
29331
|
message = t2("errorBoundary.defaultMessage");
|
|
29124
29332
|
break;
|
|
29125
29333
|
}
|
|
29126
|
-
return /* @__PURE__ */
|
|
29127
|
-
/* @__PURE__ */
|
|
29128
|
-
/* @__PURE__ */
|
|
29129
|
-
/* @__PURE__ */
|
|
29130
|
-
/* @__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(
|
|
29131
29339
|
Text21,
|
|
29132
29340
|
{
|
|
29133
29341
|
size: "small",
|
|
@@ -29140,9 +29348,9 @@ var ErrorBoundary = () => {
|
|
|
29140
29348
|
};
|
|
29141
29349
|
|
|
29142
29350
|
// src/components/utilities/visually-hidden/visually-hidden.tsx
|
|
29143
|
-
import { jsx as
|
|
29351
|
+
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
29144
29352
|
var VisuallyHidden = ({ children }) => {
|
|
29145
|
-
return /* @__PURE__ */
|
|
29353
|
+
return /* @__PURE__ */ jsx108("span", { className: "sr-only", children });
|
|
29146
29354
|
};
|
|
29147
29355
|
|
|
29148
29356
|
// src/hooks/use-data-table.tsx
|
|
@@ -29238,7 +29446,7 @@ var useDataTable2 = ({
|
|
|
29238
29446
|
|
|
29239
29447
|
// src/permissions/permissions-provider.tsx
|
|
29240
29448
|
import { useCallback as useCallback28, useMemo as useMemo26 } from "react";
|
|
29241
|
-
import { jsx as
|
|
29449
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
29242
29450
|
var PermissionsProvider = ({
|
|
29243
29451
|
permissions = null,
|
|
29244
29452
|
isLoading = false,
|
|
@@ -29279,7 +29487,7 @@ var PermissionsProvider = ({
|
|
|
29279
29487
|
}),
|
|
29280
29488
|
[permissions, isLoading, isEnforced, hasPermission, hasAnyPermission, hasAllPermissions, can]
|
|
29281
29489
|
);
|
|
29282
|
-
return /* @__PURE__ */
|
|
29490
|
+
return /* @__PURE__ */ jsx109(PermissionsContext.Provider, { value, children });
|
|
29283
29491
|
};
|
|
29284
29492
|
|
|
29285
29493
|
// src/permissions/use-permissions.tsx
|
|
@@ -29293,7 +29501,7 @@ var usePermissions = () => {
|
|
|
29293
29501
|
};
|
|
29294
29502
|
|
|
29295
29503
|
// src/permissions/permission-guard.tsx
|
|
29296
|
-
import { Fragment as Fragment12, jsx as
|
|
29504
|
+
import { Fragment as Fragment12, jsx as jsx110 } from "react/jsx-runtime";
|
|
29297
29505
|
var PermissionGuard = ({
|
|
29298
29506
|
children,
|
|
29299
29507
|
permission,
|
|
@@ -29303,7 +29511,7 @@ var PermissionGuard = ({
|
|
|
29303
29511
|
const { hasAnyPermission, hasAllPermissions } = usePermissions();
|
|
29304
29512
|
const list = Array.isArray(permission) ? permission : [permission];
|
|
29305
29513
|
const allowed = requireAll ? hasAllPermissions(list) : hasAnyPermission(list);
|
|
29306
|
-
return /* @__PURE__ */
|
|
29514
|
+
return /* @__PURE__ */ jsx110(Fragment12, { children: allowed ? children : fallback });
|
|
29307
29515
|
};
|
|
29308
29516
|
|
|
29309
29517
|
// src/permissions/route-permission-guard.tsx
|
|
@@ -29312,7 +29520,7 @@ import { Container as Container6, Heading as Heading10, Text as Text22 } from "@
|
|
|
29312
29520
|
import { useMemo as useMemo27 } from "react";
|
|
29313
29521
|
import { useTranslation as useTranslation50 } from "react-i18next";
|
|
29314
29522
|
import { Navigate as Navigate2, Outlet as Outlet3, useMatches } from "react-router-dom";
|
|
29315
|
-
import { jsx as
|
|
29523
|
+
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
29316
29524
|
var readRequirementFromHandle = (handle) => {
|
|
29317
29525
|
if (!handle || typeof handle !== "object") {
|
|
29318
29526
|
return void 0;
|
|
@@ -29352,28 +29560,28 @@ var RoutePermissionGuard = () => {
|
|
|
29352
29560
|
return void 0;
|
|
29353
29561
|
}, [matches]);
|
|
29354
29562
|
if (isLoading || !requirement) {
|
|
29355
|
-
return /* @__PURE__ */
|
|
29563
|
+
return /* @__PURE__ */ jsx111(Outlet3, {});
|
|
29356
29564
|
}
|
|
29357
29565
|
const hasAccess = requirement.requireAll ? hasAllPermissions(requirement.permissions) : hasAnyPermission(requirement.permissions);
|
|
29358
29566
|
if (!hasAccess) {
|
|
29359
29567
|
if (requirement.redirectTo) {
|
|
29360
|
-
return /* @__PURE__ */
|
|
29568
|
+
return /* @__PURE__ */ jsx111(Navigate2, { to: requirement.redirectTo, replace: true });
|
|
29361
29569
|
}
|
|
29362
|
-
return /* @__PURE__ */
|
|
29570
|
+
return /* @__PURE__ */ jsx111(AccessDenied, { requirement });
|
|
29363
29571
|
}
|
|
29364
|
-
return /* @__PURE__ */
|
|
29572
|
+
return /* @__PURE__ */ jsx111(Outlet3, {});
|
|
29365
29573
|
};
|
|
29366
29574
|
var AccessDenied = ({
|
|
29367
29575
|
requirement
|
|
29368
29576
|
}) => {
|
|
29369
29577
|
const { t: t2 } = useTranslation50();
|
|
29370
|
-
return /* @__PURE__ */
|
|
29371
|
-
/* @__PURE__ */
|
|
29372
|
-
/* @__PURE__ */
|
|
29373
|
-
/* @__PURE__ */
|
|
29374
|
-
/* @__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") })
|
|
29375
29583
|
] }),
|
|
29376
|
-
/* @__PURE__ */
|
|
29584
|
+
/* @__PURE__ */ jsx111(Text22, { size: "small", className: "text-ui-fg-muted", children: t2("permissions.accessDenied.requiredPermission", {
|
|
29377
29585
|
permission: requirement.permissions.join(", ")
|
|
29378
29586
|
}) })
|
|
29379
29587
|
] }) }) });
|
|
@@ -29404,7 +29612,7 @@ import {
|
|
|
29404
29612
|
cloneElement as cloneElement2,
|
|
29405
29613
|
isValidElement
|
|
29406
29614
|
} from "react";
|
|
29407
|
-
import { jsx as
|
|
29615
|
+
import { jsx as jsx112 } from "react/jsx-runtime";
|
|
29408
29616
|
var PermissionAction = ({
|
|
29409
29617
|
permission,
|
|
29410
29618
|
requireAll = false,
|
|
@@ -29416,16 +29624,16 @@ var PermissionAction = ({
|
|
|
29416
29624
|
}
|
|
29417
29625
|
const inner = children.props.children;
|
|
29418
29626
|
const label = children.props.asChild && isValidElement(inner) ? inner.props.children : inner;
|
|
29419
|
-
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) }) });
|
|
29420
29628
|
};
|
|
29421
29629
|
|
|
29422
29630
|
// src/permissions/section-no-access.tsx
|
|
29423
29631
|
import { Text as Text23 } from "@medusajs/ui";
|
|
29424
29632
|
import { useTranslation as useTranslation51 } from "react-i18next";
|
|
29425
|
-
import { jsx as
|
|
29633
|
+
import { jsx as jsx113 } from "react/jsx-runtime";
|
|
29426
29634
|
var SectionNoAccess = ({ className }) => {
|
|
29427
29635
|
const { t: t2 } = useTranslation51();
|
|
29428
|
-
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") }) });
|
|
29429
29637
|
};
|
|
29430
29638
|
|
|
29431
29639
|
// src/permissions/with-permission.ts
|
|
@@ -29452,7 +29660,7 @@ var SidebarContext = createContext11(null);
|
|
|
29452
29660
|
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
29453
29661
|
import { useCallback as useCallback29, useEffect as useEffect27, useMemo as useMemo29, useState as useState40 } from "react";
|
|
29454
29662
|
import { useLocation as useLocation4 } from "react-router-dom";
|
|
29455
|
-
import { jsx as
|
|
29663
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
29456
29664
|
var SidebarProvider = ({ children }) => {
|
|
29457
29665
|
const [desktop, setDesktop] = useState40(true);
|
|
29458
29666
|
const [mobile, setMobile] = useState40(false);
|
|
@@ -29478,7 +29686,7 @@ var SidebarProvider = ({ children }) => {
|
|
|
29478
29686
|
}),
|
|
29479
29687
|
[desktop, mobile, toggle]
|
|
29480
29688
|
);
|
|
29481
|
-
return /* @__PURE__ */
|
|
29689
|
+
return /* @__PURE__ */ jsx114(SidebarContext.Provider, { value, children });
|
|
29482
29690
|
};
|
|
29483
29691
|
|
|
29484
29692
|
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
@@ -29521,6 +29729,197 @@ var useSidebarMenuPlacement = (align) => {
|
|
|
29521
29729
|
return state === "collapsed" ? { side: "right", align } : {};
|
|
29522
29730
|
};
|
|
29523
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
|
+
|
|
29524
29923
|
// src/price-lists/constants.ts
|
|
29525
29924
|
var PriceListStatus = /* @__PURE__ */ ((PriceListStatus2) => {
|
|
29526
29925
|
PriceListStatus2["ACTIVE"] = "active";
|
|
@@ -29683,6 +30082,8 @@ export {
|
|
|
29683
30082
|
AddressSchema,
|
|
29684
30083
|
AttributeValueInput,
|
|
29685
30084
|
BadgeListSummary,
|
|
30085
|
+
CORE_ENTRY_PREFIX,
|
|
30086
|
+
CORE_LAYOUTS,
|
|
29686
30087
|
ChipGroup,
|
|
29687
30088
|
ChipInput,
|
|
29688
30089
|
CodeCell,
|
|
@@ -29727,6 +30128,8 @@ export {
|
|
|
29727
30128
|
JsonViewSection,
|
|
29728
30129
|
JsonViewSectionSkeleton,
|
|
29729
30130
|
KeyboundForm,
|
|
30131
|
+
LayoutComposer,
|
|
30132
|
+
LayoutEntry,
|
|
29730
30133
|
LinkButton,
|
|
29731
30134
|
ListBadge,
|
|
29732
30135
|
ListSummary,
|
|
@@ -29770,6 +30173,7 @@ export {
|
|
|
29770
30173
|
SidebarContext,
|
|
29771
30174
|
SidebarLink,
|
|
29772
30175
|
SidebarProvider,
|
|
30176
|
+
SingleColumnLayoutComponent,
|
|
29773
30177
|
SingleColumnPage,
|
|
29774
30178
|
SingleColumnPageSkeleton,
|
|
29775
30179
|
Skeleton,
|
|
@@ -29788,6 +30192,7 @@ export {
|
|
|
29788
30192
|
TextSkeleton,
|
|
29789
30193
|
Thumbnail,
|
|
29790
30194
|
TransferOwnershipSchema,
|
|
30195
|
+
TwoColumnLayoutComponent,
|
|
29791
30196
|
TwoColumnPage,
|
|
29792
30197
|
TwoColumnPageSkeleton,
|
|
29793
30198
|
VisuallyHidden,
|
|
@@ -29796,18 +30201,24 @@ export {
|
|
|
29796
30201
|
applyActionPermissions,
|
|
29797
30202
|
applyNavGroups,
|
|
29798
30203
|
applyNavOverrides,
|
|
30204
|
+
applyReplacements,
|
|
29799
30205
|
buildAdditionalDataDefaults,
|
|
29800
30206
|
buildAdditionalDataSchema,
|
|
30207
|
+
buildCoreEntries,
|
|
30208
|
+
buildDisplayEntries,
|
|
29801
30209
|
buildOfferGridData,
|
|
29802
30210
|
buildProductChangeView,
|
|
30211
|
+
buildWidgetEntries,
|
|
29803
30212
|
countries,
|
|
29804
30213
|
createDataGridHelper,
|
|
29805
30214
|
createDataGridPriceColumns,
|
|
29806
30215
|
createFormHelper,
|
|
29807
30216
|
createWithPermission,
|
|
29808
30217
|
currencies,
|
|
30218
|
+
detailPageDefaultEntries,
|
|
29809
30219
|
extractPricesFromOffers,
|
|
29810
30220
|
extractReferenceIds,
|
|
30221
|
+
extractSectionElements,
|
|
29811
30222
|
filterCommandsByPermission,
|
|
29812
30223
|
formatFieldValue,
|
|
29813
30224
|
genericForwardRef,
|
|
@@ -29836,12 +30247,15 @@ export {
|
|
|
29836
30247
|
isReferenceField,
|
|
29837
30248
|
isSameAddress,
|
|
29838
30249
|
linkFields,
|
|
30250
|
+
mergeLayoutPreferences,
|
|
29839
30251
|
mergeListFilters,
|
|
30252
|
+
navOverridesFromPreferences,
|
|
29840
30253
|
permissionMapAllows,
|
|
29841
30254
|
plainTextToHtml,
|
|
29842
30255
|
productChangeViewHasContent,
|
|
29843
30256
|
queryClient,
|
|
29844
30257
|
queryKeysFactory,
|
|
30258
|
+
resolveRouteOverrides,
|
|
29845
30259
|
richTextContentClasses,
|
|
29846
30260
|
sanitizeRichText,
|
|
29847
30261
|
toPermissionList,
|