@gnome-ui/react-native 1.7.0 → 1.8.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 +326 -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/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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1884 -526
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
3
|
+
export interface ExpanderRowProps {
|
|
4
|
+
/** Primary label. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Secondary line below the title. */
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
/** Icon or image placed at the leading edge of the header row. */
|
|
9
|
+
leading?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Widget placed at the trailing edge of the header row, before the
|
|
12
|
+
* chevron (e.g. a value label or a `Switch`). Stop event propagation
|
|
13
|
+
* inside it so the row's toggle isn't triggered.
|
|
14
|
+
*/
|
|
15
|
+
trailing?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Nested rows revealed when expanded. Use `ActionRow`, `ButtonRow`, or
|
|
18
|
+
* any row-shaped element — separators are inserted automatically.
|
|
19
|
+
*/
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** Controlled expanded state. */
|
|
22
|
+
expanded?: boolean;
|
|
23
|
+
/** Initial expanded state when uncontrolled. Defaults to `false`. */
|
|
24
|
+
defaultExpanded?: boolean;
|
|
25
|
+
/** Called when the expanded state changes. */
|
|
26
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
27
|
+
style?: StyleProp<ViewStyle>;
|
|
28
|
+
testID?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Collapsible `ActionRow` that reveals nested rows on activation, mirroring
|
|
32
|
+
* `@gnome-ui/react`'s `ExpanderRow`. The header row toggles a smooth reveal
|
|
33
|
+
* animation exposing child rows. Supports both controlled (`expanded`) and
|
|
34
|
+
* uncontrolled (`defaultExpanded`) modes.
|
|
35
|
+
*
|
|
36
|
+
* The reveal panel reuses the standalone `Expander`'s exact recipe — a
|
|
37
|
+
* single `Animated.View` with a directly-driven numeric `height` (RN has no
|
|
38
|
+
* CSS grid to lean on for the web version's `grid-template-rows: 0fr → 1fr`
|
|
39
|
+
* trick), content staying mounted while collapsed
|
|
40
|
+
* (`accessibilityElementsHidden`/`importantForAccessibility` standing in
|
|
41
|
+
* for the web's `inert`), and the "show natural height until first
|
|
42
|
+
* `onLayout` measurement lands, then hand control to `Animated`" guard for
|
|
43
|
+
* a `defaultExpanded` initial mount. The only difference from `Expander`
|
|
44
|
+
* itself: the chevron is `PanDown` (a straight down-arrow, matching the
|
|
45
|
+
* source CSS's hand-drawn `M4 6l4 4 4-4` path and rotating 0deg → 180deg)
|
|
46
|
+
* rather than `Expander`'s `PanEnd` triangle rotating 0deg → 90deg — the
|
|
47
|
+
* same icon/rotation pair `Dropdown`'s own chevron already established.
|
|
48
|
+
*
|
|
49
|
+
* Nested children get a `Separator` inserted before each one (including
|
|
50
|
+
* the first, directly under the header) via `Children.toArray(children)
|
|
51
|
+
* .filter(Boolean)`, the same falsy-child-filtering `ExpanderRow`'s web
|
|
52
|
+
* version already does. Unlike `CheckRow`/`ButtonRow`, this component has
|
|
53
|
+
* no `disabled` prop — the source `@gnome-ui/react` version doesn't expose
|
|
54
|
+
* one either, so none is added here.
|
|
55
|
+
*
|
|
56
|
+
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ExpanderRow.html
|
|
57
|
+
*/
|
|
58
|
+
export declare const ExpanderRow: import('react').ForwardRefExoticComponent<ExpanderRowProps & import('react').RefAttributes<View>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
export interface FieldGroupProps extends Omit<ViewProps, 'style'> {
|
|
4
|
+
/** Group heading, rendered above the grouped content. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Helper text shown below the label. Hidden when `error` is set. */
|
|
7
|
+
helperText?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Error message shown below the label in place of `helperText`.
|
|
10
|
+
* Announced via `role="alert"` when it appears.
|
|
11
|
+
*/
|
|
12
|
+
error?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Visually dims the group. Unlike the web version's native
|
|
15
|
+
* `<fieldset disabled>`, this does not automatically disable descendant
|
|
16
|
+
* controls — RN has no equivalent of a fieldset's built-in
|
|
17
|
+
* disabled-propagates-to-descendants behavior, so each child control
|
|
18
|
+
* must still be disabled individually.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Arbitrary field content — checkboxes, radios, a custom composite field, etc. */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generic form-field grouping with a shared label, help text, and error
|
|
27
|
+
* message, for arbitrary fields outside a `BoxedList`. Mirrors
|
|
28
|
+
* `@gnome-ui/react`'s `FieldGroup`.
|
|
29
|
+
*
|
|
30
|
+
* `PreferencesGroup` is scoped specifically to wrapping settings rows
|
|
31
|
+
* inside a `BoxedList` — use `FieldGroup` for a plain labeled grouping
|
|
32
|
+
* around any set of related form controls (e.g. a `RadioButton` group or
|
|
33
|
+
* several `Checkbox`es sharing one label and error), independent of the
|
|
34
|
+
* settings-page layout.
|
|
35
|
+
*
|
|
36
|
+
* `<fieldset>`/`<legend>` have no RN element equivalent — this renders as
|
|
37
|
+
* a plain `View` with `role="group"` (the closest match to a fieldset's
|
|
38
|
+
* implicit ARIA role; RN's `Role` union has it natively, no substitution
|
|
39
|
+
* needed) and a themed `Text` label in place of the `<legend>`. The web
|
|
40
|
+
* version's `aria-describedby` (an id-relationship prop) has no RN
|
|
41
|
+
* equivalent and is dropped, the same "no relationship attribute" gap
|
|
42
|
+
* `ProgressBar`/`LevelBar`/`Expander` already established. The hint/error
|
|
43
|
+
* text reuses `TextField`'s exact recipe verbatim — `error ?? helperText`
|
|
44
|
+
* picks the message, `error ? theme.errorColor : theme.windowFgColor` plus
|
|
45
|
+
* `error ? 1 : theme.opacityDim` picks the color/opacity — rather than
|
|
46
|
+
* re-deriving the same dim-vs-error styling logic independently.
|
|
47
|
+
* `disabled` only dims the group visually (`theme.opacityDisabled`); see
|
|
48
|
+
* the prop doc for why it can't also disable descendants automatically.
|
|
49
|
+
*
|
|
50
|
+
* @see https://developer.gnome.org/hig/patterns/controls/
|
|
51
|
+
*/
|
|
52
|
+
export declare const FieldGroup: ({ label, helperText, error, disabled, children, style, ...viewProps }: FieldGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { MultiSelectDropdownOption } from '../MultiSelectDropdown';
|
|
3
|
+
export interface FilterableMultiSelectDropdownProps<V extends string = string> {
|
|
4
|
+
/** The list of selectable options. */
|
|
5
|
+
options: MultiSelectDropdownOption<V>[];
|
|
6
|
+
/** The currently selected values. */
|
|
7
|
+
value: V[];
|
|
8
|
+
/** Called with the full updated selection whenever an option is toggled. */
|
|
9
|
+
onChange: (value: V[]) => void;
|
|
10
|
+
/** Placeholder shown on the trigger when no option is selected. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Placeholder for the filter field shown once the list is open. */
|
|
13
|
+
filterPlaceholder?: string;
|
|
14
|
+
/** Accessible label for the control. */
|
|
15
|
+
accessibilityLabel?: string;
|
|
16
|
+
/** Disables the entire control. */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `MultiSelectDropdown` plus a filter field for narrowing long option
|
|
23
|
+
* lists, mirroring `@gnome-ui/react`'s `FilterableMultiSelectDropdown`.
|
|
24
|
+
*
|
|
25
|
+
* Same overall shape and positioning recipe as `MultiSelectDropdown` —
|
|
26
|
+
* duplicated rather than composed, matching how the web source itself
|
|
27
|
+
* relates to `MultiSelectDropdown` (a parallel implementation sharing only
|
|
28
|
+
* the `MultiSelectDropdownOption` type, not a wrapper around it) — with a
|
|
29
|
+
* filter `TextInput` pinned above the list, auto-focused on open via
|
|
30
|
+
* `autoFocus`. Typing narrows `options` to those whose label or
|
|
31
|
+
* description contains the query (case-insensitive); filtering only
|
|
32
|
+
* affects what's shown, never the underlying selection — values selected
|
|
33
|
+
* before a query hides their option stay selected. An empty filtered
|
|
34
|
+
* result renders a centered "No results" message instead of the list.
|
|
35
|
+
*
|
|
36
|
+
* The web version's filter-field keyboard handler (↑/↓ roving highlight,
|
|
37
|
+
* Home/End, Enter-to-toggle) has no RN port — same "RN's touch-first model
|
|
38
|
+
* has no keyboard focus to drive it" reasoning `Dropdown`/`TabBar` already
|
|
39
|
+
* established; RN's own `TextInput` still handles the actual typing (and
|
|
40
|
+
* its software keyboard) natively, only the roving-highlight navigation on
|
|
41
|
+
* top of it is dropped. Selection is by direct tap only, same as
|
|
42
|
+
* `MultiSelectDropdown`.
|
|
43
|
+
*
|
|
44
|
+
* @see https://developer.gnome.org/hig/patterns/controls/drop-down-lists.html
|
|
45
|
+
*/
|
|
46
|
+
export declare const FilterableMultiSelectDropdown: <V extends string = string>({ options, value, onChange, placeholder, filterPlaceholder, accessibilityLabel, disabled, style, testID, }: FilterableMultiSelectDropdownProps<V>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,6 +25,16 @@ export interface IconProps {
|
|
|
25
25
|
* equivalent to inherit from a parent, unlike the web version.
|
|
26
26
|
*/
|
|
27
27
|
color?: IconColor;
|
|
28
|
+
/**
|
|
29
|
+
* Arbitrary fill color, overriding `color`. Escape hatch for the rare
|
|
30
|
+
* case where a fixed named-palette swatch (e.g. `color="blue"` →
|
|
31
|
+
* `theme.blue3`) isn't good enough — most concretely, tinting an icon
|
|
32
|
+
* with the app's actual *configurable* accent (`theme.accentColor`),
|
|
33
|
+
* which `blue3` never tracks. Added for `BottomTabBar`'s active-tab
|
|
34
|
+
* icon, the same precedent as `style` being added specifically for
|
|
35
|
+
* `Dropdown`'s chevron rotation need.
|
|
36
|
+
*/
|
|
37
|
+
tintColor?: string;
|
|
28
38
|
/** Forwarded to the underlying `Svg` — useful for a `transform` (e.g. a rotated disclosure chevron) or `margin`. */
|
|
29
39
|
style?: StyleProp<ViewStyle>;
|
|
30
40
|
}
|
|
@@ -53,4 +63,4 @@ export interface IconProps {
|
|
|
53
63
|
* import { siGithub } from "simple-icons";
|
|
54
64
|
* <Icon icon={siGithub} label="GitHub" />
|
|
55
65
|
*/
|
|
56
|
-
export declare const Icon: ({ icon, size, width, height, label, color, style }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
export declare const Icon: ({ icon, size, width, height, label, color, tintColor, style, }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export interface MultiSelectDropdownOption<V extends string = string> {
|
|
3
|
+
/** The value included in `value` when this option is selected. */
|
|
4
|
+
value: V;
|
|
5
|
+
/** Display label shown in the list and (when only one is selected) the trigger. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Optional descriptive text shown below the label. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Whether the option is selectable. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MultiSelectDropdownProps<V extends string = string> {
|
|
13
|
+
/** The list of selectable options. */
|
|
14
|
+
options: MultiSelectDropdownOption<V>[];
|
|
15
|
+
/** The currently selected values. */
|
|
16
|
+
value: V[];
|
|
17
|
+
/** Called with the full updated selection whenever an option is toggled. */
|
|
18
|
+
onChange: (value: V[]) => void;
|
|
19
|
+
/** Placeholder shown on the trigger when no option is selected. */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Accessible label for the control. */
|
|
22
|
+
accessibilityLabel?: string;
|
|
23
|
+
/** Disables the entire control. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
testID?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Checkbox-list variant of `Dropdown` for selecting multiple values from a
|
|
30
|
+
* single trigger, mirroring `@gnome-ui/react`'s `MultiSelectDropdown`.
|
|
31
|
+
*
|
|
32
|
+
* `Dropdown`/`ComboRow` are single-select only — use `MultiSelectDropdown`
|
|
33
|
+
* when more than one value can be chosen at once. Toggling an option keeps
|
|
34
|
+
* the panel open so the user can pick several in a row (unlike `Dropdown`,
|
|
35
|
+
* whose `selectOption` closes the panel); close it via the backdrop tap.
|
|
36
|
+
*
|
|
37
|
+
* The `Modal` + backdrop + independently-measured-then-combined
|
|
38
|
+
* trigger-rect/panel-height positioning (`Rect`/`Position`/
|
|
39
|
+
* `computePosition`/`GAP`/`MARGIN`/`MAX_LIST_HEIGHT`) is duplicated
|
|
40
|
+
* verbatim from `Dropdown` rather than extracted to a shared hook — same
|
|
41
|
+
* "genuinely different, not save-able" judgment call already applied to
|
|
42
|
+
* `Tooltip`/`Dropdown`'s own position-code duplication, though this is now
|
|
43
|
+
* the third near-identical copy of the up/down-flip-clamp-to-width shape
|
|
44
|
+
* specifically (not `Tooltip`'s 4-directional cascade) — worth extracting
|
|
45
|
+
* into a shared hook in a future pass if a fourth caller needs it, since
|
|
46
|
+
* unlike `Tooltip` these two are not just similarly-shaped but identical.
|
|
47
|
+
*
|
|
48
|
+
* Each option row gets a leading checkbox-square visual (border/background
|
|
49
|
+
* only, no animation — `Dropdown`'s own per-option content has none
|
|
50
|
+
* either) instead of `Dropdown`'s single trailing checkmark-when-selected,
|
|
51
|
+
* since more than one row can be checked at once.
|
|
52
|
+
*
|
|
53
|
+
* @see https://developer.gnome.org/hig/patterns/controls/drop-down-lists.html
|
|
54
|
+
*/
|
|
55
|
+
export declare const MultiSelectDropdown: <V extends string = string>({ options, value, onChange, placeholder, accessibilityLabel, disabled, style, testID, }: MultiSelectDropdownProps<V>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { StyleProp, TextInput, TextInputProps, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
export interface PasswordFieldProps extends Omit<TextInputProps, 'style' | 'secureTextEntry'> {
|
|
3
|
+
/** Visible label rendered above the input. */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Helper text rendered below the input. Hidden when `error` is set. */
|
|
6
|
+
helperText?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Error message rendered below the input in place of `helperText`.
|
|
9
|
+
* Also applies the error visual state to the input border.
|
|
10
|
+
*/
|
|
11
|
+
error?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Show the peek toggle button that reveals the password as plain text.
|
|
14
|
+
* Mirrors `GtkPasswordEntry`'s `show-peek-icon` property. Defaults to `true`.
|
|
15
|
+
*/
|
|
16
|
+
revealable?: boolean;
|
|
17
|
+
/** Accessible label for the toggle button while the password is hidden. */
|
|
18
|
+
revealLabel?: string;
|
|
19
|
+
/** Accessible label for the toggle button while the password is revealed. */
|
|
20
|
+
concealLabel?: string;
|
|
21
|
+
/** Style applied to the wrapping `View`. */
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
/** Style applied to the `TextInput` itself. */
|
|
24
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Single-line password input with a peek toggle to reveal the value as
|
|
28
|
+
* plain text, mirroring `@gnome-ui/react`'s `PasswordField`.
|
|
29
|
+
*
|
|
30
|
+
* `TextField` plus the exact reveal/conceal recipe `PasswordEntryRow`
|
|
31
|
+
* already established for this package: `secureTextEntry` (not `revealed
|
|
32
|
+
* ? 'text' : 'password'`, which has no RN equivalent), and the shipped
|
|
33
|
+
* `IconButton` for the toggle rather than a hand-rolled pressable — a
|
|
34
|
+
* circular icon button at `size="sm"` (28 dp) here, matching the web
|
|
35
|
+
* version's own `size="sm"` on this component specifically (as opposed to
|
|
36
|
+
* `PasswordEntryRow`'s default size, since that one sits inside a taller
|
|
37
|
+
* row). The toggle is positioned absolutely at the input's trailing edge,
|
|
38
|
+
* vertically centered — the RN port of the source CSS's `position:
|
|
39
|
+
* absolute; inset-block-start: 50%; transform: translateY(-50%)` — and the
|
|
40
|
+
* input gets extra trailing padding (`.hasToggle`'s `padding-inline-end`)
|
|
41
|
+
* so typed text never runs under the button.
|
|
42
|
+
*
|
|
43
|
+
* Use this over `TextField` with a manually-set `secureTextEntry` (which
|
|
44
|
+
* has no reveal affordance at all).
|
|
45
|
+
*
|
|
46
|
+
* @see https://docs.gtk.org/gtk4/class.PasswordEntry.html
|
|
47
|
+
*/
|
|
48
|
+
export declare const PasswordField: import('react').ForwardRefExoticComponent<PasswordFieldProps & import('react').RefAttributes<TextInput>>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
export interface RangeSliderMark {
|
|
3
|
+
value: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface RangeSliderProps extends Omit<ViewProps, 'style'> {
|
|
7
|
+
/** Current `[lower, upper]` values. Both must be between `min` and `max`. */
|
|
8
|
+
value: [number, number];
|
|
9
|
+
/** Called when either thumb moves. */
|
|
10
|
+
onChange: (value: [number, number]) => void;
|
|
11
|
+
/** Minimum value. Defaults to `0`. */
|
|
12
|
+
min?: number;
|
|
13
|
+
/** Maximum value. Defaults to `100`. */
|
|
14
|
+
max?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Granularity of each step.
|
|
17
|
+
* - The `adjustable` accessibility action (VoiceOver/TalkBack swipe up/down) moves by one step.
|
|
18
|
+
* Defaults to `1`.
|
|
19
|
+
*/
|
|
20
|
+
step?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum allowed gap between the lower and upper thumb, in value units.
|
|
23
|
+
* Prevents the thumbs from crossing or overlapping. Defaults to `0`.
|
|
24
|
+
*/
|
|
25
|
+
minDistance?: number;
|
|
26
|
+
/** Disables the control. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Marks to display along the track.
|
|
30
|
+
* Each mark can have an optional label rendered below the track.
|
|
31
|
+
*/
|
|
32
|
+
marks?: RangeSliderMark[];
|
|
33
|
+
/** Accessible label for the lower-bound thumb. Defaults to `"Minimum value"`. */
|
|
34
|
+
minLabel?: string;
|
|
35
|
+
/** Accessible label for the upper-bound thumb. Defaults to `"Maximum value"`. */
|
|
36
|
+
maxLabel?: string;
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Dual-thumb slider for selecting a min/max range, following the Adwaita
|
|
41
|
+
* `GtkScale` pattern used by `Slider` — mirrors `@gnome-ui/react`'s
|
|
42
|
+
* `RangeSlider`. Distinct from `Slider` (single value) — use this for
|
|
43
|
+
* range filters (price, date range, etc.) where both bounds are
|
|
44
|
+
* adjustable.
|
|
45
|
+
*
|
|
46
|
+
* Reuses `Slider`'s exact `PanResponder`/`locationX` pixel-positioning
|
|
47
|
+
* technique (no `%`-of-self transform, since RN's `transform` only takes
|
|
48
|
+
* pixel offsets) rather than two separate per-thumb responders: a single
|
|
49
|
+
* `PanResponder` spans the whole track and, on `onPanResponderGrant`,
|
|
50
|
+
* picks whichever thumb is closer to the touch point — the same
|
|
51
|
+
* nearest-thumb logic the web version's `handleTrackPointerDown` uses —
|
|
52
|
+
* then that same thumb keeps following the touch for the rest of the
|
|
53
|
+
* gesture (`onPanResponderMove`), exactly matching the web behavior of
|
|
54
|
+
* "the thumb chosen at touch-down stays locked to the gesture even if the
|
|
55
|
+
* pointer drifts closer to the other thumb mid-drag." This single-
|
|
56
|
+
* responder shape also stands in for the web version's separate "drag the
|
|
57
|
+
* track itself" affordance — touching anywhere on the track immediately
|
|
58
|
+
* jumps the nearest thumb there, so no separate interaction is needed.
|
|
59
|
+
*
|
|
60
|
+
* The web's keyboard (← / → / Page Up/Down / Home/End) has no RN
|
|
61
|
+
* equivalent — same "no keyboard to drive it" reasoning `Slider` already
|
|
62
|
+
* established — replaced by two independent `accessibilityRole="adjustable"`
|
|
63
|
+
* elements (one per thumb, each with its own `accessibilityValue`/
|
|
64
|
+
* `onAccessibilityAction`), the native VoiceOver/TalkBack increment-
|
|
65
|
+
* decrement analog. Each thumb's own visual `View` stays
|
|
66
|
+
* `pointerEvents="none"` (dragging is the track responder's job, not a
|
|
67
|
+
* per-thumb touch target) — screen readers still reach it independently
|
|
68
|
+
* through the accessibility tree, which is separate from RN's touch hit-
|
|
69
|
+
* testing.
|
|
70
|
+
*
|
|
71
|
+
* @see https://developer.gnome.org/hig/patterns/controls/sliders.html
|
|
72
|
+
*/
|
|
73
|
+
export declare const RangeSlider: ({ value, onChange, min, max, step, minDistance, disabled, marks, minLabel, maxLabel, style, onLayout, testID, ...viewProps }: RangeSliderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
export type StatusBadgeVariant = 'success' | 'warning' | 'error' | 'new' | 'accent' | 'neutral';
|
|
4
|
+
export interface StatusBadgeProps extends Omit<ViewProps, 'style'> {
|
|
5
|
+
/**
|
|
6
|
+
* Visual style. Defaults to `"neutral"`.
|
|
7
|
+
* - `success` — green, for published / active states.
|
|
8
|
+
* - `warning` — yellow, for beta / pending states.
|
|
9
|
+
* - `error` — red, for failed / rejected states.
|
|
10
|
+
* - `new` — purple, for newly released / featured items.
|
|
11
|
+
* - `accent` — blue, for highlighted / primary states.
|
|
12
|
+
* - `neutral` — muted overlay, for draft / archived / inactive states.
|
|
13
|
+
*/
|
|
14
|
+
variant?: StatusBadgeVariant;
|
|
15
|
+
/** Short human-readable label. String/number render as a themed label; other nodes render as-is. */
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Pill-shaped text label for entity status — published, beta, new, etc.,
|
|
21
|
+
* mirroring `@gnome-ui/react`'s `StatusBadge`.
|
|
22
|
+
*
|
|
23
|
+
* Unlike `Badge` (numeric counts, optional anchor/dot mode), `StatusBadge`
|
|
24
|
+
* is a simpler sibling designed purely for short human-readable state
|
|
25
|
+
* labels — no anchor positioning, no dot mode, no counter. The variant
|
|
26
|
+
* color mapping reuses `Badge`'s exact `getVariantColors` shape (this
|
|
27
|
+
* component gets its own copy rather than importing `Badge`'s internal
|
|
28
|
+
* helper, since it isn't exported — same small-duplicated-helper precedent
|
|
29
|
+
* as `dimColor` across `TextField`/`SearchBar`/`PasswordField`), plus a
|
|
30
|
+
* `new` (purple) variant `Badge` doesn't have. `neutral`'s background is
|
|
31
|
+
* `theme.hoverOverlay` — a translucent overlay, matching the source CSS's
|
|
32
|
+
* `--gnome-hover-overlay` exactly — rather than `Badge`'s own flat
|
|
33
|
+
* `light4`/`dark2` neutral, since this component's source CSS genuinely
|
|
34
|
+
* differs from `Badge`'s on that one variant.
|
|
35
|
+
*
|
|
36
|
+
* `children` follows the same convention `Badge` already established:
|
|
37
|
+
* string/number renders as a themed `Text` label, any other node renders
|
|
38
|
+
* as-is.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <StatusBadge variant="success">published</StatusBadge>
|
|
42
|
+
* <StatusBadge variant="warning">beta</StatusBadge>
|
|
43
|
+
* <StatusBadge variant="new">new</StatusBadge>
|
|
44
|
+
*
|
|
45
|
+
* @see https://developer.gnome.org/hig/patterns/feedback/badges.html
|
|
46
|
+
*/
|
|
47
|
+
export declare const StatusBadge: ({ variant, children, style, ...viewProps }: StatusBadgeProps) => import("react/jsx-runtime").JSX.Element;
|