ionbase-ui 0.6.0 → 0.6.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.
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Icon
3
+ *
4
+ * `Icon.tsx` has always emitted an `.ion-icon` class and nothing ever styled it.
5
+ * That was not benign. An `<svg>` is an inline-level replaced element, so when
6
+ * it shares a line box with anything else it sits on the *text baseline* and the
7
+ * font's descender space opens up underneath it — the icon then reads a couple
8
+ * of pixels high, and the box around it grows taller than the icon.
9
+ *
10
+ * Every slot in this system happens to hide that today: `.ion-button__icon-start`,
11
+ * `.ion-menu__icon`, `.ion-input__icon-start` and friends are all flex or grid
12
+ * containers, and a flex/grid item is blockified — `display: inline` becomes
13
+ * `block` — which removes the baseline from the picture entirely. Measured: a
14
+ * direct icon, an icon inside an `inline-grid` swap wrapper, and an icon inside
15
+ * a plain `display: block` wrapper all centre to within 0.00px of the label.
16
+ *
17
+ * The alignment was therefore correct by side effect of the container, not
18
+ * because the icon defended itself. It failed the moment the icon stopped being
19
+ * the only thing on its line: with one text node beside it inside a wrapper, the
20
+ * icon measured 3px above the label's centre and the button grew from 40px to
21
+ * 46px. Consumers nest icons inside their own wrappers all the time — swap and
22
+ * crossfade animations do it by construction — so "the parent will always be a
23
+ * flex container" is not an invariant this package can rely on.
24
+ *
25
+ * WHY inline-block AND NOT block
26
+ *
27
+ * `display: block` also kills the baseline, and it is what several resets reach
28
+ * for, but it is wrong here: it forces an icon used mid-sentence onto its own
29
+ * line. Measured on a 600px paragraph with one inline icon — 2 lines became 3.
30
+ * `inline-block` keeps the icon in the text flow, and `vertical-align: middle`
31
+ * centres it on the x-height axis, which is where an inline icon should sit.
32
+ *
33
+ * Both declarations are inert wherever it already worked: a flex or grid item is
34
+ * blockified regardless of the `display` it was given, and `vertical-align` does
35
+ * not apply to one. So this changes nothing in Button, Menu, Input, Tabs or
36
+ * anywhere else the icon is already a direct flex child — it only supplies the
37
+ * floor that was missing underneath them.
38
+ *
39
+ * NOT DONE HERE: an optical nudge. Icons centre on the line box while text is
40
+ * read on its cap-height band, so the two centres are not identical. Measured
41
+ * from rendered pixels on a descender-free label at Medium, the gap is 0.31px —
42
+ * below a device pixel at 1x, and smaller than the variation between individual
43
+ * Lucide glyphs. A `translateY` correction here would be a magic number papering
44
+ * over less than it introduces.
45
+ */
46
+ .ion-icon {
47
+ display: inline-block;
48
+ vertical-align: middle;
49
+ }
@@ -20,6 +20,13 @@
20
20
  * it bypasses next/font and friends, and it hands visitor IPs to Google.
21
21
  */
22
22
  @import url('./tokens/index.css');
23
+
24
+ /*
25
+ * Before the components, deliberately. `.ion-icon` is a primitive that every
26
+ * slot below sizes with its own `... svg` rule, and those rules have to be free
27
+ * to win on ordering as well as specificity.
28
+ */
29
+ @import url('./icon.css');
23
30
  @import url('./button.css');
24
31
  @import url('./tabs.css');
25
32
  @import url('./badge.css');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ionbase-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "IonBase Design System — accessible React components, styles and design tokens in one package",
5
5
  "license": "MIT",
6
6
  "type": "module",