@kanso-labs/react-native-kanso-ui 0.10.0 → 0.11.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 (46) hide show
  1. package/dist/collection/index.js +107 -80
  2. package/dist/collection/index.js.map +1 -1
  3. package/dist/components/chip/index.d.ts +4 -1
  4. package/dist/components/chip/index.js +229 -161
  5. package/dist/components/chip/index.js.map +1 -1
  6. package/dist/components/dialog/index.d.ts +5 -5
  7. package/dist/components/dialog/index.js +5 -5
  8. package/dist/components/dialog/index.js.map +1 -1
  9. package/dist/components/drop-zone/index.d.ts +3 -3
  10. package/dist/components/drop-zone/index.js +2 -2
  11. package/dist/components/drop-zone/index.js.map +1 -1
  12. package/dist/components/menu/index.d.ts +3 -3
  13. package/dist/components/menu/index.js +3 -3
  14. package/dist/components/menu/index.js.map +1 -1
  15. package/dist/components/popover/index.d.ts +2 -2
  16. package/dist/components/popover/index.js +2 -2
  17. package/dist/components/popover/index.js.map +1 -1
  18. package/dist/components/search-view/index.d.ts +3 -2
  19. package/dist/components/search-view/index.js +3 -2
  20. package/dist/components/search-view/index.js.map +1 -1
  21. package/dist/components/sheet/index.d.ts +16 -7
  22. package/dist/components/sheet/index.js +157 -152
  23. package/dist/components/sheet/index.js.map +1 -1
  24. package/dist/components/table/index.d.ts +391 -0
  25. package/dist/components/table/index.js +1708 -0
  26. package/dist/components/table/index.js.map +1 -0
  27. package/dist/components/token-field/index.d.ts +105 -0
  28. package/dist/components/token-field/index.js +574 -0
  29. package/dist/components/token-field/index.js.map +1 -0
  30. package/dist/components/tooltip/index.d.ts +2 -1
  31. package/dist/components/tooltip/index.js.map +1 -1
  32. package/dist/field/index.js +50 -1
  33. package/dist/field/index.js.map +1 -1
  34. package/dist/field/styles.js +9 -1
  35. package/dist/field/styles.js.map +1 -1
  36. package/dist/glyphs/index.js +37 -1
  37. package/dist/glyphs/index.js.map +1 -1
  38. package/dist/i18n/index.js +17 -1
  39. package/dist/i18n/index.js.map +1 -1
  40. package/dist/i18n/messages.js +340 -0
  41. package/dist/i18n/messages.js.map +1 -1
  42. package/dist/index.d.ts +4 -2
  43. package/dist/index.js +4 -2
  44. package/dist/slider/index.js +1 -1
  45. package/dist/slider/index.js.map +1 -1
  46. package/package.json +1 -1
@@ -571,26 +571,38 @@ function* loaderNode(props) {
571
571
  type: "loader"
572
572
  };
573
573
  }
574
+ function LoaderRow() {
575
+ const $ = c(2);
576
+ const t0 = useCollection().loadMore ?? IDLE;
577
+ let t1;
578
+ if ($[0] !== t0) {
579
+ t1 = /* @__PURE__ */ jsx(LoadingRow, { ...t0 });
580
+ $[0] = t0;
581
+ $[1] = t1;
582
+ } else t1 = $[1];
583
+ return t1;
584
+ }
574
585
  /**
575
- * The row the `LoadMore` part draws: a live region, empty while idle and
586
+ * The row a `LoadMore` part draws: a live region, empty while idle and
576
587
  * holding the ring while loading. Android and React Native Web say what
577
588
  * arrives in it; iOS has no live regions, so the ring's name is said there
578
- * as it appears.
589
+ * as it appears. A List's and a ListBox's, and a Table's, which draws it
590
+ * after its rows at a row's own height.
579
591
  */
