@kanso-labs/react-native-kanso-ui 0.11.24 → 0.11.26

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 (36) hide show
  1. package/README.md +27 -0
  2. package/dist/calendar/index.js +105 -41
  3. package/dist/calendar/index.js.map +1 -1
  4. package/dist/calendar/styles.js +7 -0
  5. package/dist/calendar/styles.js.map +1 -1
  6. package/dist/components/calendar/index.d.ts +2 -2
  7. package/dist/components/calendar/index.js.map +1 -1
  8. package/dist/components/carousel/index.d.ts +24 -3
  9. package/dist/components/carousel/index.js +58 -35
  10. package/dist/components/carousel/index.js.map +1 -1
  11. package/dist/components/color-picker/index.js +98 -93
  12. package/dist/components/color-picker/index.js.map +1 -1
  13. package/dist/components/dialog/index.js +7 -2
  14. package/dist/components/dialog/index.js.map +1 -1
  15. package/dist/components/range-calendar/index.d.ts +2 -2
  16. package/dist/components/range-calendar/index.js.map +1 -1
  17. package/dist/components/search-view/index.js.map +1 -1
  18. package/dist/components/segmented-button/index.js +108 -88
  19. package/dist/components/segmented-button/index.js.map +1 -1
  20. package/dist/components/sheet/index.js +8 -4
  21. package/dist/components/sheet/index.js.map +1 -1
  22. package/dist/components/table/index.js +1 -0
  23. package/dist/components/table/index.js.map +1 -1
  24. package/dist/field/index.d.ts +1 -1
  25. package/dist/field/index.js +112 -161
  26. package/dist/field/index.js.map +1 -1
  27. package/dist/field/styles.js +4 -0
  28. package/dist/field/styles.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/number/parser.js +3 -3
  31. package/dist/number/parser.js.map +1 -1
  32. package/dist/overlay/keyboard.js +100 -27
  33. package/dist/overlay/keyboard.js.map +1 -1
  34. package/dist/segments/index.js +1 -1
  35. package/dist/segments/index.js.map +1 -1
  36. package/package.json +15 -11
package/README.md CHANGED
@@ -113,6 +113,33 @@ draw Gesture Handler's root view around their own track, so an app need not wrap
113
113
  itself in `GestureHandlerRootView` for them, and one that already does loses
114
114
  nothing.
115
115
 
