@webority/mobile-ui 0.7.4 → 0.8.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 (47) hide show
  1. package/lib/commonjs/components/AppIcon/defaultIcons.js +1 -1
  2. package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
  3. package/lib/commonjs/components/Input/Input.js +1 -1
  4. package/lib/commonjs/components/Notation/Notation.js +1 -1
  5. package/lib/commonjs/components/NumberInput/NumberInput.js +1 -1
  6. package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
  7. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  8. package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +1 -1
  9. package/lib/commonjs/components/Select/Select.js +1 -1
  10. package/lib/commonjs/components/SliderField/SliderField.js +1 -1
  11. package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
  12. package/lib/commonjs/theme/tokens.js +1 -1
  13. package/lib/module/components/AppIcon/defaultIcons.js +1 -1
  14. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  15. package/lib/module/components/Input/Input.js +1 -1
  16. package/lib/module/components/Notation/Notation.js +1 -1
  17. package/lib/module/components/NumberInput/NumberInput.js +1 -1
  18. package/lib/module/components/OTPInput/OTPInput.js +1 -1
  19. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  20. package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
  21. package/lib/module/components/Select/Select.js +1 -1
  22. package/lib/module/components/SliderField/SliderField.js +1 -1
  23. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  24. package/lib/module/theme/tokens.js +1 -1
  25. package/lib/typescript/commonjs/components/AppIcon/defaultIcons.d.ts +3 -3
  26. package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +1 -1
  27. package/lib/typescript/commonjs/components/Input/Input.d.ts +5 -2
  28. package/lib/typescript/commonjs/components/Notation/Notation.d.ts +14 -3
  29. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +4 -1
  30. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +6 -1
  31. package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +7 -6
  32. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +5 -2
  33. package/lib/typescript/commonjs/components/Select/Select.d.ts +5 -2
  34. package/lib/typescript/commonjs/components/SliderField/SliderField.d.ts +4 -1
  35. package/lib/typescript/commonjs/theme/types.d.ts +23 -0
  36. package/lib/typescript/module/components/AppIcon/defaultIcons.d.ts +3 -3
  37. package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +1 -1
  38. package/lib/typescript/module/components/Input/Input.d.ts +5 -2
  39. package/lib/typescript/module/components/Notation/Notation.d.ts +14 -3
  40. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +4 -1
  41. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +6 -1
  42. package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +7 -6
  43. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +5 -2
  44. package/lib/typescript/module/components/Select/Select.d.ts +5 -2
  45. package/lib/typescript/module/components/SliderField/SliderField.d.ts +4 -1
  46. package/lib/typescript/module/theme/types.d.ts +23 -0
  47. package/package.json +12 -13
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * The library's own renderers for the affordances components draw
3
3
  * themselves: the password eye, the error glyph, SearchBar's magnifier and
4
- * clear button, FilePicker's attachment. Every one is an AppIcon, so an app
5
- * gets the design system's glyphs with zero setup; `theme.icons` still wins
6
- * when an app registers its own.
4
+ * clear button, FilePicker's attachment, OptionSheet's selected tick. Every
5
+ * one is an AppIcon, so an app gets the design system's glyphs with zero
6
+ * setup; `theme.icons` still wins when an app registers its own.
7
7
  */
8
8
  import type { IconRegistry } from '../../theme/types.js';
9
9
  export declare const defaultIcons: Required<IconRegistry>;
@@ -21,7 +21,7 @@
21
21
  * - Helper / error / counter text rendered below the field.
22
22
  * - Shake-on-error or any cross-field animation.
23
23
  */
24
- import React from 'react';
24
+ import type React from 'react';
25
25
  import type { AccessibilityRole, AccessibilityState, StyleProp, TextStyle, ViewStyle } from 'react-native';
26
26
  import { Animated } from 'react-native';
27
27
  import type { FieldSide, FieldVariantTokens, ResolvedFieldSizeTokens, Theme } from '../../theme/types.js';
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import type { BlurEvent, FocusEvent, StyleProp, TextInputProps, TextStyle, ViewStyle } from 'react-native';
3
3
  import { TextInput } from 'react-native';
4
4
  import type { SlotIcon, SlotIconState } from '../AppIcon/slotIcon.js';
