achery-ui 0.10.1 → 0.10.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "achery-ui",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Achery Workshop design system — autumn alchemy, hard edges, botanical marginalia.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,11 +4,13 @@ import { useTheme } from '../theme/ThemeContext'
4
4
 
5
5
  export type BadgeTone = 'neutral' | 'saved' | 'drafting' | 'stopped' | 'archived'
6
6
  export type BadgeVariant = 'outline' | 'solid'
7
+ export type BadgeSize = 'sm' | 'md' | 'lg'
7
8
 
8
9
  export interface BadgeProps {
9
10
  tone?: BadgeTone
10
11
  variant?: BadgeVariant
11
12
  dot?: boolean
13
+ size?: BadgeSize
12
14
  children: string
13
15
  style?: ViewStyle
14
16
  }
@@ -24,7 +26,9 @@ function toneColors(tone: BadgeTone, variant: BadgeVariant, isDark: boolean) {
24
26
  return map[tone]
25
27
  }
26
28
 
27
- export function Badge({ tone = 'neutral', variant = 'outline', dot = false, children, style }: BadgeProps) {
29
+ const badgeFontSize: Record<BadgeSize, number> = { sm: 10, md: 11, lg: 12 }
30
+
31
+ export function Badge({ tone = 'neutral', variant = 'outline', dot = false, size = 'md', children, style }: BadgeProps) {
28
32
  const { tokens, dark } = useTheme()
29
33
  const colors = toneColors(tone, variant, dark)
30
34
 
@@ -51,7 +55,7 @@ export function Badge({ tone = 'neutral', variant = 'outline', dot = false, chil
51
55
  {dot && (
52
56
  <View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: colors.fg }} />
53
57
  )}
54
- <Text style={{ color: fg, fontSize: 11, fontWeight: fontWeights.semibold.toString() as any, letterSpacing: 0.5 }}>
58
+ <Text style={{ color: fg, fontSize: badgeFontSize[size], fontWeight: fontWeights.semibold.toString() as any, letterSpacing: 0.5 }}>
55
59
  {children}
56
60
  </Text>
57
61
  </View>
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from 'react'
1
2
  import { TouchableOpacity, View, Text, StyleSheet, type ViewStyle } from 'react-native'
2
3
  import { spacing, fontWeights } from 'achery-ui/tokens'
3
4
  import { useTheme } from '../theme/ThemeContext'
@@ -9,7 +10,7 @@ export type ButtonSize = 'sm' | 'md' | 'lg'
9
10
  export interface ButtonProps {
10
11
  variant?: ButtonVariant
11
12
  size?: ButtonSize
12
- children: string
13
+ children: ReactNode
13
14
  onPress?: () => void
14
15
  disabled?: boolean
15
16
  style?: ViewStyle
@@ -37,6 +38,14 @@ function makeColors(variant: ButtonVariant, tokens: SemanticTokens) {
37
38
  export function Button({ variant = 'secondary', size = 'md', children, onPress, disabled, style }: ButtonProps) {
38
39
  const { tokens } = useTheme()
39
40
  const colors = makeColors(variant, tokens)
41
+ const textStyle = {
42
+ color: disabled ? tokens.fgMute : colors.label,
43
+ fontSize: fontSize[size],
44
+ fontWeight: fontWeights.semibold.toString() as any,
45
+ letterSpacing: 0.01 * fontSize[size],
46
+ }
47
+
48
+ const isString = typeof children === 'string'
40
49
 
41
50
  return (
42
51
  <TouchableOpacity
@@ -52,20 +61,18 @@ export function Button({ variant = 'secondary', size = 'md', children, onPress,
52
61
  paddingHorizontal: paddingH[size],
53
62
  alignSelf: 'flex-start',
54
63
  opacity: disabled ? 0.5 : 1,
64
+ flexDirection: 'row',
65
+ alignItems: 'center',
66
+ gap: spacing.sp2,
55
67
  },
56
68
  style,
57
69
  ]}
58
70
  >
59
- <Text
60
- style={{
61
- color: disabled ? tokens.fgMute : colors.label,
62
- fontSize: fontSize[size],
63
- fontWeight: fontWeights.semibold.toString() as any,
64
- letterSpacing: 0.01 * fontSize[size],
65
- }}
66
- >
67
- {children}
68
- </Text>
71
+ {isString ? (
72
+ <Text style={textStyle}>{children}</Text>
73
+ ) : (
74
+ children
75
+ )}
69
76
  </TouchableOpacity>
70
77
  )
71
78
  }
@@ -1,4 +1,4 @@
1
- import { View, TextInput, Text, type TextInputProps, type TextStyle, type ViewStyle } from 'react-native'
1
+ import { View, TextInput, Text, type TextInputProps, type ViewStyle } from 'react-native'
2
2
  import { spacing, fontWeights } from 'achery-ui/tokens'
3
3
  import { useTheme } from '../theme/ThemeContext'
4
4
 
@@ -32,7 +32,6 @@ export function Field({ label, hint, error, children, style }: FieldProps) {
32
32
 
33
33
  export interface InputProps extends TextInputProps {
34
34
  error?: boolean
35
- style?: ViewStyle
36
35
  }
37
36
 
38
37
  export function Input({ error, style, ...props }: InputProps) {
@@ -61,7 +60,6 @@ export interface TextareaProps extends TextInputProps {
61
60
  error?: boolean
62
61
  /** Approximate number of visible lines. @default 4 */
63
62
  rows?: number
64
- style?: TextStyle
65
63
  }
66
64
 
67
65
  /**
@@ -60,7 +60,7 @@ export const Skeleton = ({ lines = 3, width, block = false, height = 80, style }
60
60
  {Array.from({ length: lines }).map((_, i) => (
61
61
  <Animated.View
62
62
  key={i}
63
- style={[baseStyle, { height: LINE_HEIGHT, width: lineWidths[i] ?? '100%' }, { opacity }]}
63
+ style={[baseStyle, { height: LINE_HEIGHT, width: (lineWidths[i] ?? '100%') as any }, { opacity }]}
64
64
  />
65
65
  ))}
66
66
  </View>
@@ -1,6 +1,6 @@
1
- import { useState } from 'react'
1
+ import { useState, type ReactNode } from 'react'
2
2
  import { ScrollView, TouchableOpacity, View, Text } from 'react-native'
3
- import type { ViewStyle, ReactNode } from 'react-native'
3
+ import type { ViewStyle } from 'react-native'
4
4
  import { spacing, fontWeights } from 'achery-ui/tokens'
5
5
  import { useTheme } from '../theme/ThemeContext'
6
6
 
@@ -2,17 +2,18 @@ export { NativeThemeProvider, useTheme } from './theme/ThemeContext'
2
2
  export type { NativeThemeProviderProps, NativeThemeContextValue } from './theme/ThemeContext'
3
3
 
4
4
  export {
5
- Text, Button, Card, Badge, Field, Input, MaterialCard, MaterialEyebrow,
5
+ Text, Button, Card, Badge, Field, Input, Textarea, MaterialCard, MaterialEyebrow,
6
6
  Glyph, GlyphPicker,
7
7
  Skeleton, ProgressBar, Checkbox, Toggle, Tabs,
8
8
  ToastProvider, useToast,
9
+ StatusDot, SegmentedControl, ScreenNav,
9
10
  } from './components/index'
10
11
  export type {
11
12
  TextProps,
12
13
  ButtonProps, ButtonVariant, ButtonSize,
13
14
  CardProps, CardVariant, CardPadding,
14
15
  BadgeProps, BadgeTone, BadgeVariant,
15
- FieldProps, InputProps,
16
+ FieldProps, InputProps, TextareaProps,
16
17
  NativeMaterialCardProps, MaterialIntensity,
17
18
  NativeGlyphProps,
18
19
  GlyphPickerProps,
@@ -22,6 +23,9 @@ export type {
22
23
  ToggleProps,
23
24
  TabsProps, TabItem,
24
25
  ToastProviderProps, ToastData, ToastOptions,
26
+ StatusDotProps,
27
+ SegmentedControlProps, NativeSegmentOption,
28
+ ScreenNavProps,
25
29
  } from './components/index'
26
30
 
27
31
  // Glyph utilities — pure TS, work on native