580
- function LoaderRow() {
592
+ function LoadingRow(t0) {
581
593
  const $ = c(8);
594
+ const { isLoading: t1, label, style, testID } = t0;
595
+ const isLoading = t1 === void 0 ? false : t1;
582
596
  const own = stylesOf(useTheme());
583
- const { isLoading: t0, label, style, testID } = useCollection().loadMore ?? IDLE;
584
- const isLoading = t0 === void 0 ? false : t0;
585
597
  const messages = useMessages();
586
598
  const name = label ?? messages.loadingMore;
587
599
  useLoadingAnnouncement(isLoading, name);
588
600
  const T0 = View;
589
- const t1 = "polite";
590
- const t2 = composeStyles(isLoading ? own.loading : styles.idle, style);
591
- let t3;
601
+ const t2 = "polite";
602
+ const t3 = composeStyles(isLoading ? own.loading : styles.idle, style);
603
+ let t4;
592
604
  if ($[0] !== isLoading || $[1] !== name) {
593
- t3 = isLoading ? /* @__PURE__ */ jsx(ProgressIndicator, {
605
+ t4 = isLoading ? /* @__PURE__ */ jsx(ProgressIndicator, {
594
606
  "aria-label": name,
595
607
  diameter: LOADING_DIAMETER,
596
608
  isIndeterminate: true,
@@ -598,23 +610,23 @@ function LoaderRow() {
598
610
  }) : null;
599
611
  $[0] = isLoading;
600
612
  $[1] = name;
601
- $[2] = t3;
602
- } else t3 = $[2];
603
- let t4;
604
- if ($[3] !== T0 || $[4] !== t2 || $[5] !== t3 || $[6] !== testID) {
605
- t4 = /* @__PURE__ */ jsx(T0, {
606
- "aria-live": t1,
607
- style: t2,
613
+ $[2] = t4;
614
+ } else t4 = $[2];
615
+ let t5;
616
+ if ($[3] !== T0 || $[4] !== t3 || $[5] !== t4 || $[6] !== testID) {
617
+ t5 = /* @__PURE__ */ jsx(T0, {
618
+ "aria-live": t2,
619
+ style: t3,
608
620
  testID,
609
- children: t3
621
+ children: t4
610
622
  });
611
623
  $[3] = T0;
612
- $[4] = t2;
613
- $[5] = t3;
624
+ $[4] = t3;
625
+ $[5] = t4;
614
626
  $[6] = testID;
615
- $[7] = t4;
616
- } else t4 = $[7];
617
- return t4;
627
+ $[7] = t5;
628
+ } else t5 = $[7];
629
+ return t5;
618
630
  }
619
631
  function loadMoreOf({ isLoading = false, onLoadMore }) {
620
632
  return () => {
@@ -653,48 +665,27 @@ function renderEntry({ item }) {
653
665
  }
654
666
  /**
655
667
  * How many rows a search leaves, said to a screen reader as it changes and
656
- * never drawn: in a polite live region on Android and under React Native
657
- * Web, and through `AccessibilityInfo` on iOS, which has no live regions,
658
- * so nothing is drawn there at all. A `count` of `null` says nothing, for a
668
+ * never drawn, through `Status`. A `count` of `null` says nothing, for a
659
669
  * list that is closed, so the count is said again as it opens.
660
670
  */
661
671
  function ResultsStatus(t0) {
662
- const $ = c(8);
672
+ const $ = c(5);
663
673
  const { count } = t0;
664
- const t1 = useTheme();
665
- let t2;
666
- if ($[0] !== t1) {
667
- t2 = stylesOf(t1);
668
- $[0] = t1;
669
- $[1] = t2;
670
- } else t2 = $[1];
671
- const own = t2;
672
674
  const locale = useLocaleOf(void 0);
673
- let t3;
674
- if ($[2] !== count || $[3] !== locale) {
675
- t3 = count === null ? "" : resultsFor(count, locale);
676
- $[2] = count;
677
- $[3] = locale;
678
- $[4] = t3;
679
- } else t3 = $[4];
680
- const message = t3;
681
- useResultsAnnouncement(message);
682
- if (Platform.OS === "ios") return null;
683
- let t4;
684
- if ($[5] !== message || $[6] !== own.status) {
685
- t4 = /* @__PURE__ */ jsx(View, {
686
- "aria-live": "polite",
687
- style: styles.status,
688
- children: /* @__PURE__ */ jsx(Text, {
689
- style: own.status,
690
- children: message
691
- })
692
- });
693
- $[5] = message;
694
- $[6] = own.status;
695
- $[7] = t4;
696
- } else t4 = $[7];
697
- return t4;
675
+ let t1;
676
+ if ($[0] !== count || $[1] !== locale) {
677
+ t1 = count === null ? "" : resultsFor(count, locale);
678
+ $[0] = count;
679
+ $[1] = locale;
680
+ $[2] = t1;
681
+ } else t1 = $[2];
682
+ let t2;
683
+ if ($[3] !== t1) {
684
+ t2 = /* @__PURE__ */ jsx(Status, { message: t1 });
685
+ $[3] = t1;
686
+ $[4] = t2;
687
+ } else t2 = $[4];
688
+ return t2;
698
689
  }
699
690
  /**
700
691
  * The list's layout handler: the call site's own, then a scroll that brings
@@ -1199,6 +1190,42 @@ function SelectBox(t0) {
1199
1190
  return t3;
1200
1191
  }
1201
1192
  /**
1193
+ * A message said to a screen reader as it changes and never drawn: in a
1194
+ * polite live region on Android and under React Native Web, and through
1195
+ * `AccessibilityInfo` on iOS, which has no live regions, so nothing is drawn
1196
+ * there at all. The message a status mounts with is not said, and an empty
1197
+ * one says nothing. A search's count of rows, and a table's sort.
1198
+ */
1199
+ function Status(t0) {
1200
+ const $ = c(5);
1201
+ const { message } = t0;
1202
+ const t1 = useTheme();
1203
+ let t2;
1204
+ if ($[0] !== t1) {
1205
+ t2 = stylesOf(t1);
1206
+ $[0] = t1;
1207
+ $[1] = t2;
1208
+ } else t2 = $[1];
1209
+ const own = t2;
1210
+ useAnnouncement(message);
1211
+ if (Platform.OS === "ios") return null;
1212
+ let t3;
1213
+ if ($[2] !== message || $[3] !== own.status) {
1214
+ t3 = /* @__PURE__ */ jsx(View, {
1215
+ "aria-live": "polite",
1216
+ style: styles.status,
1217
+ children: /* @__PURE__ */ jsx(Text, {
1218
+ style: own.status,
1219
+ children: message
1220
+ })
1221
+ });
1222
+ $[2] = message;
1223
+ $[3] = own.status;
1224
+ $[4] = t3;
1225
+ } else t3 = $[4];
1226
+ return t3;
1227
+ }
1228
+ /**
1202
1229
  * Opens a tree's row, or closes it when it is open. Built by a call rather
1203
1230
  * than written inline, which is what react-perf's
1204
1231
  * no-new-function-as-prop is after.
@@ -1269,6 +1296,26 @@ function treeLead({ box, chevron, indent, leading, style }) {
1269
1296
  ]
1270
1297
  });
1271
1298
  }
1299
+ function useAnnouncement(message) {
1300
+ const $ = c(3);
1301
+ const was = useRef(message);
1302
+ let t0;
1303
+ let t1;
1304
+ if ($[0] !== message) {
1305
+ t0 = () => {
1306
+ if (message !== was.current && message !== "" && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(message);
1307
+ was.current = message;
1308
+ };
1309
+ t1 = [message];
1310
+ $[0] = message;
1311
+ $[1] = t0;
1312
+ $[2] = t1;
1313
+ } else {
1314
+ t0 = $[1];
1315
+ t1 = $[2];
1316
+ }
1317
+ useEffect(t0, t1);
1318
+ }
1272
1319
  function useCollection() {
1273
1320
  const collection = use(CollectionContext);
1274
1321
  if (collection === null) throw new Error("A List or ListBox part is drawn by the one it is in.");
@@ -1295,26 +1342,6 @@ function useLoadingAnnouncement(isLoading, label) {
1295
1342
  }
1296
1343
  useEffect(t0, t1);
1297
1344
  }
1298
- function useResultsAnnouncement(message) {
1299
- const $ = c(3);
1300
- const was = useRef(message);
1301
- let t0;
1302
- let t1;
1303
- if ($[0] !== message) {
1304
- t0 = () => {
1305
- if (message !== was.current && message !== "" && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(message);
1306
- was.current = message;
1307
- };
1308
- t1 = [message];
1309
- $[0] = message;
1310
- $[1] = t0;
1311
- $[2] = t1;
1312
- } else {
1313
- t0 = $[1];
1314
- t1 = $[2];
1315
- }
1316
- useEffect(t0, t1);
1317
- }
1318
1345
  /**
1319
1346
  * The leading slot of a List's row that selects: the checkbox, then whatever
1320
1347
  * the row was given, in a row of their own so the two sit side by side.
@@ -1326,6 +1353,6 @@ function withBox(box, leading, style) {
1326
1353
  }) : box;
1327
1354
  }
1328
1355
  //#endregion
1329
- export { Collection, CollectionView, ResultsStatus, focusKeyOf, loaderNode, nestedRowNode, rowCountOf, rowNode, sectionNode };
1356
+ export { Collection, CollectionView, LoadingRow, ResultsStatus, SelectBox, Status, accessibilityActionOf, childElementsOf, focusKeyOf, loadMoreOf, loaderNode, nestedRowNode, noop, pressThen, rowCountOf, rowNode, sectionNode };
1330
1357
 
1331
1358
  //# sourceMappingURL=index.js.map