@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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/README.md +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, Fragment as A, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Z as he, _ as fe, $ as pe, a0 as K, a1 as ge, a2 as xe, a3 as ve, a4 as ke, a5 as Ne, a6 as be, a7 as Te, p as ye, a8 as Ce, a9 as we, aa as Ae } from "./index-OuHV9Ann.js";
|
|
3
|
-
import { z as X, B as v } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
|
-
import { D as De } from "./STRINGS-BExFecZW.js";
|
|
5
|
-
import { MagnifyingGlassIcon as q, PlusIcon as J, TokensIcon as je, ArrowLeftIcon as Oe, EyeOpenIcon as Y, Pencil1Icon as Se } from "@radix-ui/react-icons";
|
|
6
|
-
import { useAtom as Ee } from "jotai";
|
|
7
|
-
import { nanoid as Ie } from "nanoid";
|
|
8
|
-
import { useState as x, useRef as U, useCallback as F, useMemo as Pe, useEffect as ee, Suspense as ze, lazy as Re } from "react";
|
|
9
|
-
import { useTranslation as Le } from "react-i18next";
|
|
10
|
-
import { toast as p } from "sonner";
|
|
11
|
-
import { twMerge as Me } from "tailwind-merge";
|
|
12
|
-
const W = (o) => {
|
|
13
|
-
const m = o.trim();
|
|
14
|
-
return m.length === 0 || m.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m);
|
|
15
|
-
}, $e = (o, m, n, i = !1, u) => {
|
|
16
|
-
const h = o.trim();
|
|
17
|
-
return h.length === 0 ? "" : h.length > 25 ? n("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h) ? Object.entries(m).find(
|
|
18
|
-
([k, C]) => C.name === h && (!i || k !== u)
|
|
19
|
-
) ? n("Token name already exists") : "" : n("Only alphanumeric characters and hyphens allowed");
|
|
20
|
-
}, Be = (o) => o.replace(/\s+/g, "-"), Fe = Re(() => import("./design-token-usage-D1lWCJ3L.js")), te = ({
|
|
21
|
-
tokenId: o,
|
|
22
|
-
token: m,
|
|
23
|
-
isDisabled: n,
|
|
24
|
-
isSelected: i,
|
|
25
|
-
isArchived: u = !1,
|
|
26
|
-
onSelect: h,
|
|
27
|
-
onEdit: y,
|
|
28
|
-
onUnarchive: N
|
|
29
|
-
}) => /* @__PURE__ */ a(
|
|
30
|
-
"div",
|
|
31
|
-
{
|
|
32
|
-
onClick: () => h(o),
|
|
33
|
-
className: `group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${u ? "border-muted bg-muted/30 opacity-60" : i ? "border-primary bg-primary/10" : "hover:bg-muted/90"}`,
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
36
|
-
/* @__PURE__ */ e("div", { className: `text-xs font-semibold ${u ? "text-muted-foreground" : ""}`, children: m.name }),
|
|
37
|
-
/* @__PURE__ */ e("div", { className: `w-full max-w-52 truncate text-[10px] font-light ${u ? "text-muted-foreground" : ""}`, children: m.value })
|
|
38
|
-
] }),
|
|
39
|
-
/* @__PURE__ */ a("div", { className: "absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100", children: [
|
|
40
|
-
!u && /* @__PURE__ */ a(A, { children: [
|
|
41
|
-
/* @__PURE__ */ e(ze, { fallback: null, children: /* @__PURE__ */ e(Fe, { tokenId: o, tokenName: m.name, children: /* @__PURE__ */ e(
|
|
42
|
-
v,
|
|
43
|
-
{
|
|
44
|
-
variant: "ghost",
|
|
45
|
-
size: "sm",
|
|
46
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
47
|
-
children: /* @__PURE__ */ e(Y, { className: "h-3 w-3" })
|
|
48
|
-
}
|
|
49
|
-
) }) }),
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
v,
|
|
52
|
-
{
|
|
53
|
-
variant: "ghost",
|
|
54
|
-
size: "sm",
|
|
55
|
-
onClick: (k) => {
|
|
56
|
-
k.stopPropagation(), y(o);
|
|
57
|
-
},
|
|
58
|
-
disabled: n,
|
|
59
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
60
|
-
children: /* @__PURE__ */ e(Se, { className: "h-3 w-3" })
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
] }),
|
|
64
|
-
u && /* @__PURE__ */ e(
|
|
65
|
-
v,
|
|
66
|
-
{
|
|
67
|
-
variant: "ghost",
|
|
68
|
-
size: "sm",
|
|
69
|
-
onClick: (k) => {
|
|
70
|
-
k.stopPropagation(), N == null || N(o);
|
|
71
|
-
},
|
|
72
|
-
disabled: n,
|
|
73
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
74
|
-
children: /* @__PURE__ */ e(Y, { className: "h-3 w-3" })
|
|
75
|
-
}
|
|
76
|
-
)
|
|
77
|
-
] })
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
), tt = ({ onActiveTokenChange: o, onDirtyStateChange: m }) => {
|
|
81
|
-
const { t: n } = Le(), [i, u] = Ee(he), h = fe(), { saveDesignTokens: y, debouncedSaveDesignTokens: N } = pe(), k = K("pageId", ""), C = K("siteWideUsage", {}), [f, z] = x("view"), [g, R] = x(null), [b, Z] = x(null), [l, D] = x(""), [c, j] = x(""), [O, S] = x(""), [E, ne] = x(""), [se, L] = x(!1), M = U(null), [I, $] = x({
|
|
82
|
-
isOpen: !1,
|
|
83
|
-
tokenId: null,
|
|
84
|
-
tokenName: "",
|
|
85
|
-
pageCount: 0,
|
|
86
|
-
partialCount: 0
|
|
87
|
-
}), P = U(null), re = F(
|
|
88
|
-
(t) => {
|
|
89
|
-
if (!C) return { pageCount: 0, partialCount: 0 };
|
|
90
|
-
let s = 0, r = 0;
|
|
91
|
-
return Object.entries(C).forEach(([d, T]) => {
|
|
92
|
-
if (d === k || !(T != null && T.designTokens)) return;
|
|
93
|
-
Object.keys(T.designTokens).some((ue) => ue === t) && (T.isPartial ? r++ : s++);
|
|
94
|
-
}), { pageCount: s, partialCount: r };
|
|
95
|
-
},
|
|
96
|
-
[C, k]
|
|
97
|
-
), B = Pe(() => Object.entries(i).filter(
|
|
98
|
-
([, t]) => t.name.toLowerCase().includes(E.toLowerCase()) || t.value.toLowerCase().includes(E.toLowerCase())
|
|
99
|
-
), [i, E]);
|
|
100
|
-
ee(() => {
|
|
101
|
-
if (!m)
|
|
102
|
-
return;
|
|
103
|
-
const t = f === "add" && (l && l.trim().length > 0 || c && c.trim().length > 0);
|
|
104
|
-
m(t);
|
|
105
|
-
}, [f, l, c, m]), ee(() => {
|
|
106
|
-
if (o)
|
|
107
|
-
if (f === "edit" || f === "add")
|
|
108
|
-
o(l && c ? {
|
|
109
|
-
name: l,
|
|
110
|
-
value: c,
|
|
111
|
-
id: g || void 0
|
|
112
|
-
} : null);
|
|
113
|
-
else if (f === "view" && b && i[b]) {
|
|
114
|
-
const t = i[b];
|
|
115
|
-
o({
|
|
116
|
-
name: t.name,
|
|
117
|
-
value: t.value,
|
|
118
|
-
id: b
|
|
119
|
-
});
|
|
120
|
-
} else
|
|
121
|
-
o(null);
|
|
122
|
-
}, [f, l, c, g, b, i, o]);
|
|
123
|
-
const ae = () => {
|
|
124
|
-
if (!l.trim() || !c.trim()) {
|
|
125
|
-
p.error(n("Please fill in both token name and classes"));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (!W(l)) {
|
|
129
|
-
p.error(n("Invalid design token name format"));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (Object.entries(i).find(
|
|
133
|
-
([s, r]) => r.name === l.trim() && s !== g
|
|
134
|
-
)) {
|
|
135
|
-
p.error(n("Token already exists"));
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
g && ie(l, c);
|
|
139
|
-
}, w = F(() => {
|
|
140
|
-
R(null), D(""), j(""), S(""), L(!1), z("view");
|
|
141
|
-
}, []), ie = F(
|
|
142
|
-
(t, s) => {
|
|
143
|
-
!g || f !== "edit" || !t.trim() || !s.trim() || !W(t) || Object.entries(i).find(
|
|
144
|
-
([d, T]) => T.name === t.trim() && d !== g
|
|
145
|
-
) || (L(!0), M.current && clearTimeout(M.current), M.current = setTimeout(() => {
|
|
146
|
-
const d = {
|
|
147
|
-
...i,
|
|
148
|
-
[g]: {
|
|
149
|
-
name: t.trim(),
|
|
150
|
-
value: s.trim()
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
u(d), h(), N(), L(!1), p.success(n("Token updated successfully")), w();
|
|
154
|
-
}, 10));
|
|
155
|
-
},
|
|
156
|
-
[
|
|
157
|
-
g,
|
|
158
|
-
f,
|
|
159
|
-
i,
|
|
160
|
-
u,
|
|
161
|
-
h,
|
|
162
|
-
N,
|
|
163
|
-
n,
|
|
164
|
-
w
|
|
165
|
-
]
|
|
166
|
-
), oe = () => {
|
|
167
|
-
if (!l.trim() || !c.trim()) {
|
|
168
|
-
p.error(n("Please fill in both token name and classes"));
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (!W(l)) {
|
|
172
|
-
p.error(n("Invalid design token name format"));
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (Object.values(i).find((d) => d.name === l.trim())) {
|
|
176
|
-
p.error(n("Token already exists"));
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
const s = `${De}${Ie(12)}`, r = {
|
|
180
|
-
...i,
|
|
181
|
-
[s]: {
|
|
182
|
-
name: l.trim(),
|
|
183
|
-
value: c.trim()
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
u(r), h(), y(), p.success(n("Token added successfully")), w();
|
|
187
|
-
}, G = (t) => {
|
|
188
|
-
const s = i[t];
|
|
189
|
-
if (!s) return;
|
|
190
|
-
const { pageCount: r, partialCount: d } = re(t);
|
|
191
|
-
$({
|
|
192
|
-
isOpen: !0,
|
|
193
|
-
tokenId: t,
|
|
194
|
-
tokenName: s.name,
|
|
195
|
-
pageCount: r,
|
|
196
|
-
partialCount: d
|
|
197
|
-
}), P.current = t;
|
|
198
|
-
}, le = () => {
|
|
199
|
-
const t = P.current;
|
|
200
|
-
if (!t) return;
|
|
201
|
-
const s = {
|
|
202
|
-
...i,
|
|
203
|
-
[t]: {
|
|
204
|
-
...i[t],
|
|
205
|
-
archived: !0
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
u(s), h(), y(), p.success(n("Token archived successfully")), $({
|
|
209
|
-
isOpen: !1,
|
|
210
|
-
tokenId: null,
|
|
211
|
-
tokenName: "",
|
|
212
|
-
pageCount: 0,
|
|
213
|
-
partialCount: 0
|
|
214
|
-
}), P.current = null;
|
|
215
|
-
}, V = (t) => {
|
|
216
|
-
const s = {
|
|
217
|
-
...i,
|
|
218
|
-
[t]: {
|
|
219
|
-
name: i[t].name,
|
|
220
|
-
value: i[t].value
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
u(s), h(), p.success(n("Token unarchived successfully"));
|
|
224
|
-
}, _ = (t) => {
|
|
225
|
-
const s = i[t];
|
|
226
|
-
s && (R(t), D(s.name), j(s.value), S(""), z("edit"));
|
|
227
|
-
}, Q = () => {
|
|
228
|
-
R(null), D(""), j(""), S(""), z("add");
|
|
229
|
-
}, ce = (t) => {
|
|
230
|
-
const s = Be(t);
|
|
231
|
-
D(s);
|
|
232
|
-
const r = $e(s, i, n, f === "edit", g || void 0);
|
|
233
|
-
S(r);
|
|
234
|
-
}, H = (t) => {
|
|
235
|
-
j(t);
|
|
236
|
-
}, de = (t) => {
|
|
237
|
-
const s = we(Ae(Me(c, t)));
|
|
238
|
-
H(s);
|
|
239
|
-
}, me = (t) => {
|
|
240
|
-
const s = c.split(" ").filter((r) => r !== t).join(" ");
|
|
241
|
-
H(s);
|
|
242
|
-
};
|
|
243
|
-
return /* @__PURE__ */ a(A, { children: [
|
|
244
|
-
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: f === "view" ? (() => {
|
|
245
|
-
const t = B.filter(([, r]) => !r.archived), s = B.filter(([, r]) => r.archived);
|
|
246
|
-
return /* @__PURE__ */ a(A, { children: [
|
|
247
|
-
Object.entries(i).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
248
|
-
/* @__PURE__ */ a("div", { className: "relative flex-1", children: [
|
|
249
|
-
/* @__PURE__ */ e(q, { className: "absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" }),
|
|
250
|
-
/* @__PURE__ */ e(
|
|
251
|
-
X,
|
|
252
|
-
{
|
|
253
|
-
placeholder: n("Search tokens"),
|
|
254
|
-
value: E,
|
|
255
|
-
onChange: (r) => ne(r.target.value),
|
|
256
|
-
className: "h-6 pl-7 text-xs"
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
] }),
|
|
260
|
-
/* @__PURE__ */ a(
|
|
261
|
-
v,
|
|
262
|
-
{
|
|
263
|
-
variant: "outline",
|
|
264
|
-
onClick: Q,
|
|
265
|
-
size: "sm",
|
|
266
|
-
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
267
|
-
children: [
|
|
268
|
-
/* @__PURE__ */ e(J, { className: "h-3 w-3" }),
|
|
269
|
-
n("Add")
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
] }),
|
|
274
|
-
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(Te, { className: "flex h-full flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
275
|
-
Object.entries(i).length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
276
|
-
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(je, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
277
|
-
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
|
|
278
|
-
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
|
|
279
|
-
/* @__PURE__ */ a(v, { variant: "default", onClick: Q, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
280
|
-
/* @__PURE__ */ e(J, { className: "mr-1 h-3 w-3" }),
|
|
281
|
-
n("Add first design token")
|
|
282
|
-
] })
|
|
283
|
-
] }) : B.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
284
|
-
/* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(q, { className: "h-10 w-10 text-muted-foreground" }) }),
|
|
285
|
-
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No tokens found") }),
|
|
286
|
-
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("No design tokens match your search") })
|
|
287
|
-
] }) : /* @__PURE__ */ a(A, { children: [
|
|
288
|
-
t.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-1", children: t.map(([r, d]) => /* @__PURE__ */ e(
|
|
289
|
-
te,
|
|
290
|
-
{
|
|
291
|
-
token: d,
|
|
292
|
-
tokenId: r,
|
|
293
|
-
isSelected: b === r,
|
|
294
|
-
isArchived: !1,
|
|
295
|
-
onSelect: Z,
|
|
296
|
-
onEdit: _,
|
|
297
|
-
onArchive: G,
|
|
298
|
-
onUnarchive: V,
|
|
299
|
-
isDisabled: !1
|
|
300
|
-
},
|
|
301
|
-
r
|
|
302
|
-
)) }),
|
|
303
|
-
s.length > 0 && /* @__PURE__ */ a("div", { className: "mt-4 space-y-1", children: [
|
|
304
|
-
/* @__PURE__ */ e("div", { className: "px-2 py-1 text-[10px] font-semibold text-muted-foreground", children: n("Archived") }),
|
|
305
|
-
s.map(([r, d]) => /* @__PURE__ */ e(
|
|
306
|
-
te,
|
|
307
|
-
{
|
|
308
|
-
token: d,
|
|
309
|
-
tokenId: r,
|
|
310
|
-
isSelected: b === r,
|
|
311
|
-
isArchived: !0,
|
|
312
|
-
onSelect: Z,
|
|
313
|
-
onEdit: _,
|
|
314
|
-
onArchive: G,
|
|
315
|
-
onUnarchive: V,
|
|
316
|
-
isDisabled: !1
|
|
317
|
-
},
|
|
318
|
-
r
|
|
319
|
-
))
|
|
320
|
-
] })
|
|
321
|
-
] }),
|
|
322
|
-
/* @__PURE__ */ e("div", { className: "h-44" })
|
|
323
|
-
] }) }) })
|
|
324
|
-
] });
|
|
325
|
-
})() : (() => {
|
|
326
|
-
const t = f === "edit", s = n(t ? "Edit Design Token" : "Add Design Token"), r = n(t ? "Update design token" : "Create a reusable design token");
|
|
327
|
-
return /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
|
|
328
|
-
/* @__PURE__ */ a("div", { className: "mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5", children: [
|
|
329
|
-
/* @__PURE__ */ e(
|
|
330
|
-
v,
|
|
331
|
-
{
|
|
332
|
-
variant: "ghost",
|
|
333
|
-
size: "sm",
|
|
334
|
-
onClick: w,
|
|
335
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
|
|
336
|
-
children: /* @__PURE__ */ e(Oe, { className: "h-3 w-3" })
|
|
337
|
-
}
|
|
338
|
-
),
|
|
339
|
-
/* @__PURE__ */ a("div", { className: "flex-1", children: [
|
|
340
|
-
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: s }),
|
|
341
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: r })
|
|
342
|
-
] }),
|
|
343
|
-
t && se && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary" }) })
|
|
344
|
-
] }),
|
|
345
|
-
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
|
|
346
|
-
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
347
|
-
/* @__PURE__ */ e(ye, { htmlFor: "token-name", className: "text-xs font-medium", children: n("Token Name") }),
|
|
348
|
-
/* @__PURE__ */ e(
|
|
349
|
-
X,
|
|
350
|
-
{
|
|
351
|
-
id: "token-name",
|
|
352
|
-
placeholder: "Button-Primary",
|
|
353
|
-
value: l,
|
|
354
|
-
onChange: (d) => ce(d.target.value),
|
|
355
|
-
className: "h-7 text-xs"
|
|
356
|
-
}
|
|
357
|
-
),
|
|
358
|
-
O ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: O }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: n("Button-Primary, Card-Header, Text-Large etc.") })
|
|
359
|
-
] }),
|
|
360
|
-
/* @__PURE__ */ e(
|
|
361
|
-
Ce,
|
|
362
|
-
{
|
|
363
|
-
from: "designToken",
|
|
364
|
-
classFromProps: c,
|
|
365
|
-
onAddNew: de,
|
|
366
|
-
onRemove: me,
|
|
367
|
-
showDesignTokenSuggestions: !1
|
|
368
|
-
}
|
|
369
|
-
),
|
|
370
|
-
/* @__PURE__ */ a("div", { className: "mt-3 flex items-center justify-end gap-2 pt-3", children: [
|
|
371
|
-
/* @__PURE__ */ e(v, { variant: "outline", onClick: w, className: "h-7 text-xs", children: n("Cancel") }),
|
|
372
|
-
t ? /* @__PURE__ */ e(
|
|
373
|
-
v,
|
|
374
|
-
{
|
|
375
|
-
onClick: ae,
|
|
376
|
-
disabled: !l.trim() || !c.trim() || !!O,
|
|
377
|
-
className: "h-7 text-xs",
|
|
378
|
-
children: n("Save Token")
|
|
379
|
-
}
|
|
380
|
-
) : /* @__PURE__ */ e(
|
|
381
|
-
v,
|
|
382
|
-
{
|
|
383
|
-
onClick: oe,
|
|
384
|
-
disabled: !l.trim() || !c.trim() || !!O,
|
|
385
|
-
className: "h-7 text-xs",
|
|
386
|
-
children: n("Add Token")
|
|
387
|
-
}
|
|
388
|
-
)
|
|
389
|
-
] })
|
|
390
|
-
] })
|
|
391
|
-
] });
|
|
392
|
-
})() }),
|
|
393
|
-
/* @__PURE__ */ e(
|
|
394
|
-
ge,
|
|
395
|
-
{
|
|
396
|
-
open: I.isOpen,
|
|
397
|
-
onOpenChange: (t) => {
|
|
398
|
-
t || ($({
|
|
399
|
-
isOpen: !1,
|
|
400
|
-
tokenId: null,
|
|
401
|
-
tokenName: "",
|
|
402
|
-
pageCount: 0,
|
|
403
|
-
partialCount: 0
|
|
404
|
-
}), P.current = null);
|
|
405
|
-
},
|
|
406
|
-
children: /* @__PURE__ */ a(xe, { children: [
|
|
407
|
-
/* @__PURE__ */ e(ve, { children: n("Archive Design Token") }),
|
|
408
|
-
/* @__PURE__ */ a(ke, { className: "space-y-3", children: [
|
|
409
|
-
/* @__PURE__ */ a("p", { children: [
|
|
410
|
-
n("This token is used on"),
|
|
411
|
-
" ",
|
|
412
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: I.pageCount }),
|
|
413
|
-
" ",
|
|
414
|
-
n("pages"),
|
|
415
|
-
I.partialCount > 0 && /* @__PURE__ */ a(A, { children: [
|
|
416
|
-
" ",
|
|
417
|
-
n("and"),
|
|
418
|
-
" ",
|
|
419
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: I.partialCount }),
|
|
420
|
-
" ",
|
|
421
|
-
n("partials")
|
|
422
|
-
] }),
|
|
423
|
-
"."
|
|
424
|
-
] }),
|
|
425
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: n("Archiving this token will remove the styling for those blocks.") }),
|
|
426
|
-
/* @__PURE__ */ e("p", { children: n("Do you wish to continue?") })
|
|
427
|
-
] }),
|
|
428
|
-
/* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
429
|
-
/* @__PURE__ */ e(Ne, { children: n("Cancel") }),
|
|
430
|
-
/* @__PURE__ */ e(
|
|
431
|
-
be,
|
|
432
|
-
{
|
|
433
|
-
onClick: le,
|
|
434
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
435
|
-
children: n("Archive")
|
|
436
|
-
}
|
|
437
|
-
)
|
|
438
|
-
] })
|
|
439
|
-
] })
|
|
440
|
-
}
|
|
441
|
-
)
|
|
442
|
-
] });
|
|
443
|
-
};
|
|
444
|
-
export {
|
|
445
|
-
tt as default
|
|
446
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DCJDQs1a.cjs"),y=require("@radix-ui/react-icons"),c=require("react"),j=require("react-i18next"),g=require("./plugin-DHpuZZXz.cjs"),o=require("lodash-es"),b=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),w=require("@tailwindcss/forms"),C=require("@tailwindcss/typography"),D=require("./fonts-D5fTqvSS.cjs"),F=require("./manage-design-tokens-udLBvkHA.cjs"),N=()=>{const[s]=t.useTheme(),r=t.useThemeOptions(),[l]=t.useDarkMode(),{document:n,window:d}=t.useFrame(),i=D.useRegisteredFonts();c.useEffect(()=>{l?n==null||n.documentElement.classList.add("dark"):n==null||n.documentElement.classList.remove("dark")},[l,n]),c.useEffect(()=>{!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...g.getChaiThemeOptions(r)}},plugins:[C,w,b,v,g.plugin(function({addBase:a,theme:m}){a({"h1,h2,h3,h4,h5,h6":{fontFamily:m("fontFamily.heading")},body:{fontFamily:m("fontFamily.body"),color:m("colors.foreground"),backgroundColor:m("colors.background")}})})]})},[s,r,d]);const u=c.useMemo(()=>{const a=o.get(s,"fontFamily.heading"),m=o.get(s,"fontFamily.body");return i.filter(f=>f.family===a||f.family===m)},[s,i]),p=c.useMemo(()=>g.getThemeFontsUrls(o.filter(u,a=>o.has(a,"url"))),[u]),h=c.useMemo(()=>g.getThemeCustomFontFace(o.filter(u,a=>o.has(a,"src"))),[u]);return e.jsxs(e.Fragment,{children:[e.jsx(t.CssThemeVariables,{theme:s}),p.map((a,m)=>e.jsx("link",{rel:"stylesheet",href:a},`preview-font-${m}`)),e.jsx("style",{id:"chai-custom-fonts",dangerouslySetInnerHTML:{__html:h}})]})},T=({content:s,classes:r="",className:l="w-full rounded border-0",style:n={minHeight:80},title:d="Preview"})=>{const i=c.useMemo(()=>t.IframeInitialContent.replace('dir="__HTML_DIR__"','dir="ltr"'),[]);return e.jsxs(t.ChaiFrame,{className:l,style:n,title:d,initialContent:i,children:[e.jsx(N,{}),e.jsx("div",{className:"h-full p-4",children:e.jsx("div",{className:r||void 0,dangerouslySetInnerHTML:{__html:s}})})]})},x=["xs","sm","md","lg","xl","2xl"],k=s=>{if(s=s.trim().replace(/ +(?= )/g,""),o.isEmpty(s))return"";const r=o.map(s.split(" "),t.constructClassObject),l=[];for(const n of r){const d=n.mq;if(!l.includes(n.fullCls))for(let i=x.indexOf(d)+1;i<x.length;i++){const u=o.find(r,{property:n.property,mq:x[i]});if(u&&u.cls!==n.cls)break;o.find(r,{cls:n.cls,mq:x[i]})&&l.push(`${x[i]}:${n.cls}`)}}return o.filter(o.map(r,n=>l.includes(n.fullCls)?null:n.fullCls),n=>n!==null).join(" ")},q=({activeToken:s})=>{const{t:r}=j.useTranslation(),l=s!=null&&s.value?k(s.value):"",n=s&&s.name&&s.value;return e.jsx(t.ScrollArea,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-4",children:e.jsxs("div",{className:"space-y-2 rounded-lg border bg-card p-4",children:[n&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.name}),s.id&&e.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground",children:s.id})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[10px] font-medium text-muted-foreground",children:r("Preview:")}),e.jsx(T,{content:r("Sample text with token styles applied"),classes:l,style:{minHeight:80},title:r("Token Preview")})]})]})})})},A=({open:s,onOpenChange:r})=>{const{t:l}=j.useTranslation(),[n,d]=c.useState(null),[i,u]=c.useState(!1),[p,h]=c.useState(!1),a=c.useCallback(f=>{if(!f&&i){h(!0);return}r(f)},[i,r]),m=c.useCallback(()=>{h(!1),u(!1),r(!1)},[r]);return e.jsxs(e.Fragment,{children:[e.jsx(t.Dialog,{open:s,onOpenChange:a,children:e.jsxs(t.DialogContent,{className:"flex h-[540px] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(t.DialogHeader,{className:"border-b border-border px-6 py-4",children:e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(y.TokensIcon,{className:"h-5 w-5 text-primary"}),l("Design Token Management")]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex w-1/2 flex-col border-r border-border p-4",children:e.jsx(F.default,{onActiveTokenChange:d,onDirtyStateChange:u})}),e.jsxs("div",{className:"flex w-1/2 flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold",children:l("Live Preview")})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{activeToken:n})})]})]})]})}),e.jsx(t.AlertDialog,{open:p,onOpenChange:h,children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:l("Unsaved Changes")}),e.jsx(t.AlertDialogDescription,{children:l("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{children:l("Continue Editing")}),e.jsx(t.AlertDialogAction,{onClick:m,children:l("Discard Changes")})]})]})})]})};exports.default=A;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { jsxs as l, jsx as e, Fragment as y } from "react/jsx-runtime";
|
|
2
|
-
import { al as k, am as A, an as T, ao as M, ap as H, aq as _, ar as j, as as I, a7 as P, D as S, e as L, f as E, g as O, a1 as U, a2 as q, at as R, a3 as $, a4 as V, au as Y, a5 as z, a6 as B } from "./index-OuHV9Ann.js";
|
|
3
|
-
import { TokensIcon as Q } from "@radix-ui/react-icons";
|
|
4
|
-
import { useMemo as u, useEffect as b, useState as g, useCallback as w } from "react";
|
|
5
|
-
import { useTranslation as F } from "react-i18next";
|
|
6
|
-
import { p as W, g as G, a as J, b as K } from "./plugin-BSjgGgwo.js";
|
|
7
|
-
import { get as v, filter as x, has as C, isEmpty as X, map as D, find as N } from "lodash-es";
|
|
8
|
-
import Z from "@tailwindcss/aspect-ratio";
|
|
9
|
-
import ee from "@tailwindcss/container-queries";
|
|
10
|
-
import se from "@tailwindcss/forms";
|
|
11
|
-
import ne from "@tailwindcss/typography";
|
|
12
|
-
import { u as ae } from "./fonts-B3UYxuJI.js";
|
|
13
|
-
import re from "./manage-design-tokens-6YGIctip.js";
|
|
14
|
-
const te = () => {
|
|
15
|
-
const [s] = T(), a = M(), [r] = H(), { document: n, window: i } = _(), t = ae();
|
|
16
|
-
b(() => {
|
|
17
|
-
r ? n == null || n.documentElement.classList.add("dark") : n == null || n.documentElement.classList.remove("dark");
|
|
18
|
-
}, [r, n]), b(() => {
|
|
19
|
-
!i || !i.tailwind || (i.tailwind.config = {
|
|
20
|
-
darkMode: "class",
|
|
21
|
-
theme: {
|
|
22
|
-
extend: {
|
|
23
|
-
container: {
|
|
24
|
-
center: !0,
|
|
25
|
-
padding: "1rem",
|
|
26
|
-
screens: {
|
|
27
|
-
"2xl": "1400px"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
...G(a)
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
plugins: [
|
|
34
|
-
ne,
|
|
35
|
-
se,
|
|
36
|
-
Z,
|
|
37
|
-
ee,
|
|
38
|
-
W(function({ addBase: o, theme: d }) {
|
|
39
|
-
o({
|
|
40
|
-
"h1,h2,h3,h4,h5,h6": {
|
|
41
|
-
fontFamily: d("fontFamily.heading")
|
|
42
|
-
},
|
|
43
|
-
body: {
|
|
44
|
-
fontFamily: d("fontFamily.body"),
|
|
45
|
-
color: d("colors.foreground"),
|
|
46
|
-
backgroundColor: d("colors.background")
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
});
|
|
52
|
-
}, [s, a, i]);
|
|
53
|
-
const c = u(() => {
|
|
54
|
-
const o = v(s, "fontFamily.heading"), d = v(s, "fontFamily.body");
|
|
55
|
-
return t.filter((h) => h.family === o || h.family === d);
|
|
56
|
-
}, [s, t]), p = u(
|
|
57
|
-
() => J(x(c, (o) => C(o, "url"))),
|
|
58
|
-
[c]
|
|
59
|
-
), m = u(
|
|
60
|
-
() => K(x(c, (o) => C(o, "src"))),
|
|
61
|
-
[c]
|
|
62
|
-
);
|
|
63
|
-
return /* @__PURE__ */ l(y, { children: [
|
|
64
|
-
/* @__PURE__ */ e(j, { theme: s }),
|
|
65
|
-
p.map((o, d) => /* @__PURE__ */ e("link", { rel: "stylesheet", href: o }, `preview-font-${d}`)),
|
|
66
|
-
/* @__PURE__ */ e("style", { id: "chai-custom-fonts", dangerouslySetInnerHTML: { __html: m } })
|
|
67
|
-
] });
|
|
68
|
-
}, le = ({
|
|
69
|
-
content: s,
|
|
70
|
-
classes: a = "",
|
|
71
|
-
className: r = "w-full rounded border-0",
|
|
72
|
-
style: n = { minHeight: 80 },
|
|
73
|
-
title: i = "Preview"
|
|
74
|
-
}) => {
|
|
75
|
-
const t = u(() => k.replace('dir="__HTML_DIR__"', 'dir="ltr"'), []);
|
|
76
|
-
return (
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
/* @__PURE__ */ l(A, { className: r, style: n, title: i, initialContent: t, children: [
|
|
79
|
-
/* @__PURE__ */ e(te, {}),
|
|
80
|
-
/* @__PURE__ */ e("div", { className: "h-full p-4", children: /* @__PURE__ */ e("div", { className: a || void 0, dangerouslySetInnerHTML: { __html: s } }) })
|
|
81
|
-
] })
|
|
82
|
-
);
|
|
83
|
-
}, f = ["xs", "sm", "md", "lg", "xl", "2xl"], oe = (s) => {
|
|
84
|
-
if (s = s.trim().replace(/ +(?= )/g, ""), X(s)) return "";
|
|
85
|
-
const a = D(s.split(" "), I), r = [];
|
|
86
|
-
for (const n of a) {
|
|
87
|
-
const i = n.mq;
|
|
88
|
-
if (!r.includes(n.fullCls))
|
|
89
|
-
for (let t = f.indexOf(i) + 1; t < f.length; t++) {
|
|
90
|
-
const c = N(a, { property: n.property, mq: f[t] });
|
|
91
|
-
if (c && c.cls !== n.cls)
|
|
92
|
-
break;
|
|
93
|
-
N(a, { cls: n.cls, mq: f[t] }) && r.push(`${f[t]}:${n.cls}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return x(
|
|
97
|
-
D(a, (n) => r.includes(n.fullCls) ? null : n.fullCls),
|
|
98
|
-
(n) => n !== null
|
|
99
|
-
).join(" ");
|
|
100
|
-
}, ie = ({ activeToken: s }) => {
|
|
101
|
-
const { t: a } = F(), r = s != null && s.value ? oe(s.value) : "", n = s && s.name && s.value;
|
|
102
|
-
return /* @__PURE__ */ e(P, { className: "h-full", children: /* @__PURE__ */ e("div", { className: "space-y-4 pr-4", children: /* @__PURE__ */ l("div", { className: "space-y-2 rounded-lg border bg-card p-4", children: [
|
|
103
|
-
n && /* @__PURE__ */ e(y, { children: /* @__PURE__ */ l("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
104
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-semibold", children: s.name }),
|
|
105
|
-
s.id && /* @__PURE__ */ e("span", { className: "rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground", children: s.id })
|
|
106
|
-
] }) }),
|
|
107
|
-
/* @__PURE__ */ l("div", { children: [
|
|
108
|
-
/* @__PURE__ */ e("div", { className: "mb-2 text-[10px] font-medium text-muted-foreground", children: a("Preview:") }),
|
|
109
|
-
/* @__PURE__ */ e(
|
|
110
|
-
le,
|
|
111
|
-
{
|
|
112
|
-
content: a("Sample text with token styles applied"),
|
|
113
|
-
classes: r,
|
|
114
|
-
style: { minHeight: 80 },
|
|
115
|
-
title: a("Token Preview")
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
] })
|
|
119
|
-
] }) }) });
|
|
120
|
-
}, Ce = ({ open: s, onOpenChange: a }) => {
|
|
121
|
-
const { t: r } = F(), [n, i] = g(null), [t, c] = g(!1), [p, m] = g(!1), o = w(
|
|
122
|
-
(h) => {
|
|
123
|
-
if (!h && t) {
|
|
124
|
-
m(!0);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
a(h);
|
|
128
|
-
},
|
|
129
|
-
[t, a]
|
|
130
|
-
), d = w(() => {
|
|
131
|
-
m(!1), c(!1), a(!1);
|
|
132
|
-
}, [a]);
|
|
133
|
-
return /* @__PURE__ */ l(y, { children: [
|
|
134
|
-
/* @__PURE__ */ e(S, { open: s, onOpenChange: o, children: /* @__PURE__ */ l(L, { className: "flex h-[540px] max-w-6xl flex-col gap-0 p-0", children: [
|
|
135
|
-
/* @__PURE__ */ e(E, { className: "border-b border-border px-6 py-4", children: /* @__PURE__ */ l(O, { className: "flex items-center gap-2", children: [
|
|
136
|
-
/* @__PURE__ */ e(Q, { className: "h-5 w-5 text-primary" }),
|
|
137
|
-
r("Design Token Management")
|
|
138
|
-
] }) }),
|
|
139
|
-
/* @__PURE__ */ l("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
140
|
-
/* @__PURE__ */ e("div", { className: "flex w-1/2 flex-col border-r border-border p-4", children: /* @__PURE__ */ e(re, { onActiveTokenChange: i, onDirtyStateChange: c }) }),
|
|
141
|
-
/* @__PURE__ */ l("div", { className: "flex w-1/2 flex-col p-4", children: [
|
|
142
|
-
/* @__PURE__ */ e("div", { className: "mb-3 flex items-center justify-between", children: /* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: r("Live Preview") }) }),
|
|
143
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ e(ie, { activeToken: n }) })
|
|
144
|
-
] })
|
|
145
|
-
] })
|
|
146
|
-
] }) }),
|
|
147
|
-
/* @__PURE__ */ e(U, { open: p, onOpenChange: m, children: /* @__PURE__ */ l(q, { children: [
|
|
148
|
-
/* @__PURE__ */ l(R, { children: [
|
|
149
|
-
/* @__PURE__ */ e($, { children: r("Unsaved Changes") }),
|
|
150
|
-
/* @__PURE__ */ e(V, { children: r("You have unsaved changes. Are you sure you want to close? Your changes will be lost.") })
|
|
151
|
-
] }),
|
|
152
|
-
/* @__PURE__ */ l(Y, { children: [
|
|
153
|
-
/* @__PURE__ */ e(z, { children: r("Continue Editing") }),
|
|
154
|
-
/* @__PURE__ */ e(B, { onClick: d, children: r("Discard Changes") })
|
|
155
|
-
] })
|
|
156
|
-
] }) })
|
|
157
|
-
] });
|
|
158
|
-
};
|
|
159
|
-
export {
|
|
160
|
-
Ce as default
|
|
161
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-DCJDQs1a.cjs"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),oe=require("./STRINGS-FNnfjF5H.cjs"),j=require("@radix-ui/react-icons"),le=require("jotai"),ce=require("nanoid"),i=require("react"),de=require("react-i18next"),p=require("sonner"),ue=require("tailwind-merge"),L=o=>{const m=o.trim();return m.length===0||m.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m)},me=(o,m,t,a=!1,x)=>{const h=o.trim();return h.length===0?"":h.length>25?t("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h)?Object.entries(m).find(([k,C])=>C.name===h&&(!a||k!==x))?t("Token name already exists"):"":t("Only alphanumeric characters and hyphens allowed")},xe=o=>o.replace(/\s+/g,"-"),he=i.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-eY2wQ0l3.cjs"))),_=({tokenId:o,token:m,isDisabled:t,isSelected:a,isArchived:x=!1,onSelect:h,onEdit:y,onUnarchive:N})=>e.jsxs("div",{onClick:()=>h(o),className:`group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${x?"border-muted bg-muted/30 opacity-60":a?"border-primary bg-primary/10":"hover:bg-muted/90"}`,children:[e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:`text-xs font-semibold ${x?"text-muted-foreground":""}`,children:m.name}),e.jsx("div",{className:`w-full max-w-52 truncate text-[10px] font-light ${x?"text-muted-foreground":""}`,children:m.value})]}),e.jsxs("div",{className:"absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:[!x&&e.jsxs(e.Fragment,{children:[e.jsx(i.Suspense,{fallback:null,children:e.jsx(he,{tokenId:o,tokenName:m.name,children:e.jsx(g.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),y(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.Pencil1Icon,{className:"h-3 w-3"})})]}),x&&e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),N==null||N(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})]})]}),fe=({onActiveTokenChange:o,onDirtyStateChange:m})=>{const{t}=de.useTranslation(),[a,x]=le.useAtom(c.chaiDesignTokensAtom),h=c.useIncrementActionsCount(),{saveDesignTokens:y,debouncedSaveDesignTokens:N}=c.useSaveWebsiteData(),k=c.useBuilderProp("pageId",""),C=c.useBuilderProp("siteWideUsage",{}),[f,B]=i.useState("view"),[v,R]=i.useState(null),[b,W]=i.useState(null),[l,A]=i.useState(""),[d,S]=i.useState(""),[D,I]=i.useState(""),[O,H]=i.useState(""),[K,q]=i.useState(!1),z=i.useRef(null),[E,M]=i.useState({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P=i.useRef(null),X=i.useCallback(s=>{if(!C)return{pageCount:0,partialCount:0};let n=0,r=0;return Object.entries(C).forEach(([u,T])=>{if(u===k||!(T!=null&&T.designTokens))return;Object.keys(T.designTokens).some(ie=>ie===s)&&(T.isPartial?r++:n++)}),{pageCount:n,partialCount:r}},[C,k]),F=i.useMemo(()=>Object.entries(a).filter(([,s])=>s.name.toLowerCase().includes(O.toLowerCase())||s.value.toLowerCase().includes(O.toLowerCase())),[a,O]);i.useEffect(()=>{if(!m)return;const s=f==="add"&&(l&&l.trim().length>0||d&&d.trim().length>0);m(s)},[f,l,d,m]),i.useEffect(()=>{if(o)if(f==="edit"||f==="add")o(l&&d?{name:l,value:d,id:v||void 0}:null);else if(f==="view"&&b&&a[b]){const s=a[b];o({name:s.name,value:s.value,id:b})}else o(null)},[f,l,d,v,b,a,o]);const J=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.entries(a).find(([n,r])=>r.name===l.trim()&&n!==v)){p.toast.error(t("Token already exists"));return}v&&Y(l,d)},w=i.useCallback(()=>{R(null),A(""),S(""),I(""),q(!1),B("view")},[]),Y=i.useCallback((s,n)=>{!v||f!=="edit"||!s.trim()||!n.trim()||!L(s)||Object.entries(a).find(([u,T])=>T.name===s.trim()&&u!==v)||(q(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{const u={...a,[v]:{name:s.trim(),value:n.trim()}};x(u),h(),N(),q(!1),p.toast.success(t("Token updated successfully")),w()},10))},[v,f,a,x,h,N,t,w]),U=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.values(a).find(u=>u.name===l.trim())){p.toast.error(t("Token already exists"));return}const n=`${oe.DESIGN_TOKEN_PREFIX}${ce.nanoid(12)}`,r={...a,[n]:{name:l.trim(),value:d.trim()}};x(r),h(),y(),p.toast.success(t("Token added successfully")),w()},$=s=>{const n=a[s];if(!n)return;const{pageCount:r,partialCount:u}=X(s);M({isOpen:!0,tokenId:s,tokenName:n.name,pageCount:r,partialCount:u}),P.current=s},ee=()=>{const s=P.current;if(!s)return;const n={...a,[s]:{...a[s],archived:!0}};x(n),h(),y(),p.toast.success(t("Token archived successfully")),M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null},G=s=>{const n={...a,[s]:{name:a[s].name,value:a[s].value}};x(n),h(),p.toast.success(t("Token unarchived successfully"))},Z=s=>{const n=a[s];n&&(R(s),A(n.name),S(n.value),I(""),B("edit"))},V=()=>{R(null),A(""),S(""),I(""),B("add")},se=s=>{const n=xe(s);A(n);const r=me(n,a,t,f==="edit",v||void 0);I(r)},Q=s=>{S(s)},te=s=>{const n=c.orderClassesByBreakpoint(c.removeDuplicateClasses(ue.twMerge(d,s)));Q(n)},ne=s=>{const n=d.split(" ").filter(r=>r!==s).join(" ");Q(n)},re=()=>{const s=f==="edit",n=t(s?"Edit Design Token":"Add Design Token"),r=t(s?"Update design token":"Create a reusable design token");return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5",children:[e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:w,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(j.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:n}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:r})]}),s&&K&&e.jsx("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"})})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(c.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:t("Token Name")}),e.jsx(g.Input,{id:"token-name",placeholder:"Button-Primary",value:l,onChange:u=>se(u.target.value),className:"h-7 text-xs"}),D?e.jsx("span",{className:"text-[10px] text-destructive",children:D}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:t("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(c.ManualClasses,{from:"designToken",classFromProps:d,onAddNew:te,onRemove:ne,showDesignTokenSuggestions:!1}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(g.Button,{variant:"outline",onClick:w,className:"h-7 text-xs",children:t("Cancel")}),s?e.jsx(g.Button,{onClick:J,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Save Token")}):e.jsx(g.Button,{onClick:U,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Add Token")})]})]})]})},ae=()=>{const s=F.filter(([,r])=>!r.archived),n=F.filter(([,r])=>r.archived);return e.jsxs(e.Fragment,{children:[Object.entries(a).length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(j.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(g.Input,{placeholder:t("Search tokens"),value:O,onChange:r=>H(r.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(g.Button,{variant:"outline",onClick:V,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(j.PlusIcon,{className:"h-3 w-3"}),t("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(c.ScrollArea,{className:"flex h-full flex-1 items-center justify-center",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(a).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2 text-3xl",children:e.jsx(j.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("Create reusable design tokens to streamline your styling")}),e.jsxs(g.Button,{variant:"default",onClick:V,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(j.PlusIcon,{className:"mr-1 h-3 w-3"}),t("Add first design token")]})]}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx(j.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("No design tokens match your search")})]}):e.jsxs(e.Fragment,{children:[s.length>0&&e.jsx("div",{className:"space-y-1",children:s.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!1,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))}),n.length>0&&e.jsxs("div",{className:"mt-4 space-y-1",children:[e.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold text-muted-foreground",children:t("Archived")}),n.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!0,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))]})]}),e.jsx("div",{className:"h-44"})]})})})]})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full w-full flex-col",children:f==="view"?ae():re()}),e.jsx(c.AlertDialog,{open:E.isOpen,onOpenChange:s=>{s||(M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null)},children:e.jsxs(c.AlertDialogContent,{children:[e.jsx(c.AlertDialogTitle,{children:t("Archive Design Token")}),e.jsxs(c.AlertDialogDescription,{className:"space-y-3",children:[e.jsxs("p",{children:[t("This token is used on")," ",e.jsx("span",{className:"font-semibold",children:E.pageCount})," ",t("pages"),E.partialCount>0&&e.jsxs(e.Fragment,{children:[" ",t("and")," ",e.jsx("span",{className:"font-semibold",children:E.partialCount})," ",t("partials")]}),"."]}),e.jsx("p",{className:"text-sm text-destructive",children:t("Archiving this token will remove the styling for those blocks.")}),e.jsx("p",{children:t("Do you wish to continue?")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c.AlertDialogCancel,{children:t("Cancel")}),e.jsx(c.AlertDialogAction,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:t("Archive")})]})]})})]})};exports.default=fe;
|