@estiva-app/ui 0.90.1 → 0.90.2
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/InlineChip.d.ts +22 -13
- package/dist/InlineChip.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/registry.json +3 -3
- package/src/InlineChip.mdx +4 -2
- package/src/InlineChip.test.tsx +3 -2
- package/src/InlineChip.tsx +24 -14
- package/src/Tooltip.test.tsx +5 -4
- package/src/Tooltip.tsx +1 -1
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.90.
|
|
7
|
+
"packageVersion": "0.90.2",
|
|
8
8
|
"exports": 210,
|
|
9
9
|
"typeExports": 211,
|
|
10
10
|
"files": null
|
|
@@ -3883,8 +3883,8 @@
|
|
|
3883
3883
|
"docPage": "src/InlineChip.mdx",
|
|
3884
3884
|
"app": null,
|
|
3885
3885
|
"looks": [
|
|
3886
|
-
"rounded-sm align-
|
|
3887
|
-
"bg-bg-active text-text-muted font-mono text-caption"
|
|
3886
|
+
"rounded-sm align-baseline text-body-2 font-normal select-none [&>:is(svg,img,:empty)]:self-center [&>:has(svg,img)]:self-center",
|
|
3887
|
+
"bg-bg-active text-text-muted font-mono text-caption before:invisible before:-mr-1 before:font-sans before:text-body-2 before:content-['x']"
|
|
3888
3888
|
]
|
|
3889
3889
|
},
|
|
3890
3890
|
{
|
package/src/InlineChip.mdx
CHANGED
|
@@ -40,8 +40,10 @@ import { InlineChip } from '@estiva-app/ui'
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
- It belongs inside running text at the body size. `h-[1.4em]` is one line of
|
|
43
|
-
that text, and
|
|
44
|
-
is the same height as a line without one
|
|
43
|
+
that text, and the chip's words sit on the sentence's baseline, so a line with
|
|
44
|
+
a chip is the same height as a line without one and its words are level with
|
|
45
|
+
the sentence's — in a 19.6px line or RichText's 21px one, and inside a
|
|
46
|
+
wrapper such as a hover card's trigger. An icon, a picture or an empty swatch in it is centred.
|
|
45
47
|
- It renders a plain anchor when it has an `href`, and changes page as
|
|
46
48
|
**Link** does: through **AppProvider**'s `navigate`, or a router app's `onClick`.
|
|
47
49
|
The `href` stays a real address for a modified click or a new tab. Inside something that opens on
|
package/src/InlineChip.test.tsx
CHANGED
|
@@ -35,10 +35,11 @@ describe('InlineChip', () => {
|
|
|
35
35
|
expect(link.getAttribute('href')).toBe('/somewhere')
|
|
36
36
|
})
|
|
37
37
|
|
|
38
|
-
it('is one line high and
|
|
38
|
+
it('is one line high and sits on the sentence’s baseline, in every tone', () => {
|
|
39
39
|
for (const tone of Object.keys(INLINE_CHIP_TONE_CLASSES) as (keyof typeof INLINE_CHIP_TONE_CLASSES)[]) {
|
|
40
40
|
const classes = inlineChipClassName(tone).split(' ')
|
|
41
|
-
expect(classes).toContain('align-
|
|
41
|
+
expect(classes).toContain('align-baseline')
|
|
42
|
+
expect(classes).toContain('items-baseline')
|
|
42
43
|
expect(classes).toContain('mx-0.5')
|
|
43
44
|
// One height only: 1.4em of the body size, or the same 19.6px written out where the text is smaller.
|
|
44
45
|
const heights = classes.filter((c) => c.startsWith('h-'))
|
package/src/InlineChip.tsx
CHANGED
|
@@ -12,22 +12,30 @@ import { cn } from './cn'
|
|
|
12
12
|
*
|
|
13
13
|
* - the person tone is `person`, not `mention` — every chip here is a
|
|
14
14
|
* mention of something;
|
|
15
|
-
* - the alignment is a class
|
|
16
|
-
*
|
|
15
|
+
* - the alignment is a class, not a `style` object, so it is part of the
|
|
16
|
+
* class list like every other size in the package;
|
|
17
17
|
* - a chip that leads somewhere takes `href` and `onClick`, the way `NavItem`
|
|
18
18
|
* does: the package draws an anchor, the app's router takes the click.
|
|
19
19
|
*
|
|
20
|
-
* **Why
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* **Why the baseline.** The chip's words sit on the sentence's baseline,
|
|
21
|
+
* whatever the line's height and whatever wraps the chip. `items-baseline`
|
|
22
|
+
* makes its words the chip's baseline, and `align-baseline` puts that on the
|
|
23
|
+
* sentence's; the `icon` slot, and any child holding an icon or a picture or
|
|
24
|
+
* holding nothing at all (an app's own chip in an editor, a colour swatch), is
|
|
25
|
+
* centred instead, because such a child has no baseline of its own and would
|
|
26
|
+
* sit with its bottom edge on the words' (3.8px high, measured 2026-09-13). `1.4em` keeps the chip one 14px
|
|
27
|
+
* line tall.
|
|
28
|
+
*
|
|
29
|
+
* It was `align-top` until PEE-72 (2026-10-29), which held only while the
|
|
30
|
+
* line was 19.6px and the chip was the line's own child. RichText's 21px
|
|
31
|
+
* lines (0.64) put every chip's words 1px high, measured on peek.estiva.app;
|
|
32
|
+
* a link's chip inside its hover card's trigger (0.75) was level only by
|
|
33
|
+
* chance, its baseline taken from its icon.
|
|
26
34
|
*/
|
|
27
35
|
|
|
28
36
|
/** The shape every tone shares. Exported for a rich-text editor that renders chips from strings. */
|
|
29
37
|
export const INLINE_CHIP_CLASSES =
|
|
30
|
-
'inline-flex h-[1.4em] items-
|
|
38
|
+
'inline-flex h-[1.4em] items-baseline gap-1 rounded-sm px-1 mx-0.5 align-baseline text-body-2 font-normal select-none [&>:is(svg,img,:empty)]:self-center [&>:has(svg,img)]:self-center'
|
|
31
39
|
|
|
32
40
|
/** What a chip is made of, by what it stands for. */
|
|
33
41
|
export const INLINE_CHIP_TONE_CLASSES = {
|
|
@@ -40,11 +48,13 @@ export const INLINE_CHIP_TONE_CLASSES = {
|
|
|
40
48
|
/**
|
|
41
49
|
* A reference nobody could resolve — still a mention, just an anonymous one.
|
|
42
50
|
* Its height is the body line's 19.6px written out, because `1.4em` here is
|
|
43
|
-
* the caption's em
|
|
44
|
-
*
|
|
45
|
-
*
|
|
51
|
+
* the caption's em, 16.8px. Its smaller letters would set a baseline of
|
|
52
|
+
* their own and make the line 3px taller, so a strut — an invisible letter
|
|
53
|
+
* in the body's type, no wider than nothing, its gap taken back — sets the
|
|
54
|
+
* chip's baseline and the letters sit on it.
|
|
46
55
|
*/
|
|
47
|
-
quiet:
|
|
56
|
+
quiet:
|
|
57
|
+
"h-[19.6px] bg-bg-active text-text-muted font-mono text-caption before:invisible before:-mr-1 before:w-0 before:font-sans before:text-body-2 before:content-['x']",
|
|
48
58
|
/** A file this reader cannot open — deleted, or not theirs to see: said in words, quieter than a link. */
|
|
49
59
|
muted: 'bg-bg-active text-text-muted',
|
|
50
60
|
} as const
|
|
@@ -73,7 +83,7 @@ export function InlineChip({ tone = 'neutral', icon, href, className, children,
|
|
|
73
83
|
const inApp = useInAppClick(href, props.onClick)
|
|
74
84
|
const body = (
|
|
75
85
|
<>
|
|
76
|
-
{icon && <span className="flex size-4 shrink-0 items-center justify-center text-text-secondary">{icon}</span>}
|
|
86
|
+
{icon && <span className="flex size-4 shrink-0 items-center justify-center self-center text-text-secondary">{icon}</span>}
|
|
77
87
|
{children}
|
|
78
88
|
</>
|
|
79
89
|
)
|
package/src/Tooltip.test.tsx
CHANGED
|
@@ -78,9 +78,10 @@ describe('WithTooltip', () => {
|
|
|
78
78
|
expect(errors).toEqual([])
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
// F1
|
|
82
|
-
//
|
|
83
|
-
|
|
81
|
+
// F1 pinned the wrapper to the line's top, as the chip was then. Since PEE-72 the
|
|
82
|
+
// chip sits on the sentence's baseline, and `align-top` put a chip in this wrapper
|
|
83
|
+
// 1px high in a 21px line; the apps may not add the class to the part, so it carries it.
|
|
84
|
+
it('inline: the wrapper sits on the line’s baseline by itself', () => {
|
|
84
85
|
render(
|
|
85
86
|
<p>
|
|
86
87
|
<WithTooltip inline label="Item one">
|
|
@@ -88,7 +89,7 @@ describe('WithTooltip', () => {
|
|
|
88
89
|
</WithTooltip>
|
|
89
90
|
</p>,
|
|
90
91
|
)
|
|
91
|
-
expect(screen.getByText('Item one').parentElement?.className.split(' ')).toContain('align-
|
|
92
|
+
expect(screen.getByText('Item one').parentElement?.className.split(' ')).toContain('align-baseline')
|
|
92
93
|
})
|
|
93
94
|
|
|
94
95
|
it('a block wrapper is not moved', () => {
|
package/src/Tooltip.tsx
CHANGED
|
@@ -172,7 +172,7 @@ export function WithTooltip({ label, shortcut, placement = 'top', wrapperClassNa
|
|
|
172
172
|
can carry the handlers for all of them. A control that IS the trigger
|
|
173
173
|
(Button, IconButton) composes the part onto itself instead, which is
|
|
174
174
|
what lets a `Dialog.Close` or a `Menu.Trigger` be one of those. */}
|
|
175
|
-
<BaseTooltip.Trigger delay={OPEN_DELAY} render={<Wrapper className={cn('inline-flex shrink-0', inline && 'align-
|
|
175
|
+
<BaseTooltip.Trigger delay={OPEN_DELAY} render={<Wrapper className={cn('inline-flex shrink-0', inline && 'align-baseline', wrapperClassName)} />}>
|
|
176
176
|
{children}
|
|
177
177
|
</BaseTooltip.Trigger>
|
|
178
178
|
<TooltipSurface label={label} shortcut={shortcut} placement={placement} />
|