@webority-technologies/mobile 0.0.20 → 0.0.22

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 (27) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +61 -4
  2. package/lib/commonjs/components/BottomSheet/index.js +6 -0
  3. package/lib/commonjs/components/FieldBase/FieldBase.js +212 -24
  4. package/lib/commonjs/components/Input/Input.js +1 -1
  5. package/lib/commonjs/components/SearchBar/SearchBar.js +8 -2
  6. package/lib/commonjs/components/Select/Select.js +1 -1
  7. package/lib/commonjs/components/index.js +6 -0
  8. package/lib/module/components/BottomSheet/BottomSheet.js +60 -4
  9. package/lib/module/components/BottomSheet/index.js +1 -1
  10. package/lib/module/components/FieldBase/FieldBase.js +211 -23
  11. package/lib/module/components/Input/Input.js +1 -1
  12. package/lib/module/components/SearchBar/SearchBar.js +8 -2
  13. package/lib/module/components/Select/Select.js +1 -1
  14. package/lib/module/components/index.js +1 -1
  15. package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +41 -0
  16. package/lib/typescript/commonjs/components/BottomSheet/index.d.ts +2 -2
  17. package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +43 -12
  18. package/lib/typescript/commonjs/components/Input/Input.d.ts +1 -1
  19. package/lib/typescript/commonjs/components/index.d.ts +2 -2
  20. package/lib/typescript/commonjs/theme/types.d.ts +31 -7
  21. package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +41 -0
  22. package/lib/typescript/module/components/BottomSheet/index.d.ts +2 -2
  23. package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +43 -12
  24. package/lib/typescript/module/components/Input/Input.d.ts +1 -1
  25. package/lib/typescript/module/components/index.d.ts +2 -2
  26. package/lib/typescript/module/theme/types.d.ts +31 -7
  27. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- export { BottomSheet, default } from './BottomSheet';
2
- export type { BottomSheetProps, BottomSheetRef, SnapPoint } from './BottomSheet';
1
+ export { BottomSheet, default, useBottomSheet } from './BottomSheet';
2
+ export type { BottomSheetContextValue, BottomSheetProps, BottomSheetRef, SnapPoint } from './BottomSheet';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -23,9 +23,17 @@
23
23
  */
24
24
  import React from 'react';
25
25
  import type { AccessibilityRole, AccessibilityState, StyleProp, TextStyle, ViewStyle } from 'react-native';
26
- import type { FieldSizeTokens, FieldVariantTokens, Theme } from '../../theme/types';
26
+ import type { FieldSide, FieldSizeTokens, FieldVariantTokens, Theme } from '../../theme/types';
27
27
  export type FieldBaseSize = 'sm' | 'md' | 'lg';
