@dxos/lit-ui 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
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/dist/src/dx-anchor/dx-anchor.d.ts +1 -11
- package/dist/src/dx-anchor/dx-anchor.d.ts.map +1 -1
- package/dist/src/dx-anchor/dx-anchor.js +5 -13
- 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 +58 -33
- package/dist/src/dx-avatar/dx-avatar.js.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.d.ts +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 +5 -3
- 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/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/react.d.ts +2 -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 +17 -20
- package/src/defs.ts +1 -1
- package/src/dx-anchor/dx-anchor.ts +7 -22
- package/src/dx-avatar/dx-avatar.lit-stories.ts +6 -4
- package/src/dx-avatar/dx-avatar.pcss +53 -33
- package/src/dx-avatar/dx-avatar.ts +63 -35
- package/src/dx-tag-picker/dx-tag-picker.pcss +6 -4
- package/src/index.ts +1 -1
- package/src/react.ts +4 -2
package/package.json
CHANGED
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/lit-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dfabb4ec29",
|
|
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
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
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"
|
|
39
35
|
],
|
|
40
36
|
"dependencies": {
|
|
41
|
-
"@lit/react": "^1.0.
|
|
42
|
-
"lit": "^3.
|
|
43
|
-
"@dxos/react-hooks": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
37
|
+
"@lit/react": "^1.0.8",
|
|
38
|
+
"lit": "^3.3.1",
|
|
39
|
+
"@dxos/react-hooks": "0.8.4-main.dfabb4ec29",
|
|
40
|
+
"@dxos/ui-types": "0.8.4-main.dfabb4ec29",
|
|
41
|
+
"@dxos/util": "0.8.4-main.dfabb4ec29"
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
44
|
+
"@dxos/test-utils": "0.8.4-main.dfabb4ec29"
|
|
48
45
|
},
|
|
49
46
|
"publishConfig": {
|
|
50
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 =
|
|
@@ -5,41 +5,28 @@
|
|
|
5
5
|
// TODO(thure): Find a way to instruct ESLint & Prettier to treat any whitespace between tags rendered in the `html` template function as significant.
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { LitElement } from 'lit';
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
export class DxAnchorActivate extends Event {
|
|
14
|
-
public readonly refId: string;
|
|
15
|
-
public readonly label: string;
|
|
16
|
-
public readonly trigger: DxAnchor;
|
|
17
|
-
constructor(props: { refId: string; label: string; trigger: DxAnchor }) {
|
|
18
|
-
super('dx-anchor-activate');
|
|
19
|
-
this.refId = props.refId;
|
|
20
|
-
this.label = props.label;
|
|
21
|
-
this.trigger = props.trigger;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
11
|
+
import { DxAnchorActivate } from '@dxos/ui-types';
|
|
24
12
|
|
|
25
13
|
@customElement('dx-anchor')
|
|
26
14
|
export class DxAnchor extends LitElement {
|
|
27
|
-
|
|
28
15
|
// TODO(thure): There is a case (in)sensitivity issue here which is pernicious:
|
|
29
16
|
// Only refactoring the properties here to all-lowercase fixes the binding in `RefField.tsx`, but that
|
|
30
17
|
// should be unnecessary, and it isn’t an issue for `DxAvatar` or `DxGrid`. What’s going on?
|
|
31
18
|
|
|
32
19
|
@property({ type: String })
|
|
33
|
-
|
|
20
|
+
dxn: string = '';
|
|
34
21
|
|
|
35
22
|
@property({ type: String })
|
|
36
23
|
rootclassname: string | undefined = undefined;
|
|
37
24
|
|
|
38
|
-
override connectedCallback
|
|
25
|
+
override connectedCallback(): void {
|
|
39
26
|
super.connectedCallback();
|
|
40
27
|
this.tabIndex = 0;
|
|
41
|
-
this.classList.add('dx-focus-ring');
|
|
42
|
-
if(this.rootclassname){
|
|
28
|
+
this.classList.add(this.getAttribute('data-visible-focus') === 'false' ? 'outline-hidden' : 'dx-focus-ring');
|
|
29
|
+
if (this.rootclassname) {
|
|
43
30
|
this.classList.add(this.rootclassname);
|
|
44
31
|
}
|
|
45
32
|
this.setAttribute('role', 'button');
|
|
@@ -52,9 +39,7 @@ export class DxAnchor extends LitElement {
|
|
|
52
39
|
}
|
|
53
40
|
|
|
54
41
|
private handleActivate(event: { type: string }): void {
|
|
55
|
-
this.dispatchEvent(
|
|
56
|
-
new DxAnchorActivate({ refId: this.refid, label: this.textContent ?? '', trigger: this }),
|
|
57
|
-
);
|
|
42
|
+
this.dispatchEvent(new DxAnchorActivate({ dxn: this.dxn, label: this.textContent ?? '', trigger: this }));
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
override createRenderRoot(): this {
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
|
-
|
|
7
6
|
import './dx-avatar.pcss';
|
|
7
|
+
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
|
|
10
10
|
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
|
-
export const Basic = (
|
|
18
|
-
return html
|
|
19
|
+
export const Basic = (_props: DxAvatarProps) => {
|
|
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-accent-focus-indicator);
|
|
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
|
-
|
|
@@ -7,14 +7,13 @@ import { customElement, property, state } from 'lit/decorators.js';
|
|
|
7
7
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
8
8
|
|
|
9
9
|
import { makeId } from '@dxos/react-hooks';
|
|
10
|
-
import { getFirstTwoRenderableChars } from '@dxos/util';
|
|
11
10
|
|
|
12
11
|
import { type Size } from '../defs';
|
|
13
12
|
|
|
14
13
|
export type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
15
14
|
|
|
16
15
|
export type AvatarVariant = 'square' | 'circle';
|
|
17
|
-
export type AvatarStatus = 'active' | 'inactive' | 'current' | '
|
|
16
|
+
export type AvatarStatus = 'active' | 'inactive' | 'current' | 'internal' | 'error' | 'warning';
|
|
18
17
|
export type AvatarAnimation = 'pulse' | 'none';
|
|
19
18
|
|
|
20
19
|
const rx = '0.125rem';
|
|
@@ -37,6 +36,7 @@ export type DxAvatarProps = Partial<
|
|
|
37
36
|
>
|
|
38
37
|
>;
|
|
39
38
|
|
|
39
|
+
// TODO(burdon): Needs popover.
|
|
40
40
|
@customElement('dx-avatar')
|
|
41
41
|
export class DxAvatar extends LitElement {
|
|
42
42
|
private maskId: string;
|
|
@@ -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,19 @@ 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}-surface-text)`
|
|
127
|
+
: 'var(--color-accent-surface-text)';
|
|
128
|
+
|
|
123
129
|
return html`<span
|
|
124
130
|
role="none"
|
|
125
131
|
class=${`dx-avatar${this.rootClassName ? ` ${this.rootClassName}` : ''}`}
|
|
@@ -139,59 +145,67 @@ export class DxAvatar extends LitElement {
|
|
|
139
145
|
${
|
|
140
146
|
this.variant === 'circle'
|
|
141
147
|
? svg`<circle fill="white" cx="50%" cy="50%" r=${r} />`
|
|
142
|
-
: svg
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
: svg`
|
|
149
|
+
<rect
|
|
150
|
+
fill="white"
|
|
151
|
+
width=${2 * r}
|
|
152
|
+
height=${2 * r}
|
|
153
|
+
x=${ringGap + ringWidth}
|
|
154
|
+
y=${ringGap + ringWidth}
|
|
155
|
+
rx=${rx}
|
|
156
|
+
/>`
|
|
150
157
|
}
|
|
151
158
|
</mask>
|
|
152
159
|
</defs>
|
|
153
160
|
${
|
|
154
161
|
this.variant === 'circle'
|
|
155
|
-
? svg`
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
? svg`
|
|
163
|
+
<circle
|
|
164
|
+
cx="50%"
|
|
165
|
+
cy="50%"
|
|
166
|
+
r=${r}
|
|
167
|
+
fill=${bg}
|
|
168
|
+
/>`
|
|
169
|
+
: svg`
|
|
170
|
+
<rect
|
|
171
|
+
fill=${bg}
|
|
172
|
+
x=${ringGap + ringWidth}
|
|
173
|
+
y=${ringGap + ringWidth}
|
|
174
|
+
width=${2 * r}
|
|
175
|
+
height=${2 * r}
|
|
176
|
+
rx=${rx}
|
|
177
|
+
/>`
|
|
169
178
|
}
|
|
170
179
|
${
|
|
171
180
|
this.icon
|
|
172
|
-
? svg
|
|
181
|
+
? svg`
|
|
182
|
+
<use
|
|
173
183
|
class="dx-avatar__icon"
|
|
174
184
|
href=${this.icon}
|
|
175
185
|
x=${sizePx / 5}
|
|
176
186
|
y=${sizePx / 5}
|
|
177
187
|
width=${(3 * sizePx) / 5}
|
|
178
188
|
height=${(3 * sizePx) / 5} />`
|
|
179
|
-
:
|
|
189
|
+
: // NOTE: Firefox currently doesn't fully support alignment-baseline.
|
|
190
|
+
svg`
|
|
191
|
+
<text
|
|
180
192
|
x="50%"
|
|
181
193
|
y="50%"
|
|
182
194
|
class="dx-avatar__fallback-text"
|
|
183
195
|
fill=${fg}
|
|
184
196
|
text-anchor="middle"
|
|
185
197
|
alignment-baseline="central"
|
|
198
|
+
dominant-baseline="middle"
|
|
186
199
|
font-size=${this.size === 'px' ? '200%' : this.size * fontScale}
|
|
187
200
|
mask=${`url(#${this.maskId})`}
|
|
188
201
|
>
|
|
189
|
-
${
|
|
202
|
+
${/\p{Emoji_Presentation}/u.test(this.fallback) ? this.fallback : getInitials(this.fallback)}
|
|
190
203
|
</text>`
|
|
191
204
|
}
|
|
192
205
|
${
|
|
193
206
|
this.imgSrc &&
|
|
194
|
-
svg
|
|
207
|
+
svg`
|
|
208
|
+
<image
|
|
195
209
|
width="100%"
|
|
196
210
|
height="100%"
|
|
197
211
|
preserveAspectRatio="xMidYMid slice"
|
|
@@ -211,3 +225,17 @@ export class DxAvatar extends LitElement {
|
|
|
211
225
|
return this;
|
|
212
226
|
}
|
|
213
227
|
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Returns the first two renderable characters from a string that are separated by non-word characters.
|
|
231
|
+
* Handles Unicode characters correctly.
|
|
232
|
+
*/
|
|
233
|
+
const getInitials = (label = ''): string[] => {
|
|
234
|
+
return label
|
|
235
|
+
.trim()
|
|
236
|
+
.split(/\s+/)
|
|
237
|
+
.map((str) => str.replace(/[^\p{L}\p{N}\s]/gu, ''))
|
|
238
|
+
.filter(Boolean)
|
|
239
|
+
.slice(0, 2)
|
|
240
|
+
.map((word) => word[0].toUpperCase());
|
|
241
|
+
};
|
|
@@ -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/index.ts
CHANGED
package/src/react.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { type EventName, createComponent } from '@lit/react';
|
|
6
6
|
import React, { type ComponentPropsWithRef } from 'react';
|
|
7
7
|
|
|
8
|
+
import { DX_ANCHOR_ACTIVATE, type DxAnchorActivate } from '@dxos/ui-types';
|
|
9
|
+
|
|
8
10
|
import {
|
|
9
|
-
type DxAnchorActivate,
|
|
10
11
|
type DxTagPickerItemClick,
|
|
11
12
|
DxAnchor as NaturalDxAnchor,
|
|
12
13
|
DxAvatar as NaturalDxAvatar,
|
|
@@ -19,7 +20,7 @@ export const DxAnchor = createComponent({
|
|
|
19
20
|
elementClass: NaturalDxAnchor,
|
|
20
21
|
react: React,
|
|
21
22
|
events: {
|
|
22
|
-
onActivate:
|
|
23
|
+
onActivate: DX_ANCHOR_ACTIVATE as EventName<DxAnchorActivate>,
|
|
23
24
|
},
|
|
24
25
|
});
|
|
25
26
|
|
|
@@ -53,4 +54,5 @@ export const DxTagPickerItem = createComponent({
|
|
|
53
54
|
export type DxTagPickerItemProps = ComponentPropsWithRef<typeof DxTagPickerItem>;
|
|
54
55
|
|
|
55
56
|
export { createComponent };
|
|
57
|
+
|
|
56
58
|
export type { EventName };
|