@attrus-ds/core 0.2.0 → 1.0.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/LICENSE +27 -27
- package/dist/assets/flags/Brazil-rounded.svg +15 -15
- package/dist/assets/flags/Brazil-square.svg +16 -16
- package/dist/assets/flags/Chile-rounded.svg +10 -10
- package/dist/assets/flags/Chile-square.svg +10 -10
- package/dist/assets/flags/Colombia-rounded.svg +9 -9
- package/dist/assets/flags/Colombia-square.svg +9 -9
- package/dist/assets/flags/EUA-rounded.svg +10 -10
- package/dist/assets/flags/EUA-square.svg +10 -10
- package/dist/assets/flags/EUR-rounded.svg +8 -8
- package/dist/assets/flags/EUR-square.svg +8 -8
- package/dist/assets/flags/Mexico-rounded.svg +18 -18
- package/dist/assets/flags/Mexico-square.svg +18 -18
- package/dist/assets/icon-attrus-dark.svg +2 -2
- package/dist/assets/icon-attrus-light.svg +2 -2
- package/dist/assets/logo-attrus-dark.svg +7 -7
- package/dist/assets/logo-attrus-light.svg +7 -7
- package/dist/css/components/buttons.css +301 -301
- package/dist/css/components/callout.css +195 -195
- package/dist/css/components/cards.css +272 -272
- package/dist/css/components/combobox.css +319 -319
- package/dist/css/components/empty-states.css +61 -61
- package/dist/css/components/inputs.css +975 -975
- package/dist/css/components/number-input.css +138 -138
- package/dist/css/components/overlays.css +374 -374
- package/dist/css/components/primitives.css +314 -314
- package/dist/css/components/sidebar.css +179 -179
- package/dist/css/components/smart-search.css +91 -91
- package/dist/css/components/status-pills.css +207 -207
- package/dist/css/components/stepper.css +309 -309
- package/dist/css/components/table.css +602 -602
- package/dist/css/components/tabs.css +319 -319
- package/dist/css/components/toast.css +243 -243
- package/dist/css/components/tooltip.css +231 -231
- package/dist/css/components/topbar.css +148 -148
- package/dist/css/tokens.css +713 -666
- package/dist/react/AppSidebar/AppSidebar.d.ts +50 -50
- package/dist/react/AppSidebar/AppSidebar.tsx +197 -197
- package/dist/react/AppTopbar/AppTopbar.d.ts +58 -58
- package/dist/react/AppTopbar/AppTopbar.tsx +203 -203
- package/dist/react/Atoms/Atoms.d.ts +149 -149
- package/dist/react/Atoms/Atoms.tsx +407 -407
- package/dist/react/Button/Button.d.ts +25 -25
- package/dist/react/Button/Button.tsx +83 -83
- package/dist/react/Callout/Callout.d.ts +29 -29
- package/dist/react/Callout/Callout.tsx +98 -98
- package/dist/react/Card/Card.d.ts +38 -38
- package/dist/react/Card/Card.tsx +93 -93
- package/dist/react/Combobox/Combobox.d.ts +52 -52
- package/dist/react/Combobox/Combobox.tsx +254 -254
- package/dist/react/DataTable/DataTable.d.ts +81 -81
- package/dist/react/DataTable/DataTable.tsx +308 -308
- package/dist/react/Drawer/Drawer.d.ts +35 -35
- package/dist/react/Drawer/Drawer.tsx +226 -226
- package/dist/react/Input/Input.d.ts +155 -155
- package/dist/react/Input/Input.tsx +478 -478
- package/dist/react/Modal/Modal.d.ts +27 -27
- package/dist/react/Modal/Modal.tsx +173 -173
- package/dist/react/NumberInput/NumberInput.d.ts +25 -25
- package/dist/react/NumberInput/NumberInput.tsx +117 -117
- package/dist/react/Pill/Pill.d.ts +31 -31
- package/dist/react/Pill/Pill.tsx +104 -104
- package/dist/react/SearchPill/SearchPill.d.ts +14 -14
- package/dist/react/SearchPill/SearchPill.tsx +40 -40
- package/dist/react/SmartSearch/SmartSearch.d.ts +65 -65
- package/dist/react/SmartSearch/SmartSearch.tsx +271 -271
- package/dist/react/Stepper/Stepper.d.ts +25 -25
- package/dist/react/Stepper/Stepper.tsx +94 -94
- package/dist/react/Tabs/Tabs.d.ts +32 -32
- package/dist/react/Tabs/Tabs.tsx +147 -147
- package/dist/react/Toast/Toast.d.ts +30 -30
- package/dist/react/Toast/Toast.tsx +94 -94
- package/dist/react/Tooltip/Tooltip.d.ts +23 -23
- package/dist/react/Tooltip/Tooltip.tsx +80 -80
- package/dist/react/ZeroState/ZeroState.d.ts +17 -17
- package/dist/react/ZeroState/ZeroState.tsx +45 -45
- package/dist/react/index.ts +35 -35
- package/dist/tokens/attrus-tokens.flat.json +1234 -1234
- package/dist/tokens/attrus-tokens.json +1089 -1089
- package/package.json +66 -64
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'danger' | 'danger-outline' | 'success' | 'link' | 'inverse';
|
|
4
|
-
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
-
|
|
6
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
-
/** Visual emphasis. Default: 'primary'. */
|
|
8
|
-
variant?: ButtonVariant;
|
|
9
|
-
/** Control height: xs=24, sm=32, md=40 (default), lg=48. */
|
|
10
|
-
size?: ButtonSize;
|
|
11
|
-
/** Shows the canonical spinner and disables interaction. */
|
|
12
|
-
loading?: boolean;
|
|
13
|
-
/** Square icon-only button (.btn-icon) — width locks to the height. */
|
|
14
|
-
iconOnly?: boolean;
|
|
15
|
-
/** Leading slot — typically an <Icon/>. */
|
|
16
|
-
icon?: React.ReactNode;
|
|
17
|
-
/** Trailing slot — e.g. a chevron. */
|
|
18
|
-
iconRight?: React.ReactNode;
|
|
19
|
-
/** On dark/brand panels: remaps ghost/secondary to the inverse foreground scale (`.on-inverse`). */
|
|
20
|
-
onInverse?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export declare const Button: React.FC<ButtonProps>;
|
|
24
|
-
export declare const ButtonGroup: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
25
|
-
export default Button;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'danger' | 'danger-outline' | 'success' | 'link' | 'inverse';
|
|
4
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
+
|
|
6
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
/** Visual emphasis. Default: 'primary'. */
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
/** Control height: xs=24, sm=32, md=40 (default), lg=48. */
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
/** Shows the canonical spinner and disables interaction. */
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/** Square icon-only button (.btn-icon) — width locks to the height. */
|
|
14
|
+
iconOnly?: boolean;
|
|
15
|
+
/** Leading slot — typically an <Icon/>. */
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
/** Trailing slot — e.g. a chevron. */
|
|
18
|
+
iconRight?: React.ReactNode;
|
|
19
|
+
/** On dark/brand panels: remaps ghost/secondary to the inverse foreground scale (`.on-inverse`). */
|
|
20
|
+
onInverse?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
24
|
+
export declare const ButtonGroup: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
25
|
+
export default Button;
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ATTRUS Button — typed wrapper over the canonical `.btn` system
|
|
5
|
-
* (preview/components/buttons.css). The CSS stays the single source
|
|
6
|
-
* of visual truth; this component only composes class names.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export type ButtonVariant =
|
|
10
|
-
| 'primary' /* brand fill — main action */
|
|
11
|
-
| 'secondary' /* neutral fill + hairline border — alternative actions */
|
|
12
|
-
| 'tertiary' /* soft neutral fill, borderless — quiet affirmative */
|
|
13
|
-
| 'ghost' /* nothing until hover — toolbars, table rows */
|
|
14
|
-
| 'danger' /* destructive solid */
|
|
15
|
-
| 'danger-outline' /* destructive contextual — outline, surface bg */
|
|
16
|
-
| 'success' /* strong positive (rare) */
|
|
17
|
-
| 'link' /* looks like an inline text link */
|
|
18
|
-
| 'inverse'; /* white on dark/brand panels */
|
|
19
|
-
|
|
20
|
-
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
21
|
-
|
|
22
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
23
|
-
/** Visual emphasis. Default: 'primary'. */
|
|
24
|
-
variant?: ButtonVariant;
|
|
25
|
-
/** Control height: xs=24, sm=32, md=40 (default), lg=48. */
|
|
26
|
-
size?: ButtonSize;
|
|
27
|
-
/** Shows the canonical spinner and disables interaction. */
|
|
28
|
-
loading?: boolean;
|
|
29
|
-
/** Square icon-only button (.btn-icon) — width locks to the height. */
|
|
30
|
-
iconOnly?: boolean;
|
|
31
|
-
/** Leading slot — typically an <Icon/>. */
|
|
32
|
-
icon?: React.ReactNode;
|
|
33
|
-
/** Trailing slot — e.g. a chevron. */
|
|
34
|
-
iconRight?: React.ReactNode;
|
|
35
|
-
/** On dark/brand panels: remaps ghost/secondary to the inverse foreground
|
|
36
|
-
* scale (`.on-inverse`). Only meaningful with variant 'ghost' | 'secondary'. */
|
|
37
|
-
onInverse?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const Button: React.FC<ButtonProps> = ({
|
|
41
|
-
variant = 'primary',
|
|
42
|
-
size = 'md',
|
|
43
|
-
loading = false,
|
|
44
|
-
iconOnly = false,
|
|
45
|
-
icon,
|
|
46
|
-
iconRight,
|
|
47
|
-
onInverse = false,
|
|
48
|
-
className,
|
|
49
|
-
children,
|
|
50
|
-
disabled,
|
|
51
|
-
type = 'button',
|
|
52
|
-
...rest
|
|
53
|
-
}) => {
|
|
54
|
-
const cls = [
|
|
55
|
-
'btn',
|
|
56
|
-
`btn-${variant}`,
|
|
57
|
-
size !== 'md' ? `btn-${size}` : '',
|
|
58
|
-
iconOnly ? 'btn-icon' : '',
|
|
59
|
-
loading ? 'is-loading' : '',
|
|
60
|
-
onInverse ? 'on-inverse' : '',
|
|
61
|
-
className || '',
|
|
62
|
-
]
|
|
63
|
-
.filter(Boolean)
|
|
64
|
-
.join(' ');
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<button type={type} className={cls} disabled={disabled || loading} aria-busy={loading || undefined} {...rest}>
|
|
68
|
-
{icon}
|
|
69
|
-
{children}
|
|
70
|
-
{iconRight}
|
|
71
|
-
</button>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default Button;
|
|
76
|
-
|
|
77
|
-
/** Segmented / toolbar cluster — children must be <Button>s (`.btn-group`):
|
|
78
|
-
* outer corners pill-rounded, inner seams collapsed. */
|
|
79
|
-
export const ButtonGroup: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, children, ...rest }) => (
|
|
80
|
-
<div role="group" className={['btn-group', className || ''].filter(Boolean).join(' ')} {...rest}>
|
|
81
|
-
{children}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ATTRUS Button — typed wrapper over the canonical `.btn` system
|
|
5
|
+
* (preview/components/buttons.css). The CSS stays the single source
|
|
6
|
+
* of visual truth; this component only composes class names.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type ButtonVariant =
|
|
10
|
+
| 'primary' /* brand fill — main action */
|
|
11
|
+
| 'secondary' /* neutral fill + hairline border — alternative actions */
|
|
12
|
+
| 'tertiary' /* soft neutral fill, borderless — quiet affirmative */
|
|
13
|
+
| 'ghost' /* nothing until hover — toolbars, table rows */
|
|
14
|
+
| 'danger' /* destructive solid */
|
|
15
|
+
| 'danger-outline' /* destructive contextual — outline, surface bg */
|
|
16
|
+
| 'success' /* strong positive (rare) */
|
|
17
|
+
| 'link' /* looks like an inline text link */
|
|
18
|
+
| 'inverse'; /* white on dark/brand panels */
|
|
19
|
+
|
|
20
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
21
|
+
|
|
22
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
23
|
+
/** Visual emphasis. Default: 'primary'. */
|
|
24
|
+
variant?: ButtonVariant;
|
|
25
|
+
/** Control height: xs=24, sm=32, md=40 (default), lg=48. */
|
|
26
|
+
size?: ButtonSize;
|
|
27
|
+
/** Shows the canonical spinner and disables interaction. */
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
/** Square icon-only button (.btn-icon) — width locks to the height. */
|
|
30
|
+
iconOnly?: boolean;
|
|
31
|
+
/** Leading slot — typically an <Icon/>. */
|
|
32
|
+
icon?: React.ReactNode;
|
|
33
|
+
/** Trailing slot — e.g. a chevron. */
|
|
34
|
+
iconRight?: React.ReactNode;
|
|
35
|
+
/** On dark/brand panels: remaps ghost/secondary to the inverse foreground
|
|
36
|
+
* scale (`.on-inverse`). Only meaningful with variant 'ghost' | 'secondary'. */
|
|
37
|
+
onInverse?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Button: React.FC<ButtonProps> = ({
|
|
41
|
+
variant = 'primary',
|
|
42
|
+
size = 'md',
|
|
43
|
+
loading = false,
|
|
44
|
+
iconOnly = false,
|
|
45
|
+
icon,
|
|
46
|
+
iconRight,
|
|
47
|
+
onInverse = false,
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
disabled,
|
|
51
|
+
type = 'button',
|
|
52
|
+
...rest
|
|
53
|
+
}) => {
|
|
54
|
+
const cls = [
|
|
55
|
+
'btn',
|
|
56
|
+
`btn-${variant}`,
|
|
57
|
+
size !== 'md' ? `btn-${size}` : '',
|
|
58
|
+
iconOnly ? 'btn-icon' : '',
|
|
59
|
+
loading ? 'is-loading' : '',
|
|
60
|
+
onInverse ? 'on-inverse' : '',
|
|
61
|
+
className || '',
|
|
62
|
+
]
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.join(' ');
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<button type={type} className={cls} disabled={disabled || loading} aria-busy={loading || undefined} {...rest}>
|
|
68
|
+
{icon}
|
|
69
|
+
{children}
|
|
70
|
+
{iconRight}
|
|
71
|
+
</button>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default Button;
|
|
76
|
+
|
|
77
|
+
/** Segmented / toolbar cluster — children must be <Button>s (`.btn-group`):
|
|
78
|
+
* outer corners pill-rounded, inner seams collapsed. */
|
|
79
|
+
export const ButtonGroup: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, children, ...rest }) => (
|
|
80
|
+
<div role="group" className={['btn-group', className || ''].filter(Boolean).join(' ')} {...rest}>
|
|
81
|
+
{children}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export type CalloutTone = 'info' | 'warn' | 'success' | 'danger' | 'neutral';
|
|
4
|
-
|
|
5
|
-
export interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
/** Semantic tone. Default 'info' (brand royal tint). */
|
|
7
|
-
tone?: CalloutTone;
|
|
8
|
-
/** Compact density for dense panels & forms. */
|
|
9
|
-
small?: boolean;
|
|
10
|
-
/** Leading icon slot (18px, 16px when small). */
|
|
11
|
-
icon?: React.ReactNode;
|
|
12
|
-
/** Bold heading line — wraps content in the rich vertical layout. */
|
|
13
|
-
title?: React.ReactNode;
|
|
14
|
-
/** Action row (canonical Buttons). Implies the rich layout. */
|
|
15
|
-
actions?: React.ReactNode;
|
|
16
|
-
/** Full-width alert bar: centered row, left accent rule, actions inline-right. */
|
|
17
|
-
bar?: boolean;
|
|
18
|
-
/** On a bar: re-adds radius + full border for in-container use. */
|
|
19
|
-
rounded?: boolean;
|
|
20
|
-
/** Content-sized, single line (badges, hero notices). */
|
|
21
|
-
inline?: boolean;
|
|
22
|
-
/** Glassy translucent tint + light text for dark surfaces. */
|
|
23
|
-
onInverse?: boolean;
|
|
24
|
-
/** When set, renders the × dismiss button and calls back on click. */
|
|
25
|
-
onDismiss?: () => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export declare const Callout: React.FC<CalloutProps>;
|
|
29
|
-
export default Callout;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type CalloutTone = 'info' | 'warn' | 'success' | 'danger' | 'neutral';
|
|
4
|
+
|
|
5
|
+
export interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Semantic tone. Default 'info' (brand royal tint). */
|
|
7
|
+
tone?: CalloutTone;
|
|
8
|
+
/** Compact density for dense panels & forms. */
|
|
9
|
+
small?: boolean;
|
|
10
|
+
/** Leading icon slot (18px, 16px when small). */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/** Bold heading line — wraps content in the rich vertical layout. */
|
|
13
|
+
title?: React.ReactNode;
|
|
14
|
+
/** Action row (canonical Buttons). Implies the rich layout. */
|
|
15
|
+
actions?: React.ReactNode;
|
|
16
|
+
/** Full-width alert bar: centered row, left accent rule, actions inline-right. */
|
|
17
|
+
bar?: boolean;
|
|
18
|
+
/** On a bar: re-adds radius + full border for in-container use. */
|
|
19
|
+
rounded?: boolean;
|
|
20
|
+
/** Content-sized, single line (badges, hero notices). */
|
|
21
|
+
inline?: boolean;
|
|
22
|
+
/** Glassy translucent tint + light text for dark surfaces. */
|
|
23
|
+
onInverse?: boolean;
|
|
24
|
+
/** When set, renders the × dismiss button and calls back on click. */
|
|
25
|
+
onDismiss?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare const Callout: React.FC<CalloutProps>;
|
|
29
|
+
export default Callout;
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ATTRUS Callout — typed wrapper over the canonical `.callout` system
|
|
5
|
-
* (preview/components/callout.css). Scales from a one-line note up to a
|
|
6
|
-
* rich panel (title + body + actions + dismiss) and a full-width alert bar.
|
|
7
|
-
* CSS stays the visual source of truth.
|
|
8
|
-
*
|
|
9
|
-
* Action buttons convention: keep them SMALL and DISCREET — Button
|
|
10
|
-
* size="xs" with ghost/tertiary/secondary; reserve solid fills and
|
|
11
|
-
* danger for destructive actions.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export type CalloutTone = 'info' | 'warn' | 'success' | 'danger' | 'neutral';
|
|
15
|
-
|
|
16
|
-
export interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
|
-
/** Semantic tone. Default 'info' (brand royal tint). */
|
|
18
|
-
tone?: CalloutTone;
|
|
19
|
-
/** Compact density for dense panels & forms. */
|
|
20
|
-
small?: boolean;
|
|
21
|
-
/** Leading icon slot (18px, 16px when small). */
|
|
22
|
-
icon?: React.ReactNode;
|
|
23
|
-
/** Bold heading line — wraps content in the rich vertical layout. */
|
|
24
|
-
title?: React.ReactNode;
|
|
25
|
-
/** Action row (canonical Buttons). Implies the rich layout. */
|
|
26
|
-
actions?: React.ReactNode;
|
|
27
|
-
/** Full-width alert bar: centered row, left accent rule, actions inline-right. */
|
|
28
|
-
bar?: boolean;
|
|
29
|
-
/** On a bar: re-adds radius + full border for in-container use. */
|
|
30
|
-
rounded?: boolean;
|
|
31
|
-
/** Content-sized, single line (badges, hero notices). */
|
|
32
|
-
inline?: boolean;
|
|
33
|
-
/** Glassy translucent tint + light text for dark surfaces. */
|
|
34
|
-
onInverse?: boolean;
|
|
35
|
-
/** When set, renders the × dismiss button and calls back on click. */
|
|
36
|
-
onDismiss?: () => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const DismissGlyph: React.FC = () => (
|
|
40
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" aria-hidden="true">
|
|
41
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
42
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
43
|
-
</svg>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export const Callout: React.FC<CalloutProps> = ({
|
|
47
|
-
tone = 'info',
|
|
48
|
-
small = false,
|
|
49
|
-
icon,
|
|
50
|
-
title,
|
|
51
|
-
actions,
|
|
52
|
-
bar = false,
|
|
53
|
-
rounded = false,
|
|
54
|
-
inline = false,
|
|
55
|
-
onInverse = false,
|
|
56
|
-
onDismiss,
|
|
57
|
-
className,
|
|
58
|
-
children,
|
|
59
|
-
...rest
|
|
60
|
-
}) => {
|
|
61
|
-
const cls = [
|
|
62
|
-
'callout',
|
|
63
|
-
`callout-${tone}`, /* always emitted — .callout-info pairs with .on-inverse in CSS */
|
|
64
|
-
small ? 'callout-sm' : '',
|
|
65
|
-
bar ? 'callout-bar' : '',
|
|
66
|
-
bar && rounded ? 'callout-rounded' : '',
|
|
67
|
-
inline ? 'callout-inline' : '',
|
|
68
|
-
onInverse ? 'on-inverse' : '',
|
|
69
|
-
className || '',
|
|
70
|
-
]
|
|
71
|
-
.filter(Boolean)
|
|
72
|
-
.join(' ');
|
|
73
|
-
|
|
74
|
-
const rich = Boolean(title || actions);
|
|
75
|
-
const body = children != null ? <div className="callout-body">{children}</div> : null;
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<div className={cls} role={tone === 'danger' ? 'alert' : 'status'} {...rest}>
|
|
79
|
-
{icon}
|
|
80
|
-
{rich ? (
|
|
81
|
-
<div className="callout-content">
|
|
82
|
-
{title ? <div className="callout-title">{title}</div> : null}
|
|
83
|
-
{body}
|
|
84
|
-
{actions ? <div className="callout-actions">{actions}</div> : null}
|
|
85
|
-
</div>
|
|
86
|
-
) : (
|
|
87
|
-
body
|
|
88
|
-
)}
|
|
89
|
-
{onDismiss ? (
|
|
90
|
-
<button type="button" className="callout-dismiss" aria-label="Dismiss" onClick={onDismiss}>
|
|
91
|
-
<DismissGlyph />
|
|
92
|
-
</button>
|
|
93
|
-
) : null}
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default Callout;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ATTRUS Callout — typed wrapper over the canonical `.callout` system
|
|
5
|
+
* (preview/components/callout.css). Scales from a one-line note up to a
|
|
6
|
+
* rich panel (title + body + actions + dismiss) and a full-width alert bar.
|
|
7
|
+
* CSS stays the visual source of truth.
|
|
8
|
+
*
|
|
9
|
+
* Action buttons convention: keep them SMALL and DISCREET — Button
|
|
10
|
+
* size="xs" with ghost/tertiary/secondary; reserve solid fills and
|
|
11
|
+
* danger for destructive actions.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type CalloutTone = 'info' | 'warn' | 'success' | 'danger' | 'neutral';
|
|
15
|
+
|
|
16
|
+
export interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
/** Semantic tone. Default 'info' (brand royal tint). */
|
|
18
|
+
tone?: CalloutTone;
|
|
19
|
+
/** Compact density for dense panels & forms. */
|
|
20
|
+
small?: boolean;
|
|
21
|
+
/** Leading icon slot (18px, 16px when small). */
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
/** Bold heading line — wraps content in the rich vertical layout. */
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
/** Action row (canonical Buttons). Implies the rich layout. */
|
|
26
|
+
actions?: React.ReactNode;
|
|
27
|
+
/** Full-width alert bar: centered row, left accent rule, actions inline-right. */
|
|
28
|
+
bar?: boolean;
|
|
29
|
+
/** On a bar: re-adds radius + full border for in-container use. */
|
|
30
|
+
rounded?: boolean;
|
|
31
|
+
/** Content-sized, single line (badges, hero notices). */
|
|
32
|
+
inline?: boolean;
|
|
33
|
+
/** Glassy translucent tint + light text for dark surfaces. */
|
|
34
|
+
onInverse?: boolean;
|
|
35
|
+
/** When set, renders the × dismiss button and calls back on click. */
|
|
36
|
+
onDismiss?: () => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const DismissGlyph: React.FC = () => (
|
|
40
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" aria-hidden="true">
|
|
41
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
42
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const Callout: React.FC<CalloutProps> = ({
|
|
47
|
+
tone = 'info',
|
|
48
|
+
small = false,
|
|
49
|
+
icon,
|
|
50
|
+
title,
|
|
51
|
+
actions,
|
|
52
|
+
bar = false,
|
|
53
|
+
rounded = false,
|
|
54
|
+
inline = false,
|
|
55
|
+
onInverse = false,
|
|
56
|
+
onDismiss,
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
...rest
|
|
60
|
+
}) => {
|
|
61
|
+
const cls = [
|
|
62
|
+
'callout',
|
|
63
|
+
`callout-${tone}`, /* always emitted — .callout-info pairs with .on-inverse in CSS */
|
|
64
|
+
small ? 'callout-sm' : '',
|
|
65
|
+
bar ? 'callout-bar' : '',
|
|
66
|
+
bar && rounded ? 'callout-rounded' : '',
|
|
67
|
+
inline ? 'callout-inline' : '',
|
|
68
|
+
onInverse ? 'on-inverse' : '',
|
|
69
|
+
className || '',
|
|
70
|
+
]
|
|
71
|
+
.filter(Boolean)
|
|
72
|
+
.join(' ');
|
|
73
|
+
|
|
74
|
+
const rich = Boolean(title || actions);
|
|
75
|
+
const body = children != null ? <div className="callout-body">{children}</div> : null;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className={cls} role={tone === 'danger' ? 'alert' : 'status'} {...rest}>
|
|
79
|
+
{icon}
|
|
80
|
+
{rich ? (
|
|
81
|
+
<div className="callout-content">
|
|
82
|
+
{title ? <div className="callout-title">{title}</div> : null}
|
|
83
|
+
{body}
|
|
84
|
+
{actions ? <div className="callout-actions">{actions}</div> : null}
|
|
85
|
+
</div>
|
|
86
|
+
) : (
|
|
87
|
+
body
|
|
88
|
+
)}
|
|
89
|
+
{onDismiss ? (
|
|
90
|
+
<button type="button" className="callout-dismiss" aria-label="Dismiss" onClick={onDismiss}>
|
|
91
|
+
<DismissGlyph />
|
|
92
|
+
</button>
|
|
93
|
+
) : null}
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default Callout;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export type CardVariant = 'default' | 'flat' | 'subtle' | 'sunken' | 'raised' | 'floating' | 'hero' | 'inverse';
|
|
4
|
-
export type CardAccent = 'success' | 'warning' | 'danger' | 'info';
|
|
5
|
-
export type CardDensity = 'compact' | 'default' | 'spacious';
|
|
6
|
-
|
|
7
|
-
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
/** Surface role. Default: surface + hairline + xs shadow. */
|
|
9
|
-
variant?: CardVariant;
|
|
10
|
-
/** Semantic banner tint (success/warning/danger/info). */
|
|
11
|
-
accent?: CardAccent;
|
|
12
|
-
/** Padding density for the card and its slots. */
|
|
13
|
-
density?: CardDensity;
|
|
14
|
-
/** Clip children to the rounded corners (tables, images). */
|
|
15
|
-
clip?: boolean;
|
|
16
|
-
/** Hover/press affordance (`.card.interactive`). */
|
|
17
|
-
interactive?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CardStatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
|
-
label: React.ReactNode;
|
|
22
|
-
value: React.ReactNode;
|
|
23
|
-
/** Delta text, e.g. "+8.2%". */
|
|
24
|
-
delta?: React.ReactNode;
|
|
25
|
-
/** up=success, down=danger, flat=muted. Default: 'flat'. */
|
|
26
|
-
deltaDirection?: 'up' | 'down' | 'flat';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface CardSlotProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
30
|
-
|
|
31
|
-
export declare const Card: React.FC<CardProps>;
|
|
32
|
-
export declare const CardHeader: React.FC<CardSlotProps>;
|
|
33
|
-
export declare const CardBody: React.FC<CardSlotProps>;
|
|
34
|
-
export declare const CardFooter: React.FC<CardSlotProps>;
|
|
35
|
-
export declare const CardCanvas: React.FC<CardSlotProps>;
|
|
36
|
-
export declare const CardDivider: React.FC<CardSlotProps>;
|
|
37
|
-
export declare const CardStat: React.FC<CardStatProps>;
|
|
38
|
-
export default Card;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type CardVariant = 'default' | 'flat' | 'subtle' | 'sunken' | 'raised' | 'floating' | 'hero' | 'inverse';
|
|
4
|
+
export type CardAccent = 'success' | 'warning' | 'danger' | 'info';
|
|
5
|
+
export type CardDensity = 'compact' | 'default' | 'spacious';
|
|
6
|
+
|
|
7
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** Surface role. Default: surface + hairline + xs shadow. */
|
|
9
|
+
variant?: CardVariant;
|
|
10
|
+
/** Semantic banner tint (success/warning/danger/info). */
|
|
11
|
+
accent?: CardAccent;
|
|
12
|
+
/** Padding density for the card and its slots. */
|
|
13
|
+
density?: CardDensity;
|
|
14
|
+
/** Clip children to the rounded corners (tables, images). */
|
|
15
|
+
clip?: boolean;
|
|
16
|
+
/** Hover/press affordance (`.card.interactive`). */
|
|
17
|
+
interactive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CardStatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
label: React.ReactNode;
|
|
22
|
+
value: React.ReactNode;
|
|
23
|
+
/** Delta text, e.g. "+8.2%". */
|
|
24
|
+
delta?: React.ReactNode;
|
|
25
|
+
/** up=success, down=danger, flat=muted. Default: 'flat'. */
|
|
26
|
+
deltaDirection?: 'up' | 'down' | 'flat';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CardSlotProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
30
|
+
|
|
31
|
+
export declare const Card: React.FC<CardProps>;
|
|
32
|
+
export declare const CardHeader: React.FC<CardSlotProps>;
|
|
33
|
+
export declare const CardBody: React.FC<CardSlotProps>;
|
|
34
|
+
export declare const CardFooter: React.FC<CardSlotProps>;
|
|
35
|
+
export declare const CardCanvas: React.FC<CardSlotProps>;
|
|
36
|
+
export declare const CardDivider: React.FC<CardSlotProps>;
|
|
37
|
+
export declare const CardStat: React.FC<CardStatProps>;
|
|
38
|
+
export default Card;
|