@gnome-ui/react 1.12.0 → 1.14.0

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/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  React component library following the [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/), built on the [Adwaita](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/) design language.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@gnome-ui/react)](https://www.npmjs.com/package/@gnome-ui/react)
6
+ [![CI](https://github.com/eljijuna/gnome-ui/actions/workflows/ci.yml/badge.svg)](https://github.com/eljijuna/gnome-ui/actions/workflows/ci.yml)
7
+ [![Storybook](https://img.shields.io/badge/Storybook-live-ff4785?logo=storybook&logoColor=white)](https://eljijuna.github.io/gnome-ui/)
6
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)
7
9
 
8
10
  Live documentation: **[Storybook →](https://eljijuna.github.io/gnome-ui/)**
@@ -45,6 +47,7 @@ export default function App() {
45
47
  |-----------|-------------|
46
48
  | [`Button`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-button--docs) | Default, Suggested, Destructive, Flat, Raised variants; `osd` overlay modifier; sm/md/lg sizes; pill and circular shapes |
47
49
  | [`SplitButton`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-splitbutton--docs) | Primary action button with attached dropdown arrow; Default, Suggested, Destructive variants |
50
+ | [`ButtonContent`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-buttoncontent--docs) | Icon + label layout helper for buttons that contain both an icon and text |
48
51
  | [`Switch`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-switch--docs) | On/off toggle for settings that apply immediately |
49
52
  | [`Checkbox`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-checkbox--docs) | Multi-selection with checked, unchecked, and indeterminate states |
50
53
  | [`RadioButton`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-radiobutton--docs) | Single-selection within a group; keyboard arrow-key navigation |
@@ -70,26 +73,38 @@ export default function App() {
70
73
  | [`StatusPage`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-statuspage--docs) | Empty-state page with icon, title, description, and optional actions; `compact` prop for sidebars/popovers |
71
74
  | [`Separator`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-separator--docs) | Horizontal/vertical dividing line between content groups |
72
75
  | [`Chip`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-chip--docs) | Compact pill-shaped label for tags, filters, and multi-select; static, removable, and selectable modes |
76
+ | [`ShortcutLabel`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-shortcutlabel--docs) | Renders keyboard shortcut tokens (e.g. `Ctrl+S`) as individual key cap pills |
77
+ | [`WindowTitle`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-windowtitle--docs) | Two-line title + subtitle widget for use inside a `HeaderBar` |
73
78
 
74
79
  ### Layout & containers
75
80
 
76
81
  | Component | Description |
77
82
  |-----------|-------------|
83
+ | [`Box`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-box--docs) | Flex layout primitive equivalent to `GtkBox` — vertical or horizontal, with GNOME HIG spacing scale |
78
84
  | [`Card`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-card--docs) | Elevated surface for grouping content; static or interactive (activatable) |
79
85
  | [`Frame`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-frame--docs) | Bordered surface without background fill — mirrors `GtkFrame` |
86
+ | [`Bin`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-bin--docs) | Single-child transparent wrapper — mirrors `AdwBin` |
80
87
  | [`HeaderBar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-headerbar--docs) | Title bar with centered title and leading/trailing action slots |
81
88
  | [`Toolbar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-toolbar--docs) | Horizontal action bar with 6 px padding/gap for flat and raised buttons |
82
89
  | [`Spacer`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-spacer--docs) | Invisible `flex: 1` filler to push trailing items to the end of a `Toolbar` |
90
+ | [`ToolbarView`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-toolbarview--docs) | Layout with pinned top/bottom bars and scrollable center content — mirrors `AdwToolbarView` |
83
91
  | [`LinkedGroup`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-linkedgroup--docs) | Renders children as a single connected unit with merged borders; horizontal and vertical |
84
92
  | [`Sidebar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-sidebar--docs) / `SidebarSection` / `SidebarItem` | Lateral navigation panel with named sections, suffix widgets, and context menus |
93
+ | [`BoxedList`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-boxedlist--docs) | Rounded bordered list of rows — canonical GNOME settings pattern |
85
94
  | [`ActionRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-actionrow--docs) | Settings row with title, subtitle, leading icon, and trailing widget |
86
95
  | [`ButtonRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-buttonrow--docs) | Full-width activatable row styled as a button inside a `BoxedList`; Default, Suggested, Destructive |
87
96
  | [`ExpanderRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-expanderrow--docs) | Collapsible `ActionRow` that reveals nested rows; controlled and uncontrolled |
88
- | [`BoxedList`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-boxedlist--docs) | Rounded bordered list of rows canonical GNOME settings pattern |
89
- | [`WrapBox`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-wrapbox--docs) | Flexible wrapping layout for tag/chip lists that flows across multiple lines |
97
+ | [`SwitchRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-switchrow--docs) | `ActionRow` with a built-in `Switch` trailing widget |
98
+ | [`CheckRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-checkrow--docs) | `ActionRow` with a built-in `Checkbox` trailing widget |
99
+ | [`ComboRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-comborow--docs) | `ActionRow` with a built-in `Dropdown` for selecting a value |
100
+ | [`EntryRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-entryrow--docs) | Inline text entry row — title doubles as floating label |
101
+ | [`PasswordEntryRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-passwordentryrow--docs) | `EntryRow` variant with show/hide password toggle |
102
+ | [`SpinRow`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-spinrow--docs) | `ActionRow` with a built-in `SpinButton` for numeric values |
103
+ | [`WrapBox`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-wrapbox--docs) | Wrapping flex container for tag/chip lists that flows across multiple lines — mirrors `AdwWrapBox` |
90
104
  | [`TabBar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-tabs--docs) / `TabItem` / `TabPanel` | Tab-based navigation with keyboard support, optional close buttons, and `inline` variant |
91
105
  | [`ViewSwitcher`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-viewswitcher--docs) / `ViewSwitcherItem` | Segmented pill control for switching between 2–4 top-level views |
92
106
  | [`ViewSwitcherSidebar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-viewswitchersidebar--docs) / `ViewSwitcherSidebarItem` | Sidebar-based view switcher — replaces `GtkStackSidebar` |
107
+ | [`Carousel`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-carousel--docs) / `CarouselIndicatorDots` / `CarouselIndicatorLines` | Swipeable page carousel with dot or line indicators — mirrors `AdwCarousel` |
93
108
  | [`ShortcutsDialog`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-shortcutsdialog--docs) | Modal listing keyboard shortcuts with integrated search |
94
109
 
95
110
  ### Overlays
@@ -98,10 +113,19 @@ export default function App() {
98
113
  |-----------|-------------|
99
114
  | [`Toast`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-toast--docs) / `Toaster` | Non-blocking temporary notification with auto-dismiss, action, and queue support |
100
115
  | [`Dialog`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-dialog--docs) | Blocking modal with title, body, focus trap, and configurable buttons |
116
+ | [`BottomSheet`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-bottomsheet--docs) | Slide-up panel from the bottom of the viewport with drag handle and optional title |
101
117
  | [`Tooltip`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-tooltip--docs) | Floating informational label on hover/focus with auto-flip positioning |
102
118
  | [`Popover`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-popover--docs) | Floating interactive panel with arrow and auto-flip positioning |
103
119
  | [`Banner`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-banner--docs) | Persistent message strip with optional action and dismiss |
104
120
 
121
+ ### Preferences
122
+
123
+ | Component | Description |
124
+ |-----------|-------------|
125
+ | [`PreferencesGroup`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-preferencesgroup--docs) | Titled `BoxedList` section with optional description and header suffix widget |
126
+ | [`PreferencesPage`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-preferencespage--docs) | Named page that contains one or more `PreferencesGroup` sections |
127
+ | [`PreferencesDialog`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-preferencesdialog--docs) | Tabbed preferences window — mirrors `AdwPreferencesDialog` |
128
+
105
129
  ### Adaptive layout
106
130
 
107
131
  | Component | Description |
@@ -110,6 +134,7 @@ export default function App() {
110
134
  | [`Clamp`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-clamp--docs) | Constrains content to a max width, centering it — mirrors `AdwClamp` |
111
135
  | [`NavigationSplitView`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-navigationsplitview--docs) | Two-pane layout that collapses to a single pane at ≤ 400 px |
112
136
  | [`OverlaySplitView`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-overlaysplitview--docs) | Sidebar becomes slide-over overlay at ≤ 400 px |
137
+ | [`NavigationView`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-navigationview--docs) / `NavigationPage` | Mobile-style navigation stack with forward/back slide transitions — mirrors `AdwNavigationView` |
113
138
  | [`ViewSwitcherBar`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-viewswitcherbar--docs) | Bottom bar for `ViewSwitcher` items on narrow screens (≤ 550 px) |
114
139
  | [`BreakpointBin`](https://eljijuna.github.io/gnome-ui/?path=/docs/adaptive-breakpointbin--docs) | Applies layout changes when the **component** crosses a size threshold — CSS container queries equivalent |
115
140
 
@@ -0,0 +1,65 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ /** GNOME HIG standard spacing values (matches GtkBox spacing tokens). */
3
+ export type BoxSpacing = 3 | 6 | 12 | 18 | 24 | 32 | 48;
4
+ export type BoxOrientation = "horizontal" | "vertical";
5
+ export type BoxAlign = "start" | "center" | "end" | "stretch" | "baseline";
6
+ export type BoxJustify = "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
7
+ export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * Direction children are arranged.
10
+ * `"vertical"` → `flex-direction: column` (default).
11
+ * `"horizontal"` → `flex-direction: row`.
12
+ */
13
+ orientation?: BoxOrientation;
14
+ /**
15
+ * Gap between children in pixels.
16
+ * Accepts any of the GNOME HIG standard spacing values or any CSS string.
17
+ * Defaults to `6` (the HIG "standard" inner spacing).
18
+ */
19
+ spacing?: BoxSpacing | number | string;
20
+ /**
21
+ * Cross-axis alignment (`align-items`).
22
+ * Defaults to `"stretch"` for vertical, `"center"` for horizontal.
23
+ */
24
+ align?: BoxAlign;
25
+ /**
26
+ * Main-axis distribution (`justify-content`).
27
+ * Defaults to `"start"`.
28
+ */
29
+ justify?: BoxJustify;
30
+ children?: ReactNode;
31
+ }
32
+ /**
33
+ * Fundamental flex layout primitive — the web equivalent of `GtkBox`.
34
+ *
35
+ * Arranges children in a single row or column with consistent spacing
36
+ * following the GNOME Human Interface Guidelines spacing scale:
37
+ *
38
+ * | Token | px | Use |
39
+ * |-------|----|-----|
40
+ * | tight | 3 | Dense UI, icon + label pairs |
41
+ * | standard | 6 | Default inner spacing |
42
+ * | medium | 12 | Between related groups |
43
+ * | large | 18 | Between loosely related sections |
44
+ * | section | 24 | Page-level section gaps |
45
+ * | loose | 32 | Large content separation |
46
+ * | jumbo | 48 | Hero / splash spacing |
47
+ *
48
+ * **Usage:**
49
+ * ```tsx
50
+ * // Vertical section (heading + content)
51
+ * <Box spacing={8}>
52
+ * <Text variant="caption-heading" color="dim">Devices</Text>
53
+ * <BoxedList>…</BoxedList>
54
+ * </Box>
55
+ *
56
+ * // Horizontal icon + label
57
+ * <Box orientation="horizontal" spacing={6} align="center">
58
+ * <Icon name="folder" />
59
+ * <Text>Documents</Text>
60
+ * </Box>
61
+ * ```
62
+ *
63
+ * @see https://developer.gnome.org/hig/guidelines/spacing.html
64
+ */
65
+ export declare function Box({ orientation, spacing, align, justify, className, style, children, ...props }: BoxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { Box } from './Box';
2
+ export type { BoxProps, BoxOrientation, BoxAlign, BoxJustify, BoxSpacing } from './Box';
@@ -0,0 +1,70 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export type ColorSwatchSize = "sm" | "md" | "lg";
3
+ export interface ColorSwatchProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onClick" | "onSelect"> {
4
+ /** CSS color value displayed as the swatch background. */
5
+ color: string;
6
+ /** Whether this swatch is the currently selected color. */
7
+ selected?: boolean;
8
+ /** Swatch diameter. Defaults to `"md"`. */
9
+ size?: ColorSwatchSize;
10
+ /** Called when the user clicks or activates the swatch. */
11
+ onSelect?: (color: string) => void;
12
+ /** Accessible label. Defaults to the color value. */
13
+ "aria-label"?: string;
14
+ disabled?: boolean;
15
+ }
16
+ /**
17
+ * Single circular color swatch button.
18
+ *
19
+ * Can be used standalone or composed inside `ColorPicker`.
20
+ * Shows a white checkmark when `selected`.
21
+ */
22
+ export declare function ColorSwatch({ color, selected, size, onSelect, disabled, className, style, "aria-label": ariaLabel, ...props }: ColorSwatchProps): import("react/jsx-runtime").JSX.Element;
23
+ export interface ColorPickerColor {
24
+ /** CSS color value (hex recommended). */
25
+ value: string;
26
+ /** Human-readable name shown as aria-label and tooltip. */
27
+ label?: string;
28
+ }
29
+ /** Default Adwaita-named palette (matches Avatar color set). */
30
+ export declare const GNOME_PALETTE: ColorPickerColor[];
31
+ export interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
32
+ /** Currently selected color value. */
33
+ value?: string;
34
+ /** Called when the user selects a color. */
35
+ onChange?: (value: string) => void;
36
+ /**
37
+ * Palette of colors to display.
38
+ * Defaults to `GNOME_PALETTE` (the 9 Adwaita named colors).
39
+ */
40
+ colors?: ColorPickerColor[];
41
+ /**
42
+ * Show a "Custom…" button at the end that opens a native color picker.
43
+ * When a custom color is chosen it is passed to `onChange` and shown
44
+ * as a selected swatch until another palette color is picked.
45
+ * Defaults to `false`.
46
+ */
47
+ allowCustom?: boolean;
48
+ /** Swatch size. Defaults to `"md"`. */
49
+ size?: ColorSwatchSize;
50
+ }
51
+ /**
52
+ * Color palette picker following the Adwaita `GtkColorButton` + swatch pattern.
53
+ *
54
+ * Renders a row of circular `ColorSwatch` items. Keyboard navigation uses
55
+ * arrow keys (roving tabindex). Optionally adds a "Custom…" button backed
56
+ * by a hidden `<input type="color">`.
57
+ *
58
+ * ```tsx
59
+ * <ColorPicker value={color} onChange={setColor} />
60
+ * <ColorPicker value={color} onChange={setColor} allowCustom />
61
+ * <ColorPicker
62
+ * value={color}
63
+ * onChange={setColor}
64
+ * colors={[{ value: "#ff0000", label: "Red" }, …]}
65
+ * />
66
+ * ```
67
+ *
68
+ * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ColorButton.html
69
+ */
70
+ export declare function ColorPicker({ value, onChange, colors, allowCustom, size, className, style, "aria-label": ariaLabel, ...props }: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { ColorPicker, ColorSwatch, GNOME_PALETTE } from './ColorPicker';
2
+ export type { ColorPickerProps, ColorPickerColor, ColorSwatchProps, ColorSwatchSize } from './ColorPicker';