@bearmenu/ui 0.7.1 → 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 (128) hide show
  1. package/dist/{chunk-4JOV7FXW.js → chunk-2DEIXTBN.js} +1 -1
  2. package/dist/{chunk-UUJVXN2O.js → chunk-66MAPLXS.js} +3 -1
  3. package/dist/{chunk-Y5D5LP4A.js → chunk-7BWTYWM3.js} +14 -3
  4. package/dist/{chunk-ZFNOCP6W.js → chunk-H3BV4VAG.js} +15 -1
  5. package/dist/{chunk-TL4YU2O5.js → chunk-UKBNQO6Q.js} +2 -2
  6. package/dist/{chunk-UX6SWAKH.js → chunk-UZ3PCIE5.js} +119 -28
  7. package/dist/{chunk-YLNYXPIH.js → chunk-VBA45GLP.js} +1 -1
  8. package/dist/{chunk-A5ONAJCE.js → chunk-VG3PND3D.js} +1 -1
  9. package/dist/{chunk-ZBBUKXM5.js → chunk-X3WMRKOW.js} +1 -1
  10. package/dist/{chunk-HCM6LKM5.js → chunk-XNA2INVQ.js} +2 -2
  11. package/dist/{chunk-AV777R4G.js → chunk-YYGB4G4Q.js} +1 -1
  12. package/dist/components/accordion.js +1 -1
  13. package/dist/components/alert-dialog.js +1 -1
  14. package/dist/components/alert.d.ts +2 -2
  15. package/dist/components/alert.js +1 -1
  16. package/dist/components/avatar.d.ts +10 -1
  17. package/dist/components/avatar.js +41 -14
  18. package/dist/components/badge.d.ts +11 -2
  19. package/dist/components/badge.js +1 -1
  20. package/dist/components/breadcrumb.js +1 -1
  21. package/dist/components/button.d.ts +1 -1
  22. package/dist/components/button.js +1 -1
  23. package/dist/components/calendar.js +3 -3
  24. package/dist/components/card.d.ts +2 -2
  25. package/dist/components/card.js +1 -1
  26. package/dist/components/carousel.js +1 -1
  27. package/dist/components/circular-progress.js +1 -1
  28. package/dist/components/combobox.js +3 -3
  29. package/dist/components/command.d.ts +15 -15
  30. package/dist/components/command.js +1 -1
  31. package/dist/components/currency-input.js +2 -2
  32. package/dist/components/date-input.d.ts +1 -1
  33. package/dist/components/date-input.js +1 -1
  34. package/dist/components/description-list.js +1 -1
  35. package/dist/components/dropdown-menu.js +1 -1
  36. package/dist/components/empty-state.js +2 -2
  37. package/dist/components/field.js +2 -2
  38. package/dist/components/filter-category-row.js +2 -2
  39. package/dist/components/form.js +1 -1
  40. package/dist/components/haptic-button.js +1 -1
  41. package/dist/components/input-group.js +1 -1
  42. package/dist/components/input.js +1 -1
  43. package/dist/components/item.d.ts +2 -2
  44. package/dist/components/item.js +1 -1
  45. package/dist/components/kbd.js +1 -1
  46. package/dist/components/label.js +1 -1
  47. package/dist/components/link-button.js +1 -1
  48. package/dist/components/multi-select-combobox.js +4 -4
  49. package/dist/components/pagination.js +1 -1
  50. package/dist/components/place-about-tab.d.ts +17 -1
  51. package/dist/components/place-about-tab.js +4 -4
  52. package/dist/components/place-card.js +2 -2
  53. package/dist/components/place-details-mobile.js +7 -7
  54. package/dist/components/place-schedule-week.js +2 -2
  55. package/dist/components/popover.js +1 -1
  56. package/dist/components/searchable-select.js +3 -3
  57. package/dist/components/select.js +2 -2
  58. package/dist/components/selection-bar.js +1 -1
  59. package/dist/components/sheet.d.ts +23 -0
  60. package/dist/components/sheet.js +51 -14
  61. package/dist/components/sliding-panels.js +5 -1
  62. package/dist/components/sonner.js +2 -2
  63. package/dist/components/spinner.d.ts +2 -2
  64. package/dist/components/stepper.js +4 -1
  65. package/dist/components/table.js +1 -1
  66. package/dist/components/tabs.js +1 -1
  67. package/dist/components/tag-group.js +1 -1
  68. package/dist/components/tag.d.ts +2 -2
  69. package/dist/components/tag.js +1 -1
  70. package/dist/components/text.d.ts +21 -3
  71. package/dist/components/text.js +1 -1
  72. package/dist/components/toggle-group.js +1 -1
  73. package/dist/components/toggle.js +1 -1
  74. package/dist/lib/card-hover.d.ts +75 -0
  75. package/dist/lib/card-hover.js +18 -0
  76. package/package.json +1 -1
  77. package/src/components/accordion.tsx +1 -1
  78. package/src/components/avatar.stories.tsx +59 -26
  79. package/src/components/avatar.test.tsx +129 -0
  80. package/src/components/avatar.tsx +93 -37
  81. package/src/components/badge.tsx +15 -3
  82. package/src/components/breadcrumb.tsx +1 -1
  83. package/src/components/button.tsx +16 -1
  84. package/src/components/calendar.tsx +2 -2
  85. package/src/components/circular-progress.tsx +1 -1
  86. package/src/components/command.tsx +2 -2
  87. package/src/components/currency-input.tsx +1 -1
  88. package/src/components/description-list.tsx +1 -1
  89. package/src/components/dropdown-menu.tsx +1 -1
  90. package/src/components/field.tsx +1 -1
  91. package/src/components/input-group.tsx +1 -1
  92. package/src/components/input.tsx +1 -1
  93. package/src/components/item.tsx +1 -1
  94. package/src/components/kbd.tsx +1 -1
  95. package/src/components/label.tsx +1 -1
  96. package/src/components/place-about-tab.tsx +131 -18
  97. package/src/components/place-card.tsx +1 -1
  98. package/src/components/place-details-mobile.tsx +2 -2
  99. package/src/components/popover.tsx +9 -1
  100. package/src/components/select.tsx +2 -2
  101. package/src/components/selection-bar.tsx +1 -1
  102. package/src/components/sheet.tsx +72 -12
  103. package/src/components/sliding-panels.stories.tsx +70 -0
  104. package/src/components/sliding-panels.test.tsx +116 -0
  105. package/src/components/sliding-panels.tsx +14 -0
  106. package/src/components/sonner.tsx +2 -2
  107. package/src/components/stepper.tsx +4 -1
  108. package/src/components/table.tsx +1 -1
  109. package/src/components/tabs.tsx +1 -1
  110. package/src/components/tag-group.tsx +1 -1
  111. package/src/components/tag.tsx +1 -1
  112. package/src/components/text.test.tsx +37 -3
  113. package/src/components/text.tsx +32 -3
  114. package/src/components/toggle.tsx +1 -1
  115. package/src/globals.css +53 -11
  116. package/src/lib/card-hover.ts +87 -0
  117. package/dist/chunk-EBAMCZDW.js +0 -112
  118. package/dist/chunk-VQNDZVI7.js +0 -106
  119. package/dist/components/toast.d.ts +0 -18
  120. package/dist/components/toast.js +0 -3
  121. package/dist/components/toaster.d.ts +0 -5
  122. package/dist/components/toaster.js +0 -25
  123. package/dist/components/use-toast.d.ts +0 -42
  124. package/dist/components/use-toast.js +0 -2
  125. package/src/components/toast.stories.tsx +0 -63
  126. package/src/components/toast.tsx +0 -130
  127. package/src/components/toaster.tsx +0 -31
  128. package/src/components/use-toast.ts +0 -180
