@webority/mobile-ui 0.10.0 → 0.11.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 (74) hide show
  1. package/android/src/newarch/java/com/webority/mobileui/pdfrasterizer/PdfRasterizerModule.kt +6 -7
  2. package/ios/PdfRasterizer.mm +36 -9
  3. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
  4. package/lib/commonjs/components/FieldBase/ChoiceText.js +1 -1
  5. package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
  6. package/lib/commonjs/components/FieldBase/useFloatingLabel.js +1 -1
  7. package/lib/commonjs/components/FormField/FormField.js +1 -1
  8. package/lib/commonjs/components/Input/Input.js +1 -1
  9. package/lib/commonjs/components/Notation/Notation.js +1 -1
  10. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  11. package/lib/commonjs/components/PermissionPrompt/PermissionPrompt.js +1 -0
  12. package/lib/commonjs/components/PermissionPrompt/index.js +1 -0
  13. package/lib/commonjs/components/PermissionPrompt/usePermissionPrompt.js +1 -0
  14. package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  15. package/lib/commonjs/components/Radio/Radio.js +1 -1
  16. package/lib/commonjs/components/Radio/RadioGroup.js +1 -1
  17. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  18. package/lib/commonjs/components/Select/Select.js +1 -1
  19. package/lib/commonjs/components/Switch/Switch.js +1 -1
  20. package/lib/commonjs/components/TagInput/TagInput.js +1 -1
  21. package/lib/commonjs/components/index.js +1 -1
  22. package/lib/module/components/Checkbox/Checkbox.js +1 -1
  23. package/lib/module/components/FieldBase/ChoiceText.js +1 -1
  24. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  25. package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
  26. package/lib/module/components/FormField/FormField.js +1 -1
  27. package/lib/module/components/Input/Input.js +1 -1
  28. package/lib/module/components/Notation/Notation.js +1 -1
  29. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  30. package/lib/module/components/PermissionPrompt/PermissionPrompt.js +1 -0
  31. package/lib/module/components/PermissionPrompt/index.js +1 -0
  32. package/lib/module/components/PermissionPrompt/usePermissionPrompt.js +1 -0
  33. package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  34. package/lib/module/components/Radio/Radio.js +1 -1
  35. package/lib/module/components/Radio/RadioGroup.js +1 -1
  36. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  37. package/lib/module/components/Select/Select.js +1 -1
  38. package/lib/module/components/Switch/Switch.js +1 -1
  39. package/lib/module/components/TagInput/TagInput.js +1 -1
  40. package/lib/module/components/index.js +1 -1
  41. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -1
  42. package/lib/typescript/commonjs/components/FileViewer/FileViewer.d.ts +1 -1
  43. package/lib/typescript/commonjs/components/Notation/Notation.d.ts +10 -4
  44. package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +2 -0
  45. package/lib/typescript/commonjs/components/PermissionPrompt/PermissionPrompt.d.ts +39 -0
  46. package/lib/typescript/commonjs/components/PermissionPrompt/index.d.ts +5 -0
  47. package/lib/typescript/commonjs/components/PermissionPrompt/usePermissionPrompt.d.ts +44 -0
  48. package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +5 -2
  49. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +13 -4
  50. package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +5 -0
  51. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +5 -1
  52. package/lib/typescript/commonjs/components/Select/Select.d.ts +2 -0
  53. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +11 -4
  54. package/lib/typescript/commonjs/components/TagInput/TagInput.d.ts +4 -0
  55. package/lib/typescript/commonjs/components/index.d.ts +2 -0
  56. package/lib/typescript/commonjs/specs/NativePdfRasterizer.d.ts +1 -1
  57. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -1
  58. package/lib/typescript/module/components/FileViewer/FileViewer.d.ts +1 -1
  59. package/lib/typescript/module/components/Notation/Notation.d.ts +10 -4
  60. package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +2 -0
  61. package/lib/typescript/module/components/PermissionPrompt/PermissionPrompt.d.ts +39 -0
  62. package/lib/typescript/module/components/PermissionPrompt/index.d.ts +5 -0
  63. package/lib/typescript/module/components/PermissionPrompt/usePermissionPrompt.d.ts +44 -0
  64. package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +5 -2
  65. package/lib/typescript/module/components/Radio/Radio.d.ts +13 -4
  66. package/lib/typescript/module/components/Radio/RadioGroup.d.ts +5 -0
  67. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +5 -1
  68. package/lib/typescript/module/components/Select/Select.d.ts +2 -0
  69. package/lib/typescript/module/components/Switch/Switch.d.ts +11 -4
  70. package/lib/typescript/module/components/TagInput/TagInput.d.ts +4 -0
  71. package/lib/typescript/module/components/index.d.ts +2 -0
  72. package/lib/typescript/module/specs/NativePdfRasterizer.d.ts +1 -1
  73. package/package.json +3 -3
  74. package/src/specs/NativePdfRasterizer.ts +1 -1