116
+ ### The keyboard
117
+
118
+ A `Sheet`, a `Dialog` and a `SearchView` keep what they hold above the software
119
+ keyboard. React Native draws edge to edge on Android, so the keyboard covers the
120
+ window rather than shrinking it, and each of them is a `Modal`, a window of its
121
+ own, whose keyboard Android reports to nothing React Native listens to. Install
122
+ [react-native-keyboard-controller](https://kirillzyusko.github.io/react-native-keyboard-controller/),
123
+ an optional peer, and mount its provider at the root of the app, for those
124
+ reports to reach the library:
125
+
126
+ ```bash
127
+ npx expo install react-native-keyboard-controller
128
+ ```
129
+
130
+ ```tsx
131
+ import { KeyboardProvider } from 'react-native-keyboard-controller'
132
+
133
+ ;<KeyboardProvider navigationBarTranslucent statusBarTranslucent>
134
+ <App />
135
+ </KeyboardProvider>
136
+ ```
137
+
138
+ Without it, iOS keeps the overlays above the keyboard all the same, and Android
139
+ does so only for a field in the app's own window. A screen of the app's own is
140
+ the app's to keep clear, with the controller's `KeyboardAwareScrollView` or
141
+ `KeyboardAvoidingView`.
142
+
116
143
  ## Routing
117
144
 
118
145
  A component with an `href` presses through the app's router once the app is
@@ -38,7 +38,7 @@ const ROWS_ABOVE_SHOWN = 3;
38
38
  * shown, both years where they are two, as web's does.
39
39
  */
40
40
  function CalendarFrame(t0) {
41
- const $ = c(28);
41
+ const $ = c(30);
42
42
  const { firstDayOfWeek, locale, months, showMonthYearMenus, state } = t0;
43
43
  const t1 = useTheme();
44
44
  let t2;
@@ -49,79 +49,87 @@ function CalendarFrame(t0) {
49
49
  } else t2 = $[1];
50
50
  const own = t2;
51
51
  const sideBySide = useSideBySide(months);
52
+ const stacked = months > 1 && !sideBySide;
52
53
  const t3 = sideBySide ? own.monthsSideBySide : own.months;
53
54
  let t4;
54
- if ($[2] !== firstDayOfWeek || $[3] !== locale || $[4] !== months || $[5] !== own.monthSideBySide || $[6] !== sideBySide || $[7] !== state) {
55
+ if ($[2] !== firstDayOfWeek || $[3] !== locale || $[4] !== months || $[5] !== own.monthSideBySide || $[6] !== sideBySide || $[7] !== stacked || $[8] !== state) {
55
56
  let t5;
56
- if ($[9] !== firstDayOfWeek || $[10] !== locale || $[11] !== own.monthSideBySide || $[12] !== sideBySide || $[13] !== state) {
57
- t5 = (offset) => /* @__PURE__ */ jsx(View, {
57
+ if ($[10] !== firstDayOfWeek || $[11] !== locale || $[12] !== own.monthSideBySide || $[13] !== sideBySide || $[14] !== stacked || $[15] !== state) {
58
+ t5 = (offset) => /* @__PURE__ */ jsxs(View, {
58
59
  style: sideBySide ? own.monthSideBySide : void 0,
59
- children: /* @__PURE__ */ jsx(MonthGrid, {
60
+ children: [stacked ? /* @__PURE__ */ jsx(MonthCaption, {
61
+ locale,
62
+ offset,
63
+ state
64
+ }) : null, /* @__PURE__ */ jsx(MonthGrid, {
60
65
  firstDayOfWeek,
61
66
  locale,
62
67
  offset,
68
+ stacked,
63
69
  state
64
- })
70
+ })]
65
71
  }, offset.months);
66
- $[9] = firstDayOfWeek;
67
- $[10] = locale;
68
- $[11] = own.monthSideBySide;
69
- $[12] = sideBySide;
70
- $[13] = state;
71
- $[14] = t5;
72
- } else t5 = $[14];
72
+ $[10] = firstDayOfWeek;
73
+ $[11] = locale;
74
+ $[12] = own.monthSideBySide;
75
+ $[13] = sideBySide;
76
+ $[14] = stacked;
77
+ $[15] = state;
78
+ $[16] = t5;
79
+ } else t5 = $[16];
73
80
  t4 = offsetsOf(months).map(t5);
74
81
  $[2] = firstDayOfWeek;
75
82
  $[3] = locale;
76
83
  $[4] = months;
77
84
  $[5] = own.monthSideBySide;
78
85
  $[6] = sideBySide;
79
- $[7] = state;
80
- $[8] = t4;
81
- } else t4 = $[8];
86
+ $[7] = stacked;
87
+ $[8] = state;
88
+ $[9] = t4;
89
+ } else t4 = $[9];
82
90
  let t5;
83
- if ($[15] !== t3 || $[16] !== t4) {
91
+ if ($[17] !== t3 || $[18] !== t4) {
84
92
  t5 = /* @__PURE__ */ jsx(View, {
85
93
  style: t3,
86
94
  children: t4
87
95
  });
88
- $[15] = t3;
89
- $[16] = t4;
90
- $[17] = t5;
91
- } else t5 = $[17];
96
+ $[17] = t3;
97
+ $[18] = t4;
98
+ $[19] = t5;
99
+ } else t5 = $[19];
92
100
  const grids = t5;
93
101
  if (showMonthYearMenus && months <= 1) {
94
102
  let t6;
95
- if ($[18] !== grids || $[19] !== locale || $[20] !== state) {
103
+ if ($[20] !== grids || $[21] !== locale || $[22] !== state) {
96
104
  t6 = /* @__PURE__ */ jsx(CalendarMenus, {
97
105
  locale,
98
106
  state,
99
107
  children: grids
100
108
  });
101
- $[18] = grids;
102
- $[19] = locale;
103
- $[20] = state;
104
- $[21] = t6;
105
- } else t6 = $[21];
109
+ $[20] = grids;
110
+ $[21] = locale;
111
+ $[22] = state;
112
+ $[23] = t6;
113
+ } else t6 = $[23];
106
114
  return t6;
107
115
  }
108
116
  let t6;
109
- if ($[22] !== locale || $[23] !== state) {
117
+ if ($[24] !== locale || $[25] !== state) {
110
118
  t6 = /* @__PURE__ */ jsx(CalendarHeader, {
111
119
  locale,
112
120
  state
113
121
  });
114
- $[22] = locale;
115
- $[23] = state;
116
- $[24] = t6;
117
- } else t6 = $[24];
122
+ $[24] = locale;
123
+ $[25] = state;
124
+ $[26] = t6;
125
+ } else t6 = $[26];
118
126
  let t7;
119
- if ($[25] !== grids || $[26] !== t6) {
127
+ if ($[27] !== grids || $[28] !== t6) {
120
128
  t7 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t6, grids] });
121
- $[25] = grids;
122
- $[26] = t6;
123
- $[27] = t7;
124
- } else t7 = $[27];
129
+ $[27] = grids;
130
+ $[28] = t6;
131
+ $[29] = t7;
132
+ } else t7 = $[29];
125
133
  return t7;
126
134
  }
