@wallarm-org/design-system 0.73.0 → 0.74.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 (90) hide show
  1. package/dist/components/Attribute/AttributeValue.js +1 -1
  2. package/dist/components/ButtonBase/classes.d.ts +1 -1
  3. package/dist/components/ButtonBase/classes.js +12 -1
  4. package/dist/components/InlineEdit/InlineEditControl.js +11 -4
  5. package/dist/components/InlineEdit/InlineEditInput.js +1 -1
  6. package/dist/components/InlineEdit/InlineEditNumber.js +1 -1
  7. package/dist/components/InlineEdit/InlineEditPreviewValue.js +1 -1
  8. package/dist/components/InlineEdit/InlineEditSelect.js +1 -0
  9. package/dist/components/InlineEdit/InlineEditTextarea.js +1 -1
  10. package/dist/components/InlineEdit/InlineEditTime.js +1 -1
  11. package/dist/components/InlineEdit/classes.js +3 -3
  12. package/dist/components/Input/classes.d.ts +1 -1
  13. package/dist/components/Input/classes.js +3 -2
  14. package/dist/components/InputGroup/InputGroup.d.ts +1 -1
  15. package/dist/components/InputGroup/InputGroup.js +2 -1
  16. package/dist/components/NumberInput/classes.d.ts +4 -4
  17. package/dist/components/NumberInput/classes.js +8 -4
  18. package/dist/components/Select/SelectButton.d.ts +1 -1
  19. package/dist/components/Select/SelectButton.js +2 -1
  20. package/dist/components/Select/SelectInput/SelectInput.d.ts +1 -1
  21. package/dist/components/Select/SelectInput/SelectInput.js +2 -1
  22. package/dist/components/Select/SelectInput/SelectInputItemRenderer.d.ts +2 -2
  23. package/dist/components/Select/SelectInput/SelectInputItemRenderer.js +2 -1
  24. package/dist/components/Select/SelectInput/SelectInputOverflowRenderer.d.ts +1 -1
  25. package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.d.ts +50 -0
  26. package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.js → HorizontalBarStack/HorizontalBarStack.figma.js} +16 -8
  27. package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.js +239 -0
  28. package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.d.ts +14 -0
  29. package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.js +56 -0
  30. package/dist/components/SimpleCharts/HorizontalBarStack/classes.d.ts +19 -0
  31. package/dist/components/SimpleCharts/HorizontalBarStack/classes.js +49 -0
  32. package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/constants.d.ts +2 -2
  33. package/dist/components/SimpleCharts/HorizontalBarStack/constants.js +16 -0
  34. package/dist/components/SimpleCharts/HorizontalBarStack/index.d.ts +2 -0
  35. package/dist/components/SimpleCharts/HorizontalBarStack/index.js +2 -0
  36. package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.d.ts +2 -2
  37. package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.js +2 -2
  38. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.d.ts +4 -0
  39. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.js +3 -7
  40. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.d.ts +7 -13
  41. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.js +3 -16
  42. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.d.ts +5 -1
  43. package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.js +9 -28
  44. package/dist/components/SimpleCharts/LineChart/classes.d.ts +0 -6
  45. package/dist/components/SimpleCharts/LineChart/classes.js +1 -7
  46. package/dist/components/SimpleCharts/Metric/Metric.d.ts +14 -0
  47. package/dist/components/SimpleCharts/Metric/Metric.figma.d.ts +1 -0
  48. package/dist/components/SimpleCharts/Metric/Metric.figma.js +49 -0
  49. package/dist/components/SimpleCharts/Metric/Metric.js +17 -0
  50. package/dist/components/SimpleCharts/Metric/MetricCaption.d.ts +6 -0
  51. package/dist/components/SimpleCharts/Metric/MetricCaption.js +16 -0
  52. package/dist/components/SimpleCharts/Metric/MetricDelta.d.ts +10 -0
  53. package/dist/components/SimpleCharts/Metric/MetricDelta.js +12 -0
  54. package/dist/components/SimpleCharts/Metric/MetricHeader.d.ts +9 -0
  55. package/dist/components/SimpleCharts/Metric/MetricHeader.js +16 -0
  56. package/dist/components/SimpleCharts/Metric/MetricSkeleton.d.ts +12 -0
  57. package/dist/components/SimpleCharts/Metric/MetricSkeleton.js +31 -0
  58. package/dist/components/SimpleCharts/Metric/MetricTotal.d.ts +12 -0
  59. package/dist/components/SimpleCharts/Metric/MetricTotal.js +36 -0
  60. package/dist/components/SimpleCharts/Metric/MetricValue.d.ts +9 -0
  61. package/dist/components/SimpleCharts/Metric/MetricValue.js +18 -0
  62. package/dist/components/SimpleCharts/Metric/classes.d.ts +8 -0
  63. package/dist/components/SimpleCharts/Metric/classes.js +9 -0
  64. package/dist/components/SimpleCharts/Metric/index.d.ts +7 -0
  65. package/dist/components/SimpleCharts/Metric/index.js +7 -0
  66. package/dist/components/SimpleCharts/index.d.ts +2 -1
  67. package/dist/components/SimpleCharts/index.js +2 -1
  68. package/dist/components/SimpleCharts/internal/ChartDelta.d.ts +22 -0
  69. package/dist/components/SimpleCharts/internal/ChartDelta.js +31 -0
  70. package/dist/components/SimpleCharts/internal/ChartHoverCard.d.ts +26 -0
  71. package/dist/components/SimpleCharts/internal/ChartHoverCard.js +57 -0
  72. package/dist/components/SimpleCharts/internal/index.d.ts +2 -0
  73. package/dist/components/SimpleCharts/internal/index.js +2 -0
  74. package/dist/components/Slider/Slider.d.ts +1 -1
  75. package/dist/components/Slider/classes.d.ts +2 -3
  76. package/dist/components/TemporalCore/props.d.ts +1 -1
  77. package/dist/components/Textarea/classes.d.ts +2 -2
  78. package/dist/components/Textarea/classes.js +4 -2
  79. package/dist/components/Textarea/useAutoResize.d.ts +1 -0
  80. package/dist/components/Textarea/useAutoResize.js +5 -4
  81. package/dist/metadata/components.json +2425 -465
  82. package/package.json +1 -1
  83. package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.d.ts +0 -30
  84. package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.js +0 -132
  85. package/dist/components/SimpleCharts/HorizontalBar/classes.d.ts +0 -11
  86. package/dist/components/SimpleCharts/HorizontalBar/classes.js +0 -12
  87. package/dist/components/SimpleCharts/HorizontalBar/constants.js +0 -16
  88. package/dist/components/SimpleCharts/HorizontalBar/index.d.ts +0 -1
  89. package/dist/components/SimpleCharts/HorizontalBar/index.js +0 -1
  90. /package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.d.ts → HorizontalBarStack/HorizontalBarStack.figma.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -1,30 +0,0 @@
