@hzblj/kara-components 0.17.0 → 0.18.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 (205) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/lib/module/atoms/badge/badge.android.js +5 -0
  3. package/lib/module/atoms/badge/badge.android.js.map +1 -1
  4. package/lib/module/atoms/badge/badge.ios.js +2 -0
  5. package/lib/module/atoms/badge/badge.ios.js.map +1 -1
  6. package/lib/module/atoms/button/button-tokens.js +8 -0
  7. package/lib/module/atoms/button/button-tokens.js.map +1 -1
  8. package/lib/module/atoms/button/button.android.js +43 -15
  9. package/lib/module/atoms/button/button.android.js.map +1 -1
  10. package/lib/module/atoms/button/button.ios.js +66 -10
  11. package/lib/module/atoms/button/button.ios.js.map +1 -1
  12. package/lib/module/atoms/checkbox/checkbox.android.js +5 -1
  13. package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
  14. package/lib/module/atoms/checkbox/checkbox.ios.js +3 -1
  15. package/lib/module/atoms/checkbox/checkbox.ios.js.map +1 -1
  16. package/lib/module/atoms/color-picker/color-picker.android.js +4 -0
  17. package/lib/module/atoms/color-picker/color-picker.android.js.map +1 -1
  18. package/lib/module/atoms/color-picker/color-picker.ios.js +24 -2
  19. package/lib/module/atoms/color-picker/color-picker.ios.js.map +1 -1
  20. package/lib/module/atoms/date-picker/date-picker.android.js +85 -10
  21. package/lib/module/atoms/date-picker/date-picker.android.js.map +1 -1
  22. package/lib/module/atoms/date-picker/date-picker.ios.js +9 -7
  23. package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
  24. package/lib/module/atoms/divider/divider.android.js +17 -4
  25. package/lib/module/atoms/divider/divider.android.js.map +1 -1
  26. package/lib/module/atoms/divider/divider.ios.js +4 -0
  27. package/lib/module/atoms/divider/divider.ios.js.map +1 -1
  28. package/lib/module/atoms/fab/fab.android.js +64 -8
  29. package/lib/module/atoms/fab/fab.android.js.map +1 -1
  30. package/lib/module/atoms/fab/fab.ios.js +68 -12
  31. package/lib/module/atoms/fab/fab.ios.js.map +1 -1
  32. package/lib/module/atoms/icon-button/icon-button.android.js +48 -5
  33. package/lib/module/atoms/icon-button/icon-button.android.js.map +1 -1
  34. package/lib/module/atoms/icon-button/icon-button.ios.js +60 -10
  35. package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
  36. package/lib/module/atoms/list/list.android.js +32 -4
  37. package/lib/module/atoms/list/list.android.js.map +1 -1
  38. package/lib/module/atoms/list/list.ios.js +15 -5
  39. package/lib/module/atoms/list/list.ios.js.map +1 -1
  40. package/lib/module/atoms/progress/progress.android.js +21 -7
  41. package/lib/module/atoms/progress/progress.android.js.map +1 -1
  42. package/lib/module/atoms/progress/progress.ios.js +5 -1
  43. package/lib/module/atoms/progress/progress.ios.js.map +1 -1
  44. package/lib/module/atoms/slider/slider.android.js +16 -2
  45. package/lib/module/atoms/slider/slider.android.js.map +1 -1
  46. package/lib/module/atoms/slider/slider.ios.js +22 -2
  47. package/lib/module/atoms/slider/slider.ios.js.map +1 -1
  48. package/lib/module/atoms/switch/switch.android.js +5 -1
  49. package/lib/module/atoms/switch/switch.android.js.map +1 -1
  50. package/lib/module/atoms/switch/switch.ios.js +3 -1
  51. package/lib/module/atoms/switch/switch.ios.js.map +1 -1
  52. package/lib/module/atoms/text/spans.js +2 -1
  53. package/lib/module/atoms/text/spans.js.map +1 -1
  54. package/lib/module/atoms/text/text.android.js +18 -6
  55. package/lib/module/atoms/text/text.android.js.map +1 -1
  56. package/lib/module/atoms/text/text.ios.js +6 -2
  57. package/lib/module/atoms/text/text.ios.js.map +1 -1
  58. package/lib/module/atoms/text-field/text-field-input.js +14 -0
  59. package/lib/module/atoms/text-field/text-field-input.js.map +1 -0
  60. package/lib/module/atoms/text-field/text-field.android.js +113 -6
  61. package/lib/module/atoms/text-field/text-field.android.js.map +1 -1
  62. package/lib/module/atoms/text-field/text-field.ios.js +75 -3
  63. package/lib/module/atoms/text-field/text-field.ios.js.map +1 -1
  64. package/lib/module/molecules/collapsible/collapsible.android.js +4 -3
  65. package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
  66. package/lib/module/molecules/collapsible/collapsible.ios.js +3 -1
  67. package/lib/module/molecules/collapsible/collapsible.ios.js.map +1 -1
  68. package/lib/module/molecules/radio-group/radio-group.android.js +10 -2
  69. package/lib/module/molecules/radio-group/radio-group.android.js.map +1 -1
  70. package/lib/module/molecules/radio-group/radio-group.ios.js +6 -2
  71. package/lib/module/molecules/radio-group/radio-group.ios.js.map +1 -1
  72. package/lib/module/molecules/search-bar/search-bar.js +9 -0
  73. package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
  74. package/lib/module/molecules/stepper/stepper.android.js +25 -13
  75. package/lib/module/molecules/stepper/stepper.android.js.map +1 -1
  76. package/lib/module/molecules/stepper/stepper.ios.js +12 -6
  77. package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
  78. package/lib/module/organisms/action-sheet/action-sheet.android.js +16 -8
  79. package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
  80. package/lib/module/organisms/action-sheet/action-sheet.ios.js +16 -3
  81. package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
  82. package/lib/module/organisms/alert/alert.android.js +4 -3
  83. package/lib/module/organisms/alert/alert.android.js.map +1 -1
  84. package/lib/module/organisms/alert/alert.ios.js +3 -2
  85. package/lib/module/organisms/alert/alert.ios.js.map +1 -1
  86. package/lib/module/organisms/context-menu/context-menu.android.js +3 -1
  87. package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
  88. package/lib/module/organisms/context-menu/context-menu.ios.js +1 -0
  89. package/lib/module/organisms/context-menu/context-menu.ios.js.map +1 -1
  90. package/lib/module/organisms/fab-menu/fab-menu.android.js +3 -0
  91. package/lib/module/organisms/fab-menu/fab-menu.android.js.map +1 -1
  92. package/lib/module/organisms/fab-menu/fab-menu.ios.js +3 -0
  93. package/lib/module/organisms/fab-menu/fab-menu.ios.js.map +1 -1
  94. package/lib/module/organisms/menu/menu-parts.js +20 -0
  95. package/lib/module/organisms/menu/menu-parts.js.map +1 -0
  96. package/lib/module/organisms/menu/menu.android.js +51 -19
  97. package/lib/module/organisms/menu/menu.android.js.map +1 -1
  98. package/lib/module/organisms/menu/menu.ios.js +71 -8
  99. package/lib/module/organisms/menu/menu.ios.js.map +1 -1
  100. package/lib/module/organisms/sheet/sheet.js +2 -1
  101. package/lib/module/organisms/sheet/sheet.js.map +1 -1
  102. package/lib/typescript/atoms/badge/badge.types.d.ts +2 -0
  103. package/lib/typescript/atoms/button/button-tokens.d.ts +6 -2
  104. package/lib/typescript/atoms/button/button.types.d.ts +19 -5
  105. package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +2 -0
  106. package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +2 -0
  107. package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +5 -5
  108. package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +30 -7
  109. package/lib/typescript/atoms/divider/divider.ios.d.ts +4 -0
  110. package/lib/typescript/atoms/divider/divider.types.d.ts +13 -2
  111. package/lib/typescript/atoms/fab/fab.types.d.ts +21 -4
  112. package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +23 -4
  113. package/lib/typescript/atoms/list/list.types.d.ts +15 -1
  114. package/lib/typescript/atoms/progress/progress.types.d.ts +13 -2
  115. package/lib/typescript/atoms/slider/slider.ios.d.ts +4 -0
  116. package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
  117. package/lib/typescript/atoms/switch/switch.types.d.ts +2 -0
  118. package/lib/typescript/atoms/text/spans.d.ts +2 -0
  119. package/lib/typescript/atoms/text/text.types.d.ts +9 -1
  120. package/lib/typescript/atoms/text-field/text-field-input.d.ts +7 -0
  121. package/lib/typescript/atoms/text-field/text-field.types.d.ts +77 -4
  122. package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +2 -0
  123. package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +4 -0
  124. package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +11 -1
  125. package/lib/typescript/molecules/stepper/stepper.ios.d.ts +2 -1
  126. package/lib/typescript/molecules/stepper/stepper.types.d.ts +17 -0
  127. package/lib/typescript/organisms/action-sheet/action-sheet.ios.d.ts +4 -0
  128. package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -3
  129. package/lib/typescript/organisms/alert/alert.types.d.ts +8 -3
  130. package/lib/typescript/organisms/menu/menu-parts.d.ts +14 -0
  131. package/lib/typescript/organisms/menu/menu.types.d.ts +35 -7
  132. package/lib/typescript/organisms/sheet/sheet.types.d.ts +7 -1
  133. package/package.json +4 -4
  134. package/src/atoms/badge/badge.android.tsx +9 -2
  135. package/src/atoms/badge/badge.ios.tsx +2 -2
  136. package/src/atoms/badge/badge.types.ts +2 -0
  137. package/src/atoms/button/button-tokens.ts +6 -3
  138. package/src/atoms/button/button.android.tsx +35 -11
  139. package/src/atoms/button/button.ios.tsx +72 -8
  140. package/src/atoms/button/button.types.ts +20 -5
  141. package/src/atoms/checkbox/checkbox.android.tsx +5 -2
  142. package/src/atoms/checkbox/checkbox.ios.tsx +2 -2
  143. package/src/atoms/checkbox/checkbox.types.ts +2 -0
  144. package/src/atoms/color-picker/color-picker.android.tsx +10 -2
  145. package/src/atoms/color-picker/color-picker.ios.tsx +24 -1
  146. package/src/atoms/color-picker/color-picker.types.ts +2 -0
  147. package/src/atoms/date-picker/date-picker.android.tsx +86 -16
  148. package/src/atoms/date-picker/date-picker.ios.tsx +20 -8
  149. package/src/atoms/date-picker/date-picker.types.ts +31 -7
  150. package/src/atoms/divider/divider.android.tsx +14 -3
  151. package/src/atoms/divider/divider.ios.tsx +4 -0
  152. package/src/atoms/divider/divider.types.ts +14 -2
  153. package/src/atoms/fab/fab.android.tsx +61 -11
  154. package/src/atoms/fab/fab.ios.tsx +48 -13
  155. package/src/atoms/fab/fab.types.ts +22 -4
  156. package/src/atoms/icon-button/icon-button.android.tsx +60 -10
  157. package/src/atoms/icon-button/icon-button.ios.tsx +77 -8
  158. package/src/atoms/icon-button/icon-button.types.ts +24 -4
  159. package/src/atoms/list/list.android.tsx +26 -4
  160. package/src/atoms/list/list.ios.tsx +20 -5
  161. package/src/atoms/list/list.types.ts +16 -1
  162. package/src/atoms/progress/progress.android.tsx +32 -6
  163. package/src/atoms/progress/progress.ios.tsx +11 -5
  164. package/src/atoms/progress/progress.types.ts +13 -2
  165. package/src/atoms/slider/slider.android.tsx +18 -2
  166. package/src/atoms/slider/slider.ios.tsx +38 -2
  167. package/src/atoms/slider/slider.types.ts +7 -0
  168. package/src/atoms/switch/switch.android.tsx +5 -2
  169. package/src/atoms/switch/switch.ios.tsx +2 -2
  170. package/src/atoms/switch/switch.types.ts +2 -0
  171. package/src/atoms/text/spans.ts +2 -1
  172. package/src/atoms/text/text.android.tsx +20 -7
  173. package/src/atoms/text/text.ios.tsx +7 -0
  174. package/src/atoms/text/text.types.ts +10 -1
  175. package/src/atoms/text-field/text-field-input.ts +17 -0
  176. package/src/atoms/text-field/text-field.android.tsx +132 -9
  177. package/src/atoms/text-field/text-field.ios.tsx +110 -6
  178. package/src/atoms/text-field/text-field.types.ts +98 -4
  179. package/src/molecules/collapsible/collapsible.android.tsx +10 -2
  180. package/src/molecules/collapsible/collapsible.ios.tsx +8 -2
  181. package/src/molecules/collapsible/collapsible.types.ts +2 -0
  182. package/src/molecules/radio-group/radio-group.android.tsx +18 -4
  183. package/src/molecules/radio-group/radio-group.ios.tsx +19 -5
  184. package/src/molecules/radio-group/radio-group.types.ts +4 -0
  185. package/src/molecules/search-bar/search-bar.tsx +9 -0
  186. package/src/molecules/search-bar/search-bar.types.ts +12 -1
  187. package/src/molecules/stepper/stepper.android.tsx +24 -4
  188. package/src/molecules/stepper/stepper.ios.tsx +23 -8
  189. package/src/molecules/stepper/stepper.types.ts +17 -0
  190. package/src/organisms/action-sheet/action-sheet.android.tsx +23 -11
  191. package/src/organisms/action-sheet/action-sheet.ios.tsx +20 -3
  192. package/src/organisms/action-sheet/action-sheet.types.ts +8 -3
  193. package/src/organisms/alert/alert.android.tsx +11 -8
  194. package/src/organisms/alert/alert.ios.tsx +2 -1
  195. package/src/organisms/alert/alert.types.ts +8 -3
  196. package/src/organisms/context-menu/context-menu.android.tsx +3 -2
  197. package/src/organisms/context-menu/context-menu.ios.tsx +1 -0
  198. package/src/organisms/fab-menu/fab-menu.android.tsx +3 -0
  199. package/src/organisms/fab-menu/fab-menu.ios.tsx +9 -1
  200. package/src/organisms/menu/menu-parts.ts +21 -0
  201. package/src/organisms/menu/menu.android.tsx +39 -10
  202. package/src/organisms/menu/menu.ios.tsx +55 -5
  203. package/src/organisms/menu/menu.types.ts +30 -7
  204. package/src/organisms/sheet/sheet.tsx +2 -1
  205. package/src/organisms/sheet/sheet.types.ts +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @hzblj/kara-components
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#57](https://github.com/hzblj/kara-ui/pull/57) [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7) Thanks [@hzblj](https://github.com/hzblj)! - `Button` takes `variant="plain"`, a text button in the accent with no fill, for the lesser action beside a prominent one ("Skip", "Forgot password?"): SwiftUI's `borderless` style on iOS, padded to a 44pt tap target that the whole label area takes, and Material's `TextButton` on Android. A `tint` colours its label. `Button` also takes `icon`, one of the app's icons before the label and in its colour: a SwiftUI `Label` in the button on iOS, the icon in the button's content row on Android, with Material's tighter padding on the icon side. Screen readers still read the label alone.
8
+
9
+ `IconButton` takes `variant`: `plain` (as before, and the default), `filled`, `tonal`, `outlined` or `glass`. iOS draws them as SwiftUI's `borderedProminent`, `bordered` and `glass` styles in a circle, and `outlined` as a plain button in a hairline ring, since SwiftUI has no outlined style; below iOS 26 `glass` is the `bordered` circle. Android draws Material's `FilledIconButton`, `FilledTonalIconButton` and `OutlinedIconButton`, and `glass` as the tonal one: Material has no glass, and a contained button still reads over a photo where an outline would not. A new `color` is the icon's colour, or on `filled` the fill, with the icon picking a colour that reads on it, as a `Button`'s `tint` does.
10
+
11
+ `List` takes `variant` and `separators`. `insetGrouped` sets the rows in a rounded card inset from the edges (SwiftUI's `insetGrouped` list style; on Android a `Card` inside the column, as `Form` draws a section), `plain` runs them edge to edge. Each platform keeps its own list by default, `insetGrouped` on iOS and `plain` on Android, so nothing changes until you ask. `separators={false}` drops the lines between rows: iOS hides each row's separator, Android draws no `Divider`.
12
+
13
+ `Fab` takes `label`, which makes it an extended FAB with the text beside the icon: Material's `ExtendedFloatingActionButton` on Android, and on iOS kara's own FAB as a 56pt accent capsule. Screen readers say `accessibilityLabel` for the whole button, so give it the label's words. It also takes `size`: `small` (40), `regular` (56, the default) or `large` (96, with a 36 icon), Material's `SmallFloatingActionButton` and `LargeFloatingActionButton` on Android and circles of the same sizes on iOS.
14
+
15
+ - [#57](https://github.com/hzblj/kara-ui/pull/57) [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7) Thanks [@hzblj](https://github.com/hzblj)! - `DatePicker` takes `datePickerStyle` and `disabled`. `compact`, the pill that opens a calendar, stays the default; `graphical` is the calendar in place, a month at a time (with the time under it in `datetime` mode on iOS), and `wheel` puts the value on wheels. Android shows Material's calendar in place for `graphical` in `date` and `datetime` modes, without its title and headline and in the accent; for `wheel`, and in `time` mode, it keeps its field and dialog, since Material has no wheel. `disabled` dims the picker and ignores taps; Material's calendar has no disabled state of its own, so a disabled `graphical` picker on Android is dimmed and offers only the selected day.
16
+
17
+ `Slider` takes `onValueChangeEnd`, called once with the final value when the user lets go, so a seek or a volume can commit on release instead of at every step of the drag: SwiftUI's `onEditingChanged` on iOS, Material's `onValueChangeFinished` on Android.
18
+
19
+ `Stepper` and `RadioGroup` take `disabled`, which dims the row and stops the value changing. `Stepper` also takes `decrementLabel` and `incrementLabel`, what TalkBack says for its minus and plus buttons on Android (`Decrement` and `Increment` unless the app passes its own words); iOS's native stepper labels its buttons itself.
20
+
21
+ `ColorPicker` takes `disabled`: SwiftUI dims the label and the well and ignores taps on iOS, and on Android kara's own well dims and does not open its sheet, the label dimmed with it.
22
+
23
+ `Divider` takes `axis`. `vertical` draws Compose's `VerticalDivider` on Android, as tall as the `HStack` around it; SwiftUI's divider already turns by itself in an `HStack`, so iOS ignores it.
24
+
25
+ `Text` ends a text cut short with an ellipsis on Android too, where `numberOfLines` used to clip it. `truncation` says where the ellipsis goes: `tail`, the default, `head` to keep the end of the text, or `middle` to keep both of its ends, for a path or a file name. Android puts it at the head or in the middle of a single line only, as Compose does, and ends a longer text at the tail; kara-native's `AnimatedText` takes `textOverflow` to draw it. That Compose text, which Android also draws for `animate` and `monospacedDigit`, now reads every string child, so a `Text` like `{count} items` no longer comes out empty there.
26
+
27
+ - [#57](https://github.com/hzblj/kara-ui/pull/57) [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7) Thanks [@hzblj](https://github.com/hzblj)! - `Alert` takes `cancelLabel`: the cancel button's label, so an app in another language no longer shows an English "Cancel" beside its own confirm label. `Cancel` stays the default, and `null` leaves the button out, for an alert that only informs and is closed by its confirm button alone.
28
+
29
+ `ActionSheet` takes a `message`: the confirmation dialog's own message under the title on iOS, a line under the title on Android. The title now shows on iOS too, where SwiftUI hid it by default and the actions lost what they were about.
30
+
31
+ `Menu` can open from an icon. `icon` sits before the `label` in the same colour, or stands alone as an `IconButton` that opens the menu, with an `accessibilityLabel` the types require when there is no label. iOS now draws each action's `icon` in the menu, as Android already did.
32
+
33
+ `MenuAction` takes `disabled`: the action stays in the list, greyed, and does not respond. `Menu`, `ActionSheet` and `ContextMenu` honour it on both platforms (the iOS context menu marks its `UIAction` disabled in kara-native's `ContextMenuView`, so it needs a native rebuild), `FabMenu` on iOS only, since Material's FAB menu items have no disabled state.
34
+
35
+ `Progress` takes `color`, any colour token: `fill.destructive.primary` for storage nearly full, `fill.success.primary` for a goal reached. `fill.accent.primary` stays the default. On Android a bar in another colour gets a track in that colour, faded, rather than Material's pale accent under it.
36
+
37
+ - [#53](https://github.com/hzblj/kara-ui/pull/53) [`d31ac23`](https://github.com/hzblj/kara-ui/commit/d31ac23ae6cdb27948148b14d7d7abb0611ab3f9) Thanks [@hzblj](https://github.com/hzblj)! - `Sheet` takes `systemBackground`: on iOS the sheet keeps the system's own background instead of `bg`, which is untinted Liquid Glass on iOS 26 and a material blur before it. Use it for a sheet that floats over content it should let through, such as a map. Android keeps `bg`.
38
+
39
+ - [#57](https://github.com/hzblj/kara-ui/pull/57) [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7) Thanks [@hzblj](https://github.com/hzblj)! - `testID` works on both platforms, so Maestro and other end-to-end tests can find a control by it: the accessibility identifier on iOS, the Compose test tag (exposed as the resource id) on Android. `Switch`, `Checkbox`, `Slider`, `Stepper`, `RadioGroup`, `Menu`, `Collapsible`, `Progress` and `Badge` take it for the first time, and `TextField`, `IconButton`, `Fab`, `Divider` and `List`, which only forwarded it on iOS, now tag their Compose views too. It lands on the control a test taps or reads rather than on a row around it: the switch or the box beside its label, the field below its label, a `Menu`'s trigger, a `Stepper`'s buttons and value, a `Collapsible`'s row.
40
+
41
+ - [#57](https://github.com/hzblj/kara-ui/pull/57) [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7) Thanks [@hzblj](https://github.com/hzblj)! - `TextField` can be set up for the text it takes, so a proper email, password or one-time-code field can be built. `placeholder` is a hint in the empty field; `keyboard` brings up the `email`, `url`, `number`, `decimal` or `phone` keyboard; `autoCapitalize` and `autoCorrect` say how the keyboard treats what is typed, and both turn off by themselves for an email or a URL; `contentType` offers to fill the field in, through iOS AutoFill and, on Android, an autofill service; `maxLength` cuts off what is typed past it. It submits and moves on as well: `submitLabel` names the return key (`done`, `go`, `next`, `search` or `send`), `onSubmit` is called with the text when it is pressed, `autoFocus` focuses the field as it appears, `onFocusChange` reports focus, and a `ref` (`TextFieldRef`, with `focus`, `blur` and `clear`) lets one field's `next` focus the following one. A `multiline` field keeps a return key that starts a new line. On Android a `secure` field now brings up the password keyboard, which suggests and learns nothing.
42
+
43
+ `SearchBar` takes `onSubmit`, called with the query when the keyboard's return key, which now reads Search, is pressed, and `autoFocus`. A query is taken as typed: capitals and corrections are off by default, and `autoCapitalize` and `autoCorrect` turn them back on.
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [[`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7), [`262bf11`](https://github.com/hzblj/kara-ui/commit/262bf1130730001da9390df0671bc2c16f7026a7)]:
48
+ - @hzblj/kara-native@0.18.0
49
+ - @hzblj/kara-sx@0.18.0
50
+ - @hzblj/kara-theme@0.18.0
51
+
3
52
  ## 0.17.0
4
53
 
5
54
  ### Minor Changes
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { Badge as ComposeBadge, Text as ComposeText } from '@expo/ui/jetpack-compose';
4
+ import { testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
4
5
  import { useAppTheme } from '@hzblj/kara-theme';
6
+ import { useMemo } from 'react';
5
7
  import { useHostGuard } from "../../host-context.js";
6
8
  import { BADGE_TOKENS } from "./badge-tokens.js";
7
9
 
@@ -9,14 +11,17 @@ import { BADGE_TOKENS } from "./badge-tokens.js";
9
11
  import { jsx as _jsx } from "react/jsx-runtime";
10
12
  export const Badge = ({
11
13
  label,
14
+ testID,
12
15
  tone = 'neutral'
13
16
  }) => {
14
17
  useHostGuard('Badge');
15
18
  const theme = useAppTheme();
16
19
  const tokens = BADGE_TOKENS[tone];
20
+ const modifiers = useMemo(() => testID ? [testIdModifier(testID)] : undefined, [testID]);
17
21
  return /*#__PURE__*/_jsx(ComposeBadge, {
18
22
  containerColor: theme.color(tokens.fill),
19
23
  contentColor: theme.color(tokens.content),
24
+ modifiers: modifiers,
20
25
  children: /*#__PURE__*/_jsx(ComposeText, {
21
26
  color: theme.colorString(tokens.content),
22
27
  style: theme.typography.captionMedium,
@@ -1 +1 @@
1
- {"version":3,"names":["Badge","ComposeBadge","Text","ComposeText","useAppTheme","useHostGuard","BADGE_TOKENS","jsx","_jsx","label","tone","theme","tokens","containerColor","color","fill","contentColor","content","children","colorString","style","typography","captionMedium"],"sourceRoot":"../../../../src","sources":["atoms/badge/badge.android.tsx"],"mappings":";;AAAA,SAAQA,KAAK,IAAIC,YAAY,EAAEC,IAAI,IAAIC,WAAW,QAAO,0BAA0B;AACnF,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,YAAY,QAAO,uBAAoB;AAE/C,SAAQC,YAAY,QAAO,mBAAgB;;AAE3C;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,OAAO,MAAMR,KAAqB,GAAGA,CAAC;EAACS,KAAK;EAAEC,IAAI,GAAG;AAAqB,CAAC,KAAK;EAC9EL,YAAY,CAAC,OAAO,CAAC;EACrB,MAAMM,KAAK,GAAGP,WAAW,CAAC,CAAC;EAC3B,MAAMQ,MAAM,GAAGN,YAAY,CAACI,IAAI,CAAC;EAEjC,oBACEF,IAAA,CAACP,YAAY;IAACY,cAAc,EAAEF,KAAK,CAACG,KAAK,CAACF,MAAM,CAACG,IAAI,CAAE;IAACC,YAAY,EAAEL,KAAK,CAACG,KAAK,CAACF,MAAM,CAACK,OAAO,CAAE;IAAAC,QAAA,eAChGV,IAAA,CAACL,WAAW;MAACW,KAAK,EAAEH,KAAK,CAACQ,WAAW,CAACP,MAAM,CAACK,OAAO,CAAE;MAACG,KAAK,EAAET,KAAK,CAACU,UAAU,CAACC,aAAc;MAAAJ,QAAA,EAC1FT;IAAK,CACK;EAAC,CACF,CAAC;AAEnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Badge","ComposeBadge","Text","ComposeText","testID","testIdModifier","useAppTheme","useMemo","useHostGuard","BADGE_TOKENS","jsx","_jsx","label","tone","theme","tokens","modifiers","undefined","containerColor","color","fill","contentColor","content","children","colorString","style","typography","captionMedium"],"sourceRoot":"../../../../src","sources":["atoms/badge/badge.android.tsx"],"mappings":";;AAAA,SAAQA,KAAK,IAAIC,YAAY,EAAEC,IAAI,IAAIC,WAAW,QAAO,0BAA0B;AACnF,SAAQC,MAAM,IAAIC,cAAc,QAAO,oCAAoC;AAC3E,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAE/C,SAAQC,YAAY,QAAO,mBAAgB;;AAE3C;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,OAAO,MAAMX,KAAqB,GAAGA,CAAC;EAACY,KAAK;EAAER,MAAM;EAAES,IAAI,GAAG;AAAqB,CAAC,KAAK;EACtFL,YAAY,CAAC,OAAO,CAAC;EACrB,MAAMM,KAAK,GAAGR,WAAW,CAAC,CAAC;EAC3B,MAAMS,MAAM,GAAGN,YAAY,CAACI,IAAI,CAAC;EACjC,MAAMG,SAAS,GAAGT,OAAO,CAAC,MAAOH,MAAM,GAAG,CAACC,cAAc,CAACD,MAAM,CAAC,CAAC,GAAGa,SAAU,EAAE,CAACb,MAAM,CAAC,CAAC;EAE1F,oBACEO,IAAA,CAACV,YAAY;IACXiB,cAAc,EAAEJ,KAAK,CAACK,KAAK,CAACJ,MAAM,CAACK,IAAI,CAAE;IACzCC,YAAY,EAAEP,KAAK,CAACK,KAAK,CAACJ,MAAM,CAACO,OAAO,CAAE;IAC1CN,SAAS,EAAEA,SAAU;IAAAO,QAAA,eAErBZ,IAAA,CAACR,WAAW;MAACgB,KAAK,EAAEL,KAAK,CAACU,WAAW,CAACT,MAAM,CAACO,OAAO,CAAE;MAACG,KAAK,EAAEX,KAAK,CAACY,UAAU,CAACC,aAAc;MAAAJ,QAAA,EAC1FX;IAAK,CACK;EAAC,CACF,CAAC;AAEnB,CAAC","ignoreList":[]}
@@ -8,6 +8,7 @@ import { BADGE_TOKENS } from "./badge-tokens.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  export const Badge = ({
10
10
  label,
11
+ testID,
11
12
  tone = 'neutral'
12
13
  }) => {
13
14
  useHostGuard('Badge');
@@ -20,6 +21,7 @@ export const Badge = ({
20
21
  });
21
22
  return /*#__PURE__*/_jsx(HStack, {
22
23
  modifiers: modifiers,
24
+ testID: testID,
23
25
  children: /*#__PURE__*/_jsx(Text, {
24
26
  color: tokens.content,
25
27
  variant: "labelMedium",
@@ -1 +1 @@
1
- {"version":3,"names":["HStack","useSxModifiers","useHostGuard","Text","BADGE_TOKENS","jsx","_jsx","Badge","label","tone","tokens","modifiers","bg","fill","borderRadius","px","py","children","color","content","variant"],"sourceRoot":"../../../../src","sources":["atoms/badge/badge.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,mBAAmB;AACxC,SAAQC,cAAc,QAAO,gBAAgB;AAC7C,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAS;AAE5B,SAAQC,YAAY,QAAO,mBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,MAAMC,KAAqB,GAAGA,CAAC;EAACC,KAAK;EAAEC,IAAI,GAAG;AAAqB,CAAC,KAAK;EAC9EP,YAAY,CAAC,OAAO,CAAC;EACrB,MAAMQ,MAAM,GAAGN,YAAY,CAACK,IAAI,CAAC;EACjC,MAAME,SAAS,GAAGV,cAAc,CAAC;IAACW,EAAE,EAAEF,MAAM,CAACG,IAAI;IAAEC,YAAY,EAAE,MAAM;IAAEC,EAAE,EAAE,IAAI;IAAEC,EAAE,EAAE;EAAI,CAAC,CAAC;EAE7F,oBACEV,IAAA,CAACN,MAAM;IAACW,SAAS,EAAEA,SAAU;IAAAM,QAAA,eAC3BX,IAAA,CAACH,IAAI;MAACe,KAAK,EAAER,MAAM,CAACS,OAAQ;MAACC,OAAO,EAAC,aAAa;MAAAH,QAAA,EAC/CT;IAAK,CACF;EAAC,CACD,CAAC;AAEb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["HStack","useSxModifiers","useHostGuard","Text","BADGE_TOKENS","jsx","_jsx","Badge","label","testID","tone","tokens","modifiers","bg","fill","borderRadius","px","py","children","color","content","variant"],"sourceRoot":"../../../../src","sources":["atoms/badge/badge.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,mBAAmB;AACxC,SAAQC,cAAc,QAAO,gBAAgB;AAC7C,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAS;AAE5B,SAAQC,YAAY,QAAO,mBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,MAAMC,KAAqB,GAAGA,CAAC;EAACC,KAAK;EAAEC,MAAM;EAAEC,IAAI,GAAG;AAAqB,CAAC,KAAK;EACtFR,YAAY,CAAC,OAAO,CAAC;EACrB,MAAMS,MAAM,GAAGP,YAAY,CAACM,IAAI,CAAC;EACjC,MAAME,SAAS,GAAGX,cAAc,CAAC;IAACY,EAAE,EAAEF,MAAM,CAACG,IAAI;IAAEC,YAAY,EAAE,MAAM;IAAEC,EAAE,EAAE,IAAI;IAAEC,EAAE,EAAE;EAAI,CAAC,CAAC;EAE7F,oBACEX,IAAA,CAACN,MAAM;IAACY,SAAS,EAAEA,SAAU;IAACH,MAAM,EAAEA,MAAO;IAAAS,QAAA,eAC3CZ,IAAA,CAACH,IAAI;MAACgB,KAAK,EAAER,MAAM,CAACS,OAAQ;MAACC,OAAO,EAAC,aAAa;MAAAH,QAAA,EAC/CV;IAAK,CACF;EAAC,CACD,CAAC;AAEb,CAAC","ignoreList":[]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ /** `fill` and `shadow` are unset for `plain`: a text button has no container to fill or lift. */
4
+
3
5
  const TOKENS = {
4
6
  accent: {
5
7
  content: 'content.on.accent',
@@ -16,6 +18,11 @@ const TOKENS = {
16
18
  fill: 'btn.bg.glass.base',
17
19
  shadow: 'btn.glass'
18
20
  },
21
+ plain: {
22
+ content: 'content.accent',
23
+ fill: undefined,
24
+ shadow: undefined
25
+ },
19
26
  secondary: {
20
27
  content: 'content.primary',
21
28
  fill: 'btn.bg.secondary.base',
@@ -31,6 +38,7 @@ export const buttonTokens = (variant, disabled, theme) => {
31
38
  accent: 'fill.accent.disabled',
32
39
  destructive: 'fill.destructive.disabled',
33
40
  glass: 'btn.bg.glass.disabled',
41
+ plain: undefined,
34
42
  secondary: 'btn.bg.secondary.disabled'
35
43
  };
36
44
  void theme;
@@ -1 +1 @@
1
- {"version":3,"names":["TOKENS","accent","content","fill","shadow","destructive","glass","secondary","buttonTokens","variant","disabled","theme","tokens","disabledFill","luminance","color","hex","exec","undefined","r","g","b","map","i","channel","Number","parseInt","slice","currentHex","token","resolved","entry","split","reduce","node","key","dark","light","adaptive","contentOnTint","tint"],"sourceRoot":"../../../../src","sources":["atoms/button/button-tokens.ts"],"mappings":";;AAUA,MAAMA,MAAM,GAAG;EACbC,MAAM,EAAE;IAACC,OAAO,EAAE,mBAAmB;IAAEC,IAAI,EAAE,qBAAqB;IAAEC,MAAM,EAAE;EAAY,CAAC;EACzFC,WAAW,EAAE;IAACH,OAAO,EAAE,wBAAwB;IAAEC,IAAI,EAAE,0BAA0B;IAAEC,MAAM,EAAE;EAAiB,CAAC;EAC7GE,KAAK,EAAE;IAACJ,OAAO,EAAE,iBAAiB;IAAEC,IAAI,EAAE,mBAAmB;IAAEC,MAAM,EAAE;EAAW,CAAC;EACnFG,SAAS,EAAE;IAACL,OAAO,EAAE,iBAAiB;IAAEC,IAAI,EAAE,uBAAuB;IAAEC,MAAM,EAAE;EAAe;AAChG,CAAwD;AAExD,OAAO,MAAMI,YAAY,GAAGA,CAACC,OAAsB,EAAEC,QAAiB,EAAEC,KAAY,KAAK;EACvF,MAAMC,MAAM,GAAGZ,MAAM,CAACS,OAAO,CAAC;EAE9B,IAAI,CAACC,QAAQ,EAAE;IACb,OAAOE,MAA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AAQ,EAAE;IAChC,OAAOA,QAAQ;EACjB;EAEA,MAAMC,KAAK,GAAGF,KAAK,CAChBG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACbA,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAAU,CAACC,IAAI,EAAEC,GAAG,KAAMD,IAAI,GAA2CC,GAAG,CAAC,EAAExB,KAAK,CAAC;EAE9F,IAAIoB,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,UAAU,IAAIA,KAAK,EAAE;IAC7D,MAAM;MAACK,IAAI;MAAEC;IAAK,CAAC,GAAIN,KAAK,CAA+CO,QAAQ;IAEnF,OAAO3B,KAAK,CAACyB,IAAI,GAAGA,IAAI,GAAGC,KAAK;EAClC;EAEA,OAAON,KAAK;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMQ,aAAa,GAAGA,CAACC,IAAgB,EAAE7B,KAAY,KAC1D,CAACG,SAAS,CAACc,UAAU,CAACY,IAAI,EAAE7B,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,iBAAiB,GAAG,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["TOKENS","accent","content","fill","shadow","destructive","glass","plain","undefined","secondary","buttonTokens","variant","disabled","theme","tokens","disabledFill","luminance","color","hex","exec","r","g","b","map","i","channel","Number","parseInt","slice","currentHex","token","resolved","entry","split","reduce","node","key","dark","light","adaptive","contentOnTint","tint"],"sourceRoot":"../../../../src","sources":["atoms/button/button-tokens.ts"],"mappings":";;AAIA;;AAOA,MAAMA,MAAM,GAAG;EACbC,MAAM,EAAE;IAACC,OAAO,EAAE,mBAAmB;IAAEC,IAAI,EAAE,qBAAqB;IAAEC,MAAM,EAAE;EAAY,CAAC;EACzFC,WAAW,EAAE;IAACH,OAAO,EAAE,wBAAwB;IAAEC,IAAI,EAAE,0BAA0B;IAAEC,MAAM,EAAE;EAAiB,CAAC;EAC7GE,KAAK,EAAE;IAACJ,OAAO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
1
  "use strict";
2
2
 
3
- import { Button as ComposeButton, Text as ComposeText, OutlinedButton } from '@expo/ui/jetpack-compose';
4
- import { testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
3
+ import { Button as ComposeButton, Spacer as ComposeSpacer, Text as ComposeText, OutlinedButton, TextButton } from '@expo/ui/jetpack-compose';
4
+ import { testID as testIdModifier, width as widthModifier } from '@expo/ui/jetpack-compose/modifiers';
5
5
  import { useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
6
- import { useAppTheme } from '@hzblj/kara-theme';
6
+ import { spacing, useAppTheme } from '@hzblj/kara-theme';
7
7
  import { useMemo } from 'react';
8
8
  import { useHostGuard } from "../../host-context.js";
9
+ import { Icon } from "../icon/index.js";
9
10
  import { buttonTokens, contentOnTint } from "./button-tokens.js";
10
11
 
12
+ /** Material's `ButtonDefaults.IconSpacing`: the gap between a button's icon and its label. */
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const ICON_GAP = [widthModifier(spacing.s8)];
15
+
16
+ /**
17
+ * Material's padding for a button with a leading icon (`ButtonWithIconContentPadding`,
18
+ * `TextButtonWithIconContentPadding`): the icon side a step tighter than the label's. Top and bottom keep the defaults.
19
+ */
20
+ const WITH_ICON_PADDING = {
21
+ end: spacing.s24,
22
+ start: spacing.s16
23
+ };
24
+ const TEXT_WITH_ICON_PADDING = {
25
+ end: spacing.s16,
26
+ start: spacing.s12
27
+ };
28
+
11
29
  /**
12
30
  * Material's filled button, in its own stadium shape. No `borderRadius` or `shadow` from the tokens: those shape the
13
31
  * SwiftUI button's glossy ring, and laid over a Compose button they clip and outline a rounded rectangle around the
14
- * pill Material draws. The label is a Compose `Text` — `@expo/ui`'s button takes composable content, not a string.
32
+ * pill Material draws. The label is a Compose `Text` — `@expo/ui`'s button takes composable content, not a string —
33
+ * after the `icon`, when there is one, in the same row.
15
34
  *
16
- * Material has no glass, so `glass` is its outlined button — and a `tint` makes any variant a filled button in that
17
- * colour, as a prominent style does on iOS. `buttonStyle` and `controlSize` are SwiftUI's alone.
35
+ * Material has no glass, so `glass` is its outlined button — and a `tint` makes any variant but `plain` a filled
36
+ * button in that colour, as a prominent style does on iOS. `plain` is Material's `TextButton`, and a `tint` colours its
37
+ * label. `buttonStyle` and `controlSize` are SwiftUI's alone.
18
38
  */
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
39
  export const Button = ({
21
40
  accessibilityHint,
22
41
  disabled = false,
42
+ icon,
23
43
  label,
24
44
  onPress,
25
45
  testID,
@@ -38,24 +58,32 @@ export const Button = ({
38
58
  }, accessibilityHint !== undefined);
39
59
  const modifiers = useMemo(() => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...accessibilityModifiers], [accessibilityModifiers, sxModifiers, testID]);
40
60
  const style = theme.typography.body;
61
+ const text = variant === 'plain';
41
62
  const outlined = variant === 'glass' && !tint;
42
63
  const fill = tint && !disabled ? tint : tokens.fill;
43
- const content = tint && !disabled ? contentOnTint(tint, theme) : tokens.content;
44
- const MaterialButton = outlined ? OutlinedButton : ComposeButton;
45
- return /*#__PURE__*/_jsx(MaterialButton, {
46
- colors: outlined ? {
64
+ const content = !tint || disabled ? tokens.content : text ? tint : contentOnTint(tint, theme);
65
+ const MaterialButton = text ? TextButton : outlined ? OutlinedButton : ComposeButton;
66
+ return /*#__PURE__*/_jsxs(MaterialButton, {
67
+ colors: fill && !text && !outlined ? {
68
+ containerColor: theme.color(fill),
47
69
  contentColor: theme.color(content),
70
+ disabledContainerColor: theme.color(fill),
48
71
  disabledContentColor: theme.color(content)
49
72
  } : {
50
- containerColor: theme.color(fill),
51
73
  contentColor: theme.color(content),
52
- disabledContainerColor: theme.color(fill),
53
74
  disabledContentColor: theme.color(content)
54
75
  },
76
+ contentPadding: icon ? text ? TEXT_WITH_ICON_PADDING : WITH_ICON_PADDING : undefined,
55
77
  enabled: !disabled,
56
78
  modifiers: modifiers,
57
79
  onClick: onPress,
58
- children: /*#__PURE__*/_jsx(ComposeText, {
80
+ children: [icon ? /*#__PURE__*/_jsx(Icon, {
81
+ color: content,
82
+ name: icon,
83
+ size: "s20"
84
+ }) : null, icon ? /*#__PURE__*/_jsx(ComposeSpacer, {
85
+ modifiers: ICON_GAP
86
+ }) : null, /*#__PURE__*/_jsx(ComposeText, {
59
87
  color: theme.colorString(content),
60
88
  style: {
61
89
  fontFamily: style.fontFamily,
@@ -64,7 +92,7 @@ export const Button = ({
64
92
  lineHeight: style.lineHeight
65
93
  },
66
94
  children: label
67
- })
95
+ })]
68
96
  });
69
97
  };
70
98
  //# sourceMappingURL=button.android.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Button","ComposeButton","Text","ComposeText","OutlinedButton","testID","testIdModifier","useAccessibilityModifiers","useSxModifiers","useAppTheme","useMemo","useHostGuard","buttonTokens","contentOnTint","jsx","_jsx","accessibilityHint","disabled","label","onPress","tint","variant","wide","theme","tokens","sxModifiers","accessibilityModifiers","undefined","modifiers","style","typography","body","outlined","fill","content","MaterialButton","colors","contentColor","color","disabledContentColor","containerColor","disabledContainerColor","enabled","onClick","children","colorString","fontFamily","fontSize","fontWeight","lineHeight"],"sourceRoot":"../../../../src","sources":["atoms/button/button.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,EAAEC,IAAI,IAAIC,WAAW,EAAEC,cAAc,QAAO,0BAA0B;AACrG,SAAQC,MAAM,IAAIC,cAAc,QAAO,oCAAoC;AAC3E,SAAQC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACxE,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAE/C,SAAQC,YAAY,EAAEC,aAAa,QAAO,oBAAiB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,MAAMf,MAAuB,GAAGA,CAAC;EACtCgB,iBAAiB;EACjBC,QAAQ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,CAACe,KAAK,CAACJ,OAAO;IAAC,CAAC,GAChF;MACEM,cAAc,EAAEjB,KAAK,CAACe,KAAK,CAACL,IAAI,CAAC;MACjCI,YAAY,EAAEd,KAAK,CAACe,KAAK,CAACJ,OAAO,CAAC;MAClCO,sBAAsB,EAAElB,KAAK,CAACe,KAAK,CAACL,IAAI,CAAC;MACzCM,oBAAoB,EAAEhB,KAAK,CAACe,KAAK,CAACJ,OAAO;IAC3C,CACL;IACDQ,OAAO,EAAE,CAACzB,QAAS;IACnBW,SAAS,EAAEA,SAAU;IACrBe,OAAO,EAAExB,OAAQ;IAAAyB,QAAA,eAEjB7B,IAAA,CAACZ,WAAW;MACVmC,KAAK,EAAEf,KAAK,CAACsB,WAAW,CAACX,OAAO,CAAE;MAClCL,KAAK,EAAE;QACLiB,UAAU,EAAEjB,KAAK,CAACiB,UAAU;QAC5BC,QAAQ,EAAElB,KAAK,CAACkB,QAAQ;QACxBC,UAAU,EAAEnB,KAAK,CAACmB,UAAU;QAC5BC,UAAU,EAAEpB,KAAK,CAACoB;MACpB,CAAE;MAAAL,QAAA,EAED1B;IAAK,CACK;EAAC,CACA,CAAC;AAErB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Button","ComposeButton","Spacer","ComposeSpacer","Text","ComposeText","OutlinedButton","TextButton","testID","testIdModifier","width","widthModifier","useAccessibilityModifiers","useSxModifiers","spacing","useAppTheme","useMemo","useHostGuard","Icon","buttonTokens","contentOnTint","jsx","_jsx","jsxs","_jsxs","ICON_GAP","s8","WITH_ICON_PADDING","end","s24","start","s16","TEXT_WITH_ICON_PADDING","s12","accessibilityHint","disabled","icon","label","onPress","tint","variant","wide","theme","tokens","sxModifiers","accessibilityModifiers","undefined","modifiers","style","typography","body","text","outlined","fill","content","MaterialButton","colors","containerColor","color","contentColor","disabledContainerColor","disabledContentColor","contentPadding","enabled","onClick","children","name","size","colorString","fontFamily","fontSize","fontWeight","lineHeight"],"sourceRoot":"../../../../src","sources":["atoms/button/button.android.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BAAoB,EAAEnB,KAAK,CAACgB,KAAK,CAACJ,OAAO;IAC3C,CAAC,GACD;MAACK,YAAY,EAAEjB,KAAK,CAACgB,KAAK,CAACJ,OAAO,CAAC;MAAEO,oBAAoB,EAAEnB,KAAK,CAACgB,KAAK,CAACJ,OAAO;IAAC,CACpF;IACDQ,cAAc,EAAE1B,IAAI,GAAIe,IAAI,GAAGnB,sBAAsB,GAAGL,iBAAiB,GAAImB,SAAU;IACvFiB,OAAO,EAAE,CAAC5B,QAAS;IACnBY,SAAS,EAAEA,SAAU;IACrBiB,OAAO,EAAE1B,OAAQ;IAAA2B,QAAA,GAEhB7B,IAAI,gBAAGd,IAAA,CAACJ,IAAI;MAACwC,KAAK,EAAEJ,OAAQ;MAACY,IAAI,EAAE9B,IAAK;MAAC+B,IAAI,EAAC;IAAK,CAAE,CAAC,GAAG,IAAI,EAC7D/B,IAAI,gBAAGd,IAAA,CAACnB,aAAa;MAAC4C,SAAS,EAAEtB;IAAS,CAAE,CAAC,GAAG,IAAI,eACrDH,IAAA,CAACjB,WAAW;MACVqD,KAAK,EAAEhB,KAAK,CAAC0B,WAAW,CAACd,OAAO,CAAE;MAClCN,KAAK,EAAE;QACLqB,UAAU,EAAErB,KAAK,CAACqB,UAAU;QAC5BC,QAAQ,EAAEtB,KAAK,CAACsB,QAAQ;QACxBC,UAAU,EAAEvB,KAAK,CAACuB,UAAU;QAC5BC,UAAU,EAAExB,KAAK,CAACwB;MACpB,CAAE;MAAAP,QAAA,EAED5B;IAAK,CACK,CAAC;EAAA,CACA,CAAC;AAErB,CAAC","ignoreList":[]}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import { Button as SwiftUIButton } from '@expo/ui/swift-ui';
4
- import { buttonStyle as buttonStyleModifier, controlSize as controlSizeModifier, disabled as disabledModifier, glassEffect as glassEffectModifier, tint as tintModifier } from '@expo/ui/swift-ui/modifiers';
3
+ import { Button as SwiftUIButton, Label as SwiftUILabel } from '@expo/ui/swift-ui';
4
+ import { buttonStyle as buttonStyleModifier, contentShape, controlSize as controlSizeModifier, disabled as disabledModifier, glassEffect as glassEffectModifier, labelStyle, shapes, tint as tintModifier } from '@expo/ui/swift-ui/modifiers';
5
5
  import { useAccessibilityModifiers } from '@hzblj/kara-sx';
6
6
  import { useAppTheme } from '@hzblj/kara-theme';
7
7
  import { useMemo } from 'react';
8
8
  import { useHostGuard } from "../../host-context.js";
9
+ import { Icon } from "../icon/index.js";
9
10
  import { Text } from "../text/index.js";
10
11
  import { VStack } from "../v-stack/index.js";
11
12
  import { buttonTokens, contentOnTint } from "./button-tokens.js";
@@ -14,19 +15,55 @@ const STYLE_BY_VARIANT = {
14
15
  accent: 'borderedProminent',
15
16
  destructive: 'borderedProminent',
16
17
  glass: 'glass',
18
+ plain: 'borderless',
17
19
  secondary: 'bordered'
18
20
  };
19
21
  const TINT_BY_VARIANT = {
20
22
  accent: 'fill.accent.primary',
21
23
  destructive: 'fill.destructive.primary',
22
24
  glass: undefined,
25
+ plain: undefined,
23
26
  secondary: undefined
24
27
  };
28
+
29
+ /** Both, wherever the button sits: a toolbar or a menu would otherwise show the icon alone. */
30
+ const TITLE_AND_ICON = [labelStyle('titleAndIcon')];
31
+
32
+ /**
33
+ * `borderless` draws nothing around the label, so the label is the button: padding takes it to a 44pt tap target,
34
+ * and a rectangle content shape makes the whole of it (the padding, and the width `wide` gives it) take the tap,
35
+ * not only the glyphs.
36
+ */
37
+ const TEXT_BUTTON_TARGET = {
38
+ modifiers: [contentShape(shapes.rectangle())]
39
+ };
40
+
41
+ /**
42
+ * A prominent style (and tinted glass) is coloured by the tint, so a caller's own tint picks the label on it. A text
43
+ * style has nothing to fill, so there the tint is the label's own colour.
44
+ */
45
+ const labelColor = ({
46
+ disabled,
47
+ filled,
48
+ textOnly,
49
+ theme,
50
+ tint,
51
+ tokens
52
+ }) => {
53
+ if (!tint || disabled) {
54
+ return tokens.content;
55
+ }
56
+ if (filled) {
57
+ return contentOnTint(tint, theme);
58
+ }
59
+ return textOnly ? tint : tokens.content;
60
+ };
25
61
  export const Button = ({
26
62
  accessibilityHint,
27
63
  buttonStyle,
28
64
  controlSize = 'large',
29
65
  disabled = false,
66
+ icon,
30
67
  label,
31
68
  onPress,
32
69
  testID,
@@ -51,8 +88,17 @@ export const Button = ({
51
88
  */
52
89
  const glassTint = style === 'glass' && resolvedTint ? theme.color(resolvedTint) : undefined;
53
90
  const filled = Boolean(glassTint) || style === 'borderedProminent' || style === 'glassProminent';
54
- // A prominent style — and tinted glass — is coloured by the tint, so a caller's own tint picks the label on it.
55
- const content = tint && filled && !disabled ? contentOnTint(tint, theme) : tokens.content;
91
+ const textOnly = style === 'borderless' || style === 'plain';
92
+ // Only the `plain` variant's own text button is padded out; another variant restyled `plain` keeps its layout.
93
+ const textButton = variant === 'plain' && textOnly;
94
+ const content = labelColor({
95
+ disabled,
96
+ filled,
97
+ textOnly,
98
+ theme,
99
+ tint,
100
+ tokens
101
+ });
56
102
  const accessibilityModifiers = useAccessibilityModifiers({
57
103
  accessibilityHint
58
104
  });
@@ -75,19 +121,29 @@ export const Button = ({
75
121
  }
76
122
  return list;
77
123
  }, [accessibilityModifiers, controlSize, disabled, glassTint, resolvedTint, style, theme]);
124
+ const text = /*#__PURE__*/_jsx(Text, {
125
+ color: content,
126
+ variant: "body",
127
+ children: label
128
+ });
78
129
  return /*#__PURE__*/_jsx(SwiftUIButton, {
79
130
  modifiers: modifiers,
80
131
  onPress: onPress,
81
132
  testID: testID,
82
133
  children: /*#__PURE__*/_jsx(VStack, {
83
134
  align: "center",
84
- py: glassTint ? 's16' : undefined,
135
+ ios: textButton ? TEXT_BUTTON_TARGET : undefined,
136
+ py: glassTint ? 's16' : textButton ? 's12' : undefined,
85
137
  wide: wide,
86
- children: /*#__PURE__*/_jsx(Text, {
87
- color: content,
88
- variant: "body",
89
- children: label
90
- })
138
+ children: icon ? /*#__PURE__*/_jsx(SwiftUILabel, {
139
+ icon: /*#__PURE__*/_jsx(Icon, {
140
+ color: content,
141
+ name: icon,
142
+ size: "s20"
143
+ }),
144
+ modifiers: TITLE_AND_ICON,
145
+ children: text
146
+ }) : text
91
147
  })
92
148
  });
93
149
  };
@@ -1 +1 @@
1
- {"version":3,"names":["Button","SwiftUIButton","buttonStyle","buttonStyleModifier","controlSize","controlSizeModifier","disabled","disabledModifier","glassEffect","glassEffectModifier","tint","tintModifier","useAccessibilityModifiers","useAppTheme","useMemo","useHostGuard","Text","VStack","buttonTokens","contentOnTint","jsx","_jsx","STYLE_BY_VARIANT","accent","destructive","glass","secondary","TINT_BY_VARIANT","undefined","accessibilityHint","label","onPress","testID","variant","wide","theme","tokens","resolvedTint","style","glassTint","color","filled","Boolean","content","accessibilityModifiers","modifiers","list","push","interactive","shape","children","align","py"],"sourceRoot":"../../../../src","sources":["atoms/button/button.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SACEC,WAAW,IAAIC,mBAAmB,EAClCC,WAAW,IAAIC,mBAAmB,EAClCC,QAAQ,IAAIC,gBAAgB,EAC5BC,WAAW,IAAIC,mBAAmB,EAClCC,IAAI,IAAIC,YAAY,QACf,6BAA6B;AACpC,SAAQC,yBAAyB,QAAO,gBAAgB;AACxD,SAAyBC,WAAW,QAAO,mBAAmB;AAC9D,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAS;AAC5B,SAAQC,MAAM,QAAO,qBAAY;AAEjC,SAAQC,YAAY,EAAEC,aAAa,QAAO,oBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3D,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,mBAAmB;EAC3BC,WAAW,EAAE,mBAAmB;EAChCC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAE;AACb,CAA2D;AAE3D,MAAMC,eAAe,GAAG;EACtBJ,MAAM,EAAE,qBAAqB;EAC7BC,WAAW,EAAE,0B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B,CAACD,WAAW,CAAC,EAChC,GAAGwC,sBAAsB,CAC1B;IAED,IAAIL,SAAS,EAAE;MACbO,IAAI,CAACC,IAAI,CACPtC,mBAAmB,CAAC;QAACgB,KAAK,EAAE;UAACuB,WAAW,EAAE,IAAI;UAAEtC,IAAI,EAAE6B,SAAS;UAAEN,OAAO,EAAE;QAAS,CAAC;QAAEgB,KAAK,EAAE;MAAS,CAAC,CACzG,CAAC;IACH,CAAC,MAAM,IAAIZ,YAAY,EAAE;MACvBS,IAAI,CAACC,IAAI,CAACpC,YAAY,CAACwB,KAAK,CAACK,KAAK,CAACH,YAAY,CAAC,CAAC,CAAC;IACpD;IAEA,IAAI/B,QAAQ,EAAE;MACZwC,IAAI,CAACC,IAAI,CAACxC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC;IAEA,OAAOuC,IAAI;EACb,CAAC,EAAE,CAACF,sBAAsB,EAAExC,WAAW,EAAEE,QAAQ,EAAEiC,SAAS,EAAEF,YAAY,EAAEC,KAAK,EAAEH,KAAK,CAAC,CAAC;EAE1F,oBACEd,IAAA,CAACpB,aAAa;IAAC4C,SAAS,EAAEA,SAAU;IAACd,OAAO,EAAEA,OAAQ;IAACC,MAAM,EAAEA,MAAO;IAAAkB,QAAA,eACpE7B,IAAA,CAACJ,MAAM;MAACkC,KAAK,EAAC,QAAQ;MAACC,EAAE,EAAEb,SAAS,GAAG,KAAK,GAAGX,SAAU;MAACM,IAAI,EAAEA,IAAK;MAAAgB,QAAA,eACnE7B,IAAA,CAACL,IAAI;QAACwB,KAAK,EAAEG,OAAQ;QAACV,OAAO,EAAC,MAAM;QAAAiB,QAAA,EACjCpB;MAAK,CACF;IAAC,CACD;EAAC,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Button","SwiftUIButton","Label","SwiftUILabel","buttonStyle","buttonStyleModifier","contentShape","controlSize","controlSizeModifier","disabled","disabledModifier","glassEffect","glassEffectModifier","labelStyle","shapes","tint","tintModifier","useAccessibilityModifiers","useAppTheme","useMemo","useHostGuard","Icon","Text","VStack","buttonTokens","contentOnTint","jsx","_jsx","STYLE_BY_VARIANT","accent","destructive","glass","plain","secondary","TINT_BY_VARIANT","undefined","TITLE_AND_ICON","TEXT_BUTTON_TARGET","modifiers","rectangle","labelColor","filled","textOnly","theme","tokens","content","accessibilityHint","icon","label","onPress","testID","variant","wide","resolvedTint","style","glassTint","color","Boolean","textButton","accessibilityModifiers","list","push","interactive","shape","text","children","align","ios","py","name","size"],"sourceRoot":"../../../../src","sources":["atoms/button/button.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,EAAEC,KAAK,IAAIC,YAAY,QAAO,mBAAmB;AAChF,SACEC,WAAW,IAAIC,mBAAmB,EAClCC,YAAY,EACZC,WAAW,IAAIC,mBAAmB,EAClCC,QAAQ,IAAIC,gBAAgB,EAC5BC,WAAW,IAAIC,mBAAmB,EAClCC,UAAU,EACVC,MAAM,EACNC,IAAI,IAAIC,YAAY,QACf,6BAA6B;AACpC,SAAQC,yBAAyB,QAAO,gBAAgB;AACxD,SAAqCC,WAAW,QAAO,mBAAmB;AAC1E,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAS;AAC5B,SAAQC,IAAI,QAAO,kBAAS;AAC5B,SAAQC,MAAM,QAAO,qBAAY;AAEjC,SAAQC,YAAY,EAAEC,aAAa,QAAO,oBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3D,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,mBAAmB;EAC3BC,WAAW,EAAE,mBAAmB;EAChCC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,YAAY;EACnBC,SAAS,EAAE;AACb,CAA2D;AAE3D,MAAMC,eAAe,GAAG;EACtBL,MAAM,EAAE,qBAAqB;EAC7BC,WAAW,EAAE,0BAA0B;EACvCC,KAAK,EAAEI,SAAS;E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AI,CAAC,CAAC;IACnC;IAEA,OAAOkD,IAAI;EACb,CAAC,EAAE,CAACD,sBAAsB,EAAEpD,WAAW,EAAEE,QAAQ,EAAE8C,SAAS,EAAEF,YAAY,EAAEC,KAAK,EAAEX,KAAK,CAAC,CAAC;EAE1F,MAAMqB,IAAI,gBACRrC,IAAA,CAACL,IAAI;IAACkC,KAAK,EAAEX,OAAQ;IAACM,OAAO,EAAC,MAAM;IAAAc,QAAA,EACjCjB;EAAK,CACF,CACP;EAED,oBACErB,IAAA,CAAC1B,aAAa;IAACqC,SAAS,EAAEA,SAAU;IAACW,OAAO,EAAEA,OAAQ;IAACC,MAAM,EAAEA,MAAO;IAAAe,QAAA,eACpEtC,IAAA,CAACJ,MAAM;MACL2C,KAAK,EAAC,QAAQ;MACdC,GAAG,EAAET,UAAU,GAAGrB,kBAAkB,GAAGF,SAAU;MACjDiC,EAAE,EAAEb,SAAS,GAAG,KAAK,GAAGG,UAAU,GAAG,KAAK,GAAGvB,SAAU;MACvDiB,IAAI,EAAEA,IAAK;MAAAa,QAAA,EAEVlB,IAAI,gBACHpB,IAAA,CAACxB,YAAY;QAAC4C,IAAI,eAAEpB,IAAA,CAACN,IAAI;UAACmC,KAAK,EAAEX,OAAQ;UAACwB,IAAI,EAAEtB,IAAK;UAACuB,IAAI,EAAC;QAAK,CAAE,CAAE;QAAChC,SAAS,EAAEF,cAAe;QAAA6B,QAAA,EAC5FD;MAAI,CACO,CAAC,GAEfA;IACD,CACK;EAAC,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { Checkbox as ComposeCheckbox, Row, Text } from '@expo/ui/jetpack-compose';
4
- import { clickable, fillMaxWidth } from '@expo/ui/jetpack-compose/modifiers';
4
+ import { clickable, fillMaxWidth, testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
5
5
  import { spacing, useAppTheme } from '@hzblj/kara-theme';
6
6
  import { useMemo } from 'react';
7
7
  import { useHostGuard } from "../../host-context.js";
@@ -18,17 +18,21 @@ export const Checkbox = ({
18
18
  disabled = false,
19
19
  label,
20
20
  onValueChange,
21
+ testID,
21
22
  value
22
23
  }) => {
23
24
  useHostGuard('Checkbox');
24
25
  const theme = useAppTheme();
25
26
  const rowModifiers = useMemo(() => disabled || !onValueChange ? [fillMaxWidth()] : [fillMaxWidth(), clickable(() => onValueChange(!value))], [disabled, onValueChange, value]);
27
+ // On the box, not the row: the box is its own toggleable node inside the row, and the one a test reads.
28
+ const controlModifiers = useMemo(() => testID ? [testIdModifier(testID)] : undefined, [testID]);
26
29
  const control = /*#__PURE__*/_jsx(ComposeCheckbox, {
27
30
  colors: {
28
31
  checkedColor: theme.color('fill.accent.primary'),
29
32
  checkmarkColor: theme.color('content.on.accent')
30
33
  },
31
34
  enabled: !disabled,
35
+ modifiers: controlModifiers,
32
36
  onCheckedChange: onValueChange ?? NOOP,
33
37
  value: value
34
38
  });
@@ -1 +1 @@
1
- {"version":3,"names":["Checkbox","ComposeCheckbox","Row","Text","clickable","fillMaxWidth","spacing","useAppTheme","useMemo","useHostGuard","jsx","_jsx","jsxs","_jsxs","NOOP","undefined","disabled","label","onValueChange","value","theme","rowModifiers","control","colors","checkedColor","color","checkmarkColor","enabled","onCheckedChange","horizontalArrangement","spacedBy","s8","modifiers","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.android.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,IAAIC,eAAe,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC/E,SAAQC,SAAS,EAAEC,YAAY,QAAO,oCAAoC;AAC1E,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA,MAAMC,IAAI,GAAGA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CACF,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Checkbox","ComposeCheckbox","Row","Text","clickable","fillMaxWidth","testID","testIdModifier","spacing","useAppTheme","useMemo","useHostGuard","jsx","_jsx","jsxs","_jsxs","NOOP","undefined","disabled","label","onValueChange","value","theme","rowModifiers","controlModifiers","control","colors","checkedColor","color","checkmarkColor","enabled","modifiers","onCheckedChange","horizontalArrangement","spacedBy","s8","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.android.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,IAAIC,eAAe,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC/E,SAAQC,SAAS,EAAEC,YAAY,EAAEC,MAAM,IAAIC,cAAc,QAAO,oCAAoC;AACpG,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA,MAAMC,IAAI,GAAGA,CAAA,KAAMC,SAAS;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMjB,QAA2B,GAAGA,CAAC;EAACkB,QAAQ,GAAG,KAAK;EAAEC,KAAK;EAAEC,aAAa;EAAEd,MAAM;EAAEe;AAAoB,CAAC,KAAK;EACrHV,YAAY,CAAC,UAAU,CAAC;EACxB,MAAMW,KAAK,GAAGb,WAAW,CAAC,CAAC;EAC3B,MAAMc,YAAY,GAAGb,OAAO,CAC1B,MAAOQ,QAAQ,IAAI,CAACE,aAAa,GAAG,CAACf,YAAY,CAAC,CAAC,CAAC,GAAG,CAACA,YAAY,CAAC,CAAC,EAAED,SAAS,CAAC,MAAMgB,aAAa,CAAC,CAACC,KAAK,CAAC,CAAC,CAAE,EAChH,CAACH,QAAQ,EAAEE,aAAa,EAAEC,KAAK,CACjC,CAAC;EACD;EACA,MAAMG,gBAAgB,GAAGd,OAAO,CAAC,MAAOJ,MAAM,GAAG,CAACC,cAAc,CAACD,MAAM,CAAC,CAAC,GAAGW,SAAU,EAAE,CAACX,MAAM,CAAC,CAAC;EACjG,MAAMmB,OAAO,gBACXZ,IAAA,CAACZ,eAAe;IACdyB,MAAM,EAAE;MAACC,YAAY,EAAEL,KAAK,CAACM,KAAK,CAAC,qBAAqB,CAAC;MAAEC,cAAc,EAAEP,KAAK,CAACM,KAAK,CAAC,mBAAmB;IAAC,CAAE;IAC7GE,OAAO,EAAE,CAACZ,QAAS;IACnBa,SAAS,EAAEP,gBAAiB;IAC5BQ,eAAe,EAAEZ,aAAa,IAAIJ,IAAK;IACvCK,KAAK,EAAEA;EAAM,CACd,CACF;EAED,IAAI,CAACF,KAAK,EAAE;IACV,OAAOM,OAAO;EAChB;EAEA,oBACEV,KAAA,CAACb,GAAG;IAAC+B,qBAAqB,EAAE;MAACC,QAAQ,EAAE1B,OAAO,CAAC2B;IAAE,CAAE;IAACJ,SAAS,EAAER,YAAa;IAACa,iBAAiB,EAAC,QAAQ;IAAAC,QAAA,GACpGZ,OAAO,eACRZ,IAAA,CAACV,IAAI;MAACyB,KAAK,EAAEN,KAAK,CAACgB,WAAW,CAACpB,QAAQ,GAAG,kBAAkB,GAAG,iBAAiB,CAAE;MAACqB,KAAK,EAAEjB,KAAK,CAACkB,UAAU,CAACC,IAAK;MAAAJ,QAAA,EAC7GlB;IAAK,CACF,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -10,6 +10,7 @@ export const Checkbox = ({
10
10
  disabled = false,
11
11
  label,
12
12
  onValueChange,
13
+ testID,
13
14
  value
14
15
  }) => {
15
16
  useHostGuard('Checkbox');
@@ -25,7 +26,8 @@ export const Checkbox = ({
25
26
  isOn: value,
26
27
  label: label,
27
28
  modifiers: modifiers,
28
- onIsOnChange: onValueChange
29
+ onIsOnChange: onValueChange,
30
+ testID: testID
29
31
  });
30
32
  };
31
33
  //# sourceMappingURL=checkbox.ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Toggle","disabled","disabledModifier","tint","useAppTheme","useMemo","useHostGuard","jsx","_jsx","Checkbox","label","onValueChange","value","theme","modifiers","list","color","push","isOn","onIsOnChange"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,mBAAmB;AACxC,SAAQC,QAAQ,IAAIC,gBAAgB,EAAEC,IAAI,QAAO,6BAA6B;AAC9E,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG/C,OAAO,MAAMC,QAA2B,GAAGA,CAAC;EAACR,QAAQ,GAAG,KAAK;EAAES,KAAK;EAAEC,aAAa;EAAEC;AAAoB,CAAC,KAAK;EAC7GN,YAAY,CAAC,UAAU,CAAC;EACxB,MAAMO,KAAK,GAAGT,WAAW,CAAC,CAAC;EAE3B,MAAMU,SAAS,GAAGT,OAAO,CAAC,MAAM;IAC9B,MAAMU,IAAI,GAAG,CAACZ,IAAI,CAACU,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAEvD,IAAIf,QAAQ,EAAE;MACZc,IAAI,CAACE,IAAI,CAACf,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC;IAEA,OAAOa,IAAI;EACb,CAAC,EAAE,CAACd,QAAQ,EAAEY,KAAK,CAAC,CAAC;EAErB,oBAAOL,IAAA,CAACR,MAAM;IAACkB,IAAI,EAAEN,KAAM;IAACF,KAAK,EAAEA,KAAM;IAACI,SAAS,EAAEA,SAAU;IAACK,YAAY,EAAER;EAAc,CAAE,CAAC;AACjG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Toggle","disabled","disabledModifier","tint","useAppTheme","useMemo","useHostGuard","jsx","_jsx","Checkbox","label","onValueChange","testID","value","theme","modifiers","list","color","push","isOn","onIsOnChange"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,mBAAmB;AACxC,SAAQC,QAAQ,IAAIC,gBAAgB,EAAEC,IAAI,QAAO,6BAA6B;AAC9E,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG/C,OAAO,MAAMC,QAA2B,GAAGA,CAAC;EAACR,QAAQ,GAAG,KAAK;EAAES,KAAK;EAAEC,aAAa;EAAEC,MAAM;EAAEC;AAAoB,CAAC,KAAK;EACrHP,YAAY,CAAC,UAAU,CAAC;EACxB,MAAMQ,KAAK,GAAGV,WAAW,CAAC,CAAC;EAE3B,MAAMW,SAAS,GAAGV,OAAO,CAAC,MAAM;IAC9B,MAAMW,IAAI,GAAG,CAACb,IAAI,CAACW,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAEvD,IAAIhB,QAAQ,EAAE;MACZe,IAAI,CAACE,IAAI,CAAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC;IAEA,OAAOc,IAAI;EACb,CAAC,EAAE,CAACf,QAAQ,EAAEa,KAAK,CAAC,CAAC;EAErB,oBAAON,IAAA,CAACR,MAAM;IAACmB,IAAI,EAAEN,KAAM;IAACH,KAAK,EAAEA,KAAM;IAACK,SAAS,EAAEA,SAAU;IAACK,YAAY,EAAET,aAAc;IAACC,MAAM,EAAEA;EAAO,CAAE,CAAC;AACjH,CAAC","ignoreList":[]}
@@ -9,8 +9,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  /**
10
10
  * The row SwiftUI's `ColorPicker` lays out on iOS, the label leading and the well trailing, around kara's own Compose
11
11
  * well: Compose ships no colour picker, so the sheet behind it draws the iOS picker's grid, spectrum and sliders.
12
+ * `disabled` dims the label and the well, which then does not open its sheet.
12
13
  */
13
14
  export const ColorPicker = ({
15
+ disabled = false,
14
16
  label,
15
17
  onValueChange,
16
18
  supportsOpacity = false,
@@ -24,8 +26,10 @@ export const ColorPicker = ({
24
26
  testID: testID,
25
27
  wide: true,
26
28
  children: [label ? /*#__PURE__*/_jsx(Text, {
29
+ color: disabled ? 'content.tertiary' : undefined,
27
30
  children: label
28
31
  }) : null, /*#__PURE__*/_jsx(Spacer, {}), /*#__PURE__*/_jsx(ColorWell, {
32
+ enabled: !disabled,
29
33
  onValueChange: onValueChange,
30
34
  supportsOpacity: supportsOpacity,
31
35
  title: label,
@@ -1 +1 @@
1
- {"version":3,"names":["ColorWell","useHostGuard","HStack","Spacer","Text","jsx","_jsx","jsxs","_jsxs","ColorPicker","label","onValueChange","supportsOpacity","testID","value","align","spacing","wide","children","title"],"sourceRoot":"../../../../src","sources":["atoms/color-picker/color-picker.android.tsx"],"mappings":";;AAAA,SAAQA,SAAS,QAAO,oCAAoC;AAE5D,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,MAAM,QAAO,qBAAY;AACjC,SAAQC,MAAM,QAAO,oBAAW;AAChC,SAAQC,IAAI,QAAO,kBAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG5B;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAiC,GAAGA,CAAC;EAChDC,KAAK;EACLC,aAAa;EACbC,eAAe,GAAG,KAAK;EACvBC,MAAM;EACNC;AACgB,CAAC,KAAK;EACtBb,YAAY,CAAC,aAAa,CAAC;EAE3B,oBACEO,KAAA,CAACN,MAAM;IAACa,KAAK,EAAC,QAAQ;IAACC,OAAO,EAAC,KAAK;IAACH,MAAM,EAAEA,MAAO;IAACI,IAAI;IAAAC,QAAA,GACtDR,KAAK,gBAAGJ,IAAA,CAACF,IAAI;MAAAc,QAAA,EAAER;IAAK,CAAO,CAAC,GAAG,IAAI,eACpCJ,IAAA,CAACH,MAAM,IAAE,CAAC,eACVG,IAAA,CAACN,SAAS;MAACW,aAAa,EAAEA,aAAc;MAACC,eAAe,EAAEA,eAAgB;MAACO,KAAK,EAAET,KAAM;MAACI,KAAK,EAAEA;IAAM,CAAE,CAAC;EAAA,CACnG,CAAC;AAEb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ColorWell","useHostGuard","HStack","Spacer","Text","jsx","_jsx","jsxs","_jsxs","ColorPicker","disabled","label","onValueChange","supportsOpacity","testID","value","align","spacing","wide","children","color","undefined","enabled","title"],"sourceRoot":"../../../../src","sources":["atoms/color-picker/color-picker.android.tsx"],"mappings":";;AAAA,SAAQA,SAAS,QAAO,oCAAoC;AAE5D,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,MAAM,QAAO,qBAAY;AACjC,SAAQC,MAAM,QAAO,oBAAW;AAChC,SAAQC,IAAI,QAAO,kBAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG5B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAiC,GAAGA,CAAC;EAChDC,QAAQ,GAAG,KAAK;EAChBC,KAAK;EACLC,aAAa;EACbC,eAAe,GAAG,KAAK;EACvBC,MAAM;EACNC;AACgB,CAAC,KAAK;EACtBd,YAAY,CAAC,aAAa,CAAC;EAE3B,oBACEO,KAAA,CAACN,MAAM;IAACc,KAAK,EAAC,QAAQ;IAACC,OAAO,EAAC,KAAK;IAACH,MAAM,EAAEA,MAAO;IAACI,IAAI;IAAAC,QAAA,GACtDR,KAAK,gBAAGL,IAAA,CAACF,IAAI;MAACgB,KAAK,EAAEV,QAAQ,GAAG,kBAAkB,GAAGW,SAAU;MAAAF,QAAA,EAAER;IAAK,CAAO,CAAC,GAAG,IAAI,eACtFL,IAAA,CAACH,MAAM,IAAE,CAAC,eACVG,IAAA,CAACN,SAAS;MACRsB,OAAO,EAAE,CAACZ,QAAS;MACnBE,aAAa,EAAEA,aAAc;MAC7BC,eAAe,EAAEA,eAAgB;MACjCU,KAAK,EAAEZ,KAAM;MACbI,KAAK,EAAEA;IAAM,CACd,CAAC;EAAA,CACI,CAAC;AAEb,CAAC","ignoreList":[]}
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  import { ColorPicker as SwiftUIColorPicker } from '@expo/ui/swift-ui';
4
+ import { disabled as disabledModifier, labelsHidden, opacity as opacityModifier } from '@expo/ui/swift-ui/modifiers';
5
+ import { opacity } from '@hzblj/kara-theme';
4
6
  import { useHostGuard } from "../../host-context.js";
5
- import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { HStack } from "../h-stack/index.js";
8
+ import { Spacer } from "../spacer/index.js";
9
+ import { Text } from "../text/index.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ // iOS 27 stops a disabled picker but draws its label and well at full strength: the label is then kara's own text,
12
+ // dimmed, and the well takes the opacity.
13
+ const DISABLED = [labelsHidden(), disabledModifier(true), opacityModifier(opacity.o40)];
6
14
  export const ColorPicker = ({
15
+ disabled = false,
7
16
  label,
8
17
  onValueChange,
9
18
  supportsOpacity = false,
@@ -11,12 +20,25 @@ export const ColorPicker = ({
11
20
  value
12
21
  }) => {
13
22
  useHostGuard('ColorPicker');
14
- return /*#__PURE__*/_jsx(SwiftUIColorPicker, {
23
+ const picker = /*#__PURE__*/_jsx(SwiftUIColorPicker, {
15
24
  label: label,
25
+ modifiers: disabled ? DISABLED : undefined,
16
26
  onSelectionChange: onValueChange,
17
27
  selection: value,
18
28
  supportsOpacity: supportsOpacity,
19
29
  testID: testID
20
30
  });
31
+ if (!disabled) {
32
+ return picker;
33
+ }
34
+ return /*#__PURE__*/_jsxs(HStack, {
35
+ align: "center",
36
+ spacing: "s12",
37
+ wide: true,
38
+ children: [label ? /*#__PURE__*/_jsx(Text, {
39
+ color: "content.tertiary",
40
+ children: label
41
+ }) : null, /*#__PURE__*/_jsx(Spacer, {}), picker]
42
+ });
21
43
  };
22
44
  //# sourceMappingURL=color-picker.ios.js.map