@bacon-pos/ui 0.3.0 → 0.5.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 (101) hide show
  1. package/lib/commonjs/components/CodeField/CodeField.js +95 -65
  2. package/lib/commonjs/components/CodeField/CodeField.js.map +1 -1
  3. package/lib/commonjs/components/CodeField/CodeField.stories.js +24 -1
  4. package/lib/commonjs/components/CodeField/CodeField.stories.js.map +1 -1
  5. package/lib/commonjs/components/CodeField/CodeField.test.js +28 -0
  6. package/lib/commonjs/components/CodeField/CodeField.test.js.map +1 -1
  7. package/lib/commonjs/components/Dialog/Dialog.js +23 -4
  8. package/lib/commonjs/components/Dialog/Dialog.js.map +1 -1
  9. package/lib/commonjs/components/Dialog/Dialog.stories.js +49 -1
  10. package/lib/commonjs/components/Dialog/Dialog.stories.js.map +1 -1
  11. package/lib/commonjs/components/Keypad/Keypad.js +162 -0
  12. package/lib/commonjs/components/Keypad/Keypad.js.map +1 -0
  13. package/lib/commonjs/components/Keypad/Keypad.stories.js +210 -0
  14. package/lib/commonjs/components/Keypad/Keypad.stories.js.map +1 -0
  15. package/lib/commonjs/components/Keypad/Keypad.test.js +119 -0
  16. package/lib/commonjs/components/Keypad/Keypad.test.js.map +1 -0
  17. package/lib/commonjs/components/Keypad/index.js +13 -0
  18. package/lib/commonjs/components/Keypad/index.js.map +1 -0
  19. package/lib/commonjs/components/Toast/Toast.js +184 -0
  20. package/lib/commonjs/components/Toast/Toast.js.map +1 -0
  21. package/lib/commonjs/components/Toast/Toast.stories.js +109 -0
  22. package/lib/commonjs/components/Toast/Toast.stories.js.map +1 -0
  23. package/lib/commonjs/components/Toast/Toast.test.js +70 -0
  24. package/lib/commonjs/components/Toast/Toast.test.js.map +1 -0
  25. package/lib/commonjs/components/Toast/ToastProvider.js +95 -0
  26. package/lib/commonjs/components/Toast/ToastProvider.js.map +1 -0
  27. package/lib/commonjs/components/Toast/index.js +26 -0
  28. package/lib/commonjs/components/Toast/index.js.map +1 -0
  29. package/lib/commonjs/components/index.js +30 -8
  30. package/lib/commonjs/components/index.js.map +1 -1
  31. package/lib/module/components/CodeField/CodeField.js +95 -65
  32. package/lib/module/components/CodeField/CodeField.js.map +1 -1
  33. package/lib/module/components/CodeField/CodeField.stories.js +23 -0
  34. package/lib/module/components/CodeField/CodeField.stories.js.map +1 -1
  35. package/lib/module/components/CodeField/CodeField.test.js +28 -0
  36. package/lib/module/components/CodeField/CodeField.test.js.map +1 -1
  37. package/lib/module/components/Dialog/Dialog.js +23 -4
  38. package/lib/module/components/Dialog/Dialog.js.map +1 -1
  39. package/lib/module/components/Dialog/Dialog.stories.js +48 -0
  40. package/lib/module/components/Dialog/Dialog.stories.js.map +1 -1
  41. package/lib/module/components/Keypad/Keypad.js +158 -0
  42. package/lib/module/components/Keypad/Keypad.js.map +1 -0
  43. package/lib/module/components/Keypad/Keypad.stories.js +206 -0
  44. package/lib/module/components/Keypad/Keypad.stories.js.map +1 -0
  45. package/lib/module/components/Keypad/Keypad.test.js +119 -0
  46. package/lib/module/components/Keypad/Keypad.test.js.map +1 -0
  47. package/lib/module/components/Keypad/index.js +4 -0
  48. package/lib/module/components/Keypad/index.js.map +1 -0
  49. package/lib/module/components/Toast/Toast.js +180 -0
  50. package/lib/module/components/Toast/Toast.js.map +1 -0
  51. package/lib/module/components/Toast/Toast.stories.js +105 -0
  52. package/lib/module/components/Toast/Toast.stories.js.map +1 -0
  53. package/lib/module/components/Toast/Toast.test.js +69 -0
  54. package/lib/module/components/Toast/Toast.test.js.map +1 -0
  55. package/lib/module/components/Toast/ToastProvider.js +90 -0
  56. package/lib/module/components/Toast/ToastProvider.js.map +1 -0
  57. package/lib/module/components/Toast/index.js +5 -0
  58. package/lib/module/components/Toast/index.js.map +1 -0
  59. package/lib/module/components/index.js +2 -0
  60. package/lib/module/components/index.js.map +1 -1
  61. package/lib/typescript/commonjs/components/CodeField/CodeField.d.ts +5 -1
  62. package/lib/typescript/commonjs/components/CodeField/CodeField.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -1
  64. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/components/Keypad/Keypad.d.ts +54 -0
  66. package/lib/typescript/commonjs/components/Keypad/Keypad.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/components/Keypad/index.d.ts +3 -0
  68. package/lib/typescript/commonjs/components/Keypad/index.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/components/Toast/Toast.d.ts +40 -0
  70. package/lib/typescript/commonjs/components/Toast/Toast.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/components/Toast/ToastProvider.d.ts +34 -0
  72. package/lib/typescript/commonjs/components/Toast/ToastProvider.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/components/Toast/index.d.ts +3 -0
  74. package/lib/typescript/commonjs/components/Toast/index.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/components/index.d.ts +2 -0
  76. package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
  77. package/lib/typescript/module/components/CodeField/CodeField.d.ts +5 -1
  78. package/lib/typescript/module/components/CodeField/CodeField.d.ts.map +1 -1
  79. package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -1
  80. package/lib/typescript/module/components/Dialog/Dialog.d.ts.map +1 -1
  81. package/lib/typescript/module/components/Keypad/Keypad.d.ts +54 -0
  82. package/lib/typescript/module/components/Keypad/Keypad.d.ts.map +1 -0
  83. package/lib/typescript/module/components/Keypad/index.d.ts +3 -0
  84. package/lib/typescript/module/components/Keypad/index.d.ts.map +1 -0
  85. package/lib/typescript/module/components/Toast/Toast.d.ts +40 -0
  86. package/lib/typescript/module/components/Toast/Toast.d.ts.map +1 -0
  87. package/lib/typescript/module/components/Toast/ToastProvider.d.ts +34 -0
  88. package/lib/typescript/module/components/Toast/ToastProvider.d.ts.map +1 -0
  89. package/lib/typescript/module/components/Toast/index.d.ts +3 -0
  90. package/lib/typescript/module/components/Toast/index.d.ts.map +1 -0
  91. package/lib/typescript/module/components/index.d.ts +2 -0
  92. package/lib/typescript/module/components/index.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/src/components/CodeField/CodeField.tsx +104 -64
  95. package/src/components/Dialog/Dialog.tsx +40 -10
  96. package/src/components/Keypad/Keypad.tsx +191 -0
  97. package/src/components/Keypad/index.ts +2 -0
  98. package/src/components/Toast/Toast.tsx +173 -0
  99. package/src/components/Toast/ToastProvider.tsx +126 -0
  100. package/src/components/Toast/index.ts +7 -0
  101. package/src/components/index.ts +2 -0
