@kanso-labs/react-native-kanso-ui 0.0.0-stage → 0.1.1

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 (145) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +205 -2
  3. package/dist/button/index.d.ts +56 -0
  4. package/dist/button/index.js +169 -0
  5. package/dist/button/index.js.map +1 -0
  6. package/dist/button/palettes.js +47 -0
  7. package/dist/button/palettes.js.map +1 -0
  8. package/dist/chip/index.js +194 -0
  9. package/dist/chip/index.js.map +1 -0
  10. package/dist/chip/styles.js +36 -0
  11. package/dist/chip/styles.js.map +1 -0
  12. package/dist/clipboard/index.js +58 -0
  13. package/dist/clipboard/index.js.map +1 -0
  14. package/dist/components/avatar/index.d.ts +82 -0
  15. package/dist/components/avatar/index.js +62 -0
  16. package/dist/components/avatar/index.js.map +1 -0
  17. package/dist/components/button/index.d.ts +87 -0
  18. package/dist/components/button/index.js +377 -0
  19. package/dist/components/button/index.js.map +1 -0
  20. package/dist/components/card/index.d.ts +78 -0
  21. package/dist/components/card/index.js +315 -0
  22. package/dist/components/card/index.js.map +1 -0
  23. package/dist/components/checkbox/index.d.ts +76 -0
  24. package/dist/components/checkbox/index.js +360 -0
  25. package/dist/components/checkbox/index.js.map +1 -0
  26. package/dist/components/chip/index.d.ts +84 -0
  27. package/dist/components/chip/index.js +257 -0
  28. package/dist/components/chip/index.js.map +1 -0
  29. package/dist/components/chip-group/index.d.ts +143 -0
  30. package/dist/components/chip-group/index.js +669 -0
  31. package/dist/components/chip-group/index.js.map +1 -0
  32. package/dist/components/copy-field/index.d.ts +60 -0
  33. package/dist/components/copy-field/index.js +277 -0
  34. package/dist/components/copy-field/index.js.map +1 -0
  35. package/dist/components/currency/index.d.ts +69 -0
  36. package/dist/components/currency/index.js +162 -0
  37. package/dist/components/currency/index.js.map +1 -0
  38. package/dist/components/form/index.d.ts +84 -0
  39. package/dist/components/form/index.js +95 -0
  40. package/dist/components/form/index.js.map +1 -0
  41. package/dist/components/icon-button/index.d.ts +68 -0
  42. package/dist/components/icon-button/index.js +289 -0
  43. package/dist/components/icon-button/index.js.map +1 -0
  44. package/dist/components/link/index.d.ts +59 -0
  45. package/dist/components/link/index.js +191 -0
  46. package/dist/components/link/index.js.map +1 -0
  47. package/dist/components/number-field/index.d.ts +151 -0
  48. package/dist/components/number-field/index.js +832 -0
  49. package/dist/components/number-field/index.js.map +1 -0
  50. package/dist/components/product-icon/index.d.ts +70 -0
  51. package/dist/components/product-icon/index.js +60 -0
  52. package/dist/components/product-icon/index.js.map +1 -0
  53. package/dist/components/radio-group/index.d.ts +105 -0
  54. package/dist/components/radio-group/index.js +597 -0
  55. package/dist/components/radio-group/index.js.map +1 -0
  56. package/dist/components/search-field/index.d.ts +98 -0
  57. package/dist/components/search-field/index.js +521 -0
  58. package/dist/components/search-field/index.js.map +1 -0
  59. package/dist/components/segmented-button/index.d.ts +113 -0
  60. package/dist/components/segmented-button/index.js +937 -0
  61. package/dist/components/segmented-button/index.js.map +1 -0
  62. package/dist/components/separator/index.d.ts +45 -0
  63. package/dist/components/separator/index.js +109 -0
  64. package/dist/components/separator/index.js.map +1 -0
  65. package/dist/components/stack/index.d.ts +70 -0
  66. package/dist/components/stack/index.js +107 -0
  67. package/dist/components/stack/index.js.map +1 -0
  68. package/dist/components/switch/index.d.ts +76 -0
  69. package/dist/components/switch/index.js +591 -0
  70. package/dist/components/switch/index.js.map +1 -0
  71. package/dist/components/text/index.d.ts +44 -0
  72. package/dist/components/text/index.js +78 -0
  73. package/dist/components/text/index.js.map +1 -0
  74. package/dist/components/text-field/index.d.ts +146 -0
  75. package/dist/components/text-field/index.js +228 -0
  76. package/dist/components/text-field/index.js.map +1 -0
  77. package/dist/control/index.js +117 -0
  78. package/dist/control/index.js.map +1 -0
  79. package/dist/control/styles.js +36 -0
  80. package/dist/control/styles.js.map +1 -0
  81. package/dist/field/index.d.ts +13 -0
  82. package/dist/field/index.js +1007 -0
  83. package/dist/field/index.js.map +1 -0
  84. package/dist/field/styles.js +131 -0
  85. package/dist/field/styles.js.map +1 -0
  86. package/dist/form/index.d.ts +24 -0
  87. package/dist/form/index.js +209 -0
  88. package/dist/form/index.js.map +1 -0
  89. package/dist/glyphs/icon-style.d.ts +25 -0
  90. package/dist/glyphs/icon-style.js +22 -0
  91. package/dist/glyphs/icon-style.js.map +1 -0
  92. package/dist/glyphs/index.js +170 -0
  93. package/dist/glyphs/index.js.map +1 -0
  94. package/dist/glyphs/styles.js +7 -0
  95. package/dist/glyphs/styles.js.map +1 -0
  96. package/dist/hooks/useWindowSizeClass.d.ts +25 -0
  97. package/dist/hooks/useWindowSizeClass.js +39 -0
  98. package/dist/hooks/useWindowSizeClass.js.map +1 -0
  99. package/dist/index.d.ts +31 -0
  100. package/dist/index.js +27 -0
  101. package/dist/mark/image.js +61 -0
  102. package/dist/mark/image.js.map +1 -0
  103. package/dist/mark/index.d.ts +9 -0
  104. package/dist/mark/index.js +234 -0
  105. package/dist/mark/index.js.map +1 -0
  106. package/dist/mark/initials.js +65 -0
  107. package/dist/mark/initials.js.map +1 -0
  108. package/dist/mark/styles.d.ts +1 -0
  109. package/dist/mark/styles.js +73 -0
  110. package/dist/mark/styles.js.map +1 -0
  111. package/dist/number/parser.js +321 -0
  112. package/dist/number/parser.js.map +1 -0
  113. package/dist/number/state.js +235 -0
  114. package/dist/number/state.js.map +1 -0
  115. package/dist/overlay/host.js +111 -0
  116. package/dist/overlay/host.js.map +1 -0
  117. package/dist/press/index.js +350 -0
  118. package/dist/press/index.js.map +1 -0
  119. package/dist/press/styles.js +31 -0
  120. package/dist/press/styles.js.map +1 -0
  121. package/dist/router/index.d.ts +28 -0
  122. package/dist/router/index.js +82 -0
  123. package/dist/router/index.js.map +1 -0
  124. package/dist/theme/color.js +25 -0
  125. package/dist/theme/color.js.map +1 -0
  126. package/dist/theme/resolve.d.ts +6 -0
  127. package/dist/theme/resolve.js +310 -0
  128. package/dist/theme/resolve.js.map +1 -0
  129. package/dist/theme/scope.d.ts +42 -0
  130. package/dist/theme/scope.js +80 -0
  131. package/dist/theme/scope.js.map +1 -0
  132. package/dist/theme/styles.js +39 -0
  133. package/dist/theme/styles.js.map +1 -0
  134. package/dist/theme-scope.d.ts +56 -0
  135. package/dist/theme-scope.js +127 -0
  136. package/dist/theme-scope.js.map +1 -0
  137. package/dist/tokens/defaults.d.ts +407 -0
  138. package/dist/tokens/defaults.js +403 -0
  139. package/dist/tokens/defaults.js.map +1 -0
  140. package/dist/typography/fonts.js +84 -0
  141. package/dist/typography/fonts.js.map +1 -0
  142. package/dist/typography/roles.d.ts +10 -0
  143. package/dist/typography/roles.js +82 -0
  144. package/dist/typography/roles.js.map +1 -0
  145. package/package.json +132 -4
