asterui 0.12.43 → 0.12.45

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.
@@ -0,0 +1,56 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { notification as a } from "./Notification.js";
3
+ class r {
4
+ success(e, n) {
5
+ return a.open({
6
+ message: e,
7
+ type: "success",
8
+ variant: "compact",
9
+ ...n
10
+ });
11
+ }
12
+ error(e, n) {
13
+ return a.open({
14
+ message: e,
15
+ type: "error",
16
+ variant: "compact",
17
+ ...n
18
+ });
19
+ }
20
+ info(e, n) {
21
+ return a.open({
22
+ message: e,
23
+ type: "info",
24
+ variant: "compact",
25
+ ...n
26
+ });
27
+ }
28
+ warning(e, n) {
29
+ return a.open({
30
+ message: e,
31
+ type: "warning",
32
+ variant: "compact",
33
+ ...n
34
+ });
35
+ }
36
+ loading(e, n) {
37
+ const o = /* @__PURE__ */ s("span", { className: "loading loading-spinner loading-sm" });
38
+ return a.open({
39
+ message: e,
40
+ type: "info",
41
+ variant: "compact",
42
+ duration: 0,
43
+ icon: o,
44
+ ...n
45
+ });
46
+ }
47
+ destroy(e) {
48
+ e ? a.close(e) : a.destroy();
49
+ }
50
+ }
51
+ const p = new r();
52
+ export {
53
+ r as MessageManager,
54
+ p as message
55
+ };
56
+ //# sourceMappingURL=Message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Message.js","sources":["../../src/components/Message.tsx"],"sourcesContent":["import React from 'react'\nimport { notification } from './Notification'\n\nexport interface MessageConfig {\n duration?: number\n key?: string\n icon?: React.ReactNode\n className?: string\n style?: React.CSSProperties\n 'data-testid'?: string\n onClick?: () => void\n onClose?: () => void\n}\n\nexport class MessageManager {\n success(content: React.ReactNode, config?: MessageConfig) {\n return notification.open({\n message: content,\n type: 'success',\n variant: 'compact',\n ...config,\n })\n }\n\n error(content: React.ReactNode, config?: MessageConfig) {\n return notification.open({\n message: content,\n type: 'error',\n variant: 'compact',\n ...config,\n })\n }\n\n info(content: React.ReactNode, config?: MessageConfig) {\n return notification.open({\n message: content,\n type: 'info',\n variant: 'compact',\n ...config,\n })\n }\n\n warning(content: React.ReactNode, config?: MessageConfig) {\n return notification.open({\n message: content,\n type: 'warning',\n variant: 'compact',\n ...config,\n })\n }\n\n loading(content: React.ReactNode, config?: MessageConfig) {\n const loadingIcon = (\n <span className=\"loading loading-spinner loading-sm\" />\n )\n return notification.open({\n message: content,\n type: 'info',\n variant: 'compact',\n duration: 0,\n icon: loadingIcon,\n ...config,\n })\n }\n\n destroy(id?: string) {\n if (id) {\n notification.close(id)\n } else {\n notification.destroy()\n }\n }\n}\n\nexport const message = new MessageManager()\n"],"names":["MessageManager","content","config","notification","loadingIcon","jsx","id","message"],"mappings":";;AAcO,MAAMA,EAAe;AAAA,EAC1B,QAAQC,GAA0BC,GAAwB;AACxD,WAAOC,EAAa,KAAK;AAAA,MACvB,SAASF;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,GAAGC;AAAA,IAAA,CACJ;AAAA,EACH;AAAA,EAEA,MAAMD,GAA0BC,GAAwB;AACtD,WAAOC,EAAa,KAAK;AAAA,MACvB,SAASF;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,GAAGC;AAAA,IAAA,CACJ;AAAA,EACH;AAAA,EAEA,KAAKD,GAA0BC,GAAwB;AACrD,WAAOC,EAAa,KAAK;AAAA,MACvB,SAASF;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,GAAGC;AAAA,IAAA,CACJ;AAAA,EACH;AAAA,EAEA,QAAQD,GAA0BC,GAAwB;AACxD,WAAOC,EAAa,KAAK;AAAA,MACvB,SAASF;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,GAAGC;AAAA,IAAA,CACJ;AAAA,EACH;AAAA,EAEA,QAAQD,GAA0BC,GAAwB;AACxD,UAAME,IACJ,gBAAAC,EAAC,QAAA,EAAK,WAAU,qCAAA,CAAqC;AAEvD,WAAOF,EAAa,KAAK;AAAA,MACvB,SAASF;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAMG;AAAA,MACN,GAAGF;AAAA,IAAA,CACJ;AAAA,EACH;AAAA,EAEA,QAAQI,GAAa;AACnB,IAAIA,IACFH,EAAa,MAAMG,CAAE,IAErBH,EAAa,QAAA;AAAA,EAEjB;AACF;AAEO,MAAMI,IAAU,IAAIP,EAAA;"}
@@ -1,13 +1,20 @@
1
1
  import { default as React } from 'react';
