@lunejs/admin-ui 0.1.2 → 0.1.4

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.
@@ -1,37 +1,40 @@
1
- import { useEffect as g, useMemo as c } from "react";
2
- import { useDataTable as d } from "../../../../shared/components/data-table/use-data-table.js";
1
+ import { useEffect as d, useMemo as c } from "react";
2
+ import { useDataTable as g } from "../../../../shared/components/data-table/use-data-table.js";
3
3
  import { getSkip as h } from "../../../../shared/utils/pagination.utils.js";
4
4
  import { useAssetsCount as A } from "../../hooks/use-assets-count.js";
5
5
  import { useGetAssets as b } from "../../hooks/use-get-assets.js";
6
6
  const z = () => {
7
- const o = d({
7
+ const a = g({
8
8
  search: ""
9
- }), { filters: e, pagination: t } = o, { isLoading: a, count: n } = A(), {
9
+ }), { filters: e, pagination: t } = a, { isLoading: o, count: n } = A(), {
10
10
  isLoading: s,
11
11
  isRefetching: m,
12
12
  assets: i,
13
13
  pagination: { pageInfo: p },
14
14
  refetch: f
15
- } = b({
16
- filters: {
17
- ...e.search && { filename: { contains: e.search } }
15
+ } = b(
16
+ {
17
+ filters: {
18
+ ...e.search && { filename: { contains: e.search } }
19
+ },
20
+ skip: h(t.page, t.size),
21
+ take: t.size
18
22
  },
19
- skip: h(t.page, t.size),
20
- take: t.size
21
- });
22
- g(() => {
23
+ "data-table"
24
+ );
25
+ d(() => {
23
26
  f();
24
27
  }, [e, t]);
25
- const u = c(
28
+ const l = c(
26
29
  () => i?.map((r) => ({ ...r, createdAt: new Date(r.createdAt) })) ?? [],
27
30
  [i]
28
- ), l = c(() => !s && !a && !n, [s, a, n]);
31
+ ), u = c(() => !s && !o && !n, [s, o, n]);
29
32
  return {
30
- dataTable: o,
33
+ dataTable: a,
31
34
  isLoading: s,
32
35
  isRefetching: m,
33
- shouldRenderEmptyState: l,
34
- assets: u,
36
+ shouldRenderEmptyState: u,
37
+ assets: l,
35
38
  totalRows: p?.total ?? 0
36
39
  };
37
40
  };
@@ -1,7 +1,7 @@
1
1
  import { AssetListInput, CommonAssetFragment, GetAllAssetsQueryQuery } from '../../api/types';
2
2
  import { GraphQLError } from 'graphql';
3
3
  import { RefetchOptions, QueryObserverResult, FetchStatus } from '@tanstack/query-core';
4
- export declare const useGetAssets: (input?: AssetListInput) => {
4
+ export declare const useGetAssets: (input?: AssetListInput, key?: string) => {
5
5
  assets: CommonAssetFragment[];
6
6
  pagination: {
7
7
  count: number | undefined;
@@ -1,22 +1,22 @@
1
- import { useMemo as m } from "react";
2
- import { useGqlQuery as n } from "../../api/fetchers/use-gql-query.js";
3
- import { GET_ALL_ASSETS_QUERY as i, COMMON_ASSET_FRAGMENT as p } from "../../api/operations/asset.operations.js";
4
- import { getFragmentData as u } from "../../api/codegen/fragment-masking.js";
5
- import { AssetCacheKeys as A } from "../constants/cache-keys.js";
6
- const _ = (s) => {
7
- const t = n(i, {
1
+ import { useMemo as n } from "react";
2
+ import { useGqlQuery as i } from "../../api/fetchers/use-gql-query.js";
3
+ import { GET_ALL_ASSETS_QUERY as p, COMMON_ASSET_FRAGMENT as u } from "../../api/operations/asset.operations.js";
4
+ import { getFragmentData as A } from "../../api/codegen/fragment-masking.js";
5
+ import { AssetCacheKeys as c } from "../constants/cache-keys.js";
6
+ const g = (s, e = "") => {
7
+ const t = i(p, {
8
8
  variables: { input: s },
9
- key: [A.All]
10
- }), e = m(
11
- () => t.data?.assets.items.map((r) => u(p, r)) ?? [],
9
+ key: [c.All, e]
10
+ }), a = n(
11
+ () => t.data?.assets.items.map((m) => A(u, m)) ?? [],
12
12
  [t.data]
13
- ), { count: a, pageInfo: o } = t.data?.assets ?? {};
13
+ ), { count: o, pageInfo: r } = t.data?.assets ?? {};
14
14
  return {
15
15
  ...t,
16
- assets: e,
17
- pagination: { count: a, pageInfo: o }
16
+ assets: a,
17
+ pagination: { count: o, pageInfo: r }
18
18
  };
19
19
  };
20
20
  export {
21
- _ as useGetAssets
21
+ g as useGetAssets
22
22
  };
@@ -1,11 +1,11 @@
1
1
  import { getFragmentData as m } from "../../api/codegen/fragment-masking.js";
2
2
  import { useGqlQuery as r } from "../../api/fetchers/use-gql-query.js";
3
3
  import { GET_CUSTOM_FIELD_DEFINITIONS_QUERY as a, COMMON_CUSTOM_FIELD_DEFINITION_FRAGMENT as f } from "../../api/operations/custom-field-definition.operations.js";
4
- import { CustomFieldDefinitionsCacheKeys as u } from "../constants/cache-keys.js";
4
+ import { CustomFieldDefinitionsCacheKeys as F } from "../constants/cache-keys.js";
5
5
  const I = (t) => {
6
6
  const { data: i, ...o } = r(a, {
7
7
  variables: { input: t },
8
- key: [u.All]
8
+ key: [F.All, JSON.stringify(t)]
9
9
  }), e = i?.customFieldDefinitions?.items.map(
10
10
  (s) => m(f, s)
11
11
  ) ?? [], n = {
@@ -5,18 +5,18 @@ import { useDataTable as F } from "../../../../shared/components/data-table/use-
5
5
  import { getSkip as k } from "../../../../shared/utils/pagination.utils.js";
6
6
  import { OrderParamFiltersKeys as u } from "../../constants/param-filters-keys.js";
7
7
  import { useCountOrders as E } from "../../hooks/use-count-orders.js";
8
- import { useGetOrders as M } from "../../hooks/use-get-orders.js";
8
+ import { useGetOrders as L } from "../../hooks/use-get-orders.js";
9
9
  const N = () => {
10
- const [i] = P(), l = a(
11
- () => i.get(u.OrderState),
10
+ const [l] = P(), c = a(
11
+ () => l.get(u.OrderState),
12
12
  []
13
13
  ), p = a(
14
- () => i.get(u.CustomerEmail),
14
+ () => l.get(u.CustomerEmail),
15
15
  []
16
- ), c = F({
16
+ ), m = F({
17
17
  search: p ?? "",
18
- states: l ? [l] : []
19
- }), { filters: t, pagination: s } = c, { isLoading: m, count: n } = E({
18
+ states: c ? [c] : []
19
+ }), { filters: t, pagination: s } = m, { isLoading: o, count: n } = E({
20
20
  filters: {
21
21
  states: [
22
22
  r.Canceled,
@@ -28,12 +28,12 @@ const N = () => {
28
28
  ]
29
29
  }
30
30
  }), {
31
- isLoading: o,
31
+ isLoading: i,
32
32
  isRefetching: f,
33
33
  orders: d,
34
- pagination: { pageInfo: h },
35
- refetch: g
36
- } = M({
34
+ pagination: { pageInfo: g },
35
+ refetch: h
36
+ } = L({
37
37
  filters: {
38
38
  ...t.search && { code: { contains: t.search } },
39
39
  ...t.search && { customer: { contains: t.search } },
@@ -43,7 +43,7 @@ const N = () => {
43
43
  take: s.size
44
44
  });
45
45
  O(() => {
46
- g();
46
+ h();
47
47
  }, [t, s]);
48
48
  const y = a(
49
49
  () => d?.map((e) => ({
@@ -57,14 +57,14 @@ const N = () => {
57
57
  placedAt: e.placedAt ?? null
58
58
  })) ?? [],
59
59
  [d]
60
- ), S = a(() => !o && !m && !n, [o, m, n]);
60
+ ), S = a(() => !i && !o && !n, [i, o, n]);
61
61
  return {
62
- dataTable: c,
63
- isLoading: o,
62
+ dataTable: m,
63
+ isLoading: i || o,
64
64
  isRefetching: f,
65
65
  shouldRenderEmptyState: S,
66
66
  orders: y,
67
- totalRows: h?.total ?? 0
67
+ totalRows: g?.total ?? 0
68
68
  };
69
69
  };
70
70
  export {
@@ -40,7 +40,7 @@ const et = () => {
40
40
  l,
41
41
  {
42
42
  type: "submit",
43
- disabled: !(o || s || r || n) || i.formState.isSubmitting || !t.name,
43
+ disabled: !(o || s || r || i.formState.isDirty || n) || i.formState.isSubmitting || !t.name,
44
44
  children: "Save"
45
45
  }
46
46
  );
@@ -1,44 +1,51 @@
1
- import { LunePrice as o } from "../../../../../packages/lune-common/dist/index.js";
1
+ import { LunePrice as t } from "../../../../../packages/lune-common/dist/index.js";
2
2
  import { useUpdateProduct as l } from "../../../hooks/use-update-product.js";
3
- const g = () => {
4
- const { updateProduct: n } = l();
3
+ const p = () => {
4
+ const { updateProduct: c } = l();
5
5
  return {
6
- updateProduct: (a, e) => {
7
- const { variants: s, options: r } = e, d = a.variants.items[0].optionValues.length === 0, c = a?.variants.items[0];
8
- return n(a.id, {
9
- name: e.name,
10
- description: e.description,
11
- enabled: e.enabled,
12
- defaultVariant: d ? a.variants.items[0].id : null,
13
- customFields: e.customFields,
14
- variants: s.length ? s.map((i) => ({
15
- id: i?.id,
16
- action: i.action,
17
- salePrice: i.salePrice ? o.parse(i.salePrice) : 0,
18
- stock: i.stock || 0,
19
- optionValues: i.optionValues
6
+ updateProduct: (s, i) => {
7
+ const { variants: a, options: o } = i, d = s.variants.items[0].optionValues.length === 0, n = s?.variants.items[0];
8
+ return c(s.id, {
9
+ name: i.name,
10
+ description: i.description,
11
+ enabled: i.enabled,
12
+ defaultVariant: d ? s.variants.items[0].id : null,
13
+ customFields: i.customFields,
14
+ variants: a.length ? a.map((e) => ({
15
+ id: e?.id,
16
+ action: e.action,
17
+ salePrice: e.salePrice ? t.parse(e.salePrice) : 0,
18
+ stock: e.stock || 0,
19
+ comparisonPrice: e.comparisonPrice ? t.parse(e.comparisonPrice) : 0,
20
+ sku: e.sku,
21
+ requiresShipping: e.requiresShipping,
22
+ weight: e.weight,
23
+ height: e.height,
24
+ width: e.width,
25
+ length: e.length,
26
+ optionValues: e.optionValues
20
27
  })) : [
21
28
  {
22
- id: c?.id,
23
- salePrice: e.salePrice ? o.parse(e.salePrice) : 0,
24
- comparisonPrice: e.comparisonPrice ? o.parse(e.comparisonPrice) : 0,
25
- stock: e.stock || 0,
26
- sku: e.sku,
27
- weight: e.weight,
28
- length: e.length,
29
- width: e.width,
30
- height: e.height,
31
- requiresShipping: e.requiresShipping,
29
+ id: n?.id,
30
+ salePrice: i.salePrice ? t.parse(i.salePrice) : 0,
31
+ comparisonPrice: i.comparisonPrice ? t.parse(i.comparisonPrice) : 0,
32
+ stock: i.stock || 0,
33
+ sku: i.sku,
34
+ weight: i.weight,
35
+ length: i.length,
36
+ width: i.width,
37
+ height: i.height,
38
+ requiresShipping: i.requiresShipping,
32
39
  action: "none"
33
40
  }
34
41
  ],
35
- variantsToRemove: a?.variants.items.filter((i) => !s.some((t) => t.id === i.id)).filter((i) => s.length ? !0 : i.id !== c?.id).map((i) => i.id) ?? [],
36
- optionsToRemove: a?.options.filter((i) => !r.some((t) => t.id === i.id)).map((i) => i.id) ?? [],
37
- options: r
42
+ variantsToRemove: s?.variants.items.filter((e) => !a.some((r) => r.id === e.id)).filter((e) => a.length ? !0 : e.id !== n?.id).map((e) => e.id) ?? [],
43
+ optionsToRemove: s?.options.filter((e) => !o.some((r) => r.id === e.id)).map((e) => e.id) ?? [],
44
+ options: o
38
45
  });
39
46
  }
40
47
  };
41
48
  };
42
49
  export {
43
- g as useProductDetailsUpdate
50
+ p as useProductDetailsUpdate
44
51
  };
@@ -1,7 +1,8 @@
1
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import "react";
3
+ import { isUUID as f } from "../../../../../../packages/lune-common/dist/index.js";
3
4
  import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
4
- import { cn as s } from "../../../../../../packages/lune-ui/dist/lib/utils.js";
5
+ import { cn as n } from "../../../../../../packages/lune-ui/dist/lib/utils.js";
5
6
  import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js";
6
7
  import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-avatar/dist/index.js";
7
8
  import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-separator/dist/index.js";
@@ -32,32 +33,32 @@ import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tog
32
33
  import "../../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
34
  import "../../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
35
  import "../../../../../../packages/lune-ui/dist/form/form.js";
35
- import { Link as f } from "../../../../../../node_modules/react-router/dist/development/chunk-JMJ3UQ3L.js";
36
- import { useVariantContext as x } from "../variants.context.js";
37
- const _ = ({ variant: r, groupName: a, className: d }) => {
38
- const { product: u, variants: i, updateVariants: m } = x(), l = !!a, n = l ? r.values.filter((e) => e.name !== a).map((e) => e.name).join("/") : r.values.map((e) => e.name).join(" / ");
39
- return /* @__PURE__ */ p("div", { className: s("flex items-center px-6 py-4 hover:bg-muted/50", d), children: [
40
- /* @__PURE__ */ p("div", { className: s("flex items-center gap-4 w-full", l && "pl-8"), children: [
36
+ import { Link as x } from "../../../../../../node_modules/react-router/dist/development/chunk-JMJ3UQ3L.js";
37
+ import { useVariantContext as g } from "../variants.context.js";
38
+ const oe = ({ variant: r, groupName: a, className: d }) => {
39
+ const { product: u, variants: i, updateVariants: m } = g(), s = !!a, p = s ? r.values.filter((e) => e.name !== a).map((e) => e.name).join("/") : r.values.map((e) => e.name).join(" / ");
40
+ return /* @__PURE__ */ l("div", { className: n("flex items-center px-6 py-4 hover:bg-muted/50", d), children: [
41
+ /* @__PURE__ */ l("div", { className: n("flex items-center gap-4 w-full", s && "pl-8"), children: [
41
42
  /* @__PURE__ */ t(
42
43
  h,
43
44
  {
44
- "aria-label": `Select variant "${n}"`,
45
+ "aria-label": `Select variant "${p}"`,
45
46
  checked: r.selected,
46
47
  onCheckedChange: (e) => m(
47
48
  i.map((o) => o.id === r.id ? { ...o, selected: !!e } : o)
48
49
  )
49
50
  }
50
51
  ),
51
- /* @__PURE__ */ t(
52
- f,
52
+ f(r.id) ? /* @__PURE__ */ t(
53
+ x,
53
54
  {
54
55
  to: `/products/${u?.id}/variants/${r.id}`,
55
56
  className: "hover:underline w-full cursor-pointer",
56
- children: n
57
+ children: p
57
58
  }
58
- )
59
+ ) : /* @__PURE__ */ t("span", { className: "w-full", children: p })
59
60
  ] }),
60
- /* @__PURE__ */ p("div", { className: "flex items-center gap-2 w-full", children: [
61
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-2 w-full", children: [
61
62
  /* @__PURE__ */ t(
62
63
  c,
63
64
  {
@@ -83,5 +84,5 @@ const _ = ({ variant: r, groupName: a, className: d }) => {
83
84
  ] });
84
85
  };
85
86
  export {
86
- _ as VariantItem
87
+ oe as VariantItem
87
88
  };
@@ -1,47 +1,47 @@
1
1
  import { isUUID as r } from "../../../packages/lune-common/dist/index.js";
2
- import { queryClient as V } from "../../../app/app.js";
2
+ import { queryClient as I } from "../../../app/app.js";
3
3
  import { useGqlMutationDEPRECATED as s } from "../../api/fetchers/use-gql-mutation.js";
4
- import { UPDATE_OPTION_MUTATION as w, CREATE_OPTION_MUTATION as g, REMOVE_OPTION_MUTATION as _ } from "../../api/operations/option.operations.js";
4
+ import { UPDATE_OPTION_MUTATION as U, CREATE_OPTION_MUTATION as V, REMOVE_OPTION_MUTATION as _ } from "../../api/operations/option.operations.js";
5
5
  import { UPDATE_PRODUCT_MUTATION as N } from "../../api/operations/product.operations.js";
6
6
  import { UPDATE_VARIANT_MUTATION as M, REMOVE_VARIANT_MUTATION as R, CREATE_VARIANT_MUTATION as b } from "../../api/operations/variant.operations.js";
7
7
  import { ProductCacheKeys as C } from "../constants/cache-keys.js";
8
8
  const G = () => {
9
- const { mutateAsync: T } = s(N), { mutateAsync: O } = s(M), { mutateAsync: d } = s(R), { mutateAsync: A } = s(b), { mutateAsync: E } = s(w), { mutateAsync: P } = s(g), { mutateAsync: h } = s(_);
9
+ const { mutateAsync: h } = s(N), { mutateAsync: T } = s(M), { mutateAsync: d } = s(R), { mutateAsync: O } = s(b), { mutateAsync: A } = s(U), { mutateAsync: P } = s(V), { mutateAsync: g } = s(_);
10
10
  return {
11
- updateProduct: async (i, o) => {
12
- const n = o.options?.filter((e) => !r(e.id)), c = o.options?.filter((e) => r(e.id));
13
- n?.length && o.defaultVariant && await d({ id: o.defaultVariant });
14
- const y = c.length ? await Promise.all(
11
+ updateProduct: async (n, o) => {
12
+ const a = o.options?.filter((e) => !r(e.id)), c = o.options?.filter((e) => r(e.id));
13
+ a?.length && o.defaultVariant && await d({ id: o.defaultVariant });
14
+ const E = c.length ? await Promise.all(
15
15
  c.map(
16
- (e, t) => E({
16
+ (e, t) => A({
17
17
  id: e.id,
18
18
  input: {
19
19
  order: t,
20
20
  name: e.name,
21
- values: e.values.map((a, m) => ({
22
- id: r(a.id) ? a.id : "",
23
- name: a.customObjectEntryId ? null : a.name,
24
- customObjectEntryId: a.customObjectEntryId,
21
+ values: e.values.map((i, m) => ({
22
+ id: r(i.id) ? i.id : "",
23
+ name: i.customObjectEntryId ? null : i.name,
24
+ customObjectEntryId: i.customObjectEntryId,
25
25
  order: m
26
26
  }))
27
27
  }
28
28
  })
29
29
  )
30
- ) : [], f = n.length ? await P({
31
- productId: i,
32
- input: n.map((e, t) => ({
30
+ ) : [], w = a.length ? await P({
31
+ productId: n,
32
+ input: a.map((e, t) => ({
33
33
  order: c.length + t,
34
34
  name: e.name,
35
- values: e.values.map((a, m) => ({
36
- name: a.customObjectEntryId ? null : a.name,
37
- customObjectEntryId: a.customObjectEntryId,
35
+ values: e.values.map((i, m) => ({
36
+ name: i.customObjectEntryId ? null : i.name,
37
+ customObjectEntryId: i.customObjectEntryId,
38
38
  order: m
39
39
  }))
40
40
  }))
41
41
  }) : [];
42
- await Promise.all(o.optionsToRemove.map((e) => h({ id: e })));
43
- const I = [...y, ...f], p = /* @__PURE__ */ new Map();
44
- I.forEach((e) => {
42
+ await Promise.all(o.optionsToRemove.map((e) => g({ id: e })));
43
+ const y = [...E, ...w], p = /* @__PURE__ */ new Map();
44
+ y.forEach((e) => {
45
45
  e.values.forEach((t) => {
46
46
  p.set(t.name, t.id);
47
47
  });
@@ -50,8 +50,8 @@ const G = () => {
50
50
  ...e,
51
51
  optionValues: e.optionValues?.map((t) => ({ id: p.get(t.name) ?? t.id, name: t.name })).filter((t) => t.id) ?? []
52
52
  }));
53
- await T({
54
- id: i,
53
+ await h({
54
+ id: n,
55
55
  input: {
56
56
  name: o.name,
57
57
  description: o.description,
@@ -59,20 +59,25 @@ const G = () => {
59
59
  customFields: Object.entries(o.customFields).map(([e, t]) => ({ id: e, value: t }))
60
60
  }
61
61
  });
62
- const U = l.filter((e) => e.action === "none"), u = l.filter((e) => e.action === "create");
62
+ const f = l.filter((e) => e.action === "none"), u = l.filter((e) => e.action === "create");
63
63
  await Promise.all(
64
- U.map(
65
- async (e) => await O({
64
+ f.map(
65
+ async (e) => await T({
66
66
  id: e.id,
67
67
  input: {
68
68
  salePrice: e.salePrice,
69
69
  stock: e.stock,
70
+ comparisonPrice: e.comparisonPrice,
71
+ sku: e.sku,
72
+ requiresShipping: e.requiresShipping,
73
+ weight: e.weight,
74
+ dimensions: { height: e.height, width: e.width, length: e.length },
70
75
  optionValues: e.optionValues?.map((t) => t.id)
71
76
  }
72
77
  })
73
78
  )
74
- ), u.length && await A({
75
- productId: i,
79
+ ), u.length && await O({
80
+ productId: n,
76
81
  input: u.map((e) => ({
77
82
  salePrice: e.salePrice,
78
83
  stock: e.stock,
@@ -85,7 +90,7 @@ const G = () => {
85
90
  }))
86
91
  }), await Promise.all(
87
92
  o.variantsToRemove.map(async (e) => await d({ id: e }))
88
- ), V.refetchQueries({ queryKey: [C.Unique(i)] });
93
+ ), I.refetchQueries({ queryKey: [C.Unique(n)] });
89
94
  }
90
95
  };
91
96
  };
@@ -33,20 +33,21 @@ import "../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist
33
33
  import "../../../packages/lune-ui/dist/form/form.js";
34
34
  import { useParams as f } from "../../../node_modules/react-router/dist/development/chunk-JMJ3UQ3L.js";
35
35
  import { PageLayout as x } from "../../../shared/components/layout/page-layout.js";
36
+ import { PageLoader as u } from "../../../shared/components/loader/page-loader.js";
36
37
  import { NotFound as h } from "../../../shared/components/not-found/not-found.js";
37
- import { VariantDetails as u } from "../components/variant-details/variant-details.js";
38
+ import { VariantDetails as v } from "../components/variant-details/variant-details.js";
38
39
  import { VariantsList as o } from "../components/variant-details/variants-list/variants-list.js";
39
- import { useGetProductForVariants as v } from "../hooks/use-get-product-for-variants.js";
40
- const or = () => {
41
- const { id: p, variantId: a } = f(), { isLoading: s, product: i } = v(p), m = n(
40
+ import { useGetProductForVariants as g } from "../hooks/use-get-product-for-variants.js";
41
+ const mr = () => {
42
+ const { id: s, variantId: a } = f(), { isLoading: m, product: i } = g(s), p = n(
42
43
  () => i?.variants.items.find((e) => e.id === a) ?? null,
43
44
  [i, a]
44
45
  );
45
- return i.id ? /* @__PURE__ */ t(
46
+ return m ? /* @__PURE__ */ r(u, {}) : i.id ? /* @__PURE__ */ t(
46
47
  x,
47
48
  {
48
49
  className: "max-w-5xl mx-auto w-full fade-in grid grid-cols-6 gap-6",
49
- isLoading: s,
50
+ isLoading: m,
50
51
  children: [
51
52
  /* @__PURE__ */ r("section", { className: "col-span-2 hidden lg:block", children: /* @__PURE__ */ r(l, { className: "pt-4 pb-0 overflow-hidden", children: /* @__PURE__ */ t(c, { className: "px-0 flex flex-col gap-4", children: [
52
53
  /* @__PURE__ */ r(d, { className: "px-4", children: "Variants" }),
@@ -55,11 +56,11 @@ const or = () => {
55
56
  /* @__PURE__ */ r("div", { className: "border-t max-h-[calc(100vh-48px*2-16px-16px-16px-36px-34px)] overflow-y-auto", children: /* @__PURE__ */ r(o.List, {}) })
56
57
  ] })
57
58
  ] }) }) }),
58
- /* @__PURE__ */ r("section", { className: "col-span-6 lg:col-span-4", children: m && /* @__PURE__ */ r(
59
- u,
59
+ /* @__PURE__ */ r("section", { className: "col-span-6 lg:col-span-4", children: p && /* @__PURE__ */ r(
60
+ v,
60
61
  {
61
62
  productId: i.id,
62
- variant: m,
63
+ variant: p,
63
64
  variants: i.variants.items
64
65
  }
65
66
  ) })
@@ -68,5 +69,5 @@ const or = () => {
68
69
  ) : /* @__PURE__ */ r(h, {});
69
70
  };
70
71
  export {
71
- or as VariantsPage
72
+ mr as VariantsPage
72
73
  };
@@ -1,4 +1,4 @@
1
- import { __exports as e } from "../../../../../_virtual/cloneDeep.js";
1
+ import { __exports as e } from "../../../../../_virtual/cloneDeep2.js";
2
2
  import { __require as u } from "./cloneDeepWith.js";
3
3
  var o;
4
4
  function c() {
@@ -1,4 +1,4 @@
1
- import { __exports as e } from "../../../../_virtual/cloneDeep2.js";
1
+ import { __exports as e } from "../../../../_virtual/cloneDeep.js";
2
2
  import { __require as u } from "./cloneDeepWith.js";
3
3
  var o;
4
4
  function c() {
@@ -46,11 +46,14 @@ import { AssetSelectorEmptyState as Y } from "../empty-state/asset-selector-empt
46
46
  import { AssetSelectorNoMatchingFiltersState as _ } from "../empty-state/asset-selector-no-matching-filters-state.js";
47
47
  import O from "../../../../node_modules/lucide-react/dist/esm/icons/cloud-upload.js";
48
48
  const Mr = ({ selected: h, setSelected: s }) => {
49
- const { theme: n } = U(), [g, p] = P(), [i, x] = C(""), { isUploading: c, uploadAsset: b } = M(), { isLoading: l, isRefetching: N, refetch: y, assets: m } = B({
50
- filters: {
51
- ...i && { filename: { contains: i } }
52
- }
53
- }), d = !!i, k = !l && !m.length && !d;
49
+ const { theme: n } = U(), [g, c] = P(), [i, x] = C(""), { isUploading: p, uploadAsset: b } = M(), { isLoading: l, isRefetching: N, refetch: y, assets: m } = B(
50
+ {
51
+ filters: {
52
+ ...i && { filename: { contains: i } }
53
+ }
54
+ },
55
+ "asset-selector"
56
+ ), d = !!i, k = !l && !m.length && !d;
54
57
  I(() => {
55
58
  y();
56
59
  }, [i]);
@@ -69,8 +72,8 @@ const Mr = ({ selected: h, setSelected: s }) => {
69
72
  {
70
73
  className: f(
71
74
  "flex items-center justify-between gap-3 pb-6 px-6 z-10 h-fit border border-transparent",
72
- p && n === "light" && "shadow-sm",
73
- p && n === "dark" && "border-b-border"
75
+ c && n === "light" && "shadow-sm",
76
+ c && n === "dark" && "border-b-border"
74
77
  ),
75
78
  children: [
76
79
  /* @__PURE__ */ o(E, { className: "max-w-80 w-full", children: [
@@ -90,8 +93,8 @@ const Mr = ({ selected: h, setSelected: s }) => {
90
93
  }
91
94
  )
92
95
  ] }),
93
- /* @__PURE__ */ e(T, { onDrop: (r) => b(r), children: /* @__PURE__ */ o(D, { isLoading: c, variant: "outline", className: "shrink-0", children: [
94
- !c && /* @__PURE__ */ e(O, {}),
96
+ /* @__PURE__ */ e(T, { onDrop: (r) => b(r), children: /* @__PURE__ */ o(D, { isLoading: p, variant: "outline", className: "shrink-0", children: [
97
+ !p && /* @__PURE__ */ e(O, {}),
95
98
  " Upload"
96
99
  ] }) })
97
100
  ]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@lunejs/admin-ui",
3
3
  "description": "Admin UI for Lune",
4
4
  "license": "AGPL-3.0",
5
- "version": "0.1.2",
5
+ "version": "0.1.4",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"