@helloimjolopez-pathway/pathway-components 0.7.0 → 0.7.1
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/components/badge/badge.jsx +12 -10
- package/dist/pathway-components.js +16 -16
- package/package.json +1 -1
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
* STATIC, v1 to v2. Three v1 values did not match Figma and now do:
|
|
16
16
|
* Outline & Fill stroke v1 Subtle, Figma Strong (Neutral Bold, accents plain).
|
|
17
17
|
* Neutral Naked text v1 Neutral/Bold, Figma Neutral/Base.
|
|
18
|
-
* Stroke placement
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Stroke placement Figma draws the stroke inside a frame that grows by the
|
|
19
|
+
* stroke width, so content keeps its padding to the
|
|
20
|
+
* border; the 1px box-shadow here renders the same edge.
|
|
21
21
|
* Figma's default leading icon is the placeholder `error`; in code the icon is
|
|
22
22
|
* passed explicitly, so existing call sites render exactly as before.
|
|
23
23
|
*
|
|
24
24
|
* DISMISSIBLE and INTERACTIVE, every size, with or without icons:
|
|
25
25
|
* outer frame invisible, min width and height Accessibility/Touch Target/AA
|
|
26
26
|
* (44). The pill keeps its size (20 / 22 / 22) inside it.
|
|
27
|
-
* Badge.Pill
|
|
27
|
+
* Focus Ring wraps Badge.Pill; FocusRing/Offset from the border, ring outside.
|
|
28
|
+
* Badge.Pill fill, stroke (inside its frame), CornerRadius/Large.
|
|
28
29
|
* Container.Main Padding/XXXTight left and right, Padding/XXXXTight top and
|
|
29
30
|
* bottom, NO gap.
|
|
30
31
|
* Container.Label Padding/XXXTight left and right; Field Label to value
|
|
@@ -139,10 +140,11 @@ const outer = { display: "inline-flex", alignItems: "center", justifyContent: "c
|
|
|
139
140
|
minWidth: T.touchW, minHeight: T.touchH, boxSizing: "border-box", padding: 0, margin: 0, border: 0,
|
|
140
141
|
background: "transparent", font: "inherit", color: "inherit", textDecoration: "none", outline: "none" };
|
|
141
142
|
const strokeShadow = (stroke) => (stroke ? `0 0 0 ${L.border} ${stroke}` : "none");
|
|
142
|
-
/* Focus ring: FocusRing/Width of Stroke/FocusRing/Base, FocusRing/Offset
|
|
143
|
-
* as an outline so the gap shows whatever surface the badge sits on. No white halo.
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/* Focus ring: FocusRing/Width of Stroke/FocusRing/Base, FocusRing/Offset from the pill's
|
|
144
|
+
* border, as an outline so the gap shows whatever surface the badge sits on. No white halo.
|
|
145
|
+
* The border is a 1px box-shadow outside the box, so the offset adds it when there is one. */
|
|
146
|
+
const focusRing = (focused, stroke) => (focused
|
|
147
|
+
? { outline: `${T.ringWidth} solid ${T.ring}`, outlineOffset: stroke ? `calc(${T.ringOffset} + ${L.border})` : T.ringOffset }
|
|
146
148
|
: { outline: "none" });
|
|
147
149
|
const transition = `background ${T.duration} ${T.easing}, color ${T.duration} ${T.easing}, box-shadow ${T.duration} ${T.easing}`;
|
|
148
150
|
|
|
@@ -250,7 +252,7 @@ export function Badge({
|
|
|
250
252
|
...pillBase,
|
|
251
253
|
background: painted.fill ? C(fam.fill) : "transparent",
|
|
252
254
|
color: C(badgeStyle === "Naked" && fam.textNaked ? fam.textNaked : fam.text),
|
|
253
|
-
boxShadow: strokeShadow(stroke), ...focusRing(focused),
|
|
255
|
+
boxShadow: strokeShadow(stroke), ...focusRing(focused, stroke),
|
|
254
256
|
}}>
|
|
255
257
|
{leadingIcon && ico(leadingIcon, 1)}
|
|
256
258
|
<span className="pw-badge__label" style={{ ...textSlot, gap: T.fieldGap }}>
|
|
@@ -318,7 +320,7 @@ export function Badge({
|
|
|
318
320
|
style={{ ...outer, cursor: disabled ? "not-allowed" : "pointer", ...style }}>
|
|
319
321
|
<span className="pw-badge__pill" style={{
|
|
320
322
|
...pillBase, background: fill, color: fg,
|
|
321
|
-
boxShadow: strokeShadow(stroke), ...focusRing(focused),
|
|
323
|
+
boxShadow: strokeShadow(stroke), ...focusRing(focused, stroke),
|
|
322
324
|
}}>
|
|
323
325
|
{lead && ico(lead, on ? 0 : 1)}
|
|
324
326
|
<span className="pw-badge__label" style={textSlot}><span style={{ ...cut, display: "block", maxWidth: spec.contentMax }}>{label}</span></span>
|