@dxos/react-ui-list 0.8.4-main.406dc2a → 0.8.4-main.548089c

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": "@dxos/react-ui-list",
3
- "version": "0.8.4-main.406dc2a",
3
+ "version": "0.8.4-main.548089c",
4
4
  "description": "A list component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -30,33 +30,33 @@
30
30
  "@preact/signals-core": "^1.12.1",
31
31
  "@radix-ui/react-accordion": "1.2.3",
32
32
  "@radix-ui/react-context": "1.1.1",
33
- "@dxos/debug": "0.8.4-main.406dc2a",
34
- "@dxos/invariant": "0.8.4-main.406dc2a",
35
- "@dxos/echo": "0.8.4-main.406dc2a",
36
- "@dxos/log": "0.8.4-main.406dc2a",
37
- "@dxos/live-object": "0.8.4-main.406dc2a",
38
- "@dxos/react-ui": "0.8.4-main.406dc2a",
39
- "@dxos/react-ui-text-tooltip": "0.8.4-main.406dc2a",
40
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a",
41
- "@dxos/react-ui-types": "0.8.4-main.406dc2a",
42
- "@dxos/util": "0.8.4-main.406dc2a"
33
+ "@dxos/debug": "0.8.4-main.548089c",
34
+ "@dxos/echo": "0.8.4-main.548089c",
35
+ "@dxos/invariant": "0.8.4-main.548089c",
36
+ "@dxos/log": "0.8.4-main.548089c",
37
+ "@dxos/live-object": "0.8.4-main.548089c",
38
+ "@dxos/react-ui-text-tooltip": "0.8.4-main.548089c",
39
+ "@dxos/react-ui-theme": "0.8.4-main.548089c",
40
+ "@dxos/react-ui": "0.8.4-main.548089c",
41
+ "@dxos/react-ui-types": "0.8.4-main.548089c",
42
+ "@dxos/util": "0.8.4-main.548089c"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "~19.2.2",
46
- "@types/react-dom": "~19.2.1",
46
+ "@types/react-dom": "~19.2.2",
47
47
  "effect": "3.18.3",
48
48
  "react": "~19.2.0",
49
49
  "react-dom": "~19.2.0",
50
50
  "vite": "7.1.9",
51
- "@dxos/random": "0.8.4-main.406dc2a",
52
- "@dxos/storybook-utils": "0.8.4-main.406dc2a"
51
+ "@dxos/random": "0.8.4-main.548089c",
52
+ "@dxos/storybook-utils": "0.8.4-main.548089c"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "effect": "^3.13.3",
56
56
  "react": "^19.0.0",
57
57
  "react-dom": "^19.0.0",
58
- "@dxos/react-ui": "0.8.4-main.406dc2a",
59
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a"
58
+ "@dxos/react-ui-theme": "0.8.4-main.548089c",
59
+ "@dxos/react-ui": "0.8.4-main.548089c"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
8
  import { faker } from '@dxos/random';
9
- import { withTheme } from '@dxos/react-ui/testing';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
10
 
11
11
  import { Accordion } from './Accordion';
12
12
 
