@datalayer/primer-addons 1.0.39 → 1.0.41
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/README.md +19 -8
- package/lib/components/box/boxCss.js +17 -1
- package/lib/components/box/boxTokens.d.ts +2 -1
- package/lib/components/box/boxTokens.js +2 -1
- package/lib/components/card/Card.d.ts +119 -5
- package/lib/components/card/Card.js +60 -46
- package/lib/components/card/Card.stories.d.ts +6 -0
- package/lib/components/card/Card.stories.js +26 -0
- package/lib/components/date-picker/TimeColumns.d.ts +5 -0
- package/lib/components/date-picker/TimeColumns.js +44 -3
- package/lib/components/entity-avatar/EntityAvatar.d.ts +73 -0
- package/lib/components/entity-avatar/EntityAvatar.js +63 -0
- package/lib/components/entity-avatar/index.d.ts +1 -0
- package/lib/components/entity-avatar/index.js +5 -0
- package/lib/components/hover-card/HoverCard.d.ts +63 -0
- package/lib/components/hover-card/HoverCard.js +55 -0
- package/lib/components/hover-card/HoverCardAnchor.d.ts +33 -0
- package/lib/components/hover-card/HoverCardAnchor.js +26 -0
- package/lib/components/hover-card/HoverCardDetails.d.ts +36 -0
- package/lib/components/hover-card/HoverCardDetails.js +65 -0
- package/lib/components/hover-card/HoverCardLayer.d.ts +34 -0
- package/lib/components/hover-card/HoverCardLayer.js +57 -0
- package/lib/components/hover-card/index.d.ts +12 -0
- package/lib/components/hover-card/index.js +16 -0
- package/lib/components/hover-card/useHoverCard.d.ts +57 -0
- package/lib/components/hover-card/useHoverCard.js +200 -0
- package/lib/components/hover-card/usePrefersReducedMotion.d.ts +10 -0
- package/lib/components/hover-card/usePrefersReducedMotion.js +28 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/logo/DatalayerLogo.js +18 -1
- package/lib/components/toolbar/ToolbarButton.d.ts +2 -2
- package/lib/components/toolbar/ToolbarButton.js +23 -21
- package/lib/components/toolbar/ToolbarDropdown.js +3 -1
- package/lib/theme/colors/index.d.ts +1 -0
- package/lib/theme/colors/index.js +3 -0
- package/lib/theme/colors/vscodeColors.d.ts +280 -0
- package/lib/theme/colors/vscodeColors.js +129 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +18 -1
- package/lib/theme/css/createThemeCSSVars.js +17 -1
- package/lib/theme/css/primerBaseVars.js +59 -0
- package/lib/theme/css/primerComponentsCss.d.ts +47 -0
- package/lib/theme/css/primerComponentsCss.js +72 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/palettes/ColorPalette.js +41 -1
- package/lib/theme/themeRegistry.js +2 -0
- package/lib/theme/themeTokens.d.ts +1 -1
- package/lib/theme/themeTokens.js +61 -1
- package/lib/theme/themes/loopThemeStyles.d.ts +4 -31
- package/lib/theme/themes/loopThemeStyles.js +17 -44
- package/lib/theme/themes/vscodeEditorsCss.d.ts +12 -0
- package/lib/theme/themes/vscodeEditorsCss.js +239 -0
- package/lib/theme/themes/vscodeTheme.d.ts +1085 -0
- package/lib/theme/themes/vscodeTheme.js +17 -0
- package/lib/theme/themes/vscodeThemeStyles.d.ts +7 -0
- package/lib/theme/themes/vscodeThemeStyles.js +246 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -14,16 +14,27 @@ This project has been [shared in a discussion](https://github.com/primer/react/d
|
|
|
14
14
|
|
|
15
15
|
## Current Addons
|
|
16
16
|
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [ ] Brand Footer
|
|
21
|
-
- [x] Content Loader
|
|
17
|
+
- [x] Appearance controls, menus, theme previews and collaborator palettes
|
|
18
|
+
- [x] Box
|
|
19
|
+
- [x] Calendar Picker
|
|
22
20
|
- [x] Card
|
|
23
|
-
- [x]
|
|
24
|
-
- [
|
|
21
|
+
- [x] Closeable Flash
|
|
22
|
+
- [x] Color Swatch and Color Picker
|
|
23
|
+
- [x] Content Loader
|
|
24
|
+
- [x] Date Picker
|
|
25
|
+
- [x] Entity Avatar
|
|
26
|
+
- [x] Hover Card
|
|
27
|
+
- [x] Datalayer logos and text marks
|
|
28
|
+
- [x] Sheet
|
|
29
|
+
- [x] Side Overlay
|
|
25
30
|
- [x] Slider
|
|
26
|
-
- [x]
|
|
31
|
+
- [x] Sliding Panel
|
|
32
|
+
- [x] Toolbar and Floating Toolbar
|
|
33
|
+
|
|
34
|
+
The components use the active theme's semantic tokens rather than fixed
|
|
35
|
+
visual values. For example, toolbar icon buttons and dropdown triggers read
|
|
36
|
+
`--theme-radius-control`: they retain the regular Primer corner in the default
|
|
37
|
+
themes and become fully rounded controls in `loop`.
|
|
27
38
|
|
|
28
39
|
## Reactor Plugins
|
|
29
40
|
|
|
@@ -300,6 +300,22 @@ const UNITLESS = new Set([
|
|
|
300
300
|
]);
|
|
301
301
|
/** A camelCased property as CSS: `WebkitLineClamp` is `-webkit-line-clamp`; `--x` stays. */
|
|
302
302
|
const kebab = (key) => key.startsWith('--') ? key : key.replace(/^(Webkit|Moz|ms)(?=[A-Z])/, m => `-${m.toLowerCase()}`).replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
|
|
303
|
+
/**
|
|
304
|
+
* The keys of a style, with the resets first.
|
|
305
|
+
*
|
|
306
|
+
* `all` is a shorthand that sets *every* property: written after `width` it
|
|
307
|
+
* undoes it, whatever the author meant. A grown card's picture collapsed to
|
|
308
|
+
* 40px that way — `<Box as="button" display="block" width="100%" all="unset">`
|
|
309
|
+
* — and the artwork of the Library's hover card was a sliver at its left
|
|
310
|
+
* (seen 2026-10-09). An author may write the props in any order; a reset is
|
|
311
|
+
* emitted before what it would reset.
|
|
312
|
+
*/
|
|
313
|
+
const RESETS = ['all'];
|
|
314
|
+
const keysOf = (style) => {
|
|
315
|
+
const keys = Object.keys(style);
|
|
316
|
+
const resets = keys.filter(key => RESETS.includes(key));
|
|
317
|
+
return resets.length === 0 ? keys : [...resets, ...keys.filter(key => !resets.includes(key))];
|
|
318
|
+
};
|
|
303
319
|
/**
|
|
304
320
|
* A style's declarations. With `raw` (an `sx` object), a key that is no
|
|
305
321
|
* style prop is CSS as written — its number in pixels unless the property
|
|
@@ -307,7 +323,7 @@ const kebab = (key) => key.startsWith('--') ? key : key.replace(/^(Webkit|Moz|ms
|
|
|
307
323
|
*/
|
|
308
324
|
function blockOf(style, raw = false) {
|
|
309
325
|
const block = [];
|
|
310
|
-
for (const key of
|
|
326
|
+
for (const key of keysOf(style)) {
|
|
311
327
|
const value = style[key];
|
|
312
328
|
if (key in BOX_STYLE_PROPS) {
|
|
313
329
|
addDeclarations(block, key, value);
|
|
@@ -79,7 +79,7 @@ export declare const BOX_SPACE: readonly ["0", "4px", "8px", "16px", "24px", "32
|
|
|
79
79
|
export declare const BOX_FONT_SIZES: readonly ["12px", "14px", "16px", "20px", "24px", "32px", "40px", "48px", "56px"];
|
|
80
80
|
/** Primer's radii by index (`borderRadius={2}` is 6px). */
|
|
81
81
|
export declare const BOX_RADII: readonly ["0", "3px", "6px", "100px"];
|
|
82
|
-
/** Radii by name: Primer's, and the theme's shapes (LOOP T-03). */
|
|
82
|
+
/** Radii by name: Primer's, and the theme's shapes (LOOP T-03), an overlay's among them. */
|
|
83
83
|
export declare const BOX_RADIUS_VARS: {
|
|
84
84
|
readonly small: "--borderRadius-small";
|
|
85
85
|
readonly medium: "--borderRadius-medium";
|
|
@@ -89,6 +89,7 @@ export declare const BOX_RADIUS_VARS: {
|
|
|
89
89
|
readonly card: "--theme-radius-card";
|
|
90
90
|
readonly bubble: "--theme-radius-bubble";
|
|
91
91
|
readonly frame: "--theme-radius-frame";
|
|
92
|
+
readonly overlay: "--theme-radius-overlay";
|
|
92
93
|
};
|
|
93
94
|
export type BoxRadiusToken = keyof typeof BOX_RADIUS_VARS;
|
|
94
95
|
/** Primer's border widths by index. */
|
|
@@ -81,7 +81,7 @@ export const BOX_SPACE = ['0', '4px', '8px', '16px', '24px', '32px', '40px', '48
|
|
|
81
81
|
export const BOX_FONT_SIZES = ['12px', '14px', '16px', '20px', '24px', '32px', '40px', '48px', '56px'];
|
|
82
82
|
/** Primer's radii by index (`borderRadius={2}` is 6px). */
|
|
83
83
|
export const BOX_RADII = ['0', '3px', '6px', '100px'];
|
|
84
|
-
/** Radii by name: Primer's, and the theme's shapes (LOOP T-03). */
|
|
84
|
+
/** Radii by name: Primer's, and the theme's shapes (LOOP T-03), an overlay's among them. */
|
|
85
85
|
export const BOX_RADIUS_VARS = {
|
|
86
86
|
small: '--borderRadius-small',
|
|
87
87
|
medium: '--borderRadius-medium',
|
|
@@ -91,6 +91,7 @@ export const BOX_RADIUS_VARS = {
|
|
|
91
91
|
card: '--theme-radius-card',
|
|
92
92
|
bubble: '--theme-radius-bubble',
|
|
93
93
|
frame: '--theme-radius-frame',
|
|
94
|
+
overlay: '--theme-radius-overlay',
|
|
94
95
|
};
|
|
95
96
|
/** Primer's border widths by index. */
|
|
96
97
|
export const BOX_BORDER_WIDTHS = ['0', '1px'];
|
|
@@ -1,9 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Card`: a surface that follows the theme.
|
|
3
|
+
*
|
|
4
|
+
* It is this package's own `Box`, so every colour, shadow and corner is one
|
|
5
|
+
* of the theme's variables: the ground is `canvas.default` (a card is never
|
|
6
|
+
* the page showing through), the hairline `border.default`, the shadow one of
|
|
7
|
+
* Primer's (`shadow.small`…, which each colour mode sets for itself — no
|
|
8
|
+
* literal `rgba` that reads as a smudge on a dark page), and the corner the
|
|
9
|
+
* theme's card corner unless `rounded` says otherwise.
|
|
10
|
+
*
|
|
11
|
+
* Every `Box` prop passes through and wins over the card's defaults (`bg`,
|
|
12
|
+
* `p`, `as`, …), and `sx` wins over both, as it does on `Box`.
|
|
13
|
+
*
|
|
14
|
+
* - `interactive` — a card that is clicked: a pointer, a border that takes
|
|
15
|
+
* the accent and a lifted shadow on hover, a focus ring for the keyboard.
|
|
16
|
+
* It always has a border, so a card rendered `as="button"` shows the
|
|
17
|
+
* card's hairline rather than the browser's button border, and a button
|
|
18
|
+
* reads its text left to right in the page's font.
|
|
19
|
+
* - `variant` — the card's flavour: `default`, `subtle`, `inset`, or a
|
|
20
|
+
* tone (`accent`, `success`, `attention`, `danger`), each a ground and a
|
|
21
|
+
* hairline from the theme.
|
|
22
|
+
* - `dashed` — a dashed hairline, for a placeholder or a "create new" card;
|
|
23
|
+
* `disabled` — quieter, no pointer, no hover;
|
|
24
|
+
* - `accent` — a colour along the top edge, a token or the item's own;
|
|
25
|
+
* - slots: `Card.Header`, `Card.Cover` (image, gradient or colour, a glyph,
|
|
26
|
+
* a top-right accessory), `Card.Image`, `Card.Content`, `Card.Footer`
|
|
27
|
+
* (the metadata line, over a hairline) and `Card.Actions`; the slots take
|
|
28
|
+
* `Box` props over their defaults.
|
|
29
|
+
* - `selected` — the card that is chosen among others: an accent border on
|
|
30
|
+
* an accent wash. It says nothing to assistive technology by itself: the
|
|
31
|
+
* caller sets `aria-pressed` or `aria-selected`, as its role requires.
|
|
32
|
+
*/
|
|
1
33
|
import React from "react";
|
|
2
|
-
import { BoxProps } from "
|
|
3
|
-
|
|
4
|
-
|
|
34
|
+
import { type BoxColorToken, type BoxProps, type BoxPseudoProps, type BoxRadiusToken, type BoxStyleProps } from "../box/Box";
|
|
35
|
+
/**
|
|
36
|
+
* `Box`'s props, but `border` is the card's switch rather than a CSS value.
|
|
37
|
+
* Spelled out rather than `Omit<BoxProps, 'border'>`: `BoxProps` has an index
|
|
38
|
+
* signature, and `Omit` over one drops every named key (`children` would be
|
|
39
|
+
* `unknown`).
|
|
40
|
+
*/
|
|
41
|
+
type CardBoxProps = Omit<BoxStyleProps, 'border'> & BoxPseudoProps & Omit<React.HTMLAttributes<HTMLElement>, keyof BoxStyleProps | 'as'> & {
|
|
42
|
+
as?: React.ElementType;
|
|
43
|
+
sx?: BoxProps['sx'];
|
|
44
|
+
className?: string;
|
|
45
|
+
style?: React.CSSProperties;
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
[prop: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A card's flavour: its ground and, when it is bordered, its hairline.
|
|
51
|
+
*
|
|
52
|
+
* - `default` — the page's own surface, `canvas.default`;
|
|
53
|
+
* - `subtle` — a quieter ground, `canvas.subtle`, for a card among cards
|
|
54
|
+
* or one inside a panel;
|
|
55
|
+
* - `inset` — sunk into the page, `canvas.inset`, for code, logs, a prompt;
|
|
56
|
+
* - `accent`, `success`, `attention`, `danger` — a note in that tone: the
|
|
57
|
+
* tone's wash with the tone's muted hairline.
|
|
58
|
+
*/
|
|
59
|
+
export type CardVariant = 'default' | 'subtle' | 'inset' | 'accent' | 'success' | 'attention' | 'danger';
|
|
60
|
+
export type CardProps = CardBoxProps & {
|
|
61
|
+
/**
|
|
62
|
+
* The corner: a radius by name — Primer's (`small`, `medium`, `large`,
|
|
63
|
+
* `full`) or the theme's shapes (`control`, `card`, `bubble`, `frame`,
|
|
64
|
+
* `overlay` for a panel floating over the page) —
|
|
65
|
+
* or an index of Primer's radii. The theme's `card` corner by default.
|
|
66
|
+
*/
|
|
67
|
+
rounded?: BoxRadiusToken | number;
|
|
68
|
+
/** The card's flavour, `default` by default; see {@link CardVariant}. */
|
|
69
|
+
variant?: CardVariant;
|
|
70
|
+
/** A hairline around the card, `border.default`. */
|
|
5
71
|
border?: boolean;
|
|
6
|
-
|
|
72
|
+
/** Primer's shadows by name; `none` for a card that lies flat. `small` by default. */
|
|
73
|
+
shadow?: 'none' | 'small' | 'medium' | 'large' | 'extraLarge';
|
|
74
|
+
/** A card that is clicked: hover and focus states, a pointer, a border. */
|
|
75
|
+
interactive?: boolean;
|
|
76
|
+
/** The chosen card among others: an accent border on an accent wash. */
|
|
77
|
+
selected?: boolean;
|
|
78
|
+
/** A dashed hairline: a placeholder, a drop zone, a "create new" card. */
|
|
79
|
+
dashed?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* A card that cannot be used now: quieter, no pointer, no hover. With
|
|
82
|
+
* `interactive`, it also sets `aria-disabled`.
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* A colour along the card's top edge: a theme token (`accent.emphasis`,
|
|
87
|
+
* `success.emphasis`…) or any CSS colour the caller has from its theme,
|
|
88
|
+
* such as an item's own colour.
|
|
89
|
+
*/
|
|
90
|
+
accent?: BoxColorToken | (string & {});
|
|
7
91
|
};
|
|
8
92
|
export type CardHeaderProps = {
|
|
9
93
|
/**
|
|
@@ -22,15 +106,45 @@ export type CardImageProps = {
|
|
|
22
106
|
svg?: string;
|
|
23
107
|
height: number;
|
|
24
108
|
};
|
|
25
|
-
|
|
109
|
+
/** A slot's props: the slot's own defaults, overridden by any `Box` prop. */
|
|
110
|
+
export type CardContentProps = CardBoxProps & {
|
|
111
|
+
children: React.ReactNode;
|
|
112
|
+
};
|
|
113
|
+
/** The card's last line: metadata, chips, an owner, an action. */
|
|
114
|
+
export type CardFooterProps = CardBoxProps & {
|
|
26
115
|
children: React.ReactNode;
|
|
27
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* The card's cover, above its content: an image, or a gradient between two
|
|
119
|
+
* colours, or a theme colour, with an optional glyph centred on it and an
|
|
120
|
+
* accessory (a label, a menu) in its top-right corner.
|
|
121
|
+
*/
|
|
122
|
+
export type CardCoverProps = CardBoxProps & {
|
|
123
|
+
/** The cover's height, in pixels. 110 by default. */
|
|
124
|
+
height?: number;
|
|
125
|
+
/** An image URL; it covers the area. */
|
|
126
|
+
image?: string;
|
|
127
|
+
/** A gradient between two colours, top left to bottom right. */
|
|
128
|
+
gradient?: {
|
|
129
|
+
from: string;
|
|
130
|
+
to: string;
|
|
131
|
+
};
|
|
132
|
+
/** The ground under (or instead of) the image or gradient. `neutral.emphasis` by default. */
|
|
133
|
+
color?: BoxColorToken | (string & {});
|
|
134
|
+
/** What sits in the top-right corner: a label, a menu. */
|
|
135
|
+
accessory?: React.ReactNode;
|
|
136
|
+
/** A glyph centred on the cover, drawn in `fg.onEmphasis`. */
|
|
137
|
+
children?: React.ReactNode;
|
|
138
|
+
};
|
|
28
139
|
export type CardActionsProps = {
|
|
29
140
|
children: React.ReactNode;
|
|
30
141
|
};
|
|
31
142
|
export declare const Card: React.FC<CardProps> & {
|
|
32
143
|
Header: React.FC<CardHeaderProps>;
|
|
144
|
+
Cover: React.FC<CardCoverProps>;
|
|
33
145
|
Image: React.FC<CardImageProps>;
|
|
34
146
|
Content: React.FC<CardContentProps>;
|
|
147
|
+
Footer: React.FC<CardFooterProps>;
|
|
35
148
|
Actions: React.FC<CardActionsProps>;
|
|
36
149
|
};
|
|
150
|
+
export {};
|
|
@@ -1,62 +1,76 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { IconButton, Text } from "@primer/react";
|
|
3
|
+
import { Box, } from "../box/Box";
|
|
4
|
+
const VARIANTS = {
|
|
5
|
+
default: { bg: 'canvas.default', borderColor: 'border.default' },
|
|
6
|
+
subtle: { bg: 'canvas.subtle', borderColor: 'border.default' },
|
|
7
|
+
inset: { bg: 'canvas.inset', borderColor: 'border.default' },
|
|
8
|
+
accent: { bg: 'accent.subtle', borderColor: 'accent.muted' },
|
|
9
|
+
success: { bg: 'success.subtle', borderColor: 'success.muted' },
|
|
10
|
+
attention: { bg: 'attention.subtle', borderColor: 'attention.muted' },
|
|
11
|
+
danger: { bg: 'danger.subtle', borderColor: 'danger.muted' },
|
|
12
|
+
};
|
|
3
13
|
/**
|
|
4
14
|
* The corners, read from the theme: each theme sets Primer's radii (loop's
|
|
5
15
|
* are rounder), and a card left unsaid takes the theme's card corner.
|
|
6
16
|
*/
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const CARD_RADIUS = 'card';
|
|
18
|
+
const SHADOWS = {
|
|
19
|
+
none: 'none',
|
|
20
|
+
small: 'shadow.small',
|
|
21
|
+
medium: 'shadow.medium',
|
|
22
|
+
large: 'shadow.large',
|
|
23
|
+
extraLarge: 'shadow.extraLarge',
|
|
24
|
+
};
|
|
25
|
+
/** What `interactive` adds: a pointer, the hover and focus states, a button reset. */
|
|
26
|
+
const INTERACTIVE = {
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
textAlign: 'left',
|
|
29
|
+
font: 'inherit',
|
|
30
|
+
transition: 'border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease',
|
|
31
|
+
hover: { borderColor: 'accent.emphasis', boxShadow: SHADOWS.medium },
|
|
32
|
+
focusVisible: { outline: '2px solid', outlineColor: 'accent.emphasis', outlineOffset: '2px' },
|
|
33
|
+
reducedMotion: { transition: 'none' },
|
|
34
|
+
};
|
|
35
|
+
/** What `disabled` takes away: the pointer and the hover, at a lower voice. */
|
|
36
|
+
const DISABLED = {
|
|
37
|
+
cursor: 'not-allowed',
|
|
38
|
+
opacity: 0.6,
|
|
39
|
+
hover: {},
|
|
19
40
|
};
|
|
20
41
|
export const Card = (props) => {
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
borderWidth: 1,
|
|
35
|
-
borderStyle: 'solid',
|
|
36
|
-
borderColor: 'border.default'
|
|
37
|
-
} : undefined),
|
|
38
|
-
...(shadow ? {
|
|
39
|
-
boxShadow: shadowVals[shadow]
|
|
40
|
-
} : {
|
|
41
|
-
boxShadow: shadowVals['small']
|
|
42
|
-
})
|
|
43
|
-
}, ...otherProps, children: children }));
|
|
42
|
+
const { rounded, border, shadow = 'small', variant = 'default', interactive, selected, dashed, disabled, accent, children, ...otherProps } = props;
|
|
43
|
+
const outlined = border || interactive || selected || dashed;
|
|
44
|
+
const flavour = VARIANTS[variant];
|
|
45
|
+
return (_jsx(Box
|
|
46
|
+
// A column, so the actions stand at the bottom however long the text
|
|
47
|
+
// above them: cards side by side end on one line.
|
|
48
|
+
, {
|
|
49
|
+
// A column, so the actions stand at the bottom however long the text
|
|
50
|
+
// above them: cards side by side end on one line.
|
|
51
|
+
display: "flex", flexDirection: "column", bg: selected ? 'accent.subtle' : flavour.bg, color: "fg.default", borderRadius: rounded ?? CARD_RADIUS, boxShadow: SHADOWS[shadow], ...(outlined ? {
|
|
52
|
+
border: '1px solid',
|
|
53
|
+
borderColor: selected ? 'accent.emphasis' : flavour.borderColor,
|
|
54
|
+
} : undefined), ...(dashed ? { borderStyle: 'dashed' } : undefined), ...(accent ? { borderTop: '3px solid', borderTopColor: accent } : undefined), ...(interactive ? INTERACTIVE : undefined), ...(disabled ? DISABLED : undefined), ...(interactive && disabled ? { 'aria-disabled': true } : undefined), ...otherProps, children: children }));
|
|
44
55
|
};
|
|
45
56
|
Card.Header = (props) => {
|
|
46
57
|
const { title, description, leadingVisual, action } = props;
|
|
47
|
-
return _jsxs(Box, { display: "flex", alignItems: "center",
|
|
58
|
+
return _jsxs(Box, { display: "flex", alignItems: "center", p: 3, children: [leadingVisual && _jsx(Box, { mr: 3, children: _jsx(IconButton, { size: "medium", icon: leadingVisual, "aria-label": "" }) }), _jsxs(Box, { flexGrow: 1, children: [_jsx(Text, { as: "div", display: "block", children: title }), _jsx(Text, { display: "block", color: "fg.muted", children: description })] }), action && _jsx(Box, { children: action })] });
|
|
48
59
|
};
|
|
49
60
|
Card.Image = ({ url, image, svg, height }) => {
|
|
50
|
-
return (_jsxs(Box, { display: "block", width: "100%", height: `${height}px`, backgroundImage: `url(${url})`,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
return (_jsxs(Box, { display: "block", width: "100%", height: `${height}px`, backgroundImage: url ? `url(${url})` : undefined, backgroundSize: "cover", backgroundRepeat: "no-repeat", backgroundPosition: "center", objectFit: "cover", children: [image && _jsx("img", { src: image, style: { maxHeight: `${height}px` } }), svg && _jsx("img", { src: `data:image/svg+xml;utf8,${svg}`, style: { maxHeight: height } })] }));
|
|
62
|
+
};
|
|
63
|
+
Card.Cover = ({ height = 110, image, gradient, color = 'neutral.emphasis', accessory, children, ...rest }) => {
|
|
64
|
+
return (_jsxs(Box, { position: "relative", width: "100%", height: `${height}px`, flexShrink: 0, display: "flex", alignItems: "center", justifyContent: "center", bg: color, backgroundImage: image
|
|
65
|
+
? `url(${image})`
|
|
66
|
+
: gradient ? `linear-gradient(135deg, ${gradient.from} 0%, ${gradient.to} 100%)` : undefined, backgroundSize: "cover", backgroundPosition: "center", color: "fg.onEmphasis", fontSize: 4, fontWeight: "semibold", ...rest, children: [children, accessory && (_jsx(Box, { position: "absolute", top: 2, right: 2, display: "flex", alignItems: "center", gap: 1, children: accessory }))] }));
|
|
67
|
+
};
|
|
68
|
+
Card.Content = ({ children, ...rest }) => {
|
|
69
|
+
return (_jsx(Box, { display: "block", p: 3, ...rest, children: children }));
|
|
56
70
|
};
|
|
57
|
-
Card.
|
|
58
|
-
return (_jsx(Box, { display: "
|
|
71
|
+
Card.Footer = ({ children, ...rest }) => {
|
|
72
|
+
return (_jsx(Box, { display: "flex", alignItems: "center", gap: 2, flexWrap: "wrap", mt: "auto", px: 3, py: 2, borderTop: "1px solid", borderColor: "border.muted", ...rest, children: children }));
|
|
59
73
|
};
|
|
60
74
|
Card.Actions = ({ children }) => {
|
|
61
|
-
return _jsx(Box, { display: "block",
|
|
75
|
+
return _jsx(Box, { display: "block", p: 3, mt: "auto", children: children });
|
|
62
76
|
};
|
|
@@ -4,8 +4,10 @@ declare const meta: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").FC<CardProps> & {
|
|
6
6
|
Header: React.FC<import("./Card").CardHeaderProps>;
|
|
7
|
+
Cover: React.FC<import("./Card").CardCoverProps>;
|
|
7
8
|
Image: React.FC<import("./Card").CardImageProps>;
|
|
8
9
|
Content: React.FC<import("./Card").CardContentProps>;
|
|
10
|
+
Footer: React.FC<import("./Card").CardFooterProps>;
|
|
9
11
|
Actions: React.FC<import("./Card").CardActionsProps>;
|
|
10
12
|
};
|
|
11
13
|
tags: string[];
|
|
@@ -18,3 +20,7 @@ type Story = StoryObj<typeof meta>;
|
|
|
18
20
|
export declare const CardDay: Story;
|
|
19
21
|
export declare const CardDaySvg: Story;
|
|
20
22
|
export declare const CardNight: Story;
|
|
23
|
+
/** A card that is clicked: rendered as a button, with hover and focus states. */
|
|
24
|
+
export declare const CardInteractive: Story;
|
|
25
|
+
/** The chosen card among others: an accent border on an accent wash. */
|
|
26
|
+
export declare const CardSelected: Story;
|
|
@@ -49,3 +49,29 @@ export const CardNight = {
|
|
|
49
49
|
},
|
|
50
50
|
render: (args) => _jsxs(ThemedCard, { ...args, colorMode: "night", children: [_jsx(Card.Header, { leadingVisual: ProjectIcon, title: "Shrimp and Chorizo Paella", description: "September 14, 2016", action: _jsx(IconButton, { "aria-label": "Menu", onClick: () => alert("Menu"), icon: ThreeBarsIcon }) }), _jsx(Card.Image, { height: 200, url: "https://images.unsplash.com/photo-1623961990059-28356e226a77?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=douglas-lopez-4B0cLMtJxWw-unsplash.jpg&w=640" }), _jsxs(Card.Content, { children: [_jsx(Text, { display: "block", fontSize: 22, children: "Paella" }), _jsx(Text, { color: "fg.muted", children: "This impressive paella is a perfect party dish and a fun meal to cook together with your guests. Add 1 cup of frozen peas along with the mussels, if you like." })] }), _jsx(Card.Actions, { children: _jsxs(ButtonGroup, { children: [_jsx(Button, { variant: 'invisible', onClick: () => alert("Share it on Socials!"), children: "Share" }), _jsx(Button, { variant: 'invisible', onClick: () => alert("Learn more about Paella"), children: "Learn More" })] }) })] })
|
|
51
51
|
};
|
|
52
|
+
/** A card that is clicked: rendered as a button, with hover and focus states. */
|
|
53
|
+
export const CardInteractive = {
|
|
54
|
+
args: {
|
|
55
|
+
as: "button",
|
|
56
|
+
type: "button",
|
|
57
|
+
interactive: true,
|
|
58
|
+
shadow: "none",
|
|
59
|
+
p: 3,
|
|
60
|
+
sx: { maxWidth: 360 },
|
|
61
|
+
},
|
|
62
|
+
render: (args) => _jsxs(ThemedCard, { ...args, onClick: () => alert("Opened"), children: [_jsx(Text, { display: "block", fontWeight: "bold", children: "Tutor" }), _jsx(Text, { color: "fg.muted", children: "Author lessons, exercises and assignments, and follow the courses you give and take." })] })
|
|
63
|
+
};
|
|
64
|
+
/** The chosen card among others: an accent border on an accent wash. */
|
|
65
|
+
export const CardSelected = {
|
|
66
|
+
args: {
|
|
67
|
+
interactive: true,
|
|
68
|
+
selected: true,
|
|
69
|
+
shadow: "none",
|
|
70
|
+
role: "button",
|
|
71
|
+
tabIndex: 0,
|
|
72
|
+
"aria-pressed": true,
|
|
73
|
+
p: 3,
|
|
74
|
+
sx: { maxWidth: 360 },
|
|
75
|
+
},
|
|
76
|
+
render: (args) => _jsxs(ThemedCard, { ...args, children: [_jsx(Text, { display: "block", fontWeight: "bold", children: "Selected example" }), _jsx(Text, { color: "fg.muted", children: "The one picked among its siblings." })] })
|
|
77
|
+
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** `7` → `07`. Two digits, always, because a column of ragged numbers reads badly. */
|
|
2
2
|
export declare const pad: (value: number) => string;
|
|
3
|
+
/** Read a freely typed 24-hour time without letting `Date` roll it over. */
|
|
4
|
+
export declare function parseTime(text: string): {
|
|
5
|
+
hour: number;
|
|
6
|
+
minute: number;
|
|
7
|
+
} | null;
|
|
3
8
|
export interface TimeColumnsProps {
|
|
4
9
|
/** The hour shown as chosen, 0–23. */
|
|
5
10
|
hour: number;
|
|
@@ -19,10 +19,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
*
|
|
20
20
|
* @module components/date-picker/TimeColumns
|
|
21
21
|
*/
|
|
22
|
-
import { useEffect, useRef } from "react";
|
|
23
|
-
import { ActionList, Box, Text } from "@primer/react";
|
|
22
|
+
import { useEffect, useRef, useState } from "react";
|
|
23
|
+
import { ActionList, Box, Text, TextInput } from "@primer/react";
|
|
24
24
|
/** `7` → `07`. Two digits, always, because a column of ragged numbers reads badly. */
|
|
25
25
|
export const pad = (value) => `${value}`.padStart(2, "0");
|
|
26
|
+
/** Read a freely typed 24-hour time without letting `Date` roll it over. */
|
|
27
|
+
export function parseTime(text) {
|
|
28
|
+
const match = /^(\d{1,2}):(\d{2})$/.exec(text.trim());
|
|
29
|
+
if (!match) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const hour = Number(match[1]);
|
|
33
|
+
const minute = Number(match[2]);
|
|
34
|
+
return hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59
|
|
35
|
+
? { hour, minute }
|
|
36
|
+
: null;
|
|
37
|
+
}
|
|
26
38
|
const HOURS = Array.from({ length: 24 }, (_, index) => index);
|
|
27
39
|
function Column({ label, ariaLabel, values, selected, onPick, disabled, }) {
|
|
28
40
|
const scroller = useRef(null);
|
|
@@ -65,6 +77,28 @@ function Column({ label, ariaLabel, values, selected, onPick, disabled, }) {
|
|
|
65
77
|
* them.
|
|
66
78
|
*/
|
|
67
79
|
export function TimeColumns({ hour, minute, step = 5, onChange, disabled, labelPrefix, }) {
|
|
80
|
+
const selectedText = `${pad(hour)}:${pad(minute)}`;
|
|
81
|
+
const [text, setText] = useState(selectedText);
|
|
82
|
+
const typing = useRef(false);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!typing.current) {
|
|
85
|
+
setText(selectedText);
|
|
86
|
+
}
|
|
87
|
+
}, [selectedText]);
|
|
88
|
+
const pick = (nextHour, nextMinute) => {
|
|
89
|
+
typing.current = false;
|
|
90
|
+
setText(`${pad(nextHour)}:${pad(nextMinute)}`);
|
|
91
|
+
onChange(nextHour, nextMinute);
|
|
92
|
+
};
|
|
93
|
+
const commitText = (nextText) => {
|
|
94
|
+
typing.current = false;
|
|
95
|
+
const parsed = parseTime(nextText);
|
|
96
|
+
if (!parsed) {
|
|
97
|
+
setText(selectedText);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
pick(parsed.hour, parsed.minute);
|
|
101
|
+
};
|
|
68
102
|
const every = Math.min(60, Math.max(1, Math.floor(step) || 1));
|
|
69
103
|
const minutes = Array.from({ length: Math.ceil(60 / every) }, (_, index) => index * every);
|
|
70
104
|
// A minute the step does not land on — 17:07 read back from a stored value —
|
|
@@ -83,6 +117,13 @@ export function TimeColumns({ hour, minute, step = 5, onChange, disabled, labelP
|
|
|
83
117
|
fontSize: 1,
|
|
84
118
|
fontWeight: "bold",
|
|
85
119
|
fontVariantNumeric: "tabular-nums",
|
|
86
|
-
}, children: [pad(hour), ":", pad(minute)] })] }), _jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [_jsx(Column, { label: "Hour", ariaLabel: labelPrefix ? `${labelPrefix}, hour` : "Hour", values: HOURS, selected: hour, disabled: disabled, onPick: (next) =>
|
|
120
|
+
}, children: [pad(hour), ":", pad(minute)] })] }), _jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [_jsx(Column, { label: "Hour", ariaLabel: labelPrefix ? `${labelPrefix}, hour` : "Hour", values: HOURS, selected: hour, disabled: disabled, onPick: (next) => pick(next, minute) }), _jsx(Column, { label: "Minute", ariaLabel: labelPrefix ? `${labelPrefix}, minute` : "Minute", values: shown, selected: minute, disabled: disabled, onPick: (next) => pick(hour, next) })] }), _jsx(TextInput, { "aria-label": labelPrefix ? `${labelPrefix}, type a time` : "Type a time", value: text, placeholder: "HH:mm", disabled: disabled, inputMode: "numeric", sx: { mt: 2, width: "100%", fontFamily: "mono" }, onChange: (event) => {
|
|
121
|
+
typing.current = true;
|
|
122
|
+
setText(event.target.value);
|
|
123
|
+
}, onBlur: (event) => commitText(event.target.value), onKeyDown: (event) => {
|
|
124
|
+
if (event.key === "Enter") {
|
|
125
|
+
commitText(event.target.value);
|
|
126
|
+
}
|
|
127
|
+
} })] }));
|
|
87
128
|
}
|
|
88
129
|
export default TimeColumns;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `EntityAvatar`: the face of a person, an agent, an app or a space, drawn
|
|
3
|
+
* by the theme.
|
|
4
|
+
*
|
|
5
|
+
* One of three things, in this order:
|
|
6
|
+
*
|
|
7
|
+
* - an **image** (`src`), cropped to the shape — and, if it fails to load,
|
|
8
|
+
* what would have been drawn without it;
|
|
9
|
+
* - a **glyph** (`children`): an emoji's drawing, an icon — whatever the
|
|
10
|
+
* caller draws, on the avatar's ground;
|
|
11
|
+
* - the **initials** of `name`.
|
|
12
|
+
*
|
|
13
|
+
* Its ground is the theme's: a tone's wash with the tone's foreground
|
|
14
|
+
* (`ground="subtle"`, the default), the tone's solid colour with
|
|
15
|
+
* `fg.onEmphasis` (`ground="emphasis"`), the page's own surface with a
|
|
16
|
+
* hairline (`ground="canvas"`), or the entity's own colour (`color`), as a
|
|
17
|
+
* profile's cards give one, with `fg.onEmphasis`.
|
|
18
|
+
*
|
|
19
|
+
* Its shape is the theme's too: a `circle` for a person, `rounded` for
|
|
20
|
+
* anything else — the theme's medium corner (rounder in `loop`), never more
|
|
21
|
+
* than a little over a quarter of the avatar, so a small one stays a square
|
|
22
|
+
* with soft corners rather than turning into a circle.
|
|
23
|
+
*
|
|
24
|
+
* Not Primer's `Avatar` (an image only, in a circle or a fixed square).
|
|
25
|
+
*/
|
|
26
|
+
import { type CSSProperties, type ElementType, type HTMLAttributes, type JSX, type ReactNode } from 'react';
|
|
27
|
+
import { type BoxProps, type BoxPseudoProps, type BoxStyleProps } from '../box/Box';
|
|
28
|
+
export type EntityAvatarShape = 'circle' | 'rounded';
|
|
29
|
+
export type EntityAvatarTone = 'accent' | 'success' | 'attention' | 'severe' | 'danger' | 'done' | 'sponsors' | 'neutral';
|
|
30
|
+
export type EntityAvatarGround = 'subtle' | 'emphasis' | 'canvas';
|
|
31
|
+
/**
|
|
32
|
+
* `Box`'s props but `color` and `children`, which are the avatar's own.
|
|
33
|
+
* Spelled out rather than `Omit<BoxProps, …>`: `BoxProps` has an index
|
|
34
|
+
* signature, and `Omit` over one drops every named key.
|
|
35
|
+
*/
|
|
36
|
+
type EntityAvatarBoxProps = Omit<BoxStyleProps, 'color'> & BoxPseudoProps & Omit<HTMLAttributes<HTMLElement>, keyof BoxStyleProps | 'as' | 'color' | 'children'> & {
|
|
37
|
+
as?: ElementType;
|
|
38
|
+
sx?: BoxProps['sx'];
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
[prop: string]: unknown;
|
|
42
|
+
};
|
|
43
|
+
export type EntityAvatarProps = EntityAvatarBoxProps & {
|
|
44
|
+
/** An image URL; it covers the avatar. */
|
|
45
|
+
src?: string;
|
|
46
|
+
/** What the avatar is of, for assistive technology; the name by default. */
|
|
47
|
+
alt?: string;
|
|
48
|
+
/** A glyph drawn on the ground: an emoji's drawing, an icon. */
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
/** The entity's name: its initials when there is neither image nor glyph. */
|
|
51
|
+
name?: string;
|
|
52
|
+
/** Its edge, in pixels. 32 by default. */
|
|
53
|
+
size?: number;
|
|
54
|
+
/** `circle` for a person, `rounded` (the theme's corner) for the rest. */
|
|
55
|
+
shape?: EntityAvatarShape;
|
|
56
|
+
/** The tone of its ground. `accent` by default. */
|
|
57
|
+
tone?: EntityAvatarTone;
|
|
58
|
+
/** How the ground is drawn: the tone's wash, its solid colour, or the page's. */
|
|
59
|
+
ground?: EntityAvatarGround;
|
|
60
|
+
/**
|
|
61
|
+
* The entity's own colour, as the theme gives it — a palette colour, a
|
|
62
|
+
* token — drawn solid under `fg.onEmphasis`; it overrides `tone`.
|
|
63
|
+
*/
|
|
64
|
+
color?: string;
|
|
65
|
+
/** A hairline just outside the edge, for an avatar on a ground like its own. */
|
|
66
|
+
ring?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** The theme's corner for an avatar that is not a person's. */
|
|
69
|
+
export declare const ENTITY_AVATAR_RADIUS = "min(var(--borderRadius-medium), 28%)";
|
|
70
|
+
/** Up to two letters: the first of the first two words. */
|
|
71
|
+
export declare const initialsOf: (name?: string) => string;
|
|
72
|
+
export declare function EntityAvatar({ src, alt, children, name, size, shape, tone, ground, color, ring, ...rest }: EntityAvatarProps): JSX.Element;
|
|
73
|
+
export default EntityAvatar;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `EntityAvatar`: the face of a person, an agent, an app or a space, drawn
|
|
8
|
+
* by the theme.
|
|
9
|
+
*
|
|
10
|
+
* One of three things, in this order:
|
|
11
|
+
*
|
|
12
|
+
* - an **image** (`src`), cropped to the shape — and, if it fails to load,
|
|
13
|
+
* what would have been drawn without it;
|
|
14
|
+
* - a **glyph** (`children`): an emoji's drawing, an icon — whatever the
|
|
15
|
+
* caller draws, on the avatar's ground;
|
|
16
|
+
* - the **initials** of `name`.
|
|
17
|
+
*
|
|
18
|
+
* Its ground is the theme's: a tone's wash with the tone's foreground
|
|
19
|
+
* (`ground="subtle"`, the default), the tone's solid colour with
|
|
20
|
+
* `fg.onEmphasis` (`ground="emphasis"`), the page's own surface with a
|
|
21
|
+
* hairline (`ground="canvas"`), or the entity's own colour (`color`), as a
|
|
22
|
+
* profile's cards give one, with `fg.onEmphasis`.
|
|
23
|
+
*
|
|
24
|
+
* Its shape is the theme's too: a `circle` for a person, `rounded` for
|
|
25
|
+
* anything else — the theme's medium corner (rounder in `loop`), never more
|
|
26
|
+
* than a little over a quarter of the avatar, so a small one stays a square
|
|
27
|
+
* with soft corners rather than turning into a circle.
|
|
28
|
+
*
|
|
29
|
+
* Not Primer's `Avatar` (an image only, in a circle or a fixed square).
|
|
30
|
+
*/
|
|
31
|
+
import { useState } from 'react';
|
|
32
|
+
import { Box } from '../box/Box';
|
|
33
|
+
/** The theme's corner for an avatar that is not a person's. */
|
|
34
|
+
export const ENTITY_AVATAR_RADIUS = 'min(var(--borderRadius-medium), 28%)';
|
|
35
|
+
/** Up to two letters: the first of the first two words. */
|
|
36
|
+
export const initialsOf = (name) => (name ?? '')
|
|
37
|
+
.trim()
|
|
38
|
+
.split(/[\s._-]+/)
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.slice(0, 2)
|
|
41
|
+
.map(word => word[0].toUpperCase())
|
|
42
|
+
.join('');
|
|
43
|
+
const wash = (tone) => tone === 'neutral'
|
|
44
|
+
? { bg: 'neutral.muted', color: 'fg.default' }
|
|
45
|
+
: { bg: `${tone}.subtle`, color: `${tone}.fg` };
|
|
46
|
+
const solid = (tone) => ({
|
|
47
|
+
bg: tone === 'neutral' ? 'neutral.emphasis' : `${tone}.emphasis`,
|
|
48
|
+
color: 'fg.onEmphasis',
|
|
49
|
+
});
|
|
50
|
+
export function EntityAvatar({ src, alt, children, name, size = 32, shape = 'circle', tone = 'accent', ground = 'subtle', color, ring = false, ...rest }) {
|
|
51
|
+
const [failed, setFailed] = useState(false);
|
|
52
|
+
const label = alt ?? name;
|
|
53
|
+
const paint = color
|
|
54
|
+
? { bg: color, color: 'fg.onEmphasis' }
|
|
55
|
+
: ground === 'emphasis'
|
|
56
|
+
? solid(tone)
|
|
57
|
+
: ground === 'canvas'
|
|
58
|
+
? { bg: 'canvas.default', color: 'fg.default', border: '1px solid', borderColor: 'border.default' }
|
|
59
|
+
: wash(tone);
|
|
60
|
+
const image = src && !failed;
|
|
61
|
+
return (_jsx(Box, { role: "img", "aria-label": label, "data-entity-avatar": shape, width: size, height: size, minWidth: size, display: "inline-flex", alignItems: "center", justifyContent: "center", overflow: "hidden", borderRadius: shape === 'circle' ? '50%' : ENTITY_AVATAR_RADIUS, fontSize: `${Math.max(9, Math.round(size * 0.4))}px`, fontWeight: "semibold", lineHeight: "1", userSelect: "none", boxShadow: ring ? '0 0 0 1px var(--borderColor-default)' : undefined, ...(image ? { bg: 'canvas.subtle' } : paint), ...rest, children: image ? (_jsx(Box, { as: "img", src: src, alt: "", width: size, height: size, objectFit: "cover", display: "block", referrerPolicy: "no-referrer", onError: () => setFailed(true) })) : (children ?? initialsOf(name)) }));
|
|
62
|
+
}
|
|
63
|
+
export default EntityAvatar;
|