@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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 (253) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/badge/index.js +9 -70
  5. package/dist/badge/index.js.map +1 -1
  6. package/dist/button/group.d.ts +5 -0
  7. package/dist/button/group.js +115 -0
  8. package/dist/button/group.js.map +1 -0
  9. package/dist/button/index.d.ts +4 -1
  10. package/dist/button/index.js +45 -23
  11. package/dist/button/index.js.map +1 -1
  12. package/dist/button/palettes.d.ts +2 -0
  13. package/dist/button/slots.js +2 -1
  14. package/dist/button/slots.js.map +1 -1
  15. package/dist/calendar/index.js +351 -182
  16. package/dist/calendar/index.js.map +1 -1
  17. package/dist/calendar/styles.js +33 -2
  18. package/dist/calendar/styles.js.map +1 -1
  19. package/dist/carousel/arrangement.d.ts +5 -0
  20. package/dist/carousel/arrangement.js +123 -0
  21. package/dist/carousel/arrangement.js.map +1 -0
  22. package/dist/chequer/index.js +95 -0
  23. package/dist/chequer/index.js.map +1 -0
  24. package/dist/collection/index.d.ts +157 -0
  25. package/dist/collection/index.js +1331 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/color-thumb/index.js +56 -0
  28. package/dist/color-thumb/index.js.map +1 -0
  29. package/dist/components/badge/index.d.ts +48 -0
  30. package/dist/components/badge/index.js +122 -0
  31. package/dist/components/badge/index.js.map +1 -0
  32. package/dist/{badge → components/badge}/styles.js +10 -6
  33. package/dist/components/badge/styles.js.map +1 -0
  34. package/dist/components/breadcrumbs/index.d.ts +66 -0
  35. package/dist/components/breadcrumbs/index.js +285 -0
  36. package/dist/components/breadcrumbs/index.js.map +1 -0
  37. package/dist/components/button/index.d.ts +4 -2
  38. package/dist/components/button/index.js +227 -188
  39. package/dist/components/button/index.js.map +1 -1
  40. package/dist/components/button-group/index.d.ts +87 -0
  41. package/dist/components/button-group/index.js +275 -0
  42. package/dist/components/button-group/index.js.map +1 -0
  43. package/dist/components/calendar/index.d.ts +11 -3
  44. package/dist/components/calendar/index.js +60 -45
  45. package/dist/components/calendar/index.js.map +1 -1
  46. package/dist/components/carousel/index.d.ts +72 -0
  47. package/dist/components/carousel/index.js +496 -0
  48. package/dist/components/carousel/index.js.map +1 -0
  49. package/dist/components/checkbox/index.d.ts +7 -1
  50. package/dist/components/checkbox/index.js +183 -138
  51. package/dist/components/checkbox/index.js.map +1 -1
  52. package/dist/components/checkbox-group/index.d.ts +92 -0
  53. package/dist/components/checkbox-group/index.js +306 -0
  54. package/dist/components/checkbox-group/index.js.map +1 -0
  55. package/dist/components/code/index.d.ts +25 -0
  56. package/dist/components/code/index.js +87 -0
  57. package/dist/components/code/index.js.map +1 -0
  58. package/dist/components/color-area/index.d.ts +85 -0
  59. package/dist/components/color-area/index.js +630 -0
  60. package/dist/components/color-area/index.js.map +1 -0
  61. package/dist/components/color-field/index.d.ts +144 -0
  62. package/dist/components/color-field/index.js +516 -0
  63. package/dist/components/color-field/index.js.map +1 -0
  64. package/dist/components/color-picker/index.d.ts +74 -0
  65. package/dist/components/color-picker/index.js +317 -0
  66. package/dist/components/color-picker/index.js.map +1 -0
  67. package/dist/components/color-slider/index.d.ts +82 -0
  68. package/dist/components/color-slider/index.js +456 -0
  69. package/dist/components/color-slider/index.js.map +1 -0
  70. package/dist/components/color-swatch/index.d.ts +46 -0
  71. package/dist/components/color-swatch/index.js +127 -0
  72. package/dist/components/color-swatch/index.js.map +1 -0
  73. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  74. package/dist/components/color-swatch-picker/index.js +287 -0
  75. package/dist/components/color-swatch-picker/index.js.map +1 -0
  76. package/dist/components/color-wheel/index.d.ts +71 -0
  77. package/dist/components/color-wheel/index.js +407 -0
  78. package/dist/components/color-wheel/index.js.map +1 -0
  79. package/dist/components/combo-box/index.d.ts +193 -0
  80. package/dist/components/combo-box/index.js +616 -0
  81. package/dist/components/combo-box/index.js.map +1 -0
  82. package/dist/components/container/index.d.ts +47 -0
  83. package/dist/components/container/index.js +85 -0
  84. package/dist/components/container/index.js.map +1 -0
  85. package/dist/components/date-field/index.d.ts +120 -0
  86. package/dist/components/date-field/index.js +111 -0
  87. package/dist/components/date-field/index.js.map +1 -0
  88. package/dist/components/date-picker/index.d.ts +130 -0
  89. package/dist/components/date-picker/index.js +310 -0
  90. package/dist/components/date-picker/index.js.map +1 -0
  91. package/dist/components/date-range-picker/index.d.ts +139 -0
  92. package/dist/components/date-range-picker/index.js +421 -0
  93. package/dist/components/date-range-picker/index.js.map +1 -0
  94. package/dist/components/disclosure/index.d.ts +94 -0
  95. package/dist/components/disclosure/index.js +365 -0
  96. package/dist/components/disclosure/index.js.map +1 -0
  97. package/dist/components/disclosure-group/index.d.ts +61 -0
  98. package/dist/components/disclosure-group/index.js +100 -0
  99. package/dist/components/disclosure-group/index.js.map +1 -0
  100. package/dist/components/drop-zone/index.d.ts +113 -0
  101. package/dist/components/drop-zone/index.js +304 -0
  102. package/dist/components/drop-zone/index.js.map +1 -0
  103. package/dist/components/fab/index.d.ts +80 -0
  104. package/dist/components/fab/index.js +246 -0
  105. package/dist/components/fab/index.js.map +1 -0
  106. package/dist/components/fab-menu/index.d.ts +120 -0
  107. package/dist/components/fab-menu/index.js +640 -0
  108. package/dist/components/fab-menu/index.js.map +1 -0
  109. package/dist/components/feed/index.d.ts +57 -0
  110. package/dist/components/feed/index.js +167 -0
  111. package/dist/components/feed/index.js.map +1 -0
  112. package/dist/components/form/index.d.ts +3 -2
  113. package/dist/components/form/index.js.map +1 -1
  114. package/dist/components/icon-button/index.d.ts +4 -2
  115. package/dist/components/icon-button/index.js +204 -171
  116. package/dist/components/icon-button/index.js.map +1 -1
  117. package/dist/components/keycap/index.d.ts +27 -0
  118. package/dist/components/keycap/index.js +136 -0
  119. package/dist/components/keycap/index.js.map +1 -0
  120. package/dist/components/list/index.d.ts +15 -158
  121. package/dist/components/list/index.js +21 -1047
  122. package/dist/components/list/index.js.map +1 -1
  123. package/dist/components/list-box/index.d.ts +73 -0
  124. package/dist/components/list-box/index.js +82 -0
  125. package/dist/components/list-box/index.js.map +1 -0
  126. package/dist/components/loading-indicator/index.d.ts +32 -0
  127. package/dist/components/loading-indicator/index.js +174 -0
  128. package/dist/components/loading-indicator/index.js.map +1 -0
  129. package/dist/components/menu/index.js +1 -1
  130. package/dist/components/navigation-tree/index.d.ts +117 -0
  131. package/dist/components/navigation-tree/index.js +135 -0
  132. package/dist/components/navigation-tree/index.js.map +1 -0
  133. package/dist/components/number-field/index.js +132 -143
  134. package/dist/components/number-field/index.js.map +1 -1
  135. package/dist/components/range-calendar/index.d.ts +69 -0
  136. package/dist/components/range-calendar/index.js +144 -0
  137. package/dist/components/range-calendar/index.js.map +1 -0
  138. package/dist/components/search-view/index.d.ts +78 -0
  139. package/dist/components/search-view/index.js +570 -0
  140. package/dist/components/search-view/index.js.map +1 -0
  141. package/dist/components/select/index.d.ts +152 -0
  142. package/dist/components/select/index.js +419 -0
  143. package/dist/components/select/index.js.map +1 -0
  144. package/dist/components/separator/index.d.ts +3 -2
  145. package/dist/components/separator/index.js +29 -26
  146. package/dist/components/separator/index.js.map +1 -1
  147. package/dist/components/slider/index.d.ts +111 -0
  148. package/dist/components/slider/index.js +673 -0
  149. package/dist/components/slider/index.js.map +1 -0
  150. package/dist/components/split-button/index.d.ts +77 -0
  151. package/dist/components/split-button/index.js +354 -0
  152. package/dist/components/split-button/index.js.map +1 -0
  153. package/dist/components/supporting-pane/index.d.ts +44 -0
  154. package/dist/components/supporting-pane/index.js +109 -0
  155. package/dist/components/supporting-pane/index.js.map +1 -0
  156. package/dist/components/tabs/index.d.ts +196 -0
  157. package/dist/components/tabs/index.js +1137 -0
  158. package/dist/components/tabs/index.js.map +1 -0
  159. package/dist/components/text/index.d.ts +1 -1
  160. package/dist/components/text/index.js +49 -21
  161. package/dist/components/text/index.js.map +1 -1
  162. package/dist/components/text-area/index.d.ts +145 -0
  163. package/dist/components/text-area/index.js +231 -0
  164. package/dist/components/text-area/index.js.map +1 -0
  165. package/dist/components/time-field/index.d.ts +43 -0
  166. package/dist/components/time-field/index.js +107 -0
  167. package/dist/components/time-field/index.js.map +1 -0
  168. package/dist/components/time-picker/index.d.ts +65 -0
  169. package/dist/components/time-picker/index.js +1168 -0
  170. package/dist/components/time-picker/index.js.map +1 -0
  171. package/dist/components/toolbar/index.d.ts +53 -0
  172. package/dist/components/toolbar/index.js +185 -0
  173. package/dist/components/toolbar/index.js.map +1 -0
  174. package/dist/components/tooltip/index.d.ts +101 -0
  175. package/dist/components/tooltip/index.js +223 -0
  176. package/dist/components/tooltip/index.js.map +1 -0
  177. package/dist/components/tree/index.d.ts +112 -0
  178. package/dist/components/tree/index.js +157 -0
  179. package/dist/components/tree/index.js.map +1 -0
  180. package/dist/control/group.js +23 -0
  181. package/dist/control/group.js.map +1 -0
  182. package/dist/disclosure/chevron.js +75 -0
  183. package/dist/disclosure/chevron.js.map +1 -0
  184. package/dist/disclosure/index.js +7 -0
  185. package/dist/disclosure/index.js.map +1 -0
  186. package/dist/drop/index.d.ts +54 -0
  187. package/dist/drop/index.js +161 -0
  188. package/dist/drop/index.js.map +1 -0
  189. package/dist/fab/index.d.ts +19 -0
  190. package/dist/fab/index.js +147 -0
  191. package/dist/fab/index.js.map +1 -0
  192. package/dist/field/chevron.js +74 -0
  193. package/dist/field/chevron.js.map +1 -0
  194. package/dist/field/index.d.ts +2 -1
  195. package/dist/field/index.js +350 -153
  196. package/dist/field/index.js.map +1 -1
  197. package/dist/field/styles.js +27 -0
  198. package/dist/field/styles.js.map +1 -1
  199. package/dist/files/index.d.ts +18 -0
  200. package/dist/files/index.js +107 -0
  201. package/dist/files/index.js.map +1 -0
  202. package/dist/form/index.d.ts +6 -4
  203. package/dist/form/index.js +64 -85
  204. package/dist/form/index.js.map +1 -1
  205. package/dist/glyphs/index.js +92 -1
  206. package/dist/glyphs/index.js.map +1 -1
  207. package/dist/i18n/index.js +20 -1
  208. package/dist/i18n/index.js.map +1 -1
  209. package/dist/i18n/messages.js +1394 -34
  210. package/dist/i18n/messages.js.map +1 -1
  211. package/dist/index.d.ts +51 -6
  212. package/dist/index.js +47 -4
  213. package/dist/indicator/paths.js +23 -1
  214. package/dist/indicator/paths.js.map +1 -1
  215. package/dist/modal/index.js +96 -68
  216. package/dist/modal/index.js.map +1 -1
  217. package/dist/navigation/index.js +8 -5
  218. package/dist/navigation/index.js.map +1 -1
  219. package/dist/number/keyboard.js +16 -0
  220. package/dist/number/keyboard.js.map +1 -0
  221. package/dist/overlay/anchored.js +68 -38
  222. package/dist/overlay/anchored.js.map +1 -1
  223. package/dist/overlay/keyboard.js +57 -0
  224. package/dist/overlay/keyboard.js.map +1 -0
  225. package/dist/overlay/panel.js +173 -19
  226. package/dist/overlay/panel.js.map +1 -1
  227. package/dist/overlay/placement.js +16 -2
  228. package/dist/overlay/placement.js.map +1 -1
  229. package/dist/picker/index.js +322 -0
  230. package/dist/picker/index.js.map +1 -0
  231. package/dist/press/index.d.ts +2 -0
  232. package/dist/press/index.js +102 -100
  233. package/dist/press/index.js.map +1 -1
  234. package/dist/row/index.js +77 -69
  235. package/dist/row/index.js.map +1 -1
  236. package/dist/row/styles.js +13 -2
  237. package/dist/row/styles.js.map +1 -1
  238. package/dist/segments/field.js +277 -0
  239. package/dist/segments/field.js.map +1 -0
  240. package/dist/segments/index.js +574 -0
  241. package/dist/segments/index.js.map +1 -0
  242. package/dist/segments/styles.js +24 -0
  243. package/dist/segments/styles.js.map +1 -0
  244. package/dist/separator/index.js +7 -0
  245. package/dist/separator/index.js.map +1 -0
  246. package/dist/slider/index.js +145 -0
  247. package/dist/slider/index.js.map +1 -0
  248. package/dist/swatch/index.js +56 -0
  249. package/dist/swatch/index.js.map +1 -0
  250. package/dist/typography/size.js +14 -0
  251. package/dist/typography/size.js.map +1 -0
  252. package/package.json +11 -2
  253. package/dist/badge/styles.js.map +0 -1
