asterui 0.12.26 → 0.12.28

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.
Files changed (166) hide show
  1. package/dist/components/Collapse.d.ts +40 -20
  2. package/dist/components/Descriptions.d.ts +35 -3
  3. package/dist/components/Empty.d.ts +10 -1
  4. package/dist/components/Image.d.ts +13 -1
  5. package/dist/components/List.d.ts +74 -8
  6. package/dist/components/Table.d.ts +64 -10
  7. package/dist/components/Timeline.d.ts +62 -7
  8. package/dist/index.d.ts +4 -6
  9. package/dist/index.js +148 -150
  10. package/dist/index.js.map +1 -1
  11. package/dist/index10.js +1 -1
  12. package/dist/index100.js +5 -32
  13. package/dist/index100.js.map +1 -1
  14. package/dist/index101.js +13 -5
  15. package/dist/index101.js.map +1 -1
  16. package/dist/index102.js +43 -11
  17. package/dist/index102.js.map +1 -1
  18. package/dist/index103.js +11 -44
  19. package/dist/index103.js.map +1 -1
  20. package/dist/index104.js +12 -10
  21. package/dist/index104.js.map +1 -1
  22. package/dist/index105.js +7 -14
  23. package/dist/index105.js.map +1 -1
  24. package/dist/index106.js +12 -7
  25. package/dist/index106.js.map +1 -1
  26. package/dist/index107.js +29 -11
  27. package/dist/index107.js.map +1 -1
  28. package/dist/index108.js +16 -29
  29. package/dist/index108.js.map +1 -1
  30. package/dist/index109.js +31 -16
  31. package/dist/index109.js.map +1 -1
  32. package/dist/index110.js +517 -30
  33. package/dist/index110.js.map +1 -1
  34. package/dist/index111.js +45 -515
  35. package/dist/index111.js.map +1 -1
  36. package/dist/index18.js +105 -64
  37. package/dist/index18.js.map +1 -1
  38. package/dist/index22.js +1 -1
  39. package/dist/index23.js +127 -93
  40. package/dist/index23.js.map +1 -1
  41. package/dist/index39.js +162 -115
  42. package/dist/index39.js.map +1 -1
  43. package/dist/index40.js +398 -40
  44. package/dist/index40.js.map +1 -1
  45. package/dist/index41.js +132 -389
  46. package/dist/index41.js.map +1 -1
  47. package/dist/index42.js +252 -91
  48. package/dist/index42.js.map +1 -1
  49. package/dist/index43.js +143 -247
  50. package/dist/index43.js.map +1 -1
  51. package/dist/index44.js +15 -154
  52. package/dist/index44.js.map +1 -1
  53. package/dist/index45.js +17 -15
  54. package/dist/index45.js.map +1 -1
  55. package/dist/index46.js +136 -16
  56. package/dist/index46.js.map +1 -1
  57. package/dist/index47.js +118 -133
  58. package/dist/index47.js.map +1 -1
  59. package/dist/index48.js +35 -13
  60. package/dist/index48.js.map +1 -1
  61. package/dist/index49.js +34 -35
  62. package/dist/index49.js.map +1 -1
  63. package/dist/index50.js +81 -34
  64. package/dist/index50.js.map +1 -1
  65. package/dist/index51.js +166 -71
  66. package/dist/index51.js.map +1 -1
  67. package/dist/index52.js +144 -167
  68. package/dist/index52.js.map +1 -1
  69. package/dist/index53.js +11 -152
  70. package/dist/index53.js.map +1 -1
  71. package/dist/index54.js +55 -10
  72. package/dist/index54.js.map +1 -1
  73. package/dist/index55.js +12 -55
  74. package/dist/index55.js.map +1 -1
  75. package/dist/index56.js +7 -14
  76. package/dist/index56.js.map +1 -1
  77. package/dist/index57.js +333 -6
  78. package/dist/index57.js.map +1 -1
  79. package/dist/index58.js +47 -334
  80. package/dist/index58.js.map +1 -1
  81. package/dist/index59.js +122 -47
  82. package/dist/index59.js.map +1 -1
  83. package/dist/index60.js +108 -120
  84. package/dist/index60.js.map +1 -1
  85. package/dist/index61.js +167 -107
  86. package/dist/index61.js.map +1 -1
  87. package/dist/index62.js +29 -167
  88. package/dist/index62.js.map +1 -1
  89. package/dist/index63.js +120 -30
  90. package/dist/index63.js.map +1 -1
  91. package/dist/index64.js +80 -116
  92. package/dist/index64.js.map +1 -1
  93. package/dist/index65.js +19 -85
  94. package/dist/index65.js.map +1 -1
  95. package/dist/index66.js +73 -19
  96. package/dist/index66.js.map +1 -1
  97. package/dist/index67.js +54 -71
  98. package/dist/index67.js.map +1 -1
  99. package/dist/index68.js +44 -56
  100. package/dist/index68.js.map +1 -1
  101. package/dist/index69.js +49 -42
  102. package/dist/index69.js.map +1 -1
  103. package/dist/index70.js +121 -50
  104. package/dist/index70.js.map +1 -1
  105. package/dist/index71.js +102 -118
  106. package/dist/index71.js.map +1 -1
  107. package/dist/index72.js +72 -105
  108. package/dist/index72.js.map +1 -1
  109. package/dist/index73.js +67 -73
  110. package/dist/index73.js.map +1 -1
  111. package/dist/index74.js +19 -66
  112. package/dist/index74.js.map +1 -1
  113. package/dist/index75.js +55 -18
  114. package/dist/index75.js.map +1 -1
  115. package/dist/index76.js +251 -55
  116. package/dist/index76.js.map +1 -1
  117. package/dist/index77.js +22 -254
  118. package/dist/index77.js.map +1 -1
  119. package/dist/index78.js +31 -22
  120. package/dist/index78.js.map +1 -1
  121. package/dist/index79.js +93 -30
  122. package/dist/index79.js.map +1 -1
  123. package/dist/index80.js +626 -86
  124. package/dist/index80.js.map +1 -1
  125. package/dist/index81.js +73 -322
  126. package/dist/index81.js.map +1 -1
  127. package/dist/index82.js +39 -79
  128. package/dist/index82.js.map +1 -1
  129. package/dist/index83.js +23 -40
  130. package/dist/index83.js.map +1 -1
  131. package/dist/index84.js +207 -23
  132. package/dist/index84.js.map +1 -1
  133. package/dist/index85.js +148 -199
  134. package/dist/index85.js.map +1 -1
  135. package/dist/index86.js +152 -147
  136. package/dist/index86.js.map +1 -1
  137. package/dist/index87.js +143 -156
  138. package/dist/index87.js.map +1 -1
  139. package/dist/index88.js +35 -65
  140. package/dist/index88.js.map +1 -1
  141. package/dist/index89.js +234 -35
  142. package/dist/index89.js.map +1 -1
  143. package/dist/index90.js +31 -231
  144. package/dist/index90.js.map +1 -1
  145. package/dist/index91.js +210 -34
  146. package/dist/index91.js.map +1 -1
  147. package/dist/index92.js +418 -187
  148. package/dist/index92.js.map +1 -1
  149. package/dist/index93.js +686 -376
  150. package/dist/index93.js.map +1 -1
  151. package/dist/index94.js +165 -738
  152. package/dist/index94.js.map +1 -1
  153. package/dist/index95.js +253 -173
  154. package/dist/index95.js.map +1 -1
  155. package/dist/index96.js +64 -256
  156. package/dist/index96.js.map +1 -1
  157. package/dist/index97.js +121 -61
  158. package/dist/index97.js.map +1 -1
  159. package/dist/index98.js +14 -126
  160. package/dist/index98.js.map +1 -1
  161. package/dist/index99.js +31 -12
  162. package/dist/index99.js.map +1 -1
  163. package/package.json +1 -1
  164. package/dist/components/Indicator.d.ts +0 -7
  165. package/dist/index112.js +0 -53
  166. package/dist/index112.js.map +0 -1