@@ -65,7 +65,10 @@ export interface InputProps extends Omit<TextInputProps, 'style'> {
65
65
  placeholder?: string;
66
66
  value?: string;
67
67
  onChangeText?: (text: string) => void;
68
- /** A string or a node. A non-empty value puts the field in the error state and replaces the helper. */
68
+ /**
69
+ * A string or a node puts the field in the error state and replaces the helper; `true` shows the
70
+ * error state without a message.
71
+ */
69
72
  error?: React.ReactNode;
70
73
  /** A string or a node. */
71
74
  helperText?: React.ReactNode;
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
+ import type { ColorValue } from 'react-native';
2
3
  export interface NotationRun {
3
4
  text: string;
4
5
  /** The subscript that follows `text`, when the run is a symbol. */
@@ -17,17 +18,27 @@ export interface NotationProps {
17
18
  * mixes such text with verbatim stored text. Needs a parent Text.
18
19
  */
19
20
  text?: string | readonly NotationTextRun[];
20
- /** One symbol: the base, drawn with `sub` small and lowered after it. Renders its own Text. */
21
+ /** One symbol: the base, drawn with `sub` small and lowered after it. Needs a parent Text. */
21
22
  base?: string;
22
23
  sub?: string;
23
24
  /** Follows the symbol after a space. */
24
25
  desc?: string;
25
- /** Subscript ink. Defaults to `colors.text.primary`; pass the parent's colour when it differs. */
26
+ /**
27
+ * Subscript ink. Inside a field label it defaults to the label's ink, elsewhere to
28
+ * `colors.text.primary`; pass the parent's colour when it differs.
29
+ */
26
30
  color?: string;
27
31
  testID?: string;
28
32
  }
29
33
  /** The text split into runs: `{ text }` for prose, `{ text, sub }` for a symbol and its subscript. */
30
34
  export declare const parseNotation: (text: string | null | undefined) => NotationRun[];
35
+ /** The size and ink of the Text a Notation sits in, which the subscript's View cannot inherit. */
36
+ export interface NotationInk {
37
+ fontSize: number;
38
+ color: ColorValue;
39
+ }
40
+ /** Provided by a label Text (FieldLabel) so a subscript inside it scales and inks with the label. */
41
+ export declare const NotationInkContext: React.Context<NotationInk | null>;
31
42
  /** A symbol of a standard with its subscript drawn small and lowered below the baseline. */
32
43
  export declare const Notation: React.FC<NotationProps>;
33
44
  /** A symbol as the standard prints it: `sym('C', 'IP')` is C with a small IP, then `desc` if given. */
@@ -26,7 +26,10 @@ export interface NumberInputProps {
26
26
  help?: React.ReactNode;
27
27
  /** A string or a node. */
28
28
  helperText?: React.ReactNode;
29
- /** A string or a node. A non-empty value puts the field in the error state and replaces the helper. */
29
+ /**
30
+ * A string or a node puts the field in the error state and replaces the helper; `true` shows the
31
+ * error state without a message.
32
+ */
30
33
  error?: React.ReactNode;
31
34
  disabled?: boolean;
32
35
  size?: NumberInputSize;
@@ -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,16 +4,17 @@
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
14
15
  * re-exports them so the public import path is unchanged.
15
16
  */
16
- import React from 'react';
17
+ import type React from 'react';
17
18
  import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
18
19
  export type SelectValue = string | number;
19
20
  export interface SelectOption {
@@ -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;
@@ -11,7 +11,7 @@
11
11
  * internally and manages its own open/close.
12
12
  * - Render PickerTrigger themselves alongside a controlled picker.
13
13
  */
14
- import React from 'react';
14
+ import type React from 'react';
15
15
  import type { View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
16
16
  import type { FieldBaseSize, FieldBaseVariant } from '../FieldBase/index.js';
17
17
  export type PickerTriggerSize = FieldBaseSize;
@@ -27,7 +27,10 @@ export interface PickerTriggerProps {
27
27
  help?: React.ReactNode;
28
28
  /** Helper text shown below the field. Hidden when `error` is set. A string or a node. */
29
29
  helperText?: React.ReactNode;
30
- /** Error message shown below the field (and red-borders the field). A string or a node. */
30
+ /**
31
+ * Error message shown below the field (and red-borders the field). A string or a node; `true`
32
+ * shows the error state without a message.
33
+ */
31
34
  error?: React.ReactNode;
32
35
  /**
33
36
  * Appends the required marker to the label. Marker text + colour come from
@@ -6,7 +6,7 @@
6
6
  * drift between the two. Supports optional client-side search, theme-aware
7
7
  * styling, full a11y, and dark-mode auto.
8
8
  */
9
- import React from 'react';
9
+ import type React from 'react';
10
10
  import type { View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
11
11
  import type { HapticType } from '../../utils/index.js';
12
12
  import type { SlotIcon } from '../AppIcon/slotIcon.js';
@@ -66,7 +66,10 @@ interface BaseSelectProps<T = SelectOption> {
66
66
  * `'*'` in `colors.error`).
67
67
  */
68
68
  required?: boolean;
69
- /** A string or a node. A non-empty value puts the trigger in the error state. */
69
+ /**
70
+ * A string or a node puts the trigger in the error state and shows it below; `true` shows the
71
+ * error state without a message.
72
+ */
70
73
  error?: React.ReactNode;
71
74
  /** Hint under the field, shown while there is no `error`. A string or a node. */
72
75
  helperText?: React.ReactNode;
@@ -13,7 +13,10 @@ interface SliderFieldCommonProps {
13
13
  /** Appends the required marker to the label. */
14
14
  required?: boolean;
15
15
  helperText?: string;
16
- /** Shown in place of `helperText`, in the error colour; the value box turns red with an icon. */
16
+ /**
17
+ * Shown in place of `helperText`, in the error colour; the value box turns red with an icon. `true`
18
+ * shows the error state without a message.
19
+ */
17
20
  error?: React.ReactNode;
18
21
  min?: number;
19
22
  max?: number;
@@ -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;
@@ -1096,6 +1106,11 @@ export interface IconRegistry {
1096
1106
  chevronDown?: IconRenderer;
1097
1107
  /** Trailing "goes somewhere" chevron on ListItem. Default `chevron-right`. */
1098
1108
  chevronRight?: IconRenderer;
1109
+ /**
1110
+ * Mark on the selected row of a single-choice option sheet when
1111
+ * `components.optionSheet.selectedMarker` is `'icon'`. Default `tick-circle`, bulk.
1112
+ */
1113
+ selectedTick?: IconRenderer;
1099
1114
  }
1100
1115
  /**
1101
1116
  * An app's own text style, registered under a name in `theme.textVariants` and
@@ -1121,6 +1136,14 @@ export interface Theme {
1121
1136
  typography: TypographyScale;
1122
1137
  spacing: SpacingScale;
1123
1138
  radius: RadiusScale;
1139
+ /**
1140
+ * Corner smoothing of the squircle Android draws behind Button, Card,
1141
+ * fields, Box and the other smooth-cornered hosts: 0 is a plain rounded
1142
+ * rectangle, 1 the fullest curve. iOS draws Apple's continuous curve, which
1143
+ * has no smoothing setting, so this changes Android only. Library default:
1144
+ * `SQUIRCLE_SMOOTHING` (0.6, Figma's "iOS" preset).
1145
+ */
1146
+ cornerSmoothing: number;
1124
1147
  shadows: ShadowScale;
1125
1148
  motion: MotionScale;
1126
1149
  components: ComponentTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-ui",
3
- "version": "0.7.4",
3
+ "version": "0.8.1",
4
4
  "description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -59,17 +59,8 @@
59
59
  "javaPackageName": "com.webority.mobileui.pdfrasterizer"
60
60
  }
61
61
  },
62
- "scripts": {
63
- "prepack": "node ../../scripts/package-guard-pack.mjs --output-dirs lib --allow-file ../../.webority/package-allow.json",
64
- "build": "bob build && node ../../scripts/minify-lib.mjs",
65
- "clean": "rimraf lib",
66
- "lint": "biome lint ./src",
67
- "lint:fix": "biome lint --write ./src",
68
- "test": "jest",
69
- "typecheck": "tsc --noEmit"
70
- },
71
62
  "peerDependencies": {
72
- "@webority/mobile-core": ">=0.7.0 <0.8.0",
63
+ "@webority/mobile-core": ">=0.8.0 <0.9.0",
73
64
  "expo": ">=57.0.0",
74
65
  "expo-file-system": ">=57.0.0",
75
66
  "expo-haptics": ">=57.0.0",
@@ -116,6 +107,14 @@
116
107
  ]
117
108
  },
118
109
  "devDependencies": {
119
- "@webority/mobile-core": "file:../core"
110
+ "@webority/mobile-core": "0.8.1"
111
+ },
112
+ "scripts": {
113
+ "build": "bob build && node ../../scripts/minify-lib.mjs",
114
+ "clean": "rimraf lib",
115
+ "lint": "biome lint ./src",
116
+ "lint:fix": "biome lint --write ./src",
117
+ "test": "jest",
118
+ "typecheck": "tsc --noEmit"
120
119
  }
121
- }
120
+ }