@gnome-ui/react-native 1.10.0 → 1.11.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 +258 -0
- package/dist/components/CopyButton/CopyButton.d.ts +44 -0
- package/dist/components/CopyButton/index.d.ts +2 -0
- package/dist/components/ScrollToTop/ScrollToTop.d.ts +105 -0
- package/dist/components/ScrollToTop/index.d.ts +2 -0
- package/dist/components/Spacer/Spacer.d.ts +25 -0
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/StepIndicator/StepIndicator.d.ts +56 -0
- package/dist/components/StepIndicator/index.d.ts +2 -0
- package/dist/components/SwitchRow/SwitchRow.d.ts +43 -0
- package/dist/components/SwitchRow/index.d.ts +2 -0
- package/dist/components/Timeline/Timeline.d.ts +87 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Toolbar/Toolbar.d.ts +25 -0
- package/dist/components/Toolbar/index.d.ts +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1203 -698
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type TimelineOrientation = 'vertical' | 'horizontal';
|
|
4
|
+
export type TimelineVariant = 'default' | 'dotted' | 'none';
|
|
5
|
+
export interface TimelineItem {
|
|
6
|
+
/** Icon rendered inside the timeline node. Sized/colored by the consumer — see the component doc. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Content at the leading edge of the node.
|
|
10
|
+
* - **Vertical:** rendered to the left of the connector track.
|
|
11
|
+
* - **Horizontal:** rendered above the node.
|
|
12
|
+
*
|
|
13
|
+
* Typical use: timestamp, badge, short label.
|
|
14
|
+
*/
|
|
15
|
+
leading?: ReactNode;
|
|
16
|
+
/** Main event content rendered adjacent to the node (title, description…). */
|
|
17
|
+
content: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface TimelineProps {
|
|
20
|
+
/** Ordered list of timeline events. */
|
|
21
|
+
items: TimelineItem[];
|
|
22
|
+
/**
|
|
23
|
+
* Axis direction of the connector line.
|
|
24
|
+
* - `"vertical"` — events stack top-to-bottom (default).
|
|
25
|
+
* - `"horizontal"` — events flow left-to-right, in a horizontal `ScrollView`.
|
|
26
|
+
*/
|
|
27
|
+
orientation?: TimelineOrientation;
|
|
28
|
+
/**
|
|
29
|
+
* Visual style of the connector between nodes.
|
|
30
|
+
* - `"default"` — solid thin line.
|
|
31
|
+
* - `"dotted"` — dotted line; useful for future or pending events.
|
|
32
|
+
* - `"none"` — no connector; each node stands alone.
|
|
33
|
+
*/
|
|
34
|
+
variant?: TimelineVariant;
|
|
35
|
+
style?: StyleProp<ViewStyle>;
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Ordered sequence of events connected by a visual timeline — mirrors
|
|
40
|
+
* `@gnome-ui/react`'s `Timeline`. An original composition (no direct
|
|
41
|
+
* libadwaita widget), following GNOME HIG activity-feed/stepper patterns.
|
|
42
|
+
*
|
|
43
|
+
* The web version aligns every item's `leading` column (vertical) or row
|
|
44
|
+
* (horizontal) via CSS subgrid, so timestamps/labels line up across items
|
|
45
|
+
* regardless of how wide/tall any single one of them is. RN/Yoga has no
|
|
46
|
+
* grid or subgrid at all, so that alignment is reproduced by measurement
|
|
47
|
+
* instead — the same `onLayout` + `Record<index, size>` +
|
|
48
|
+
* "largest-so-far wins" technique `Slider`'s mark labels already
|
|
49
|
+
* established: every item's `leading` cell (always rendered, even when
|
|
50
|
+
* empty, matching the web version's own "same 3 children" comment)
|
|
51
|
+
* reports its own rendered width (vertical) or height (horizontal), and
|
|
52
|
+
* every cell gets a `minWidth`/`minHeight` equal to the largest one
|
|
53
|
+
* measured so far, so the node column/row starts at the same position in
|
|
54
|
+
* every item. The node track itself additionally gets a *fixed*
|
|
55
|
+
* width (vertical, matching the source CSS's literal `24px` column) or
|
|
56
|
+
* height (horizontal, the larger of the dot/icon node sizes, since the
|
|
57
|
+
* source's row there is CSS `auto` with no fixed value to port) — without
|
|
58
|
+
* it, an item with an icon node (28 dp) and one with a plain dot (12 dp)
|
|
59
|
+
* would each size their own track differently, misaligning `content`'s
|
|
60
|
+
* start position between them.
|
|
61
|
+
*
|
|
62
|
+
* `orientation="horizontal"` wraps itself in a horizontal `ScrollView`,
|
|
63
|
+
* reimagining the web CSS's `overflow-x: auto` — the direct native
|
|
64
|
+
* equivalent for "scroll instead of overflow when items don't fit". The
|
|
65
|
+
* web version's `grid-auto-columns: minmax(72px, 1fr)` also grows items
|
|
66
|
+
* to fill leftover space when the row *doesn't* overflow; that half
|
|
67
|
+
* doesn't port (a `ScrollView`'s content isn't bounded the way a CSS grid
|
|
68
|
+
* track is, so there's no "leftover space" to distribute) — each item
|
|
69
|
+
* just gets a flat 72 dp `minWidth` instead, unconditionally scrollable
|
|
70
|
+
* like `overflow-x: auto`'s own fallback path.
|
|
71
|
+
*
|
|
72
|
+
* `icon`/`leading`/`content` are plain `ReactNode`, the same as
|
|
73
|
+
* `PathBar`'s segment `icon` — the consumer sizes and colors their own
|
|
74
|
+
* icon (e.g. `tintColor={theme.accentFgColor}` on their own `<Icon>`),
|
|
75
|
+
* since RN has no `currentColor` for this component to tint an arbitrary
|
|
76
|
+
* child with the way the web version's CSS `color: accent-fg-color`
|
|
77
|
+
* does via inheritance onto the icon's SVG.
|
|
78
|
+
*
|
|
79
|
+
* `role="list"`/`role="listitem"` are set **without** `accessible` — the
|
|
80
|
+
* `ToggleGroup`/`StepIndicator`-established pattern for a grouping role
|
|
81
|
+
* over children that may themselves contain focusable content (an
|
|
82
|
+
* item's `content` is arbitrary `ReactNode` and could include one), so
|
|
83
|
+
* nothing nested inside gets swallowed into a single VoiceOver stop.
|
|
84
|
+
* Assert `element.props.role` on a `testID` in tests instead of
|
|
85
|
+
* `getByRole('list'/'listitem')`.
|
|
86
|
+
*/
|
|
87
|
+
export declare const Timeline: ({ items, orientation, variant, style, testID, }: TimelineProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleProp, View, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
export interface ToolbarProps extends Omit<ViewProps, 'style'> {
|
|
3
|
+
style?: StyleProp<ViewStyle>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Horizontal action bar following the libadwaita `.toolbar` pattern —
|
|
7
|
+
* mirrors `@gnome-ui/react`'s `Toolbar`. Directly portable: no web-only
|
|
8
|
+
* APIs, just a flex row with fixed padding/gap.
|
|
9
|
+
*
|
|
10
|
+
* Provides `theme.space1` (6 dp) padding and gap — the standard spacing
|
|
11
|
+
* for rows of flat buttons in header bars, action bars, and tool rows.
|
|
12
|
+
* Place a `Spacer` between leading and trailing groups to push trailing
|
|
13
|
+
* items to the end. Use `Button variant="flat"` for buttons that blend
|
|
14
|
+
* into the bar, or `variant="raised"` for one that needs explicit
|
|
15
|
+
* elevation within a flat context.
|
|
16
|
+
*
|
|
17
|
+
* The web CSS's `color`/`font-family` on `.toolbar` are dropped — RN has
|
|
18
|
+
* no style inheritance from a parent `View` down to child `Text`
|
|
19
|
+
* elements the way CSS `color` cascades, so a value here would reach
|
|
20
|
+
* nothing (every child, e.g. `Button`, already sets its own explicit
|
|
21
|
+
* text/icon colors).
|
|
22
|
+
*
|
|
23
|
+
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/style-classes.html#toolbar-style-class
|
|
24
|
+
*/
|
|
25
|
+
export declare const Toolbar: import('react').ForwardRefExoticComponent<ToolbarProps & import('react').RefAttributes<View>>;
|