@wallarm-org/design-system 1.33.0 → 2.0.0-rc-fix-stepper.1
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/FilterDropdown/FilterDropdownTrigger.js +2 -1
- package/dist/components/NumericBadge/NumericBadge.d.ts +6 -3
- package/dist/components/NumericBadge/NumericBadge.figma.js +17 -6
- package/dist/components/NumericBadge/NumericBadge.js +51 -7
- package/dist/components/NumericBadge/classes.d.ts +3 -1
- package/dist/components/NumericBadge/classes.js +138 -23
- package/dist/components/Stepper/StepperIndicator.js +12 -6
- package/dist/components/Stepper/StepperList.d.ts +2 -2
- package/dist/components/Stepper/classes.js +6 -6
- package/dist/metadata/components.json +56 -18
- package/package.json +1 -1
|
@@ -81,7 +81,8 @@ const FilterDropdownTrigger = ({ ref, className, children, onKeyDown, 'aria-labe
|
|
|
81
81
|
"aria-hidden": true,
|
|
82
82
|
className: "inline-flex shrink-0",
|
|
83
83
|
children: /*#__PURE__*/ jsx(NumericBadge, {
|
|
84
|
-
type: "
|
|
84
|
+
type: "secondary",
|
|
85
|
+
color: "neutral",
|
|
85
86
|
children: value.length
|
|
86
87
|
})
|
|
87
88
|
})
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import type { TestableProps } from '../../utils/testId';
|
|
4
4
|
import { numericBadgeVariants } from './classes';
|
|
5
|
-
type NumericBadgeNativeProps = HTMLAttributes<HTMLDivElement>;
|
|
6
|
-
type NumericBadgeVariantsProps = Omit<VariantProps<typeof numericBadgeVariants>, 'clickable'>;
|
|
5
|
+
type NumericBadgeNativeProps = Omit<HTMLAttributes<HTMLDivElement>, 'color'>;
|
|
6
|
+
type NumericBadgeVariantsProps = Omit<VariantProps<typeof numericBadgeVariants>, 'clickable' | 'iconOnly'>;
|
|
7
7
|
export type NumericBadgeProps = NumericBadgeNativeProps & NumericBadgeVariantsProps & TestableProps & {
|
|
8
|
+
ref?: Ref<HTMLDivElement>;
|
|
9
|
+
/** Applies the badge to its child element, such as a span or a native button. */
|
|
10
|
+
asChild?: boolean;
|
|
8
11
|
'data-slot'?: string;
|
|
9
12
|
};
|
|
10
13
|
export declare const NumericBadge: FC<NumericBadgeProps>;
|
|
@@ -5,17 +5,28 @@ const figmaNodeUrl = 'https://www.figma.com/design/VKb5gW46uSGw0rqrhZsbXT/wip-co
|
|
|
5
5
|
code_connect.connect(NumericBadge, figmaNodeUrl, {
|
|
6
6
|
props: {
|
|
7
7
|
type: code_connect["enum"]('Type', {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Solid: 'solid',
|
|
9
|
+
Secondary: 'secondary',
|
|
10
|
+
Outline: 'outline'
|
|
11
|
+
}),
|
|
12
|
+
color: code_connect["enum"]('Color', {
|
|
13
|
+
Neutral: 'neutral',
|
|
14
|
+
'Neutral-alt': 'neutral-alt',
|
|
10
15
|
Brand: 'brand',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
Danger: 'danger',
|
|
17
|
+
Info: 'info',
|
|
18
|
+
Success: 'success'
|
|
19
|
+
}),
|
|
20
|
+
size: code_connect["enum"]('Size', {
|
|
21
|
+
Medium: 'default',
|
|
22
|
+
Small: 'small'
|
|
14
23
|
}),
|
|
15
24
|
children: code_connect.string('#')
|
|
16
25
|
},
|
|
17
|
-
example: ({ type, children })=>/*#__PURE__*/ jsx(NumericBadge, {
|
|
26
|
+
example: ({ type, color, size, children })=>/*#__PURE__*/ jsx(NumericBadge, {
|
|
18
27
|
type: type,
|
|
28
|
+
color: color,
|
|
29
|
+
size: size,
|
|
19
30
|
children: children
|
|
20
31
|
})
|
|
21
32
|
});
|
|
@@ -1,19 +1,63 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement, useRef } from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
4
|
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { isIconOnly } from "../../utils/isIconOnly.js";
|
|
3
6
|
import { numericBadgeVariants } from "./classes.js";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const hasNativeKeyboardActivation = (element)=>'BUTTON' === element.tagName || 'INPUT' === element.tagName || 'A' === element.tagName && element.hasAttribute('href');
|
|
8
|
+
const NumericBadge = ({ type = 'secondary', color = 'solid' === type ? 'brand' : 'neutral', size = 'default', asChild = false, children, className, ref, role, tabIndex, onClick, onKeyDown, onKeyUp, onBlur, 'data-slot': dataSlot, ...props })=>{
|
|
9
|
+
const child = asChild && /*#__PURE__*/ isValidElement(children) ? children : null;
|
|
10
|
+
const childProps = child?.props;
|
|
11
|
+
const nativeChild = child?.type === 'button' || child?.type === 'input' || child?.type === 'a' && childProps?.href != null;
|
|
12
|
+
const isClickable = !childProps?.disabled && !!(onClick || childProps?.onClick || nativeChild);
|
|
13
|
+
const spacePressed = useRef(false);
|
|
14
|
+
const Comp = asChild ? Slot : 'div';
|
|
15
|
+
const handleKeyDown = (event)=>{
|
|
16
|
+
onKeyDown?.(event);
|
|
17
|
+
if (event.defaultPrevented || !isClickable || event.target !== event.currentTarget || hasNativeKeyboardActivation(event.currentTarget)) return;
|
|
18
|
+
if ('Enter' === event.key) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
event.currentTarget.click();
|
|
21
|
+
} else if (' ' === event.key) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
spacePressed.current = true;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const handleKeyUp = (event)=>{
|
|
27
|
+
onKeyUp?.(event);
|
|
28
|
+
if (' ' !== event.key) return;
|
|
29
|
+
const activate = spacePressed.current;
|
|
30
|
+
spacePressed.current = false;
|
|
31
|
+
if (activate && !event.defaultPrevented && isClickable && event.target === event.currentTarget && !hasNativeKeyboardActivation(event.currentTarget)) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.currentTarget.click();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/ jsx(Comp, {
|
|
7
37
|
...props,
|
|
8
|
-
|
|
38
|
+
ref: ref,
|
|
39
|
+
role: role ?? (isClickable && !nativeChild ? 'button' : void 0),
|
|
40
|
+
tabIndex: tabIndex ?? (isClickable && !nativeChild ? 0 : void 0),
|
|
9
41
|
"data-slot": dataSlot ?? 'numeric-badge',
|
|
10
42
|
"data-type": type,
|
|
11
|
-
|
|
43
|
+
"data-color": color,
|
|
44
|
+
onClick: onClick ? (event)=>{
|
|
45
|
+
if (!event.defaultPrevented) onClick(event);
|
|
46
|
+
} : void 0,
|
|
47
|
+
onKeyDown: handleKeyDown,
|
|
48
|
+
onKeyUp: handleKeyUp,
|
|
49
|
+
onBlur: (event)=>{
|
|
50
|
+
spacePressed.current = false;
|
|
51
|
+
onBlur?.(event);
|
|
52
|
+
},
|
|
12
53
|
className: cn(numericBadgeVariants({
|
|
13
54
|
type,
|
|
55
|
+
color,
|
|
14
56
|
size,
|
|
15
|
-
clickable: isClickable
|
|
16
|
-
|
|
57
|
+
clickable: isClickable,
|
|
58
|
+
iconOnly: isIconOnly(child ? child.props.children : children)
|
|
59
|
+
}), className),
|
|
60
|
+
children: children
|
|
17
61
|
});
|
|
18
62
|
};
|
|
19
63
|
NumericBadge.displayName = 'NumericBadge';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const numericBadgeVariants: (props?: ({
|
|
2
|
-
type?: "
|
|
2
|
+
type?: "outline" | "secondary" | "solid" | null | undefined;
|
|
3
|
+
color?: "brand" | "danger" | "info" | "neutral" | "neutral-alt" | "success" | null | undefined;
|
|
3
4
|
size?: "default" | "small" | null | undefined;
|
|
5
|
+
iconOnly?: boolean | null | undefined;
|
|
4
6
|
clickable?: boolean | null | undefined;
|
|
5
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,24 +1,92 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
const numericBadgeVariants = cva('inline-flex items-center rounded-full font-mono font-medium transition-colors
|
|
2
|
+
const numericBadgeVariants = cva('inline-flex w-max shrink-0 items-center justify-center whitespace-nowrap rounded-full font-mono font-medium transition-colors', {
|
|
3
3
|
variants: {
|
|
4
4
|
type: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
solid: '',
|
|
6
|
+
secondary: '',
|
|
7
|
+
outline: 'border-1'
|
|
8
|
+
},
|
|
9
|
+
color: {
|
|
10
|
+
neutral: '',
|
|
11
|
+
'neutral-alt': '',
|
|
12
|
+
brand: '',
|
|
13
|
+
danger: '',
|
|
14
|
+
success: '',
|
|
15
|
+
info: ''
|
|
11
16
|
},
|
|
12
17
|
size: {
|
|
13
|
-
default: 'px-5 py-2 text-xs',
|
|
14
|
-
small: '
|
|
18
|
+
default: 'h-20 min-w-16 px-5 py-2 text-xs [&_svg]:icon-md',
|
|
19
|
+
small: 'h-16 min-w-12 px-3 py-2 text-2xs [&_svg]:icon-sm'
|
|
20
|
+
},
|
|
21
|
+
iconOnly: {
|
|
22
|
+
true: ''
|
|
15
23
|
},
|
|
16
24
|
clickable: {
|
|
17
|
-
true: 'cursor-pointer overlay active:outline-none active:ring-3',
|
|
25
|
+
true: 'cursor-pointer overlay active:outline-none active:ring-3 focus-visible:outline-none focus-visible:ring-3',
|
|
18
26
|
false: ''
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
29
|
compoundVariants: [
|
|
30
|
+
{
|
|
31
|
+
type: 'solid',
|
|
32
|
+
color: 'brand',
|
|
33
|
+
className: 'bg-bg-fill-brand text-text-primary-alt'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'solid',
|
|
37
|
+
color: 'danger',
|
|
38
|
+
className: 'bg-bg-fill-danger text-text-primary-alt'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'secondary',
|
|
42
|
+
color: 'neutral',
|
|
43
|
+
className: 'bg-states-primary-active text-text-primary'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'secondary',
|
|
47
|
+
color: 'neutral-alt',
|
|
48
|
+
className: 'bg-states-primary-alt-active text-text-primary-alt'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'secondary',
|
|
52
|
+
color: 'brand',
|
|
53
|
+
className: 'bg-states-brand-active text-text-brand'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'secondary',
|
|
57
|
+
color: 'danger',
|
|
58
|
+
className: 'bg-states-danger-active text-text-danger'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'secondary',
|
|
62
|
+
color: 'success',
|
|
63
|
+
className: 'bg-states-success-active text-text-success'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'secondary',
|
|
67
|
+
color: 'info',
|
|
68
|
+
className: 'bg-states-info-active text-text-info'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'outline',
|
|
72
|
+
color: 'neutral',
|
|
73
|
+
className: 'border-border-primary bg-component-outline-button-bg text-text-primary'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'outline',
|
|
77
|
+
color: 'brand',
|
|
78
|
+
className: 'border-border-brand bg-bg-brand text-text-brand'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'outline',
|
|
82
|
+
color: 'danger',
|
|
83
|
+
className: 'border-border-danger bg-bg-danger text-text-danger'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'outline',
|
|
87
|
+
color: 'success',
|
|
88
|
+
className: 'border-border-success bg-bg-success text-text-success'
|
|
89
|
+
},
|
|
22
90
|
{
|
|
23
91
|
type: 'outline',
|
|
24
92
|
size: 'default',
|
|
@@ -27,37 +95,84 @@ const numericBadgeVariants = cva('inline-flex items-center rounded-full font-mon
|
|
|
27
95
|
{
|
|
28
96
|
type: 'outline',
|
|
29
97
|
size: 'small',
|
|
30
|
-
className: '
|
|
98
|
+
className: 'px-2 py-1'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
iconOnly: true,
|
|
102
|
+
className: 'px-2 py-2'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: 'outline',
|
|
106
|
+
iconOnly: true,
|
|
107
|
+
className: 'px-1 py-1'
|
|
31
108
|
},
|
|
32
109
|
{
|
|
33
110
|
clickable: true,
|
|
34
|
-
type:
|
|
35
|
-
|
|
111
|
+
type: [
|
|
112
|
+
'secondary',
|
|
113
|
+
'outline'
|
|
114
|
+
],
|
|
115
|
+
color: 'neutral',
|
|
116
|
+
className: 'hover:overlay-states-primary-hover active:overlay-states-primary-hover'
|
|
36
117
|
},
|
|
37
118
|
{
|
|
38
119
|
clickable: true,
|
|
39
|
-
type: '
|
|
40
|
-
|
|
120
|
+
type: 'secondary',
|
|
121
|
+
color: 'neutral-alt',
|
|
122
|
+
className: 'hover:overlay-states-primary-alt-hover active:overlay-states-primary-alt-hover'
|
|
41
123
|
},
|
|
42
124
|
{
|
|
43
125
|
clickable: true,
|
|
44
|
-
type: '
|
|
45
|
-
|
|
126
|
+
type: 'solid',
|
|
127
|
+
color: 'brand',
|
|
128
|
+
className: 'hover:overlay-states-on-fill-hover active:overlay-states-on-fill-hover active:ring-focus-brand focus-visible:ring-focus-brand'
|
|
46
129
|
},
|
|
47
130
|
{
|
|
48
131
|
clickable: true,
|
|
49
|
-
type: '
|
|
50
|
-
|
|
132
|
+
type: 'solid',
|
|
133
|
+
color: 'danger',
|
|
134
|
+
className: 'hover:overlay-states-on-fill-hover active:overlay-states-on-fill-hover active:ring-focus-destructive focus-visible:ring-focus-destructive'
|
|
51
135
|
},
|
|
52
136
|
{
|
|
53
137
|
clickable: true,
|
|
54
|
-
type:
|
|
55
|
-
|
|
138
|
+
type: [
|
|
139
|
+
'secondary',
|
|
140
|
+
'outline'
|
|
141
|
+
],
|
|
142
|
+
color: 'brand',
|
|
143
|
+
className: 'hover:overlay-states-brand-hover active:overlay-states-brand-hover'
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
clickable: true,
|
|
147
|
+
type: [
|
|
148
|
+
'secondary',
|
|
149
|
+
'outline'
|
|
150
|
+
],
|
|
151
|
+
color: 'danger',
|
|
152
|
+
className: 'hover:overlay-states-danger-hover active:overlay-states-danger-hover'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
clickable: true,
|
|
156
|
+
type: [
|
|
157
|
+
'secondary',
|
|
158
|
+
'outline'
|
|
159
|
+
],
|
|
160
|
+
color: 'success',
|
|
161
|
+
className: 'hover:overlay-states-success-hover active:overlay-states-success-hover'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
clickable: true,
|
|
165
|
+
type: 'secondary',
|
|
166
|
+
color: 'info',
|
|
167
|
+
className: 'hover:overlay-states-info-hover active:overlay-states-info-hover'
|
|
56
168
|
},
|
|
57
169
|
{
|
|
58
170
|
clickable: true,
|
|
59
|
-
type:
|
|
60
|
-
|
|
171
|
+
type: [
|
|
172
|
+
'secondary',
|
|
173
|
+
'outline'
|
|
174
|
+
],
|
|
175
|
+
className: 'active:ring-focus-primary focus-visible:ring-focus-primary'
|
|
61
176
|
}
|
|
62
177
|
]
|
|
63
178
|
});
|
|
@@ -3,6 +3,7 @@ import { Steps } from "@ark-ui/react/steps";
|
|
|
3
3
|
import { Check } from "../../icons/index.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { NumericBadge } from "../NumericBadge/index.js";
|
|
6
7
|
import { stepperIndicatorVariants } from "./classes.js";
|
|
7
8
|
import { useStepperItemContext } from "./StepperContext.js";
|
|
8
9
|
const renderDefault = (status, index)=>{
|
|
@@ -17,16 +18,21 @@ const StepperIndicator = ({ children, className, ref, 'data-testid': testIdProp,
|
|
|
17
18
|
const testId = useTestId('indicator', testIdProp);
|
|
18
19
|
return /*#__PURE__*/ jsx(Steps.Indicator, {
|
|
19
20
|
asChild: true,
|
|
20
|
-
children: /*#__PURE__*/ jsx(
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
children: /*#__PURE__*/ jsx(NumericBadge, {
|
|
22
|
+
asChild: true,
|
|
23
|
+
type: 'upcoming' === status ? 'outline' : 'secondary',
|
|
24
|
+
color: 'active' === status ? 'brand' : 'danger' === status ? 'danger' : 'neutral',
|
|
23
25
|
"data-slot": "stepper-indicator",
|
|
24
|
-
"data-status": status,
|
|
25
|
-
"data-testid": testId,
|
|
26
26
|
className: cn(stepperIndicatorVariants({
|
|
27
27
|
status
|
|
28
28
|
}), className),
|
|
29
|
-
children:
|
|
29
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
30
|
+
...rest,
|
|
31
|
+
ref: ref,
|
|
32
|
+
"data-status": status,
|
|
33
|
+
"data-testid": testId,
|
|
34
|
+
children: children ?? renderDefault(status, index)
|
|
35
|
+
})
|
|
30
36
|
})
|
|
31
37
|
});
|
|
32
38
|
};
|
|
@@ -6,7 +6,7 @@ export interface StepperListProps extends OlHTMLAttributes<HTMLOListElement>, Te
|
|
|
6
6
|
ref?: Ref<HTMLOListElement>;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* The step bar: an `<ol>` with
|
|
10
|
-
* `aria-labelledby`.
|
|
9
|
+
* The step bar: an `<ol>` with 24px side insets and 12px bottom padding, as in Figma.
|
|
10
|
+
* Name it with `aria-label` or `aria-labelledby`.
|
|
11
11
|
*/
|
|
12
12
|
export declare const StepperList: FC<StepperListProps>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
const stepperVariants = cva('min-w-0');
|
|
4
|
-
const stepperListVariants = cva('m-0 flex min-w-0 list-none items-start
|
|
4
|
+
const stepperListVariants = cva('m-0 flex min-w-0 list-none items-start px-24 pb-12');
|
|
5
5
|
const stepperItemVariants = cva('flex min-w-0 items-start');
|
|
6
6
|
const stepperTriggerVariants = cva(cn('grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] grid-rows-[20px] items-start gap-x-4 bg-transparent p-0 text-left', 'rounded-6 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-focus-primary'));
|
|
7
|
-
const stepperIndicatorVariants = cva("col-start-1 row-span-2 row-start-1
|
|
7
|
+
const stepperIndicatorVariants = cva("col-start-1 row-span-2 row-start-1 min-w-16 [font-feature-settings:'liga'_0] [&_svg]:icon-sm", {
|
|
8
8
|
variants: {
|
|
9
9
|
status: {
|
|
10
|
-
active: '
|
|
11
|
-
danger: '
|
|
12
|
-
completed: '
|
|
13
|
-
upcoming: '
|
|
10
|
+
active: 'px-4 py-2',
|
|
11
|
+
danger: 'px-4 py-2',
|
|
12
|
+
completed: 'px-2 py-2 text-icon-primary',
|
|
13
|
+
upcoming: 'px-3 py-1'
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
defaultVariants: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
3
|
-
"generatedAt": "2026-10-02T12:
|
|
2
|
+
"version": "1.33.0",
|
|
3
|
+
"generatedAt": "2026-10-02T12:33:35.613Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -56848,11 +56848,6 @@
|
|
|
56848
56848
|
"type": "string | undefined",
|
|
56849
56849
|
"required": false
|
|
56850
56850
|
},
|
|
56851
|
-
{
|
|
56852
|
-
"name": "color",
|
|
56853
|
-
"type": "string | undefined",
|
|
56854
|
-
"required": false
|
|
56855
|
-
},
|
|
56856
56851
|
{
|
|
56857
56852
|
"name": "itemProp",
|
|
56858
56853
|
"type": "string | undefined",
|
|
@@ -56938,28 +56933,49 @@
|
|
|
56938
56933
|
"required": false,
|
|
56939
56934
|
"description": "@see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}"
|
|
56940
56935
|
},
|
|
56936
|
+
{
|
|
56937
|
+
"name": "color",
|
|
56938
|
+
"type": "{ neutral: string; 'neutral-alt': string; brand: string; danger: string; success: string; info: string; }",
|
|
56939
|
+
"required": false,
|
|
56940
|
+
"defaultValue": "type === 'solid' ? 'brand' : 'neutral"
|
|
56941
|
+
},
|
|
56941
56942
|
{
|
|
56942
56943
|
"name": "type",
|
|
56943
|
-
"type": "{
|
|
56944
|
+
"type": "{ solid: string; secondary: string; outline: string; }",
|
|
56944
56945
|
"required": false,
|
|
56945
|
-
"defaultValue": "
|
|
56946
|
+
"defaultValue": "secondary"
|
|
56946
56947
|
},
|
|
56947
56948
|
{
|
|
56948
56949
|
"name": "size",
|
|
56949
56950
|
"type": "{ default: string; small: string; }",
|
|
56950
56951
|
"required": false,
|
|
56951
56952
|
"defaultValue": "default"
|
|
56953
|
+
},
|
|
56954
|
+
{
|
|
56955
|
+
"name": "asChild",
|
|
56956
|
+
"type": "boolean | undefined",
|
|
56957
|
+
"required": false,
|
|
56958
|
+
"description": "Applies the badge to its child element, such as a span or a native button.",
|
|
56959
|
+
"defaultValue": "false"
|
|
56952
56960
|
}
|
|
56953
56961
|
],
|
|
56954
56962
|
"variants": [
|
|
56955
56963
|
{
|
|
56956
56964
|
"name": "type",
|
|
56957
56965
|
"options": [
|
|
56958
|
-
"
|
|
56959
|
-
"
|
|
56966
|
+
"solid",
|
|
56967
|
+
"secondary",
|
|
56968
|
+
"outline"
|
|
56969
|
+
]
|
|
56970
|
+
},
|
|
56971
|
+
{
|
|
56972
|
+
"name": "color",
|
|
56973
|
+
"options": [
|
|
56974
|
+
"neutral",
|
|
56975
|
+
"neutral-alt",
|
|
56960
56976
|
"brand",
|
|
56961
|
-
"
|
|
56962
|
-
"
|
|
56977
|
+
"danger",
|
|
56978
|
+
"success",
|
|
56963
56979
|
"info"
|
|
56964
56980
|
]
|
|
56965
56981
|
},
|
|
@@ -56970,6 +56986,12 @@
|
|
|
56970
56986
|
"small"
|
|
56971
56987
|
]
|
|
56972
56988
|
},
|
|
56989
|
+
{
|
|
56990
|
+
"name": "iconOnly",
|
|
56991
|
+
"options": [
|
|
56992
|
+
"true"
|
|
56993
|
+
]
|
|
56994
|
+
},
|
|
56973
56995
|
{
|
|
56974
56996
|
"name": "clickable",
|
|
56975
56997
|
"options": [
|
|
@@ -56982,7 +57004,7 @@
|
|
|
56982
57004
|
"examples": [
|
|
56983
57005
|
{
|
|
56984
57006
|
"name": "Basic",
|
|
56985
|
-
"code": "
|
|
57007
|
+
"code": "args => <NumericBadge {...args}>1</NumericBadge>",
|
|
56986
57008
|
"description": "The default count. Keep it to what the reader can take in at a glance; a four-digit count is\na number they need to read, not see."
|
|
56987
57009
|
},
|
|
56988
57010
|
{
|
|
@@ -56992,8 +57014,18 @@
|
|
|
56992
57014
|
},
|
|
56993
57015
|
{
|
|
56994
57016
|
"name": "Types",
|
|
56995
|
-
"code": "() => (\n // One row per type, so the label always sits beside the badges it names.\n <VStack gap={8} align='start'>\n {(
|
|
56996
|
-
"description": "
|
|
57017
|
+
"code": "() => (\n // One row per type, so the label always sits beside the badges it names.\n <VStack gap={8} align='start'>\n {combinations.map(({ type, color }) => (\n <HStack key={`${type}-${color}`} gap={12} align='center'>\n <span className='sb-annotation w-256 whitespace-nowrap text-right'>\n {type} / {color}\n </span>\n <div\n className={`inline-flex items-center gap-12 p-8 ${color === 'neutral-alt' ? 'bg-component-tooltip-bg' : ''}`}\n >\n <NumericBadge type={type} color={color} size='default'>\n 1\n </NumericBadge>\n <NumericBadge type={type} color={color} size='small'>\n 1\n </NumericBadge>\n </div>\n </HStack>\n ))}\n </VStack>\n)",
|
|
57018
|
+
"description": "Every supported Type × Color combination, in Medium and Small."
|
|
57019
|
+
},
|
|
57020
|
+
{
|
|
57021
|
+
"name": "Content",
|
|
57022
|
+
"code": "() => (\n <VStack gap={16} align='start'>\n {(['default', 'small'] as const).map(size => (\n <HStack key={size} gap={12} align='center'>\n <span className='sb-annotation w-96 text-right'>{size}</span>\n <NumericBadge size={size}>1</NumericBadge>\n <NumericBadge size={size}>99</NumericBadge>\n <NumericBadge size={size} color='danger' aria-label='Needs attention'>\n !\n </NumericBadge>\n <NumericBadge size={size} color='info' aria-label='Unknown'>\n ?\n </NumericBadge>\n <NumericBadge size={size} color='success' aria-label='Completed'>\n <Check />\n </NumericBadge>\n </HStack>\n ))}\n </VStack>\n)",
|
|
57023
|
+
"description": "Numbers, short glyphs, and icons share the same badge heights."
|
|
57024
|
+
},
|
|
57025
|
+
{
|
|
57026
|
+
"name": "Clickable",
|
|
57027
|
+
"code": "() => {\n const [activations, setActivations] = useState(0);\n\n return (\n <VStack gap={12} align='start'>\n {combinations.map(({ type, color }) => (\n <HStack key={`${type}-${color}`} gap={12} align='center'>\n <span className='sb-annotation w-256 whitespace-nowrap text-right'>\n {type} / {color}\n </span>\n <div className={color === 'neutral-alt' ? 'bg-component-tooltip-bg p-8' : 'p-8'}>\n <NumericBadge\n asChild\n type={type}\n color={color}\n onClick={() => setActivations(count => count + 1)}\n >\n <button type='button' aria-label={`${type} ${color}`}>\n 1\n </button>\n </NumericBadge>\n </div>\n </HStack>\n ))}\n <output aria-label='Activations'>{activations}</output>\n </VStack>\n );\n}",
|
|
57028
|
+
"description": "Use a native button for an action; Tab, Enter, and Space work as expected."
|
|
56997
57029
|
}
|
|
56998
57030
|
]
|
|
56999
57031
|
},
|
|
@@ -95981,7 +96013,7 @@
|
|
|
95981
96013
|
{
|
|
95982
96014
|
"name": "InDrawer",
|
|
95983
96015
|
"code": "() => {\n const { step, statuses, goTo } = usePolicyFlow();\n const { nextRef, submitRef, onBackClick, onNextClick } = useFooterFocus(step);\n const [submitted, setSubmitted] = useState(0);\n const last = step === POLICY_STEPS.length - 1;\n const onSubmit = (event: FormEvent) => {\n event.preventDefault();\n setSubmitted(n => n + 1);\n };\n return (\n <Drawer data-testid='drawer' width={640}>\n <DrawerTrigger asChild>\n <Button variant='outline' color='neutral' data-testid='drawer-open'>\n Create policy\n </Button>\n </DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Create policy</DrawerTitle>\n </DrawerHeader>\n <form onSubmit={onSubmit} className='flex min-h-0 flex-1 flex-col'>\n <Stepper\n data-testid='stepper'\n count={POLICY_STEPS.length}\n step={step}\n onStepChange={details => goTo(details.step)}\n className='flex min-h-0 flex-1 flex-col'\n >\n <StepperList aria-label='Create policy steps'>\n {POLICY_STEPS.map((title, i) => (\n <StepperItem key={title} index={i} status={statuses[i]}>\n <StepperTrigger>\n <StepperIndicator />\n <StepperTitle>{title}</StepperTitle>\n </StepperTrigger>\n <StepperSeparator />\n </StepperItem>\n ))}\n </StepperList>\n <DrawerBody>\n {POLICY_STEPS.map((title, i) => (\n <StepperContent key={title} index={i} className='py-16'>\n <BodyPlaceholder label={`${title} fields`} />\n </StepperContent>\n ))}\n <span className='sb-annotation' data-testid='stepper-submitted'>\n Submitted: {submitted}\n </span>\n </DrawerBody>\n <DrawerFooter>\n {step > 0 && (\n <DrawerFooterControls placement='left'>\n <StepperPrevTrigger asChild onClick={onBackClick}>\n <Button variant='outline' color='neutral' size='large'>\n Back\n </Button>\n </StepperPrevTrigger>\n </DrawerFooterControls>\n )}\n <DrawerFooterControls placement='right'>\n {last ? (\n <Button\n ref={submitRef}\n type='submit'\n variant='primary'\n color='brand'\n size='large'\n >\n Create policy\n </Button>\n ) : (\n <StepperNextTrigger asChild onClick={onNextClick}>\n <Button ref={nextRef} variant='primary' color='brand' size='large'>\n Next: {POLICY_STEPS[step + 1]}\n </Button>\n </StepperNextTrigger>\n )}\n </DrawerFooterControls>\n </DrawerFooter>\n </Stepper>\n </form>\n </DrawerContent>\n </Drawer>\n );\n}",
|
|
95984
|
-
"description": "Inside a create drawer: the step list sits under the header, `StepperContent` shows the current\nstep's body (every body stays mounted, so fields keep their values) and the footer moves with\nBack / Next. Steps never submit the form; only the last step's own submit button does. Focus\nstays on the footer when Back or Next unmounts. Drawer parts inside the `Stepper
|
|
96016
|
+
"description": "Inside a create drawer: the step list sits under the header, `StepperContent` shows the current\nstep's body (every body stays mounted, so fields keep their values) and the footer moves with\nBack / Next. Steps never submit the form; only the last step's own submit button does. Focus\nstays on the footer when Back or Next unmounts. The list sits directly below the header,\nwith 24px side insets, 12px bottom padding and no divider. Drawer parts inside the `Stepper`\nroot take its test ids (`stepper--body`, `stepper--footer`), not the Drawer's."
|
|
95985
96017
|
},
|
|
95986
96018
|
{
|
|
95987
96019
|
"name": "LongLabel",
|
|
@@ -106837,7 +106869,7 @@
|
|
|
106837
106869
|
"props": [
|
|
106838
106870
|
{
|
|
106839
106871
|
"name": "color",
|
|
106840
|
-
"type": "string
|
|
106872
|
+
"type": "{ neutral: string; 'neutral-alt': string; brand: string; danger: string; success: string; info: string; }",
|
|
106841
106873
|
"required": false
|
|
106842
106874
|
},
|
|
106843
106875
|
{
|
|
@@ -107104,6 +107136,12 @@
|
|
|
107104
107136
|
"type": "string | undefined",
|
|
107105
107137
|
"required": false,
|
|
107106
107138
|
"description": "@see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}"
|
|
107139
|
+
},
|
|
107140
|
+
{
|
|
107141
|
+
"name": "asChild",
|
|
107142
|
+
"type": "boolean | undefined",
|
|
107143
|
+
"required": false,
|
|
107144
|
+
"description": "Applies the badge to its child element, such as a span or a native button."
|
|
107107
107145
|
}
|
|
107108
107146
|
]
|
|
107109
107147
|
},
|
package/package.json
CHANGED