@kennycorrea/ui 1.8.0 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.1 — 2026-10-30
4
+
5
+ TabBar label contrast.
6
+
7
+ - **`TabBar` is opaque by default.** Over coloured content the translucent bar left its 10px labels below WCAG AA (gray-11 at 3.3:1 in light). The see-through material is now opt-in with `translucent`, which switches labels to step 12 (≥ 6:1 over any backdrop). The active label uses `accent-12` in both modes, because `accent-11` on the canvas fails for eleven accents in light; the icon keeps the brand colour. The active item is also bolder and has an indicator pill, so colour is not the only difference. Checked against saturated backdrops in `test/TabBar-contrast.test.tsx`; demo in `examples/TabBars.tsx`.
8
+
3
9
  ## 1.8.0 — 2026-10-27
4
10
 
5
11
  An `Accordion` organism.
@@ -26,16 +26,22 @@ export interface TabBarProps {
26
26
  onValueChange?: (value: string) => void;
27
27
  /** Breakpoint (Radix Themes' scale) from which the bar is hidden. Default `md`. */
28
28
  hideFrom?: TabBarBreakpoint;
29
+ /**
30
+ * Blurred see-through material instead of the default opaque bar. Labels switch to step 12 so
31
+ * they stay AA over whatever scrolls beneath.
32
+ */
33
+ translucent?: boolean;
29
34
  'aria-label'?: string;
30
35
  className?: string;
31
36
  }
32
37
  /**
33
38
  * A fixed bottom navigation bar for small screens. 3–5 items; the active one is in the brand
34
- * colour and carries `aria-current="page"`. Height is `--tabbar-height` (49px + `--safe-bottom`);
39
+ * colour, bolder and on an indicator pill, and carries `aria-current="page"`. Opaque unless
40
+ * `translucent`. Height is `--tabbar-height` (49px + `--safe-bottom`);
35
41
  * render a {@link TabBarSpacer} (or pad by that variable) so content is not covered.
36
42
  * Press feedback is `:active`; nothing depends on hover.
37
43
  */
38
- export declare function TabBar({ items, value, onValueChange, hideFrom, className, 'aria-label': ariaLabel, }: TabBarProps): import("react").JSX.Element;
44
+ export declare function TabBar({ items, value, onValueChange, hideFrom, translucent, className, 'aria-label': ariaLabel, }: TabBarProps): import("react").JSX.Element;
39
45
  /** Reserves the bar's height in the flow, hidden at the same breakpoint as the bar. */