@@ -24,7 +24,7 @@ const DefaultStory = () => {
24
24
  return (
25
25
  <Accordion.Root<TestItem> items={items} classNames='w-[40rem]'>
26
26
  {({ items }) => (
27
- <div className='flex flex-col w-full border-y border-separator divide-y divide-separator'>
27
+ <div className='flex flex-col is-full border-y border-separator divide-y divide-separator'>
28
28
  {items.map((item) => (
29
29
  <Accordion.Item key={item.id} item={item} classNames='border-x border-separator'>
30
30
  <Accordion.ItemHeader>{item.name}</Accordion.ItemHeader>
@@ -42,10 +42,7 @@ const DefaultStory = () => {
42
42
  const meta = {
43
43
  title: 'ui/react-ui-list/Accordion',
44
44
  render: DefaultStory,
45
- decorators: [withTheme],
46
- parameters: {
47
- layout: 'column',
48
- },
45
+ decorators: [withTheme, withLayout({ container: 'column' })],
49
46
  } satisfies Meta<typeof Accordion>;
50
47
 
51
48
  export default meta;
@@ -33,13 +33,13 @@ const DefaultStory = ({ items = [], ...props }: ListRootProps<TestItemType>) =>
33
33
  <List.Root<TestItemType> dragPreview items={items} getId={(item) => item.id} onMove={handleMove} {...props}>
34
34
  {({ items }) => (
35
35
  <>
36
- <div className='flex flex-col w-full'>
36
+ <div className='flex flex-col is-full'>
37
37
  <div role='none' className={grid}>
38
38
  <div />
39
39
  <div className='flex items-center text-sm'>Items</div>
40
40
  </div>
41
41
 
42
- <div role='list' className='w-full h-full overflow-auto'>
42
+ <div role='list' className='is-full bs-full overflow-auto'>
43
43
  {items?.map((item) => (
44
44
  <List.Item<TestItemType> key={item.id} item={item} classNames={mx(grid, ghostHover)}>
45
45
  <List.ItemDragHandle />
@@ -73,7 +73,7 @@ const SimpleStory = ({ items = [], ...props }: ListRootProps<TestItemType>) => {
73
73
  return (
74
74
  <List.Root<TestItemType> dragPreview items={items} {...props}>
75
75
  {({ items }) => (
76
- <div role='list' className='w-full h-full overflow-auto'>
76
+ <div role='list' className='is-full bs-full overflow-auto'>
77
77
  {items?.map((item) => (
78
78
  <List.Item<TestItemType> key={item.id} item={item} classNames={mx(grid, ghostHover)}>
79
79
  <List.ItemDragHandle />
@@ -14,7 +14,7 @@ export type TreeItemDataProps = {
14
14
  className?: string;
15
15
  headingClassName?: string;
16
16
  icon?: string;
17
- iconClassName?: string;
17
+ iconHue?: string;
18
18
  disabled?: boolean;
19
19
  testId?: string;
20
20
  };
@@ -86,10 +86,7 @@ const RawTreeItem = <T extends HasId = any>({
86
86
 
87
87
  const { useItems, getProps, isOpen, isCurrent } = useTree();
88
88
  const items = useItems(item);
89
- const { id, parentOf, label, className, headingClassName, icon, iconClassName, disabled, testId } = getProps(
90
- item,
91
- _path,
92
- );
89
+ const { id, parentOf, label, className, headingClassName, icon, iconHue, disabled, testId } = getProps(item, _path);
93
90
  const path = useMemo(() => [..._path, id], [_path, id]);
94
91
  const open = isOpen(path, item);
95
92
  const current = isCurrent(path, item);
@@ -239,7 +236,7 @@ const RawTreeItem = <T extends HasId = any>({
239
236
  ghostFocusWithin,
240
237
  className,
241
238
  ]}
242
- data-itemid={id}
239
+ data-object-id={id}
243
240
  data-testid={testId}
244
241
  // NOTE(thure): This is intentionally an empty string to for descendents to select by in the CSS
245
242
  // without alerting the user (except for in the correct link element). See also:
@@ -264,7 +261,7 @@ const RawTreeItem = <T extends HasId = any>({
264
261
  label={label}
265
262
  className={headingClassName}
266
263
  icon={icon}
267
- iconClassName={iconClassName}
264
+ iconHue={iconHue}
268
265
  onSelect={handleSelect}
269
266
  ref={buttonRef}
270
267
  />
@@ -6,6 +6,7 @@ import React, { type KeyboardEvent, type MouseEvent, forwardRef, memo, useCallba
6
6
 
7
7
  import { Button, Icon, type Label, toLocalizedString, useTranslation } from '@dxos/react-ui';
8
8
  import { TextTooltip } from '@dxos/react-ui-text-tooltip';
9
+ import { getStyles } from '@dxos/react-ui-theme';
9
10
 
10
11
  // TODO(wittjosiah): Consider whether there should be a separate disabled prop which was visually distinct
11
12
  // rather than just making the item unselectable.
@@ -13,7 +14,7 @@ export type TreeItemHeadingProps = {
13
14
  label: Label;
14
15
  className?: string;
15
16
  icon?: string;
16
- iconClassName?: string;
17
+ iconHue?: string;
17
18
  disabled?: boolean;
18
19
  current?: boolean;
19
20
  onSelect?: (option: boolean) => void;
@@ -21,8 +22,9 @@ export type TreeItemHeadingProps = {
21
22
 
22
23
  export const TreeItemHeading = memo(
23
24
  forwardRef<HTMLButtonElement, TreeItemHeadingProps>(
24
- ({ label, className, icon, iconClassName, disabled, current, onSelect }, forwardedRef) => {
25
+ ({ label, className, icon, iconHue, disabled, current, onSelect }, forwardedRef) => {
25
26
  const { t } = useTranslation();
27
+ const styles = iconHue ? getStyles(iconHue) : undefined;
26
28
 
27
29
  const handleSelect = useCallback(
28
30
  (event: MouseEvent) => {
@@ -65,7 +67,7 @@ export const TreeItemHeading = memo(
65
67
  onKeyDown={handleButtonKeydown}
66
68
  {...(current && { 'aria-current': 'location' })}
67
69
  >
68
- {icon && <Icon icon={icon ?? 'ph--placeholder--regular'} size={5} classNames={['mlb-1', iconClassName]} />}
70
+ {icon && <Icon icon={icon ?? 'ph--placeholder--regular'} size={5} classNames={['mlb-1', styles?.icon]} />}
69
71
  <span className='flex-1 is-0 truncate text-start text-sm font-normal' data-tooltip>
70
72
  {toLocalizedString(label, t)}
71
73
  </span>