@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bspk/ui",
3
- "version": "1.0.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.2",
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": "^5.6.3",
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: '--desktop-subheader-x-large', height: '--spacing-sizing-14' }, // 56,
25
- 'xx-large': { font: '--desktop-subheader-xx-large', height: '--spacing-sizing-17' }, // 72,
26
- 'xxx-large': { font: '--desktop-display-regular-small', height: '--spacing-sizing-19' }, //96,
27
- 'xxxx-large': { font: '--desktop-display-regular-medium', height: '--spacing-sizing-21' }, // 120,
28
- 'xxxxx-large': { font: '--desktop-display-regular-large', height: '--spacing-sizing-23' }, //144,
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 ProfileProps = CommonProps<'aria-label'> & {
31
+ export type AvatarProps = CommonProps<'aria-label'> & {
32
32
  /**
33
- * The size of the profile.
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 profile.
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 profile limited to 2 characters. */
44
+ /** The initials to display in the avatar limited to 2 characters. */
45
45
  initials?: string;
46
- /** The icon to display in the profile. */
46
+ /** The icon to display in the avatar. */
47
47
  icon?: ReactNode;
48
- /** The url to the image to display in the profile. */
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
- * A profile component.
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 Profile
58
+ * @name Avatar
61
59
  */
62
- function Profile({
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
- }: ProfileProps) {
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-profile="" data-size={size}>
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
- Profile.bspkName = 'Profile';
88
+ Avatar.bspkName = 'Avatar';
91
89
 
92
- export { Profile };
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', 'Profile']);
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, Profile.
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, Profile.
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
  *
@@ -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<As extends ElementType> = Pick<ButtonProps<As>, 'as' | 'onClick'>;
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<As extends ElementType = 'button'>({ as, ...props }: ElementProps<MenuButtonProps<As>, As>) {
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 />