@gnome-ui/react-native 1.5.0 → 1.6.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.
Files changed (32) hide show
  1. package/README.md +441 -3
  2. package/dist/components/AvatarGroup/AvatarGroup.d.ts +47 -0
  3. package/dist/components/AvatarGroup/index.d.ts +2 -0
  4. package/dist/components/AvatarRotator/AvatarRotator.d.ts +65 -0
  5. package/dist/components/AvatarRotator/index.d.ts +2 -0
  6. package/dist/components/Box/Box.d.ts +87 -0
  7. package/dist/components/Box/index.d.ts +2 -0
  8. package/dist/components/Clamp/Clamp.d.ts +61 -0
  9. package/dist/components/Clamp/index.d.ts +2 -0
  10. package/dist/components/CoachMark/CoachMark.d.ts +92 -0
  11. package/dist/components/CoachMark/CoachMarkTour.d.ts +54 -0
  12. package/dist/components/CoachMark/coachMarkUtils.d.ts +42 -0
  13. package/dist/components/CoachMark/index.d.ts +5 -0
  14. package/dist/components/InlineViewSwitcher/InlineViewSwitcher.d.ts +93 -0
  15. package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.d.ts +25 -0
  16. package/dist/components/InlineViewSwitcher/index.d.ts +4 -0
  17. package/dist/components/InlineViewSwitcher/variants.d.ts +30 -0
  18. package/dist/components/PreferencesGroup/PreferencesGroup.d.ts +52 -0
  19. package/dist/components/PreferencesGroup/index.d.ts +2 -0
  20. package/dist/components/StatusPage/StatusPage.d.ts +79 -0
  21. package/dist/components/StatusPage/index.d.ts +2 -0
  22. package/dist/components/ToggleGroup/ToggleGroup.d.ts +70 -0
  23. package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +49 -0
  24. package/dist/components/ToggleGroup/index.d.ts +4 -0
  25. package/dist/components/WrapBox/WrapBox.d.ts +67 -0
  26. package/dist/components/WrapBox/index.d.ts +2 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.ts +10 -0
  30. package/dist/index.js +1487 -393
  31. package/dist/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -0,0 +1,49 @@
