@bspk/ui 1.0.0 → 1.0.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/{Profile.d.ts → Avatar.d.ts} +11 -13
- package/{Profile.js → Avatar.js} +12 -14
- package/Avatar.js.map +1 -0
- package/ListItem.d.ts +2 -2
- package/ListItem.js +2 -2
- package/ListItem.js.map +1 -1
- package/MenuButton.d.ts +2 -3
- package/MenuButton.js +1 -1
- package/MenuButton.js.map +1 -1
- package/meta.d.ts +2 -2
- package/meta.js +188 -188
- package/meta.js.map +1 -1
- package/package.json +3 -3
- package/src/{Profile.tsx → Avatar.tsx} +18 -20
- package/src/ListItem.tsx +3 -3
- package/src/MenuButton.tsx +2 -5
- package/src/meta.ts +191 -191
- package/src/utils/errors.tsx +9 -4
- package/utils/errors.d.ts +1 -4
- package/utils/errors.js +7 -3
- package/utils/errors.js.map +1 -1
- package/Profile.js.map +0 -1
- package/styles/anywhere.css +0 -1693
- package/styles/anywhere.ts +0 -1694
- package/styles/base.css +0 -160
- package/styles/base.ts +0 -161
- package/styles/better-homes-gardens.css +0 -1693
- package/styles/better-homes-gardens.ts +0 -1694
- package/styles/cartus.css +0 -1691
- package/styles/cartus.ts +0 -1692
- package/styles/century-21.css +0 -1689
- package/styles/century-21.ts +0 -1690
- package/styles/coldwell-banker.css +0 -1691
- package/styles/coldwell-banker.ts +0 -1692
- package/styles/corcoran.css +0 -1685
- package/styles/corcoran.ts +0 -1686
- package/styles/denali-boss.css +0 -1681
- package/styles/denali-boss.ts +0 -1682
- package/styles/era.css +0 -1685
- package/styles/era.ts +0 -1686
- package/styles/sothebys.css +0 -1677
- package/styles/sothebys.ts +0 -1678
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bspk/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "CC-BY-4.0",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=20"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@bspk/icons": "^1.0.
|
|
30
|
+
"@bspk/icons": "^1.0.3",
|
|
31
31
|
"@bspk/styles": "^1.0.0",
|
|
32
32
|
"@floating-ui/dom": "^1.6.13",
|
|
33
33
|
"focus-trap-react": "^11.0.1"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"ts-jest": "^29.2.5",
|
|
67
67
|
"ts-node": "^10.9.2",
|
|
68
68
|
"tslib": "^2.8.1",
|
|
69
|
-
"typescript": "
|
|
69
|
+
"typescript": "5.6.3",
|
|
70
70
|
"typescript-eslint": "8.13.0",
|
|
71
71
|
"typescript-json-schema": "^0.65.1"
|
|
72
72
|
}
|
|
@@ -21,45 +21,43 @@ const SIZE_VARIANTS: Record<SizeVariant, { height: string; font: string }> = {
|
|
|
21
21
|
small: { font: '--labels-small', height: '--spacing-sizing-08' }, // 32,
|
|
22
22
|
medium: { font: '--labels-base', height: '--spacing-sizing-10' }, // 40
|
|
23
23
|
large: { font: '--labels-large', height: '--spacing-sizing-12' }, //48,
|
|
24
|
-
'x-large': { font: '--
|
|
25
|
-
'xx-large': { font: '--
|
|
26
|
-
'xxx-large': { font: '--
|
|
27
|
-
'xxxx-large': { font: '--
|
|
28
|
-
'xxxxx-large': { font: '--
|
|
24
|
+
'x-large': { font: '--subheader-x-large', height: '--spacing-sizing-14' }, // 56,
|
|
25
|
+
'xx-large': { font: '--subheader-xx-large', height: '--spacing-sizing-17' }, // 72,
|
|
26
|
+
'xxx-large': { font: '--display-regular-small', height: '--spacing-sizing-19' }, //96,
|
|
27
|
+
'xxxx-large': { font: '--display-regular-medium', height: '--spacing-sizing-21' }, // 120,
|
|
28
|
+
'xxxxx-large': { font: '--display-regular-large', height: '--spacing-sizing-23' }, //144,
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export type
|
|
31
|
+
export type AvatarProps = CommonProps<'aria-label'> & {
|
|
32
32
|
/**
|
|
33
|
-
* The size of the
|
|
33
|
+
* The size of the avatar.
|
|
34
34
|
*
|
|
35
35
|
* @default small
|
|
36
36
|
*/
|
|
37
37
|
size?: SizeVariant;
|
|
38
38
|
/**
|
|
39
|
-
* The color of the
|
|
39
|
+
* The color of the avatar.
|
|
40
40
|
*
|
|
41
41
|
* @default grey
|
|
42
42
|
*/
|
|
43
43
|
color?: ColorVariant;
|
|
44
|
-
/** The initials to display in the
|
|
44
|
+
/** The initials to display in the avatar limited to 2 characters. */
|
|
45
45
|
initials?: string;
|
|
46
|
-
/** The icon to display in the
|
|
46
|
+
/** The icon to display in the avatar. */
|
|
47
47
|
icon?: ReactNode;
|
|
48
|
-
/** The url to the image to display in the
|
|
48
|
+
/** The url to the image to display in the avatar. */
|
|
49
49
|
image?: string;
|
|
50
50
|
/** The number of notifications not displayed in a list. */
|
|
51
51
|
overflowCount?: number;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* A profile is a visual representation of a user or entity. It can be used to display an initials, icon, image, or an
|
|
55
|
+
* An avatar is a visual representation of a user or entity. It can be used to display an initials, icon, image, or an
|
|
58
56
|
* overflowCount.
|
|
59
57
|
*
|
|
60
|
-
* @name
|
|
58
|
+
* @name Avatar
|
|
61
59
|
*/
|
|
62
|
-
function
|
|
60
|
+
function Avatar({
|
|
63
61
|
initials,
|
|
64
62
|
color = 'grey',
|
|
65
63
|
size = 'small',
|
|
@@ -67,7 +65,7 @@ function Profile({
|
|
|
67
65
|
image,
|
|
68
66
|
'aria-label': ariaLabel,
|
|
69
67
|
overflowCount,
|
|
70
|
-
}:
|
|
68
|
+
}: AvatarProps) {
|
|
71
69
|
const children = useMemo(() => {
|
|
72
70
|
if (initials) return <span data-initials>{initials}</span>;
|
|
73
71
|
if (icon) return <span data-icon>{icon}</span>;
|
|
@@ -79,7 +77,7 @@ function Profile({
|
|
|
79
77
|
return (
|
|
80
78
|
<>
|
|
81
79
|
{children && (
|
|
82
|
-
<div aria-label={ariaLabel} css={style} data-color={color} data-
|
|
80
|
+
<div aria-label={ariaLabel} css={style} data-avatar="" data-color={color} data-size={size}>
|
|
83
81
|
{children}
|
|
84
82
|
</div>
|
|
85
83
|
)}
|
|
@@ -87,9 +85,9 @@ function Profile({
|
|
|
87
85
|
);
|
|
88
86
|
}
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
Avatar.bspkName = 'Avatar';
|
|
91
89
|
|
|
92
|
-
export {
|
|
90
|
+
export { Avatar };
|
|
93
91
|
|
|
94
92
|
export const style = css`
|
|
95
93
|
--height: var(--spacing-sizing-10);
|
package/src/ListItem.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { useErrorLogger } from './utils/errors';
|
|
|
7
7
|
|
|
8
8
|
import { CommonProps, ElementProps } from './';
|
|
9
9
|
|
|
10
|
-
export const LEADING_COMPONENTS = Object.freeze(['Icon', 'Img', '
|
|
10
|
+
export const LEADING_COMPONENTS = Object.freeze(['Icon', 'Img', 'Avatar']);
|
|
11
11
|
|
|
12
12
|
export const TRAILING_COMPONENTS = Object.freeze([
|
|
13
13
|
'ListItemButton',
|
|
@@ -31,7 +31,7 @@ export type ListItemProps<As extends ElementType = 'div'> = CommonProps<'active'
|
|
|
31
31
|
/**
|
|
32
32
|
* The leading element to display in the ListItem.
|
|
33
33
|
*
|
|
34
|
-
* Leading elements may only be one of the following [Icon](/icons), Img,
|
|
34
|
+
* Leading elements may only be one of the following [Icon](/icons), Img, Avatar.
|
|
35
35
|
*/
|
|
36
36
|
leading?: ReactNode;
|
|
37
37
|
/**
|
|
@@ -61,7 +61,7 @@ export type ListItemProps<As extends ElementType = 'div'> = CommonProps<'active'
|
|
|
61
61
|
*
|
|
62
62
|
* The ListItem has three main elements: leading element, label, and trailing element.
|
|
63
63
|
*
|
|
64
|
-
* Leading elements may be one of the following [Icon](/icons), Img,
|
|
64
|
+
* Leading elements may be one of the following [Icon](/icons), Img, Avatar.
|
|
65
65
|
*
|
|
66
66
|
* Trailing elements may be one of the following [Icon](/icons), Checkbox, ListItemButton, Radio, Switch, Tag, Txt.
|
|
67
67
|
*
|
package/src/MenuButton.tsx
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { SvgMenu } from '@bspk/icons/Menu';
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
import { ElementType } from 'react';
|
|
4
3
|
|
|
5
4
|
import { ButtonProps } from './Button';
|
|
6
5
|
|
|
7
6
|
import { ElementProps } from '.';
|
|
8
7
|
|
|
9
|
-
export type MenuButtonProps
|
|
8
|
+
export type MenuButtonProps = Pick<ButtonProps, 'as' | 'onClick'>;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Utility component used within top navigation.
|
|
13
12
|
*
|
|
14
13
|
* @name MenuButton
|
|
15
14
|
*/
|
|
16
|
-
function MenuButton
|
|
17
|
-
const As: ElementType = as || 'div';
|
|
18
|
-
|
|
15
|
+
function MenuButton(props: ElementProps<MenuButtonProps, 'button'>) {
|
|
19
16
|
return (
|
|
20
17
|
<button {...props} css={style}>
|
|
21
18
|
<SvgMenu />
|