@hzblj/kara-components 0.13.2 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/lib/module/atoms/activity-indicator/activity-indicator.android.js +14 -7
  3. package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -1
  4. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +12 -2
  5. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -1
  6. package/lib/module/atoms/date-picker/date-picker.android.js +13 -1
  7. package/lib/module/atoms/date-picker/date-picker.android.js.map +1 -1
  8. package/lib/module/atoms/date-picker/date-picker.ios.js +19 -12
  9. package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
  10. package/lib/module/atoms/picker/picker.android.js +48 -41
  11. package/lib/module/atoms/picker/picker.android.js.map +1 -1
  12. package/lib/module/atoms/picker/picker.ios.js +25 -2
  13. package/lib/module/atoms/picker/picker.ios.js.map +1 -1
  14. package/lib/module/atoms/segmented-control/segmented-control.android.js +25 -18
  15. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
  16. package/lib/module/atoms/segmented-control/segmented-control.ios.js +15 -2
  17. package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -1
  18. package/lib/module/atoms/text/spans.js +44 -0
  19. package/lib/module/atoms/text/spans.js.map +1 -0
  20. package/lib/module/atoms/text/text.android.js +68 -3
  21. package/lib/module/atoms/text/text.android.js.map +1 -1
  22. package/lib/module/atoms/text/text.ios.js +15 -4
  23. package/lib/module/atoms/text/text.ios.js.map +1 -1
  24. package/lib/module/host-context.js +8 -0
  25. package/lib/module/host-context.js.map +1 -1
  26. package/lib/typescript/atoms/activity-indicator/activity-indicator.ios.d.ts +4 -1
  27. package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +2 -1
  28. package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +2 -1
  29. package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +1 -1
  30. package/lib/typescript/atoms/picker/picker.ios.d.ts +5 -0
  31. package/lib/typescript/atoms/picker/picker.types.d.ts +6 -2
  32. package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +2 -1
  33. package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +2 -1
  34. package/lib/typescript/atoms/text/spans.d.ts +14 -0
  35. package/lib/typescript/atoms/text/text.types.d.ts +8 -1
  36. package/lib/typescript/host-context.d.ts +7 -0
  37. package/package.json +4 -4
  38. package/src/atoms/activity-indicator/activity-indicator.android.tsx +18 -5
  39. package/src/atoms/activity-indicator/activity-indicator.ios.tsx +10 -2
  40. package/src/atoms/activity-indicator/activity-indicator.types.ts +2 -1
  41. package/src/atoms/date-picker/date-picker.android.tsx +15 -1
  42. package/src/atoms/date-picker/date-picker.ios.tsx +20 -9
  43. package/src/atoms/date-picker/date-picker.types.ts +1 -1
  44. package/src/atoms/picker/picker.android.tsx +53 -44
  45. package/src/atoms/picker/picker.ios.tsx +28 -7
  46. package/src/atoms/picker/picker.types.ts +6 -2
  47. package/src/atoms/segmented-control/segmented-control.android.tsx +29 -18
  48. package/src/atoms/segmented-control/segmented-control.ios.tsx +10 -2
  49. package/src/atoms/segmented-control/segmented-control.types.ts +2 -1
  50. package/src/atoms/text/spans.ts +45 -0
  51. package/src/atoms/text/text.android.tsx +69 -3
  52. package/src/atoms/text/text.ios.tsx +36 -4
  53. package/src/atoms/text/text.types.ts +8 -1
  54. package/src/host-context.tsx +8 -0
@@ -12,6 +12,10 @@ export type TextTransform = 'lowercase' | 'uppercase'
12
12
  * SwiftUI `Text` / Compose `Text` in a theme typography variant. A native atom: outside a host, use `RnText`. It takes
13
13
  * the native `sx` surface too: padding, a frame (`wide` lines it up by `align`), a background, and the `ios` bucket's
14
14
  * `contentTransition`, `animation` and `monospacedDigit` for a number that changes in place.
15
+ *
16
+ * Nested `Text` children are spans: runs of the same text in a colour of their own, one paragraph that wraps as one.
17
+ * With `animate`, a colour that changes (the text's or a span's) eases to its new value instead of switching: a word lit
18
+ * as it is said, a phrase brought forward. SwiftUI interpolates the text, Compose animates each span's colour.
15
19
  */
16
20
  export type TextProps = ResponsiveSx &
17
21
  AccessibilityProps & {
@@ -20,7 +24,10 @@ export type TextProps = ResponsiveSx &
20
24
  * layout; Android keeps them as they are.
21
25
  */
22
26
  align?: TextAlign
23
- /** The text. */
27
+ /**
28
+ * The text: a string, or strings and nested `Text` spans, each in a `color` of its own. A span takes only its
29
+ * colour; the variant, alignment and everything else are the outer text's.
30
+ */
24
31
  children?: ReactNode
25
32
  /** The text's colour. `content.primary` by default. */
26
33
  color?: ColorToken
@@ -6,6 +6,14 @@ export const HostBoundary = ({children}: {children: ReactNode}) => (
6
6
  <HostContext.Provider value>{children}</HostContext.Provider>
7
7
  )
8
8
 
9
+ /**
10
+ * Whether this renders inside a `Screen` or `Island` already. An atom that brings its own host renders straight into
11
+ * that one instead: on Android a host nested in another is a real view beside the outer host's own `ComposeView`, and
12
+ * the outer host (a horizontal `LinearLayout`) measures its `ComposeView` in the width the nested one leaves over,
13
+ * which for a full-width nested host is none.
14
+ */
15
+ export const useInsideHost = () => useContext(HostContext)
16
+
9
17
  export const useHostGuard = (atom: string) => {
10
18
  const insideHost = useContext(HostContext)
11
19