@webority/mobile-ui 0.7.3 → 0.8.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 (57) hide show
  1. package/lib/commonjs/components/FilePicker/FilePicker.js +1 -1
  2. package/lib/commonjs/components/Notation/Notation.js +1 -1
  3. package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
  4. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  5. package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  6. package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
  7. package/lib/commonjs/components/Radio/Radio.js +1 -1
  8. package/lib/commonjs/components/SliderField/SliderField.js +1 -1
  9. package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
  10. package/lib/commonjs/components/TagInput/TagInput.js +1 -1
  11. package/lib/commonjs/theme/tokens.js +1 -1
  12. package/lib/module/components/FilePicker/FilePicker.js +1 -1
  13. package/lib/module/components/Notation/Notation.js +1 -1
  14. package/lib/module/components/OTPInput/OTPInput.js +1 -1
  15. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  16. package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  17. package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
  18. package/lib/module/components/Radio/Radio.js +1 -1
  19. package/lib/module/components/SliderField/SliderField.js +1 -1
  20. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  21. package/lib/module/components/TagInput/TagInput.js +1 -1
  22. package/lib/module/theme/tokens.js +1 -1
  23. package/lib/typescript/commonjs/components/Autocomplete/Autocomplete.d.ts +1 -1
  24. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +1 -1
  25. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +2 -1
  26. package/lib/typescript/commonjs/components/FilePicker/FilePicker.d.ts +1 -1
  27. package/lib/typescript/commonjs/components/Notation/Notation.d.ts +17 -8
  28. package/lib/typescript/commonjs/components/Notation/index.d.ts +1 -1
  29. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +6 -1
  30. package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +6 -5
  31. package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +1 -1
  32. package/lib/typescript/commonjs/components/ProfilePicker/ProfilePicker.d.ts +1 -1
  33. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +2 -1
  34. package/lib/typescript/commonjs/components/SliderField/SliderField.d.ts +1 -1
  35. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +2 -1
  36. package/lib/typescript/commonjs/components/TagInput/TagInput.d.ts +2 -1
  37. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +1 -1
  38. package/lib/typescript/commonjs/components/index.d.ts +1 -1
  39. package/lib/typescript/commonjs/theme/types.d.ts +18 -0
  40. package/lib/typescript/module/components/Autocomplete/Autocomplete.d.ts +1 -1
  41. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +1 -1
  42. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +2 -1
  43. package/lib/typescript/module/components/FilePicker/FilePicker.d.ts +1 -1
  44. package/lib/typescript/module/components/Notation/Notation.d.ts +17 -8
  45. package/lib/typescript/module/components/Notation/index.d.ts +1 -1
  46. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +6 -1
  47. package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +6 -5
  48. package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +1 -1
  49. package/lib/typescript/module/components/ProfilePicker/ProfilePicker.d.ts +1 -1
  50. package/lib/typescript/module/components/Radio/Radio.d.ts +2 -1
  51. package/lib/typescript/module/components/SliderField/SliderField.d.ts +1 -1
  52. package/lib/typescript/module/components/Switch/Switch.d.ts +2 -1
  53. package/lib/typescript/module/components/TagInput/TagInput.d.ts +2 -1
  54. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +1 -1
  55. package/lib/typescript/module/components/index.d.ts +1 -1
  56. package/lib/typescript/module/theme/types.d.ts +18 -0
  57. package/package.json +2 -2
@@ -638,6 +638,15 @@ export interface InlineSelectTokens {
638
638
  /** Trigger text + chevron colour. Library default: `colors.primary`. */
639
639
  color?: string;
640
640
  }