@@ -0,0 +1,44 @@
1
+ import type { PermissionKind, PermissionStatus } from '@webority/mobile-core/permissions';
2
+ /**
3
+ * - `pending`: the first status read, or on Android the system prompt asked straight away.
4
+ * - `explain`: the explainer with Continue (and Cancel on Android).
5
+ * - `unavailable`: the feature cannot work; offer the fallback.
6
+ * - `authorized`: granted or limited; the feature can run.
7
+ */
8
+ export type PermissionPromptView = 'pending' | 'explain' | 'unavailable' | 'authorized';
9
+ export interface UsePermissionPromptOptions {
10
+ /**
11
+ * Called each time the status settles with no question left open: when the first
12
+ * check finds nothing to ask (granted, limited, blocked or unavailable), and after
13
+ * each request or Cancel.
14
+ */
15
+ onResult?: (status: PermissionStatus) => void;
16
+ }
17
+ export interface UsePermissionPromptResult {
18
+ view: PermissionPromptView;
19
+ /** The latest status, `null` until the first check returns. */
20
+ status: PermissionStatus | null;
21
+ /** True while the system prompt is up. */
22
+ requesting: boolean;
23
+ /** Android only: the explainer offers Cancel, as Android requires; iOS and web never do. */
24
+ cancellable: boolean;
25
+ /**
26
+ * True only when the status was already `blocked` when this prompt opened, so
27
+ * Open Settings never appears straight after the person refused.
28
+ */
29
+ showSettings: boolean;
30
+ /** Shows the system prompt. Resolves the new status, or `null` when one is already up. */
31
+ request: () => Promise<PermissionStatus | null>;
32
+ /** Leaves the explainer for the unavailable state without asking. */
33
+ cancel: () => void;
34
+ openSettings: () => Promise<boolean>;
35
+ }
36
+ /**
37
+ * Decides what a permission prompt shows, by platform:
38
+ * - iOS and web explain first whenever a request can still show the system prompt.
39
+ * - Android asks straight away the first time, and explains only after one refusal
40
+ * (`denied`), the case Android's rationale flow covers.
41
+ * - `blocked` or `unavailable` goes to the unavailable state.
42
+ */
43
+ export declare const usePermissionPrompt: (kind: PermissionKind, { onResult }?: UsePermissionPromptOptions) => UsePermissionPromptResult;
44
+ //# sourceMappingURL=usePermissionPrompt.d.ts.map
@@ -159,7 +159,10 @@ export interface PhoneNumberInputProps extends Pick<TextInputProps, 'returnKeyTy
159
159
  labelStyle?: StyleProp<TextStyle>;
160
160
  placeholder?: string;
161
161
  helperText?: string;
162
- /** The app's own error text. Always wins over the built-in invalid-number message. */
162
+ /**
163
+ * The app's own error text, a string or a node; it replaces the built-in invalid-number message.
164
+ * `true` shows the error state and keeps the built-in message; `false` and `''` change nothing.
165
+ */
163
166
  error?: ReactNode;
