wimui 0.28.0 → 0.29.0

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 (67) hide show
  1. package/dist/charts.cjs +1 -1
  2. package/dist/charts.d.ts +4 -0
  3. package/dist/charts.js +5 -1
  4. package/dist/components/_internal/barSpan.cjs +2 -0
  5. package/dist/components/_internal/barSpan.d.ts +60 -0
  6. package/dist/components/_internal/barSpan.js +13 -0
  7. package/dist/components/_internal/chartTableData.cjs +0 -0
  8. package/dist/components/_internal/chartTableData.d.ts +55 -0
  9. package/dist/components/_internal/chartTableData.js +0 -0
  10. package/dist/components/charts/BoxPlot/BoxPlot.cjs +2 -0
  11. package/dist/components/charts/BoxPlot/BoxPlot.d.ts +50 -0
  12. package/dist/components/charts/BoxPlot/BoxPlot.js +130 -0
  13. package/dist/components/charts/BoxPlot/box-plot.module.cjs +2 -0
  14. package/dist/components/charts/BoxPlot/box-plot.module.js +11 -0
  15. package/dist/components/charts/CandlestickChart/CandlestickChart.cjs +2 -0
  16. package/dist/components/charts/CandlestickChart/CandlestickChart.d.ts +48 -0
  17. package/dist/components/charts/CandlestickChart/CandlestickChart.js +119 -0
  18. package/dist/components/charts/CandlestickChart/candlestick-chart.module.cjs +2 -0
  19. package/dist/components/charts/CandlestickChart/candlestick-chart.module.js +13 -0
  20. package/dist/components/charts/SankeyChart/SankeyChart.cjs +2 -0
  21. package/dist/components/charts/SankeyChart/SankeyChart.d.ts +54 -0
  22. package/dist/components/charts/SankeyChart/SankeyChart.js +106 -0
  23. package/dist/components/charts/SankeyChart/sankey-chart.module.cjs +2 -0
  24. package/dist/components/charts/SankeyChart/sankey-chart.module.js +9 -0
  25. package/dist/components/charts/SankeyChart/warn-unknown-node.cjs +2 -0
  26. package/dist/components/charts/SankeyChart/warn-unknown-node.d.ts +9 -0
  27. package/dist/components/charts/SankeyChart/warn-unknown-node.js +5 -0
  28. package/dist/components/charts/WaterfallChart/WaterfallChart.cjs +2 -0
  29. package/dist/components/charts/WaterfallChart/WaterfallChart.d.ts +53 -0
  30. package/dist/components/charts/WaterfallChart/WaterfallChart.js +128 -0
  31. package/dist/components/charts/WaterfallChart/waterfall-chart.module.cjs +2 -0
  32. package/dist/components/charts/WaterfallChart/waterfall-chart.module.js +9 -0
  33. package/dist/components/data-display/Barcode/Barcode.cjs +1 -1
  34. package/dist/components/data-display/Barcode/Barcode.js +75 -34
  35. package/dist/components/data-display/Barcode/barcode.module.cjs +1 -1
  36. package/dist/components/data-display/Barcode/barcode.module.js +7 -6
  37. package/dist/components/data-display/Barcode/encode.cjs +1 -1
  38. package/dist/components/data-display/Barcode/encode.d.ts +36 -0
  39. package/dist/components/data-display/Barcode/encode.js +19 -1
  40. package/dist/components/data-display/Comment/Comment.cjs +2 -0
  41. package/dist/components/data-display/Comment/Comment.d.ts +132 -0
  42. package/dist/components/data-display/Comment/Comment.js +86 -0
  43. package/dist/components/data-display/Comment/comment.module.cjs +2 -0
  44. package/dist/components/data-display/Comment/comment.module.js +19 -0
  45. package/dist/data-display-core.d.ts +1 -0
  46. package/dist/data-display.cjs +1 -1
  47. package/dist/data-display.js +5 -4
  48. package/dist/i18n/generated/keys.d.ts +1 -1
  49. package/dist/i18n/generated/resources.cjs +1 -1
  50. package/dist/i18n/generated/resources.js +21 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +42 -41
  53. package/dist/llms-full.txt +68 -1
  54. package/dist/llms.txt +6 -1
  55. package/dist/locales/en/common.json +14 -7
  56. package/dist/locales/en/components.json +2 -1
  57. package/dist/locales/en/data-display.json +1 -2
  58. package/dist/locales/ja/common.json +14 -7
  59. package/dist/locales/ja/components.json +2 -1
  60. package/dist/locales/ja/data-display.json +1 -2
  61. package/dist/locales/pt/common.json +14 -7
  62. package/dist/locales/pt/components.json +2 -1
  63. package/dist/locales/pt/data-display.json +1 -2
  64. package/dist/styles.css +1 -1
  65. package/dist/wimui.umd.css +1 -1
  66. package/dist/wimui.umd.js +5 -5
  67. package/package.json +2 -2
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { Title as e } from "../../typography/Title/Title.js";
3
+ import { CHART_COLORS as t, CHART_HIDDEN_A11Y_PROPS as n, CHART_THEME as r } from "../../helpers.js";
4
+ import { ChartDataTable as i } from "../../_internal/ChartDataTable.js";
5
+ import { linkTable as a } from "../../_internal/chartTableData.js";
6
+ import { warnDuplicateSankeyNode as o, warnUnknownSankeyNode as s } from "./warn-unknown-node.js";
7
+ import c from "./sankey-chart.module.js";
8
+ import "react";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
+ import { ResponsiveContainer as d, Sankey as f, Tooltip as p } from "recharts";
11
+ //#region src/components/charts/SankeyChart/SankeyChart.tsx
12
+ var m = 12, h = 24, g = 8, _ = ({ x: e = 0, y: n = 0, width: r = 0, height: i = 0, index: a = 0, payload: o }) => {
13
+ let s = (o?.targetNodes?.length ?? 0) === 0;
14
+ return /* @__PURE__ */ u("g", { children: [/* @__PURE__ */ l("rect", {
15
+ x: e,
16
+ y: n,
17
+ width: r,
18
+ height: i,
19
+ fill: t[a % t.length],
20
+ rx: 2
21
+ }), /* @__PURE__ */ l("text", {
22
+ className: c.label,
23
+ x: s ? e - g : e + r + g,
24
+ y: n + i / 2,
25
+ textAnchor: s ? "end" : "start",
26
+ dominantBaseline: "middle",
27
+ children: o?.name
28
+ })] });
29
+ }, v = ({ sourceX: e = 0, targetX: n = 0, sourceY: r = 0, targetY: i = 0, sourceControlX: a = 0, targetControlX: o = 0, linkWidth: s = 0, payload: c, colorIndexOf: u }) => {
30
+ let d = c?.source?.name, f = (d === void 0 ? void 0 : u?.get(d)) ?? 0;
31
+ return /* @__PURE__ */ l("path", {
32
+ d: `M${e},${r}C${a},${r} ${o},${i} ${n},${i}`,
33
+ fill: "none",
34
+ stroke: t[f % t.length],
35
+ strokeWidth: s,
36
+ strokeOpacity: .28
37
+ });
38
+ }, y = ({ nodes: t, links: g, height: y = 300, width: b = "100%", title: x, "aria-label": S }) => {
39
+ let C = S ?? x, w = /* @__PURE__ */ new Map();
40
+ t.forEach((e, t) => {
41
+ if (w.has(e)) {
42
+ o(e);
43
+ return;
44
+ }
45
+ w.set(e, t);
46
+ });
47
+ let T = g.filter((e) => {
48
+ let n = w.has(e.source) ? w.has(e.target) ? null : e.target : e.source;
49
+ return n === null ? !0 : (s(n, t), !1);
50
+ }), E = a(T);
51
+ return /* @__PURE__ */ u("div", {
52
+ className: `wim-sankey-chart ${c.root}`,
53
+ style: { width: b },
54
+ role: C ? "figure" : void 0,
55
+ "aria-label": C,
56
+ children: [
57
+ x && /* @__PURE__ */ l(e, {
58
+ tag: "h3",
59
+ size: "md",
60
+ style: { marginBottom: "var(--wim-spacing-md)" },
61
+ children: x
62
+ }),
63
+ /* @__PURE__ */ l("div", {
64
+ className: c.container,
65
+ style: { height: y },
66
+ "aria-hidden": "true",
67
+ children: /* @__PURE__ */ l(d, {
68
+ width: "100%",
69
+ height: "100%",
70
+ children: /* @__PURE__ */ l(f, {
71
+ ...n,
72
+ data: {
73
+ nodes: t.map((e) => ({ name: e })),
74
+ links: T.map((e) => ({
75
+ source: w.get(e.source),
76
+ target: w.get(e.target),
77
+ value: e.value
78
+ }))
79
+ },
80
+ nodeWidth: m,
81
+ nodePadding: h,
82
+ margin: {
83
+ top: 8,
84
+ right: 8,
85
+ bottom: 8,
86
+ left: 8
87
+ },
88
+ node: /* @__PURE__ */ l(_, {}),
89
+ link: /* @__PURE__ */ l(v, { colorIndexOf: w }),
90
+ children: /* @__PURE__ */ l(p, {
91
+ contentStyle: r.tooltip.contentStyle,
92
+ cursor: r.tooltip.cursor
93
+ })
94
+ })
95
+ })
96
+ }),
97
+ /* @__PURE__ */ l(i, {
98
+ caption: C,
99
+ columns: E.columns,
100
+ rows: E.rows
101
+ })
102
+ ]
103
+ });
104
+ };
105
+ //#endregion
106
+ export { y as SankeyChart };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_root_165yr_3`,t=`_container_165yr_6`,n=`_label_165yr_14`,r={root:e,container:t,label:n};exports.container=t,exports.default=r,exports.label=n,exports.root=e;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ //#region src/components/charts/SankeyChart/sankey-chart.module.scss
3
+ var e = "_root_165yr_3", t = "_container_165yr_6", n = "_label_165yr_14", r = {
4
+ root: e,
5
+ container: t,
6
+ label: n
7
+ };
8
+ //#endregion
9
+ export { t as container, r as default, n as label, e as root };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function e(e,t){}function t(e){}exports.warnDuplicateSankeyNode=t,exports.warnUnknownSankeyNode=e;
@@ -0,0 +1,9 @@
1
+ /** `links` が `nodes` に無い名前を指した。その流れは描けないので落とす。 */
2
+ export declare function warnUnknownSankeyNode(missing: string, nodes: readonly string[]): void;
3
+ /**
4
+ * `nodes` に同じ名前が 2 つ以上ある。`links` は名前で node を指すので、
5
+ * **2 つ目以降には 1 本も届かない** ── その段は空のまま描かれ、量だけが消える。
6
+ */
7
+ export declare function warnDuplicateSankeyNode(duplicate: string): void;
8
+ /** Test seam — the warn-once set is module state. */
9
+ export declare function resetSankeyWarnings(): void;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ function e(e, t) {}
3
+ function t(e) {}
4
+ //#endregion
5
+ export { t as warnDuplicateSankeyNode, e as warnUnknownSankeyNode };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("../../_internal/ChartDataTable.cjs"),i=require("../../_internal/chartTableData.cjs"),a=require("../../_internal/barSpan.cjs"),o=require("./waterfall-chart.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("recharts");var u={increase:`var(--wim-color-chart-success)`,decrease:`var(--wim-color-chart-danger)`,total:`var(--wim-color-chart-primary)`},d=e=>{let t=0;return(e??[]).map(e=>{let n=a.isFiniteNumber(e?.value)?e.value:0;if(e?.total){let n=t<0?[t,0]:[0,t];return{name:e.name,span:n,kind:`total`,amount:t,running:t}}let r=t;t+=n;let i=r<t?[r,t]:[t,r];return{name:e.name,span:i,kind:n<0?`decrease`:`increase`,amount:n,running:t}})},f=e=>e.kind===`total`||e.amount<0?String(e.amount):`+${e.amount}`,p=({x:e=0,y:t=0,width:n=0,height:r=0,payload:i})=>i?(0,c.jsxs)(`g`,{children:[(0,c.jsx)(`rect`,{x:e,y:t,width:n,height:Math.max(r,1),fill:u[i.kind],rx:2}),(0,c.jsx)(`text`,{className:o.default.value,x:e+n/2,y:t-6,textAnchor:`middle`,children:f(i)})]}):null,m=({data:e,height:a=300,width:s=`100%`,title:u,"aria-label":m})=>{let h=m??u,g=d(e),_=i.stepTable(g.map(e=>({name:e.name,change:f(e),running:e.running})));return(0,c.jsxs)(`div`,{className:`wim-waterfall-chart ${o.default.root}`,style:{width:s},role:h?`figure`:void 0,"aria-label":h,children:[u&&(0,c.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:u}),(0,c.jsx)(`div`,{className:o.default.container,style:{height:a},"aria-hidden":`true`,children:(0,c.jsx)(l.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,c.jsxs)(l.BarChart,{...n.CHART_HIDDEN_A11Y_PROPS,data:g,margin:{top:20,right:30,left:0,bottom:5},children:[(0,c.jsx)(l.CartesianGrid,{...n.CHART_THEME.grid,vertical:!1}),(0,c.jsx)(l.XAxis,{dataKey:`name`,interval:0,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.YAxis,{width:44,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,cursor:n.CHART_THEME.tooltip.cursor}),(0,c.jsx)(l.Bar,{dataKey:`span`,shape:(0,c.jsx)(p,{}),isAnimationActive:!1})]})})}),(0,c.jsx)(r.ChartDataTable,{caption:h,columns:_.columns,rows:_.rows})]})};exports.WaterfallChart=m;
@@ -0,0 +1,53 @@
1
+ import { default as React } from 'react';
2
+ export type WaterfallItem = {
3
+ /** Label for this step, shown on the X axis. */
4
+ name: string;
5
+ /**
6
+ * How much this step adds (positive) or removes (negative) from the running
7
+ * total. On a `total` step this is ignored — the bar is drawn to the running
8
+ * total instead.
9
+ */
10
+ value: number;
11
+ /**
12
+ * Draw this step as a total: a bar from the baseline up to the running total,
13
+ * rather than a floating change. Use it for the opening and closing columns.
14
+ * @default false
15
+ */
16
+ total?: boolean;
17
+ };
18
+ export type WaterfallChartProps = {
19
+ /** The steps, in the order they are applied. */
20
+ data: WaterfallItem[];
21
+ /**
22
+ * The height of the chart in pixels.
23
+ * @default 300
24
+ */
25
+ height?: number;
26
+ /**
27
+ * The width of the chart (e.g., "100%", 500).
28
+ * @default "100%"
29
+ */
30
+ width?: string | number;
31
+ /** Optional title displayed above the chart. */
32
+ title?: string;
33
+ /**
34
+ * Accessible name for the chart. Defaults to `title` when omitted; pass this
35
+ * when the chart has no visible title, or when the title is not descriptive
36
+ * enough on its own.
37
+ */
38
+ "aria-label"?: string;
39
+ };
40
+ /**
41
+ * Shows how a starting number becomes an ending number, one contribution at a
42
+ * time — revenue to profit, last month's headcount to this month's, a budget
43
+ * to what is left of it.
44
+ *
45
+ * **Each bar floats between the running total before and after that step**,
46
+ * which is what a stacked `BarChart` cannot express: stacking shows the parts
47
+ * of one total, not the arithmetic that produced it.
48
+ *
49
+ * Composition Contract:
50
+ * - Managed by: App consumption
51
+ * - Scroll lock: No
52
+ */
53
+ export declare const WaterfallChart: ({ data, height, width, title, "aria-label": ariaLabel, }: WaterfallChartProps) => React.JSX.Element;
@@ -0,0 +1,128 @@
1
+ "use client";
2
+ import { Title as e } from "../../typography/Title/Title.js";
3
+ import { CHART_HIDDEN_A11Y_PROPS as t, CHART_THEME as n } from "../../helpers.js";
4
+ import { ChartDataTable as r } from "../../_internal/ChartDataTable.js";
5
+ import { stepTable as i } from "../../_internal/chartTableData.js";
6
+ import { isFiniteNumber as a } from "../../_internal/barSpan.js";
7
+ import o from "./waterfall-chart.module.js";
8
+ import "react";
9
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
10
+ import { Bar as l, BarChart as u, CartesianGrid as d, ResponsiveContainer as f, Tooltip as p, XAxis as m, YAxis as h } from "recharts";
11
+ //#region src/components/charts/WaterfallChart/WaterfallChart.tsx
12
+ var g = {
13
+ increase: "var(--wim-color-chart-success)",
14
+ decrease: "var(--wim-color-chart-danger)",
15
+ total: "var(--wim-color-chart-primary)"
16
+ }, _ = (e) => {
17
+ let t = 0;
18
+ return (e ?? []).map((e) => {
19
+ let n = a(e?.value) ? e.value : 0;
20
+ if (e?.total) {
21
+ let n = t < 0 ? [t, 0] : [0, t];
22
+ return {
23
+ name: e.name,
24
+ span: n,
25
+ kind: "total",
26
+ amount: t,
27
+ running: t
28
+ };
29
+ }
30
+ let r = t;
31
+ t += n;
32
+ let i = r < t ? [r, t] : [t, r];
33
+ return {
34
+ name: e.name,
35
+ span: i,
36
+ kind: n < 0 ? "decrease" : "increase",
37
+ amount: n,
38
+ running: t
39
+ };
40
+ });
41
+ }, v = (e) => e.kind === "total" || e.amount < 0 ? String(e.amount) : `+${e.amount}`, y = ({ x: e = 0, y: t = 0, width: n = 0, height: r = 0, payload: i }) => i ? /* @__PURE__ */ c("g", { children: [/* @__PURE__ */ s("rect", {
42
+ x: e,
43
+ y: t,
44
+ width: n,
45
+ height: Math.max(r, 1),
46
+ fill: g[i.kind],
47
+ rx: 2
48
+ }), /* @__PURE__ */ s("text", {
49
+ className: o.value,
50
+ x: e + n / 2,
51
+ y: t - 6,
52
+ textAnchor: "middle",
53
+ children: v(i)
54
+ })] }) : null, b = ({ data: a, height: g = 300, width: b = "100%", title: x, "aria-label": S }) => {
55
+ let C = S ?? x, w = _(a), T = i(w.map((e) => ({
56
+ name: e.name,
57
+ change: v(e),
58
+ running: e.running
59
+ })));
60
+ return /* @__PURE__ */ c("div", {
61
+ className: `wim-waterfall-chart ${o.root}`,
62
+ style: { width: b },
63
+ role: C ? "figure" : void 0,
64
+ "aria-label": C,
65
+ children: [
66
+ x && /* @__PURE__ */ s(e, {
67
+ tag: "h3",
68
+ size: "md",
69
+ style: { marginBottom: "var(--wim-spacing-md)" },
70
+ children: x
71
+ }),
72
+ /* @__PURE__ */ s("div", {
73
+ className: o.container,
74
+ style: { height: g },
75
+ "aria-hidden": "true",
76
+ children: /* @__PURE__ */ s(f, {
77
+ width: "100%",
78
+ height: "100%",
79
+ children: /* @__PURE__ */ c(u, {
80
+ ...t,
81
+ data: w,
82
+ margin: {
83
+ top: 20,
84
+ right: 30,
85
+ left: 0,
86
+ bottom: 5
87
+ },
88
+ children: [
89
+ /* @__PURE__ */ s(d, {
90
+ ...n.grid,
91
+ vertical: !1
92
+ }),
93
+ /* @__PURE__ */ s(m, {
94
+ dataKey: "name",
95
+ interval: 0,
96
+ ...n.axis,
97
+ tickLine: !1,
98
+ axisLine: !1
99
+ }),
100
+ /* @__PURE__ */ s(h, {
101
+ width: 44,
102
+ ...n.axis,
103
+ tickLine: !1,
104
+ axisLine: !1
105
+ }),
106
+ /* @__PURE__ */ s(p, {
107
+ contentStyle: n.tooltip.contentStyle,
108
+ cursor: n.tooltip.cursor
109
+ }),
110
+ /* @__PURE__ */ s(l, {
111
+ dataKey: "span",
112
+ shape: /* @__PURE__ */ s(y, {}),
113
+ isAnimationActive: !1
114
+ })
115
+ ]
116
+ })
117
+ })
118
+ }),
119
+ /* @__PURE__ */ s(r, {
120
+ caption: C,
121
+ columns: T.columns,
122
+ rows: T.rows
123
+ })
124
+ ]
125
+ });
126
+ };
127
+ //#endregion
128
+ export { b as WaterfallChart };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_root_1bf2i_3`,t=`_container_1bf2i_6`,n=`_value_1bf2i_14`,r={root:e,container:t,value:n};exports.container=t,exports.default=r,exports.root=e,exports.value=n;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ //#region src/components/charts/WaterfallChart/waterfall-chart.module.scss
3
+ var e = "_root_1bf2i_3", t = "_container_1bf2i_6", n = "_value_1bf2i_14", r = {
4
+ root: e,
5
+ container: t,
6
+ value: n
7
+ };
8
+ //#endregion
9
+ export { t as container, r as default, e as root, n as value };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("./encode.cjs"),i=require("./warn-unencodable-value.cjs"),a=require("./barcode.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={code128:`Code 128`,ean13:`EAN-13`},u=11,d=o.default.forwardRef(({value:e,format:d=`code128`,height:f=64,moduleWidth:p=2,showValue:m=!0,label:h,className:g,..._},v)=>{let{t:y}=t.useWimTranslation(`common`),b=r.encodeBarcode(e,d),x=o.default.useRef(null),[S,C]=o.default.useState(!1);o.default.useLayoutEffect(()=>{let e=x.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>C(e.scrollWidth>e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[b?.modules,p]);let w=n.useMergedRef(v,x);if(!b){i.warnUnencodableValue(e,d,l[d]);let t=y(`barcode.invalid`,{format:l[d]});return(0,c.jsxs)(`div`,{ref:w,"data-invalid":`true`,className:(0,s.default)(`wim-barcode`,a.default.root,a.default.invalid,g),..._,children:[(0,c.jsx)(`span`,{className:a.default.invalidMessage,children:t}),(0,c.jsx)(`span`,{className:a.default.invalidValue,children:e})]})}let T=b.modules.length+u*2,E=T*p,D=u,O=r.toRuns(b.modules).map(([e,t])=>{let n=D;return D+=t,e?{x:n,width:t}:null});return(0,c.jsxs)(`div`,{ref:w,role:`img`,tabIndex:S?0:void 0,"aria-label":h??y(`barcode.aria_label`,{value:b.text}),"data-format":d,className:(0,s.default)(`wim-barcode`,a.default.root,g),..._,children:[(0,c.jsx)(`svg`,{className:a.default.symbol,width:E,height:f,viewBox:`0 0 ${T} ${f}`,preserveAspectRatio:`none`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:O.map(e=>e?(0,c.jsx)(`rect`,{x:e.x,y:0,width:e.width,height:f},e.x):null)}),m?(0,c.jsx)(`span`,{className:a.default.value,children:b.text}):null]})});d.displayName=`Barcode`,exports.Barcode=d;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("./encode.cjs"),i=require("./warn-unencodable-value.cjs"),a=require("./barcode.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={code128:`Code 128`,ean13:`EAN-13`},u=11,d=8,f=.35,p=7,m=o.default.forwardRef(({value:e,format:m=`code128`,height:h=64,moduleWidth:g=2,showValue:_=!0,label:v,className:y,...b},x)=>{let{t:S}=t.useWimTranslation(`common`),C=r.encodeBarcode(e,m),w=o.default.useRef(null),[T,E]=o.default.useState(!1);o.default.useLayoutEffect(()=>{let e=w.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>E(e.scrollWidth>e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C?.modules,g]);let D=n.useMergedRef(x,w);if(!C){i.warnUnencodableValue(e,m,l[m]);let t=S(`barcode.invalid`,{format:l[m]});return(0,c.jsxs)(`div`,{ref:D,"data-invalid":`true`,className:(0,s.default)(`wim-barcode`,a.default.root,a.default.invalid,y),...b,children:[(0,c.jsx)(`span`,{className:a.default.invalidMessage,children:t}),(0,c.jsx)(`span`,{className:a.default.invalidValue,children:e})]})}let O=C.modules.length+u*2,k=O*g,A=u,j=r.toRuns(C.modules).map(([e,t])=>{let n=A;return A+=t,e?{x:n,width:t,module:n-u}:null}),M=m===`ean13`&&_?C.print:void 0,N=M?Math.min(d*g,h*f):0,P=h-N,F=e=>M?M.guards.some(([t,n])=>e.module>=t&&e.module+e.width<=n):!1,I=M?[...[...M.left.text].map((e,t)=>({key:`l${t}`,digit:e,module:M.left.from+t*p+p/2})),...[...M.right.text].map((e,t)=>({key:`r${t}`,digit:e,module:M.right.from+t*p+p/2}))]:[];return(0,c.jsxs)(`div`,{ref:D,role:`img`,tabIndex:T?0:void 0,"aria-label":v??S(`barcode.aria_label`,{value:C.text}),"data-format":m,className:(0,s.default)(`wim-barcode`,a.default.root,y),...b,children:[M?(0,c.jsxs)(`svg`,{className:a.default.symbol,width:k,height:h,viewBox:`0 0 ${k} ${h}`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:[j.map(e=>e?(0,c.jsx)(`rect`,{x:e.x*g,y:0,width:e.width*g,height:F(e)?h:P,"data-guard":F(e)?`true`:void 0},e.x):null),(0,c.jsx)(`text`,{className:a.default.printedDigit,x:(u-1)*g,y:h,textAnchor:`end`,fontSize:N*.86,children:M.lead}),I.map(e=>(0,c.jsx)(`text`,{className:a.default.printedDigit,x:(u+e.module)*g,y:h,textAnchor:`middle`,fontSize:N*.86,children:e.digit},e.key))]}):(0,c.jsx)(`svg`,{className:a.default.symbol,width:k,height:h,viewBox:`0 0 ${O} ${h}`,preserveAspectRatio:`none`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:j.map(e=>e?(0,c.jsx)(`rect`,{x:e.x,y:0,width:e.width,height:h},e.x):null)}),_&&!M?(0,c.jsx)(`span`,{className:a.default.value,children:C.text}):null]})});m.displayName=`Barcode`,exports.Barcode=m;
@@ -11,69 +11,110 @@ import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
11
  var u = {
12
12
  code128: "Code 128",
13
13
  ean13: "EAN-13"
14
- }, d = 11, f = o.forwardRef(({ value: f, format: p = "code128", height: m = 64, moduleWidth: h = 2, showValue: g = !0, label: _, className: v, ...y }, b) => {
15
- let { t: x } = e("common"), S = n(f, p), C = o.useRef(null), [w, T] = o.useState(!1);
14
+ }, d = 11, f = 8, p = .35, m = 7, h = o.forwardRef(({ value: h, format: g = "code128", height: _ = 64, moduleWidth: v = 2, showValue: y = !0, label: b, className: x, ...S }, C) => {
15
+ let { t: w } = e("common"), T = n(h, g), E = o.useRef(null), [D, O] = o.useState(!1);
16
16
  o.useLayoutEffect(() => {
17
- let e = C.current;
17
+ let e = E.current;
18
18
  if (!e || typeof ResizeObserver > "u") return;
19
- let t = () => T(e.scrollWidth > e.clientWidth);
19
+ let t = () => O(e.scrollWidth > e.clientWidth);
20
20
  t();
21
21
  let n = new ResizeObserver(t);
22
22
  return n.observe(e), () => n.disconnect();
23
- }, [S?.modules, h]);
24
- let E = t(b, C);
25
- if (!S) {
26
- i(f, p, u[p]);
27
- let e = x("barcode.invalid", { format: u[p] });
23
+ }, [T?.modules, v]);
24
+ let k = t(C, E);
25
+ if (!T) {
26
+ i(h, g, u[g]);
27
+ let e = w("barcode.invalid", { format: u[g] });
28
28
  return /* @__PURE__ */ l("div", {
29
- ref: E,
29
+ ref: k,
30
30
  "data-invalid": "true",
31
- className: s("wim-barcode", a.root, a.invalid, v),
32
- ...y,
31
+ className: s("wim-barcode", a.root, a.invalid, x),
32
+ ...S,
33
33
  children: [/* @__PURE__ */ c("span", {
34
34
  className: a.invalidMessage,
35
35
  children: e
36
36
  }), /* @__PURE__ */ c("span", {
37
37
  className: a.invalidValue,
38
- children: f
38
+ children: h
39
39
  })]
40
40
  });
41
41
  }
42
- let D = S.modules.length + d * 2, O = D * h, k = d, A = r(S.modules).map(([e, t]) => {
43
- let n = k;
44
- return k += t, e ? {
42
+ let A = T.modules.length + d * 2, j = A * v, M = d, N = r(T.modules).map(([e, t]) => {
43
+ let n = M;
44
+ return M += t, e ? {
45
45
  x: n,
46
- width: t
46
+ width: t,
47
+ module: n - d
47
48
  } : null;
48
- });
49
+ }), P = g === "ean13" && y ? T.print : void 0, F = P ? Math.min(f * v, _ * p) : 0, I = _ - F, L = (e) => P ? P.guards.some(([t, n]) => e.module >= t && e.module + e.width <= n) : !1, R = P ? [...[...P.left.text].map((e, t) => ({
50
+ key: `l${t}`,
51
+ digit: e,
52
+ module: P.left.from + t * m + m / 2
53
+ })), ...[...P.right.text].map((e, t) => ({
54
+ key: `r${t}`,
55
+ digit: e,
56
+ module: P.right.from + t * m + m / 2
57
+ }))] : [];
49
58
  return /* @__PURE__ */ l("div", {
50
- ref: E,
59
+ ref: k,
51
60
  role: "img",
52
- tabIndex: w ? 0 : void 0,
53
- "aria-label": _ ?? x("barcode.aria_label", { value: S.text }),
54
- "data-format": p,
55
- className: s("wim-barcode", a.root, v),
56
- ...y,
57
- children: [/* @__PURE__ */ c("svg", {
61
+ tabIndex: D ? 0 : void 0,
62
+ "aria-label": b ?? w("barcode.aria_label", { value: T.text }),
63
+ "data-format": g,
64
+ className: s("wim-barcode", a.root, x),
65
+ ...S,
66
+ children: [P ? /* @__PURE__ */ l("svg", {
67
+ className: a.symbol,
68
+ width: j,
69
+ height: _,
70
+ viewBox: `0 0 ${j} ${_}`,
71
+ shapeRendering: "crispEdges",
72
+ "aria-hidden": "true",
73
+ children: [
74
+ N.map((e) => e ? /* @__PURE__ */ c("rect", {
75
+ x: e.x * v,
76
+ y: 0,
77
+ width: e.width * v,
78
+ height: L(e) ? _ : I,
79
+ "data-guard": L(e) ? "true" : void 0
80
+ }, e.x) : null),
81
+ /* @__PURE__ */ c("text", {
82
+ className: a.printedDigit,
83
+ x: (d - 1) * v,
84
+ y: _,
85
+ textAnchor: "end",
86
+ fontSize: F * .86,
87
+ children: P.lead
88
+ }),
89
+ R.map((e) => /* @__PURE__ */ c("text", {
90
+ className: a.printedDigit,
91
+ x: (d + e.module) * v,
92
+ y: _,
93
+ textAnchor: "middle",
94
+ fontSize: F * .86,
95
+ children: e.digit
96
+ }, e.key))
97
+ ]
98
+ }) : /* @__PURE__ */ c("svg", {
58
99
  className: a.symbol,
59
- width: O,
60
- height: m,
61
- viewBox: `0 0 ${D} ${m}`,
100
+ width: j,
101
+ height: _,
102
+ viewBox: `0 0 ${A} ${_}`,
62
103
  preserveAspectRatio: "none",
63
104
  shapeRendering: "crispEdges",
64
105
  "aria-hidden": "true",
65
- children: A.map((e) => e ? /* @__PURE__ */ c("rect", {
106
+ children: N.map((e) => e ? /* @__PURE__ */ c("rect", {
66
107
  x: e.x,
67
108
  y: 0,
68
109
  width: e.width,
69
- height: m
110
+ height: _
70
111
  }, e.x) : null)
71
- }), g ? /* @__PURE__ */ c("span", {
112
+ }), y && !P ? /* @__PURE__ */ c("span", {
72
113
  className: a.value,
73
- children: S.text
114
+ children: T.text
74
115
  }) : null]
75
116
  });
76
117
  });
77
- f.displayName = "Barcode";
118
+ h.displayName = "Barcode";
78
119
  //#endregion
79
- export { f as Barcode };
120
+ export { h as Barcode };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_1goq6_34`,t=`_symbol_1goq6_64`,n=`_value_1goq6_78`,r=`_invalid_1goq6_94`,i=`_invalidMessage_1goq6_100`,a=`_invalidValue_1goq6_106`,o={root:e,symbol:t,value:n,invalid:r,invalidMessage:i,invalidValue:a};exports.default=o,exports.invalid=r,exports.invalidMessage=i,exports.invalidValue=a,exports.root=e,exports.symbol=t,exports.value=n;
2
+ var e=`_root_4sqdu_34`,t=`_symbol_4sqdu_64`,n=`_printedDigit_4sqdu_82`,r=`_value_4sqdu_92`,i=`_invalid_4sqdu_108`,a=`_invalidMessage_4sqdu_114`,o=`_invalidValue_4sqdu_120`,s={root:e,symbol:t,printedDigit:n,value:r,invalid:i,invalidMessage:a,invalidValue:o};exports.default=s,exports.invalid=i,exports.invalidMessage=a,exports.invalidValue=o,exports.printedDigit=n,exports.root=e,exports.symbol=t,exports.value=r;
@@ -1,12 +1,13 @@
1
1
  "use client";
2
2
  //#region src/components/data-display/Barcode/barcode.module.scss
3
- var e = "_root_1goq6_34", t = "_symbol_1goq6_64", n = "_value_1goq6_78", r = "_invalid_1goq6_94", i = "_invalidMessage_1goq6_100", a = "_invalidValue_1goq6_106", o = {
3
+ var e = "_root_4sqdu_34", t = "_symbol_4sqdu_64", n = "_printedDigit_4sqdu_82", r = "_value_4sqdu_92", i = "_invalid_4sqdu_108", a = "_invalidMessage_4sqdu_114", o = "_invalidValue_4sqdu_120", s = {
4
4
  root: e,
5
5
  symbol: t,
6
- value: n,
7
- invalid: r,
8
- invalidMessage: i,
9
- invalidValue: a
6
+ printedDigit: n,
7
+ value: r,
8
+ invalid: i,
9
+ invalidMessage: a,
10
+ invalidValue: o
10
11
  };
11
12
  //#endregion
12
- export { o as default, r as invalid, i as invalidMessage, a as invalidValue, e as root, t as symbol, n as value };
13
+ export { s as default, i as invalid, a as invalidMessage, o as invalidValue, n as printedDigit, e as root, t as symbol, r as value };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`212222.222122.222221.121223.121322.131222.122213.122312.132212.221213.221312.231212.112232.122132.122231.113222.123122.123221.223211.221132.221231.213212.223112.312131.311222.321122.321221.312212.322112.322211.212123.212321.232121.111323.131123.131321.112313.132113.132311.211313.231113.231311.112133.112331.132131.113123.113321.133121.313121.211331.231131.213113.213311.213131.311123.311321.331121.312113.312311.332111.314111.221411.431111.111224.111422.121124.121421.141122.141221.112214.112412.122114.122411.142112.142211.241211.221114.413111.241112.134111.111242.121142.121241.114212.124112.124211.411212.421112.421211.212141.214121.412121.111143.111341.131141.114113.114311.411113.411311.113141.114131.311141.411131.211412.211214.211232`.split(`.`),t=`2331112`,n=104,r=105,i=103,a=e=>{let t=``;for(let n=0;n<e.length;n+=1)t+=(n%2==0?`1`:`0`).repeat(Number(e[n]));return t},o=o=>{if(o.length===0)return null;let s=[];if(/^\d+$/.test(o)&&o.length%2==0){s.push(r);for(let e=0;e<o.length;e+=2)s.push(Number(o.slice(e,e+2)))}else{if(!/^[\x20-\x7e]+$/.test(o))return null;s.push(n);for(let e of o)s.push(e.charCodeAt(0)-32)}let c=s.reduce((e,t,n)=>e+t*(n===0?1:n),0)%i;return s.push(c),{modules:s.map(t=>a(e[t])).join(``)+a(t),text:o}},s=[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],c=[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],l=[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],u=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`],d=`101`,f=`01010`,p=e=>{let t=0;for(let n=0;n<12;n+=1)t+=Number(e[n])*(n%2==0?1:3);return(10-t%10)%10},m=e=>{if(!/^\d{12,13}$/.test(e))return null;let t=e.slice(0,12),n=p(t);if(e.length===13&&Number(e[12])!==n)return null;let r=`${t}${n}`,i=u[Number(r[0])],a=``;for(let e=0;e<6;e+=1){let t=Number(r[e+1]);a+=i[e]===`L`?s[t]:c[t]}let o=``;for(let e=7;e<13;e+=1)o+=l[Number(r[e])];return{modules:`${d}${a}${f}${o}${d}`,text:r}},h=(e,t)=>t===`ean13`?m(e):o(e),g=e=>{let t=[];for(let n of e){let e=n===`1`,r=t[t.length-1];r&&r[0]===e?r[1]+=1:t.push([e,1])}return t};exports.ean13CheckDigit=p,exports.encodeBarcode=h,exports.toRuns=g;
2
+ var e=`212222.222122.222221.121223.121322.131222.122213.122312.132212.221213.221312.231212.112232.122132.122231.113222.123122.123221.223211.221132.221231.213212.223112.312131.311222.321122.321221.312212.322112.322211.212123.212321.232121.111323.131123.131321.112313.132113.132311.211313.231113.231311.112133.112331.132131.113123.113321.133121.313121.211331.231131.213113.213311.213131.311123.311321.331121.312113.312311.332111.314111.221411.431111.111224.111422.121124.121421.141122.141221.112214.112412.122114.122411.142112.142211.241211.221114.413111.241112.134111.111242.121142.121241.114212.124112.124211.411212.421112.421211.212141.214121.412121.111143.111341.131141.114113.114311.411113.411311.113141.114131.311141.411131.211412.211214.211232`.split(`.`),t=`2331112`,n=104,r=105,i=103,a=e=>{let t=``;for(let n=0;n<e.length;n+=1)t+=(n%2==0?`1`:`0`).repeat(Number(e[n]));return t},o=o=>{if(o.length===0)return null;let s=[];if(/^\d+$/.test(o)&&o.length%2==0){s.push(r);for(let e=0;e<o.length;e+=2)s.push(Number(o.slice(e,e+2)))}else{if(!/^[\x20-\x7e]+$/.test(o))return null;s.push(n);for(let e of o)s.push(e.charCodeAt(0)-32)}let c=s.reduce((e,t,n)=>e+t*(n===0?1:n),0)%i;return s.push(c),{modules:s.map(t=>a(e[t])).join(``)+a(t),text:o}},s=[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],c=[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],l=[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],u=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`],d=`101`,f=`01010`,p=e=>{let t=0;for(let n=0;n<12;n+=1)t+=Number(e[n])*(n%2==0?1:3);return(10-t%10)%10},m=e=>{if(!/^\d{12,13}$/.test(e))return null;let t=e.slice(0,12),n=p(t);if(e.length===13&&Number(e[12])!==n)return null;let r=`${t}${n}`,i=u[Number(r[0])],a=``;for(let e=0;e<6;e+=1){let t=Number(r[e+1]);a+=i[e]===`L`?s[t]:c[t]}let o=``;for(let e=7;e<13;e+=1)o+=l[Number(r[e])];return{modules:`${d}${a}${f}${o}${d}`,text:r,print:{guards:[[0,3],[45,50],[92,95]],lead:r[0],left:{text:r.slice(1,7),from:3,to:45},right:{text:r.slice(7),from:50,to:92}}}},h=(e,t)=>t===`ean13`?m(e):o(e),g=e=>{let t=[];for(let n of e){let e=n===`1`,r=t[t.length-1];r&&r[0]===e?r[1]+=1:t.push([e,1])}return t};exports.ean13CheckDigit=p,exports.encodeBarcode=h,exports.toRuns=g;
@@ -8,11 +8,47 @@
8
8
  * 体系を増やすのは後方互換なので、要求が出てから足せばよい。
9
9
  */
10
10
  export type BarcodeFormat = "code128" | "ean13";
11
+ /**
12
+ * EAN-13 の正規の印字レイアウト(T233)。
13
+ *
14
+ * 数字をバーの下へまとめて置くのは**近いけれど別の物**で、店頭の商品と見比べると
15
+ * 違って見える。正規の印字では **ガードバーが数字の帯の底まで伸び**、**先頭桁が
16
+ * シンボルの左外**に出て、残りが左右半分それぞれの下に 6 桁ずつ付く。
17
+ *
18
+ * **スキャナが読むのはバーだけなので、モジュール列は 1 文字も変えない。**
19
+ * ここに出すのは「どこに何を印字するか」だけで、位置はすべてモジュール座標
20
+ * (シンボルの先頭を 0 とする添字)で返す ── 画素は器の幅で変わるが、
21
+ * モジュールの割り付けは体系が決めていて変わらないため。
22
+ */
23
+ export type Ean13PrintLayout = {
24
+ /** 下へ伸ばすガードバーのモジュール範囲 `[開始, 終了)`。左・中央・右の 3 組。 */
25
+ guards: ReadonlyArray<readonly [number, number]>;
26
+ /** シンボルの左外に置く 1 桁目。 */
27
+ lead: string;
28
+ /** 左半分の 6 桁と、その下に敷くモジュール範囲。 */
29
+ left: {
30
+ text: string;
31
+ from: number;
32
+ to: number;
33
+ };
34
+ /** 右半分の 6 桁と、その下に敷くモジュール範囲。 */
35
+ right: {
36
+ text: string;
37
+ from: number;
38
+ to: number;
39
+ };
40
+ };
11
41
  export type EncodedBarcode = {
12
42
  /** 1 = bar, 0 = space. One character per module. */
13
43
  modules: string;
14
44
  /** Human-readable interpretation printed under the bars. */
15
45
  text: string;
46
+ /**
47
+ * How the digits are printed, for the formats that specify it. Code 128 does
48
+ * not, so it stays undefined and the value is printed under the bars as one
49
+ * run of text.
50
+ */
51
+ print?: Ean13PrintLayout;
16
52
  };
17
53
  /** Test seam: the raw pattern table, so its invariants can be measured. */
18
54
  export declare const code128Patterns: () => readonly string[];
@@ -81,7 +81,25 @@ var e = /* @__PURE__ */ "212222.222122.222221.121223.121322.131222.122213.122312
81
81
  for (let e = 7; e < 13; e += 1) o += l[Number(r[e])];
82
82
  return {
83
83
  modules: `${d}${a}${f}${o}${d}`,
84
- text: r
84
+ text: r,
85
+ print: {
86
+ guards: [
87
+ [0, 3],
88
+ [45, 50],
89
+ [92, 95]
90
+ ],
91
+ lead: r[0],
92
+ left: {
93
+ text: r.slice(1, 7),
94
+ from: 3,
95
+ to: 45
96
+ },
97
+ right: {
98
+ text: r.slice(7),
99
+ from: 50,
100
+ to: 92
101
+ }
102
+ }
85
103
  };
86
104
  }, h = (e, t) => t === "ean13" ? m(e) : o(e), g = (e) => {
87
105
  let t = [];
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../Avatar/Avatar.cjs"),i=require("./comment.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=a.default.forwardRef(({id:e,author:c,timestamp:l,children:u,replies:d,edited:f=!1,replyingTo:p,editingId:m,composer:h,editor:g,onReply:_,onEdit:v,onDelete:y,actions:b,className:x,...S},C)=>{let{t:w}=t.useWimTranslation(`common`),T=`${e}-author`,E=m!==void 0&&m===e,D=p!==void 0&&p===e,O={reply:_,edit:v,delete:y},k=[`reply`,`edit`,`delete`].filter(e=>O[e]!==void 0);return(0,s.jsxs)(`article`,{ref:C,"aria-labelledby":T,className:(0,o.default)(`wim-comment`,i.default.root,x),...S,children:[(0,s.jsxs)(`div`,{className:i.default.head,children:[(0,s.jsx)(r.Avatar,{src:c.avatarSrc,initials:c.initials,size:`sm`,alt:``,"aria-hidden":`true`}),(0,s.jsxs)(`div`,{className:i.default.meta,children:[(0,s.jsx)(`span`,{id:T,className:i.default.author,children:c.name}),c.badge&&(0,s.jsx)(`span`,{className:i.default.badge,children:c.badge}),l&&(0,s.jsx)(`span`,{className:i.default.timestamp,children:l}),f&&(0,s.jsx)(`span`,{className:i.default.edited,children:w(`comment.edited`)})]})]}),(0,s.jsx)(`div`,{className:i.default.body,children:E?g:u}),(k.length>0||b)&&(0,s.jsxs)(`div`,{className:i.default.actions,children:[k.map(t=>(0,s.jsxs)(`button`,{type:`button`,className:i.default.action,onClick:()=>O[t]?.(e),children:[w(`comment.${t}`),(0,s.jsxs)(n.VisuallyHidden,{children:[` `,w(`comment.action_context`,{name:c.name})]})]},t)),b]}),D&&h&&(0,s.jsx)(`div`,{className:i.default.composer,children:h}),d&&(0,s.jsx)(`ul`,{className:i.default.replies,children:a.default.Children.map(d,(e,t)=>(0,s.jsx)(`li`,{className:i.default.reply,children:e},t))})]})});c.displayName=`Comment`,exports.Comment=c;