641
+ export interface OptionSheetTokens {
642
+ /**
643
+ * Mark on the selected row of a single-choice sheet (Select, InlineSelect,
644
+ * PhoneNumberInput and every other OptionSheet): `'dot'` is an 8 px dot,
645
+ * `'icon'` the `tick-circle` icon in its bulk style at 20 px. Both are drawn
646
+ * in `colors.primary`. Multi-select keeps its checkbox. Library default: `'dot'`.
647
+ */
648
+ selectedMarker?: 'dot' | 'icon';
649
+ }
641
650
  export interface SelectTokens {
642
651
  /** Colour of the grab-handle rendered above the bottom-sheet picker. Library default: `colors.border.primary`. */
643
652
  handleColor?: string;
@@ -1022,6 +1031,7 @@ export interface ComponentTokens {
1022
1031
  listItem?: ListItemTokens;
1023
1032
  modal?: ModalTokens;
1024
1033
  numberInput?: NumberInputTokens;
1034
+ optionSheet?: OptionSheetTokens;
1025
1035
  otpInput?: OTPInputTokens;
1026
1036
  phoneNumberInput?: PhoneNumberInputTokens;
1027
1037
  profilePicker?: ProfilePickerTokens;
@@ -1121,6 +1131,14 @@ export interface Theme {
1121
1131
  typography: TypographyScale;
1122
1132
  spacing: SpacingScale;
1123
1133
  radius: RadiusScale;
1134
+ /**
1135
+ * Corner smoothing of the squircle Android draws behind Button, Card,
1136
+ * fields, Box and the other smooth-cornered hosts: 0 is a plain rounded
1137
+ * rectangle, 1 the fullest curve. iOS draws Apple's continuous curve, which
1138
+ * has no smoothing setting, so this changes Android only. Library default:
1139
+ * `SQUIRCLE_SMOOTHING` (0.6, Figma's "iOS" preset).
1140
+ */
1141
+ cornerSmoothing: number;
1124
1142
  shadows: ShadowScale;
1125
1143
  motion: MotionScale;
1126
1144
  components: ComponentTokens;
@@ -32,7 +32,7 @@ export interface AutocompleteProps<T = string> {
32
32
  loadingText?: string;
33
33
  placeholder?: string;
34
34
  label?: string;
35
- error?: string;
35
+ error?: React.ReactNode;
36
36
  helperText?: string;
37
37
  disabled?: boolean;
38
38
  size?: InputSize;
@@ -47,7 +47,7 @@ export interface DatePickerProps {
47
47
  label?: string;
48
48
  placeholder?: string;
49
49
  helperText?: string;
50
- error?: string;
50
+ error?: React.ReactNode;
51
51
  required?: boolean;
52
52
  disabled?: boolean;
53
53
  size?: PickerTriggerSize;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { View as RNView, StyleProp, ViewStyle } from 'react-native';
2
3
  import type { HapticType } from '../../utils/index.js';
3
4
  import type { PickerTriggerSize, PickerTriggerVariant } from '../PickerTrigger/index.js';
@@ -26,7 +27,7 @@ export interface DateRangePickerProps {
26
27
  label?: string;
27
28
  placeholder?: string;
28
29
  helperText?: string;
29
- error?: string;
30
+ error?: ReactNode;
30
31
  required?: boolean;
31
32
  disabled?: boolean;
32
33
  size?: PickerTriggerSize;
@@ -131,7 +131,7 @@ export interface FilePickerProps {
131
131
  /** Hint under the trigger (e.g. "Up to 5 files, max 100MB each."). */
132
132
  helperText?: string;
133
133
  /** External error — wins over internal validation errors (form binding). */
134
- error?: string;
134
+ error?: React.ReactNode;
135
135
  labels?: Partial<FilePickerLabels>;
136
136
  /** Haptics for pick/remove (selection) and rejections (error). Pass false to disable. */
137
137
  haptic?: HapticType | false;
@@ -4,24 +4,33 @@ export interface NotationRun {
4
4
  /** The subscript that follows `text`, when the run is a symbol. */
5
5
  sub?: string;
6
6
  }
7
+ /**
8
+ * One run of a `text` list: a string is ours and its `X_sub` symbols are subscripted; a
9
+ * `{ verbatim }` run is stored text (a citation, a clause, an option name) printed exactly as given.
10
+ */
11
+ export type NotationTextRun = string | {
12
+ verbatim: string;
13
+ };
7
14
  export interface NotationProps {
8
- /** Engine text where an underscore marks a subscript ("N_SG exceeds N_C"). Needs a parent Text. */
9
- text?: string;
10
- /** One symbol: the base, drawn with `sub` small after it. Renders its own Text. */
15
+ /**
16
+ * Engine text where an underscore marks a subscript ("N_SG exceeds N_C"), or a list of runs that
17
+ * mixes such text with verbatim stored text. Needs a parent Text.
18
+ */
19
+ text?: string | readonly NotationTextRun[];
20
+ /** One symbol: the base, drawn with `sub` small and lowered after it. Needs a parent Text. */
11
21
  base?: string;
12
22
  sub?: string;
13
23
  /** Follows the symbol after a space. */
14
24
  desc?: string;
25
+ /** Subscript ink. Defaults to `colors.text.primary`; pass the parent's colour when it differs. */
26
+ color?: string;
15
27
  testID?: string;
16
28
  }
17
29
  /** The text split into runs: `{ text }` for prose, `{ text, sub }` for a symbol and its subscript. */
18
30
  export declare const parseNotation: (text: string | null | undefined) => NotationRun[];
19
- /**
20
- * A symbol of a standard with its subscript drawn small. React Native has no <sub>, and a nested
21
- * Text cannot be shifted down, so the subscript is smaller and sits on the baseline.
22
- */
31
+ /** A symbol of a standard with its subscript drawn small and lowered below the baseline. */
23
32
  export declare const Notation: React.FC<NotationProps>;
24
33
  /** A symbol as the standard prints it: `sym('C', 'IP')` is C with a small IP, then `desc` if given. */
25
- export declare const sym: (base: string, sub?: string, desc?: string) => React.ReactElement;
34
+ export declare const sym: (base: string, sub?: string, desc?: string, color?: string) => React.ReactElement;
26
35
  export default Notation;
27
36
  //# sourceMappingURL=Notation.d.ts.map
@@ -1,3 +1,3 @@
1
- export type { NotationProps, NotationRun } from './Notation.js';
1
+ export type { NotationProps, NotationRun, NotationTextRun } from './Notation.js';
2
2
  export { default, Notation, parseNotation, sym } from './Notation.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
3
  import type { HapticType } from '../../utils/index.js';
3
4
  export type OTPInputSize = 'sm' | 'md' | 'lg';
@@ -21,7 +22,11 @@ export interface OTPInputProps {
21
22
  */
22
23
  autoFocusDelay?: number;
23
24
  disabled?: boolean;
24
- error?: boolean | string;
25
+ /**
26
+ * A string or a node puts the cells in the error state and shows it as the
27
+ * message below them; `true` shows the error state without a message.
28
+ */
29
+ error?: ReactNode;
25
30
  size?: OTPInputSize;
26
31
  secure?: boolean;
27
32
  /**
@@ -4,10 +4,11 @@
4
4
  * The picker behind Select and InlineSelect, exported so an app can open the
5
5
  * same sheet from its own trigger: RN Modal-backed slide-up
6
6
  * sheet with backdrop fade, grab handle, optional title, optional client-side
7
- * search, the option list (icon + label + description, single dot / multi
8
- * checkbox) and the multi-select Done footer. Owns the open/close animations
9
- * and the search query; selection STATE stays with the caller — the sheet
10
- * only reports `onSelect(option)` and asks `isSelected(value)`.
7
+ * search, the option list (icon + label + description, single dot or tick
8
+ * icon / multi checkbox) and the multi-select Done footer. Owns the
9
+ * open/close animations and the search query; selection STATE stays with
10
+ * the caller — the sheet only reports `onSelect(option)` and asks
11
+ * `isSelected(value)`.
11
12
  *
12
13
  * Also the home of the canonical option types (`SelectValue`, `SelectOption`)
13
14
  * and accessor signatures shared by every option-picking component. Select
@@ -58,7 +59,7 @@ export interface OptionSheetProps {
58
59
  renderSectionHeader?: (title: string) => React.ReactNode;
59
60
  /**
60
61
  * Replace the row's content (icon + label + description) with your own. The
61
- * pressable row, its accessibility state and the selected dot / checkbox
62
+ * pressable row, its accessibility state and the selected mark / checkbox
62
63
  * stay, so a custom row is still a button to a screen reader.
63
64
  */
64
65
  renderOption?: (option: unknown, state: OptionSheetRowState) => React.ReactNode;
@@ -160,7 +160,7 @@ export interface PhoneNumberInputProps extends Pick<TextInputProps, 'returnKeyTy
160
160
  placeholder?: string;
161
161
  helperText?: string;
162
162
  /** The app's own error text. Always wins over the built-in invalid-number message. */
163
- error?: string;
163
+ error?: ReactNode;
164
164
  /**
165
165
  * Text under the field once the typed number is not a real number for the
166
166
  * country under `validation`. Shown after the user leaves the field with
@@ -101,7 +101,7 @@ export interface ProfilePickerProps {
101
101
  required?: boolean;
102
102
  helperText?: string;
103
103
  /** App-supplied error; wins over a rejected pick's own message. */
104
- error?: string;
104
+ error?: React.ReactNode;
105
105
  layout?: ProfilePickerLayout;
106
106
  /** Bold primary text beside / beneath the photo (inline and profile layouts). */
107
107
  title?: React.ReactNode;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { PressableProps, View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
3
  import type { HapticType } from '../../utils/hapticUtils.js';
3
4
  export type RadioSize = 'sm' | 'md' | 'lg';
@@ -19,7 +20,7 @@ export interface RadioProps extends Omit<PressableProps, 'style' | 'children' |
19
20
  /** Secondary line under the label. */
20
21
  description?: string;
21
22
  /** Error line under the label (and description); also draws the empty ring in the error colour. */
22
- error?: string;
23
+ error?: ReactNode;
23
24
  size?: RadioSize;
24
25
  tone?: RadioTone;
25
26
  accessibilityLabel?: string;
@@ -14,7 +14,7 @@ interface SliderFieldCommonProps {
14
14
  required?: boolean;
15
15
  helperText?: string;
16
16
  /** Shown in place of `helperText`, in the error colour; the value box turns red with an icon. */
17
- error?: string;
17
+ error?: React.ReactNode;
18
18
  min?: number;
19
19
  max?: number;
20
20
  step?: number;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { PressableProps, View as RNView, StyleProp, ViewStyle } from 'react-native';
2
3
  import type { HapticType } from '../../utils/hapticUtils.js';
3
4
  export type SwitchSize = 'sm' | 'md' | 'lg';
@@ -15,7 +16,7 @@ export interface SwitchProps extends Omit<PressableProps, 'style' | 'children' |
15
16
  /** Secondary line under the label. */
16
17
  description?: string;
17
18
  /** Error line under the label (and description). */
18
- error?: string;
19
+ error?: ReactNode;
19
20
  /**
20
21
  * Lines the label (and the description) may take before truncating with an
21
22
  * ellipsis. Default: no limit, the text wraps in full. `0` also means no limit.
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { TextInput as RNTextInput, StyleProp, ViewStyle } from 'react-native';
2
3
  import type { HapticType } from '../../utils/index.js';
3
4
  import type { FieldBaseSize, FieldBaseVariant } from '../FieldBase/index.js';
@@ -9,7 +10,7 @@ export interface TagInputProps {
9
10
  placeholder?: string;
10
11
  label?: string;
11
12
  helperText?: string;
12
- error?: string;
13
+ error?: ReactNode;
13
14
  required?: boolean;
14
15
  disabled?: boolean;
15
16
  size?: FieldBaseSize;
@@ -42,7 +42,7 @@ export interface TimePickerProps {
42
42
  label?: string;
43
43
  placeholder?: string;
44
44
  helperText?: string;
45
- error?: string;
45
+ error?: React.ReactNode;
46
46
  required?: boolean;
47
47
  disabled?: boolean;
48
48
  size?: FieldBaseSize;
@@ -88,7 +88,7 @@ export type { MarkdownProps } from './Markdown/index.js';
88
88
  export { Markdown } from './Markdown/index.js';
89
89
  export type { ModalPresentation, ModalProps } from './Modal/index.js';
90
90
  export { MODAL_DISMISS_GRACE_MS, Modal } from './Modal/index.js';
91
- export type { NotationProps, NotationRun } from './Notation/index.js';
91
+ export type { NotationProps, NotationRun, NotationTextRun } from './Notation/index.js';
92
92
  export { Notation, parseNotation, sym } from './Notation/index.js';
93
93
  export type { NumberInputProps, NumberInputRef, NumberInputSize, NumberInputVariant } from './NumberInput/index.js';
94
94
  export { NumberInput } from './NumberInput/index.js';
@@ -638,6 +638,15 @@ export interface InlineSelectTokens {
638
638
  /** Trigger text + chevron colour. Library default: `colors.primary`. */
639
639
  color?: string;
640
640
  }
641
+ export interface OptionSheetTokens {
642
+ /**
643
+ * Mark on the selected row of a single-choice sheet (Select, InlineSelect,
644
+ * PhoneNumberInput and every other OptionSheet): `'dot'` is an 8 px dot,
645
+ * `'icon'` the `tick-circle` icon in its bulk style at 20 px. Both are drawn
646
+ * in `colors.primary`. Multi-select keeps its checkbox. Library default: `'dot'`.
647
+ */
648
+ selectedMarker?: 'dot' | 'icon';
649
+ }
641
650
  export interface SelectTokens {
642
651
  /** Colour of the grab-handle rendered above the bottom-sheet picker. Library default: `colors.border.primary`. */
643
652
  handleColor?: string;
@@ -1022,6 +1031,7 @@ export interface ComponentTokens {
1022
1031
  listItem?: ListItemTokens;
1023
1032
  modal?: ModalTokens;
1024
1033
  numberInput?: NumberInputTokens;
1034
+ optionSheet?: OptionSheetTokens;
1025
1035
  otpInput?: OTPInputTokens;
1026
1036
  phoneNumberInput?: PhoneNumberInputTokens;
1027
1037
  profilePicker?: ProfilePickerTokens;
@@ -1121,6 +1131,14 @@ export interface Theme {
1121
1131
  typography: TypographyScale;
1122
1132
  spacing: SpacingScale;
1123
1133
  radius: RadiusScale;
1134
+ /**
1135
+ * Corner smoothing of the squircle Android draws behind Button, Card,
1136
+ * fields, Box and the other smooth-cornered hosts: 0 is a plain rounded
1137
+ * rectangle, 1 the fullest curve. iOS draws Apple's continuous curve, which
1138
+ * has no smoothing setting, so this changes Android only. Library default:
1139
+ * `SQUIRCLE_SMOOTHING` (0.6, Figma's "iOS" preset).
1140
+ */
1141
+ cornerSmoothing: number;
1124
1142
  shadows: ShadowScale;
1125
1143
  motion: MotionScale;
1126
1144
  components: ComponentTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-ui",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -69,7 +69,7 @@
69
69
  "typecheck": "tsc --noEmit"
70
70
  },
71
71
  "peerDependencies": {
72
- "@webority/mobile-core": ">=0.7.0 <0.8.0",
72
+ "@webority/mobile-core": ">=0.8.0 <0.9.0",
73
73
  "expo": ">=57.0.0",
74
74
  "expo-file-system": ">=57.0.0",
75
75
  "expo-haptics": ">=57.0.0",