@@ -1,130 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as ToastPrimitives from "@radix-ui/react-toast";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
- import { X } from "lucide-react";
7
- import { cn } from "../lib/utils";
8
-
9
- const ToastProvider = ToastPrimitives.Provider;
10
-
11
- const ToastViewport = React.forwardRef<
12
- React.ElementRef<typeof ToastPrimitives.Viewport>,
13
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
14
- >(({ className, ...props }, ref) => (
15
- <ToastPrimitives.Viewport
16
- ref={ref}
17
- className={cn(
18
- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
19
- className
20
- )}
21
- {...props}
22
- />
23
- ));
24
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
25
-
26
- const toastVariants = cva(
27
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-xl p-6 pr-8 shadow-2xl transition-[transform,opacity] duration-[var(--duration-standard)] ease-[var(--ease-standard)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=open]:duration-[var(--duration-standard)] data-[state=closed]:duration-[var(--duration-exit-standard)] data-[state=open]:ease-[var(--ease-enter)] data-[state=closed]:ease-[var(--ease-exit)] data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
28
- {
29
- variants: {
30
- variant: {
31
- default: "glass text-foreground border border-border/50",
32
- destructive:
33
- "destructive border border-destructive/60 bg-destructive text-destructive-foreground",
34
- },
35
- },
36
- defaultVariants: {
37
- variant: "default",
38
- },
39
- }
40
- );
41
-
42
- const Toast = React.forwardRef<
43
- React.ElementRef<typeof ToastPrimitives.Root>,
44
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>
45
- >(({ className, variant, ...props }, ref) => {
46
- return (
47
- <ToastPrimitives.Root
48
- ref={ref}
49
- className={cn(toastVariants({ variant }), className)}
50
- {...props}
51
- />
52
- );
53
- });
54
- Toast.displayName = ToastPrimitives.Root.displayName;
55
-
56
- const ToastAction = React.forwardRef<
57
- React.ElementRef<typeof ToastPrimitives.Action>,
58
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
59
- >(({ className, ...props }, ref) => (
60
- <ToastPrimitives.Action
61
- ref={ref}
62
- className={cn(
63
- "inline-flex h-8 shrink-0 items-center justify-center rounded-lg border border-muted bg-transparent px-3 text-xs font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
64
- className
65
- )}
66
- {...props}
67
- />
68
- ));
69
- ToastAction.displayName = ToastPrimitives.Action.displayName;
70
-
71
- const ToastClose = React.forwardRef<
72
- React.ElementRef<typeof ToastPrimitives.Close>,
73
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
74
- >(({ className, ...props }, ref) => (
75
- <ToastPrimitives.Close
76
- ref={ref}
77
- className={cn(
78
- "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-white group-[.destructive]:opacity-100 group-[.destructive]:hover:text-white group-[.destructive]:focus:ring-white/50 group-[.destructive]:focus:ring-offset-destructive",
79
- className
80
- )}
81
- toast-close=""
82
- {...props}
83
- >
84
- <X className="h-4 w-4" />
85
- </ToastPrimitives.Close>
86
- ));
87
- ToastClose.displayName = ToastPrimitives.Close.displayName;
88
-
89
- const ToastTitle = React.forwardRef<
90
- React.ElementRef<typeof ToastPrimitives.Title>,
91
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
92
- >(({ className, ...props }, ref) => (
93
- <ToastPrimitives.Title
94
- ref={ref}
95
- className={cn(
96
- "text-sm font-semibold group-[.destructive]:text-destructive-foreground",
97
- className
98
- )}
99
- {...props}
100
- />
101
- ));
102
- ToastTitle.displayName = ToastPrimitives.Title.displayName;
103
-
104
- const ToastDescription = React.forwardRef<
105
- React.ElementRef<typeof ToastPrimitives.Description>,
106
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
107
- >(({ className, ...props }, ref) => (
108
- <ToastPrimitives.Description
109
- ref={ref}
110
- className={cn("text-sm opacity-90 group-[.destructive]:text-white", className)}
111
- {...props}
112
- />
113
- ));
114
- ToastDescription.displayName = ToastPrimitives.Description.displayName;
115
-
116
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
117
-
118
- type ToastActionElement = React.ReactElement<typeof ToastAction>;
119
-
120
- export {
121
- type ToastProps,
122
- type ToastActionElement,
123
- ToastProvider,
124
- ToastViewport,
125
- Toast,
126
- ToastTitle,
127
- ToastDescription,
128
- ToastClose,
129
- ToastAction,
130
- };
@@ -1,31 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- Toast,
5
- ToastClose,
6
- ToastDescription,
7
- ToastProvider,
8
- ToastTitle,
9
- ToastViewport,
10
- } from "./toast";
11
- import { useToast } from "./use-toast";
12
-
13
- export function Toaster() {
14
- const { toasts } = useToast();
15
-
16
- return (
17
- <ToastProvider>
18
- {toasts.map(({ id, title, description, action, ...props }) => (
19
- <Toast key={id} {...props}>
20
- <div className="grid gap-1">
21
- {title && <ToastTitle>{title}</ToastTitle>}
22
- {description && <ToastDescription>{description}</ToastDescription>}
23
- </div>
24
- {action}
25
- <ToastClose />
26
- </Toast>
27
- ))}
28
- <ToastViewport />
29
- </ToastProvider>
30
- );
31
- }
@@ -1,180 +0,0 @@
1
- "use client";
2
-
3
- // Inspired by react-hot-toast library
4
- import * as React from "react";
5
-
6
- import type { ToastActionElement, ToastProps } from "./toast";
7
-
8
- const TOAST_LIMIT = 1;
9
- const TOAST_REMOVE_DELAY = 1000000;
10
-
11
- type ToasterToast = ToastProps & {
12
- id: string;
13
- title?: React.ReactNode;
14
- description?: React.ReactNode;
15
- action?: ToastActionElement;
16
- };
17
-
18
- let count = 0;
19
-
20
- function genId() {
21
- count = (count + 1) % Number.MAX_SAFE_INTEGER;
22
- return count.toString();
23
- }
24
-
25
- type Action =
26
- | {
27
- type: "ADD_TOAST";
28
- toast: ToasterToast;
29
- }
30
- | {
31
- type: "UPDATE_TOAST";
32
- toast: Partial<ToasterToast>;
33
- }
34
- | {
35
- type: "DISMISS_TOAST";
36
- toastId?: ToasterToast["id"];
37
- }
38
- | {
39
- type: "REMOVE_TOAST";
40
- toastId?: ToasterToast["id"];
41
- };
42
-
43
- interface State {
44
- toasts: ToasterToast[];
45
- }
46
-
47
- const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
48
-
49
- const addToRemoveQueue = (toastId: string) => {
50
- if (toastTimeouts.has(toastId)) {
51
- return;
52
- }
53
-
54
- const timeout = setTimeout(() => {
55
- toastTimeouts.delete(toastId);
56
- dispatch({
57
- type: "REMOVE_TOAST",
58
- toastId: toastId,
59
- });
60
- }, TOAST_REMOVE_DELAY);
61
-
62
- toastTimeouts.set(toastId, timeout);
63
- };
64
-
65
- export const reducer = (state: State, action: Action): State => {
66
- switch (action.type) {
67
- case "ADD_TOAST":
68
- return {
69
- ...state,
70
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
71
- };
72
-
73
- case "UPDATE_TOAST":
74
- return {
75
- ...state,
76
- toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)),
77
- };
78
-
79
- case "DISMISS_TOAST": {
80
- const { toastId } = action;
81
-
82
- // ! Side effects ! - This could be extracted into a dismissToast() action,
83
- // but I'll keep it here for simplicity
84
- if (toastId) {
85
- addToRemoveQueue(toastId);
86
- } else {
87
- state.toasts.forEach((toast) => {
88
- addToRemoveQueue(toast.id);
89
- });
90
- }
91
-
92
- return {
93
- ...state,
94
- toasts: state.toasts.map((t) =>
95
- t.id === toastId || toastId === undefined
96
- ? {
97
- ...t,
98
- open: false,
99
- }
100
- : t
101
- ),
102
- };
103
- }
104
- case "REMOVE_TOAST":
105
- if (action.toastId === undefined) {
106
- return {
107
- ...state,
108
- toasts: [],
109
- };
110
- }
111
- return {
112
- ...state,
113
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
114
- };
115
- }
116
- };
117
-
118
- const listeners: Array<(state: State) => void> = [];
119
-
120
- let memoryState: State = { toasts: [] };
121
-
122
- function dispatch(action: Action) {
123
- memoryState = reducer(memoryState, action);
124
- listeners.forEach((listener) => {
125
- listener(memoryState);
126
- });
127
- }
128
-
129
- type Toast = Omit<ToasterToast, "id">;
130
-
131
- function toast({ ...props }: Toast) {
132
- const id = genId();
133
-
134
- const update = (props: ToasterToast) =>
135
- dispatch({
136
- type: "UPDATE_TOAST",
137
- toast: { ...props, id },
138
- });
139
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
140
-
141
- dispatch({
142
- type: "ADD_TOAST",
143
- toast: {
144
- ...props,
145
- id,
146
- open: true,
147
- onOpenChange: (open) => {
148
- if (!open) dismiss();
149
- },
150
- },
151
- });
152
-
153
- return {
154
- id: id,
155
- dismiss,
156
- update,
157
- };
158
- }
159
-
160
- function useToast() {
161
- const [state, setState] = React.useState<State>(memoryState);
162
-
163
- React.useEffect(() => {
164
- listeners.push(setState);
165
- return () => {
166
- const index = listeners.indexOf(setState);
167
- if (index > -1) {
168
- listeners.splice(index, 1);
169
- }
170
- };
171
- }, [state]);
172
-
173
- return {
174
- ...state,
175
- toast,
176
- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
177
- };
178
- }
179
-
180
- export { useToast, toast };