rei-kit 2.4.0 → 2.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.
@@ -22,16 +22,34 @@
22
22
  * same corner. The store lives at module scope and `ToastHost` renders it.
23
23
  */
24
24
  export type ToastTone = 'info' | 'success' | 'warning' | 'danger';
25
+ /**
26
+ * One button on a toast — nearly always "Undo".
27
+ *
28
+ * The toast is dismissed when it is pressed, so the handler only has to do
29
+ * the undoing.
30
+ */
31
+ export interface ToastAction {
32
+ /** The button's text. Already translated. */
33
+ readonly label: string;
34
+ readonly onClick: () => void;
35
+ }
25
36
  export interface Toast {
26
37
  readonly id: number;
27
38
  readonly message: string;
28
39
  readonly tone: ToastTone;
29
40
  /** Milliseconds on screen. `0` stays until dismissed. */
30
41
  readonly duration: number;
42
+ readonly action?: ToastAction | undefined;
31
43
  }
32
44
  export interface ToastOptions {
33
45
  /** Milliseconds on screen; `0` stays until dismissed. */
34
46
  duration?: number | undefined;
47
+ /**
48
+ * A button on the toast. An undo is the kindest confirmation there is: act
49
+ * first, and let the reader take it back, instead of asking "are you sure"
50
+ * before every delete.
51
+ */
52
+ action?: ToastAction | undefined;
35
53
  }
36
54
  /** Removes a toast, whether it timed out or was dismissed. */
37
55
  declare function dismiss(id: number): void;
@@ -58,6 +76,10 @@ declare function resume(id: number): void;
58
76
  *
59
77
  * const id = toast.info(t('export.preparing'), { duration: 0 })
60
78
  * toast.dismiss(id)
79
+ *
80
+ * toast.success(t('entry.deleted'), {
81
+ * action: { label: t('common.undo'), onClick: () => restore(entry) },
82
+ * })
61
83
  * ```
62
84
  */
63
85
  export declare function useToast(): {
@@ -67,11 +89,19 @@ export declare function useToast(): {
67
89
  readonly message: string;
68
90
  readonly tone: ToastTone;
69
91
  readonly duration: number;
92
+ readonly action?: {
93
+ readonly label: string;
94
+ readonly onClick: () => void;
95
+ } | undefined;
70
96
  }[], readonly {
71
97
  readonly id: number;
72
98
  readonly message: string;
73
99
  readonly tone: ToastTone;
74
100
  readonly duration: number;
101
+ readonly action?: {
102
+ readonly label: string;
103
+ readonly onClick: () => void;
104
+ } | undefined;
75
105
  }[]>>;
76
106
  info: (message: string, options?: ToastOptions) => number;
77
107
  success: (message: string, options?: ToastOptions) => number;
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export { useDragScroll } from './composables/use-drag-scroll';
44
44
  export { useMediaQuery } from './composables/use-media-query';
45
45
  export { useVisualViewport } from './composables/use-visual-viewport';
46
46
  export { useToast } from './composables/use-toast';
47
- export type { Toast, ToastOptions, ToastTone } from './composables/use-toast';
47
+ export type { Toast, ToastAction, ToastOptions, ToastTone } from './composables/use-toast';
48
48
  export type { VisualViewportRect } from './composables/use-visual-viewport';
49
49
  export { default as BaseAvatar } from './components/BaseAvatar.vue';
50
50
  export { default as BaseAlert } from './components/BaseAlert.vue';
@@ -85,5 +85,13 @@ export { default as LocaleLinks } from './components/LocaleLinks.vue';
85
85
  export { default as GoogleButton } from './components/GoogleButton.vue';
86
86
  export { default as TabBar } from './components/TabBar.vue';
87
87
  export type { TabItem } from './components/TabBar.vue';
88
+ export { default as BasePopover } from './components/BasePopover.vue';
89
+ export type { PopoverTriggerProps } from './components/BasePopover.vue';
90
+ export { default as ToggleGroup } from './components/ToggleGroup.vue';
91
+ export { default as NumberInput } from './components/NumberInput.vue';
92
+ export { default as PinInput } from './components/PinInput.vue';
93
+ export { default as CircularProgress } from './components/CircularProgress.vue';
94
+ export { default as BaseStepper } from './components/BaseStepper.vue';
95
+ export type { StepperStep } from './components/BaseStepper.vue';
88
96
  export { createI18nRuntime } from './i18n/runtime';
89
97
  export type { I18nRuntimeOptions, LocalePreference } from './i18n/runtime';