@xaui/native 0.9.1-alpha.91 → 0.9.1-alpha.93

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 (86) hide show
  1. package/dist/chunk-2SHWOFQV.js +495 -0
  2. package/dist/chunk-3A5RK2R7.js +40 -0
  3. package/dist/chunk-6JAGPPZU.cjs +788 -0
  4. package/dist/chunk-7NQL5DXY.js +302 -0
  5. package/dist/chunk-FTPPUTWL.cjs +40 -0
  6. package/dist/chunk-GGP2ERSV.js +487 -0
  7. package/dist/chunk-LKRQUQZQ.cjs +487 -0
  8. package/dist/chunk-OPLPLFGK.cjs +493 -0
  9. package/dist/{chunk-LIEXFWTN.js → chunk-P5M5URAB.js} +29 -126
  10. package/dist/chunk-XWIPLZTD.cjs +302 -0
  11. package/dist/components/carousel/index.cjs +3 -2
  12. package/dist/components/carousel/index.js +2 -1
  13. package/dist/components/index.d.cts +3 -0
  14. package/dist/components/index.d.ts +3 -0
  15. package/dist/components/number-pad/index.cjs +40 -0
  16. package/dist/components/number-pad/index.d.cts +60 -0
  17. package/dist/components/number-pad/index.d.ts +60 -0
  18. package/dist/components/number-pad/index.js +40 -0
  19. package/dist/components/number-pad/number-pad-action.d.cts +24 -0
  20. package/dist/components/number-pad/number-pad-action.d.ts +24 -0
  21. package/dist/components/number-pad/number-pad-backspace.d.cts +18 -0
  22. package/dist/components/number-pad/number-pad-backspace.d.ts +18 -0
  23. package/dist/components/number-pad/number-pad-cell.d.cts +7 -0
  24. package/dist/components/number-pad/number-pad-cell.d.ts +7 -0
  25. package/dist/components/number-pad/number-pad-icon.d.cts +13 -0
  26. package/dist/components/number-pad/number-pad-icon.d.ts +13 -0
  27. package/dist/components/number-pad/number-pad-key.d.cts +24 -0
  28. package/dist/components/number-pad/number-pad-key.d.ts +24 -0
  29. package/dist/components/number-pad/number-pad-label.d.cts +14 -0
  30. package/dist/components/number-pad/number-pad-label.d.ts +14 -0
  31. package/dist/components/number-pad/number-pad.context.d.cts +18 -0
  32. package/dist/components/number-pad/number-pad.context.d.ts +18 -0
  33. package/dist/components/number-pad/number-pad.d.cts +57 -0
  34. package/dist/components/number-pad/number-pad.d.ts +57 -0
  35. package/dist/components/number-pad/number-pad.recipe.d.cts +11 -0
  36. package/dist/components/number-pad/number-pad.recipe.d.ts +11 -0
  37. package/dist/components/number-pad/number-pad.style.d.cts +13 -0
  38. package/dist/components/number-pad/number-pad.style.d.ts +13 -0
  39. package/dist/components/number-pad/number-pad.type.d.cts +135 -0
  40. package/dist/components/number-pad/number-pad.type.d.ts +135 -0
  41. package/dist/components/number-pad/number-pad.utils.d.cts +34 -0
  42. package/dist/components/number-pad/number-pad.utils.d.ts +34 -0
  43. package/dist/components/pager/index.cjs +33 -0
  44. package/dist/components/pager/index.d.cts +60 -0
  45. package/dist/components/pager/index.d.ts +60 -0
  46. package/dist/components/pager/index.js +33 -0
  47. package/dist/components/pager/pager-content.d.cts +24 -0
  48. package/dist/components/pager/pager-content.d.ts +24 -0
  49. package/dist/components/pager/pager-indicator.d.cts +47 -0
  50. package/dist/components/pager/pager-indicator.d.ts +47 -0
  51. package/dist/components/pager/pager-page.d.cts +16 -0
  52. package/dist/components/pager/pager-page.d.ts +16 -0
  53. package/dist/components/pager/pager.context.d.cts +7 -0
  54. package/dist/components/pager/pager.context.d.ts +7 -0
  55. package/dist/components/pager/pager.d.cts +70 -0
  56. package/dist/components/pager/pager.d.ts +70 -0
  57. package/dist/components/pager/pager.recipe.d.cts +33 -0
  58. package/dist/components/pager/pager.recipe.d.ts +33 -0
  59. package/dist/components/pager/pager.type.d.cts +107 -0
  60. package/dist/components/pager/pager.type.d.ts +107 -0
  61. package/dist/components/rating/index.cjs +30 -0
  62. package/dist/components/rating/index.d.cts +41 -0
  63. package/dist/components/rating/index.d.ts +41 -0
  64. package/dist/components/rating/index.js +30 -0
  65. package/dist/components/rating/rating-icon.d.cts +16 -0
  66. package/dist/components/rating/rating-icon.d.ts +16 -0
  67. package/dist/components/rating/rating-item.d.cts +23 -0
  68. package/dist/components/rating/rating-item.d.ts +23 -0
  69. package/dist/components/rating/rating-star.d.cts +19 -0
  70. package/dist/components/rating/rating-star.d.ts +19 -0
  71. package/dist/components/rating/rating.context.d.cts +16 -0
  72. package/dist/components/rating/rating.context.d.ts +16 -0
  73. package/dist/components/rating/rating.d.cts +59 -0
  74. package/dist/components/rating/rating.d.ts +59 -0
  75. package/dist/components/rating/rating.recipe.d.cts +11 -0
  76. package/dist/components/rating/rating.recipe.d.ts +11 -0
  77. package/dist/components/rating/rating.style.d.cts +24 -0
  78. package/dist/components/rating/rating.style.d.ts +24 -0
  79. package/dist/components/rating/rating.type.d.cts +108 -0
  80. package/dist/components/rating/rating.type.d.ts +108 -0
  81. package/dist/components/rating/rating.utils.d.cts +28 -0
  82. package/dist/components/rating/rating.utils.d.ts +28 -0
  83. package/dist/index.cjs +91 -28
  84. package/dist/index.js +148 -85
  85. package/package.json +31 -1
  86. package/dist/chunk-K5UO3HBW.cjs +0 -1007