@@ -0,0 +1,40 @@
1
+ import type { IconName } from '../Icon/icons.generated';
2
+ /** Built-in statuses. More can be added later, or use custom colors. */
3
+ export type ToastStatus = 'success' | 'error' | 'warning' | 'info';
4
+ export interface ToastOptions {
5
+ /** Message text. Ellipsized on a single line if it overflows. */
6
+ message: string;
7
+ /** Visual status. Defaults to `info`. */
8
+ status?: ToastStatus;
9
+ /** Optional leading icon. */
10
+ icon?: IconName;
11
+ /** Time on screen in ms. `0` keeps it until dismissed. */
12
+ duration?: number;
13
+ /** Custom fixed height. */
14
+ height?: number;
15
+ /** Custom fixed width. Defaults to full width. */
16
+ width?: number;
17
+ /** Show a countdown progress bar for the remaining time (needs duration > 0). */
18
+ showProgress?: boolean;
19
+ /** Custom background (overrides status). */
20
+ backgroundColor?: string;
21
+ /** Custom text/icon color (overrides status). */
22
+ color?: string;
23
+ /** Countdown bar color. Defaults to the status foreground. */
24
+ progressColor?: string;
25
+ }
26
+ export interface ToastViewProps extends ToastOptions {
27
+ id: number;
28
+ position: 'top' | 'bottom';
29
+ /** When true, the toast animates out and then calls `onRemove`. */
30
+ leaving: boolean;
31
+ onRequestClose: (id: number) => void;
32
+ onRemove: (id: number) => void;
33
+ maxWidth?: number;
34
+ }
35
+ /**
36
+ * A single toast with an elegant slide + fade in/out. Self-contained: it runs
37
+ * its own duration timer and exit animation. Managed by `ToastProvider`.
38
+ */
39
+ export declare function ToastView({ id, message, status, icon, duration, height, width, showProgress, backgroundColor, color, progressColor, position, leaving, onRequestClose, onRemove, maxWidth, }: ToastViewProps): import("react/jsx-runtime").JSX.Element;
40
+ //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgBD,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,EAAE,EACF,OAAO,EACP,MAAe,EACf,IAAI,EACJ,QAAe,EACf,MAAM,EACN,KAAK,EACL,YAAoB,EACpB,eAAe,EACf,KAAK,EACL,aAAa,EACb,QAAQ,EACR,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,2CAuFhB"}
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ToastOptions } from './Toast';
3
+ export interface ToastApi {
4
+ /** Show a toast; returns its id. */
5
+ show: (options: ToastOptions) => number;
6
+ /** Dismiss a toast by id (animates out). */
7
+ hide: (id: number) => void;
8
+ /** Dismiss all toasts. */
9
+ hideAll: () => void;
10
+ }
11
+ export interface ToastProviderProps {
12
+ children: ReactNode;
13
+ /** Where toasts appear. Defaults to `bottom`. */
14
+ position?: 'top' | 'bottom';
15
+ /** Max toasts on screen at once. Defaults to 2. */
16
+ maxVisible?: number;
17
+ /** Default time on screen in ms. Defaults to 3000. */
18
+ duration?: number;
19
+ /** Distance from the screen edge. Defaults to 24. */
20
+ offset?: number;
21
+ /** Gap between stacked toasts. Defaults to 8. */
22
+ gap?: number;
23
+ /** Max toast width. Defaults to full width (no cap). */
24
+ maxWidth?: number;
25
+ }
26
+ /**
27
+ * Provides the imperative toast API and renders the toast stack. Wrap your app
28
+ * (inside ThemeProvider). Trigger toasts with `useToast().show(...)`. Newest
29
+ * toasts appear nearest the edge; at most `maxVisible` show at once.
30
+ */
31
+ export declare function ToastProvider({ children, position, maxVisible, duration, offset, gap, maxWidth, }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
32
+ /** Access the toast API. Must be used within a `ToastProvider`. */
33
+ export declare function useToast(): ToastApi;
34
+ //# sourceMappingURL=ToastProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACvB,oCAAoC;IACpC,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,MAAM,CAAC;IACxC,4CAA4C;IAC5C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,0BAA0B;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AASD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAmB,EACnB,UAAc,EACd,QAAe,EACf,MAAW,EACX,GAAO,EACP,QAAQ,GACT,EAAE,kBAAkB,2CA6DpB;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,IAAI,QAAQ,CAInC"}
@@ -0,0 +1,3 @@
1
+ export { ToastView, type ToastOptions, type ToastStatus, type ToastViewProps } from './Toast';
2
+ export { ToastProvider, useToast, type ToastApi, type ToastProviderProps, } from './ToastProvider';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC"}
@@ -10,6 +10,7 @@ export * from './Dialog';
10
10
  export * from './Icon';
11
11
  export * from './IconButton';
12
12
  export * from './Input';
13
+ export * from './Keypad';
13
14
  export * from './LinkButton';
14
15
  export * from './ProductCard';
15
16
  export * from './QuantityStepper';
@@ -18,5 +19,6 @@ export * from './Spinner';
18
19
  export * from './Surface';
19
20
  export * from './Switch';
20
21
  export * from './Text';
22
+ export * from './Toast';
21
23
  export type { LabelPosition } from './_internal/Labeled';
22
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -11,6 +11,10 @@ export interface CodeFieldProps {
11
11
  mode?: CodeFieldMode;
12
12
  /** Called once every cell is filled. */
13
13
  onComplete?: (value: string) => void;
14
+ /** Helper text below the cells. Replaced by the error message when `error` is a string. */
15
+ helperText?: string;
16
+ /** Mark the field invalid. Pass a string to show it as the error message. */
17
+ error?: boolean | string;
14
18
  /** Disable input and dim the cells. */
15
19
  disabled?: boolean;
16
20
  /** Focus on mount. */
@@ -36,5 +40,5 @@ export interface CodeFieldProps {
36
40
  * backspace-to-previous and type-to-next all work natively. The active cell
37
41
  * shows the lime focus ring. Cell size, gap, font and font size are configurable.
38
42
  */
39
- export declare function CodeField({ value, onChangeText, length, mode, onComplete, disabled, autoFocus, cellWidth, cellHeight, gap, fontFamily, fontSize, accessibilityLabel, style, }: CodeFieldProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function CodeField({ value, onChangeText, length, mode, onComplete, helperText, error, disabled, autoFocus, cellWidth, cellHeight, gap, fontFamily, fontSize, accessibilityLabel, style, }: CodeFieldProps): import("react/jsx-runtime").JSX.Element;
40
44
  //# sourceMappingURL=CodeField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;AASjE,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,MAAU,EACV,IAAgB,EAChB,UAAU,EACV,QAAgB,EAChB,SAAiB,EACjB,SAAe,EACf,UAAe,EACf,GAAQ,EACR,UAAU,EACV,QAAa,EACb,kBAA2B,EAC3B,KAAK,GACN,EAAE,cAAc,2CAmFhB"}
1
+ {"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAiBtB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;AASjE,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,MAAU,EACV,IAAgB,EAChB,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAgB,EAChB,SAAiB,EACjB,SAAe,EACf,UAAe,EACf,GAAQ,EACR,UAAU,EACV,QAAa,EACb,kBAA2B,EAC3B,KAAK,GACN,EAAE,cAAc,2CA2GhB"}
@@ -56,6 +56,10 @@ export interface DialogProps {
56
56
  radius?: number;
57
57
  /** Max width of the dialog card. Defaults to 560. */
58
58
  maxWidth?: number;
59
+ /** Fixed card width (overrides `maxWidth`). */
60
+ width?: number;
61
+ /** Fill the whole screen — for small devices. Overrides width/maxWidth/scrollMode. */
62
+ fullscreen?: boolean;
59
63
  /** Fraction of screen height the card may occupy (inner mode). Defaults to 0.9. */
60
64
  maxHeightRatio?: number;
61
65
  /** Scroll indicator color (a design-system color). Defaults to a subtle neutral. */
@@ -71,5 +75,5 @@ export interface DialogProps {
71
75
  * screens instead of scrolling inside the card. Footer composes the
72
76
  * design-system `Button`.
73
77
  */
74
- export declare function Dialog({ visible, onClose, title, subtitle, children, actions, cancel, showClose, closeDestructive, dismissOnBackdrop, scrollMode, stickyHeader, stickyFooter, padding, contentSpacing, radius, maxWidth, maxHeightRatio, scrollbarColor, style, }: DialogProps): import("react/jsx-runtime").JSX.Element;
78
+ export declare function Dialog({ visible, onClose, title, subtitle, children, actions, cancel, showClose, closeDestructive, dismissOnBackdrop, scrollMode, stickyHeader, stickyFooter, padding, contentSpacing, radius, maxWidth, width, fullscreen, maxHeightRatio, scrollbarColor, style, }: DialogProps): import("react/jsx-runtime").JSX.Element;
75
79
  //# sourceMappingURL=Dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,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AAC;IACvB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAY,EACZ,MAAM,EACN,SAAgB,EAChB,gBAAwB,EACxB,iBAAyB,EACzB,UAAoB,EACpB,YAAmB,EACnB,YAAmB,EACnB,OAAY,EACZ,cAAmB,EACnB,MAAW,EACX,QAAc,EACd,cAAoB,EACpB,cAAc,EACd,KAAK,GACN,EAAE,WAAW,2CA2Jb"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EASL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAK9D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mFAAmF;IACnF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,0CA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pF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAY,EACZ,MAAM,EACN,SAAgB,EAChB,gBAAwB,EACxB,iBAAyB,EACzB,UAAoB,EACpB,YAAmB,EACnB,YAAmB,EACnB,OAAY,EACZ,cAAmB,EACnB,MAAW,EACX,QAAc,EACd,KAAK,EACL,UAAkB,EAClB,cAAoB,EACpB,cAAc,EACd,KAAK,GACN,EAAE,WAAW,2CAmLb"}
@@ -0,0 +1,54 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ import type { IconName } from '../Icon/icons.generated';
4
+ /** The optional key to the left of 0. Hidden unless provided. */
5
+ export interface KeypadExtraKey {
6
+ /** Short label (e.g. "."). */
7
+ label?: string;
8
+ /** Or an icon. */
9
+ icon?: IconName;
10
+ /** If set, pressing appends this to the value (e.g. "." for decimals). */
11
+ value?: string;
12
+ /** Custom action (open a modal, navigate, …). Overrides `value`. */
13
+ onPress?: () => void;
14
+ /** Content color. */
15
+ color?: string;
16
+ /** Key background color. */
17
+ backgroundColor?: string;
18
+ }
19
+ export interface KeypadProps {
20
+ /** Controlled value being entered. Defaults to ''. */
21
+ value?: string;
22
+ /** Called with the next value on digit / backspace / extra-value press. */
23
+ onChangeText?: (value: string) => void;
24
+ /** Fired on every press with the raw key: '0'–'9', 'backspace', or 'extra'. */
25
+ onKeyPress?: (key: string) => void;
26
+ /** Max length of `value`. */
27
+ maxLength?: number;
28
+ /** Content shown above the keys (dots, amount, anything). Swappable per use case. */
29
+ header?: ReactNode;
30
+ /** The key left of 0. Hidden by default; provide to show and customize it. */
31
+ extraKey?: KeypadExtraKey;
32
+ /** Key height. Defaults to 83. */
33
+ keyHeight?: number;
34
+ /** Gap between keys. Defaults to 8. */
35
+ gap?: number;
36
+ /** Total width. Defaults to full width; the 3 columns split evenly. */
37
+ width?: number;
38
+ /** Digit font size. Defaults to 24. */
39
+ digitSize?: number;
40
+ /** Space between header and keys. Defaults to 24. */
41
+ headerGap?: number;
42
+ /** Disable all keys. */
43
+ disabled?: boolean;
44
+ style?: StyleProp<ViewStyle>;
45
+ }
46
+ /**
47
+ * Numeric keypad — a 3-column pad decoupled from what it drives (bind it to a
48
+ * PIN display, an amount, etc. via `value`/`onChangeText`, and put that display
49
+ * in `header`). Backspace is fixed to the right of 0; the key left of 0 is hidden
50
+ * unless you pass `extraKey` (custom symbol/icon, action and colors). Width,
51
+ * key height, gap and digit size are all configurable.
52
+ */
53
+ export declare function Keypad({ value, onChangeText, onKeyPress, maxLength, header, extraKey, keyHeight, gap, width, digitSize, headerGap, disabled, style, }: KeypadProps): import("react/jsx-runtime").JSX.Element;
54
+ //# sourceMappingURL=Keypad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Keypad.d.ts","sourceRoot":"","sources":["../../../../../src/components/Keypad/Keypad.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAQD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAU,EACV,YAAY,EACZ,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAc,EACd,GAAO,EACP,KAAK,EACL,SAAc,EACd,SAAc,EACd,QAAgB,EAChB,KAAK,GACN,EAAE,WAAW,2CAgHb"}
@@ -0,0 +1,3 @@
1
+ export { Keypad } from './Keypad';
2
+ export type { KeypadProps, KeypadExtraKey } from './Keypad';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Keypad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { IconName } from '../Icon/icons.generated';
2
+ /** Built-in statuses. More can be added later, or use custom colors. */
3
+ export type ToastStatus = 'success' | 'error' | 'warning' | 'info';
4
+ export interface ToastOptions {
5
+ /** Message text. Ellipsized on a single line if it overflows. */
6
+ message: string;
7
+ /** Visual status. Defaults to `info`. */
8
+ status?: ToastStatus;
9
+ /** Optional leading icon. */
10
+ icon?: IconName;
11
+ /** Time on screen in ms. `0` keeps it until dismissed. */
12
+ duration?: number;
13
+ /** Custom fixed height. */
14
+ height?: number;
15
+ /** Custom fixed width. Defaults to full width. */
16
+ width?: number;
17
+ /** Show a countdown progress bar for the remaining time (needs duration > 0). */
18
+ showProgress?: boolean;
19
+ /** Custom background (overrides status). */
20
+ backgroundColor?: string;
21
+ /** Custom text/icon color (overrides status). */
22
+ color?: string;
23
+ /** Countdown bar color. Defaults to the status foreground. */
24
+ progressColor?: string;
25
+ }
26
+ export interface ToastViewProps extends ToastOptions {
27
+ id: number;
28
+ position: 'top' | 'bottom';
29
+ /** When true, the toast animates out and then calls `onRemove`. */
30
+ leaving: boolean;
31
+ onRequestClose: (id: number) => void;
32
+ onRemove: (id: number) => void;
33
+ maxWidth?: number;
34
+ }
35
+ /**
36
+ * A single toast with an elegant slide + fade in/out. Self-contained: it runs
37
+ * its own duration timer and exit animation. Managed by `ToastProvider`.
38
+ */
39
+ export declare function ToastView({ id, message, status, icon, duration, height, width, showProgress, backgroundColor, color, progressColor, position, leaving, onRequestClose, onRemove, maxWidth, }: ToastViewProps): import("react/jsx-runtime").JSX.Element;
40
+ //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EA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-0,0 +1,34 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ToastOptions } from './Toast';
3
+ export interface ToastApi {
4
+ /** Show a toast; returns its id. */
5
+ show: (options: ToastOptions) => number;
6
+ /** Dismiss a toast by id (animates out). */
7
+ hide: (id: number) => void;
8
+ /** Dismiss all toasts. */
9
+ hideAll: () => void;
10
+ }
11
+ export interface ToastProviderProps {
12
+ children: ReactNode;
13
+ /** Where toasts appear. Defaults to `bottom`. */
14
+ position?: 'top' | 'bottom';
15
+ /** Max toasts on screen at once. Defaults to 2. */
16
+ maxVisible?: number;
17
+ /** Default time on screen in ms. Defaults to 3000. */
18
+ duration?: number;
19
+ /** Distance from the screen edge. Defaults to 24. */
20
+ offset?: number;
21
+ /** Gap between stacked toasts. Defaults to 8. */
22
+ gap?: number;
23
+ /** Max toast width. Defaults to full width (no cap). */
24
+ maxWidth?: number;
25
+ }
26
+ /**
27
+ * Provides the imperative toast API and renders the toast stack. Wrap your app
28
+ * (inside ThemeProvider). Trigger toasts with `useToast().show(...)`. Newest
29
+ * toasts appear nearest the edge; at most `maxVisible` show at once.
30
+ */
31
+ export declare function ToastProvider({ children, position, maxVisible, duration, offset, gap, maxWidth, }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
32
+ /** Access the toast API. Must be used within a `ToastProvider`. */
33
+ export declare function useToast(): ToastApi;
34
+ //# sourceMappingURL=ToastProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACvB,oCAAoC;IACpC,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,MAAM,CAAC;IACxC,4CAA4C;IAC5C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,0BAA0B;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AASD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAmB,EACnB,UAAc,EACd,QAAe,EACf,MAAW,EACX,GAAO,EACP,QAAQ,GACT,EAAE,kBAAkB,2CA6DpB;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,IAAI,QAAQ,CAInC"}
@@ -0,0 +1,3 @@
1
+ export { ToastView, type ToastOptions, type ToastStatus, type ToastViewProps } from './Toast';
2
+ export { ToastProvider, useToast, type ToastApi, type ToastProviderProps, } from './ToastProvider';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC"}
@@ -10,6 +10,7 @@ export * from './Dialog';
10
10
  export * from './Icon';
11
11
  export * from './IconButton';
12
12
  export * from './Input';
13
+ export * from './Keypad';
13
14
  export * from './LinkButton';
14
15
  export * from './ProductCard';
15
16
  export * from './QuantityStepper';
@@ -18,5 +19,6 @@ export * from './Spinner';
18
19
  export * from './Surface';
19
20
  export * from './Switch';
20
21
  export * from './Text';
22
+ export * from './Toast';
21
23
  export type { LabelPosition } from './_internal/Labeled';
22
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bacon-pos/ui",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Bacon POS design system — React Native component library",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -13,6 +13,16 @@ import { Text } from '../Text/Text';
13
13
  /** Removes the browser's default focus outline on web (no-op on native). */
14
14
  const WEB_NO_OUTLINE = { outlineStyle: 'none', outlineWidth: 0 } as unknown as TextStyle;
15
15
 
16
+ /** Convert a `#RRGGBB` (or `#RGB`) token to an `rgba()` string at the given alpha. */
17
+ function hexToRgba(hex: string, alpha: number): string {
18
+ const h = hex.replace('#', '');
19
+ const full = h.length === 3 ? h.replace(/./g, (c) => c + c) : h;
20
+ const r = parseInt(full.slice(0, 2), 16);
21
+ const g = parseInt(full.slice(2, 4), 16);
22
+ const b = parseInt(full.slice(4, 6), 16);
23
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
24
+ }
25
+
16
26
  export type CodeFieldMode = 'numeric' | 'alpha' | 'alphanumeric';
17
27
 
18
28
  /** Chars to strip per mode (applied after upper-casing). */
@@ -33,6 +43,10 @@ export interface CodeFieldProps {
33
43
  mode?: CodeFieldMode;
34
44
  /** Called once every cell is filled. */
35
45
  onComplete?: (value: string) => void;
46
+ /** Helper text below the cells. Replaced by the error message when `error` is a string. */
47
+ helperText?: string;
48
+ /** Mark the field invalid. Pass a string to show it as the error message. */
49
+ error?: boolean | string;
36
50
  /** Disable input and dim the cells. */
37
51
  disabled?: boolean;
38
52
  /** Focus on mount. */
@@ -65,6 +79,8 @@ export function CodeField({
65
79
  length = 6,
66
80
  mode = 'numeric',
67
81
  onComplete,
82
+ helperText,
83
+ error,
68
84
  disabled = false,
69
85
  autoFocus = false,
70
86
  cellWidth = 126,
@@ -86,75 +102,99 @@ export function CodeField({
86
102
  };
87
103
 
88
104
  const activeIndex = Math.min(value.length, length - 1);
105
+ const hasError = Boolean(error);
106
+ const message = typeof error === 'string' ? error : helperText;
89
107
 
90
108
  return (
91
- <Pressable
92
- onPress={() => inputRef.current?.focus()}
93
- disabled={disabled}
94
- style={[{ position: 'relative', alignSelf: 'flex-start' }, style]}
95
- >
96
- <View style={{ flexDirection: 'row', gap }}>
97
- {Array.from({ length }).map((_, i) => {
98
- const isActive = focused && i === activeIndex && !disabled;
99
- return (
100
- <View
101
- key={i}
102
- testID="code-field-cell"
103
- style={{
104
- width: cellWidth,
105
- height: cellHeight,
106
- borderRadius: theme.radii.pill,
107
- borderWidth: 1,
108
- borderColor: isActive ? theme.colors.border.focus : theme.colors.border.default,
109
- backgroundColor: disabled
110
- ? theme.colors.disabled.background
111
- : theme.colors.background.default,
112
- alignItems: 'center',
113
- justifyContent: 'center',
114
- opacity: disabled ? 0.6 : 1,
115
- ...(isActive
116
- ? {
117
- boxShadow: [
118
- { offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: 6, color: 'rgba(201,255,0,0.15)' },
119
- ] as ViewStyle['boxShadow'],
120
- }
121
- : null),
122
- }}
123
- >
124
- <Text
125
- color={disabled ? 'tertiary' : 'primary'}
109
+ <View style={[{ alignSelf: 'flex-start' }, style]}>
110
+ <Pressable
111
+ onPress={() => inputRef.current?.focus()}
112
+ disabled={disabled}
113
+ style={{ position: 'relative' }}
114
+ >
115
+ <View style={{ flexDirection: 'row', gap }}>
116
+ {Array.from({ length }).map((_, i) => {
117
+ const isActive = focused && i === activeIndex && !disabled;
118
+ // Error overrides the default/focus border on every cell; the active
119
+ // cell still gets the ring (red on error, lime otherwise).
120
+ const borderColor = hasError
121
+ ? theme.colors.feedback.error
122
+ : isActive
123
+ ? theme.colors.border.focus
124
+ : theme.colors.border.default;
125
+ const ringColor = hasError
126
+ ? hexToRgba(theme.colors.feedback.error, 0.15)
127
+ : 'rgba(201,255,0,0.15)';
128
+ return (
129
+ <View
130
+ key={i}
131
+ testID="code-field-cell"
126
132
  style={{
127
- fontFamily: fontFamily ?? theme.fontFamily.regular,
128
- fontSize,
129
- lineHeight: Math.round(fontSize * 1.45),
133
+ width: cellWidth,
134
+ height: cellHeight,
135
+ borderRadius: theme.radii.pill,
136
+ borderWidth: 1,
137
+ borderColor,
138
+ backgroundColor: disabled
139
+ ? theme.colors.disabled.background
140
+ : theme.colors.background.default,
141
+ alignItems: 'center',
142
+ justifyContent: 'center',
143
+ opacity: disabled ? 0.6 : 1,
144
+ ...(isActive
145
+ ? {
146
+ boxShadow: [
147
+ { offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: 6, color: ringColor },
148
+ ] as ViewStyle['boxShadow'],
149
+ }
150
+ : null),
130
151
  }}
131
152
  >
132
- {value[i] ?? ''}
133
- </Text>
134
- </View>
135
- );
136
- })}
137
- </View>
153
+ <Text
154
+ color={disabled ? 'tertiary' : 'primary'}
155
+ style={{
156
+ fontFamily: fontFamily ?? theme.fontFamily.regular,
157
+ fontSize,
158
+ lineHeight: Math.round(fontSize * 1.45),
159
+ }}
160
+ >
161
+ {value[i] ?? ''}
162
+ </Text>
163
+ </View>
164
+ );
165
+ })}
166
+ </View>
167
+
168
+ <TextInput
169
+ ref={inputRef}
170
+ value={value}
171
+ onChangeText={handleChange}
172
+ onFocus={() => setFocused(true)}
173
+ onBlur={() => setFocused(false)}
174
+ keyboardType={mode === 'numeric' ? 'number-pad' : 'default'}
175
+ autoCapitalize="characters"
176
+ autoCorrect={false}
177
+ maxLength={length}
178
+ editable={!disabled}
179
+ caretHidden
180
+ autoFocus={autoFocus}
181
+ accessibilityLabel={accessibilityLabel}
182
+ style={[
183
+ { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, opacity: 0 },
184
+ WEB_NO_OUTLINE,
185
+ ]}
186
+ />
187
+ </Pressable>
138
188
 
139
- <TextInput
140
- ref={inputRef}
141
- value={value}
142
- onChangeText={handleChange}
143
- onFocus={() => setFocused(true)}
144
- onBlur={() => setFocused(false)}
145
- keyboardType={mode === 'numeric' ? 'number-pad' : 'default'}
146
- autoCapitalize="characters"
147
- autoCorrect={false}
148
- maxLength={length}
149
- editable={!disabled}
150
- caretHidden
151
- autoFocus={autoFocus}
152
- accessibilityLabel={accessibilityLabel}
153
- style={[
154
- { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, opacity: 0 },
155
- WEB_NO_OUTLINE,
156
- ]}
157
- />
158
- </Pressable>
189
+ {message ? (
190
+ <Text
191
+ variant="bodySmall"
192
+ color={hasError ? theme.colors.feedback.error : 'tertiary'}
193
+ style={{ marginTop: 8, marginLeft: 8 }}
194
+ >
195
+ {message}
196
+ </Text>
197
+ ) : null}
198
+ </View>
159
199
  );
160
200
  }