prometeo-design-system 7.1.3 → 7.1.4
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/Chip.es.js +82 -81
- package/dist/components/Chips/chipTypes.d.ts +12 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/Chip.es.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
-
import { memo as
|
|
3
|
-
import { c as
|
|
4
|
-
import { c as
|
|
5
|
-
import { i as
|
|
6
|
-
import { Close as
|
|
7
|
-
import { A as
|
|
8
|
-
const
|
|
2
|
+
import { memo as C, forwardRef as B, useMemo as N, useCallback as p } from "react";
|
|
3
|
+
import { c as h } from "./index-BOQuZ0gG.js";
|
|
4
|
+
import { c as v } from "./cn-B6yFEsav.js";
|
|
5
|
+
import { i as V } from "./iconUtils-rTOfKDxE.js";
|
|
6
|
+
import { Close as F } from "./Icons/Close.es.js";
|
|
7
|
+
import { A as K } from "./AvatarBase-sKVPLn_O.js";
|
|
8
|
+
const q = {
|
|
9
9
|
small: "h-5 px-2 text-xs prometeo-fonts-body-small",
|
|
10
10
|
medium: "h-8 px-3 text-sm prometeo-fonts-body-medium",
|
|
11
11
|
large: "h-9 px-3 text-sm prometeo-fonts-body-medium"
|
|
12
|
-
},
|
|
12
|
+
}, Q = {
|
|
13
13
|
default: "text-neutral-default-default border-neutral-default-default bg-inherit rounded-lg font-semibold",
|
|
14
14
|
error: "",
|
|
15
15
|
success: ""
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
-
return $.includes(e);
|
|
19
|
-
}
|
|
20
|
-
function V(e) {
|
|
16
|
+
}, Z = "border-neutral-strong-default text-neutral-default-disabled", $ = "text-neutral-default-disabled", J = ["leading", "avatar"], W = ["default", "error", "success"];
|
|
17
|
+
function X(e) {
|
|
21
18
|
return J.includes(e);
|
|
22
19
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
20
|
+
function H(e) {
|
|
21
|
+
return W.includes(e);
|
|
22
|
+
}
|
|
23
|
+
function ee(e) {
|
|
24
|
+
const a = e.layout ?? (X(e.variant) ? e.variant : void 0), s = e.semanticVariant ?? (H(e.variant) ? e.variant : void 0), i = a ?? (e.avatar ? "avatar" : "leading"), m = !!e.onRemove || !!e.size || !!s || !!e.semanticVariant || H(e.variant);
|
|
25
25
|
return {
|
|
26
26
|
layout: i,
|
|
27
27
|
legacySemanticVariant: s,
|
|
28
|
-
legacySizeClass: e.size ?
|
|
29
|
-
legacySemanticContainerClass: s ?
|
|
28
|
+
legacySizeClass: e.size ? q[e.size] : void 0,
|
|
29
|
+
legacySemanticContainerClass: s ? Q[s] : void 0,
|
|
30
30
|
useLegacyRemoveHandler: !!e.onRemove,
|
|
31
|
-
isLegacyMode:
|
|
31
|
+
isLegacyMode: m
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const ae = h(
|
|
35
35
|
"group/chip flex items-center gap-1 p-2 w-max h-8 radius-medium border transition-all duration-300 ease-in-out",
|
|
36
36
|
{
|
|
37
37
|
variants: {
|
|
@@ -118,7 +118,7 @@ const ee = m(
|
|
|
118
118
|
}
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
|
-
),
|
|
121
|
+
), re = h(
|
|
122
122
|
"pyrion-fonts-label-medium transition-all duration-300 ease-in-out select-none",
|
|
123
123
|
{
|
|
124
124
|
variants: {
|
|
@@ -211,7 +211,7 @@ const ee = m(
|
|
|
211
211
|
}
|
|
212
212
|
]
|
|
213
213
|
}
|
|
214
|
-
),
|
|
214
|
+
), te = h("transition-all duration-300 ease-in-out", {
|
|
215
215
|
variants: {
|
|
216
216
|
isSelected: {
|
|
217
217
|
true: "",
|
|
@@ -295,7 +295,7 @@ const ee = m(
|
|
|
295
295
|
className: "icon-disabled-ondisabled group-hover/chip:icon-disabled-ondisabled group-active/chip:icon-disabled-ondisabled"
|
|
296
296
|
}
|
|
297
297
|
]
|
|
298
|
-
}),
|
|
298
|
+
}), se = h(
|
|
299
299
|
"transition-all duration-300 ease-in-out border-neutral-default-default border",
|
|
300
300
|
{
|
|
301
301
|
variants: {
|
|
@@ -349,145 +349,146 @@ const ee = m(
|
|
|
349
349
|
}
|
|
350
350
|
]
|
|
351
351
|
}
|
|
352
|
-
),
|
|
352
|
+
), de = {
|
|
353
353
|
size: "xsmall",
|
|
354
354
|
name: "A B"
|
|
355
355
|
};
|
|
356
|
-
function
|
|
356
|
+
function oe(e, a, s) {
|
|
357
357
|
return {
|
|
358
358
|
isSelected: !!e,
|
|
359
359
|
disabled: !!a,
|
|
360
360
|
forcedStatus: s
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function ne(e) {
|
|
364
364
|
return N(
|
|
365
365
|
() => ({
|
|
366
|
-
container:
|
|
367
|
-
label:
|
|
368
|
-
icon:
|
|
369
|
-
avatar:
|
|
366
|
+
container: ae(e),
|
|
367
|
+
label: re(e),
|
|
368
|
+
icon: te(e),
|
|
369
|
+
avatar: se(e)
|
|
370
370
|
}),
|
|
371
371
|
[e.isSelected, e.disabled, e.forcedStatus]
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const D = C(function({
|
|
375
375
|
icon: a,
|
|
376
376
|
className: s,
|
|
377
377
|
size: i = 16
|
|
378
378
|
}) {
|
|
379
379
|
return /* @__PURE__ */ o.jsx(a, { size: i, className: s });
|
|
380
|
-
}),
|
|
380
|
+
}), ie = C(function({
|
|
381
381
|
avatar: a,
|
|
382
382
|
className: s
|
|
383
383
|
}) {
|
|
384
|
-
return /* @__PURE__ */ o.jsx(
|
|
384
|
+
return /* @__PURE__ */ o.jsx(K, { ...a, className: s });
|
|
385
385
|
});
|
|
386
|
-
function
|
|
387
|
-
return e.label === a.label && e.isSelected === a.isSelected && e.disabled === a.disabled && e.forcedStatus === a.forcedStatus && e.layout === a.layout && e.variant === a.variant && e.semanticVariant === a.semanticVariant && e.className === a.className && e.onRemove === a.onRemove && e.id === a.id && e.size === a.size && e.tabIndex === a.tabIndex && e.leadingIcon === a.leadingIcon && e.trailingIcon === a.trailingIcon && e.onClick === a.onClick && e.onTrailingIconClick === a.onTrailingIconClick && e.avatar?.imageUrl === a.avatar?.imageUrl && e.avatar?.name === a.avatar?.name;
|
|
386
|
+
function le(e, a) {
|
|
387
|
+
return e.label === a.label && e.isSelected === a.isSelected && e.disabled === a.disabled && e.forcedStatus === a.forcedStatus && e.layout === a.layout && e.variant === a.variant && e.semanticVariant === a.semanticVariant && e.className === a.className && e.onRemove === a.onRemove && e.id === a.id && e.size === a.size && e.tabIndex === a.tabIndex && e.leadingIcon === a.leadingIcon && e.leadingSlot === a.leadingSlot && e.trailingIcon === a.trailingIcon && e.onClick === a.onClick && e.onTrailingIconClick === a.onTrailingIconClick && e.avatar?.imageUrl === a.avatar?.imageUrl && e.avatar?.name === a.avatar?.name;
|
|
388
388
|
}
|
|
389
|
-
const
|
|
390
|
-
|
|
389
|
+
const ce = C(
|
|
390
|
+
B(function({
|
|
391
391
|
isSelected: a = !1,
|
|
392
392
|
label: s,
|
|
393
393
|
leadingIcon: i,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
leadingSlot: m,
|
|
395
|
+
trailingIcon: x,
|
|
396
|
+
forcedStatus: P,
|
|
397
|
+
onTrailingIconClick: f,
|
|
397
398
|
onClick: l,
|
|
398
399
|
disabled: r = !1,
|
|
399
400
|
avatar: c,
|
|
400
|
-
variant:
|
|
401
|
-
layout:
|
|
402
|
-
semanticVariant:
|
|
401
|
+
variant: L,
|
|
402
|
+
layout: A,
|
|
403
|
+
semanticVariant: I,
|
|
403
404
|
onRemove: u,
|
|
404
405
|
id: g,
|
|
405
|
-
size:
|
|
406
|
+
size: _,
|
|
406
407
|
tabIndex: y,
|
|
407
|
-
className:
|
|
408
|
-
},
|
|
408
|
+
className: j
|
|
409
|
+
}, T) {
|
|
409
410
|
const t = N(
|
|
410
|
-
() =>
|
|
411
|
-
layout:
|
|
412
|
-
variant:
|
|
413
|
-
semanticVariant:
|
|
411
|
+
() => ee({
|
|
412
|
+
layout: A,
|
|
413
|
+
variant: L,
|
|
414
|
+
semanticVariant: I,
|
|
414
415
|
avatar: c,
|
|
415
416
|
onRemove: u,
|
|
416
|
-
size:
|
|
417
|
+
size: _
|
|
417
418
|
}),
|
|
418
|
-
[
|
|
419
|
-
),
|
|
420
|
-
() => ({ ...
|
|
419
|
+
[A, L, I, c, u, _]
|
|
420
|
+
), z = oe(a, r, P), b = ne(z), E = V(i) ? i : null, S = V(x) ? x : t.useLegacyRemoveHandler ? F : null, M = N(
|
|
421
|
+
() => ({ ...de, ...c }),
|
|
421
422
|
[c?.imageUrl, c?.name]
|
|
422
|
-
), n = !r && !!l,
|
|
423
|
+
), n = !r && !!l, R = t.layout === "avatar", w = y !== void 0 ? y : n ? 0 : void 0, Y = p(
|
|
423
424
|
(d) => {
|
|
424
|
-
r || (d.preventDefault(), d.stopPropagation(),
|
|
425
|
+
r || (d.preventDefault(), d.stopPropagation(), f?.(d));
|
|
425
426
|
},
|
|
426
|
-
[r,
|
|
427
|
-
),
|
|
427
|
+
[r, f]
|
|
428
|
+
), k = p(
|
|
428
429
|
(d) => {
|
|
429
430
|
r || (d.stopPropagation(), d.preventDefault(), g != null && u?.(g));
|
|
430
431
|
},
|
|
431
432
|
[r, g, u]
|
|
432
|
-
),
|
|
433
|
+
), G = p(
|
|
433
434
|
(d) => {
|
|
434
435
|
r || l?.(d);
|
|
435
436
|
},
|
|
436
437
|
[r, l]
|
|
437
|
-
),
|
|
438
|
+
), O = p(
|
|
438
439
|
(d) => {
|
|
439
440
|
!n || r || d.key !== "Enter" && d.key !== " " || (d.preventDefault(), l?.(d));
|
|
440
441
|
},
|
|
441
442
|
[r, n, l]
|
|
442
|
-
),
|
|
443
|
+
), U = !!S && (!!f || t.useLegacyRemoveHandler);
|
|
443
444
|
return /* @__PURE__ */ o.jsxs(
|
|
444
445
|
"div",
|
|
445
446
|
{
|
|
446
|
-
ref:
|
|
447
|
-
className:
|
|
447
|
+
ref: T,
|
|
448
|
+
className: v(
|
|
448
449
|
b.container,
|
|
449
450
|
!t.legacySizeClass && "h-8",
|
|
450
451
|
t.legacySizeClass,
|
|
451
452
|
t.legacySemanticContainerClass,
|
|
452
453
|
t.isLegacyMode && "inline-flex font-semibold",
|
|
453
454
|
n && "cursor-pointer",
|
|
454
|
-
r && t.isLegacyMode &&
|
|
455
|
+
r && t.isLegacyMode && Z,
|
|
455
456
|
r && "pointer-events-none",
|
|
456
|
-
|
|
457
|
+
j
|
|
457
458
|
),
|
|
458
|
-
onClick: n ?
|
|
459
|
-
onKeyDown: n ?
|
|
459
|
+
onClick: n ? G : void 0,
|
|
460
|
+
onKeyDown: n ? O : void 0,
|
|
460
461
|
"aria-disabled": r || void 0,
|
|
461
462
|
role: n ? "button" : void 0,
|
|
462
|
-
tabIndex:
|
|
463
|
+
tabIndex: w,
|
|
463
464
|
children: [
|
|
464
465
|
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
/* @__PURE__ */ o.jsx("span", { className:
|
|
466
|
+
!R && (m ?? (E && /* @__PURE__ */ o.jsx(D, { icon: E, className: b.icon }))),
|
|
467
|
+
R && /* @__PURE__ */ o.jsx(ie, { avatar: M, className: b.avatar }),
|
|
468
|
+
/* @__PURE__ */ o.jsx("span", { className: v(b.label, "truncate"), children: s })
|
|
468
469
|
] }),
|
|
469
|
-
|
|
470
|
+
U && S && /* @__PURE__ */ o.jsx(
|
|
470
471
|
"button",
|
|
471
472
|
{
|
|
472
473
|
type: "button",
|
|
473
474
|
disabled: r,
|
|
474
475
|
tabIndex: y,
|
|
475
|
-
onMouseDown: t.useLegacyRemoveHandler ?
|
|
476
|
-
onClick: t.useLegacyRemoveHandler ? void 0 :
|
|
477
|
-
className:
|
|
476
|
+
onMouseDown: t.useLegacyRemoveHandler ? k : void 0,
|
|
477
|
+
onClick: t.useLegacyRemoveHandler ? void 0 : Y,
|
|
478
|
+
className: v(
|
|
478
479
|
"shrink-0",
|
|
479
|
-
(
|
|
480
|
+
(f || u) && !r && "cursor-pointer",
|
|
480
481
|
t.useLegacyRemoveHandler && "p-0.5 z-10 transition-all duration-200 hover:scale-105",
|
|
481
482
|
t.useLegacyRemoveHandler && r && "cursor-default hover:scale-100"
|
|
482
483
|
),
|
|
483
484
|
"aria-label": `Quitar ${s}`,
|
|
484
485
|
children: /* @__PURE__ */ o.jsx(
|
|
485
|
-
|
|
486
|
+
D,
|
|
486
487
|
{
|
|
487
488
|
icon: S,
|
|
488
|
-
className:
|
|
489
|
+
className: v(
|
|
489
490
|
b.icon,
|
|
490
|
-
r && t.isLegacyMode &&
|
|
491
|
+
r && t.isLegacyMode && $
|
|
491
492
|
),
|
|
492
493
|
size: t.useLegacyRemoveHandler ? 18 : 16
|
|
493
494
|
}
|
|
@@ -498,9 +499,9 @@ const le = x(
|
|
|
498
499
|
}
|
|
499
500
|
);
|
|
500
501
|
}),
|
|
501
|
-
|
|
502
|
+
le
|
|
502
503
|
);
|
|
503
|
-
|
|
504
|
+
ce.displayName = "Chip";
|
|
504
505
|
export {
|
|
505
|
-
|
|
506
|
+
ce as default
|
|
506
507
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { IconComponent } from '../../Icons';
|
|
2
3
|
import { ComponentVariant, SizeVariant } from '../Shared/types';
|
|
3
4
|
import { AvatarBaseProps } from '../Avatar/AvatarBase';
|
|
@@ -6,7 +7,7 @@ export type ChipAvatarProps = Pick<AvatarBaseProps, "imageUrl" | "name">;
|
|
|
6
7
|
export type ChipForcedStatus = "default" | "hovered" | "pressed" | "disabled";
|
|
7
8
|
/** Layout del chip o variante semántica legacy. */
|
|
8
9
|
export type ChipVariantProp = ChipLayout | ComponentVariant;
|
|
9
|
-
|
|
10
|
+
interface ChipBaseProps {
|
|
10
11
|
label: string;
|
|
11
12
|
layout?: ChipLayout;
|
|
12
13
|
/**
|
|
@@ -19,7 +20,6 @@ export interface ChipProps {
|
|
|
19
20
|
*/
|
|
20
21
|
semanticVariant?: ComponentVariant;
|
|
21
22
|
isSelected?: boolean;
|
|
22
|
-
leadingIcon?: IconComponent;
|
|
23
23
|
trailingIcon?: IconComponent;
|
|
24
24
|
onTrailingIconClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
25
25
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -41,6 +41,15 @@ export interface ChipProps {
|
|
|
41
41
|
/** @deprecated Evitá overridear estilos del sistema. */
|
|
42
42
|
className?: string;
|
|
43
43
|
}
|
|
44
|
+
type ChipPropsWithLeadingIcon = ChipBaseProps & {
|
|
45
|
+
leadingIcon?: IconComponent;
|
|
46
|
+
leadingSlot?: never;
|
|
47
|
+
};
|
|
48
|
+
type ChipPropsWithLeadingSlot = ChipBaseProps & {
|
|
49
|
+
leadingSlot?: React.ReactNode;
|
|
50
|
+
leadingIcon?: never;
|
|
51
|
+
};
|
|
52
|
+
export type ChipProps = ChipPropsWithLeadingIcon | ChipPropsWithLeadingSlot;
|
|
44
53
|
export type ResolvedChipConfig = {
|
|
45
54
|
layout: ChipLayout;
|
|
46
55
|
legacySemanticVariant?: ComponentVariant;
|
|
@@ -53,3 +62,4 @@ export declare function isChipLayout(value?: string): value is ChipLayout;
|
|
|
53
62
|
export declare function isLegacySemanticVariant(value?: string): value is ComponentVariant;
|
|
54
63
|
export type ChipConfigInput = Pick<ChipProps, "layout" | "variant" | "semanticVariant" | "avatar" | "onRemove" | "size">;
|
|
55
64
|
export declare function resolveChipConfig(props: ChipConfigInput): ResolvedChipConfig;
|
|
65
|
+
export {};
|