28
- export type FieldBaseVariant = 'outlined' | 'filled';
28
+ export type FieldBaseVariant = 'outlined' | 'filled' | 'underline';
29
+ /**
30
+ * Pick the most "representative" side colour from a 4-side record. Used by
31
+ * consumers (Input's selectionColor, focus rings, etc.) that need a single
32
+ * colour to mirror the visible focus indicator. Priority: bottom → top →
33
+ * left → right, skipping `'transparent'`. The bottom-first order means
34
+ * underline variants pick their underline colour automatically.
35
+ */
36
+ export declare const pickRepresentativeBorderColor: (sides: Record<FieldSide, string>) => string;
29
37
  export interface FieldBaseProps {
30
38
  /** Resolves to dimension tokens at `theme.components.field[size]`. Default `'md'`. */
31
39
  size?: FieldBaseSize;
@@ -65,10 +73,26 @@ export interface FieldBaseProps {
65
73
  paddingHorizontal?: number;
66
74
  /** Override vertical padding (single-line). Multiline parents usually leave this default. */
67
75
  paddingVertical?: number;
68
- /** Override corner radius. SearchBar pill uses this to apply `radius.full`. */
76
+ /** Override corner radius (shorthand — all four corners). SearchBar pill uses this to apply `radius.full`. */
69
77
  borderRadius?: number;
70
- /** Override border width. OTP uses 1.5; everything else inherits `colors.border.width`. */
78
+ /** Top-left corner radius. Wins over `borderRadius`. */
79
+ borderTopLeftRadius?: number;
80
+ /** Top-right corner radius. Wins over `borderRadius`. */
81
+ borderTopRightRadius?: number;
82
+ /** Bottom-left corner radius. Wins over `borderRadius`. */
83
+ borderBottomLeftRadius?: number;
84
+ /** Bottom-right corner radius. Wins over `borderRadius`. */
85
+ borderBottomRightRadius?: number;
86
+ /** Override border width (shorthand — all four sides). OTP uses 1.5; everything else inherits `colors.border.width`. */
71
87
  borderWidth?: number;
88
+ /** Top border width. Wins over `borderWidth`. */
89
+ borderTopWidth?: number;
90
+ /** Right border width. Wins over `borderWidth`. */
91
+ borderRightWidth?: number;
92
+ /** Bottom border width. Wins over `borderWidth`. */
93
+ borderBottomWidth?: number;
94
+ /** Left border width. Wins over `borderWidth`. */
95
+ borderLeftWidth?: number;
72
96
  /** Gap between leading / children / trailing. Defaults to `theme.spacing.sm`. */
73
97
  gap?: number;
74
98
  fillOverrides?: Partial<FieldVariantTokens>;
@@ -114,8 +138,11 @@ export declare const resolveFieldTextStyle: (theme: Theme, options?: FieldTextSt
114
138
  export declare const resolveFieldSize: (theme: Theme, size: FieldBaseSize) => FieldSizeTokens;
115
139
  /**
116
140
  * Strict, fully-resolved colour set used internally. Mirrors `FieldVariantTokens`
117
- * but every field is non-optional every state has a concrete colour by the
118
- * time the box renders, so downstream code can rely on string-typed fills.
141
+ * but every border colour / width is expanded to a 4-side record by the time
142
+ * the box renders, so the animation pipeline can treat per-side and shorthand
143
+ * the same way. `borderFocusedRepresentative` is a single colour pulled from
144
+ * the focused sides — exposed for consumers (Input's selectionColor) that
145
+ * need to mirror the visible focus indicator without re-resolving per side.
119
146
  */
120
147
  interface ResolvedFieldColors {
121
148
  backgroundIdleEmpty: string;
@@ -125,15 +152,19 @@ interface ResolvedFieldColors {
125
152
  /** Optional override fill while in error — when undefined, error animates from idle to idle. */
126
153
  backgroundError: string | undefined;
127
154
  backgroundDisabled: string;
128
- borderIdle: string;
129
- borderFocused: string;
130
- borderError: string;
131
- borderDisabled: string;
132
- borderWidth: number;
155
+ borderIdle: Record<FieldSide, string>;
156
+ borderFocused: Record<FieldSide, string>;
157
+ borderError: Record<FieldSide, string>;
158
+ borderDisabled: Record<FieldSide, string>;
159
+ borderWidth: Record<FieldSide, number>;
160
+ /** Single representative colour from `borderFocused` — first non-transparent side, bottom-priority. */
161
+ borderFocusedRepresentative: string;
133
162
  }
134
163
  /**
135
164
  * Resolve the full set of state-aware fill + border colours for a given
136
- * variant. Order: explicit override → theme token → library default.
165
+ * variant. Order: explicit override → theme token → library default. Border
166
+ * colour + width are normalized to per-side records here; callers that need
167
+ * a single colour read `borderFocusedRepresentative`.
137
168
  */
138
169
  export declare const resolveVariantColors: (theme: Theme, variant: FieldBaseVariant, override?: Partial<FieldVariantTokens>) => ResolvedFieldColors;
139
170
  export declare const FieldBase: React.FC<FieldBaseProps>;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { TextInput } from 'react-native';
3
3
  import type { BlurEvent, FocusEvent, StyleProp, TextInputProps, TextStyle, ViewStyle } from 'react-native';
4
4
  export type InputSize = 'sm' | 'md' | 'lg';
5
- export type InputVariant = 'outlined' | 'filled';
5
+ export type InputVariant = 'outlined' | 'filled' | 'underline';
6
6
  export type InputLabelMode = 'float' | 'top';
7
7
  export interface InputProps extends Omit<TextInputProps, 'style'> {
8
8
  label?: string;
@@ -8,8 +8,8 @@ export { Banner } from './Banner';
8
8
  export type { BannerProps, BannerVariant, BannerAction } from './Banner';
9
9
  export { BottomNavigation } from './BottomNavigation';
10
10
  export type { BottomNavigationProps, TabConfig } from './BottomNavigation';
11
- export { BottomSheet } from './BottomSheet';
12
- export type { BottomSheetProps, BottomSheetRef } from './BottomSheet';
11
+ export { BottomSheet, useBottomSheet } from './BottomSheet';
12
+ export type { BottomSheetContextValue, BottomSheetProps, BottomSheetRef } from './BottomSheet';
13
13
  export { Button } from './Button';
14
14
  export type { ButtonProps, ButtonVariant, ButtonTone, ButtonSize } from './Button';
15
15
  export { Card } from './Card';
@@ -391,12 +391,33 @@ export interface FieldSizeTokens {
391
391
  borderRadius: number;
392
392
  iconSize: number;
393
393
  }
394
+ /**
395
+ * One of the four field-box sides. Used everywhere the library accepts
396
+ * per-side overrides for border width / colour.
397
+ */
398
+ export type FieldSide = 'top' | 'right' | 'bottom' | 'left';
399
+ /**
400
+ * Shorthand-or-longhand value. A bare `T` means "apply to all four sides";
401
+ * an object form lets a consumer set specific sides while the others fall
402
+ * through to whatever the resolver decided. Mirrors how React Native's
403
+ * `borderWidth` + `borderXWidth` (and CSS `border` + `border-X`) compose.
404
+ */
405
+ export type FieldPerSide<T> = T | Partial<Record<FieldSide, T>>;
406
+ /** Border colour value: a single colour string or a per-side colour map. */
407
+ export type FieldBorderColor = FieldPerSide<string>;
408
+ /** Border width value: a single width or a per-side width map. */
409
+ export type FieldBorderWidth = FieldPerSide<number>;
394
410
  /**
395
411
  * State-aware fill + border colours for a field variant. Resolution order
396
412
  * inside FieldBase: variant token → library default. Idle distinguishes
397
413
  * empty vs filled so consumers can tint the resting field differently once
398
414
  * the user has typed. When focused/error/disabled fills are omitted, the
399
415
  * box animates from the current idle fill to itself (no fill change).
416
+ *
417
+ * Border colour + width are `FieldPerSide` values — pass a bare string /
418
+ * number to set all four sides (the common case), or an object like
419
+ * `{ bottom: '#1A73E8' }` to draw only one side. Sides not specified in the
420
+ * object fall through to the shorthand default.
400
421
  */
401
422
  export interface FieldVariantTokens {
402
423
  backgroundIdleEmpty: string;
@@ -404,18 +425,20 @@ export interface FieldVariantTokens {
404
425
  backgroundFocused?: string;
405
426
  backgroundError?: string;
406
427
  backgroundDisabled: string;
407
- borderIdle: string;
408
- borderFocused: string;
409
- borderError: string;
410
- borderDisabled: string;
411
- borderWidth: number;
428
+ borderIdle: FieldBorderColor;
429
+ borderFocused: FieldBorderColor;
430
+ borderError: FieldBorderColor;
431
+ borderDisabled: FieldBorderColor;
432
+ borderWidth: FieldBorderWidth;
412
433
  }
413
434
  export interface FieldTokens extends Partial<Record<'sm' | 'md' | 'lg', FieldSizeTokens>> {
414
435
  /** Default `variant` when caller doesn't pass one. Library default: 'outlined'. */
415
- defaultVariant?: 'outlined' | 'filled';
436
+ defaultVariant?: 'outlined' | 'filled' | 'underline';
416
437
  /** State-aware fill + border colours per variant. */
417
438
  outlined?: Partial<FieldVariantTokens>;
418
439
  filled?: Partial<FieldVariantTokens>;
440
+ /** Bottom-border-only variant — Material-style underline inputs. */
441
+ underline?: Partial<FieldVariantTokens>;
419
442
  /** Text colour for the editable / displayed value. Defaults to `colors.text.primary`. */
420
443
  textColor?: string;
421
444
  /** Text colour when the field is disabled. Defaults to `colors.text.disabled`. */
@@ -439,7 +462,7 @@ export interface InputFillTokens {
439
462
  }
440
463
  export interface InputComponentTokens extends Partial<Record<ComponentSizeKey, InputSizeTokens>> {
441
464
  /** Default `variant` when caller doesn't pass one. Library default: 'outlined'. */
442
- defaultVariant?: 'outlined' | 'filled';
465
+ defaultVariant?: 'outlined' | 'filled' | 'underline';
443
466
  /** Default `labelMode` when caller doesn't pass one. Library default: 'float'. */
444
467
  defaultLabelMode?: 'float' | 'top';
445
468
  /** Corner radius in pixels for the field wrapper. Library default: size-driven (sm=10, md=12, lg=14). */
@@ -468,6 +491,7 @@ export interface InputComponentTokens extends Partial<Record<ComponentSizeKey, I
468
491
  fillColors?: {
469
492
  outlined?: InputFillTokens;
470
493
  filled?: InputFillTokens;
494
+ underline?: InputFillTokens;
471
495
  };
472
496
  }
473
497
  export interface BottomSheetTokens {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "Beautiful, animated, accessible React Native components plus API/auth/logging/network/storage utilities for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",