@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.
- package/dist/components/Attribute/AttributeValue.js +1 -1
- package/dist/components/ButtonBase/classes.d.ts +1 -1
- package/dist/components/ButtonBase/classes.js +12 -1
- package/dist/components/InlineEdit/InlineEditControl.js +11 -4
- package/dist/components/InlineEdit/InlineEditInput.js +1 -1
- package/dist/components/InlineEdit/InlineEditNumber.js +1 -1
- package/dist/components/InlineEdit/InlineEditPreviewValue.js +1 -1
- package/dist/components/InlineEdit/InlineEditSelect.js +1 -0
- package/dist/components/InlineEdit/InlineEditTextarea.js +1 -1
- package/dist/components/InlineEdit/InlineEditTime.js +1 -1
- package/dist/components/InlineEdit/classes.js +3 -3
- package/dist/components/Input/classes.d.ts +1 -1
- package/dist/components/Input/classes.js +3 -2
- package/dist/components/InputGroup/InputGroup.d.ts +1 -1
- package/dist/components/InputGroup/InputGroup.js +2 -1
- package/dist/components/NumberInput/classes.d.ts +4 -4
- package/dist/components/NumberInput/classes.js +8 -4
- package/dist/components/Select/SelectButton.d.ts +1 -1
- package/dist/components/Select/SelectButton.js +2 -1
- package/dist/components/Select/SelectInput/SelectInput.d.ts +1 -1
- package/dist/components/Select/SelectInput/SelectInput.js +2 -1
- package/dist/components/Select/SelectInput/SelectInputItemRenderer.d.ts +2 -2
- package/dist/components/Select/SelectInput/SelectInputItemRenderer.js +2 -1
- package/dist/components/Select/SelectInput/SelectInputOverflowRenderer.d.ts +1 -1
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.d.ts +50 -0
- package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.js → HorizontalBarStack/HorizontalBarStack.figma.js} +16 -8
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.js +239 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.d.ts +14 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.js +56 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.d.ts +19 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.js +49 -0
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/constants.d.ts +2 -2
- package/dist/components/SimpleCharts/HorizontalBarStack/constants.js +16 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/index.d.ts +2 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/index.js +2 -0
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.d.ts +2 -2
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.js +2 -2
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.d.ts +4 -0
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.js +3 -7
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.d.ts +7 -13
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.js +3 -16
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.d.ts +5 -1
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.js +9 -28
- package/dist/components/SimpleCharts/LineChart/classes.d.ts +0 -6
- package/dist/components/SimpleCharts/LineChart/classes.js +1 -7
- package/dist/components/SimpleCharts/Metric/Metric.d.ts +14 -0
- package/dist/components/SimpleCharts/Metric/Metric.figma.d.ts +1 -0
- package/dist/components/SimpleCharts/Metric/Metric.figma.js +49 -0
- package/dist/components/SimpleCharts/Metric/Metric.js +17 -0
- package/dist/components/SimpleCharts/Metric/MetricCaption.d.ts +6 -0
- package/dist/components/SimpleCharts/Metric/MetricCaption.js +16 -0
- package/dist/components/SimpleCharts/Metric/MetricDelta.d.ts +10 -0
- package/dist/components/SimpleCharts/Metric/MetricDelta.js +12 -0
- package/dist/components/SimpleCharts/Metric/MetricHeader.d.ts +9 -0
- package/dist/components/SimpleCharts/Metric/MetricHeader.js +16 -0
- package/dist/components/SimpleCharts/Metric/MetricSkeleton.d.ts +12 -0
- package/dist/components/SimpleCharts/Metric/MetricSkeleton.js +31 -0
- package/dist/components/SimpleCharts/Metric/MetricTotal.d.ts +12 -0
- package/dist/components/SimpleCharts/Metric/MetricTotal.js +36 -0
- package/dist/components/SimpleCharts/Metric/MetricValue.d.ts +9 -0
- package/dist/components/SimpleCharts/Metric/MetricValue.js +18 -0
- package/dist/components/SimpleCharts/Metric/classes.d.ts +8 -0
- package/dist/components/SimpleCharts/Metric/classes.js +9 -0
- package/dist/components/SimpleCharts/Metric/index.d.ts +7 -0
- package/dist/components/SimpleCharts/Metric/index.js +7 -0
- package/dist/components/SimpleCharts/index.d.ts +2 -1
- package/dist/components/SimpleCharts/index.js +2 -1
- package/dist/components/SimpleCharts/internal/ChartDelta.d.ts +22 -0
- package/dist/components/SimpleCharts/internal/ChartDelta.js +31 -0
- package/dist/components/SimpleCharts/internal/ChartHoverCard.d.ts +26 -0
- package/dist/components/SimpleCharts/internal/ChartHoverCard.js +57 -0
- package/dist/components/SimpleCharts/internal/index.d.ts +2 -0
- package/dist/components/SimpleCharts/internal/index.js +2 -0
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Slider/classes.d.ts +2 -3
- package/dist/components/TemporalCore/props.d.ts +1 -1
- package/dist/components/Textarea/classes.d.ts +2 -2
- package/dist/components/Textarea/classes.js +4 -2
- package/dist/components/Textarea/useAutoResize.d.ts +1 -0
- package/dist/components/Textarea/useAutoResize.js +5 -4
- package/dist/metadata/components.json +2425 -465
- package/package.json +1 -1
- package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.d.ts +0 -30
- package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.js +0 -132
- package/dist/components/SimpleCharts/HorizontalBar/classes.d.ts +0 -11
- package/dist/components/SimpleCharts/HorizontalBar/classes.js +0 -12
- package/dist/components/SimpleCharts/HorizontalBar/constants.js +0 -16
- package/dist/components/SimpleCharts/HorizontalBar/index.d.ts +0 -1
- package/dist/components/SimpleCharts/HorizontalBar/index.js +0 -1
- /package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.d.ts → HorizontalBarStack/HorizontalBarStack.figma.d.ts} +0 -0
|
@@ -18,7 +18,7 @@ const AttributeValue = ({ ref, children, className, ...props })=>{
|
|
|
18
18
|
ref: ref,
|
|
19
19
|
"data-testid": testId,
|
|
20
20
|
"data-slot": "attribute-value",
|
|
21
|
-
className: cn('flex items-center', '[&_[data-slot=inline-edit-preview]]:-my-4', 'has-[[data-slot=inline-edit]]:overflow-visible', isHorizontal ? 'flex-1 min-w-0 py-4 truncate' : 'pt-4 min-h-[28px]', className),
|
|
21
|
+
className: cn('flex items-center', '[&_[data-slot=inline-edit-preview]]:-my-4', '[&_[data-slot=inline-edit-control]]:-my-4', !isHorizontal && 'has-[[data-slot=inline-edit]]:-ml-7', !isHorizontal && 'has-[[data-slot=attribute-actions-target]]:-ml-7', !isHorizontal && '[&_[data-slot=inline-edit-error]]:ml-7', 'has-[[data-slot=inline-edit]]:overflow-visible', isHorizontal ? 'flex-1 min-w-0 py-4 truncate' : 'pt-4 min-h-[28px]', className),
|
|
22
22
|
children: showPlaceholder ? /*#__PURE__*/ jsx(Text, {
|
|
23
23
|
size: "sm",
|
|
24
24
|
color: "secondary",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const buttonBaseVariants: (props?: ({
|
|
2
|
-
size?: "small" | "medium" | "large" | null | undefined;
|
|
2
|
+
size?: "small" | "medium" | "large" | "inline-edit" | null | undefined;
|
|
3
3
|
iconOnly?: boolean | null | undefined;
|
|
4
4
|
loading?: boolean | null | undefined;
|
|
5
5
|
hasNonTextEnd?: boolean | null | undefined;
|
|
@@ -5,7 +5,8 @@ const buttonBaseVariants = cva(cn('items-center justify-center min-w-0 rounded-8
|
|
|
5
5
|
size: {
|
|
6
6
|
small: 'h-24 px-8 py-2 gap-4',
|
|
7
7
|
medium: 'h-32 px-12 py-6 gap-6',
|
|
8
|
-
large: 'h-36 px-16 py-8 gap-8'
|
|
8
|
+
large: 'h-36 px-16 py-8 gap-8',
|
|
9
|
+
'inline-edit': 'h-28 px-10 py-4 gap-5'
|
|
9
10
|
},
|
|
10
11
|
iconOnly: {
|
|
11
12
|
true: '',
|
|
@@ -39,6 +40,11 @@ const buttonBaseVariants = cva(cn('items-center justify-center min-w-0 rounded-8
|
|
|
39
40
|
size: 'large',
|
|
40
41
|
className: 'w-36 h-36 p-8'
|
|
41
42
|
},
|
|
43
|
+
{
|
|
44
|
+
iconOnly: true,
|
|
45
|
+
size: 'inline-edit',
|
|
46
|
+
className: 'w-28 h-28 p-4'
|
|
47
|
+
},
|
|
42
48
|
{
|
|
43
49
|
hasNonTextEnd: true,
|
|
44
50
|
size: 'small',
|
|
@@ -53,6 +59,11 @@ const buttonBaseVariants = cva(cn('items-center justify-center min-w-0 rounded-8
|
|
|
53
59
|
hasNonTextEnd: true,
|
|
54
60
|
size: 'large',
|
|
55
61
|
className: 'pr-10'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
hasNonTextEnd: true,
|
|
65
|
+
size: 'inline-edit',
|
|
66
|
+
className: 'pr-4'
|
|
56
67
|
}
|
|
57
68
|
]
|
|
58
69
|
});
|
|
@@ -3,7 +3,13 @@ import { useCallback, useEffect, useRef } from "react";
|
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { useTestId } from "../../utils/testId.js";
|
|
5
5
|
import { useInlineEdit } from "./InlineEditContext.js";
|
|
6
|
-
const FOCUSABLE_SELECTOR = 'input, textarea, select, button, [tabindex]:not([tabindex="-1"])';
|
|
6
|
+
const FOCUSABLE_SELECTOR = 'input:not([tabindex="-1"]), textarea:not([tabindex="-1"]), select:not([tabindex="-1"]), button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
|
|
7
|
+
function findOpenListbox(focusable) {
|
|
8
|
+
const controlsId = focusable.getAttribute('aria-controls');
|
|
9
|
+
if (!controlsId) return null;
|
|
10
|
+
const controlled = document.getElementById(controlsId);
|
|
11
|
+
return controlled?.getAttribute('role') === 'listbox' ? controlled : null;
|
|
12
|
+
}
|
|
7
13
|
const InlineEditControl = ({ ref, children, className, onKeyDown, onBlur, submitMode: submitModeProp, ...props })=>{
|
|
8
14
|
const testId = useTestId('control');
|
|
9
15
|
const ctx = useInlineEdit();
|
|
@@ -16,8 +22,9 @@ const InlineEditControl = ({ ref, children, className, onKeyDown, onBlur, submit
|
|
|
16
22
|
if (!editing) return;
|
|
17
23
|
const node = divRef.current;
|
|
18
24
|
if (!node) return;
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
25
|
+
const firstFocusable = node.querySelector(FOCUSABLE_SELECTOR);
|
|
26
|
+
if (!firstFocusable) return;
|
|
27
|
+
const focusable = findOpenListbox(firstFocusable) ?? firstFocusable;
|
|
21
28
|
focusable.focus();
|
|
22
29
|
if (selectOnFocusRef.current && (focusable instanceof HTMLInputElement || focusable instanceof HTMLTextAreaElement)) focusable.select();
|
|
23
30
|
}, [
|
|
@@ -64,7 +71,7 @@ const InlineEditControl = ({ ref, children, className, onKeyDown, onBlur, submit
|
|
|
64
71
|
"data-slot": "inline-edit-control",
|
|
65
72
|
onKeyDown: handleKeyDown,
|
|
66
73
|
onBlur: handleBlur,
|
|
67
|
-
className: cn('w-full min-w-0', '
|
|
74
|
+
className: cn('w-full min-w-0', '[&_[data-slot=input]]:px-6', '[&_textarea]:px-6', '[&_[data-scope=number-input][data-part=input]]:px-6', '[&_[data-scope=select][data-part=trigger]]:px-6', '[&_div[data-scope=select][data-part=trigger]:has([data-slot=overflow-list])]:pl-0', '[&_[data-slot=input-group-addon]]:px-6', '[&_[data-slot=input-group]>div:not([data-slot])]:pl-0', className),
|
|
68
75
|
children: 'function' == typeof children ? children(ctx) : children
|
|
69
76
|
});
|
|
70
77
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTestId } from "../../utils/testId.js";
|
|
3
3
|
import { Input } from "../Input/index.js";
|
|
4
4
|
import { useInlineEdit } from "./InlineEditContext.js";
|
|
5
|
-
const InlineEditInput = ({ size = '
|
|
5
|
+
const InlineEditInput = ({ size = 'inline-edit', 'data-testid': testIdProp, ...props })=>{
|
|
6
6
|
const testId = useTestId('input', testIdProp);
|
|
7
7
|
const { value, setValue, invalid } = useInlineEdit();
|
|
8
8
|
return /*#__PURE__*/ jsx(Input, {
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTestId } from "../../utils/testId.js";
|
|
3
3
|
import { NumberInput } from "../NumberInput/index.js";
|
|
4
4
|
import { useInlineEdit } from "./InlineEditContext.js";
|
|
5
|
-
const InlineEditNumber = ({ size = '
|
|
5
|
+
const InlineEditNumber = ({ size = 'inline-edit', 'data-testid': testIdProp, ...props })=>{
|
|
6
6
|
const testId = useTestId('input', testIdProp);
|
|
7
7
|
const { value, setValue, invalid } = useInlineEdit();
|
|
8
8
|
return /*#__PURE__*/ jsx(NumberInput, {
|
|
@@ -17,7 +17,7 @@ const InlineEditPreviewValue = ({ ref, lineClamp, children })=>{
|
|
|
17
17
|
ref: ref,
|
|
18
18
|
"data-testid": testId,
|
|
19
19
|
"data-slot": "inline-edit-preview-value",
|
|
20
|
-
className: cn('min-w-0 flex-1', lineClamp ? LINE_CLAMP_CLASS[lineClamp] : 'truncate', 'loading' === status && 'opacity-50'),
|
|
20
|
+
className: cn('min-w-0 flex-1', lineClamp ? cn(LINE_CLAMP_CLASS[lineClamp], 'whitespace-normal') : 'truncate', 'loading' === status && 'opacity-50'),
|
|
21
21
|
children: children
|
|
22
22
|
});
|
|
23
23
|
};
|
|
@@ -28,6 +28,7 @@ const InlineEditSelect = ({ items, collection, multiple = false, children })=>{
|
|
|
28
28
|
return /*#__PURE__*/ jsx(Select, {
|
|
29
29
|
"data-testid": testId,
|
|
30
30
|
defaultOpen: true,
|
|
31
|
+
defaultHighlightedValue: selected[0] ?? resolvedCollection.firstValue,
|
|
31
32
|
collection: resolvedCollection,
|
|
32
33
|
multiple: multiple,
|
|
33
34
|
value: selected,
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTestId } from "../../utils/testId.js";
|
|
3
3
|
import { Textarea } from "../Textarea/index.js";
|
|
4
4
|
import { useInlineEdit } from "./InlineEditContext.js";
|
|
5
|
-
const InlineEditTextarea = ({ size = '
|
|
5
|
+
const InlineEditTextarea = ({ size = 'inline-edit', 'data-testid': testIdProp, ...props })=>{
|
|
6
6
|
const testId = useTestId('input', testIdProp);
|
|
7
7
|
const { value, setValue, invalid } = useInlineEdit();
|
|
8
8
|
return /*#__PURE__*/ jsx(Textarea, {
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTestId } from "../../utils/testId.js";
|
|
3
3
|
import { TimeInput } from "../TimeInput/index.js";
|
|
4
4
|
import { useInlineEdit, useInlineEditSubmitMode } from "./InlineEditContext.js";
|
|
5
|
-
const InlineEditTime = ({ 'data-testid': testIdProp, granularity = 'minute', showTimeDropdown = true, showIcon = false, size = '
|
|
5
|
+
const InlineEditTime = ({ 'data-testid': testIdProp, granularity = 'minute', showTimeDropdown = true, showIcon = false, size = 'inline-edit', ...props })=>{
|
|
6
6
|
const testId = useTestId('input', testIdProp);
|
|
7
7
|
const { value, setValue } = useInlineEdit();
|
|
8
8
|
useInlineEditSubmitMode('blur');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
const inlineEditPreviewVariants = cva('group flex w-full min-w-0 gap-4 rounded-8 border border-transparent px-6
|
|
2
|
+
const inlineEditPreviewVariants = cva('group flex w-full min-w-0 gap-4 rounded-8 border border-transparent px-6 font-sans text-sm text-text-primary transition-colors', {
|
|
3
3
|
variants: {
|
|
4
4
|
multiline: {
|
|
5
|
-
true: 'items-start py-
|
|
6
|
-
false: 'items-center py-
|
|
5
|
+
true: 'items-start py-4',
|
|
6
|
+
false: 'items-center py-4 h-28'
|
|
7
7
|
},
|
|
8
8
|
activatable: {
|
|
9
9
|
true: '',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const inputVariants: (props?: ({
|
|
2
2
|
error?: boolean | null | undefined;
|
|
3
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
3
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
-
const inputVariants = cva(cn('flex w-full px-12 rounded-8 border bg-component-input-bg', 'font-sans text-sm text-text-primary placeholder:text-text-secondary', 'shadow-xs transition-[color,border,box-shadow]', 'focus-visible:outline-none focus-visible:ring-3', 'disabled:aria-disabled:cursor-not-allowed disabled:aria-disabled:opacity-50'), {
|
|
3
|
+
const inputVariants = cva(cn('flex w-full px-12 rounded-8 border bg-component-input-bg', 'font-sans text-sm text-text-primary placeholder:text-text-secondary', 'placeholder:text-sm', 'shadow-xs transition-[color,border,box-shadow]', 'focus-visible:outline-none focus-visible:ring-3', 'disabled:aria-disabled:cursor-not-allowed disabled:aria-disabled:opacity-50'), {
|
|
4
4
|
variants: {
|
|
5
5
|
error: {
|
|
6
6
|
true: cn('border-border-strong-danger', 'hover:not-disabled:border-border-strong-danger', 'hover:not-disabled:outline-none', 'hover:not-disabled:ring-3', 'hover:not-disabled:ring-focus-destructive-hover', 'focus-visible:ring-focus-destructive'),
|
|
@@ -9,7 +9,8 @@ const inputVariants = cva(cn('flex w-full px-12 rounded-8 border bg-component-in
|
|
|
9
9
|
size: {
|
|
10
10
|
default: 'h-36 py-8',
|
|
11
11
|
medium: 'h-32 py-6',
|
|
12
|
-
small: 'h-24 py-2'
|
|
12
|
+
small: 'h-24 py-2',
|
|
13
|
+
'inline-edit': 'h-28 py-4'
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
16
|
defaultVariants: {
|
|
@@ -2,7 +2,7 @@ import type { FC, HTMLAttributes } from 'react';
|
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { type TestableProps } from '../../utils/testId';
|
|
4
4
|
export declare const inputGroupVariants: (props?: ({
|
|
5
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
5
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export type InputGroupSize = NonNullable<VariantProps<typeof inputGroupVariants>['size']>;
|
|
8
8
|
type InputGroupProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof inputGroupVariants> & TestableProps;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const numberInputRootVariants: (props?: ({
|
|
2
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
2
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
3
3
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
4
|
export declare const numberInputFieldVariants: (props?: ({
|
|
5
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
5
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export declare const numberInputControlVariants: (props?: ({
|
|
8
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
8
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
export declare const numberInputTriggerVariants: (props?: ({
|
|
11
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
11
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -5,7 +5,8 @@ const numberInputRootVariants = cva(cn('flex items-stretch border rounded-8 bg-c
|
|
|
5
5
|
size: {
|
|
6
6
|
default: 'h-36',
|
|
7
7
|
medium: 'h-32',
|
|
8
|
-
small: 'h-24'
|
|
8
|
+
small: 'h-24',
|
|
9
|
+
'inline-edit': 'h-28'
|
|
9
10
|
}
|
|
10
11
|
},
|
|
11
12
|
defaultVariants: {
|
|
@@ -17,7 +18,8 @@ const numberInputFieldVariants = cva(cn('flex-1 h-full rounded-none border-0 bg-
|
|
|
17
18
|
size: {
|
|
18
19
|
default: 'px-12 py-8',
|
|
19
20
|
medium: 'px-12 py-6',
|
|
20
|
-
small: 'px-12 py-2'
|
|
21
|
+
small: 'px-12 py-2',
|
|
22
|
+
'inline-edit': 'px-12 py-4'
|
|
21
23
|
}
|
|
22
24
|
},
|
|
23
25
|
defaultVariants: {
|
|
@@ -29,7 +31,8 @@ const numberInputControlVariants = cva(cn('flex flex-col justify-center', 'bg-st
|
|
|
29
31
|
size: {
|
|
30
32
|
default: 'px-4 py-2 [&_svg]:icon-sm',
|
|
31
33
|
medium: 'px-3 py-1 [&_svg]:icon-sm',
|
|
32
|
-
small: 'px-2 py-0 [&_svg]:icon-xs'
|
|
34
|
+
small: 'px-2 py-0 [&_svg]:icon-xs',
|
|
35
|
+
'inline-edit': 'px-2 py-0 [&_svg]:icon-xs'
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
defaultVariants: {
|
|
@@ -41,7 +44,8 @@ const numberInputTriggerVariants = cva(cn('flex items-center justify-center roun
|
|
|
41
44
|
size: {
|
|
42
45
|
default: 'w-16 h-14 px-2 py-1',
|
|
43
46
|
medium: 'w-14 h-12 px-2 py-1',
|
|
44
|
-
small: 'w-12 h-10 px-1 py-0'
|
|
47
|
+
small: 'w-12 h-10 px-1 py-0',
|
|
48
|
+
'inline-edit': 'w-12 h-11 px-1 py-0'
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
defaultVariants: {
|
|
@@ -2,7 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import { type ButtonProps } from '../Button';
|
|
3
3
|
import { type SelectValueTextProps } from './SelectValueText';
|
|
4
4
|
type SelectButtonBaseProps = Omit<ButtonProps, 'variant' | 'color' | 'size' | 'disabled'>;
|
|
5
|
-
export type SelectButtonSize = 'small' | 'medium' | 'default';
|
|
5
|
+
export type SelectButtonSize = 'small' | 'medium' | 'default' | 'inline-edit';
|
|
6
6
|
export interface SelectButtonVariantProps {
|
|
7
7
|
variant?: Exclude<ButtonProps['variant'], 'primary'>;
|
|
8
8
|
color?: Exclude<ButtonProps['color'], 'destructive'>;
|
|
@@ -9,7 +9,8 @@ import { SelectValueText } from "./SelectValueText.js";
|
|
|
9
9
|
const SELECT_BUTTON_SIZE_MAP = {
|
|
10
10
|
small: 'small',
|
|
11
11
|
medium: 'medium',
|
|
12
|
-
default: 'large'
|
|
12
|
+
default: 'large',
|
|
13
|
+
'inline-edit': 'inline-edit'
|
|
13
14
|
};
|
|
14
15
|
const SelectButton = ({ placeholder = 'Choose...', variant = 'outline', color = 'neutral', size = 'default', 'data-testid': testIdProp, ...props })=>{
|
|
15
16
|
const testId = useTestId('button', testIdProp);
|
|
@@ -2,7 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import { type SelectValueTextProps } from '../SelectValueText';
|
|
3
3
|
interface SelectInputBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'color'> {
|
|
4
4
|
'data-testid'?: string;
|
|
5
|
-
size?: 'small' | 'medium' | 'default';
|
|
5
|
+
size?: 'small' | 'medium' | 'default' | 'inline-edit';
|
|
6
6
|
}
|
|
7
7
|
type SelectInputProps = SelectInputBaseProps & Pick<SelectValueTextProps, 'placeholder'>;
|
|
8
8
|
export declare const SelectInput: FC<SelectInputProps>;
|
|
@@ -4,8 +4,8 @@ import type { SelectDataItem } from '../types';
|
|
|
4
4
|
type SelectInputItemRendererProps = {
|
|
5
5
|
item: SelectDataItem;
|
|
6
6
|
/** `SelectInput`'s own size — chips scale down with it, see `TAG_SIZE_BY_SELECT_SIZE`. */
|
|
7
|
-
size?: 'small' | 'medium' | 'default';
|
|
7
|
+
size?: 'small' | 'medium' | 'default' | 'inline-edit';
|
|
8
8
|
};
|
|
9
|
-
export declare const TAG_SIZE_BY_SELECT_SIZE: Record<'small' | 'medium' | 'default', TagProps['size']>;
|
|
9
|
+
export declare const TAG_SIZE_BY_SELECT_SIZE: Record<'small' | 'medium' | 'default' | 'inline-edit', TagProps['size']>;
|
|
10
10
|
export declare const SelectInputItemRenderer: FC<SelectInputItemRendererProps>;
|
|
11
11
|
export {};
|
|
@@ -4,7 +4,8 @@ import { Tag, TagClose } from "../../Tag/index.js";
|
|
|
4
4
|
const TAG_SIZE_BY_SELECT_SIZE = {
|
|
5
5
|
small: 'medium',
|
|
6
6
|
medium: 'large',
|
|
7
|
-
default: 'large'
|
|
7
|
+
default: 'large',
|
|
8
|
+
'inline-edit': 'large'
|
|
8
9
|
};
|
|
9
10
|
const SelectInputItemRenderer = ({ item, size = 'default' })=>{
|
|
10
11
|
const { value, setValue } = useSelectContext();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SelectDataItem } from '../types';
|
|
2
|
-
export declare const createSelectInputOverflowRenderer: (size: "small" | "medium" | "default") => (items: SelectDataItem[]) => import("react").JSX.Element;
|
|
2
|
+
export declare const createSelectInputOverflowRenderer: (size: "small" | "medium" | "default" | "inline-edit") => (items: SelectDataItem[]) => import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../../utils/testId';
|
|
3
|
+
import type { ChartColor } from '../types';
|
|
4
|
+
export interface HorizontalBarStackDatum {
|
|
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 HorizontalBarStackProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'>, TestableProps {
|
|
15
|
+
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
/** Segments + legend. One array drives both, so colors stay in sync. */
|
|
17
|
+
data: HorizontalBarStackDatum[];
|
|
18
|
+
/**
|
|
19
|
+
* Header slot. Compose the headline from the shared `Metric` bricks —
|
|
20
|
+
* `<MetricHeader>` wrapping `<MetricValue>` / `<MetricDelta>` (and optionally `<MetricTotal>` /
|
|
21
|
+
* `<MetricCaption>`) — exactly as `Metric` and `PieChart`'s centre do. Rendered above the bar
|
|
22
|
+
* under this component's own `TestIdProvider`. Omitted → no header. (Replaces the former
|
|
23
|
+
* `value` / `delta` config props: one way to build a delta across the whole chart family.)
|
|
24
|
+
*/
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/** Bar denominator. `> sum(data.value)` → grey remainder tail. Default: `sum(data.value)`. */
|
|
27
|
+
total?: number;
|
|
28
|
+
/** Show/hide the legend. Default: true. */
|
|
29
|
+
legend?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Controlled hover target, joined by `name`. Omitted → managed internally. Set together
|
|
32
|
+
* with `onActiveNameChange` to sync hover across charts (e.g. a sibling highlights the
|
|
33
|
+
* same series). Mirrors `PieChart`.
|
|
34
|
+
*/
|
|
35
|
+
activeName?: string | null;
|
|
36
|
+
onActiveNameChange?: (name: string | null) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Names to emphasise. When non-empty, non-selected segments + legend items fade. Hover
|
|
39
|
+
* (`activeName`) wins — while a series is hovered, only it stays bright. Names not in
|
|
40
|
+
* `data` are ignored.
|
|
41
|
+
*/
|
|
42
|
+
selectedNames?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Click-to-filter. When provided, legend items become interactive (`role='button'`,
|
|
45
|
+
* `tabIndex=0`, Enter/Space) and fire with the clicked datum's `name`. The caller owns
|
|
46
|
+
* the filter (typically: drive `selectedNames`, or filter `data`).
|
|
47
|
+
*/
|
|
48
|
+
onSelect?: (name: string) => void;
|
|
49
|
+
}
|
|
50
|
+
export declare const HorizontalBarStack: FC<HorizontalBarStackProps>;
|
|
@@ -3,7 +3,8 @@ import code_connect from "@figma/code-connect";
|
|
|
3
3
|
import { Chart } from "../Chart/Chart.js";
|
|
4
4
|
import { ChartHeader } from "../Chart/ChartHeader.js";
|
|
5
5
|
import { ChartTitle } from "../Chart/ChartTitle.js";
|
|
6
|
-
import {
|
|
6
|
+
import { MetricDelta, MetricHeader, MetricValue } from "../Metric/index.js";
|
|
7
|
+
import { HorizontalBarStack } from "./HorizontalBarStack.js";
|
|
7
8
|
const figmaNodeUrl = 'https://www.figma.com/design/VKb5gW46uSGw0rqrhZsbXT/WADS-Components?node-id=9667-10883';
|
|
8
9
|
const sampleData = [
|
|
9
10
|
{
|
|
@@ -22,7 +23,7 @@ const sampleData = [
|
|
|
22
23
|
color: 'amber'
|
|
23
24
|
}
|
|
24
25
|
];
|
|
25
|
-
code_connect.connect(
|
|
26
|
+
code_connect.connect(HorizontalBarStack, figmaNodeUrl, {
|
|
26
27
|
props: {
|
|
27
28
|
title: code_connect.string('Title')
|
|
28
29
|
},
|
|
@@ -33,13 +34,20 @@ code_connect.connect(HorizontalBar, figmaNodeUrl, {
|
|
|
33
34
|
children: title
|
|
34
35
|
})
|
|
35
36
|
}),
|
|
36
|
-
/*#__PURE__*/ jsx(
|
|
37
|
+
/*#__PURE__*/ jsx(HorizontalBarStack, {
|
|
37
38
|
data: sampleData,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
children: /*#__PURE__*/ jsxs(MetricHeader, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsx(MetricValue, {
|
|
42
|
+
children: "91"
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx(MetricDelta, {
|
|
45
|
+
value: 10,
|
|
46
|
+
trend: "up",
|
|
47
|
+
sentiment: "negative"
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
})
|
|
43
51
|
})
|
|
44
52
|
]
|
|
45
53
|
})
|