164
167
  /**
165
168
  * Text under the field once the typed number is not a real number for the
@@ -169,7 +172,7 @@ export interface PhoneNumberInputProps extends Pick<TextInputProps, 'returnKeyTy
169
172
  * a cleared field earns that grace again. Default `'Enter a valid mobile
170
173
  * number'` under `validation="mobile"`, else `'Enter a valid number'`;
171
174
  * a string replaces the text, `false` turns the message off. Nothing shows
172
- * under `validation={false}`, and `error` always wins.
175
+ * under `validation={false}`, and an `error` text always wins.
173
176
  */
174
177
  invalidMessage?: string | false;
175
178
  required?: boolean;
@@ -8,6 +8,8 @@ export interface RadioGroupContextValue {
8
8
  selectedValue: RadioValue | undefined;
9
9
  onChange: (value: RadioValue) => void;
10
10
  disabled: boolean;
11
+ /** The group is in error: every radio draws its empty ring in the error colour. */
12
+ error?: boolean;
11
13
  }
12
14
  export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue | null>;
13
15
  export declare const useRadioGroup: () => RadioGroupContextValue | null;
@@ -16,10 +18,17 @@ export interface RadioProps extends Omit<PressableProps, 'style' | 'children' |
16
18
  selected?: boolean;
17
19
  onChange?: (value: RadioValue) => void;
18
20
  disabled?: boolean;
19
- label?: string;
20
- /** Secondary line under the label. */
21
- description?: string;
22
- /** Error line under the label (and description); also draws the empty ring in the error colour. */
21
+ /**
22
+ * A string, or a node for a symbol with a subscript. A node label needs an
23
+ * explicit `accessibilityLabel` (the radio's screen-reader name).
24
+ */
25
+ label?: ReactNode;
26
+ /** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
27
+ description?: ReactNode;
28
+ /**
29
+ * Error line under the label (and description); also draws the empty ring in the error colour.
30
+ * A string or a node; `true` shows the error state without a message.
31
+ */
23
32
  error?: ReactNode;
24
33
  size?: RadioSize;
25
34
  tone?: RadioTone;