package/dist/index23.js CHANGED
@@ -1,113 +1,147 @@
1
- import { jsxs as h, jsx as s, Fragment as E } from "react/jsx-runtime";
2
- import m from "react";
3
- function L(d) {
1
+ import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
+ import y, { forwardRef as A } from "react";
3
+ function B(c) {
4
4
  return null;
5
5
  }
6
- function B({
7
- title: d,
8
- bordered: a = !1,
9
- column: l = 3,
10
- size: v = "default",
11
- layout: w = "horizontal",
12
- colon: x = !0,
13
- labelStyle: N,
14
- contentStyle: $,
15
- className: j = "",
16
- style: F,
17
- children: M,
18
- ..._
19
- }) {
20
- const D = {
21
- small: "text-sm",
22
- default: "text-base",
23
- large: "text-lg"
24
- }, y = m.Children.toArray(M).filter(
25
- (p) => m.isValidElement(p)
26
- ), e = typeof l == "number" ? l : l.md || l.sm || l.xs || 3, R = () => {
27
- if (w === "vertical")
28
- return y.map((r, t) => {
29
- const o = r.props.span || 1, b = Math.min(o, e), f = r.props.labelStyle || N;
30
- return /* @__PURE__ */ h(m.Fragment, { children: [
31
- /* @__PURE__ */ h(
6
+ const H = {
7
+ sm: "text-sm",
8
+ md: "text-base",
9
+ lg: "text-lg"
10
+ }, N = A(
11
+ ({
12
+ title: c,
13
+ extra: S,
14
+ bordered: d = !1,
15
+ column: b = 3,
16
+ size: $ = "md",
17
+ layout: j = "horizontal",
18
+ colon: g = !0,
19
+ labelStyle: x,
20
+ contentStyle: v,
21
+ items: C,
22
+ className: M = "",
23
+ style: R,
24
+ children: D,
25
+ "data-testid": m = "descriptions",
26
+ ...L
27
+ }, z) => {
28
+ const w = C || y.Children.toArray(D).filter(
29
+ (t) => y.isValidElement(t)
30
+ ).map((t) => ({
31
+ label: t.props.label,
32
+ children: t.props.children,
33
+ span: t.props.span,
34
+ labelStyle: t.props.labelStyle,
35
+ contentStyle: t.props.contentStyle
36
+ })), r = typeof b == "number" ? b : b.md || b.sm || b.xs || 3, E = () => {
37
+ const t = [];
38
+ let s = [], l = 0;
39
+ return w.forEach((n) => {
40
+ const o = n.span || 1, e = Math.min(o, r);
41
+ l + e > r ? (t.push(s), s = [n], l = e) : (s.push(n), l += e);
42
+ }), s.length > 0 && t.push(s), t.map((n, o) => /* @__PURE__ */ i(y.Fragment, { children: [
43
+ /* @__PURE__ */ a("tr", { children: n.map((e, f) => {
44
+ const h = e.span || 1, p = Math.min(h, r), u = e.labelStyle || x;
45
+ return /* @__PURE__ */ i(
32
46
  "th",
33
47
  {
34
- className: `${a ? "border border-base-content/10" : ""} bg-base-200/50 font-semibold text-left px-4 py-2`,
35
- style: f,
36
- colSpan: b,
48
+ className: `${d ? "border border-base-content/10" : ""} bg-base-200/50 font-semibold text-left px-4 py-2`,
49
+ style: u,
50
+ colSpan: p,
51
+ scope: "col",
37
52
  children: [
38
- r.props.label,
39
- x && r.props.label && ":"
53
+ e.label,
54
+ g && e.label && ":"
40
55
  ]
41
- }
42
- ),
43
- t % e === e - 1 && /* @__PURE__ */ s(E, { children: Array.from({ length: e - ((t + 1) % e || e) }).map((n, i) => /* @__PURE__ */ s("th", { className: `${a ? "border border-base-content/10" : ""}` }, `empty-${i}`)) }),
44
- (t + 1) % e === 0 && /* @__PURE__ */ s("tr", { children: y.slice(t - e + 1, t + 1).map((n, i) => {
45
- const g = n.props.span || 1, u = Math.min(g, e), C = n.props.contentStyle || $;
46
- return /* @__PURE__ */ s(
47
- "td",
48
- {
49
- className: `${a ? "border border-base-content/10" : ""} px-4 py-2`,
50
- style: C,
51
- colSpan: u,
52
- children: n.props.children
53
- },
54
- i
55
- );
56
- }) }, `content-row-${t}`)
57
- ] }, t);
58
- });
59
- const p = [];
60
- let c = [], S = 0;
61
- return y.forEach((r) => {
62
- const t = r.props.span || 1, o = Math.min(t, e);
63
- S + o > e ? (p.push(c), c = [r], S = o) : (c.push(r), S += o);
64
- }), c.length > 0 && p.push(c), p.map((r, t) => {
65
- let o = 0;
66
- const b = r.map((n, i) => {
67
- const g = n.props.span || 1, u = Math.min(g, e), C = n.props.labelStyle || N, A = n.props.contentStyle || $;
68
- return o += u, /* @__PURE__ */ h(m.Fragment, { children: [
69
- /* @__PURE__ */ h(
56
+ },
57
+ f
58
+ );
59
+ }) }),
60
+ /* @__PURE__ */ a("tr", { children: n.map((e, f) => {
61
+ const h = e.span || 1, p = Math.min(h, r), u = e.contentStyle || v;
62
+ return /* @__PURE__ */ a(
63
+ "td",
64
+ {
65
+ className: `${d ? "border border-base-content/10" : ""} bg-base-100 px-4 py-2`,
66
+ style: u,
67
+ colSpan: p,
68
+ children: e.children
69
+ },
70
+ f
71
+ );
72
+ }) })
73
+ ] }, o));
74
+ }, _ = () => {
75
+ const t = [];
76
+ let s = [], l = 0;
77
+ return w.forEach((n) => {
78
+ const o = n.span || 1, e = Math.min(o, r);
79
+ l + e > r ? (t.push(s), s = [n], l = e) : (s.push(n), l += e);
80
+ }), s.length > 0 && t.push(s), t.map((n, o) => /* @__PURE__ */ a("tr", { children: n.map((e, f) => {
81
+ const h = e.span || 1, p = Math.min(h, r), u = e.labelStyle || x, V = e.contentStyle || v;
82
+ return /* @__PURE__ */ i(y.Fragment, { children: [
83
+ /* @__PURE__ */ i(
70
84
  "th",
71
85
  {
72
- className: `${a ? "border border-base-content/10" : ""} bg-base-200/50 font-semibold text-left px-4 py-2 whitespace-nowrap`,
73
- style: C,
86
+ className: `${d ? "border border-base-content/10" : ""} bg-base-200/50 font-semibold text-left px-4 py-2 whitespace-nowrap`,
87
+ style: u,
88
+ scope: "row",
74
89
  children: [
75
- n.props.label,
76
- x && n.props.label && ":"
90
+ e.label,
91
+ g && e.label && ":"
77
92
  ]
78
93
  }
79
94
  ),
80
- /* @__PURE__ */ s(
95
+ /* @__PURE__ */ a(
81
96
  "td",
82
97
  {
83
- className: `${a ? "border border-base-content/10" : ""} px-4 py-2`,
84
- style: A,
85
- colSpan: u * 2 - 1,
86
- children: n.props.children
98
+ className: `${d ? "border border-base-content/10" : ""} bg-base-100 px-4 py-2`,
99
+ style: V,
100
+ colSpan: p > 1 ? p * 2 - 1 : 1,
101
+ children: e.children
87
102
  }
88
103
  )
89
- ] }, i);
90
- }), f = e - o;
91
- return f > 0 && b.push(
92
- /* @__PURE__ */ s(m.Fragment, { children: /* @__PURE__ */ s("th", { className: `${a ? "border border-base-content/10" : ""}`, colSpan: f * 2 }) }, "empty")
93
- ), /* @__PURE__ */ s("tr", { children: b }, t);
94
- });
95
- }, z = [
96
- "w-full",
97
- a && "border-collapse",
98
- D[v],
99
- j
100
- ].filter(Boolean).join(" ");
101
- return /* @__PURE__ */ h("div", { style: F, ..._, children: [
102
- d && /* @__PURE__ */ s("div", { className: "text-lg font-semibold mb-4", children: d }),
103
- /* @__PURE__ */ s("table", { className: z, children: /* @__PURE__ */ s("tbody", { children: R() }) })
104
- ] });
105
- }
106
- const k = Object.assign(B, {
107
- Item: L
104
+ ] }, f);
105
+ }) }, o));
106
+ }, F = [
107
+ "w-full",
108
+ d && "border-collapse",
109
+ H[$],
110
+ M
111
+ ].filter(Boolean).join(" ");
112
+ return /* @__PURE__ */ i(
113
+ "div",
114
+ {
115
+ ref: z,
116
+ style: R,
117
+ "data-testid": m,
118
+ ...L,
119
+ children: [
120
+ (c || S) && /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-4", "data-testid": `${m}-header`, children: [
121
+ c && /* @__PURE__ */ a("div", { className: "text-lg font-semibold", children: c }),
122
+ S && /* @__PURE__ */ a("div", { "data-testid": `${m}-extra`, children: S })
123
+ ] }),
124
+ /* @__PURE__ */ a(
125
+ "table",
126
+ {
127
+ className: F,
128
+ role: "table",
129
+ "aria-label": typeof c == "string" ? c : void 0,
130
+ "data-testid": `${m}-table`,
131
+ children: /* @__PURE__ */ a("tbody", { children: j === "vertical" ? E() : _() })
132
+ }
133
+ )
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ );
139
+ N.displayName = "Descriptions";
140
+ const G = Object.assign(N, {
141
+ Item: B
108
142
  });
109
143
  export {
110
- k as Descriptions,
111
- k as default
144
+ G as Descriptions,
145
+ G as default
112
146
  };
113
147
  //# sourceMappingURL=index23.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index23.js","sources":["../src/components/Descriptions.tsx"],"sourcesContent":["import React from 'react'\n\nexport type DescriptionsSize = 'small' | 'default' | 'large'\nexport type DescriptionsLayout = 'horizontal' | 'vertical'\n\nexport interface DescriptionsItemProps {\n label?: React.ReactNode\n span?: number\n children?: React.ReactNode\n labelStyle?: React.CSSProperties\n contentStyle?: React.CSSProperties\n}\n\nexport interface DescriptionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n title?: React.ReactNode\n bordered?: boolean\n column?: number | {\n xs?: number\n sm?: number\n md?: number\n lg?: number\n xl?: number\n '2xl'?: number\n }\n size?: DescriptionsSize\n layout?: DescriptionsLayout\n colon?: boolean\n labelStyle?: React.CSSProperties\n contentStyle?: React.CSSProperties\n children?: React.ReactNode\n}\n\nfunction DescriptionsItem(_props: DescriptionsItemProps) {\n return null\n}\n\nfunction DescriptionsRoot({\n title,\n bordered = false,\n column = 3,\n size = 'default',\n layout = 'horizontal',\n colon = true,\n labelStyle,\n contentStyle,\n className = '',\n style,\n children,\n ...rest\n}: DescriptionsProps) {\n const sizeClasses: Record<DescriptionsSize, string> = {\n small: 'text-sm',\n default: 'text-base',\n large: 'text-lg',\n }\n\n const items = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<DescriptionsItemProps> =>\n React.isValidElement(child)\n )\n\n const getColumnCount = () => {\n if (typeof column === 'number') {\n return column\n }\n // For responsive columns, default to md value or 3\n return column.md || column.sm || column.xs || 3\n }\n\n const columnCount = getColumnCount()\n\n const renderItems = () => {\n if (layout === 'vertical') {\n return items.map((item, index) => {\n const span = item.props.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n const itemLabelStyle = item.props.labelStyle || labelStyle\n\n return (\n <React.Fragment key={index}>\n <th\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-200/50 font-semibold text-left px-4 py-2`}\n style={itemLabelStyle}\n colSpan={effectiveSpan}\n >\n {item.props.label}\n {colon && item.props.label && ':'}\n </th>\n {index % columnCount === columnCount - 1 && (\n <>\n {Array.from({ length: columnCount - ((index + 1) % columnCount || columnCount) }).map((_, i) => (\n <th key={`empty-${i}`} className={`${bordered ? 'border border-base-content/10' : ''}`} />\n ))}\n </>\n )}\n {(index + 1) % columnCount === 0 && (\n <tr key={`content-row-${index}`}>\n {items.slice(index - columnCount + 1, index + 1).map((contentItem, ci) => {\n const contentSpan = contentItem.props.span || 1\n const effectiveContentSpan = Math.min(contentSpan, columnCount)\n const itemContentStyle2 = contentItem.props.contentStyle || contentStyle\n\n return (\n <td\n key={ci}\n className={`${bordered ? 'border border-base-content/10' : ''} px-4 py-2`}\n style={itemContentStyle2}\n colSpan={effectiveContentSpan}\n >\n {contentItem.props.children}\n </td>\n )\n })}\n </tr>\n )}\n </React.Fragment>\n )\n })\n }\n\n // Horizontal layout\n const rows: React.ReactElement<DescriptionsItemProps>[][] = []\n let currentRow: React.ReactElement<DescriptionsItemProps>[] = []\n let currentSpan = 0\n\n items.forEach((item) => {\n const span = item.props.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n\n if (currentSpan + effectiveSpan > columnCount) {\n rows.push(currentRow)\n currentRow = [item]\n currentSpan = effectiveSpan\n } else {\n currentRow.push(item)\n currentSpan += effectiveSpan\n }\n })\n\n if (currentRow.length > 0) {\n rows.push(currentRow)\n }\n\n return rows.map((row, rowIndex) => {\n let usedSpan = 0\n const cells = row.map((item, cellIndex) => {\n const span = item.props.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n const itemLabelStyle = item.props.labelStyle || labelStyle\n const itemContentStyle = item.props.contentStyle || contentStyle\n usedSpan += effectiveSpan\n\n return (\n <React.Fragment key={cellIndex}>\n <th\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-200/50 font-semibold text-left px-4 py-2 whitespace-nowrap`}\n style={itemLabelStyle}\n >\n {item.props.label}\n {colon && item.props.label && ':'}\n </th>\n <td\n className={`${bordered ? 'border border-base-content/10' : ''} px-4 py-2`}\n style={itemContentStyle}\n colSpan={effectiveSpan * 2 - 1}\n >\n {item.props.children}\n </td>\n </React.Fragment>\n )\n })\n\n // Fill remaining columns\n const remainingSpan = columnCount - usedSpan\n if (remainingSpan > 0) {\n cells.push(\n <React.Fragment key=\"empty\">\n <th className={`${bordered ? 'border border-base-content/10' : ''}`} colSpan={remainingSpan * 2} />\n </React.Fragment>\n )\n }\n\n return <tr key={rowIndex}>{cells}</tr>\n })\n }\n\n const containerClasses = [\n 'w-full',\n bordered && 'border-collapse',\n sizeClasses[size],\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <div style={style} {...rest}>\n {title && (\n <div className=\"text-lg font-semibold mb-4\">\n {title}\n </div>\n )}\n <table className={containerClasses}>\n <tbody>\n {renderItems()}\n </tbody>\n </table>\n </div>\n )\n}\n\nexport const Descriptions = Object.assign(DescriptionsRoot, {\n Item: DescriptionsItem,\n})\n\nexport default Descriptions\n"],"names":["DescriptionsItem","_props","DescriptionsRoot","title","bordered","column","size","layout","colon","labelStyle","contentStyle","className","style","children","rest","sizeClasses","items","React","child","columnCount","renderItems","item","index","span","effectiveSpan","itemLabelStyle","jsxs","_","jsx","contentItem","ci","contentSpan","effectiveContentSpan","itemContentStyle2","rows","currentRow","currentSpan","row","rowIndex","usedSpan","cells","cellIndex","itemContentStyle","remainingSpan","containerClasses","Descriptions"],"mappings":";;AAgCA,SAASA,EAAiBC,GAA+B;AACvD,SAAO;AACT;AAEA,SAASC,EAAiB;AAAA,EACxB,OAAAC;AAAA,EACA,UAAAC,IAAW;AA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AA,GACF;AAEJ;AAEO,MAAMyB,IAAe,OAAO,OAAO3C,GAAkB;AAAA,EAC1D,MAAMF;AACR,CAAC;"}
1
+ {"version":3,"file":"index23.js","sources":["../src/components/Descriptions.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nexport type DescriptionsSize = 'sm' | 'md' | 'lg'\nexport type DescriptionsLayout = 'horizontal' | 'vertical'\n\nexport interface DescriptionsItemProps {\n /** Label for the item */\n label?: React.ReactNode\n /** Number of columns to span */\n span?: number\n /** Content of the item */\n children?: React.ReactNode\n /** Custom label styles */\n labelStyle?: React.CSSProperties\n /** Custom content styles */\n contentStyle?: React.CSSProperties\n}\n\n/** Item configuration for the items prop */\nexport interface DescriptionsItemConfig {\n /** Label for the item */\n label: React.ReactNode\n /** Content of the item */\n children: React.ReactNode\n /** Number of columns to span */\n span?: number\n /** Custom label styles */\n labelStyle?: React.CSSProperties\n /** Custom content styles */\n contentStyle?: React.CSSProperties\n}\n\nexport interface DescriptionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Title of the descriptions block */\n title?: React.ReactNode\n /** Extra content in the top-right corner */\n extra?: React.ReactNode\n /** Show borders around cells */\n bordered?: boolean\n /** Number of columns (or responsive config) */\n column?: number | {\n xs?: number\n sm?: number\n md?: number\n lg?: number\n xl?: number\n '2xl'?: number\n }\n /** Size variant */\n size?: DescriptionsSize\n /** Layout direction */\n layout?: DescriptionsLayout\n /** Show colon after labels */\n colon?: boolean\n /** Default label styles */\n labelStyle?: React.CSSProperties\n /** Default content styles */\n contentStyle?: React.CSSProperties\n /** Item configurations (alternative to children) */\n items?: DescriptionsItemConfig[]\n /** Children (Descriptions.Item elements) */\n children?: React.ReactNode\n /** Test ID for the component */\n 'data-testid'?: string\n}\n\nfunction DescriptionsItem(_props: DescriptionsItemProps) {\n return null\n}\n\nconst sizeClasses: Record<DescriptionsSize, string> = {\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n}\n\nconst DescriptionsRoot = forwardRef<HTMLDivElement, DescriptionsProps>(\n (\n {\n title,\n extra,\n bordered = false,\n column = 3,\n size = 'md',\n layout = 'horizontal',\n colon = true,\n labelStyle,\n contentStyle,\n items: itemsProp,\n className = '',\n style,\n children,\n 'data-testid': testId = 'descriptions',\n ...rest\n },\n ref\n ) => {\n // Convert children to item configs, or use items prop\n const itemConfigs: DescriptionsItemConfig[] = itemsProp\n ? itemsProp\n : React.Children.toArray(children)\n .filter((child): child is React.ReactElement<DescriptionsItemProps> =>\n React.isValidElement(child)\n )\n .map((child) => ({\n label: child.props.label,\n children: child.props.children,\n span: child.props.span,\n labelStyle: child.props.labelStyle,\n contentStyle: child.props.contentStyle,\n }))\n\n const getColumnCount = () => {\n if (typeof column === 'number') {\n return column\n }\n return column.md || column.sm || column.xs || 3\n }\n\n const columnCount = getColumnCount()\n\n const renderVerticalLayout = () => {\n const rows: DescriptionsItemConfig[][] = []\n let currentRow: DescriptionsItemConfig[] = []\n let currentSpan = 0\n\n itemConfigs.forEach((item) => {\n const span = item.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n\n if (currentSpan + effectiveSpan > columnCount) {\n rows.push(currentRow)\n currentRow = [item]\n currentSpan = effectiveSpan\n } else {\n currentRow.push(item)\n currentSpan += effectiveSpan\n }\n })\n\n if (currentRow.length > 0) {\n rows.push(currentRow)\n }\n\n return rows.map((row, rowIndex) => (\n <React.Fragment key={rowIndex}>\n <tr>\n {row.map((item, cellIndex) => {\n const span = item.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n const itemLabelStyle = item.labelStyle || labelStyle\n\n return (\n <th\n key={cellIndex}\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-200/50 font-semibold text-left px-4 py-2`}\n style={itemLabelStyle}\n colSpan={effectiveSpan}\n scope=\"col\"\n >\n {item.label}\n {colon && item.label && ':'}\n </th>\n )\n })}\n </tr>\n <tr>\n {row.map((item, cellIndex) => {\n const span = item.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n const itemContentStyle = item.contentStyle || contentStyle\n\n return (\n <td\n key={cellIndex}\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-100 px-4 py-2`}\n style={itemContentStyle}\n colSpan={effectiveSpan}\n >\n {item.children}\n </td>\n )\n })}\n </tr>\n </React.Fragment>\n ))\n }\n\n const renderHorizontalLayout = () => {\n const rows: DescriptionsItemConfig[][] = []\n let currentRow: DescriptionsItemConfig[] = []\n let currentSpan = 0\n\n itemConfigs.forEach((item) => {\n const span = item.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n\n if (currentSpan + effectiveSpan > columnCount) {\n rows.push(currentRow)\n currentRow = [item]\n currentSpan = effectiveSpan\n } else {\n currentRow.push(item)\n currentSpan += effectiveSpan\n }\n })\n\n if (currentRow.length > 0) {\n rows.push(currentRow)\n }\n\n return rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((item, cellIndex) => {\n const span = item.span || 1\n const effectiveSpan = Math.min(span, columnCount)\n const itemLabelStyle = item.labelStyle || labelStyle\n const itemContentStyle = item.contentStyle || contentStyle\n\n return (\n <React.Fragment key={cellIndex}>\n <th\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-200/50 font-semibold text-left px-4 py-2 whitespace-nowrap`}\n style={itemLabelStyle}\n scope=\"row\"\n >\n {item.label}\n {colon && item.label && ':'}\n </th>\n <td\n className={`${bordered ? 'border border-base-content/10' : ''} bg-base-100 px-4 py-2`}\n style={itemContentStyle}\n colSpan={effectiveSpan > 1 ? effectiveSpan * 2 - 1 : 1}\n >\n {item.children}\n </td>\n </React.Fragment>\n )\n })}\n </tr>\n ))\n }\n\n const containerClasses = [\n 'w-full',\n bordered && 'border-collapse',\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div\n ref={ref}\n style={style}\n data-testid={testId}\n {...rest}\n >\n {(title || extra) && (\n <div className=\"flex items-center justify-between mb-4\" data-testid={`${testId}-header`}>\n {title && (\n <div className=\"text-lg font-semibold\">{title}</div>\n )}\n {extra && (\n <div data-testid={`${testId}-extra`}>{extra}</div>\n )}\n </div>\n )}\n <table\n className={containerClasses}\n role=\"table\"\n aria-label={typeof title === 'string' ? title : undefined}\n data-testid={`${testId}-table`}\n >\n <tbody>\n {layout === 'vertical' ? renderVerticalLayout() : renderHorizontalLayout()}\n </tbody>\n </table>\n </div>\n )\n }\n)\n\nDescriptionsRoot.displayName = 'Descriptions'\n\nexport const Descriptions = Object.assign(DescriptionsRoot, {\n Item: DescriptionsItem,\n})\n\nexport default Descriptions\n"],"names":["DescriptionsItem","_props","sizeClasses","DescriptionsRoot","forwardRef","title","extra","bordered","column","size","layout","colon","labelStyle","contentStyle","itemsProp","className","style","children","testId","rest","ref","itemConfigs","React","child","columnCount","renderVerticalLayout","rows","currentRow","currentSpan","item","span","effectiveSpan","row","rowIndex","jsxs","jsx","cellIndex","itemLabelStyle","itemContentStyle","renderHorizontalLayout","containerClasses","Descriptions"],"mappings":";;AAkEA,SAASA,EAAiBC,GAA+B;AACvD,SAAO;AACT;AAEA,MAAMC,IAAgD;AAAA,EACpD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAmBC;AAAA,EACvB,CACE;AAAA,IACE,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,QAAAC,IAAS;AAAA,IACT,MAAAC,IAAO;AAAA,IACP,QAAAC,IAAS;AAAA,IACT,OAAAC,IAAQ;AAAA,IACR,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAOC;AAAA,IACP,WAAAC,IAAY;AAAA,IACZ,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAeC,IAAS;AAAA,IACxB,GAAGC;AAAA,EAAA,GAELC,MACG;AAEH,UAAMC,IAAwCP,KAE1CQ,EAAM,SAAS,QAAQL,CAAQ,EAC5B;AAAA,MAAO,CAACM,MACPD,EAAM,eAAeC,CAAK;AAAA,IAAA,EAE3B,IAAI,CAACA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;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEApC,EAAiB,cAAc;AAExB,MAAMsC,IAAe,OAAO,OAAOtC,GAAkB;AAAA,EAC1D,MAAMH;AACR,CAAC;"}
package/dist/index39.js CHANGED
@@ -1,125 +1,172 @@
1
- import { jsxs as u, Fragment as M, jsx as e } from "react/jsx-runtime";
2
- import { useState as a, useEffect as P } from "react";
3
- const I = ({
4
- src: s,
5
- alt: f = "",
6
- fallback: i,
7
- placeholder: h,
8
- preview: p = !0,
9
- width: n,
10
- height: o,
11
- className: g = "",
12
- onLoad: k,
13
- onError: y,
14
- ...C
15
- }) => {
16
- const [r, l] = a(!0), [c, m] = a(!1), [L, b] = a(!1), [N, v] = a(s);
17
- P(() => {
18
- l(!0), m(!1), v(s);
19
- }, [s]);
20
- const j = () => {
21
- l(!1), m(!1), k?.();
22
- }, w = () => {
23
- l(!1), m(!0), i && v(i), y?.();
24
- }, S = () => {
25
- p && !c && !r && b(!0);
26
- }, x = () => {
27
- b(!1);
28
- }, d = () => {
29
- const t = {};
30
- return n && (t.width = typeof n == "number" ? `${n}px` : n), o && (t.height = typeof o == "number" ? `${o}px` : o), t;
31
- }, E = [
32
- g,
33
- p && !c && !r ? "cursor-pointer hover:opacity-80 transition-opacity" : ""
34
- ].filter(Boolean).join(" ");
35
- return /* @__PURE__ */ u(M, { children: [
36
- /* @__PURE__ */ u("div", { className: "relative inline-block", style: d(), children: [
37
- r && h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-base-200", children: h }),
38
- /* @__PURE__ */ e(
39
- "img",
1
+ import { jsxs as p, Fragment as F, jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as z, useState as h, useEffect as W, useCallback as i } from "react";
3
+ const H = z(
4
+ ({
5
+ src: l,
6
+ alt: n = "",
7
+ fallback: c,
8
+ placeholder: y,
9
+ preview: s = !0,
10
+ width: d,
11
+ height: m,
12
+ className: N = "",
13
+ onLoad: k,
14
+ onError: w,
15
+ "data-testid": o = "image",
16
+ ...$
17
+ }, j) => {
18
+ const [t, g] = h(!0), [r, v] = h(!1), [L, u] = h(!1), [P, x] = h(l);
19
+ W(() => {
20
+ g(!0), v(!1), x(l);
21
+ }, [l]);
22
+ const D = i(() => {
23
+ g(!1), v(!1), k?.();
24
+ }, [k]), E = i(() => {
25
+ g(!1), v(!0), c && x(c), w?.();
26
+ }, [c, w]), S = i(() => {
27
+ s && !r && !t && u(!0);
28
+ }, [s, r, t]), C = i(() => {
29
+ u(!1);
30
+ }, []), K = i(
31
+ (e) => {
32
+ s && !r && !t && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), u(!0));
33
+ },
34
+ [s, r, t]
35
+ ), M = i((e) => {
36
+ e.key === "Escape" && u(!1);
37
+ }, []), b = () => {
38
+ const e = {};
39
+ return d && (e.width = typeof d == "number" ? `${d}px` : d), m && (e.height = typeof m == "number" ? `${m}px` : m), e;
40
+ }, f = s && !r && !t, B = [
41
+ N,
42
+ f ? "cursor-pointer hover:opacity-80 transition-opacity" : ""
43
+ ].filter(Boolean).join(" ");
44
+ return /* @__PURE__ */ p(F, { children: [
45
+ /* @__PURE__ */ p(
46
+ "div",
40
47
  {
41
- ...C,
42
- src: N,
43
- alt: f,
44
- className: E,
45
- style: { ...d(), display: r ? "none" : "block" },
46
- onLoad: j,
47
- onError: w,
48
- onClick: S
48
+ className: "relative inline-block",
49
+ style: b(),
50
+ "data-testid": o,
51
+ "data-state": t ? "loading" : r ? "error" : "loaded",
52
+ children: [
53
+ t && y && /* @__PURE__ */ a(
54
+ "div",
55
+ {
56
+ className: "absolute inset-0 flex items-center justify-center bg-base-200",
57
+ "data-testid": `${o}-placeholder`,
58
+ children: y
59
+ }
60
+ ),
61
+ /* @__PURE__ */ a(
62
+ "img",
63
+ {
64
+ ref: j,
65
+ ...$,
66
+ src: P,
67
+ alt: n,
68
+ className: B,
69
+ style: { ...b(), display: t ? "none" : "block" },
70
+ onLoad: D,
71
+ onError: E,
72
+ onClick: S,
73
+ onKeyDown: K,
74
+ tabIndex: f ? 0 : void 0,
75
+ role: f ? "button" : void 0,
76
+ "aria-label": f ? `${n || "Image"} (click to preview)` : void 0,
77
+ "data-testid": `${o}-img`
78
+ }
79
+ ),
80
+ r && !c && /* @__PURE__ */ a(
81
+ "div",
82
+ {
83
+ className: "flex items-center justify-center bg-base-200 text-base-content/50",
84
+ style: b(),
85
+ "data-testid": `${o}-error`,
86
+ role: "img",
87
+ "aria-label": `Failed to load: ${n || "image"}`,
88
+ children: /* @__PURE__ */ a(
89
+ "svg",
90
+ {
91
+ className: "w-12 h-12",
92
+ fill: "none",
93
+ stroke: "currentColor",
94
+ viewBox: "0 0 24 24",
95
+ "aria-hidden": "true",
96
+ children: /* @__PURE__ */ a(
97
+ "path",
98
+ {
99
+ strokeLinecap: "round",
100
+ strokeLinejoin: "round",
101
+ strokeWidth: 2,
102
+ d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
103
+ }
104
+ )
105
+ }
106
+ )
107
+ }
108
+ )
109
+ ]
49
110
  }
50
111
  ),
51
- c && !i && /* @__PURE__ */ e(
112
+ L && /* @__PURE__ */ a(
52
113
  "div",
53
114
  {
54
- className: "flex items-center justify-center bg-base-200 text-base-content/50",
55
- style: d(),
56
- children: /* @__PURE__ */ e(
57
- "svg",
58
- {
59
- className: "w-12 h-12",
60
- fill: "none",
61
- stroke: "currentColor",
62
- viewBox: "0 0 24 24",
63
- children: /* @__PURE__ */ e(
64
- "path",
65
- {
66
- strokeLinecap: "round",
67
- strokeLinejoin: "round",
68
- strokeWidth: 2,
69
- d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
70
- }
71
- )
72
- }
73
- )
115
+ className: "fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center p-4",
116
+ onClick: C,
117
+ onKeyDown: M,
118
+ role: "dialog",
119
+ "aria-modal": "true",
120
+ "aria-label": `Preview: ${n || "Image"}`,
121
+ "data-testid": `${o}-preview`,
122
+ children: /* @__PURE__ */ p("div", { className: "relative max-w-full max-h-full", children: [
123
+ /* @__PURE__ */ a(
124
+ "button",
125
+ {
126
+ className: "absolute top-4 right-4 btn btn-circle btn-sm",
127
+ onClick: C,
128
+ "aria-label": "Close preview",
129
+ autoFocus: !0,
130
+ "data-testid": `${o}-preview-close`,
131
+ children: /* @__PURE__ */ a(
132
+ "svg",
133
+ {
134
+ className: "w-6 h-6",
135
+ fill: "none",
136
+ stroke: "currentColor",
137
+ viewBox: "0 0 24 24",
138
+ "aria-hidden": "true",
139
+ children: /* @__PURE__ */ a(
140
+ "path",
141
+ {
142
+ strokeLinecap: "round",
143
+ strokeLinejoin: "round",
144
+ strokeWidth: 2,
145
+ d: "M6 18L18 6M6 6l12 12"
146
+ }
147
+ )
148
+ }
149
+ )
150
+ }
151
+ ),
152
+ /* @__PURE__ */ a(
153
+ "img",
154
+ {
155
+ src: l,
156
+ alt: n,
157
+ className: "max-w-full max-h-[90vh] object-contain",
158
+ onClick: (e) => e.stopPropagation(),
159
+ "data-testid": `${o}-preview-img`
160
+ }
161
+ )
162
+ ] })
74
163
  }
75
164
  )
76
- ] }),
77
- L && /* @__PURE__ */ e(
78
- "div",
79
- {
80
- className: "fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center p-4",
81
- onClick: x,
82
- children: /* @__PURE__ */ u("div", { className: "relative max-w-full max-h-full", children: [
83
- /* @__PURE__ */ e(
84
- "button",
85
- {
86
- className: "absolute top-4 right-4 btn btn-circle btn-sm",
87
- onClick: x,
88
- children: /* @__PURE__ */ e(
89
- "svg",
90
- {
91
- className: "w-6 h-6",
92
- fill: "none",
93
- stroke: "currentColor",
94
- viewBox: "0 0 24 24",
95
- children: /* @__PURE__ */ e(
96
- "path",
97
- {
98
- strokeLinecap: "round",
99
- strokeLinejoin: "round",
100
- strokeWidth: 2,
101
- d: "M6 18L18 6M6 6l12 12"
102
- }
103
- )
104
- }
105
- )
106
- }
107
- ),
108
- /* @__PURE__ */ e(
109
- "img",
110
- {
111
- src: s,
112
- alt: f,
113
- className: "max-w-full max-h-[90vh] object-contain",
114
- onClick: (t) => t.stopPropagation()
115
- }
116
- )
117
- ] })
118
- }
119
- )
120
- ] });
121
- };
165
+ ] });
166
+ }
167
+ );
168
+ H.displayName = "Image";
122
169
  export {
123
- I as Image
170
+ H as Image
124
171
  };
125
172
  //# sourceMappingURL=index39.js.map