127
135
  /** The two chevrons with the month and year between them. */
@@ -813,13 +821,69 @@ function MenuList(t0) {
813
821
  return t5;
814
822
  }
815
823
  /**
824
+ * The name of the month a grid shows, over the grid, while several stack. The
825
+ * heading between the chevrons names them all at once, which reads across
826
+ * months side by side in order; stacked, the second month sat under the
827
+ * first's last week with nothing saying which month it was. Formatted as the
828
+ * heading names a month: in full with its year, in the calendar's system and
829
+ * time zone, with the era where a Gregorian date falls before the common one.
830
+ *
831
+ * Hidden from a screen reader, which hears the month already with each date.
832
+ */
833
+ function MonthCaption(t0) {
834
+ const $ = c(8);
835
+ const { locale, offset, state } = t0;
836
+ const own = stylesOf(useTheme());
837
+ const role = useTypeRole("titleSmall");
838
+ const start = state.visibleRange.start.add(offset);
839
+ const month = start.calendar.getFormattableMonth?.(start) ?? start;
840
+ const T0 = View;
841
+ const t1 = true;
842
+ const t2 = own.monthCaption;
843
+ const T1 = Text;
844
+ const t3 = 1;
845
+ const t4 = composeStyles(role, own.monthCaptionText);
846
+ const t5 = new DateFormatter(locale, {
847
+ calendar: start.calendar.identifier,
848
+ era: eraOf(start),
849
+ month: "long",
850
+ timeZone: state.timeZone,
851
+ year: "numeric"
852
+ }).format(month.toDate(state.timeZone));
853
+ let t6;
854
+ if ($[0] !== T1 || $[1] !== t4 || $[2] !== t5) {
855
+ t6 = /* @__PURE__ */ jsx(T1, {
856
+ numberOfLines: t3,
857
+ style: t4,
858
+ children: t5
859
+ });
860
+ $[0] = T1;
861
+ $[1] = t4;
862
+ $[2] = t5;
863
+ $[3] = t6;
864
+ } else t6 = $[3];
865
+ let t7;
866
+ if ($[4] !== T0 || $[5] !== own || $[6] !== t6) {
867
+ t7 = /* @__PURE__ */ jsx(T0, {
868
+ "aria-hidden": t1,
869
+ style: t2,
870
+ children: t6
871
+ });
872
+ $[4] = T0;
873
+ $[5] = own;
874
+ $[6] = t6;
875
+ $[7] = t7;
876
+ } else t7 = $[7];
877
+ return t7;
878
+ }
879
+ /**
816
880
  * The weekday row and one month's weeks, held at six weeks of room so the
817
881
  * calendar keeps its height from month to month. The weeks slide in from the
818
882
  * side the new month comes from.
819
883
  */
820
884
  function MonthGrid(t0) {
821
885
  const $ = c(20);
822
- const { firstDayOfWeek, locale, offset, state } = t0;
886
+ const { firstDayOfWeek, locale, offset, stacked, state } = t0;
823
887
  const theme = useTheme();
824
888
  const own = stylesOf(theme);
825
889
  const role = useTypeRole("bodyLarge");
@@ -834,7 +898,7 @@ function MonthGrid(t0) {
834
898
  const slide = useMonthSlide(start, theme);
835
899
  const rowStyle = composeStyles(styles.row, own.rowHeight);
836
900
  const T0 = View;
837
- const t2 = own.grid;
901
+ const t2 = stacked ? void 0 : own.grid;
838
902
  const T1 = View;
839
903
  const t3 = true;
840
904
  const t4 = weekdaysOf(state, locale, firstDayOfWeek).map((weekday) => /* @__PURE__ */ jsx(View, {
@@ -887,13 +951,13 @@ function MonthGrid(t0) {
887
951
  $[14] = t7;
888
952
  } else t7 = $[14];
889
953
  let t8;
890
- if ($[15] !== T0 || $[16] !== own || $[17] !== t5 || $[18] !== t7) {
954
+ if ($[15] !== T0 || $[16] !== t2 || $[17] !== t5 || $[18] !== t7) {
891
955
  t8 = /* @__PURE__ */ jsxs(T0, {
892
956
  style: t2,
893
957
  children: [t5, t7]
894
958
  });
895
959
  $[15] = T0;
896
- $[16] = own;
960
+ $[16] = t2;
897
961
  $[17] = t5;
898
962
  $[18] = t7;
899
963
  $[19] = t8;