2
2
  export type NotificationType = 'success' | 'info' | 'warning' | 'error';
3
- export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
3
+ export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topCenter' | 'bottomCenter';
4
+ export type NotificationVariant = 'default' | 'compact';
4
5
  export interface NotificationConfig {
5
6
  message: React.ReactNode;
6
7
  description?: React.ReactNode;
7
8
  type?: NotificationType;
8
9
  duration?: number;
9
10
  placement?: NotificationPlacement;
11
+ variant?: NotificationVariant;
10
12
  closable?: boolean;
13
+ icon?: React.ReactNode;
14
+ key?: string;
15
+ className?: string;
16
+ style?: React.CSSProperties;
17
+ 'data-testid'?: string;
11
18
  onClick?: () => void;
12
19
  onClose?: () => void;
13
20
  }
@@ -1,115 +1,139 @@
1
- import { jsx as i, Fragment as h, jsxs as l } from "react/jsx-runtime";
2
- import { useState as u, useEffect as p } from "react";
3
- import d from "react-dom/client";
1
+ import { jsx as s, Fragment as d, jsxs as c } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as p } from "react";
3
+ import u from "react-dom/client";
4
4
  class m {
5
5
  notifications = [];
6
6
  listeners = [];
7
7
  container = null;
8
8
  root = null;
9
9
  idCounter = 0;
10
- subscribe(t) {
11
- return this.listeners.push(t), () => {
12
- this.listeners = this.listeners.filter((o) => o !== t);
10
+ subscribe(e) {
11
+ return this.listeners.push(e), () => {
12
+ this.listeners = this.listeners.filter((o) => o !== e);
13
13
  };
14
14
  }
15
15
  getNotifications() {
16
16
  return this.notifications;
17
17
  }
18
18
  emit() {
19
- this.listeners.forEach((t) => t());
19
+ this.listeners.forEach((e) => e());
20
20
  }
21
21
  ensureContainer() {
22
- this.container || (this.container = document.createElement("div"), document.body.appendChild(this.container), this.root = d.createRoot(this.container), this.root.render(/* @__PURE__ */ i(f, { manager: this })));
22
+ this.container || (this.container = document.createElement("div"), document.body.appendChild(this.container), this.root = u.createRoot(this.container), this.root.render(/* @__PURE__ */ s(v, { manager: this })));
23
23
  }
24
- open(t) {
24
+ open(e) {
25
25
  this.ensureContainer();
26
- const o = `notification-${++this.idCounter}`, s = {
27
- ...t,
26
+ const o = e.key ?? `notification-${++this.idCounter}`, r = e.variant === "compact", a = {
27
+ ...e,
28
28
  id: o,
29
29
  createdAt: Date.now(),
30
- duration: t.duration ?? 4.5,
31
- placement: t.placement ?? "topRight",
32
- closable: t.closable ?? !0,
33
- type: t.type ?? "info"
34
- };
35
- return this.notifications.push(s), this.emit(), s.duration && s.duration > 0 && setTimeout(() => {
30
+ duration: e.duration ?? (r ? 3 : 4.5),
31
+ placement: e.placement ?? (r ? "topCenter" : "topRight"),
32
+ variant: e.variant ?? "default",
33
+ closable: e.closable ?? !r,
34
+ type: e.type ?? "info"
35
+ }, n = this.notifications.findIndex((i) => i.id === o);
36
+ return n !== -1 ? this.notifications[n] = a : this.notifications.push(a), this.emit(), a.duration && a.duration > 0 && setTimeout(() => {
36
37
  this.close(o);
37
- }, s.duration * 1e3), o;
38
+ }, a.duration * 1e3), o;
38
39
  }
39
- close(t) {
40
- const o = this.notifications.find((s) => s.id === t);
41
- this.notifications = this.notifications.filter((s) => s.id !== t), this.emit(), o?.onClose && o.onClose();
40
+ close(e) {
41
+ const o = this.notifications.find((r) => r.id === e);
42
+ this.notifications = this.notifications.filter((r) => r.id !== e), this.emit(), o?.onClose && o.onClose();
42
43
  }
43
- success(t) {
44
- return this.open({ ...t, type: "success" });
44
+ success(e) {
45
+ return this.open({ ...e, type: "success" });
45
46
  }
46
- error(t) {
47
- return this.open({ ...t, type: "error" });
47
+ error(e) {
48
+ return this.open({ ...e, type: "error" });
48
49
  }
49
- info(t) {
50
- return this.open({ ...t, type: "info" });
50
+ info(e) {
51
+ return this.open({ ...e, type: "info" });
51
52
  }
52
- warning(t) {
53
- return this.open({ ...t, type: "warning" });
53
+ warning(e) {
54
+ return this.open({ ...e, type: "warning" });
54
55
  }
55
56
  destroy() {
56
57
  this.notifications = [], this.emit();
57
58
  }
58
59
  }
59
- function f({ manager: e }) {
60
- const [, t] = u({});
61
- p(() => e.subscribe(() => {
62
- t({});
63
- }), [e]);
64
- const o = e.getNotifications(), s = {
60
+ function v({ manager: t }) {
61
+ const [, e] = h({});
62
+ p(() => t.subscribe(() => {
63
+ e({});
64
+ }), [t]);
65
+ const o = t.getNotifications(), r = {
65
66
  topLeft: [],
66
67
  topRight: [],
68
+ topCenter: [],
67
69
  bottomLeft: [],
68
- bottomRight: []
70
+ bottomRight: [],
71
+ bottomCenter: []
69
72
  };
70
73
  o.forEach((n) => {
71
- s[n.placement].push(n);
74
+ r[n.placement].push(n);
72
75
  });
73
- const r = {
76
+ const a = {
74
77
  topRight: "toast toast-top toast-end",
75
78
  topLeft: "toast toast-top toast-start",
79
+ topCenter: "toast toast-top toast-center",
76
80
  bottomRight: "toast toast-bottom toast-end",
77
- bottomLeft: "toast toast-bottom toast-start"
81
+ bottomLeft: "toast toast-bottom toast-start",
82
+ bottomCenter: "toast toast-bottom toast-center"
78
83
  };
79
- return /* @__PURE__ */ i(h, { children: Object.entries(s).map(([n, c]) => c.length === 0 ? null : /* @__PURE__ */ i("div", { className: r[n], children: c.map((a) => /* @__PURE__ */ i(
80
- b,
84
+ return /* @__PURE__ */ s(d, { children: Object.entries(r).map(([n, i]) => i.length === 0 ? null : /* @__PURE__ */ s("div", { className: a[n], children: i.map((l) => /* @__PURE__ */ s(
85
+ w,
81
86
  {
82
- notification: a,
83
- onClose: () => e.close(a.id)
87
+ notification: l,
88
+ onClose: () => t.close(l.id)
84
89
  },
85
- a.id
90
+ l.id
86
91
  )) }, n)) });
87
92
  }
88
- function b({ notification: e, onClose: t }) {
89
- const o = {
93
+ function w({ notification: t, onClose: e }) {
94
+ const o = t.variant === "compact", r = {
90
95
  success: "alert-success",
91
96
  error: "alert-error",
92
97
  info: "alert-info",
93
98
  warning: "alert-warning"
94
- }, s = () => {
95
- e.onClick && e.onClick();
96
- };
97
- return /* @__PURE__ */ l(
99
+ }, a = {
100
+ success: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
101
+ error: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }),
102
+ info: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
103
+ warning: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) })
104
+ }, n = () => {
105
+ t.onClick && t.onClick();
106
+ }, i = t.icon ?? a[t.type];
107
+ return o ? /* @__PURE__ */ s(
108
+ "div",
109
+ {
110
+ className: `alert ${r[t.type]} shadow-md py-2 px-4 cursor-pointer${t.className ? ` ${t.className}` : ""}`,
111
+ style: t.style,
112
+ "data-testid": t["data-testid"],
113
+ onClick: n,
114
+ children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
115
+ i,
116
+ /* @__PURE__ */ s("span", { children: t.message })
117
+ ] })
118
+ }
119
+ ) : /* @__PURE__ */ c(
98
120
  "div",
99
121
  {
100
- className: `alert ${o[e.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative`,
101
- onClick: s,
122
+ className: `alert ${r[t.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative${t.className ? ` ${t.className}` : ""}`,
123
+ style: t.style,
124
+ "data-testid": t["data-testid"],
125
+ onClick: n,
102
126
  children: [
103
- /* @__PURE__ */ l("div", { className: e.closable ? "pr-8" : "", children: [
104
- e.message && /* @__PURE__ */ i("div", { className: "font-bold", children: e.message }),
105
- e.description && /* @__PURE__ */ i("div", { className: "text-sm", children: e.description })
127
+ /* @__PURE__ */ c("div", { className: t.closable ? "pr-8" : "", children: [
128
+ t.message && /* @__PURE__ */ s("div", { className: "font-bold", children: t.message }),
129
+ t.description && /* @__PURE__ */ s("div", { className: "text-sm", children: t.description })
106
130
  ] }),
107
- e.closable && /* @__PURE__ */ i(
131
+ t.closable && /* @__PURE__ */ s(
108
132
  "button",
109
133
  {
110
134
  className: "btn btn-xs btn-ghost btn-circle absolute top-2 right-2",
111
- onClick: (r) => {
112
- r.stopPropagation(), t();
135
+ onClick: (l) => {
136
+ l.stopPropagation(), e();
113
137
  },
114
138
  children: "✕"
115
139
  }
@@ -118,8 +142,8 @@ function b({ notification: e, onClose: t }) {
118
142
  }
119
143
  );
120
144
  }
121
- const y = new m();
145
+ const C = new m();
122
146
  export {
123
- y as notification
147
+ C as notification
124
148
  };
125
149
  //# sourceMappingURL=Notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","sources":["../../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n closable?: boolean\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = `notification-${++this.idCounter}`\n const notification: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? 4.5,\n placement: config.placement ?? 'topRight',\n closable: config.closable ?? true,\n type: config.type ?? 'info',\n }\n\n this.notifications.push(notification)\n this.emit()\n\n // Auto-dismiss\n if (notification.duration && notification.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notification.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n bottomLeft: [],\n bottomRight: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: 'toast toast-top toast-end',\n topLeft: 'toast toast-top toast-start',\n bottomRight: 'toast toast-bottom toast-end',\n bottomLeft: 'toast toast-bottom toast-start',\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const alertTypeClasses: Record<NotificationType, string> = {\n success: 'alert-success',\n error: 'alert-error',\n info: 'alert-info',\n warning: 'alert-warning',\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative`}\n onClick={handleClick}\n >\n <div className={notification.closable ? 'pr-8' : ''}>\n {notification.message && <div className=\"font-bold\">{notification.message}</div>}\n {notification.description && <div className=\"text-sm\">{notification.description}</div>}\n </div>\n {notification.closable && (\n <button\n className=\"btn btn-xs btn-ghost btn-circle absolute top-2 right-2\"\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n >\n ✕\n </button>\n )}\n </div>\n )\n}\n\nexport const notification = new NotificationManager()\n"],"names":["NotificationManager","listener","l","ReactDOM","jsx","NotificationContainer","config","id","notification","n","manager","forceUpdate","useState","useEffect","notifications","grouped","placementClasses","Fragment","placement","items","NotificationItem","onClose","alertTypeClasses","handleClick","jsxs","e"],"mappings":";;;AAwBA,MAAMA,EAAoB;AAAA,EAChB,gBAAoC,CAAA;AAAA,EACpC,YAAwB,CAAA;AAAA,EACxB,YAAmC;AAAA,EACnC,OAA6B;AAAA,EAC7B,YAAY;AAAA,EAEpB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAAMA,MAAMD,CAAQ;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,mBAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAO;AACb,SAAK,UAAU,QAAQ,CAACA,MAAaA,GA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,GAAc,SAAAa,KAAkC;AAC1E,QAAMC,IAAqD;AAAA,IACzD,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,EAAA,GAGLC,IAAc,MAAM;AACxB,IAAIf,EAAa,WACfA,EAAa,QAAA;AAAA,EAEjB;AAEA,SACE,gBAAAgB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,SAASF,EAAiBd,EAAa,IAAK,CAAC;AAAA,MACxD,SAASe;AAAA,MAET,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWhB,EAAa,WAAW,SAAS,IAC9C,UAAA;AAAA,UAAAA,EAAa,WAAW,gBAAAJ,EAAC,OAAA,EAAI,WAAU,aAAa,UAAAI,EAAa,SAAQ;AAAA,UACzEA,EAAa,eAAe,gBAAAJ,EAAC,OAAA,EAAI,WAAU,WAAW,UAAAI,EAAa,YAAA,CAAY;AAAA,QAAA,GAClF;AAAA,QACCA,EAAa,YACZ,gBAAAJ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,CAACqB,MAAM;AACd,cAAAA,EAAE,gBAAA,GACFJ,EAAA;AAAA,YACF;AAAA,YACD,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMb,IAAe,IAAIR,EAAA;"}
1
+ {"version":3,"file":"Notification.js","sources":["../../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topCenter' | 'bottomCenter'\nexport type NotificationVariant = 'default' | 'compact'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n variant?: NotificationVariant\n closable?: boolean\n icon?: React.ReactNode\n key?: string\n className?: string\n style?: React.CSSProperties\n 'data-testid'?: string\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = config.key ?? `notification-${++this.idCounter}`\n const isCompact = config.variant === 'compact'\n const notificationItem: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? (isCompact ? 3 : 4.5),\n placement: config.placement ?? (isCompact ? 'topCenter' : 'topRight'),\n variant: config.variant ?? 'default',\n closable: config.closable ?? !isCompact,\n type: config.type ?? 'info',\n }\n\n // If key exists, update the existing notification\n const existingIndex = this.notifications.findIndex((n) => n.id === id)\n if (existingIndex !== -1) {\n this.notifications[existingIndex] = notificationItem\n } else {\n this.notifications.push(notificationItem)\n }\n this.emit()\n\n // Auto-dismiss\n if (notificationItem.duration && notificationItem.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notificationItem.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n topCenter: [],\n bottomLeft: [],\n bottomRight: [],\n bottomCenter: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: 'toast toast-top toast-end',\n topLeft: 'toast toast-top toast-start',\n topCenter: 'toast toast-top toast-center',\n bottomRight: 'toast toast-bottom toast-end',\n bottomLeft: 'toast toast-bottom toast-start',\n bottomCenter: 'toast toast-bottom toast-center',\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const isCompact = notification.variant === 'compact'\n\n const alertTypeClasses: Record<NotificationType, string> = {\n success: 'alert-success',\n error: 'alert-error',\n info: 'alert-info',\n warning: 'alert-warning',\n }\n\n const typeIcons: Record<NotificationType, React.ReactNode> = {\n success: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clipRule=\"evenodd\" /></svg>,\n error: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clipRule=\"evenodd\" /></svg>,\n info: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clipRule=\"evenodd\" /></svg>,\n warning: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clipRule=\"evenodd\" /></svg>,\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n const icon = notification.icon ?? typeIcons[notification.type!]\n\n if (isCompact) {\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-md py-2 px-4 cursor-pointer${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className=\"flex items-center gap-2\">\n {icon}\n <span>{notification.message}</span>\n </div>\n </div>\n )\n }\n\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className={notification.closable ? 'pr-8' : ''}>\n {notification.message && <div className=\"font-bold\">{notification.message}</div>}\n {notification.description && <div className=\"text-sm\">{notification.description}</div>}\n </div>\n {notification.closable && (\n <button\n className=\"btn btn-xs btn-ghost btn-circle absolute top-2 right-2\"\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n >\n ✕\n </button>\n )}\n </div>\n )\n}\n\nexport const notification = new NotificationManager()\n"],"names":["NotificationManager","listener","l","ReactDOM","jsx","NotificationContainer","config","id","isCompact","notificationItem","existingIndex","n","notification","manager","forceUpdate","useState","useEffect","notifications","grouped","placementClasses","Fragment","placement","items","NotificationItem","onClose","alertTypeClasses","typeIcons","handleClick","icon","jsxs","e"],"mappings":";;;AA+BA,MAAMA,EAAoB;AAAA,EAChB,gBAAoC,CAAA;AAAA,EACpC,YAAwB,CAAA;AAAA,EACxB,YAAmC;AAAA,EACnC,OAA6B;AAAA,EAC7B,YAAY;AAAA,EAEpB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAAMA,MAAMD,CAAQ;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,mBAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAO;AACb,SAAK,UAAU,QAAQ,CAACA,MAAaA,GAAU;AAAA,EACjD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,IAAe,IAAIZ,EAAA;"}
@@ -30,8 +30,6 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
30
30
  export interface TabPanelProps {
31
31
  /** Tab button label */
32
32
  tab: React.ReactNode;
33
- /** Unique identifier for the tab */
34
- tabKey: string;
35
33
  /** Disable the tab */
36
34
  disabled?: boolean;
37
35
  /** Tab panel content */
@@ -1,5 +1,5 @@
1
- import { jsx as s, jsxs as c, Fragment as o } from "react/jsx-runtime";
2
- import x, { useState as k } from "react";
1
+ import { jsx as e, jsxs as o, Fragment as c } from "react/jsx-runtime";
2
+ import k, { useState as T } from "react";
3
3
  const B = {
4
4
  box: "tabs-box",
5
5
  border: "tabs-border",
@@ -11,73 +11,76 @@ const B = {
11
11
  lg: "tabs-lg",
12
12
  xl: "tabs-xl"
13
13
  };
14
- function E({
15
- children: a,
16
- items: e,
14
+ function S({
15
+ children: s,
16
+ items: a,
17
17
  activeKey: n,
18
18
  defaultActiveKey: u,
19
- onChange: K,
20
- variant: b,
21
- size: r,
19
+ onChange: x,
20
+ variant: r,
21
+ size: b,
22
22
  position: d = "top",
23
- className: p = "",
24
- ...C
23
+ className: _ = "",
24
+ ...g
25
25
  }) {
26
- const g = x.Children.toArray(a).filter(
27
- (t) => x.isValidElement(t) && t.type === y
28
- ), i = e && e.length > 0 ? e.map((t) => ({
29
- tabKey: t.key,
26
+ const p = k.Children.toArray(s).filter(
27
+ (t) => k.isValidElement(t) && t.type === h
28
+ ).map((t) => ({
29
+ ...t.props,
30
+ _key: t.key != null ? String(t.key) : ""
31
+ })), l = a && a.length > 0 ? a.map((t) => ({
32
+ _key: t.key,
30
33
  tab: t.label,
31
34
  children: t.children,
32
35
  disabled: t.disabled,
33
36
  icon: t.icon
34
- })) : g.map((t) => t.props), [j, A] = k(
35
- u || i[0]?.tabKey || ""
36
- ), m = n !== void 0 ? n : j, N = (t) => {
37
- n === void 0 && A(t), K?.(t);
38
- }, P = [
37
+ })) : p, [C, j] = T(
38
+ u || l[0]?._key || ""
39
+ ), m = n !== void 0 ? n : C, A = (t) => {
40
+ n === void 0 && j(t), x?.(t);
41
+ }, N = [
39
42
  "tabs",
40
- b && B[b],
41
- r && R[r],
42
- p
43
- ].filter(Boolean).join(" "), f = i.find((t) => t.tabKey === m), h = /* @__PURE__ */ s("div", { role: "tablist", className: P, children: i.map((t) => {
44
- const l = m === t.tabKey, T = [
43
+ r && B[r],
44
+ b && R[b],
45
+ _
46
+ ].filter(Boolean).join(" "), f = l.find((t) => t._key === m), v = /* @__PURE__ */ e("div", { role: "tablist", className: N, children: l.map((t) => {
47
+ const i = m === t._key, P = [
45
48
  "tab",
46
- l && "tab-active",
49
+ i && "tab-active",
47
50
  t.disabled && "tab-disabled"
48
51
  ].filter(Boolean).join(" ");
49
- return /* @__PURE__ */ c(
52
+ return /* @__PURE__ */ o(
50
53
  "button",
51
54
  {
52
55
  role: "tab",
53
- className: T,
54
- onClick: () => !t.disabled && N(t.tabKey),
56
+ className: P,
57
+ onClick: () => !t.disabled && A(t._key),
55
58
  disabled: t.disabled,
56
- "data-state": l ? "active" : "inactive",
57
- "aria-selected": l,
59
+ "data-state": i ? "active" : "inactive",
60
+ "aria-selected": i,
58
61
  children: [
59
- t.icon && /* @__PURE__ */ s("span", { className: "mr-1", children: t.icon }),
62
+ t.icon && /* @__PURE__ */ e("span", { className: "mr-1", children: t.icon }),
60
63
  t.tab
61
64
  ]
62
65
  },
63
- t.tabKey
66
+ t._key
64
67
  );
65
- }) }), v = f && /* @__PURE__ */ s("div", { className: d === "top" ? "mt-4" : "mb-4", role: "tabpanel", children: f.children });
66
- return /* @__PURE__ */ s("div", { ...C, children: d === "top" ? /* @__PURE__ */ c(o, { children: [
67
- h,
68
- v
69
- ] }) : /* @__PURE__ */ c(o, { children: [
68
+ }) }), y = f && /* @__PURE__ */ e("div", { className: d === "top" ? "mt-4" : "mb-4", role: "tabpanel", children: f.children });
69
+ return /* @__PURE__ */ e("div", { ...g, children: d === "top" ? /* @__PURE__ */ o(c, { children: [
70
70
  v,
71
- h
71
+ y
72
+ ] }) : /* @__PURE__ */ o(c, { children: [
73
+ y,
74
+ v
72
75
  ] }) });
73
76
  }
74
- function y({ children: a }) {
75
- return /* @__PURE__ */ s(o, { children: a });
77
+ function h({ children: s }) {
78
+ return /* @__PURE__ */ e(c, { children: s });
76
79
  }
77
- const L = Object.assign(E, {
78
- Panel: y
80
+ const I = Object.assign(S, {
81
+ Panel: h
79
82
  });
80
83
  export {
81
- L as Tabs
84
+ I as Tabs
82
85
  };
83
86
  //# sourceMappingURL=Tabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import React, { useState } from 'react'\n\nexport type TabsVariant = 'box' | 'border' | 'lift'\nexport type TabsSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nexport type TabsPosition = 'top' | 'bottom'\n\nexport interface TabItem {\n key: string\n label: React.ReactNode\n children?: React.ReactNode\n disabled?: boolean\n icon?: React.ReactNode\n}\n\nexport interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Tab panels (compound pattern) */\n children?: React.ReactNode\n /** Tab items (data-driven pattern) */\n items?: TabItem[]\n /** Current active tab key (controlled) */\n activeKey?: string\n /** Default active tab key (uncontrolled) */\n defaultActiveKey?: string\n /** Callback when tab changes */\n onChange?: (key: string) => void\n /** Visual style variant */\n variant?: TabsVariant\n /** Tab size */\n size?: TabsSize\n /** Tab position relative to content */\n position?: TabsPosition\n}\n\nexport interface TabPanelProps {\n /** Tab button label */\n tab: React.ReactNode\n /** Unique identifier for the tab */\n tabKey: string\n /** Disable the tab */\n disabled?: boolean\n /** Tab panel content */\n children?: React.ReactNode\n /** Tab icon */\n icon?: React.ReactNode\n}\n\nconst variantClasses: Record<TabsVariant, string> = {\n box: 'tabs-box',\n border: 'tabs-border',\n lift: 'tabs-lift',\n}\n\nconst sizeClasses: Record<TabsSize, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n}\n\nfunction TabsRoot({\n children,\n items,\n activeKey,\n defaultActiveKey,\n onChange,\n variant,\n size,\n position = 'top',\n className = '',\n ...rest\n}: TabsProps) {\n // Get panels from children (compound pattern)\n const panels = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<TabPanelProps> =>\n React.isValidElement(child) && child.type === TabPanel\n )\n\n // Convert items to panel-like structure if using data-driven pattern\n const effectivePanels = items && items.length > 0\n ? items.map(item => ({\n tabKey: item.key,\n tab: item.label,\n children: item.children,\n disabled: item.disabled,\n icon: item.icon,\n }))\n : panels.map(p => p.props)\n\n const [internalActiveKey, setInternalActiveKey] = useState(\n defaultActiveKey || effectivePanels[0]?.tabKey || ''\n )\n const currentActiveKey = activeKey !== undefined ? activeKey : internalActiveKey\n\n const handleTabClick = (key: string) => {\n if (activeKey === undefined) {\n setInternalActiveKey(key)\n }\n onChange?.(key)\n }\n\n const classes = [\n 'tabs',\n variant && variantClasses[variant],\n size && sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const activePanel = effectivePanels.find((panel) => panel.tabKey === currentActiveKey)\n\n const tabList = (\n <div role=\"tablist\" className={classes}>\n {effectivePanels.map((panel) => {\n const isActive = currentActiveKey === panel.tabKey\n const tabClasses = [\n 'tab',\n isActive && 'tab-active',\n panel.disabled && 'tab-disabled',\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <button\n key={panel.tabKey}\n role=\"tab\"\n className={tabClasses}\n onClick={() => !panel.disabled && handleTabClick(panel.tabKey)}\n disabled={panel.disabled}\n data-state={isActive ? 'active' : 'inactive'}\n aria-selected={isActive}\n >\n {panel.icon && <span className=\"mr-1\">{panel.icon}</span>}\n {panel.tab}\n </button>\n )\n })}\n </div>\n )\n\n const content = activePanel && (\n <div className={position === 'top' ? 'mt-4' : 'mb-4'} role=\"tabpanel\">\n {activePanel.children}\n </div>\n )\n\n return (\n <div {...rest}>\n {position === 'top' ? (\n <>\n {tabList}\n {content}\n </>\n ) : (\n <>\n {content}\n {tabList}\n </>\n )}\n </div>\n )\n}\n\nfunction TabPanel({ children }: TabPanelProps) {\n // This component is only used for type checking and is not rendered directly\n // The actual rendering is done in TabsRoot\n return <>{children}</>\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n Panel: TabPanel,\n})\n"],"names":["variantClasses","sizeClasses","TabsRoot","children","items","activeKey","defaultActiveKey","onChange","variant","size","position","className","rest","panels","React","child","TabPanel","effectivePanels","item","p","internalActiveKey","setInternalActiveKey","useState","currentActiveKey","handleTabClick","key","classes","activePanel","panel","tabList","jsx","isActive","tabClasses","jsxs","content","Fragment","Tabs"],"mappings":";;AA8CA,MAAMA,IAA8C;AAAA,EAClD,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AACR,GAEMC,IAAwC;AAAA,EAC5C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAASC,EAAS;AAAA,EAChB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAc;AAEZ,QAAMC,IAASC,EAAM,SAAS,QAAQX,CAAQ,EAAE;AAAA,IAC9C,CAACY,MACCD,EAAM,eAAeC,CAAK,KAAKA,EAAM,SAASC;AAAA,EAAA,GAI5CC,IAAkBb,KAASA,EAAM,SAAS,IAC5CA,EAAM,IAAI,CAAAc,OAAS;AAAA,IACjB,QAAQA,EAAK;AAAA,IACb,KAAKA,EAAK;AAAA,IACV,UAAUA,EAAK;AAAA,IACf,UAAUA,EAAK;AAAA,IACf,MAAMA,EAAK;AAAA,EAAA,EACX,IACFL,EAAO,IAAI,CAAAM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MAAK,YACxD,UAAAiB,EAAY,UACf;AAGF,2BACG,OAAA,EAAK,GAAGf,GACN,UAAAF,MAAa,QACZ,gBAAAuB,EAAAE,GAAA,EACG,UAAA;AAAA,IAAAN;AAAA,IACAK;AAAA,EAAA,EAAA,CACH,IAEA,gBAAAD,EAAAE,GAAA,EACG,UAAA;AAAA,IAAAD;AAAA,IACAL;AAAA,EAAA,EAAA,CACH,EAAA,CAEJ;AAEJ;AAEA,SAASb,EAAS,EAAE,UAAAb,KAA2B;AAG7C,gCAAU,UAAAA,GAAS;AACrB;AAEO,MAAMiC,IAAO,OAAO,OAAOlC,GAAU;AAAA,EAC1C,OAAOc;AACT,CAAC;"}
1
+ {"version":3,"file":"Tabs.js","sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import React, { useState } from 'react'\n\nexport type TabsVariant = 'box' | 'border' | 'lift'\nexport type TabsSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nexport type TabsPosition = 'top' | 'bottom'\n\nexport interface TabItem {\n key: string\n label: React.ReactNode\n children?: React.ReactNode\n disabled?: boolean\n icon?: React.ReactNode\n}\n\nexport interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Tab panels (compound pattern) */\n children?: React.ReactNode\n /** Tab items (data-driven pattern) */\n items?: TabItem[]\n /** Current active tab key (controlled) */\n activeKey?: string\n /** Default active tab key (uncontrolled) */\n defaultActiveKey?: string\n /** Callback when tab changes */\n onChange?: (key: string) => void\n /** Visual style variant */\n variant?: TabsVariant\n /** Tab size */\n size?: TabsSize\n /** Tab position relative to content */\n position?: TabsPosition\n}\n\nexport interface TabPanelProps {\n /** Tab button label */\n tab: React.ReactNode\n /** Disable the tab */\n disabled?: boolean\n /** Tab panel content */\n children?: React.ReactNode\n /** Tab icon */\n icon?: React.ReactNode\n}\n\nconst variantClasses: Record<TabsVariant, string> = {\n box: 'tabs-box',\n border: 'tabs-border',\n lift: 'tabs-lift',\n}\n\nconst sizeClasses: Record<TabsSize, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n}\n\ninterface InternalPanelProps extends TabPanelProps {\n _key: string\n}\n\nfunction TabsRoot({\n children,\n items,\n activeKey,\n defaultActiveKey,\n onChange,\n variant,\n size,\n position = 'top',\n className = '',\n ...rest\n}: TabsProps) {\n // Get panels from children (compound pattern), extracting key from React element\n const panels = React.Children.toArray(children)\n .filter((child): child is React.ReactElement<TabPanelProps> =>\n React.isValidElement(child) && child.type === TabPanel\n )\n .map((child) => ({\n ...child.props,\n _key: child.key != null ? String(child.key) : '',\n }))\n\n // Convert items to panel-like structure if using data-driven pattern\n const effectivePanels: InternalPanelProps[] = items && items.length > 0\n ? items.map(item => ({\n _key: item.key,\n tab: item.label,\n children: item.children,\n disabled: item.disabled,\n icon: item.icon,\n }))\n : panels\n\n const [internalActiveKey, setInternalActiveKey] = useState(\n defaultActiveKey || effectivePanels[0]?._key || ''\n )\n const currentActiveKey = activeKey !== undefined ? activeKey : internalActiveKey\n\n const handleTabClick = (key: string) => {\n if (activeKey === undefined) {\n setInternalActiveKey(key)\n }\n onChange?.(key)\n }\n\n const classes = [\n 'tabs',\n variant && variantClasses[variant],\n size && sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const activePanel = effectivePanels.find((panel) => panel._key === currentActiveKey)\n\n const tabList = (\n <div role=\"tablist\" className={classes}>\n {effectivePanels.map((panel) => {\n const isActive = currentActiveKey === panel._key\n const tabClasses = [\n 'tab',\n isActive && 'tab-active',\n panel.disabled && 'tab-disabled',\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <button\n key={panel._key}\n role=\"tab\"\n className={tabClasses}\n onClick={() => !panel.disabled && handleTabClick(panel._key)}\n disabled={panel.disabled}\n data-state={isActive ? 'active' : 'inactive'}\n aria-selected={isActive}\n >\n {panel.icon && <span className=\"mr-1\">{panel.icon}</span>}\n {panel.tab}\n </button>\n )\n })}\n </div>\n )\n\n const content = activePanel && (\n <div className={position === 'top' ? 'mt-4' : 'mb-4'} role=\"tabpanel\">\n {activePanel.children}\n </div>\n )\n\n return (\n <div {...rest}>\n {position === 'top' ? (\n <>\n {tabList}\n {content}\n </>\n ) : (\n <>\n {content}\n {tabList}\n </>\n )}\n </div>\n )\n}\n\nfunction TabPanel({ children }: TabPanelProps) {\n // This component is only used for type checking and is not rendered directly\n // The actual rendering is done in TabsRoot\n return <>{children}</>\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n Panel: TabPanel,\n})\n"],"names":["variantClasses","sizeClasses","TabsRoot","children","items","activeKey","defaultActiveKey","onChange","variant","size","position","className","rest","panels","React","child","TabPanel","effectivePanels","item","internalActiveKey","setInternalActiveKey","useState","currentActiveKey","handleTabClick","key","classes","activePanel","panel","tabList","jsx","isActive","tabClasses","jsxs","content","Fragment","Tabs"],"mappings":";;AA4CA,MAAMA,IAA8C;AAAA,EAClD,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AACR,GAEMC,IAAwC;AAAA,EAC5C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAMA,SAASC,EAAS;AAAA,EAChB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAc;AAEZ,QAAMC,IAASC,EAAM,SAAS,QAAQX,CAAQ,EAC3C;AAAA,IAAO,CAACY,MACPD,EAAM,eAAeC,CAAK,KAAKA,EAAM,SAASC;AAAA,EAAA,EAE/C,IAAI,CAACD,OAAW;AAAA,IACf,GAAGA,EAAM;AAAA,IACT,MAAMA,EAAM,OAAO,OAAO,OAAOA,EAAM,GAAG,IAAI;AAAA,EAAA,EAC9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