40
46
  export declare function TabBarSpacer({ hideFrom }: {
41
47
  hideFrom?: TabBarBreakpoint;
@@ -8,12 +8,13 @@ function badgeText(badge) {
8
8
  }
9
9
  /**
10
10
  * A fixed bottom navigation bar for small screens. 3–5 items; the active one is in the brand
11
- * colour and carries `aria-current="page"`. Height is `--tabbar-height` (49px + `--safe-bottom`);
11
+ * colour, bolder and on an indicator pill, and carries `aria-current="page"`. Opaque unless
12
+ * `translucent`. Height is `--tabbar-height` (49px + `--safe-bottom`);
12
13
  * render a {@link TabBarSpacer} (or pad by that variable) so content is not covered.
13
14
  * Press feedback is `:active`; nothing depends on hover.
14
15
  */
15
- export function TabBar({ items, value, onValueChange, hideFrom = 'md', className, 'aria-label': ariaLabel, }) {
16
- return (_jsx("nav", { className: ['ui-tabbar', className].filter(Boolean).join(' '), "data-hide-from": hideFrom, "aria-label": ariaLabel, children: items.map((item) => {
16
+ export function TabBar({ items, value, onValueChange, hideFrom = 'md', translucent = false, className, 'aria-label': ariaLabel, }) {
17
+ return (_jsx("nav", { className: ['ui-tabbar', className].filter(Boolean).join(' '), "data-hide-from": hideFrom, "data-material": translucent ? 'translucent' : 'opaque', "aria-label": ariaLabel, children: items.map((item) => {
17
18
  const active = item.value === value;
18
19
  const text = badgeText(item.badge);
19
20
  const children = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "ui-tabbar__icon", "aria-hidden": "true", children: [active && item.activeIcon ? item.activeIcon : item.icon, text !== null && (_jsx("span", { className: "ui-tabbar__badge", "data-dot": text === '' ? 'true' : undefined, children: text }))] }), _jsx("span", { className: "ui-tabbar__label", children: item.label })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kennycorrea/ui",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "A React + TypeScript component library built on Radix Themes: atoms, a Tailwind token bridge and theming.",
5
5
  "private": false,
6
6
  "type": "module",
package/tokens.css CHANGED
@@ -796,18 +796,32 @@
796
796
  :root { --tabbar-height: calc(49px + var(--safe-bottom, 0px)); }
797
797
  .ui-tabbar { position: fixed; inset: auto 0 0 0; z-index: 30; display: flex; box-sizing: border-box;
798
798
  height: var(--tabbar-height); padding: 0 var(--safe-right, 0px) var(--safe-bottom, 0px) var(--safe-left, 0px);
799
- background-color: var(--material-bar); -webkit-backdrop-filter: var(--material-bar-filter); backdrop-filter: var(--material-bar-filter);
799
+ background-color: var(--canvas-grouped, var(--color-panel-solid, #fff));
800
800
  box-shadow: inset 0 0.5px 0 var(--color-hairline); }
801
+ /* Opaque by default: gray-11 on the canvas is AA whatever scrolls underneath. `translucent` brings
802
+ the material back; 80% canvas over saturated content leaves gray-11 at 3.3:1 and accent-11 at
803
+ 2.5:1 in light, so the labels step up to 12 there (≥ 6:1 over any backdrop). Numbers in
804
+ `test/TabBar-contrast.test.tsx`. */
805
+ .ui-tabbar[data-material="translucent"] { background-color: var(--material-bar);
806
+ -webkit-backdrop-filter: var(--material-bar-filter); backdrop-filter: var(--material-bar-filter); }
807
+ .ui-tabbar[data-material="translucent"] .ui-tabbar__item { color: var(--gray-12); }
808
+ .ui-tabbar[data-material="translucent"] .ui-tabbar__item[data-active="true"] { color: var(--accent-12); }
801
809
  .ui-tabbar-spacer { height: var(--tabbar-height); flex: none; }
802
810
  .ui-tabbar__cell { flex: 1 1 0; min-width: 0; display: flex; }
803
811
  .ui-tabbar__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
804
812
  min-width: 44px; padding: 0; border: 0; background: none; font: inherit; color: var(--gray-11); text-decoration: none;
805
813
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
806
814
  .ui-tabbar__item[data-active="true"] { color: var(--accent-11); }
815
+ /* Not by colour alone: the active item is bolder and its icon sits on an indicator pill. The icon
816
+ keeps the brand step; the 10px label takes 12, since accent-11 on gray-3 is under 4.5:1 for
817
+ eleven of the accents in light. */
818
+ .ui-tabbar__item[data-active="true"] .ui-tabbar__label { font-weight: 700; color: var(--accent-12); }
819
+ .ui-tabbar__item[data-active="true"] .ui-tabbar__icon::before { content: ''; position: absolute; inset: -2px -12px; z-index: -1;
820
+ border-radius: 999px; background: var(--accent-a4); }
807
821
  .ui-tabbar__item { border-radius: 8px; transition: transform var(--press-duration) ease-out, background-color var(--press-duration) ease-out; }
808
822
  .ui-tabbar__item:active { background: var(--gray-a3); transform: scale(var(--press-scale)); }
809
823
  .ui-tabbar__item:focus-visible { outline: 2px solid var(--focus-8); outline-offset: -2px; border-radius: 8px; }
810
- .ui-tabbar__icon { position: relative; display: inline-flex; font-size: 24px; line-height: 1; }
824
+ .ui-tabbar__icon { position: relative; isolation: isolate; display: inline-flex; font-size: 24px; line-height: 1; }
811
825
  .ui-tabbar__label { font-size: 10px; line-height: 12px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
812
826
  .ui-tabbar__badge { position: absolute; top: -4px; left: calc(100% - 8px); min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
813
827
  border-radius: 8px; background: var(--red-9); color: white; font-size: 11px; line-height: 16px; font-weight: 600; text-align: center; }