@@ -7,6 +7,11 @@ export interface RadioGroupProps {
7
7
  onChange?: (value: RadioValue) => void;
8
8
  children: React.ReactNode;
9
9
  disabled?: boolean;
10
+ /**
11
+ * One error line under the group, and every radio's empty ring in the error colour. A string or
12
+ * a node; `true` shows the error state without a message.
13
+ */
14
+ error?: React.ReactNode;
10
15
  accessibilityLabel?: string;
11
16
  style?: StyleProp<ViewStyle>;
12
17
  testID?: string;
@@ -46,7 +46,11 @@ export interface SegmentedControlProps {
46
46
  label?: ReactNode;
47
47
  /** Helper line under the control. */
48
48
  helperText?: ReactNode;
49
- /** Error line under the control, in the error colour. Replaces `helperText`. */
49
+ /**
50
+ * Error line under the control, in the error colour, with the control outlined (the underline
51
+ * look recolours its divider). Replaces `helperText`; `true` shows the error state without a
52
+ * message.
53
+ */
50
54
  error?: ReactNode;
51
55
  value?: SegmentValue;
52
56
  defaultValue?: SegmentValue;
@@ -34,6 +34,8 @@ interface BaseSelectProps<T = SelectOption> {
34
34
  /** Defaults to `(o) => (o as SelectOption).icon`. */
35
35
  getOptionIcon?: (option: T) => React.ReactNode;
36
36
  placeholder?: string;
37
+ /** Called with `true` when the option sheet opens and `false` when it closes. */
38
+ onOpenChange?: (open: boolean) => void;
37
39
  searchable?: boolean;
38
40
  /**
39
41
  * Haptic feedback for interactions. Pass false to disable; pass a HapticType
@@ -12,10 +12,17 @@ export interface SwitchProps extends Omit<PressableProps, 'style' | 'children' |
12
12
  disabled?: boolean;
13
13
  size?: SwitchSize;
14
14
  tone?: SwitchTone;
15
- label?: string;
16
- /** Secondary line under the label. */
17
- description?: string;
18
- /** Error line under the label (and description). */
15
+ /**
16
+ * A string, or a node for a symbol with a subscript. A node label needs an
17
+ * explicit `accessibilityLabel` (the switch's screen-reader name).
18
+ */
19
+ label?: ReactNode;
20
+ /** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
21
+ description?: ReactNode;
22
+ /**
23
+ * Error line under the label (and description); also outlines the off track in the error colour.
24
+ * A string or a node; `true` shows the error state without a message.
25
+ */
19
26
  error?: ReactNode;
20
27
  /**
21
28
  * Lines the label (and the description) may take before truncating with an
@@ -10,6 +10,10 @@ export interface TagInputProps {
10
10
  placeholder?: string;
11
11
  label?: string;
12
12
  helperText?: string;
13
+ /**
14
+ * A string or a node puts the field in the error state and shows it below in place of the
15
+ * helper; `true` shows the error state without a message.
16
+ */
13
17
  error?: ReactNode;
14
18
  required?: boolean;
15
19
  disabled?: boolean;
@@ -114,6 +114,8 @@ export type { OTPInputProps, OTPInputRef, OTPInputSize } from './OTPInput/index.
114
114
  export { OTPInput } from './OTPInput/index.js';
115
115
  export type { PaymentResultProps, PaymentResultStatus } from './PaymentResult/index.js';
116
116
  export { PaymentResult } from './PaymentResult/index.js';
117
+ export type { PermissionPromptFallback, PermissionPromptProps, PermissionPromptView, UsePermissionPromptOptions, UsePermissionPromptResult } from './PermissionPrompt/index.js';
118
+ export { PermissionPrompt, usePermissionPrompt } from './PermissionPrompt/index.js';
117
119
  export type { CallingCode, PhoneNumberInfo, PhoneNumberInputLabelMode, PhoneNumberInputProps, PhoneNumberInputRef, PhoneNumberValidation, PhoneNumberValue } from './PhoneNumberInput/index.js';
118
120
  export { ALL_CALLING_CODES, DEFAULT_CALLING_CODES, formatE164, PhoneNumberInput, parseE164 } from './PhoneNumberInput/index.js';
119
121
  export type { PickerTriggerProps, PickerTriggerSize, PickerTriggerVariant } from './PickerTrigger/index.js';
@@ -3,7 +3,7 @@ export interface PdfDocumentInfo {
3
3
  /** Opaque handle for every subsequent call (getPageInfo/renderPage/close) — NOT the file path. */
4
4
  handle: string;
5
5
  pageCount: number;
6
- /** Points (1/72 in), the unrotated page size of page 0 — a per-page size read happens in renderPage. */
6
+ /** Points (1/72 in), the page size of page 0 as displayed (after the page's /Rotate) — a per-page size read happens in renderPage. */
7
7
  pageWidth: number;
8
8
  pageHeight: number;
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -60,7 +60,7 @@
60
60
  }
61
61
  },
62
62
  "peerDependencies": {
63
- "@webority/mobile-core": ">=0.10.0 <0.11.0",
63
+ "@webority/mobile-core": ">=0.11.0 <0.12.0",
64
64
  "expo": ">=57.0.0",
65
65
  "expo-file-system": ">=57.0.0",
66
66
  "expo-haptics": ">=57.0.0",
@@ -107,7 +107,7 @@
107
107
  ]
108
108
  },
109
109
  "devDependencies": {
110
- "@webority/mobile-core": "0.10.0"
110
+ "@webority/mobile-core": "0.11.0"
111
111
  },
112
112
  "scripts": {
113
113
  "build": "bob build && node ../../scripts/minify-lib.mjs",
@@ -5,7 +5,7 @@ export interface PdfDocumentInfo {
5
5
  /** Opaque handle for every subsequent call (getPageInfo/renderPage/close) — NOT the file path. */
6
6
  handle: string;
7
7
  pageCount: number;
8
- /** Points (1/72 in), the unrotated page size of page 0 — a per-page size read happens in renderPage. */
8
+ /** Points (1/72 in), the page size of page 0 as displayed (after the page's /Rotate) — a per-page size read happens in renderPage. */
9
9
  pageWidth: number;
10
10
  pageHeight: number;
11
11
  }