@behindthemusictree/app-kit-ui 26.1.0 → 28.0.2
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/{chunk-KPWV4LEJ.js → chunk-5PQWJRDZ.js} +1061 -541
- package/dist/chunk-5PQWJRDZ.js.map +1 -0
- package/dist/chunk-DKQQLLMY.js +246 -0
- package/dist/chunk-DKQQLLMY.js.map +1 -0
- package/dist/{chunk-ZLCRD7OK.js → chunk-XUC4UJDQ.js} +2 -2
- package/dist/genre-tree/index.cjs +1260 -635
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +35 -8
- package/dist/genre-tree/index.js +2 -2
- package/dist/genre-tree/styles.css +80 -0
- package/dist/index.cjs +1286 -661
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -4
- package/dist/popup/index.cjs +179 -73
- package/dist/popup/index.cjs.map +1 -1
- package/dist/popup/index.d.ts +22 -2
- package/dist/popup/index.js +5 -3
- package/package.json +7 -7
- package/dist/chunk-KPWV4LEJ.js.map +0 -1
- package/dist/chunk-VDXUW7PP.js +0 -141
- package/dist/chunk-VDXUW7PP.js.map +0 -1
- /package/dist/{chunk-ZLCRD7OK.js.map → chunk-XUC4UJDQ.js.map} +0 -0
package/dist/chunk-VDXUW7PP.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// src/popup/PopupTitle.tsx
|
|
2
|
-
import { X } from "lucide-react";
|
|
3
|
-
import { Button } from "@behindthemusictree/ui";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
function PopupTitle({ title, onClose, isDismissable, icon: Icon }) {
|
|
6
|
-
return /* @__PURE__ */ jsxs("div", { className: "popup-title flex items-center justify-between bg-black p-4 rounded-t-lg", children: [
|
|
7
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5 text-white" }),
|
|
9
|
-
/* @__PURE__ */ jsx("h3", { id: "popup-title", className: "text-white font-semibold", children: title })
|
|
10
|
-
] }),
|
|
11
|
-
isDismissable && /* @__PURE__ */ jsx(Button, { onClick: onClose, className: "h-8 w-8 text-white hover:text-white/80", "aria-label": "Close popup", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) })
|
|
12
|
-
] });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/popup/PopupButtons.tsx
|
|
16
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
17
|
-
function PopupButtons({ children, alignment = "center", className = "" }) {
|
|
18
|
-
const alignmentClasses = {
|
|
19
|
-
left: "justify-start",
|
|
20
|
-
center: "justify-center",
|
|
21
|
-
right: "justify-end"
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */ jsx2("div", { className: `flex gap-3 ${alignmentClasses[alignment]} ${className}`, children });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/popup/BasePopup.tsx
|
|
27
|
-
import { createPortal } from "react-dom";
|
|
28
|
-
import { Button as Button2 } from "@behindthemusictree/ui";
|
|
29
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
30
|
-
var typeClasses = {
|
|
31
|
-
default: "w-full max-w-lg",
|
|
32
|
-
success: "w-full max-w-lg",
|
|
33
|
-
error: "w-full max-w-lg",
|
|
34
|
-
warning: "w-full max-w-lg",
|
|
35
|
-
info: "w-full max-w-lg",
|
|
36
|
-
spotify: "w-full max-w-md",
|
|
37
|
-
auth: "w-full max-w-md"
|
|
38
|
-
};
|
|
39
|
-
var contentBgClasses = {
|
|
40
|
-
spotify: "bg-green-500",
|
|
41
|
-
auth: "bg-gray-800"
|
|
42
|
-
};
|
|
43
|
-
function BasePopup(props) {
|
|
44
|
-
const {
|
|
45
|
-
title,
|
|
46
|
-
children,
|
|
47
|
-
onClose,
|
|
48
|
-
type = "default",
|
|
49
|
-
icon,
|
|
50
|
-
isDismissable = true,
|
|
51
|
-
className,
|
|
52
|
-
fitContent = false,
|
|
53
|
-
showOkButton = false,
|
|
54
|
-
showCancelButton = false,
|
|
55
|
-
okButtonText = "OK",
|
|
56
|
-
cancelButtonText = "Cancel",
|
|
57
|
-
onOk,
|
|
58
|
-
okButtonDisabled = false,
|
|
59
|
-
onCancel,
|
|
60
|
-
buttonAlignment = "center",
|
|
61
|
-
topOffset = 0
|
|
62
|
-
} = props;
|
|
63
|
-
const baseClasses = "bg-white rounded-lg";
|
|
64
|
-
const renderButtons = () => {
|
|
65
|
-
if (!showOkButton && !showCancelButton) return null;
|
|
66
|
-
return /* @__PURE__ */ jsx3("div", { className: "mt-4 pt-4 border-t", children: /* @__PURE__ */ jsxs2(PopupButtons, { alignment: buttonAlignment, children: [
|
|
67
|
-
showCancelButton && /* @__PURE__ */ jsx3(Button2, { onClick: onCancel || onClose || (() => {
|
|
68
|
-
}), variant: "secondary", children: cancelButtonText }),
|
|
69
|
-
showOkButton && /* @__PURE__ */ jsx3(Button2, { onClick: onOk || onClose || (() => {
|
|
70
|
-
}), disabled: okButtonDisabled, children: okButtonText })
|
|
71
|
-
] }) });
|
|
72
|
-
};
|
|
73
|
-
const popupComponent = /* @__PURE__ */ jsx3(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
className: "fixed z-50 flex items-center justify-center bg-transparent",
|
|
77
|
-
style: {
|
|
78
|
-
top: topOffset,
|
|
79
|
-
left: 0,
|
|
80
|
-
right: 0,
|
|
81
|
-
bottom: 0
|
|
82
|
-
},
|
|
83
|
-
role: "dialog",
|
|
84
|
-
"aria-modal": "true",
|
|
85
|
-
"aria-labelledby": "popup-title",
|
|
86
|
-
children: /* @__PURE__ */ jsxs2(
|
|
87
|
-
"div",
|
|
88
|
-
{
|
|
89
|
-
className: `${baseClasses} ${fitContent ? typeClasses[type].replace("w-full", "w-fit") : typeClasses[type]} ${className || ""}`,
|
|
90
|
-
onClick: (e) => e.stopPropagation(),
|
|
91
|
-
children: [
|
|
92
|
-
/* @__PURE__ */ jsx3(PopupTitle, { title, onClose: onClose ?? (() => {
|
|
93
|
-
}), isDismissable, icon }),
|
|
94
|
-
/* @__PURE__ */ jsxs2("div", { className: `popup-content rounded-b-lg p-4 ${contentBgClasses[type] ?? ""}`, children: [
|
|
95
|
-
children,
|
|
96
|
-
renderButtons()
|
|
97
|
-
] })
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
return createPortal(popupComponent, document.body);
|
|
104
|
-
}
|
|
105
|
-
var BasePopup_default = BasePopup;
|
|
106
|
-
|
|
107
|
-
// src/popup/InternalErrorPopup.tsx
|
|
108
|
-
import { AlertTriangle, AlertCircle } from "lucide-react";
|
|
109
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
110
|
-
function InternalErrorPopup({ errorCode, contactEmail, ...rest }) {
|
|
111
|
-
return /* @__PURE__ */ jsx4(
|
|
112
|
-
BasePopup,
|
|
113
|
-
{
|
|
114
|
-
...rest,
|
|
115
|
-
title: "Internal Error",
|
|
116
|
-
isDismissable: false,
|
|
117
|
-
icon: AlertTriangle,
|
|
118
|
-
children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center space-y-6 py-4", children: [
|
|
119
|
-
/* @__PURE__ */ jsx4(AlertCircle, { className: "h-16 w-16 text-[var(--color-red-500)]", strokeWidth: 1.5 }),
|
|
120
|
-
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsxs3("p", { className: "text-center text-[var(--color-neutral-600)]", children: [
|
|
121
|
-
"Please try again. If the problem persists, contact us at",
|
|
122
|
-
" ",
|
|
123
|
-
/* @__PURE__ */ jsx4("a", { href: `mailto:${contactEmail}`, className: "text-[var(--color-primary)] hover:text-[var(--color-primary-hover)]", children: contactEmail })
|
|
124
|
-
] }) }),
|
|
125
|
-
errorCode && /* @__PURE__ */ jsxs3("div", { className: "text-sm text-[var(--color-neutral-500)] bg-[var(--color-neutral-100)] p-3 rounded-lg border border-[var(--color-neutral-100)]", children: [
|
|
126
|
-
"Error Code: ",
|
|
127
|
-
errorCode
|
|
128
|
-
] })
|
|
129
|
-
] })
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export {
|
|
135
|
-
PopupTitle,
|
|
136
|
-
PopupButtons,
|
|
137
|
-
BasePopup,
|
|
138
|
-
BasePopup_default,
|
|
139
|
-
InternalErrorPopup
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=chunk-VDXUW7PP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/popup/PopupTitle.tsx","../src/popup/PopupButtons.tsx","../src/popup/BasePopup.tsx","../src/popup/InternalErrorPopup.tsx"],"sourcesContent":["\"use client\";\n\nimport { X } from \"lucide-react\";\nimport { Button } from \"@behindthemusictree/ui\";\nimport { LucideIcon } from \"lucide-react\";\n\ninterface PopupTitleProps {\n title: string;\n onClose: () => void;\n isDismissable?: boolean;\n icon?: LucideIcon;\n}\n\nexport function PopupTitle({ title, onClose, isDismissable, icon: Icon }: PopupTitleProps) {\n return (\n <div className=\"popup-title flex items-center justify-between bg-black p-4 rounded-t-lg\">\n <div className=\"flex items-center gap-2\">\n {Icon && <Icon className=\"h-5 w-5 text-white\" />}\n <h3 id=\"popup-title\" className=\"text-white font-semibold\">\n {title}\n </h3>\n </div>\n {isDismissable && (\n <Button onClick={onClose} className=\"h-8 w-8 text-white hover:text-white/80\" aria-label=\"Close popup\">\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { ReactNode } from \"react\";\n\ninterface PopupButtonsProps {\n children: ReactNode;\n alignment?: \"left\" | \"center\" | \"right\";\n className?: string;\n}\n\nexport function PopupButtons({ children, alignment = \"center\", className = \"\" }: PopupButtonsProps) {\n const alignmentClasses = {\n left: \"justify-start\",\n center: \"justify-center\",\n right: \"justify-end\",\n };\n\n return <div className={`flex gap-3 ${alignmentClasses[alignment]} ${className}`}>{children}</div>;\n}\n","\"use client\";\n\nimport { createPortal } from \"react-dom\";\nimport { ReactNode } from \"react\";\nimport { PopupTitle } from \"./PopupTitle\";\nimport { PopupButtons } from \"./PopupButtons\";\nimport { Button } from \"@behindthemusictree/ui\";\nimport { LucideIcon } from \"lucide-react\";\n\nexport interface BasePopupProps {\n title: string;\n children: ReactNode;\n onClose?: () => void;\n type?: \"default\" | \"success\" | \"error\" | \"warning\" | \"info\" | \"spotify\" | \"auth\";\n icon?: LucideIcon;\n isDismissable?: boolean;\n className?: string;\n /** Sizes the popup to its content (up to the type's max width) instead of filling it. */\n fitContent?: boolean;\n contentClassName?: string;\n showOkButton?: boolean;\n showCancelButton?: boolean;\n okButtonText?: string;\n okButtonDisabled?: boolean;\n cancelButtonText?: string;\n onOk?: () => void;\n onCancel?: () => void;\n buttonAlignment?: \"left\" | \"center\" | \"right\";\n /**\n * Distance (in px) reserved at the top of the viewport, e.g. for a fixed app header/banner.\n * Each consuming app passes its own value. Defaults to 0.\n */\n topOffset?: number;\n}\n\nconst typeClasses: Record<string, string> = {\n default: \"w-full max-w-lg\",\n success: \"w-full max-w-lg\",\n error: \"w-full max-w-lg\",\n warning: \"w-full max-w-lg\",\n info: \"w-full max-w-lg\",\n spotify: \"w-full max-w-md\",\n auth: \"w-full max-w-md\",\n};\n\nconst contentBgClasses: Record<string, string> = {\n spotify: \"bg-green-500\",\n auth: \"bg-gray-800\",\n};\n\nexport function BasePopup(props: BasePopupProps) {\n const {\n title,\n children,\n onClose,\n type = \"default\",\n icon,\n isDismissable = true,\n className,\n fitContent = false,\n showOkButton = false,\n showCancelButton = false,\n okButtonText = \"OK\",\n cancelButtonText = \"Cancel\",\n onOk,\n okButtonDisabled = false,\n onCancel,\n buttonAlignment = \"center\",\n topOffset = 0,\n } = props;\n\n const baseClasses = \"bg-white rounded-lg\";\n\n const renderButtons = () => {\n if (!showOkButton && !showCancelButton) return null;\n\n return (\n <div className=\"mt-4 pt-4 border-t\">\n <PopupButtons alignment={buttonAlignment}>\n {showCancelButton && (\n <Button onClick={onCancel || onClose || (() => {})} variant=\"secondary\">\n {cancelButtonText}\n </Button>\n )}\n {showOkButton && (\n <Button onClick={onOk || onClose || (() => {})} disabled={okButtonDisabled}>\n {okButtonText}\n </Button>\n )}\n </PopupButtons>\n </div>\n );\n };\n\n const popupComponent = (\n <div\n className=\"fixed z-50 flex items-center justify-center bg-transparent\"\n style={{\n top: topOffset,\n left: 0,\n right: 0,\n bottom: 0,\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"popup-title\"\n >\n <div\n className={`${baseClasses} ${fitContent ? typeClasses[type].replace(\"w-full\", \"w-fit\") : typeClasses[type]} ${className || \"\"}`}\n onClick={(e) => e.stopPropagation()}\n >\n <PopupTitle title={title} onClose={onClose ?? (() => {})} isDismissable={isDismissable} icon={icon} />\n <div className={`popup-content rounded-b-lg p-4 ${contentBgClasses[type] ?? \"\"}`}>\n {children}\n {renderButtons()}\n </div>\n </div>\n </div>\n );\n\n return createPortal(popupComponent, document.body);\n}\n\nexport default BasePopup;\n","\"use client\";\n\nimport { AlertTriangle, AlertCircle } from \"lucide-react\";\nimport { BasePopup, BasePopupProps } from \"./BasePopup\";\nimport { ErrorCode } from \"@behindthemusictree/app-kit/transport\";\n\ntype InternalErrorPopupProps = Omit<BasePopupProps, \"title\" | \"children\" | \"icon\" | \"isDismissable\"> & {\n errorCode: ErrorCode;\n /**\n * Support contact email shown in the \"if the problem persists\" message. Passed by the\n * consuming app (from whatever env var / config it uses) so this package doesn't assume a\n * specific env var name.\n */\n contactEmail?: string | null;\n};\n\nexport default function InternalErrorPopup({ errorCode, contactEmail, ...rest }: InternalErrorPopupProps) {\n return (\n <BasePopup\n {...rest}\n title=\"Internal Error\"\n isDismissable={false}\n icon={AlertTriangle}\n children={\n <div className=\"flex flex-col items-center space-y-6 py-4\">\n <AlertCircle className=\"h-16 w-16 text-[var(--color-red-500)]\" strokeWidth={1.5} />\n <div>\n <p className=\"text-center text-[var(--color-neutral-600)]\">\n Please try again. If the problem persists, contact us at{\" \"}\n <a href={`mailto:${contactEmail}`} className=\"text-[var(--color-primary)] hover:text-[var(--color-primary-hover)]\">\n {contactEmail}\n </a>\n </p>\n </div>\n {errorCode && (\n <div className=\"text-sm text-[var(--color-neutral-500)] bg-[var(--color-neutral-100)] p-3 rounded-lg border border-[var(--color-neutral-100)]\">\n Error Code: {errorCode}\n </div>\n )}\n </div>\n }\n />\n );\n}\n"],"mappings":";AAEA,SAAS,SAAS;AAClB,SAAS,cAAc;AAajB,SACW,KADX;AAHC,SAAS,WAAW,EAAE,OAAO,SAAS,eAAe,MAAM,KAAK,GAAoB;AACzF,SACE,qBAAC,SAAI,WAAU,2EACb;AAAA,yBAAC,SAAI,WAAU,2BACZ;AAAA,cAAQ,oBAAC,QAAK,WAAU,sBAAqB;AAAA,MAC9C,oBAAC,QAAG,IAAG,eAAc,WAAU,4BAC5B,iBACH;AAAA,OACF;AAAA,IACC,iBACC,oBAAC,UAAO,SAAS,SAAS,WAAU,0CAAyC,cAAW,eACtF,8BAAC,KAAE,WAAU,WAAU,GACzB;AAAA,KAEJ;AAEJ;;;ACZS,gBAAAA,YAAA;AAPF,SAAS,aAAa,EAAE,UAAU,YAAY,UAAU,YAAY,GAAG,GAAsB;AAClG,QAAM,mBAAmB;AAAA,IACvB,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAEA,SAAO,gBAAAA,KAAC,SAAI,WAAW,cAAc,iBAAiB,SAAS,CAAC,IAAI,SAAS,IAAK,UAAS;AAC7F;;;AChBA,SAAS,oBAAoB;AAI7B,SAAS,UAAAC,eAAc;AAwEf,SAEI,OAAAC,MAFJ,QAAAC,aAAA;AA3CR,IAAM,cAAsC;AAAA,EAC1C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EAC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