@@ -0,0 +1,30 @@
1
+ import {
2
+ Rating,
3
+ RatingIcon,
4
+ RatingItem,
5
+ RatingRoot,
6
+ ratingRecipe,
7
+ useRating,
8
+ useRatingLayer
9
+ } from "../../chunk-7NQL5DXY.js";
10
+ import "../../chunk-F6W3JQ7K.js";
11
+ import "../../chunk-2AFA5HA2.js";
12
+ import "../../chunk-423RQBOX.js";
13
+ import "../../chunk-JN6IRT2M.js";
14
+ import "../../chunk-WFZDAXDI.js";
15
+ import "../../chunk-DKVXTMIJ.js";
16
+ import "../../chunk-3Q42X6EQ.js";
17
+ import "../../chunk-TTZOIXKE.js";
18
+ import "../../chunk-36PRYGAM.js";
19
+ import "../../chunk-EGLLDKN6.js";
20
+ import "../../chunk-Z6JBWRPL.js";
21
+ import "../../chunk-M63GFNKV.js";
22
+ export {
23
+ Rating,
24
+ RatingIcon,
25
+ RatingItem,
26
+ RatingRoot,
27
+ ratingRecipe,
28
+ useRating,
29
+ useRatingLayer
30
+ };
@@ -0,0 +1,16 @@
1
+ import type { RatingIconProps } from './rating.type';
2
+ /**
3
+ * The mark, as a glyph of your own — a heart, a flame, a paw.
4
+ *
5
+ * Written **once** and drawn twice, because a mark is the same glyph in two layers: the
6
+ * neutral ground, and the filled colour clipped to the fraction given. Which of the two this
7
+ * instance is in comes from the layer rather than from a prop, so the caller never has to
8
+ * keep two copies in step.
9
+ *
10
+ * An explicit `color` wins, as it does everywhere `Icon` appears — which is also how a
11
+ * caller opts out of the two-layer colouring entirely.
12
+ */
13
+ export declare function RatingIcon({ size, color, ...rest }: RatingIconProps): import("react").JSX.Element;
14
+ export declare namespace RatingIcon {
15
+ var displayName: string;
16
+ }
@@ -0,0 +1,16 @@
1
+ import type { RatingIconProps } from './rating.type';
2
+ /**
3
+ * The mark, as a glyph of your own — a heart, a flame, a paw.
4
+ *
5
+ * Written **once** and drawn twice, because a mark is the same glyph in two layers: the
6
+ * neutral ground, and the filled colour clipped to the fraction given. Which of the two this
7
+ * instance is in comes from the layer rather than from a prop, so the caller never has to
8
+ * keep two copies in step.
9
+ *
10
+ * An explicit `color` wins, as it does everywhere `Icon` appears — which is also how a
11
+ * caller opts out of the two-layer colouring entirely.
12
+ */
13
+ export declare function RatingIcon({ size, color, ...rest }: RatingIconProps): import("react").JSX.Element;
14
+ export declare namespace RatingIcon {
15
+ var displayName: string;
16
+ }
@@ -0,0 +1,23 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * One mark.
4
+ *
5
+ * **It is the same glyph twice.** The neutral one sits in the flow and decides how wide the
6
+ * mark is; the filled one is pinned over it inside a clip whose width is the fraction given,
7
+ * so a value of 4.3 shows three tenths of the fifth mark. That fraction is what lets one
8
+ * component be both an input and a display of an average — a boolean per mark would have to
9
+ * round 4.3 to 4 and lose the thing the average was for.
10
+ *
11
+ * **The press reads where it landed.** `locationX` over the mark's width is the fraction the
12
+ * finger meant, and `snapValue` rounds it up to the nearest `precision` step: a tap anywhere
13
+ * in the first mark is one star rather than zero, and with `precision={0.5}` the left half of
14
+ * the third is 2.5 while the right half is 3.
15
+ *
16
+ * A mark owns its own press state, which is why the root publishes resolved styles and not
17
+ * the recipe (R5).
18
+ */
19
+ export declare const RatingItem: import("react").ForwardRefExoticComponent<Omit<import("../..").PressableFeedbackProps, "isPressed" | "style" | "children" | "layout"> & {
20
+ index: number;
21
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle> | ((state: import("react-native").PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").ViewStyle>);
22
+ children?: import("react").ReactNode;
23
+ } & import("react").RefAttributes<View>>;
@@ -0,0 +1,23 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * One mark.
4
+ *
5
+ * **It is the same glyph twice.** The neutral one sits in the flow and decides how wide the
6
+ * mark is; the filled one is pinned over it inside a clip whose width is the fraction given,
7
+ * so a value of 4.3 shows three tenths of the fifth mark. That fraction is what lets one
8
+ * component be both an input and a display of an average — a boolean per mark would have to
9
+ * round 4.3 to 4 and lose the thing the average was for.
10
+ *
11
+ * **The press reads where it landed.** `locationX` over the mark's width is the fraction the
12
+ * finger meant, and `snapValue` rounds it up to the nearest `precision` step: a tap anywhere
13
+ * in the first mark is one star rather than zero, and with `precision={0.5}` the left half of
14
+ * the third is 2.5 while the right half is 3.
15
+ *
16
+ * A mark owns its own press state, which is why the root publishes resolved styles and not
17
+ * the recipe (R5).
18
+ */
19
+ export declare const RatingItem: import("react").ForwardRefExoticComponent<Omit<import("../..").PressableFeedbackProps, "isPressed" | "style" | "children" | "layout"> & {
20
+ index: number;
21
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle> | ((state: import("react-native").PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").ViewStyle>);
22
+ children?: import("react").ReactNode;
23
+ } & import("react").RefAttributes<View>>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The mark a `Rating` draws when the caller composes nothing.
3
+ *
4
+ * **`★` in both layers**, one in the neutral ground and one in the filled colour — never a
5
+ * hollow `☆` under a solid one. Two reasons, and the second is the load-bearing one: a solid
6
+ * pair is what every store's rating looks like, and `☆` (U+2606) is not in Android's system
7
+ * face, so the empty half of the row would render as a box on the platform where most of it
8
+ * is read. `★` (U+2605) is present on both.
9
+ *
10
+ * A character rather than an SVG, so the component needs no `react-native-svg` for the one
11
+ * glyph it draws itself. `Rating.Icon` replaces it with anything.
12
+ *
13
+ * **Internal** — the two layers are the `Rating.Item`'s arrangement, and a caller reaching
14
+ * for this directly would be reaching past the thing that positions it.
15
+ */
16
+ export declare function RatingStar(): import("react").JSX.Element;
17
+ export declare namespace RatingStar {
18
+ var displayName: string;
19
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The mark a `Rating` draws when the caller composes nothing.
3
+ *
4
+ * **`★` in both layers**, one in the neutral ground and one in the filled colour — never a
5
+ * hollow `☆` under a solid one. Two reasons, and the second is the load-bearing one: a solid
6
+ * pair is what every store's rating looks like, and `☆` (U+2606) is not in Android's system
7
+ * face, so the empty half of the row would render as a box on the platform where most of it
8
+ * is read. `★` (U+2605) is present on both.
9
+ *
10
+ * A character rather than an SVG, so the component needs no `react-native-svg` for the one
11
+ * glyph it draws itself. `Rating.Icon` replaces it with anything.
12
+ *
13
+ * **Internal** — the two layers are the `Rating.Item`'s arrangement, and a caller reaching
14
+ * for this directly would be reaching past the thing that positions it.
15
+ */
16
+ export declare function RatingStar(): import("react").JSX.Element;
17
+ export declare namespace RatingStar {
18
+ var displayName: string;
19
+ }
@@ -0,0 +1,16 @@
1
+ import type { RatingContextValue, RatingLayerContextValue } from './rating.type';
2
+ /**
3
+ * R10 — `useRating` is exported so a control beside the row can read or set the value, and
4
+ * so a caller can write their own mark against the same `select` the built-in ones call.
5
+ * Outside a `<Rating>` it throws by name.
6
+ */
7
+ export declare const RatingProvider: import("react").Provider<RatingContextValue | null>, useRating: () => RatingContextValue;
8
+ /**
9
+ * Which of a mark's two layers a glyph is drawn in.
10
+ *
11
+ * It exists so `Rating.Icon` needs no prop to know its colour: a mark is the same glyph
12
+ * twice, once in the neutral ground and once in the filled colour clipped to the fraction
13
+ * given, and the caller writes that glyph **once**. A `tone` prop would have made them write
14
+ * it twice and keep the two in step.
15
+ */
16
+ export declare const RatingLayerProvider: import("react").Provider<RatingLayerContextValue | null>, useRatingLayer: () => RatingLayerContextValue;
@@ -0,0 +1,16 @@
1
+ import type { RatingContextValue, RatingLayerContextValue } from './rating.type';
2
+ /**
3
+ * R10 — `useRating` is exported so a control beside the row can read or set the value, and
4
+ * so a caller can write their own mark against the same `select` the built-in ones call.
5
+ * Outside a `<Rating>` it throws by name.
6
+ */
7
+ export declare const RatingProvider: import("react").Provider<RatingContextValue | null>, useRating: () => RatingContextValue;
8
+ /**
9
+ * Which of a mark's two layers a glyph is drawn in.
10
+ *
11
+ * It exists so `Rating.Icon` needs no prop to know its colour: a mark is the same glyph
12
+ * twice, once in the neutral ground and once in the filled colour clipped to the fraction
13
+ * given, and the caller writes that glyph **once**. A `tone` prop would have made them write
14
+ * it twice and keep the two in step.
15
+ */
16
+ export declare const RatingLayerProvider: import("react").Provider<RatingLayerContextValue | null>, useRatingLayer: () => RatingLayerContextValue;
@@ -0,0 +1,59 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * A row of marks, given or shown.
4
+ *
5
+ * ```tsx
6
+ * <Rating value={score} onValueChange={setScore} />
7
+ *
8
+ * <Rating value={4.3} isReadOnly />
9
+ *
10
+ * <Rating value={score} onValueChange={setScore} precision={0.5}>
11
+ * <Rating.Icon as={HeartIcon} />
12
+ * </Rating>
13
+ * ```
14
+ *
15
+ * **One component for the input and the average.** The fill of each mark is a *fraction*,
16
+ * so 4.3 shows three tenths of the fifth mark — a boolean per mark would have had to round
17
+ * it, and rounding is exactly what an average must not do. `precision` governs input only.
18
+ *
19
+ * **The row is data, not markup.** `max` says how many marks there are, so the root renders
20
+ * them; five hand-written marks is a row that disagrees with the prop the moment either
21
+ * changes. `children` is therefore the **glyph**, written once and drawn once per mark.
22
+ *
23
+ * **There is no label.** A "4,3 sur 5" beside the row is a `Typography` in a `Row` — the
24
+ * screen's, not the rating's (R1), and the moment it were a slot it would need an alignment,
25
+ * a format and a language.
26
+ *
27
+ * **There is no `isClearable`**, deliberately. Tapping the mark you already chose to go back
28
+ * to nothing is a gesture half the world's rating inputs have and half do not, so it is not
29
+ * a default either way; a caller who wants it holds the value and compares
30
+ * (`onValueChange={next => setScore(next === score ? 0 : next)}`), which is three words and
31
+ * says which behaviour they picked.
32
+ */
33
+ export declare const RatingRoot: import("react").ForwardRefExoticComponent<{
34
+ variant?: import("./rating.type").RatingVariant;
35
+ size?: import("./rating.type").RatingSize;
36
+ color?: string;
37
+ max?: number;
38
+ value?: number;
39
+ defaultValue?: number;
40
+ onValueChange?: (value: number) => void;
41
+ precision?: number;
42
+ isReadOnly?: boolean;
43
+ isDisabled?: boolean;
44
+ children?: import("react").ReactNode;
45
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
46
+ } & Omit<import("react-native").ViewProps, "style" | "children"> & Omit<import("../..").ViewStyleProps, keyof {
47
+ variant?: import("./rating.type").RatingVariant;
48
+ size?: import("./rating.type").RatingSize;
49
+ color?: string;
50
+ max?: number;
51
+ value?: number;
52
+ defaultValue?: number;
53
+ onValueChange?: (value: number) => void;
54
+ precision?: number;
55
+ isReadOnly?: boolean;
56
+ isDisabled?: boolean;
57
+ children?: import("react").ReactNode;
58
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
59
+ }> & import("react").RefAttributes<View>>;
@@ -0,0 +1,59 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * A row of marks, given or shown.
4
+ *
5
+ * ```tsx
6
+ * <Rating value={score} onValueChange={setScore} />
7
+ *
8
+ * <Rating value={4.3} isReadOnly />
9
+ *
10
+ * <Rating value={score} onValueChange={setScore} precision={0.5}>
11
+ * <Rating.Icon as={HeartIcon} />
12
+ * </Rating>
13
+ * ```
14
+ *
15
+ * **One component for the input and the average.** The fill of each mark is a *fraction*,
16
+ * so 4.3 shows three tenths of the fifth mark — a boolean per mark would have had to round
17
+ * it, and rounding is exactly what an average must not do. `precision` governs input only.
18
+ *
19
+ * **The row is data, not markup.** `max` says how many marks there are, so the root renders
20
+ * them; five hand-written marks is a row that disagrees with the prop the moment either
21
+ * changes. `children` is therefore the **glyph**, written once and drawn once per mark.
22
+ *
23
+ * **There is no label.** A "4,3 sur 5" beside the row is a `Typography` in a `Row` — the
24
+ * screen's, not the rating's (R1), and the moment it were a slot it would need an alignment,
25
+ * a format and a language.
26
+ *
27
+ * **There is no `isClearable`**, deliberately. Tapping the mark you already chose to go back
28
+ * to nothing is a gesture half the world's rating inputs have and half do not, so it is not
29
+ * a default either way; a caller who wants it holds the value and compares
30
+ * (`onValueChange={next => setScore(next === score ? 0 : next)}`), which is three words and
31
+ * says which behaviour they picked.
32
+ */
33
+ export declare const RatingRoot: import("react").ForwardRefExoticComponent<{
34
+ variant?: import("./rating.type").RatingVariant;
35
+ size?: import("./rating.type").RatingSize;
36
+ color?: string;
37
+ max?: number;
38
+ value?: number;
39
+ defaultValue?: number;
40
+ onValueChange?: (value: number) => void;
41
+ precision?: number;
42
+ isReadOnly?: boolean;
43
+ isDisabled?: boolean;
44
+ children?: import("react").ReactNode;
45
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
46
+ } & Omit<import("react-native").ViewProps, "style" | "children"> & Omit<import("../..").ViewStyleProps, keyof {
47
+ variant?: import("./rating.type").RatingVariant;
48
+ size?: import("./rating.type").RatingSize;
49
+ color?: string;
50
+ max?: number;
51
+ value?: number;
52
+ defaultValue?: number;
53
+ onValueChange?: (value: number) => void;
54
+ precision?: number;
55
+ isReadOnly?: boolean;
56
+ isDisabled?: boolean;
57
+ children?: import("react").ReactNode;
58
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
59
+ }> & import("react").RefAttributes<View>>;
@@ -0,0 +1,11 @@
1
+ import type { SlotStyles } from '../../system/recipe';
2
+ import type { XAUITheme } from '../../theme/theme.type';
3
+ import type { RatingSlot, RatingVariant } from './rating.type';
4
+ export declare const ratingRecipe: import("../..").Recipe<"root" | "glyph" | "item" | "glyphFill", RatingVariant, {
5
+ readonly size: {
6
+ readonly xs: (theme: XAUITheme) => SlotStyles<RatingSlot>;
7
+ readonly sm: (theme: XAUITheme) => SlotStyles<RatingSlot>;
8
+ readonly md: (theme: XAUITheme) => SlotStyles<RatingSlot>;
9
+ readonly lg: (theme: XAUITheme) => SlotStyles<RatingSlot>;
10
+ };
11
+ }>;
@@ -0,0 +1,11 @@
1
+ import type { SlotStyles } from '../../system/recipe';
2
+ import type { XAUITheme } from '../../theme/theme.type';
3
+ import type { RatingSlot, RatingVariant } from './rating.type';
4
+ export declare const ratingRecipe: import("../..").Recipe<"root" | "glyph" | "item" | "glyphFill", RatingVariant, {
5
+ readonly size: {
6
+ readonly xs: (theme: XAUITheme) => SlotStyles<RatingSlot>;
7
+ readonly sm: (theme: XAUITheme) => SlotStyles<RatingSlot>;
8
+ readonly md: (theme: XAUITheme) => SlotStyles<RatingSlot>;
9
+ readonly lg: (theme: XAUITheme) => SlotStyles<RatingSlot>;
10
+ };
11
+ }>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The clip the filled layer is drawn inside.
3
+ *
4
+ * **No token in it**, which is why it is here rather than in the recipe: this is geometry.
5
+ * The layer is pinned to the mark's leading edge and its width is the fraction that is
6
+ * filled, so `overflow: 'hidden'` cuts the glyph part-way through and a value of 4.3 shows
7
+ * three tenths of the fifth mark.
8
+ *
9
+ * `start` and `top` rather than `left` (R13): a right-to-left layout fills from the other
10
+ * edge, and the logical key is what makes that happen with no second branch.
11
+ *
12
+ * The glyph inside it must **not** be allowed to shrink to the clip's width, or the
13
+ * character would re-wrap instead of being cut — which is what the mark's own width on the
14
+ * inner node is for.
15
+ */
16
+ export declare const ratingSheet: {
17
+ clip: {
18
+ position: "absolute";
19
+ top: number;
20
+ start: number;
21
+ bottom: number;
22
+ overflow: "hidden";
23
+ };
24
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The clip the filled layer is drawn inside.
3
+ *
4
+ * **No token in it**, which is why it is here rather than in the recipe: this is geometry.
5
+ * The layer is pinned to the mark's leading edge and its width is the fraction that is
6
+ * filled, so `overflow: 'hidden'` cuts the glyph part-way through and a value of 4.3 shows
7
+ * three tenths of the fifth mark.
8
+ *
9
+ * `start` and `top` rather than `left` (R13): a right-to-left layout fills from the other
10
+ * edge, and the logical key is what makes that happen with no second branch.
11
+ *
12
+ * The glyph inside it must **not** be allowed to shrink to the clip's width, or the
13
+ * character would re-wrap instead of being cut — which is what the mark's own width on the
14
+ * inner node is for.
15
+ */
16
+ export declare const ratingSheet: {
17
+ clip: {
18
+ position: "absolute";
19
+ top: number;
20
+ start: number;
21
+ bottom: number;
22
+ overflow: "hidden";
23
+ };
24
+ };
@@ -0,0 +1,108 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { PressableStateCallbackType, StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native';
3
+ import type { IconContextValue, IconProps } from '../../system/icon';
4
+ import type { PressableFeedbackProps } from '../../system/pressable-feedback';
5
+ import type { ViewStyleProps } from '../../system/style-props';
6
+ import type { Size } from '../../theme/theme.type';
7
+ export type RatingSlot = 'root' | 'item' | 'glyph' | 'glyphFill';
8
+ /**
9
+ * Three, naming **which colour a filled mark takes** — the only thing this component paints
10
+ * that is a decision. The unfilled marks keep a neutral fill, which is the ground the filled
11
+ * ones are read against.
12
+ *
13
+ * - `primary` — the accent.
14
+ * - `secondary` — the neutral foreground.
15
+ * - `tertiary` — the page's own foreground, for a rating on a coloured card.
16
+ *
17
+ * The amber every store uses is not a token here, because it is not a role the theme has an
18
+ * opinion about — it is `color="#f59e0b"`, which is what a raw tint is for (R7). `warning`
19
+ * is deliberately not offered in its place: it is a status, and a four-star review is not a
20
+ * warning.
21
+ */
22
+ export type RatingVariant = 'primary' | 'secondary' | 'tertiary';
23
+ export type RatingSize = Size;
24
+ /** Which layer of a mark a glyph is drawn in. */
25
+ export type RatingTone = 'empty' | 'fill';
26
+ type RatingOwnProps = {
27
+ variant?: RatingVariant;
28
+ /** The mark's size and the gap between marks. */
29
+ size?: RatingSize;
30
+ /** A raw tint (R7) for the filled marks. The unfilled ones keep their neutral ground. */
31
+ color?: string;
32
+ /** How many marks. @default 5 */
33
+ max?: number;
34
+ /** Controlled. Leave it out and the rating keeps the value itself. */
35
+ value?: number;
36
+ /** The starting value when uncontrolled. @default 0 */
37
+ defaultValue?: number;
38
+ onValueChange?: (value: number) => void;
39
+ /**
40
+ * The step a press lands on. `1` is whole marks, `0.5` halves.
41
+ *
42
+ * It governs **input only** — a `value` of any precision displays as it is, so an average
43
+ * of 4.3 fills the fifth mark three tenths of the way whatever this says.
44
+ *
45
+ * @default 1
46
+ */
47
+ precision?: number;
48
+ /**
49
+ * A display rather than a control: the marks stop responding and announce themselves as
50
+ * an image showing a value, not as buttons.
51
+ */
52
+ isReadOnly?: boolean;
53
+ isDisabled?: boolean;
54
+ /**
55
+ * **The glyph**, drawn once per mark, in each of the two layers a mark has:
56
+ *
57
+ * ```tsx
58
+ * <Rating max={5} value={value} onValueChange={setValue}>
59
+ * <Rating.Icon as={HeartIcon} />
60
+ * </Rating>
61
+ * ```
62
+ *
63
+ * One element rather than a row of them, because the number of marks is `max` — data, not
64
+ * markup — and five hand-written marks is a row that disagrees with the prop the moment
65
+ * either changes. Left out, the mark is a star.
66
+ *
67
+ * A label beside the row is **not** in here: that is a `Typography` in a `Row`, and it is
68
+ * the screen's rather than the rating's (R1).
69
+ */
70
+ children?: ReactNode;
71
+ style?: StyleProp<ViewStyle>;
72
+ };
73
+ /** R14 — it renders a `View`, so it carries that node's style keys. */
74
+ export type RatingProps = RatingOwnProps & Omit<ViewProps, 'style' | 'children'> & Omit<ViewStyleProps, keyof RatingOwnProps>;
75
+ export type RatingItemProps = Omit<PressableFeedbackProps, 'isPressed' | 'layout' | 'style' | 'children'> & {
76
+ /** Which mark this is, counted from zero. */
77
+ index: number;
78
+ /** R9 — `Pressable`'s function form as much as an object or an array. */
79
+ style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
80
+ children?: ReactNode;
81
+ };
82
+ export type RatingIconProps = IconProps;
83
+ /** R5 — resolved styles, not props for a slot to resolve a second time. */
84
+ export type RatingContextValue = {
85
+ itemStyle: StyleProp<ViewStyle>;
86
+ glyphStyle: StyleProp<TextStyle>;
87
+ glyphFillStyle: StyleProp<TextStyle>;
88
+ /**
89
+ * Values, not a style: `Icon` hands `size` and `color` to a third-party component, so the
90
+ * root flattens each layer once here rather than in every glyph it contains.
91
+ */
92
+ icon: IconContextValue;
93
+ iconFill: IconContextValue;
94
+ /** How wide one mark is, which is what the fill layer is clipped against. */
95
+ markSize: number;
96
+ value: number;
97
+ max: number;
98
+ precision: number;
99
+ /** What a mark calls with the fraction of itself that was pressed. */
100
+ select: (index: number, ratio: number) => void;
101
+ isReadOnly: boolean;
102
+ isDisabled: boolean;
103
+ };
104
+ /** Which layer a glyph is in, so it needs no prop to know which colour it takes. */
105
+ export type RatingLayerContextValue = {
106
+ tone: RatingTone;
107
+ };
108
+ export {};
@@ -0,0 +1,108 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { PressableStateCallbackType, StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native';
3
+ import type { IconContextValue, IconProps } from '../../system/icon';
4
+ import type { PressableFeedbackProps } from '../../system/pressable-feedback';
5
+ import type { ViewStyleProps } from '../../system/style-props';
6
+ import type { Size } from '../../theme/theme.type';
7
+ export type RatingSlot = 'root' | 'item' | 'glyph' | 'glyphFill';
8
+ /**
9
+ * Three, naming **which colour a filled mark takes** — the only thing this component paints
10
+ * that is a decision. The unfilled marks keep a neutral fill, which is the ground the filled
11
+ * ones are read against.
12
+ *
13
+ * - `primary` — the accent.
14
+ * - `secondary` — the neutral foreground.
15
+ * - `tertiary` — the page's own foreground, for a rating on a coloured card.
16
+ *
17
+ * The amber every store uses is not a token here, because it is not a role the theme has an
18
+ * opinion about — it is `color="#f59e0b"`, which is what a raw tint is for (R7). `warning`
19
+ * is deliberately not offered in its place: it is a status, and a four-star review is not a
20
+ * warning.
21
+ */
22
+ export type RatingVariant = 'primary' | 'secondary' | 'tertiary';
23
+ export type RatingSize = Size;
24
+ /** Which layer of a mark a glyph is drawn in. */
25
+ export type RatingTone = 'empty' | 'fill';
26
+ type RatingOwnProps = {
27
+ variant?: RatingVariant;
28
+ /** The mark's size and the gap between marks. */
29
+ size?: RatingSize;
30
+ /** A raw tint (R7) for the filled marks. The unfilled ones keep their neutral ground. */
31
+ color?: string;
32
+ /** How many marks. @default 5 */
33
+ max?: number;
34
+ /** Controlled. Leave it out and the rating keeps the value itself. */
35
+ value?: number;
36
+ /** The starting value when uncontrolled. @default 0 */
37
+ defaultValue?: number;
38
+ onValueChange?: (value: number) => void;
39
+ /**
40
+ * The step a press lands on. `1` is whole marks, `0.5` halves.
41
+ *
42
+ * It governs **input only** — a `value` of any precision displays as it is, so an average
43
+ * of 4.3 fills the fifth mark three tenths of the way whatever this says.
44
+ *
45
+ * @default 1
46
+ */
47
+ precision?: number;
48
+ /**
49
+ * A display rather than a control: the marks stop responding and announce themselves as
50
+ * an image showing a value, not as buttons.
51
+ */
52
+ isReadOnly?: boolean;
53
+ isDisabled?: boolean;
54
+ /**
55
+ * **The glyph**, drawn once per mark, in each of the two layers a mark has:
56
+ *
57
+ * ```tsx
58
+ * <Rating max={5} value={value} onValueChange={setValue}>
59
+ * <Rating.Icon as={HeartIcon} />
60
+ * </Rating>
61
+ * ```
62
+ *
63
+ * One element rather than a row of them, because the number of marks is `max` — data, not
64
+ * markup — and five hand-written marks is a row that disagrees with the prop the moment
65
+ * either changes. Left out, the mark is a star.
66
+ *
67
+ * A label beside the row is **not** in here: that is a `Typography` in a `Row`, and it is
68
+ * the screen's rather than the rating's (R1).
69
+ */
70
+ children?: ReactNode;
71
+ style?: StyleProp<ViewStyle>;
72
+ };
73
+ /** R14 — it renders a `View`, so it carries that node's style keys. */
74
+ export type RatingProps = RatingOwnProps & Omit<ViewProps, 'style' | 'children'> & Omit<ViewStyleProps, keyof RatingOwnProps>;
75
+ export type RatingItemProps = Omit<PressableFeedbackProps, 'isPressed' | 'layout' | 'style' | 'children'> & {
76
+ /** Which mark this is, counted from zero. */
77
+ index: number;
78
+ /** R9 — `Pressable`'s function form as much as an object or an array. */
79
+ style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
80
+ children?: ReactNode;
81
+ };
82
+ export type RatingIconProps = IconProps;
83
+ /** R5 — resolved styles, not props for a slot to resolve a second time. */
84
+ export type RatingContextValue = {
85
+ itemStyle: StyleProp<ViewStyle>;
86
+ glyphStyle: StyleProp<TextStyle>;
87
+ glyphFillStyle: StyleProp<TextStyle>;
88
+ /**
89
+ * Values, not a style: `Icon` hands `size` and `color` to a third-party component, so the
90
+ * root flattens each layer once here rather than in every glyph it contains.
91
+ */
92
+ icon: IconContextValue;
93
+ iconFill: IconContextValue;
94
+ /** How wide one mark is, which is what the fill layer is clipped against. */
95
+ markSize: number;
96
+ value: number;
97
+ max: number;
98
+ precision: number;
99
+ /** What a mark calls with the fraction of itself that was pressed. */
100
+ select: (index: number, ratio: number) => void;
101
+ isReadOnly: boolean;
102
+ isDisabled: boolean;
103
+ };
104
+ /** Which layer a glyph is in, so it needs no prop to know which colour it takes. */
105
+ export type RatingLayerContextValue = {
106
+ tone: RatingTone;
107
+ };
108
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * How much of the mark at `index` is filled, from 0 to 1.
3
+ *
4
+ * A fraction rather than a boolean, and that is what lets one component be both halves of
5
+ * the job: an average of 4.3 fills the fifth mark three tenths of the way, where a boolean
6
+ * would have to round it to 4 and lose the thing the average was for.
7
+ */
8
+ export declare function fillFor(value: number, index: number): number;
9
+ export type SnapOptions = {
10
+ /** Where the press landed, in marks — `2.34` is a third of the way into the third. */
11
+ raw: number;
12
+ /** The step a press lands on. `1` is whole marks, `0.5` halves. */
13
+ precision: number;
14
+ max: number;
15
+ };
16
+ /**
17
+ * The value a press at `raw` marks means.
18
+ *
19
+ * It rounds **up**, which is the only rounding that matches what a finger meant: a tap
20
+ * anywhere in the first mark is one star, not zero, and with `precision={0.5}` a tap on the
21
+ * left half of the third is 2.5 while the right half is 3. Rounding to nearest would make
22
+ * the first sliver of every mark select the one before it, so the leftmost strip of the row
23
+ * would silently rate zero.
24
+ *
25
+ * Clamped into `[precision, max]`: the smallest thing a press can express is one step, and
26
+ * no press can exceed the row it landed in.
27
+ */
28
+ export declare function snapValue({ raw, precision, max }: SnapOptions): number;