1
+ import { IconDefinition } from '@gnome-ui/icons';
2
+ import { PressableProps, View } from 'react-native';
3
+ export interface ToggleGroupItemProps extends Omit<PressableProps, 'children' | 'style' | 'disabled' | 'onPress'> {
4
+ /** String identifier — becomes the group's `value` when this item is selected. */
5
+ name: string;
6
+ /** Visible label. Omit for icon-only items (pass `accessibilityLabel` instead). */
7
+ label?: string;
8
+ /** Icon from `@gnome-ui/icons`. */
9
+ icon?: IconDefinition;
10
+ /** Accessible name. Required for icon-only items; defaults to `label`. */
11
+ accessibilityLabel?: string;
12
+ disabled?: boolean;
13
+ }
14
+ /**
15
+ * Individual toggle inside a `ToggleGroup`. Can be icon-only, label-only, or
16
+ * icon + label — for icon-only items always pass an `accessibilityLabel` so
17
+ * screen readers can identify the option.
18
+ *
19
+ * The active state's three `color-mix(in srgb, accent N%, transparent)`
20
+ * values resolve to 8-digit `#RRGGBBAA` hexes off `theme.accentBgColor`
21
+ * (always a plain 6-digit hex), the technique `Chip` already established for
22
+ * exactly this selected-tint problem — `26` for 15% and `66` for 40% in
23
+ * light, `40` for 25% and `80` for 50% in dark. The CSS paints its active
24
+ * ring as an `inset 0 0 0 1px` box-shadow, which RN has no equivalent for;
25
+ * it becomes a real `borderWidth: 1` that every item carries at all times
26
+ * (transparent when inactive) so selecting one never shifts the row's
27
+ * layout — the same substitution `AvatarGroup` made for its own ring.
28
+ *
29
+ * `:hover` has no touch counterpart and collapses away; `:active` maps to
30
+ * `Pressable`'s `pressed` state using `theme.activeOverlay`, whose light
31
+ * (`rgba(0, 0, 0, 0.12)`) and dark (`rgba(255, 255, 255, 0.14)`) values are
32
+ * character-for-character the CSS's own `:active` colors — the same
33
+ * coincidence `ViewSwitcherItem` documented and reused. The
34
+ * `background-color`/`box-shadow` transition is dropped rather than
35
+ * rebuilt on `Animated`: `ViewSwitcherItem`, the closest sibling, doesn't
36
+ * animate its own selection either, so there is no reduced-motion handling
37
+ * to wire up here.
38
+ *
39
+ * The icon keeps the default foreground color instead of tracking the
40
+ * active accent text: `Icon` has no `currentColor` equivalent, and its
41
+ * `color` prop is a fixed GNOME palette (`blue`, `green`, …) with no
42
+ * `accent` member — which couldn't follow the app's configurable accent
43
+ * anyway. Same call, same reason, as `Chip`.
44
+ *
45
+ * `icon` is an `IconDefinition` rather than the `ReactNode` the older
46
+ * `ViewSwitcherItem` takes; that component predates `Icon` shipping in this
47
+ * package, while `Chip` and the web version both type it this way.
48
+ */
49
+ export declare const ToggleGroupItem: import('react').ForwardRefExoticComponent<ToggleGroupItemProps & import('react').RefAttributes<View>>;
@@ -0,0 +1,4 @@
1
+ export type { ToggleGroupProps } from './ToggleGroup';
2
+ export { ToggleGroup } from './ToggleGroup';
3
+ export type { ToggleGroupItemProps } from './ToggleGroupItem';
4
+ export { ToggleGroupItem } from './ToggleGroupItem';
@@ -0,0 +1,67 @@
1
+ import { ReactNode } from 'react';
2
+ import { StyleProp, View, ViewProps, ViewStyle } from 'react-native';
3
+ export type WrapBoxJustify = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
4
+ export type WrapBoxAlign = 'start' | 'center' | 'end' | 'stretch';
5
+ export interface WrapBoxProps extends Omit<ViewProps, 'style'> {
6
+ /** Gap between children on the same line, in dp. Default: `6`. */
7
+ childSpacing?: number;
8
+ /** Gap between lines, in dp. Defaults to `childSpacing`. */
9
+ lineSpacing?: number;
10
+ /** Horizontal distribution of children within each line. Default: `"start"`. */
11
+ justify?: WrapBoxJustify;
12
+ /** Cross-axis alignment of children within each line. Default: `"center"`. */
13
+ align?: WrapBoxAlign;
14
+ /** When true children wrap in the reverse direction (bottom to top). */
15
+ wrapReverse?: boolean;
16
+ children?: ReactNode;
17
+ style?: StyleProp<ViewStyle>;
18
+ }
19
+ /**
20
+ * Flexible wrapping layout container — children flow horizontally and wrap
21
+ * to new lines when they don't fit, like words in a paragraph, without
22
+ * locking them into a grid. Mirrors `AdwWrapBox` (libadwaita 1.7 / GNOME
23
+ * 48) and `@gnome-ui/react`'s own `WrapBox`.
24
+ *
25
+ * Pair with `Chip` for tag lists and filter rows, or use standalone for any
26
+ * collection of variable-width items.
27
+ *
28
+ * The web version ships its values as CSS custom properties consumed by a
29
+ * stylesheet (`--wrapbox-gap`, `--wrapbox-justify`, …) because a CSS module
30
+ * can't take runtime values any other way; RN has no such indirection, so
31
+ * they're written straight onto the style object here. Everything else is a
32
+ * direct translation: `flex-flow: row wrap` becomes
33
+ * `flexDirection: 'row'` + `flexWrap`, and the shorthand
34
+ * `gap: <row> <column>` splits into RN's separate `rowGap`/`columnGap`
35
+ * (the single `gap` property would set both, which is exactly what this
36
+ * component must be able to avoid).
37
+ *
38
+ * As in `Box`, `childSpacing`/`lineSpacing` are numbers only — RN's gap
39
+ * properties take dp, not CSS strings — and `align`/`justify` keep the
40
+ * web's bare `start`/`end` keywords in the public API while mapping
41
+ * internally onto Yoga's `flex-start`/`flex-end`.
42
+ *
43
+ * `alignContent: 'stretch'` is set explicitly even though neither package
44
+ * exposes an `alignContent` prop — **CSS defaults it to `stretch`, Yoga
45
+ * defaults it to `flex-start`**, so without this line `align="stretch"`
46
+ * silently does nothing on RN whenever the children have no cross-size of
47
+ * their own: the line collapses to zero height before `alignItems` ever
48
+ * gets to stretch anything into it. Caught on-device (the stretch row of
49
+ * the example app's demo screen rendered empty); this restores the web
50
+ * version's behaviour exactly. It's a no-op in the ordinary case where the
51
+ * container hugs its content rather than having a fixed height.
52
+ *
53
+ * @example
54
+ * // Tag list
55
+ * <WrapBox childSpacing={6}>
56
+ * {tags.map((tag) => <Chip key={tag}>{tag}</Chip>)}
57
+ * </WrapBox>
58
+ *
59
+ * @example
60
+ * // Looser gap between lines than between items
61
+ * <WrapBox childSpacing={6} lineSpacing={12} justify="center">
62
+ * {filters.map((filter) => <Chip key={filter}>{filter}</Chip>)}
63
+ * </WrapBox>
64
+ *
65
+ * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.WrapBox.html
66
+ */
67
+ export declare const WrapBox: import('react').ForwardRefExoticComponent<WrapBoxProps & import('react').RefAttributes<View>>;
@@ -0,0 +1,2 @@
1
+ export type { WrapBoxAlign, WrapBoxJustify, WrapBoxProps } from './WrapBox';
2
+ export { WrapBox } from './WrapBox';