@nadicodeai/ui 12.1.146 → 12.1.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -45,7 +45,9 @@ and `lint` checks. A component change a person can see goes through
45
45
  an operating system, a messaging channel or a sign-in provider is its icon in
46
46
  Iconify's `logos` set (`platform-mark.tsx`).
47
47
  - **Charts** are stock shadcn registry items; the deliberate deviations are held
48
- by `tests/guards/chart-kit.test.ts`. A chart the kit lacks is pulled from
48
+ by `tests/guards/chart-kit.test.ts`, and what only a browser lays out, such as
49
+ a category axis's labels, by the browser suite in `tests/visual/`, which
50
+ post-merge's `test (website, packages)` job runs. A chart the kit lacks is pulled from
49
51
  `https://ui.shadcn.com/r/styles/new-york-v4/<name>.json`.
50
52
  - **Releases.** No change names a version; the publish picks it after merge:
51
53
  `../../docs/agents/publish.md`.
@@ -11,7 +11,7 @@ declare function signedAxis(data: readonly Record<string, number | string>[], va
11
11
  * @instead Never encode a loss as a share. An unsigned ranking is the compact `Progress` ranking or a `DataTable`.
12
12
  * @behaviour Horizontal bars from a 1.5 px zero line: favourable values to the right in success with right corners rounded, unfavourable to the left in destructive with left corners rounded.
13
13
  * @words The money unit in the period or the axis. Losses stay negative, written with a true minus: −€360.
14
- * @access Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line and only past that is cut with an ellipsis, whole in the tooltip.
14
+ * @access Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line where its row holds two lines and is cut with an ellipsis past what its lines hold, whole in the tooltip, so no label runs into its neighbour.
15
15
  */
16
16
  declare function ChartBarHorizontal({ title, period, controls, link, summary, aside, footer, headingLevel, data, xKey, valueKey, displayKey, categoryDisplayKey, positiveLabel, negativeLabel, valueFormatter, axisFormatter, emptyState, size, className, }: Omit<ChartCardProps, "series" | "entityColorMap" | "otherLabel"> & {
17
17
  valueKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"chart-bar-horizontal.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-horizontal.tsx"],"names":[],"mappings":"AAaA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAoCjC,iBAAS,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM;;;EAqCrF;AAED;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAsC,EACtC,aAAa,EACb,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,gBAAgB,GAAG,YAAY,CAAC,GAAG;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,+BA+GA;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"chart-bar-horizontal.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-horizontal.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAoCjC,iBAAS,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM;;;EAqCrF;AAED;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAsC,EACtC,aAAa,EACb,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,gBAAgB,GAAG,YAAY,CAAC,GAAG;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,+BA+GA;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // Pulled from the shadcn registry item `chart-bar-horizontal`.
2
2
  "use client";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { Bar, BarChart, CartesianGrid, ReferenceLine, Text, XAxis, YAxis } from "recharts";
4
+ import { Bar, BarChart, CartesianGrid, ReferenceLine, Text, XAxis, YAxis, } from "recharts";
5
5
  import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, } from "./chart.js";
6
6
  import { niceAxisMax, niceAxisTicks, niceStep } from "./chart-axis.js";
7
7
  import { CHART_LEGEND_CLASS, ChartCard, chartPlotClassName, defaultValueFormatter, } from "./chart-card.js";
@@ -9,18 +9,20 @@ const POSITIVE_KEY = "__positive";
9
9
  const NEGATIVE_KEY = "__negative";
10
10
  const POSITIVE_BAR_COLOR = "var(--success)";
11
11
  const NEGATIVE_BAR_COLOR = "var(--destructive)";
12
+ const TWO_LINE_ROW_HEIGHT = 28;
12
13
  /**
13
14
  * Recharts keeps only SVG attributes from a `tick` object, so `maxLines` reaches
14
- * its `Text` only through a tick it renders: up to two lines, then an ellipsis.
15
+ * its `Text` only through a tick it renders.
15
16
  */
16
17
  function CategoryTick({ payload, ...props }) {
17
- return (_jsx(Text, { ...props, maxLines: 2, children: payload.value }));
18
+ const rowHeight = Number(props.height) / props.visibleTicksCount;
19
+ return (_jsx(Text, { ...props, maxLines: rowHeight >= TWO_LINE_ROW_HEIGHT ? 2 : 1, children: payload.value }));
18
20
  }
19
- /** About one 12 px character, and the bounds that keep a name whole on two lines without starving the bars. */
21
+ /** About one 12 px character, and the bounds that keep a long name readable without starving the bars. */
20
22
  const CATEGORY_CHAR_WIDTH = 6.6;
21
23
  const CATEGORY_AXIS_MIN = 64;
22
24
  const CATEGORY_AXIS_MAX = 128;
23
- /** The category axis as wide as its longest name up to the bound; a longer name wraps to a second line. */
25
+ /** The category axis as wide as its longest name up to the bound; a longer name wraps or is cut, as `CategoryTick` decides. */
24
26
  function categoryAxisWidth(data, xKey) {
25
27
  const longest = data.reduce((most, datum) => Math.max(most, String(datum[xKey] ?? "").length), 0);
26
28
  return Math.min(CATEGORY_AXIS_MAX, Math.max(CATEGORY_AXIS_MIN, Math.ceil(longest * CATEGORY_CHAR_WIDTH) + 16));
@@ -62,7 +64,7 @@ function signedAxis(data, valueKey) {
62
64
  * @instead Never encode a loss as a share. An unsigned ranking is the compact `Progress` ranking or a `DataTable`.
63
65
  * @behaviour Horizontal bars from a 1.5 px zero line: favourable values to the right in success with right corners rounded, unfavourable to the left in destructive with left corners rounded.
64
66
  * @words The money unit in the period or the axis. Losses stay negative, written with a true minus: −€360.
65
- * @access Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line and only past that is cut with an ellipsis, whole in the tooltip.
67
+ * @access Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line where its row holds two lines and is cut with an ellipsis past what its lines hold, whole in the tooltip, so no label runs into its neighbour.
66
68
  */
67
69
  function ChartBarHorizontal({ title, period, controls, link, summary, aside, footer, headingLevel, data, xKey, valueKey, displayKey, categoryDisplayKey, positiveLabel, negativeLabel, valueFormatter = defaultValueFormatter, axisFormatter, emptyState, size = "default", className, }) {
68
70
  const axis = signedAxis(data, valueKey);
@@ -1574,7 +1574,7 @@ export const USAGE = [
1574
1574
  instead: "Never encode a loss as a share. An unsigned ranking is the compact `Progress` ranking or a `DataTable`.",
1575
1575
  behaviour: "Horizontal bars from a 1.5 px zero line: favourable values to the right in success with right corners rounded, unfavourable to the left in destructive with left corners rounded.",
1576
1576
  words: "The money unit in the period or the axis. Losses stay negative, written with a true minus: −€360.",
1577
- access: "Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line and only past that is cut with an ellipsis, whole in the tooltip.",
1577
+ access: "Each bar's sign is in its position and its tooltip, never only its colour. Category labels are text, readable without hue: the axis is as wide as the longest label up to 128 px, a longer one wraps to a second line where its row holds two lines and is cut with an ellipsis past what its lines hold, whole in the tooltip, so no label runs into its neighbour.",
1578
1578
  },
1579
1579
  {
1580
1580
  name: "ChartBarMultiple",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadicodeai/ui",
3
- "version": "12.1.146",
3
+ "version": "12.1.147",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -74,6 +74,7 @@
74
74
  "check:static": "npm run check",
75
75
  "pretest": "npm run build",
76
76
  "test": "node ../../tools/workspace/heavy-slots.mjs --skip-if-filtered -- vitest run",
77
+ "test:visual": "node ../../tools/workspace/heavy-slots.mjs -- playwright test --config playwright.visual.config.ts",
77
78
  "check:export-targets": "node ../../tools/release/check-export-targets.mjs",
78
79
  "test:distribution": "node ../../tools/release/package-smoke-test.mjs"
79
80
  },
@@ -83,7 +84,7 @@
83
84
  "@base-ui/react": "^1.9.0",
84
85
  "@iconify-icons/logos": "^2.0.3",
85
86
  "@iconify/react": "^6.0.2",
86
- "@nadicodeai/design-system": "12.1.146",
87
+ "@nadicodeai/design-system": "12.1.147",
87
88
  "@tanstack/react-table": "^9.3.1",
88
89
  "@vgpu/wgsl": "0.6.0",
89
90
  "class-variance-authority": "^0.7.1",
@@ -118,7 +119,9 @@
118
119
  "@nadicodeai/eslint-config": "*",
119
120
  "@nadicodeai/eslint-plugin": "*",
120
121
  "@nadicodeai/oxlint-config": "*",
122
+ "@nadicodeai/static-design-server": "*",
121
123
  "@nadicodeai/test-support": "*",
124
+ "@playwright/test": "^1.64.1",
122
125
  "@stryker-mutator/core": "10.0.0",
123
126
  "@stryker-mutator/vitest-runner": "10.0.0",
124
127
  "@tailwindcss/postcss": "^4.3.3",