@epam/ai-dial-ui-kit 0.16.0-dev.5 → 0.16.0-dev.6
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/CHANGELOG.md +2 -2
- package/dist/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +5 -2
- package/dist/components/New/Avatar/Avatar.js +18 -17
- package/dist/components-manifest.json +65 -3
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +96 -94
- package/dist/node_modules/mime-types/index.js +1 -1
- package/dist/node_modules/react-dnd/dist/hooks/useCollector.js +1 -1
- package/dist/src/components/New/Avatar/Avatar.d.ts +9 -3
- package/dist/src/index.d.ts +3 -2
- package/dist/src/types/avatar.d.ts +9 -0
- package/dist/src/utils/avatar.d.ts +2 -1
- package/dist/types/avatar.js +3 -2
- package/dist/utils/avatar.js +41 -18
- package/package.json +1 -1
package/dist/dial-ui-kit.js
CHANGED
|
@@ -155,54 +155,56 @@ import { BottomSheet as Wi } from "./components/New/BottomSheet/BottomSheet.js";
|
|
|
155
155
|
import { Badge as Qi } from "./components/New/Badge/Badge.js";
|
|
156
156
|
import { BadgeColor as Zi, BadgeVariant as Ji } from "./types/badge.js";
|
|
157
157
|
import { Avatar as ji } from "./components/New/Avatar/Avatar.js";
|
|
158
|
-
import {
|
|
159
|
-
import { extractInitials as
|
|
160
|
-
import { EntityIdentity as
|
|
161
|
-
import { EntityType as
|
|
162
|
-
import { SideDrawer as
|
|
163
|
-
import { Tag as
|
|
164
|
-
import { TagAppearance as
|
|
165
|
-
import { TagInput as
|
|
166
|
-
import { AutocompleteTagInput as
|
|
167
|
-
import { Search as
|
|
168
|
-
import { matchesAccept as
|
|
169
|
-
import { Slider as
|
|
170
|
-
import { Tooltip as
|
|
171
|
-
import { TooltipContainer as
|
|
172
|
-
import { TooltipContent as
|
|
173
|
-
import { TooltipTrigger as
|
|
174
|
-
import { InteractiveTooltipTrigger as
|
|
175
|
-
import { InteractiveTooltip as
|
|
176
|
-
import { EllipsisTooltip as
|
|
177
|
-
import { CollapsibleSidebar as
|
|
178
|
-
import { ResizableContainer as
|
|
179
|
-
import { ConditionalResizableContainer as
|
|
180
|
-
import { NoDataContent as
|
|
181
|
-
import { TransferQueue as
|
|
182
|
-
import { DEFAULT_TRANSFER_QUEUE_LABELS as
|
|
183
|
-
import { TransferQueueItemStatus as
|
|
184
|
-
import { GRID_SELECTION_COLUMN_ID as
|
|
185
|
-
import { GridColorScheme as
|
|
186
|
-
import { DateCellRenderer as
|
|
187
|
-
import { DEFAULT_DATE_FORMAT_OPTIONS as
|
|
188
|
-
import { GRID_ALIGN_RIGHT_CLASS as
|
|
189
|
-
import { DIAL_KIT_ICON_STROKE as
|
|
190
|
-
import { convertToDate as
|
|
191
|
-
import { baseColumnComparator as
|
|
192
|
-
import { DEFAULT_ANALYTICS_BAR_COLOR_MAP as
|
|
193
|
-
import { DialAnalyticsBar as
|
|
194
|
-
import { DialAnalyticsBarGroup as
|
|
195
|
-
import { DialAnalyticsCard as
|
|
196
|
-
import { DialAnalyticsErrorTag as
|
|
197
|
-
import { DialAnalyticsHistogram as
|
|
198
|
-
import { JsonSchemaType as
|
|
158
|
+
import { AvatarColor as $i, AvatarShape as op } from "./types/avatar.js";
|
|
159
|
+
import { AVATAR_PALETTE as ep, extractInitials as tp } from "./utils/avatar.js";
|
|
160
|
+
import { EntityIdentity as ip } from "./components/New/EntityIdentity/EntityIdentity.js";
|
|
161
|
+
import { EntityType as mp } from "./types/entity-type.js";
|
|
162
|
+
import { SideDrawer as fp } from "./components/New/SideDrawer/SideDrawer.js";
|
|
163
|
+
import { Tag as xp } from "./components/New/Tag/Tag.js";
|
|
164
|
+
import { TagAppearance as Tp } from "./types/tag.js";
|
|
165
|
+
import { TagInput as up } from "./components/New/TagInput/TagInput.js";
|
|
166
|
+
import { AutocompleteTagInput as Sp } from "./components/New/AutocompleteTagInput/AutocompleteTagInput.js";
|
|
167
|
+
import { Search as Ip } from "./components/New/Search/Search.js";
|
|
168
|
+
import { matchesAccept as Ep } from "./utils/file-accept.js";
|
|
169
|
+
import { Slider as Cp } from "./components/New/Slider/Slider.js";
|
|
170
|
+
import { Tooltip as Bp } from "./components/New/Tooltip/Tooltip.js";
|
|
171
|
+
import { TooltipContainer as Np } from "./components/New/Tooltip/TooltipContainer.js";
|
|
172
|
+
import { TooltipContent as Op } from "./components/New/Tooltip/TooltipContent.js";
|
|
173
|
+
import { TooltipTrigger as Pp } from "./components/New/Tooltip/TooltipTrigger.js";
|
|
174
|
+
import { InteractiveTooltipTrigger as bp, TooltipPlacement as hp } from "./types/tooltip.js";
|
|
175
|
+
import { InteractiveTooltip as Gp } from "./components/New/InteractiveTooltip/InteractiveTooltip.js";
|
|
176
|
+
import { EllipsisTooltip as wp } from "./components/New/EllipsisTooltip/EllipsisTooltip.js";
|
|
177
|
+
import { CollapsibleSidebar as kp } from "./components/New/CollapsibleSidebar/CollapsibleSidebar.js";
|
|
178
|
+
import { ResizableContainer as Vp } from "./components/New/ResizableContainer/ResizableContainer.js";
|
|
179
|
+
import { ConditionalResizableContainer as Wp } from "./components/New/ResizableContainer/ConditionalResizableContainer.js";
|
|
180
|
+
import { NoDataContent as Qp } from "./components/New/NoDataContent/NoDataContent.js";
|
|
181
|
+
import { TransferQueue as Zp } from "./components/New/TransferQueue/TransferQueue.js";
|
|
182
|
+
import { DEFAULT_TRANSFER_QUEUE_LABELS as Xp, TRANSFER_QUEUE_AUTO_CLOSE_DELAY_MS as jp } from "./components/New/TransferQueue/constants.js";
|
|
183
|
+
import { TransferQueueItemStatus as $p } from "./types/transfer-queue.js";
|
|
184
|
+
import { GRID_SELECTION_COLUMN_ID as rm, Grid as em } from "./components/New/Grid/Grid.js";
|
|
185
|
+
import { GridColorScheme as am } from "./types/grid.js";
|
|
186
|
+
import { DateCellRenderer as pm } from "./components/New/Grid/renderers/DateCellRenderer.js";
|
|
187
|
+
import { DEFAULT_DATE_FORMAT_OPTIONS as nm, DEFAULT_LOCALE as fm } from "./components/New/Grid/renderers/constants.js";
|
|
188
|
+
import { GRID_ALIGN_RIGHT_CLASS as xm, GRID_ROOT_CLASS as Dm, ROW_HEIGHT as Tm, GRID_THEME_PARAMS as cm } from "./components/New/Grid/constants.js";
|
|
189
|
+
import { DIAL_KIT_ICON_STROKE as sm } from "./components/New/constants/icon.js";
|
|
190
|
+
import { convertToDate as dm, convertToDate as Im } from "./utils/grid-date.js";
|
|
191
|
+
import { baseColumnComparator as Em, checkColDefsChanges as _m } from "./utils/grid-comparators.js";
|
|
192
|
+
import { DEFAULT_ANALYTICS_BAR_COLOR_MAP as Lm } from "./components/Analytics/Bar/utils.js";
|
|
193
|
+
import { DialAnalyticsBar as gm } from "./components/Analytics/Bar/Bar.js";
|
|
194
|
+
import { DialAnalyticsBarGroup as Rm } from "./components/Analytics/BarGroup/BarGroup.js";
|
|
195
|
+
import { DialAnalyticsCard as Fm } from "./components/Analytics/Card/Card.js";
|
|
196
|
+
import { DialAnalyticsErrorTag as Mm } from "./components/Analytics/ErrorTag/ErrorTag.js";
|
|
197
|
+
import { DialAnalyticsHistogram as hm } from "./components/Analytics/Histogram/Histogram.js";
|
|
198
|
+
import { JsonSchemaType as Gm, SchemaDisplayMode as Um, SchemaOrientation as wm, SchemaRendererVariant as zm } from "./types/json-schema.js";
|
|
199
199
|
export {
|
|
200
|
+
ep as AVATAR_PALETTE,
|
|
200
201
|
li as Accordion,
|
|
201
202
|
Di as AccordionCaretPosition,
|
|
202
203
|
i as AnalyticsCardVariant,
|
|
203
|
-
|
|
204
|
+
Sp as AutocompleteTagInput,
|
|
204
205
|
ji as Avatar,
|
|
205
|
-
$i as
|
|
206
|
+
$i as AvatarColor,
|
|
207
|
+
op as AvatarShape,
|
|
206
208
|
mt as BASE_ICON_PROPS,
|
|
207
209
|
nt as BASE_ICON_SIZE,
|
|
208
210
|
Qi as Badge,
|
|
@@ -222,28 +224,28 @@ export {
|
|
|
222
224
|
_i as Checkbox,
|
|
223
225
|
Li as CheckboxBox,
|
|
224
226
|
Xa as CloseButton,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
kp as CollapsibleSidebar,
|
|
228
|
+
Wp as ConditionalResizableContainer,
|
|
227
229
|
qa as ConfirmationPopup,
|
|
228
230
|
oe as ConfirmationPopupVariant,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
Lm as DEFAULT_ANALYTICS_BAR_COLOR_MAP,
|
|
232
|
+
nm as DEFAULT_DATE_FORMAT_OPTIONS,
|
|
233
|
+
fm as DEFAULT_DATE_LOCALE,
|
|
232
234
|
xo as DEFAULT_GRID_DATE_FORMAT_OPTIONS,
|
|
233
235
|
Do as DEFAULT_GRID_DATE_LOCALE,
|
|
234
|
-
|
|
236
|
+
Xp as DEFAULT_TRANSFER_QUEUE_LABELS,
|
|
235
237
|
ft as DIAL_ICON_SIZE,
|
|
236
238
|
st as DIAL_KIT_CLASS,
|
|
237
|
-
|
|
239
|
+
sm as DIAL_KIT_ICON_STROKE,
|
|
238
240
|
aa as DangerButton,
|
|
239
241
|
Da as DangerIconButton,
|
|
240
|
-
|
|
242
|
+
pm as DateCellRenderer,
|
|
241
243
|
f as DialAccordion,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
gm as DialAnalyticsBar,
|
|
245
|
+
Rm as DialAnalyticsBarGroup,
|
|
246
|
+
Fm as DialAnalyticsCard,
|
|
247
|
+
Mm as DialAnalyticsErrorTag,
|
|
248
|
+
hm as DialAnalyticsHistogram,
|
|
247
249
|
Er as DialAutocompleteInputValue,
|
|
248
250
|
so as DialBreadcrumb,
|
|
249
251
|
Io as DialBreadcrumbItem,
|
|
@@ -332,9 +334,9 @@ export {
|
|
|
332
334
|
ye as EDITABLE_CONTAINER_ATTRIBUTE,
|
|
333
335
|
Kr as EditorThemes,
|
|
334
336
|
ne as ElementSize,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
wp as EllipsisTooltip,
|
|
338
|
+
ip as EntityIdentity,
|
|
339
|
+
mp as EntityType,
|
|
338
340
|
yt as ErrorMessageNotification,
|
|
339
341
|
ni as ErrorText,
|
|
340
342
|
Gt as ErrorToastNotification,
|
|
@@ -349,17 +351,17 @@ export {
|
|
|
349
351
|
ki as FolderName,
|
|
350
352
|
qt as FolderPath,
|
|
351
353
|
ce as FormItemOrientation,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
xm as GRID_ALIGN_RIGHT_CLASS,
|
|
355
|
+
Dm as GRID_ROOT_CLASS,
|
|
356
|
+
Tm as GRID_ROW_HEIGHT,
|
|
357
|
+
rm as GRID_SELECTION_COLUMN_ID,
|
|
358
|
+
cm as GRID_THEME_PARAMS,
|
|
357
359
|
Ut as GeneralMessageNotification,
|
|
358
360
|
wt as GeneralToastNotification,
|
|
359
361
|
ia as GhostButton,
|
|
360
362
|
Ta as GhostIconButton,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
+
em as Grid,
|
|
364
|
+
am as GridColorScheme,
|
|
363
365
|
Je as GridSelectionMode,
|
|
364
366
|
Pt as Highlight,
|
|
365
367
|
Aa as IconButton,
|
|
@@ -369,9 +371,9 @@ export {
|
|
|
369
371
|
Ra as InlineSelect,
|
|
370
372
|
Oa as InlineSelectTrigger,
|
|
371
373
|
Va as Input,
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
Gp as InteractiveTooltip,
|
|
375
|
+
bp as InteractiveTooltipTrigger,
|
|
376
|
+
Gm as JsonSchemaType,
|
|
375
377
|
Ua as Label,
|
|
376
378
|
_t as LazyDialJsonEditor,
|
|
377
379
|
Lt as LazyDialMarkdownEditor,
|
|
@@ -389,7 +391,7 @@ export {
|
|
|
389
391
|
ct as NOT_ALLOWED_SYMBOLS_REGEXP,
|
|
390
392
|
ma as NeutralButton,
|
|
391
393
|
ca as NeutralIconButton,
|
|
392
|
-
|
|
394
|
+
Qp as NoDataContent,
|
|
393
395
|
Ot as Notification,
|
|
394
396
|
gt as NotificationType,
|
|
395
397
|
Nt as NotificationVariant,
|
|
@@ -405,26 +407,26 @@ export {
|
|
|
405
407
|
di as RadioGroup,
|
|
406
408
|
Xr as RadioGroupOrientation,
|
|
407
409
|
Ai as RadioGroupPopupField,
|
|
408
|
-
|
|
410
|
+
Vp as ResizableContainer,
|
|
409
411
|
Ne as ResizableContainerSide,
|
|
410
412
|
at as SIZE_COLUMN,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
+
Um as SchemaDisplayMode,
|
|
414
|
+
wm as SchemaOrientation,
|
|
413
415
|
At as SchemaRenderer,
|
|
414
|
-
|
|
416
|
+
zm as SchemaRendererVariant,
|
|
415
417
|
le as ScreenResolution,
|
|
416
|
-
|
|
418
|
+
Ip as Search,
|
|
417
419
|
Ri as SegmentedControl,
|
|
418
420
|
Pa as Select,
|
|
419
421
|
se as SelectSize,
|
|
420
422
|
Se as SelectVariant,
|
|
421
423
|
Vi as SharedEntityIndicator,
|
|
422
|
-
|
|
424
|
+
fp as SideDrawer,
|
|
423
425
|
io as Skeleton,
|
|
424
426
|
Oe as SkeletonAvatarShape,
|
|
425
427
|
Fe as SkeletonAvatarSize,
|
|
426
428
|
Pe as SkeletonVariant,
|
|
427
|
-
|
|
429
|
+
Cp as Slider,
|
|
428
430
|
S as Spinner,
|
|
429
431
|
la as StarterButton,
|
|
430
432
|
sa as StaticIconButton,
|
|
@@ -432,35 +434,35 @@ export {
|
|
|
432
434
|
Ht as SuccessMessageNotification,
|
|
433
435
|
Wt as SuccessToastNotification,
|
|
434
436
|
ci as Switch,
|
|
435
|
-
|
|
437
|
+
jp as TRANSFER_QUEUE_AUTO_CLOSE_DELAY_MS,
|
|
436
438
|
xe as TabOrientation,
|
|
437
439
|
De as TabView,
|
|
438
440
|
Fi as Tabs,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
441
|
+
xp as Tag,
|
|
442
|
+
Tp as TagAppearance,
|
|
443
|
+
up as TagInput,
|
|
442
444
|
za as Textarea,
|
|
443
445
|
ka as TextareaResize,
|
|
444
446
|
ei as ThemeScope,
|
|
445
447
|
gi as ToggleIconButton,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
448
|
+
Bp as Tooltip,
|
|
449
|
+
Np as TooltipContainer,
|
|
450
|
+
Op as TooltipContent,
|
|
451
|
+
hp as TooltipPlacement,
|
|
452
|
+
Pp as TooltipTrigger,
|
|
453
|
+
Zp as TransferQueue,
|
|
454
|
+
$p as TransferQueueItemStatus,
|
|
453
455
|
it as UPDATED_AT_COLUMN,
|
|
454
456
|
Kt as WarningMessageNotification,
|
|
455
457
|
Qt as WarningToastNotification,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
Em as baseColumnComparator,
|
|
459
|
+
_m as checkColDefsChanges,
|
|
460
|
+
dm as convertGridDateToDate,
|
|
461
|
+
Im as convertToDate,
|
|
460
462
|
Ge as editableContainerProps,
|
|
461
|
-
|
|
463
|
+
tp as extractInitials,
|
|
462
464
|
rt as getTimezoneLabel,
|
|
463
|
-
|
|
465
|
+
Ep as matchesAccept,
|
|
464
466
|
je as mergeClasses,
|
|
465
467
|
be as useDialFileManagerTabs,
|
|
466
468
|
Ue as useEditableItem,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as l } from "../../_virtual/
|
|
1
|
+
import { __exports as l } from "../../_virtual/index2.js";
|
|
2
2
|
import { __require as R } from "../mime-db/index.js";
|
|
3
3
|
import b from "../../_virtual/___vite-browser-external.js";
|
|
4
4
|
import { __require as k } from "./mimeScore.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, SyntheticEvent } from 'react';
|
|
2
2
|
import { AvatarShape } from '../../../types/avatar';
|
|
3
|
+
import { AvatarColorClasses } from '../../../utils/avatar';
|
|
3
4
|
/** Props for `Avatar`. */
|
|
4
5
|
export interface AvatarProps {
|
|
5
6
|
/** Display name the initials and the colour are derived from. */
|
|
@@ -14,6 +15,8 @@ export interface AvatarProps {
|
|
|
14
15
|
size?: number;
|
|
15
16
|
/** Outline of the avatar. */
|
|
16
17
|
shape?: AvatarShape;
|
|
18
|
+
/** Explicit colour pair overriding the deterministic pick from `name`. */
|
|
19
|
+
color?: AvatarColorClasses;
|
|
17
20
|
/** Additional CSS classes for the avatar. */
|
|
18
21
|
className?: string;
|
|
19
22
|
/** Type-scale class for the initials. When set, it replaces the font size derived from `size`. */
|
|
@@ -28,9 +31,11 @@ export interface AvatarProps {
|
|
|
28
31
|
* Design system 2.0
|
|
29
32
|
*
|
|
30
33
|
* The same name always gets the same colour, drawn from the theme's visual
|
|
31
|
-
* tokens, so a list of avatars stays stable between renders and sessions
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* tokens, so a list of avatars stays stable between renders and sessions; pass
|
|
35
|
+
* `color` to pin one entry of `AVATAR_PALETTE` instead, so every avatar of a
|
|
36
|
+
* kind shares one colour regardless of name or locale. An image that is
|
|
37
|
+
* missing or fails to load falls back to the initials; a new `src` tries the
|
|
38
|
+
* image again.
|
|
34
39
|
*
|
|
35
40
|
* An avatar with an `alt` is a `role="img"` named by it, whether it shows the
|
|
36
41
|
* image or the initials. Without one it is decorative and hidden from
|
|
@@ -48,6 +53,7 @@ export interface AvatarProps {
|
|
|
48
53
|
* @param [alt=''] - Accessible name; empty makes the avatar decorative
|
|
49
54
|
* @param [size=32] - Width and height in px
|
|
50
55
|
* @param [shape=AvatarShape.Circle] - Outline of the avatar
|
|
56
|
+
* @param [color] - Explicit colour pair overriding the deterministic pick from `name`
|
|
51
57
|
* @param [className] - Additional CSS classes for the avatar
|
|
52
58
|
* @param [textClassName] - Type-scale class for the initials, replacing the size-derived font size
|
|
53
59
|
* @param [onImageError] - Called when the image fails to load
|
package/dist/src/index.d.ts
CHANGED
|
@@ -249,8 +249,9 @@ export type { BadgeProps } from './components/New/Badge/Badge';
|
|
|
249
249
|
export { BadgeColor, BadgeVariant } from './types/badge';
|
|
250
250
|
export { Avatar } from './components/New/Avatar/Avatar';
|
|
251
251
|
export type { AvatarProps } from './components/New/Avatar/Avatar';
|
|
252
|
-
export { AvatarShape } from './types/avatar';
|
|
253
|
-
export { extractInitials } from './utils/avatar';
|
|
252
|
+
export { AvatarColor, AvatarShape } from './types/avatar';
|
|
253
|
+
export { AVATAR_PALETTE, extractInitials } from './utils/avatar';
|
|
254
|
+
export type { AvatarColorClasses } from './utils/avatar';
|
|
254
255
|
export { EntityIdentity } from './components/New/EntityIdentity/EntityIdentity';
|
|
255
256
|
export type { EntityIdentityProps, EntityIdentityItem, EntityIdentityLabels, } from './components/New/EntityIdentity/EntityIdentity';
|
|
256
257
|
export { EntityType } from './types/entity-type';
|
|
@@ -5,3 +5,12 @@ export declare enum AvatarShape {
|
|
|
5
5
|
/** A rounded square — the avatar of an application, model or other entity. */
|
|
6
6
|
Square = "square"
|
|
7
7
|
}
|
|
8
|
+
export declare enum AvatarColor {
|
|
9
|
+
Green1 = "green-1",
|
|
10
|
+
Violet2 = "violet-2",
|
|
11
|
+
Brown = "brown",
|
|
12
|
+
Red = "red",
|
|
13
|
+
Green2 = "green-2",
|
|
14
|
+
Blue = "blue",
|
|
15
|
+
Violet1 = "violet-1"
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AvatarColor } from '../types/avatar';
|
|
1
2
|
/** A background and text colour pair for an initials avatar, as Tailwind classes. */
|
|
2
3
|
export interface AvatarColorClasses {
|
|
3
4
|
/** Background class, bound to a `--bg-visual-*` token. */
|
|
@@ -5,7 +6,7 @@ export interface AvatarColorClasses {
|
|
|
5
6
|
/** Text class, bound to the matching `--text-visual-*` token. */
|
|
6
7
|
foreground: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const AVATAR_PALETTE:
|
|
9
|
+
export declare const AVATAR_PALETTE: Record<AvatarColor, AvatarColorClasses>;
|
|
9
10
|
/** Returns the palette entry for a name; the same name always gets the same colours. */
|
|
10
11
|
export declare const pickAvatarColor: (name: string) => AvatarColorClasses;
|
|
11
12
|
/** Returns 1–2 uppercase initials derived from a display name, or `'?'` when it has no letters. */
|
package/dist/types/avatar.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n = /* @__PURE__ */ ((e) => (e.Circle = "circle", e.Square = "square", e))(n || {}), i = /* @__PURE__ */ ((e) => (e.Green1 = "green-1", e.Violet2 = "violet-2", e.Brown = "brown", e.Red = "red", e.Green2 = "green-2", e.Blue = "blue", e.Violet1 = "violet-1", e))(i || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
i as AvatarColor,
|
|
4
|
+
n as AvatarShape
|
|
4
5
|
};
|
package/dist/utils/avatar.js
CHANGED
|
@@ -1,22 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { AvatarColor as t } from "../types/avatar.js";
|
|
2
|
+
const l = {
|
|
3
|
+
[t.Green1]: {
|
|
4
|
+
background: "bg-green-1",
|
|
5
|
+
foreground: "text-green-2"
|
|
6
|
+
},
|
|
7
|
+
[t.Violet2]: {
|
|
8
|
+
background: "bg-violet-2",
|
|
9
|
+
foreground: "text-violet-1"
|
|
10
|
+
},
|
|
11
|
+
[t.Brown]: {
|
|
12
|
+
background: "bg-brown",
|
|
13
|
+
foreground: "text-brown-2"
|
|
14
|
+
},
|
|
15
|
+
[t.Red]: {
|
|
16
|
+
background: "bg-red",
|
|
17
|
+
foreground: "text-red"
|
|
18
|
+
},
|
|
19
|
+
[t.Green2]: {
|
|
20
|
+
background: "bg-green-2",
|
|
21
|
+
foreground: "text-green-3"
|
|
22
|
+
},
|
|
23
|
+
[t.Blue]: {
|
|
24
|
+
background: "bg-blue",
|
|
25
|
+
foreground: "text-accent"
|
|
26
|
+
},
|
|
27
|
+
[t.Violet1]: {
|
|
28
|
+
background: "bg-violet-1",
|
|
29
|
+
foreground: "text-violet-2"
|
|
30
|
+
}
|
|
31
|
+
}, c = (r) => {
|
|
32
|
+
const e = Object.values(l);
|
|
33
|
+
let n = 0;
|
|
34
|
+
for (let o = 0; o < r.length; o++)
|
|
35
|
+
n += r.charCodeAt(o);
|
|
36
|
+
return e[n % e.length];
|
|
37
|
+
}, g = (r) => r.match(new RegExp("\\p{L}", "u"))?.[0] ?? "", u = (r) => {
|
|
38
|
+
const e = r.trim().split(/\s+/).filter(Boolean);
|
|
39
|
+
return e.length === 0 ? "?" : e.length >= 2 ? (g(e[0]) + g(e[1])).toUpperCase() || "?" : e[0].replace(/[^\p{L}]/gu, "").slice(0, 2).toUpperCase() || "?";
|
|
17
40
|
};
|
|
18
41
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
l as AVATAR_PALETTE,
|
|
43
|
+
u as extractInitials,
|
|
21
44
|
c as pickAvatarColor
|
|
22
45
|
};
|