@gnome-ui/react-native 1.7.0 → 1.9.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 +423 -3
- package/dist/components/Blockquote/Blockquote.d.ts +40 -0
- package/dist/components/Blockquote/index.d.ts +2 -0
- package/dist/components/BottomTabBar/BottomTabBar.d.ts +106 -0
- package/dist/components/BottomTabBar/index.d.ts +2 -0
- package/dist/components/BreakpointBin/BreakpointBin.d.ts +65 -0
- package/dist/components/BreakpointBin/index.d.ts +2 -0
- package/dist/components/ButtonContent/ButtonContent.d.ts +47 -0
- package/dist/components/ButtonContent/index.d.ts +2 -0
- package/dist/components/ButtonRow/ButtonRow.d.ts +41 -0
- package/dist/components/ButtonRow/index.d.ts +2 -0
- package/dist/components/Callout/Callout.d.ts +36 -0
- package/dist/components/Callout/index.d.ts +2 -0
- package/dist/components/CheckRow/CheckRow.d.ts +47 -0
- package/dist/components/CheckRow/index.d.ts +2 -0
- package/dist/components/ExpanderRow/ExpanderRow.d.ts +58 -0
- package/dist/components/ExpanderRow/index.d.ts +2 -0
- package/dist/components/FieldGroup/FieldGroup.d.ts +52 -0
- package/dist/components/FieldGroup/index.d.ts +2 -0
- package/dist/components/FilterableMultiSelectDropdown/FilterableMultiSelectDropdown.d.ts +46 -0
- package/dist/components/FilterableMultiSelectDropdown/index.d.ts +2 -0
- package/dist/components/Icon/Icon.d.ts +11 -1
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.d.ts +55 -0
- package/dist/components/MultiSelectDropdown/index.d.ts +2 -0
- package/dist/components/PasswordField/PasswordField.d.ts +48 -0
- package/dist/components/PasswordField/index.d.ts +2 -0
- package/dist/components/RangeSlider/RangeSlider.d.ts +73 -0
- package/dist/components/RangeSlider/index.d.ts +2 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +47 -0
- package/dist/components/StatusBadge/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBreakpoint.d.ts +79 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2248 -801
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GNOME / libadwaita canonical breakpoints (in dp, assuming 1 sp = 1 dp at 1× density).
|
|
3
|
+
*
|
|
4
|
+
* | Name | Max width | Pattern triggered |
|
|
5
|
+
* |----------|-----------|--------------------|
|
|
6
|
+
* | `narrow` | ≤ 400 dp | Collapse split views; sidebar becomes overlay |
|
|
7
|
+
* | `medium` | ≤ 550 dp | Move ViewSwitcher to a bottom bar |
|
|
8
|
+
* | `wide` | ≤ 860 dp | Collapse outer pane in nested split views |
|
|
9
|
+
*
|
|
10
|
+
* Identical thresholds to `@gnome-ui/react`'s `useBreakpoint` — only the
|
|
11
|
+
* measurement source differs (`useWindowDimensions` instead of
|
|
12
|
+
* `window.innerWidth`/a `resize` listener).
|
|
13
|
+
*
|
|
14
|
+
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Breakpoint.html
|
|
15
|
+
*/
|
|
16
|
+
export declare const GNOME_BREAKPOINTS: {
|
|
17
|
+
/** ≤ 400 dp — split views collapse to single pane */
|
|
18
|
+
readonly narrow: 400;
|
|
19
|
+
/** ≤ 550 dp — ViewSwitcher moves to bottom bar */
|
|
20
|
+
readonly medium: 550;
|
|
21
|
+
/** ≤ 860 dp — outer pane of nested split views collapses */
|
|
22
|
+
readonly wide: 860;
|
|
23
|
+
};
|
|
24
|
+
export type GnomeBreakpointName = keyof typeof GNOME_BREAKPOINTS;
|
|
25
|
+
export interface BreakpointState {
|
|
26
|
+
/** Width ≤ 400 dp — split views are collapsed. */
|
|
27
|
+
isNarrow: boolean;
|
|
28
|
+
/** Width ≤ 550 dp — medium or narrower. */
|
|
29
|
+
isMedium: boolean;
|
|
30
|
+
/** Width ≤ 860 dp — wide or narrower. */
|
|
31
|
+
isWide: boolean;
|
|
32
|
+
/** Current window width in dp. */
|
|
33
|
+
width: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tracks the window width against GNOME / libadwaita breakpoints.
|
|
37
|
+
*
|
|
38
|
+
* Built on `useWindowDimensions` (not `Dimensions.get` + a manual listener),
|
|
39
|
+
* since it already re-renders its subscribers on every rotation/resize —
|
|
40
|
+
* there is no CSS media query to lean on here, unlike the web version.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const { isNarrow, isMedium } = useBreakpoint();
|
|
44
|
+
* // isNarrow → true when the window is ≤ 400 dp wide (split views should collapse)
|
|
45
|
+
* // isMedium → true when ≤ 550 dp (use a bottom ViewSwitcher instead)
|
|
46
|
+
*/
|
|
47
|
+
export declare function useBreakpoint(): BreakpointState;
|
|
48
|
+
/** The widest bucket, above every breakpoint, is `base`. */
|
|
49
|
+
export type GnomeBreakpointBucket = GnomeBreakpointName | 'base';
|
|
50
|
+
/**
|
|
51
|
+
* A value that may vary by breakpoint: either the value itself, or a map of
|
|
52
|
+
* breakpoint names to values.
|
|
53
|
+
*
|
|
54
|
+
* The buckets are max-widths, so the map reads like stacked `max-width`
|
|
55
|
+
* media queries — `base` is the widest, and the narrowest matching entry
|
|
56
|
+
* wins:
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* { base: 3, wide: 2, narrow: 1 }
|
|
60
|
+
* // ≤ 400 dp → 1 | ≤ 860 dp → 2 | wider → 3
|
|
61
|
+
* // (550 dp matches `wide`, since no `medium` entry is given)
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export type ResponsiveValue<T> = T | ({
|
|
65
|
+
base?: T;
|
|
66
|
+
} & Partial<Record<GnomeBreakpointName, T>>);
|
|
67
|
+
/**
|
|
68
|
+
* Bucket a width falls into. The same thresholds serve `useBreakpoint` and
|
|
69
|
+
* `BreakpointBin` — a breakpoint applies to whatever it's measured against,
|
|
70
|
+
* window or container alike.
|
|
71
|
+
*
|
|
72
|
+
* A width of `0` means "not measured yet" and reports `base`, so the first
|
|
73
|
+
* render matches the widest layout rather than flashing the narrowest one.
|
|
74
|
+
*/
|
|
75
|
+
export declare function bucketForWidth(width: number): GnomeBreakpointBucket;
|
|
76
|
+
/** True when `value` is a breakpoint map rather than a plain value. */
|
|
77
|
+
export declare function isResponsiveMap<T>(value: ResponsiveValue<T> | undefined): boolean;
|
|
78
|
+
/** Pick the entry for `bucket`, falling back outwards to the wider ones. */
|
|
79
|
+
export declare function resolveResponsive<T>(value: ResponsiveValue<T> | undefined, bucket: GnomeBreakpointBucket, fallback: T): T;
|