@@ -0,0 +1,113 @@
1
+ import { PressableProps, StyleProp, View, ViewProps, ViewStyle } from "react-native";
2
+ import { ReactNode, Ref } from "react";
3
+ import { Key } from "react-stately";
4
+ //#region src/components/segmented-button/index.d.ts
5
+ /** A name for the set: its own label, or the id of what labels it. */
6
+ type LabelledBy = {
7
+ readonly 'aria-label': string;
8
+ readonly 'aria-labelledby'?: string;
9
+ } | {
10
+ readonly 'aria-label'?: string;
11
+ readonly 'aria-labelledby': string;
12
+ };
13
+ type SegmentedButtonProps = LabelledBy & Omit<ViewProps, 'aria-label' | 'aria-labelledby' | 'children' | 'style'> & {
14
+ /** The segments, each a `SegmentedButton.Segment` with an `id`. */
15
+ readonly children?: ReactNode;
16
+ /** The keys chosen at first, when the set keeps its own selection. */
17
+ readonly defaultSelectedKeys?: Iterable<Key>;
18
+ /**
19
+ * Whether the chosen segment stays chosen when it is pressed again. On
20
+ * by default while one is chosen, since a radio group always holds a
21
+ * choice; `false` lets a press clear it. Off by default while several
22
+ * may be, where any of them can be turned off.
23
+ * @default true while one is chosen, false while several may be
24
+ */
25
+ readonly disallowEmptySelection?: boolean;
26
+ /**
27
+ * Disables every segment.
28
+ * @default false
29
+ */
30
+ readonly isDisabled?: boolean;
31
+ /** Called with the chosen keys when the choice changes. */
32
+ readonly onSelectionChange?: (keys: Set<Key>) => void;
33
+ readonly ref?: Ref<View>;
34
+ /** The chosen keys, when the call site holds the selection. */
35
+ readonly selectedKeys?: Iterable<Key>;
36
+ /**
37
+ * Whether one segment is chosen at a time, or several.
38
+ * @default 'single'
39
+ */
40
+ readonly selectionMode?: SelectionMode$1;
41
+ /**
42
+ * Whether a chosen segment draws a check before its label, as the page
43
+ * has it. `false` leaves the segment's own icon in place while chosen,
44
+ * and draws the chosen segment on the stronger secondary container.
45
+ * @default true
46
+ */
47
+ readonly showSelectedIcon?: boolean;
48
+ readonly style?: StyleProp<ViewStyle>;
49
+ };
50
+ type SegmentedButtonSegmentProps = Omit<PressableProps, 'children' | 'disabled' | 'id' | 'style'> & {
51
+ /** The segment's label. */
52
+ readonly children?: ReactNode;
53
+ /**
54
+ * Draws no press ripple. The hover and pressed state layers are unaffected.
55
+ * @default false
56
+ */
57
+ readonly disableRipple?: boolean;
58
+ /**
59
+ * An icon before the label, in the page's 18dp slot, which hands it the
60
+ * label's colour and its size through `useIconStyle()`. Replaced by the
61
+ * check while the segment is chosen, unless the set turns that off.
62
+ *
63
+ * Given with no label, the icon is the segment, centred in it and kept
64
+ * while chosen; name the segment with `aria-label` then.
65
+ */
66
+ readonly icon?: ReactNode;
67
+ /** The key the selection reports the segment by. */
68
+ readonly id: Key;
69
+ /**
70
+ * Disables the segment alone.
71
+ * @default false
72
+ */
73
+ readonly isDisabled?: boolean;
74
+ readonly ref?: Ref<View>;
75
+ readonly style?: StyleProp<ViewStyle>;
76
+ };
77
+ type SelectionMode$1 = 'multiple' | 'single';
78
+ /**
79
+ * A row of two to five joined segments, of which one, or with
80
+ * `selectionMode="multiple"` several, is chosen. Pass `selectedKeys` with
81
+ * `onSelectionChange` to hold the choice, or `defaultSelectedKeys` to let the
82
+ * set keep its own. Give every segment an `id`, which is the key the choice
83
+ * is reported by.
84
+ *
85
+ * ```tsx
86
+ * <SegmentedButton aria-label="Label" defaultSelectedKeys={['first']}>
87
+ * <SegmentedButton.Segment id="first">First item</SegmentedButton.Segment>
88
+ * <SegmentedButton.Segment id="second">Second item</SegmentedButton.Segment>
89
+ * </SegmentedButton>
90
+ * ```
91
+ *
92
+ * Name the set with `aria-label` or `aria-labelledby`, one of which the
93
+ * props require. Choosing one is announced as a radio group, and choosing
94
+ * several as a toolbar of buttons that each say whether they are selected.
95
+ *
96
+ * `style`, `ref` and `testID` land on the track.
97
+ */
98
+ declare function SegmentedButton({ children, defaultSelectedKeys, disallowEmptySelection, isDisabled, onSelectionChange, selectedKeys, selectionMode, showSelectedIcon, style, ...props }: SegmentedButtonProps): import("react").JSX.Element;
99
+ declare namespace SegmentedButton {
100
+ var Segment: typeof SegmentedButtonSegment;
101
+ }
102
+ /**
103
+ * One segment. Its `id` is the key the choice reports it by, and its label is
104
+ * what names it. A chosen segment draws a check before its label; one not
105
+ * chosen draws its `icon`, if it has one. Renders nothing outside a
106
+ * `SegmentedButton`.
107
+ *
108
+ * `style`, `ref` and `testID` land on the segment's `Pressable`.
109
+ */
110
+ declare function SegmentedButtonSegment({ children, disableRipple, hitSlop: ownHitSlop, icon, id, isDisabled: ownDisabled, onBlur, onFocus, onHoverIn, onHoverOut, onLayout, onPress, onPressIn, onPressOut, style, ...props }: SegmentedButtonSegmentProps): import("react").JSX.Element | null;
111
+ //#endregion
112
+ export { SegmentedButton, type SegmentedButtonProps, SegmentedButtonSegment, type SegmentedButtonSegmentProps };
113
+ //# sourceMappingURL=index.d.ts.map