1
- import type { FC, HTMLAttributes, Ref } from 'react';
2
- import type { TestableProps } from '../../../utils/testId';
3
- import type { ChartColor } from '../types';
4
- export interface HorizontalBarDatum {
5
- /** Legend label, React key, and `data-name` hook. */
6
- name: string;
7
- /** Segment size; proportional to the bar total. */
8
- value: number;
9
- /** Built-in palette; resolves via `resolveChartColor`. Omitted → auto-assigned by index. */
10
- color?: ChartColor;
11
- /** Tailwind `bg-*` escape hatch; wins over `color` (inline fill is skipped). */
12
- className?: string;
13
- }
14
- export interface HorizontalBarProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
15
- ref?: Ref<HTMLDivElement>;
16
- /** Segments + legend. One array drives both, so colors stay in sync. */
17
- data: HorizontalBarDatum[];
18
- /** Headline number, rendered as `value.toLocaleString('en-US')`. Omitted → header hidden. */
19
- value?: number;
20
- /** Delta chip. Rendered as an internal Badge (arrow + number). Omitted → no chip. */
21
- delta?: {
22
- value: number;
23
- trend?: 'up' | 'down';
24
- };
25
- /** Bar denominator. `> sum(data.value)` → grey remainder tail. Default: `sum(data.value)`. */
26
- total?: number;
27
- /** Show/hide the legend. Default: true. */
28
- legend?: boolean;
29
- }
30
- export declare const HorizontalBar: FC<HorizontalBarProps>;
@@ -1,132 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo } from "react";
3
- import { ArrowDown, ArrowUp } from "../../../icons/index.js";
4
- import { cn } from "../../../utils/cn.js";
5
- import { Badge } from "../../Badge/index.js";
6
- import { resolveChartColor } from "../lib/chartPalette.js";
7
- import { horizontalBarBarClasses, horizontalBarBarWrapperClasses, horizontalBarHeaderClasses, horizontalBarLegendClasses, horizontalBarLegendDotClasses, horizontalBarLegendItemClasses, horizontalBarLegendLabelClasses, horizontalBarRemainderClasses, horizontalBarRootClasses, horizontalBarSegmentClasses, horizontalBarValueClasses } from "./classes.js";
8
- import { resolveSegments } from "./lib/resolveSegments.js";
9
- const formatNumber = (n)=>n.toLocaleString('en-US');
10
- const HorizontalBar = ({ data, value, delta, total, legend = true, className, ref, 'data-testid': testId, ...props })=>{
11
- const segments = useMemo(()=>resolveSegments(data, total), [
12
- data,
13
- total
14
- ]);
15
- const slotTestId = (slot)=>testId ? `${testId}--${slot}` : void 0;
16
- const legendSegments = useMemo(()=>segments.filter((s)=>!s.isRemainder), [
17
- segments
18
- ]);
19
- const barAriaLabel = useMemo(()=>legend ? void 0 : legendSegments.length ? legendSegments.map((s)=>`${s.key} ${formatNumber(s.value)}`).join(', ') : void 0, [
20
- legend,
21
- legendSegments
22
- ]);
23
- const hasDuplicateNames = useMemo(()=>{
24
- const seen = new Set();
25
- for (const d of data){
26
- if (seen.has(d.name)) return true;
27
- seen.add(d.name);
28
- }
29
- return false;
30
- }, [
31
- data
32
- ]);
33
- useEffect(()=>{
34
- if (hasDuplicateNames && 'production' !== process.env.NODE_ENV) console.warn("[HorizontalBar] `data` contains duplicate `name` values. Names are used as the React key and the `data-name` hook — duplicates cause key collisions and ambiguous selectors. Provide unique names.");
35
- }, [
36
- hasDuplicateNames
37
- ]);
38
- const hasBar = data.length > 0;
39
- const hasValue = 'number' == typeof value;
40
- const hasDelta = !!delta;
41
- const deltaDirection = delta ? delta.trend ?? (delta.value >= 0 ? 'up' : 'down') : null;
42
- const deltaAbs = delta ? Math.abs(delta.value) : 0;
43
- return /*#__PURE__*/ jsxs("div", {
44
- ...props,
45
- ref: ref,
46
- "data-slot": "horizontal-bar",
47
- "data-testid": testId,
48
- className: cn(horizontalBarRootClasses, className),
49
- children: [
50
- (hasValue || hasDelta) && /*#__PURE__*/ jsxs("div", {
51
- "data-slot": "horizontal-bar-header",
52
- "data-testid": slotTestId('header'),
53
- className: horizontalBarHeaderClasses,
54
- children: [
55
- hasValue && /*#__PURE__*/ jsx("span", {
56
- "data-slot": "horizontal-bar-value",
57
- "data-testid": slotTestId('value'),
58
- className: horizontalBarValueClasses,
59
- children: formatNumber(value)
60
- }),
61
- delta && /*#__PURE__*/ jsxs(Badge, {
62
- type: "secondary",
63
- color: "w-orange",
64
- size: "medium",
65
- role: "img",
66
- "aria-label": `${deltaDirection} ${formatNumber(deltaAbs)}`,
67
- children: [
68
- 'up' === deltaDirection ? /*#__PURE__*/ jsx(ArrowUp, {
69
- "aria-hidden": true
70
- }) : /*#__PURE__*/ jsx(ArrowDown, {
71
- "aria-hidden": true
72
- }),
73
- formatNumber(deltaAbs)
74
- ]
75
- })
76
- ]
77
- }),
78
- hasBar && /*#__PURE__*/ jsx("div", {
79
- "data-slot": "horizontal-bar-bar-wrapper",
80
- className: horizontalBarBarWrapperClasses,
81
- children: /*#__PURE__*/ jsx("div", {
82
- "data-slot": "horizontal-bar-bar",
83
- "data-testid": slotTestId('bar'),
84
- "aria-hidden": legend ? 'true' : void 0,
85
- role: barAriaLabel ? 'img' : void 0,
86
- "aria-label": barAriaLabel,
87
- className: horizontalBarBarClasses,
88
- children: segments.map((seg)=>/*#__PURE__*/ jsx("div", {
89
- "data-slot": "horizontal-bar-segment",
90
- "data-testid": slotTestId('segment'),
91
- "data-name": seg.isRemainder ? void 0 : seg.key,
92
- "data-remainder": seg.isRemainder ? 'true' : void 0,
93
- className: cn(horizontalBarSegmentClasses, seg.isRemainder && horizontalBarRemainderClasses, seg.className),
94
- style: {
95
- flexGrow: seg.value,
96
- flexBasis: 0,
97
- backgroundColor: seg.isRemainder || seg.className ? void 0 : resolveChartColor(seg.color)
98
- }
99
- }, seg.key))
100
- })
101
- }),
102
- legend && legendSegments.length > 0 && /*#__PURE__*/ jsx("div", {
103
- "data-slot": "horizontal-bar-legend",
104
- "data-testid": slotTestId('legend'),
105
- className: horizontalBarLegendClasses,
106
- children: legendSegments.map((seg)=>/*#__PURE__*/ jsxs("span", {
107
- "data-slot": "horizontal-bar-legend-item",
108
- "data-testid": slotTestId('legend-item'),
109
- "data-name": seg.key,
110
- className: horizontalBarLegendItemClasses,
111
- children: [
112
- /*#__PURE__*/ jsx("span", {
113
- "data-slot": "horizontal-bar-legend-dot",
114
- "data-testid": slotTestId('legend-dot'),
115
- "aria-hidden": "true",
116
- className: cn(horizontalBarLegendDotClasses, seg.className),
117
- style: {
118
- backgroundColor: seg.className ? void 0 : resolveChartColor(seg.color)
119
- }
120
- }),
121
- /*#__PURE__*/ jsx("span", {
122
- className: horizontalBarLegendLabelClasses,
123
- children: seg.key
124
- })
125
- ]
126
- }, seg.key))
127
- })
128
- ]
129
- });
130
- };
131
- HorizontalBar.displayName = 'HorizontalBar';
132
- export { HorizontalBar };
@@ -1,11 +0,0 @@
1
- export declare const horizontalBarRootClasses: string;
2
- export declare const horizontalBarBarWrapperClasses: string;
3
- export declare const horizontalBarBarClasses: string;
4
- export declare const horizontalBarSegmentClasses: string;
5
- export declare const horizontalBarRemainderClasses: string;
6
- export declare const horizontalBarHeaderClasses: string;
7
- export declare const horizontalBarValueClasses: string;
8
- export declare const horizontalBarLegendClasses: string;
9
- export declare const horizontalBarLegendItemClasses: string;
10
- export declare const horizontalBarLegendDotClasses: string;
11
- export declare const horizontalBarLegendLabelClasses: string;
@@ -1,12 +0,0 @@
1
- const horizontalBarRootClasses = "flex flex-col w-full";
2
- const horizontalBarBarWrapperClasses = "px-16 py-8 w-full";
3
- const horizontalBarBarClasses = "flex h-8 w-full overflow-hidden rounded-4";
4
- const horizontalBarSegmentClasses = "h-full min-w-px";
5
- const horizontalBarRemainderClasses = "bg-bg-strong-primary";
6
- const horizontalBarHeaderClasses = "flex items-baseline gap-8 px-16 pt-8";
7
- const horizontalBarValueClasses = "text-3xl font-medium leading-3xl text-text-primary";
8
- const horizontalBarLegendClasses = "flex flex-row flex-wrap items-center gap-6 px-12 py-2";
9
- const horizontalBarLegendItemClasses = "inline-flex items-center gap-4 px-4 py-2";
10
- const horizontalBarLegendDotClasses = "inline-block size-8 rounded-2 shrink-0";
11
- const horizontalBarLegendLabelClasses = "text-xs font-mono text-text-primary";
12
- export { horizontalBarBarClasses, horizontalBarBarWrapperClasses, horizontalBarHeaderClasses, horizontalBarLegendClasses, horizontalBarLegendDotClasses, horizontalBarLegendItemClasses, horizontalBarLegendLabelClasses, horizontalBarRemainderClasses, horizontalBarRootClasses, horizontalBarSegmentClasses, horizontalBarValueClasses };
@@ -1,16 +0,0 @@
1
- const REMAINDER_KEY = '__horizontal-bar-remainder__';
2
- const HORIZONTAL_BAR_PALETTE = [
3
- 'red',
4
- 'brand',
5
- 'amber',
6
- 'blue',
7
- 'green',
8
- 'purple',
9
- 'teal',
10
- 'cyan',
11
- 'indigo',
12
- 'pink',
13
- 'rose',
14
- 'slate'
15
- ];
16
- export { HORIZONTAL_BAR_PALETTE, REMAINDER_KEY };
@@ -1 +0,0 @@
1
- export { HorizontalBar, type HorizontalBarDatum, type HorizontalBarProps, } from './HorizontalBar';
@@ -1 +0,0 @@
1
- export { HorizontalBar } from "./HorizontalBar.js";