@dxos/lit-ui 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc
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 +102 -5
- package/dist/src/dx-anchor/dx-anchor.d.ts +1 -1
- package/dist/src/dx-anchor/dx-anchor.d.ts.map +1 -1
- package/dist/src/dx-anchor/dx-anchor.js +5 -5
- package/dist/src/dx-anchor/dx-anchor.js.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.d.ts +2 -2
- package/dist/src/dx-avatar/dx-avatar.d.ts.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.js +14 -8
- package/dist/src/dx-avatar/dx-avatar.js.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.d.ts.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.js +4 -2
- package/dist/src/dx-avatar/dx-avatar.lit-stories.js.map +1 -1
- package/dist/src/dx-icon/dx-icon.d.ts.map +1 -1
- package/dist/src/dx-tag-picker/dx-tag-picker-item.d.ts.map +1 -1
- package/dist/src/react.d.ts +1 -1
- package/dist/src/react.d.ts.map +1 -1
- package/dist/src/react.js +2 -1
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -20
- package/src/defs.ts +1 -1
- package/src/dx-anchor/dx-anchor.ts +6 -9
- package/src/dx-avatar/dx-avatar.lit-stories.ts +4 -2
- package/src/dx-avatar/dx-avatar.pcss +53 -33
- package/src/dx-avatar/dx-avatar.ts +17 -10
- package/src/dx-tag-picker/dx-tag-picker.pcss +6 -4
- package/src/react.ts +3 -2
package/package.json
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/lit-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bc2380dfbc",
|
|
4
4
|
"description": "Web Components for DXOS using Lit",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"*.css",
|
|
15
|
+
"*.pcss"
|
|
16
|
+
],
|
|
10
17
|
"type": "module",
|
|
11
18
|
"exports": {
|
|
12
19
|
".": {
|
|
13
|
-
"source": "./src/index.ts",
|
|
14
20
|
"types": "./dist/src/index.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"node": "./dist/src/index.js"
|
|
21
|
+
"default": "./dist/src/index.js"
|
|
17
22
|
},
|
|
18
23
|
"./react": {
|
|
19
|
-
"source": "./src/react.ts",
|
|
20
24
|
"types": "./dist/src/react.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"node": "./dist/src/react.js"
|
|
25
|
+
"default": "./dist/src/react.js"
|
|
23
26
|
},
|
|
24
27
|
"./dx-avatar.pcss": "./src/dx-avatar/dx-avatar.pcss",
|
|
25
28
|
"./dx-tag-picker.pcss": "./src/dx-tag-picker/dx-tag-picker.pcss"
|
|
26
29
|
},
|
|
27
30
|
"main": "dist/src/index.js",
|
|
28
31
|
"types": "dist/src/index.d.ts",
|
|
29
|
-
"typesVersions": {
|
|
30
|
-
"*": {
|
|
31
|
-
"react": [
|
|
32
|
-
"./dist/src/react.d.ts"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
32
|
"files": [
|
|
37
33
|
"src",
|
|
38
34
|
"dist"
|
|
@@ -40,12 +36,12 @@
|
|
|
40
36
|
"dependencies": {
|
|
41
37
|
"@lit/react": "^1.0.8",
|
|
42
38
|
"lit": "^3.3.1",
|
|
43
|
-
"@dxos/react-hooks": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/util": "0.8.4-main.
|
|
39
|
+
"@dxos/react-hooks": "0.8.4-main.bc2380dfbc",
|
|
40
|
+
"@dxos/ui-types": "0.8.4-main.bc2380dfbc",
|
|
41
|
+
"@dxos/util": "0.8.4-main.bc2380dfbc"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
44
|
+
"@dxos/test-utils": "0.8.4-main.bc2380dfbc"
|
|
49
45
|
},
|
|
50
46
|
"publishConfig": {
|
|
51
47
|
"access": "public"
|
package/src/defs.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// TODO(thure): I was unable to bring this in from `
|
|
5
|
+
// TODO(thure): I was unable to bring this in from `ui-types` because toolbox.ts would not acknowledge
|
|
6
6
|
// `"@dxos/lit-ui": [ "packages/ui/lit-ui/src/index.ts" ]` in tsconfig.paths.json. How is this meant to work? How is it
|
|
7
7
|
// okay with `react-hooks`?
|
|
8
8
|
export type Size =
|
|
@@ -8,26 +8,25 @@
|
|
|
8
8
|
import { LitElement } from 'lit';
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
|
|
11
|
-
import { DxAnchorActivate } from '@dxos/
|
|
11
|
+
import { DxAnchorActivate } from '@dxos/ui-types';
|
|
12
12
|
|
|
13
13
|
@customElement('dx-anchor')
|
|
14
14
|
export class DxAnchor extends LitElement {
|
|
15
|
-
|
|
16
15
|
// TODO(thure): There is a case (in)sensitivity issue here which is pernicious:
|
|
17
16
|
// Only refactoring the properties here to all-lowercase fixes the binding in `RefField.tsx`, but that
|
|
18
17
|
// should be unnecessary, and it isn’t an issue for `DxAvatar` or `DxGrid`. What’s going on?
|
|
19
18
|
|
|
20
19
|
@property({ type: String })
|
|
21
|
-
|
|
20
|
+
dxn: string = '';
|
|
22
21
|
|
|
23
22
|
@property({ type: String })
|
|
24
23
|
rootclassname: string | undefined = undefined;
|
|
25
24
|
|
|
26
|
-
override connectedCallback
|
|
25
|
+
override connectedCallback(): void {
|
|
27
26
|
super.connectedCallback();
|
|
28
27
|
this.tabIndex = 0;
|
|
29
|
-
this.classList.add(this.getAttribute('data-visible-focus')==='false' ? 'outline-
|
|
30
|
-
if(this.rootclassname){
|
|
28
|
+
this.classList.add(this.getAttribute('data-visible-focus') === 'false' ? 'outline-hidden' : 'dx-focus-ring');
|
|
29
|
+
if (this.rootclassname) {
|
|
31
30
|
this.classList.add(this.rootclassname);
|
|
32
31
|
}
|
|
33
32
|
this.setAttribute('role', 'button');
|
|
@@ -40,9 +39,7 @@ export class DxAnchor extends LitElement {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
private handleActivate(event: { type: string }): void {
|
|
43
|
-
this.dispatchEvent(
|
|
44
|
-
new DxAnchorActivate({ refId: this.refid, label: this.textContent ?? '', trigger: this }),
|
|
45
|
-
);
|
|
42
|
+
this.dispatchEvent(new DxAnchorActivate({ dxn: this.dxn, label: this.textContent ?? '', trigger: this }));
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
override createRenderRoot(): this {
|
|
@@ -11,9 +11,11 @@ import { type DxAvatarProps } from './dx-avatar';
|
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
title: 'dx-avatar',
|
|
14
|
-
parameters: {
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
},
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export const Basic = (_props: DxAvatarProps) => {
|
|
18
|
-
return html
|
|
20
|
+
return html` <dx-avatar hue="teal" fallback="Composer user" icon="/icons.svg#ph--basketball--regular"></dx-avatar> `;
|
|
19
21
|
};
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
/* Tailwind v4: Fixed @apply directives - converted to direct CSS */
|
|
1
2
|
.dx-avatar-group {
|
|
2
|
-
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding-right: 0.5rem;
|
|
3
6
|
}
|
|
4
7
|
|
|
5
8
|
.dx-avatar-group .dx-avatar {
|
|
6
|
-
|
|
9
|
+
margin-right: -0.5rem;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
.dx-avatar-group .dx-avatar {
|
|
10
|
-
&[size=
|
|
11
|
-
|
|
13
|
+
&[size='0'],
|
|
14
|
+
&[size='px'],
|
|
15
|
+
&[size='0.5'],
|
|
16
|
+
&[size='1'],
|
|
17
|
+
&[size='1.5'],
|
|
18
|
+
&[size='2'],
|
|
19
|
+
&[size='2.5'] {
|
|
20
|
+
margin-right: -0.25rem;
|
|
12
21
|
}
|
|
13
22
|
}
|
|
14
23
|
|
|
@@ -17,68 +26,79 @@ dx-avatar {
|
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
.dx-avatar {
|
|
20
|
-
|
|
29
|
+
position: relative;
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
/* Tailwind v4 migration: converted @apply to direct CSS properties */
|
|
21
33
|
|
|
22
34
|
.dx-avatar__frame {
|
|
23
|
-
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
.dx-avatar__frame,
|
|
27
|
-
|
|
39
|
+
.dx-avatar__frame,
|
|
40
|
+
.dx-avatar__ring {
|
|
41
|
+
border-radius: 9999px;
|
|
28
42
|
}
|
|
29
43
|
|
|
30
|
-
&[data-variant=
|
|
31
|
-
.dx-avatar__frame,
|
|
32
|
-
|
|
44
|
+
&[data-variant='square'] {
|
|
45
|
+
.dx-avatar__frame,
|
|
46
|
+
.dx-avatar__ring {
|
|
47
|
+
border-radius: 0.125rem;
|
|
33
48
|
}
|
|
34
49
|
}
|
|
35
50
|
|
|
36
51
|
.dx-avatar__status-icon {
|
|
37
|
-
|
|
52
|
+
position: absolute;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
right: 0;
|
|
38
55
|
}
|
|
39
56
|
|
|
40
57
|
.dx-avatar__ring {
|
|
41
|
-
|
|
58
|
+
position: absolute;
|
|
59
|
+
inset: 0;
|
|
60
|
+
border-width: 2px;
|
|
61
|
+
border-color: var(--surface-bg);
|
|
42
62
|
}
|
|
43
63
|
|
|
44
|
-
&[data-status=
|
|
45
|
-
|
|
64
|
+
&[data-status='active'] .dx-avatar__ring {
|
|
65
|
+
border-color: var(--color-success-border);
|
|
46
66
|
}
|
|
47
67
|
|
|
48
|
-
&[data-status=
|
|
49
|
-
|
|
68
|
+
&[data-status='inactive'] .dx-avatar__ring {
|
|
69
|
+
border-color: var(--color-neutral-border);
|
|
50
70
|
}
|
|
51
71
|
|
|
52
|
-
&[data-status=
|
|
53
|
-
|
|
72
|
+
&[data-status='current'] .dx-avatar__ring {
|
|
73
|
+
border-color: var(--color-focus-ring);
|
|
54
74
|
}
|
|
55
75
|
|
|
56
|
-
&[data-status=
|
|
57
|
-
|
|
76
|
+
&[data-status='internal'] .dx-avatar__ring {
|
|
77
|
+
border-color: var(--color-separator);
|
|
58
78
|
}
|
|
59
79
|
|
|
60
|
-
&[data-status=
|
|
61
|
-
|
|
80
|
+
&[data-status='error'] .dx-avatar__ring {
|
|
81
|
+
border-color: var(--color-error-border);
|
|
62
82
|
}
|
|
63
83
|
|
|
64
|
-
&[data-status=
|
|
65
|
-
|
|
84
|
+
&[data-status='warning'] .dx-avatar__ring {
|
|
85
|
+
border-color: var(--color-warning-border);
|
|
66
86
|
}
|
|
67
87
|
|
|
68
|
-
&[data-animation=
|
|
69
|
-
|
|
88
|
+
&[data-animation='pulse'] .dx-avatar__ring {
|
|
89
|
+
animation: halo-pulse var(--duration, 1s) ease-in-out infinite;
|
|
70
90
|
}
|
|
71
91
|
|
|
72
|
-
&[data-state-loading-status=
|
|
73
|
-
.dx-avatar__fallback-text,
|
|
74
|
-
|
|
92
|
+
&[data-state-loading-status='loaded'] {
|
|
93
|
+
.dx-avatar__fallback-text,
|
|
94
|
+
.dx-avatar__status-icon {
|
|
95
|
+
display: none;
|
|
75
96
|
}
|
|
76
97
|
}
|
|
77
98
|
|
|
78
|
-
&[data-state-loading-status=
|
|
99
|
+
&[data-state-loading-status='error'] {
|
|
79
100
|
.dx-avatar__image {
|
|
80
|
-
|
|
101
|
+
display: none;
|
|
81
102
|
}
|
|
82
103
|
}
|
|
83
104
|
}
|
|
84
|
-
|
|
@@ -13,7 +13,7 @@ import { type Size } from '../defs';
|
|
|
13
13
|
export type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
14
14
|
|
|
15
15
|
export type AvatarVariant = 'square' | 'circle';
|
|
16
|
-
export type AvatarStatus = 'active' | 'inactive' | 'current' | '
|
|
16
|
+
export type AvatarStatus = 'active' | 'inactive' | 'current' | 'internal' | 'error' | 'warning';
|
|
17
17
|
export type AvatarAnimation = 'pulse' | 'none';
|
|
18
18
|
|
|
19
19
|
const rx = '0.125rem';
|
|
@@ -71,7 +71,7 @@ export class DxAvatar extends LitElement {
|
|
|
71
71
|
hue: string | undefined = undefined;
|
|
72
72
|
|
|
73
73
|
@property({ type: String })
|
|
74
|
-
hueVariant: 'fill' | 'surface' = 'fill';
|
|
74
|
+
hueVariant: 'fill' | 'surface' | 'transparent' = 'fill';
|
|
75
75
|
|
|
76
76
|
@property({ type: String })
|
|
77
77
|
size: Size = 10;
|
|
@@ -113,13 +113,18 @@ export class DxAvatar extends LitElement {
|
|
|
113
113
|
const r = sizePx / 2 - ringGap - ringWidth;
|
|
114
114
|
const isTextOnly = Boolean(this.fallback && /[0-9a-zA-Z]+/.test(this.fallback));
|
|
115
115
|
const fontScale = (isTextOnly ? 3 : 3.6) * (1 / 1.612);
|
|
116
|
-
const bg =
|
|
117
|
-
|
|
118
|
-
?
|
|
119
|
-
:
|
|
120
|
-
|
|
116
|
+
const bg =
|
|
117
|
+
this.hueVariant === 'transparent'
|
|
118
|
+
? 'transparent'
|
|
119
|
+
: this.hue
|
|
120
|
+
? this.hueVariant === 'surface'
|
|
121
|
+
? `var(--color-${this.hue}-surface)`
|
|
122
|
+
: `var(--color-${this.hue === 'neutral' ? 'input-surface' : `${this.hue}-fill`})`
|
|
123
|
+
: 'var(--surface-bg)';
|
|
121
124
|
const fg =
|
|
122
|
-
this.hue && this.hueVariant === 'surface'
|
|
125
|
+
this.hue && this.hueVariant === 'surface'
|
|
126
|
+
? `var(--color-${this.hue}-foreground)`
|
|
127
|
+
: 'var(--color-accent-foreground)';
|
|
123
128
|
|
|
124
129
|
return html`<span
|
|
125
130
|
role="none"
|
|
@@ -181,7 +186,8 @@ export class DxAvatar extends LitElement {
|
|
|
181
186
|
y=${sizePx / 5}
|
|
182
187
|
width=${(3 * sizePx) / 5}
|
|
183
188
|
height=${(3 * sizePx) / 5} />`
|
|
184
|
-
:
|
|
189
|
+
: // NOTE: Firefox currently doesn't fully support alignment-baseline.
|
|
190
|
+
svg`
|
|
185
191
|
<text
|
|
186
192
|
x="50%"
|
|
187
193
|
y="50%"
|
|
@@ -189,10 +195,11 @@ export class DxAvatar extends LitElement {
|
|
|
189
195
|
fill=${fg}
|
|
190
196
|
text-anchor="middle"
|
|
191
197
|
alignment-baseline="central"
|
|
198
|
+
dominant-baseline="middle"
|
|
192
199
|
font-size=${this.size === 'px' ? '200%' : this.size * fontScale}
|
|
193
200
|
mask=${`url(#${this.maskId})`}
|
|
194
201
|
>
|
|
195
|
-
${/\p{
|
|
202
|
+
${/\p{Emoji_Presentation}/u.test(this.fallback) ? this.fallback : getInitials(this.fallback)}
|
|
196
203
|
</text>`
|
|
197
204
|
}
|
|
198
205
|
${
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@reference "../../../ui-theme/src/main.css";
|
|
2
|
+
|
|
1
3
|
@layer dx-components {
|
|
2
4
|
dx-tag-picker-item {
|
|
3
5
|
display: inline-block;
|
|
@@ -8,16 +10,16 @@
|
|
|
8
10
|
@apply p-0 m-0 flex;
|
|
9
11
|
|
|
10
12
|
button {
|
|
11
|
-
@apply
|
|
12
|
-
padding-block: var(--
|
|
13
|
+
@apply px-1;
|
|
14
|
+
padding-block: var(--spacing-tag-padding-block);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
&[data-remove='true'] {
|
|
16
18
|
button:first-child {
|
|
17
|
-
@apply
|
|
19
|
+
@apply pr-0.5;
|
|
18
20
|
}
|
|
19
21
|
button:last-child {
|
|
20
|
-
@apply
|
|
22
|
+
@apply pl-0.5;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
}
|
package/src/react.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type EventName, createComponent } from '@lit/react';
|
|
6
6
|
import React, { type ComponentPropsWithRef } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type DxAnchorActivate } from '@dxos/
|
|
8
|
+
import { DX_ANCHOR_ACTIVATE, type DxAnchorActivate } from '@dxos/ui-types';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
type DxTagPickerItemClick,
|
|
@@ -20,7 +20,7 @@ export const DxAnchor = createComponent({
|
|
|
20
20
|
elementClass: NaturalDxAnchor,
|
|
21
21
|
react: React,
|
|
22
22
|
events: {
|
|
23
|
-
onActivate:
|
|
23
|
+
onActivate: DX_ANCHOR_ACTIVATE as EventName<DxAnchorActivate>,
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -54,4 +54,5 @@ export const DxTagPickerItem = createComponent({
|
|
|
54
54
|
export type DxTagPickerItemProps = ComponentPropsWithRef<typeof DxTagPickerItem>;
|
|
55
55
|
|
|
56
56
|
export { createComponent };
|
|
57
|
+
|
|
57
58
|
export type { EventName };
|