@@ -1,7 +1,9 @@
1
1
  import { useTheme } from "../../theme/scope.js";
2
2
  import { composeStyles, themedStyles } from "../../theme/styles.js";
3
+ import { SeparatorOrientationContext } from "../../separator/index.js";
3
4
  import { c } from "react/compiler-runtime";
4
5
  import { StyleSheet, View } from "react-native";
6
+ import { use } from "react";
5
7
  import { jsx } from "react/jsx-runtime";
6
8
  //#region src/components/separator/index.tsx
7
9
  const styles = StyleSheet.create({
@@ -58,50 +60,51 @@ const VERTICAL = { "aria-orientation": "vertical" };
58
60
  */
59
61
  function Separator(t0) {
60
62
  const $ = c(14);
63
+ let own;
61
64
  let props;
62
65
  let style;
63
66
  let t1;
64
- let t2;
65
67
  if ($[0] !== t0) {
66
- ({inset: t1, orientation: t2, style, ...props} = t0);
68
+ ({inset: t1, orientation: own, style, ...props} = t0);
67
69
  $[0] = t0;
68
- $[1] = props;
69
- $[2] = style;
70
- $[3] = t1;
71
- $[4] = t2;
70
+ $[1] = own;
71
+ $[2] = props;
72
+ $[3] = style;
73
+ $[4] = t1;
72
74
  } else {
73
- props = $[1];
74
- style = $[2];
75
- t1 = $[3];
76
- t2 = $[4];
75
+ own = $[1];
76
+ props = $[2];
77
+ style = $[3];
78
+ t1 = $[4];
77
79
  }
78
80
  const inset = t1 === void 0 ? "none" : t1;
79
- const orientation = t2 === void 0 ? "horizontal" : t2;
80
81
  const theme = useTheme();
81
- const t3 = orientation === "vertical" ? VERTICAL : void 0;
82
- let t4;
82
+ const provided = use(SeparatorOrientationContext);
83
+ const orientation = own ?? provided ?? "horizontal";
84
+ const t2 = orientation === "vertical" ? VERTICAL : void 0;
85
+ let t3;
83
86
  if ($[5] !== inset || $[6] !== orientation || $[7] !== style || $[8] !== theme) {
84
- t4 = composeStyles(styles[orientation], fillOf(theme).rule, insetsOf(theme)[orientation][inset], style);
87
+ t3 = composeStyles(styles[orientation], fillOf(theme).rule, insetsOf(theme)[orientation][inset], style);
85
88
  $[5] = inset;
86
89
  $[6] = orientation;
87
90
  $[7] = style;
88
91
  $[8] = theme;
89
- $[9] = t4;
90
- } else t4 = $[9];
91
- let t5;
92
- if ($[10] !== props || $[11] !== t3 || $[12] !== t4) {
93
- t5 = /* @__PURE__ */ jsx(View, {
92
+ $[9] = t3;
93
+ } else t3 = $[9];
94
+ let t4;
95
+ if ($[10] !== props || $[11] !== t2 || $[12] !== t3) {
96
+ t4 = /* @__PURE__ */ jsx(View, {
94
97
  role: "separator",
95
- ...t3,
98
+ ...t2,
96
99
  ...props,
97
- style: t4
100
+ style: t3
98
101
  });
99
102
  $[10] = props;
100
- $[11] = t3;
101
- $[12] = t4;
102
- $[13] = t5;
103
- } else t5 = $[13];
104
- return t5;
103
+ $[11] = t2;
104
+ $[12] = t3;
105
+ $[13] = t4;
106
+ } else t4 = $[13];
107
+ return t4;
105
108
  }
106
109
  //#endregion
107
110
  export { Separator };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ComponentRef","Ref","ViewProps","ViewStyle","StyleSheet","View","useTheme","composeStyles","themedStyles","styles","create","horizontal","alignSelf","flexShrink","height","vertical","width","fillOf","colors","rule","backgroundColor","outlineVariant","insetsOf","spacing","both","marginEnd","lg","marginStart","none","start","marginBottom","marginTop","VERTICAL","SeparatorInset","SeparatorProps","inset","orientation","ref","Separator","t0","$","_c","props","style","t1","t2","undefined","theme","t3","t4","t5","_c"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { ViewProps, ViewStyle } from 'react-native'\n\nimport { StyleSheet, View } from 'react-native'\n\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own, as on web: the design system treats the two\n// as one decision.\n//\n// Drawn as a filled 1dp view rather than as a border, so the rule is the view\n// itself, which flex `gap` and anything measuring it can see.\n//\n// A rule has no length of its own. `alignSelf: 'stretch'` takes it from the\n// parent's cross axis: a horizontal rule spans a column, which is what a\n// `View` is by default, and a vertical one spans a row. A rule between two\n// rows should match whatever they turn out to be rather than being told a\n// length at the call site, and in a parent running the same way as the rule\n// it has none, which is the documented cost.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The page\n// names them \"inset\" and \"middle-inset\"; the prop says `start` and `both`, as\n// on web, since the two words say which ends move. The inset is a margin on\n// the axis the rule runs along, which shortens a stretched rule rather than\n// pushing it out of its parent. A horizontal rule's is `marginStart`, which\n// React Native puts on the right under right-to-left.\nconst styles = StyleSheet.create({\n horizontal: {\n alignSelf: 'stretch',\n flexShrink: 0,\n height: 1,\n },\n vertical: {\n alignSelf: 'stretch',\n flexShrink: 0,\n width: 1,\n },\n})\n\nconst fillOf = themedStyles(({ colors }) =>\n StyleSheet.create({\n rule: { backgroundColor: colors.outlineVariant },\n }),\n)\n\n// The page's 16dp, on the axis the rule runs along.\nconst insetsOf = themedStyles(({ spacing }) => ({\n horizontal: StyleSheet.create({\n both: { marginEnd: spacing.lg, marginStart: spacing.lg },\n none: {},\n start: { marginStart: spacing.lg },\n }),\n vertical: StyleSheet.create({\n both: { marginBottom: spacing.lg, marginTop: spacing.lg },\n none: {},\n start: { marginTop: spacing.lg },\n }),\n}))\n\n// React Native Web writes `aria-orientation` onto the element, which React\n// Native's types do not name. A horizontal rule needs none, since that is the\n// separator role's own default.\nconst VERTICAL: { readonly 'aria-orientation': 'vertical' } = {\n 'aria-orientation': 'vertical',\n}\n\ntype SeparatorInset = 'both' | 'none' | 'start'\n\ntype SeparatorProps = ViewProps & {\n /**\n * How far the rule is held off the ends it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both` holds\n * it off each end, which is its middle-inset one. The inset follows the\n * writing direction rather than a fixed side.\n * @default 'none'\n */\n readonly inset?: SeparatorInset\n /**\n * Which way the rule runs. A rule takes its length from its parent: a\n * horizontal one spans a column, and a vertical one a row.\n * @default 'horizontal'\n */\n readonly orientation?: 'horizontal' | 'vertical'\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/**\n * A 1dp rule between items, in the outline-variant colour, carrying the\n * separator role.\n *\n * ```tsx\n * <Stack gap=\"none\">\n * <Text>First item</Text>\n * <Separator inset=\"start\" />\n * <Text>Second item</Text>\n * </Stack>\n * ```\n *\n * `inset` holds the rule off the ends it runs between, `start` off the\n * leading one and `both` off each, which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * Web draws the rule again as a border under forced colours, which neither\n * iOS nor Android has. `style`, `ref` and `testID` land on the `View`, and a\n * `style` there applies over the rule's own.\n */\nfunction Separator({\n inset = 'none',\n orientation = 'horizontal',\n style,\n ...props\n}: SeparatorProps) {\n const theme = useTheme()\n\n return (\n <View\n role=\"separator\"\n {...(orientation === 'vertical' ? VERTICAL : undefined)}\n {...props}\n style={composeStyles<ViewStyle>(\n styles[orientation],\n fillOf(theme).rule,\n insetsOf(theme)[orientation][inset],\n style,\n )}\n />\n )\n}\n\nexport type { SeparatorInset, SeparatorProps }\n\nexport { Separator }\n"],"mappings":";;;;;;AA6BA,MAAMS,SAASL,WAAWM,OAAO;CAC/BC,YAAY;EACVC,WAAW;EACXC,YAAY;EACZC,QAAQ;CACV;CACAC,UAAU;EACRH,WAAW;EACXC,YAAY;EACZG,OAAO;CACT;AACF,CAAC;AAED,MAAMC,SAAST,cAAc,EAAEU,aAC7Bd,WAAWM,OAAO,EAChBS,MAAM,EAAEC,iBAAiBF,OAAOG,eAAe,EACjD,CAAC,CACH;AAGA,MAAMC,WAAWd,cAAc,EAAEe,eAAe;CAC9CZ,YAAYP,WAAWM,OAAO;EAC5Bc,MAAM;GAAEC,WAAWF,QAAQG;GAAIC,aAAaJ,QAAQG;EAAG;EACvDE,MAAM,CAAC;EACPC,OAAO,EAAEF,aAAaJ,QAAQG,GAAG;CACnC,CAAC;CACDX,UAAUX,WAAWM,OAAO;EAC1Bc,MAAM;GAAEM,cAAcP,QAAQG;GAAIK,WAAWR,QAAQG;EAAG;EACxDE,MAAM,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GAAiD,GAClDN;GACG,OAAAO;EAKN,CAAA;EACDT,EAAA,MAAAE;EAAAF,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAVFU;AAUE"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","Ref","ViewProps","ViewStyle","use","StyleSheet","View","SeparatorOrientationContext","useTheme","composeStyles","themedStyles","styles","create","horizontal","alignSelf","flexShrink","height","vertical","width","fillOf","colors","rule","backgroundColor","outlineVariant","insetsOf","spacing","both","marginEnd","lg","marginStart","none","start","marginBottom","marginTop","VERTICAL","SeparatorInset","SeparatorProps","inset","orientation","ref","Separator","t0","$","_c","own","props","style","t1","undefined","theme","provided","t2","t3","t4","_c"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { ViewProps, ViewStyle } from 'react-native'\n\nimport { use } from 'react'\nimport { StyleSheet, View } from 'react-native'\n\nimport { SeparatorOrientationContext } from '../../separator'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own, as on web: the design system treats the two\n// as one decision.\n//\n// Drawn as a filled 1dp view rather than as a border, so the rule is the view\n// itself, which flex `gap` and anything measuring it can see.\n//\n// A rule has no length of its own. `alignSelf: 'stretch'` takes it from the\n// parent's cross axis: a horizontal rule spans a column, which is what a\n// `View` is by default, and a vertical one spans a row. A rule between two\n// rows should match whatever they turn out to be rather than being told a\n// length at the call site, and in a parent running the same way as the rule\n// it has none, which is the documented cost.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The page\n// names them \"inset\" and \"middle-inset\"; the prop says `start` and `both`, as\n// on web, since the two words say which ends move. The inset is a margin on\n// the axis the rule runs along, which shortens a stretched rule rather than\n// pushing it out of its parent. A horizontal rule's is `marginStart`, which\n// React Native puts on the right under right-to-left.\nconst styles = StyleSheet.create({\n horizontal: {\n alignSelf: 'stretch',\n flexShrink: 0,\n height: 1,\n },\n vertical: {\n alignSelf: 'stretch',\n flexShrink: 0,\n width: 1,\n },\n})\n\nconst fillOf = themedStyles(({ colors }) =>\n StyleSheet.create({\n rule: { backgroundColor: colors.outlineVariant },\n }),\n)\n\n// The page's 16dp, on the axis the rule runs along.\nconst insetsOf = themedStyles(({ spacing }) => ({\n horizontal: StyleSheet.create({\n both: { marginEnd: spacing.lg, marginStart: spacing.lg },\n none: {},\n start: { marginStart: spacing.lg },\n }),\n vertical: StyleSheet.create({\n both: { marginBottom: spacing.lg, marginTop: spacing.lg },\n none: {},\n start: { marginTop: spacing.lg },\n }),\n}))\n\n// React Native Web writes `aria-orientation` onto the element, which React\n// Native's types do not name. A horizontal rule needs none, since that is the\n// separator role's own default.\nconst VERTICAL: { readonly 'aria-orientation': 'vertical' } = {\n 'aria-orientation': 'vertical',\n}\n\ntype SeparatorInset = 'both' | 'none' | 'start'\n\ntype SeparatorProps = ViewProps & {\n /**\n * How far the rule is held off the ends it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both` holds\n * it off each end, which is its middle-inset one. The inset follows the\n * writing direction rather than a fixed side.\n * @default 'none'\n */\n readonly inset?: SeparatorInset\n /**\n * Which way the rule runs. A rule takes its length from its parent: a\n * horizontal one spans a column, and a vertical one a row. Inside a\n * `Toolbar` it runs across the bar unless this says otherwise.\n * @default 'horizontal'\n */\n readonly orientation?: 'horizontal' | 'vertical'\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/**\n * A 1dp rule between items, in the outline-variant colour, carrying the\n * separator role.\n *\n * ```tsx\n * <Stack gap=\"none\">\n * <Text>First item</Text>\n * <Separator inset=\"start\" />\n * <Text>Second item</Text>\n * </Stack>\n * ```\n *\n * `inset` holds the rule off the ends it runs between, `start` off the\n * leading one and `both` off each, which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * Web draws the rule again as a border under forced colours, which neither\n * iOS nor Android has. `style`, `ref` and `testID` land on the `View`, and a\n * `style` there applies over the rule's own.\n */\nfunction Separator({\n inset = 'none',\n orientation: own,\n style,\n ...props\n}: SeparatorProps) {\n const theme = useTheme()\n const provided = use(SeparatorOrientationContext)\n const orientation = own ?? provided ?? 'horizontal'\n\n return (\n <View\n role=\"separator\"\n {...(orientation === 'vertical' ? VERTICAL : undefined)}\n {...props}\n style={composeStyles<ViewStyle>(\n styles[orientation],\n fillOf(theme).rule,\n insetsOf(theme)[orientation][inset],\n style,\n )}\n />\n )\n}\n\nexport type { SeparatorInset, SeparatorProps }\n\nexport { Separator }\n"],"mappings":";;;;;;;;AA+BA,MAAMW,SAASN,WAAWO,OAAO;CAC/BC,YAAY;EACVC,WAAW;EACXC,YAAY;EACZC,QAAQ;CACV;CACAC,UAAU;EACRH,WAAW;EACXC,YAAY;EACZG,OAAO;CACT;AACF,CAAC;AAED,MAAMC,SAAST,cAAc,EAAEU,aAC7Bf,WAAWO,OAAO,EAChBS,MAAM,EAAEC,iBAAiBF,OAAOG,eAAe,EACjD,CAAC,CACH;AAGA,MAAMC,WAAWd,cAAc,EAAEe,eAAe;CAC9CZ,YAAYR,WAAWO,OAAO;EAC5Bc,MAAM;GAAEC,WAAWF,QAAQG;GAAIC,aAAaJ,QAAQG;EAAG;EACvDE,MAAM,CAAC;EACPC,OAAO,EAAEF,aAAaJ,QAAQG,GAAG;CACnC,CAAC;CACDX,UAAUZ,WAAWO,OAAO;EAC1Bc,MAAM;GAAEM,cAAcP,QAAQG;GAAIK,WAAWR,QAAQG;EAAG;EACxDE,MAAM,CAAC;EACPC,OAAO,EAAEE,WAAWR,QAAQG,GAAG;CACjC,CAAC;AACH,EAAE;AAKF,MAAMM,WAAwD,EAC5D,oBAAoB,WACtB;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAAM,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CA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yleProp, View, ViewStyle } from "react-native";
2
+ import { ComponentRef, ReactNode, Ref } from "react";
3
+ //#region src/components/slider/index.d.ts
4
+ type SliderProps = {
5
+ /**
6
+ * The slider's name for a screen reader, when no `label` is drawn: a
7
+ * slider that a row labels some other way leaves `label` out and passes
8
+ * this instead.
9
+ */
10
+ readonly 'aria-label'?: string;
11
+ /** The value the slider starts at, when it keeps its own. */
12
+ readonly defaultValue?: number | number[];
13
+ /**
14
+ * How the value reads, in the indicator and to a screen reader, in the
15
+ * provider's locale.
16
+ */
17
+ readonly formatOptions?: Intl.NumberFormatOptions;
18
+ /**
19
+ * The page's inset icon, at the start of the active part, from `md` up:
20
+ * the page gives it a size at M, L and XL alone. Drawn for a single
21
+ * handle, and only while the active part has room for it. It reads its
22
+ * colour and size through `useIconStyle()`.
23
+ */
24
+ readonly icon?: ReactNode;
25
+ /**
26
+ * Draws the slider disabled, and takes no presses, drags or screen reader
27
+ * actions.
28
+ * @default false
29
+ */
30
+ readonly isDisabled?: boolean;
31
+ /**
32
+ * What the slider sets. A slider that a row labels some other way leaves
33
+ * it out and passes `aria-label` instead.
34
+ */
35
+ readonly label?: string;
36
+ /**
37
+ * The largest value.
38
+ * @default 100
39
+ */
40
+ readonly maxValue?: number;
41
+ /**
42
+ * The smallest value.
43
+ * @default 0
44
+ */
45
+ readonly minValue?: number;
46
+ /** Called with the value as it moves. */
47
+ readonly onChange?: (value: number | number[]) => void;
48
+ /** Called with the value once a drag, a press or an action has ended. */
49
+ readonly onChangeEnd?: (value: number | number[]) => void;
50
+ /**
51
+ * Along which axis the handle moves. A vertical slider is 240dp tall until
52
+ * `style` says otherwise.
53
+ * @default 'horizontal'
54
+ */
55
+ readonly orientation?: 'horizontal' | 'vertical';
56
+ readonly ref?: Ref<ComponentRef<typeof View>>;
57
+ /**
58
+ * A stop at every step, the page's stops configuration, so the reader can
59
+ * see where the handle can land. Meant for a slider with a handful of
60
+ * steps: each stop is a 4dp dot, and a fine step draws a crowd of them.
61
+ * @default false
62
+ */
63
+ readonly showStops?: boolean;
64
+ /**
65
+ * The page's sizes, by the track's thickness: 16dp at `xs`, 24dp at `sm`,
66
+ * 40dp at `md`, 56dp at `lg` and 96dp at `xl`, with the handle 44dp long
67
+ * up to `sm` and 52dp, 68dp and 108dp past it.
68
+ * @default 'xs'
69
+ */
70
+ readonly size?: SliderSize;
71
+ /**
72
+ * The distance between two values the handle can land on.
73
+ * @default 1
74
+ */
75
+ readonly step?: number;
76
+ readonly style?: StyleProp<ViewStyle>;
77
+ readonly testID?: string;
78
+ /**
79
+ * A name for each handle of a range slider, in order, since two handles
80
+ * named by the same label cannot be told apart.
81
+ */
82
+ readonly thumbLabels?: readonly string[];
83
+ /**
84
+ * The value, for a call site holding it itself with `onChange`: a number
85
+ * for one handle, or an array of numbers for a handle each.
86
+ */
87
+ readonly value?: number | number[];
88
+ };
89
+ type SliderSize = 'lg' | 'md' | 'sm' | 'xl' | 'xs';
90
+ /**
91
+ * A slider for one value, or for a range when the value is an array. Its
92
+ * state is React Stately's, as web's is: pass `value` with `onChange` to
93
+ * control it, or `defaultValue` to let it keep its own, with `minValue`,
94
+ * `maxValue` and `step` to shape it and `formatOptions` to say how it reads.
95
+ *
96
+ * ```tsx
97
+ * <Slider defaultValue={40} label="Label" />
98
+ * ```
99
+ *
100
+ * A press on the track moves the nearest handle there, and a drag carries
101
+ * it. A screen reader hears each handle as an adjustable control named by the
102
+ * label, which it moves a step at a time. `style`, `ref` and `testID` land on
103
+ * the slider as a whole, which is the view a layout positions and the one
104
+ * that gives a vertical slider its height. With a `testID`, the drag and the
105
+ * press are registered with Gesture Handler as `<testID>-pan` and
106
+ * `<testID>-tap`, which its `getByGestureTestId` finds in a test.
107
+ */
108
+ declare function Slider({ 'aria-label': ariaLabel, defaultValue, formatOptions, icon, isDisabled, label, maxValue, minValue, onChange, onChangeEnd, orientation, ref, showStops, size, step, style, testID, thumbLabels, value }: SliderProps): import("react").JSX.Element;
109
+ //#endregion
110
+ export { Slider, type SliderProps, type SliderSize };
111
+ //# sourceMappingURL=index.d.ts.map