ui-arreya-components 0.0.16 → 0.1.4

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 (109) hide show
  1. package/dist/index.d.mts +342 -0
  2. package/dist/index.d.ts +342 -0
  3. package/dist/index.js +1682 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +1495 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +63 -106
  8. package/.github/workflows/npm-publish.yml +0 -35
  9. package/.storybook/main.ts +0 -18
  10. package/.storybook/preview.ts +0 -16
  11. package/.storybook/vitest.setup.ts +0 -9
  12. package/README.md +0 -62
  13. package/components.json +0 -21
  14. package/dist/styles.css +0 -3
  15. package/dist/ui.cjs.js +0 -242
  16. package/dist/ui.es.js +0 -25142
  17. package/dist/ui.umd.js +0 -242
  18. package/eslint.config.js +0 -28
  19. package/postcss.config.js +0 -6
  20. package/scripts/build-index-ts.sh +0 -16
  21. package/scripts/template.sh +0 -57
  22. package/src/components/feature/graph-card.stories.tsx +0 -138
  23. package/src/components/feature/graph-card.tsx +0 -113
  24. package/src/components/feature/header.stories.tsx +0 -129
  25. package/src/components/feature/header.tsx +0 -78
  26. package/src/components/feature/login-form.stories.tsx +0 -35
  27. package/src/components/feature/login-form.tsx +0 -97
  28. package/src/components/feature/search-bar.stories.tsx +0 -35
  29. package/src/components/feature/search-bar.tsx +0 -141
  30. package/src/components/feature/wizard.stories.tsx +0 -199
  31. package/src/components/feature/wizard.tsx +0 -278
  32. package/src/components/ui/accordion.stories.tsx.disabled +0 -36
  33. package/src/components/ui/accordion.tsx +0 -55
  34. package/src/components/ui/alert-dialog.stories.tsx +0 -46
  35. package/src/components/ui/alert-dialog.tsx +0 -139
  36. package/src/components/ui/alert.stories.tsx +0 -45
  37. package/src/components/ui/alert.tsx +0 -59
  38. package/src/components/ui/aspect-ratio.stories.tsx +0 -24
  39. package/src/components/ui/aspect-ratio.tsx +0 -5
  40. package/src/components/ui/avatar.stories.tsx +0 -29
  41. package/src/components/ui/avatar.tsx +0 -48
  42. package/src/components/ui/badge.stories.tsx +0 -43
  43. package/src/components/ui/badge.tsx +0 -36
  44. package/src/components/ui/breadcrumb.stories.tsx +0 -146
  45. package/src/components/ui/breadcrumb.tsx +0 -115
  46. package/src/components/ui/button.stories.tsx +0 -87
  47. package/src/components/ui/button.tsx +0 -57
  48. package/src/components/ui/card.stories.tsx +0 -99
  49. package/src/components/ui/card.tsx +0 -76
  50. package/src/components/ui/carousel.stories.tsx +0 -47
  51. package/src/components/ui/carousel.tsx +0 -260
  52. package/src/components/ui/chart.stories.tsx.disabled +0 -44
  53. package/src/components/ui/chart.tsx +0 -363
  54. package/src/components/ui/checkbox.stories.tsx +0 -56
  55. package/src/components/ui/checkbox.tsx +0 -28
  56. package/src/components/ui/collapsible.stories.tsx +0 -58
  57. package/src/components/ui/collapsible.tsx +0 -9
  58. package/src/components/ui/context-menu.stories.tsx +0 -34
  59. package/src/components/ui/context-menu.tsx +0 -198
  60. package/src/components/ui/dialog.stories.tsx +0 -40
  61. package/src/components/ui/dialog.tsx +0 -120
  62. package/src/components/ui/drawer.stories.tsx +0 -48
  63. package/src/components/ui/drawer.tsx +0 -116
  64. package/src/components/ui/dropdown-menu.stories.tsx +0 -92
  65. package/src/components/ui/dropdown-menu.tsx +0 -199
  66. package/src/components/ui/form.tsx +0 -176
  67. package/src/components/ui/hover-card.stories.tsx +0 -31
  68. package/src/components/ui/hover-card.tsx +0 -27
  69. package/src/components/ui/input-otp.tsx +0 -69
  70. package/src/components/ui/input.stories.tsx +0 -63
  71. package/src/components/ui/input.tsx +0 -22
  72. package/src/components/ui/label.tsx +0 -24
  73. package/src/components/ui/menubar.tsx +0 -254
  74. package/src/components/ui/navigation-menu.tsx +0 -128
  75. package/src/components/ui/pagination.tsx +0 -117
  76. package/src/components/ui/popover.tsx +0 -31
  77. package/src/components/ui/progress.tsx +0 -26
  78. package/src/components/ui/radio-group.tsx +0 -42
  79. package/src/components/ui/resizable.tsx +0 -43
  80. package/src/components/ui/scroll-area.tsx +0 -46
  81. package/src/components/ui/select.tsx +0 -157
  82. package/src/components/ui/separator.tsx +0 -29
  83. package/src/components/ui/sheet.tsx +0 -138
  84. package/src/components/ui/sidebar.tsx +0 -771
  85. package/src/components/ui/skeleton.tsx +0 -15
  86. package/src/components/ui/slider.tsx +0 -26
  87. package/src/components/ui/sonner.tsx +0 -29
  88. package/src/components/ui/switch.tsx +0 -27
  89. package/src/components/ui/table.tsx +0 -120
  90. package/src/components/ui/tabs.tsx +0 -53
  91. package/src/components/ui/textarea.tsx +0 -22
  92. package/src/components/ui/toast.tsx +0 -127
  93. package/src/components/ui/toaster.tsx +0 -33
  94. package/src/components/ui/toggle-group.tsx +0 -59
  95. package/src/components/ui/toggle.tsx +0 -43
  96. package/src/components/ui/tooltip.tsx +0 -30
  97. package/src/hooks/use-mobile.tsx +0 -19
  98. package/src/hooks/use-toast.ts +0 -194
  99. package/src/index.css +0 -3633
  100. package/src/index.ts +0 -51
  101. package/src/lib/types.ts +0 -5
  102. package/src/lib/utils.ts +0 -6
  103. package/src/styles/tailwind.css +0 -100
  104. package/tailwind.config.js +0 -94
  105. package/tsconfig.app.json +0 -30
  106. package/tsconfig.json +0 -13
  107. package/tsconfig.node.json +0 -24
  108. package/vite.config.ts +0 -33
  109. package/vitest.workspace.ts +0 -32
@@ -1,194 +0,0 @@
1
- "use client"
2
-
3
- // Inspired by react-hot-toast library
4
- import * as React from "react"
5
-
6
- import type {
7
- ToastActionElement,
8
- ToastProps,
9
- } from "@/components/ui/toast"
10
-
11
- const TOAST_LIMIT = 1
12
- const TOAST_REMOVE_DELAY = 1000000
13
-
14
- type ToasterToast = ToastProps & {
15
- id: string
16
- title?: React.ReactNode
17
- description?: React.ReactNode
18
- action?: ToastActionElement
19
- }
20
-
21
- const actionTypes = {
22
- ADD_TOAST: "ADD_TOAST",
23
- UPDATE_TOAST: "UPDATE_TOAST",
24
- DISMISS_TOAST: "DISMISS_TOAST",
25
- REMOVE_TOAST: "REMOVE_TOAST",
26
- } as const
27
-
28
- let count = 0
29
-
30
- function genId() {
31
- count = (count + 1) % Number.MAX_SAFE_INTEGER
32
- return count.toString()
33
- }
34
-
35
- type ActionType = typeof actionTypes
36
-
37
- type Action =
38
- | {
39
- type: ActionType["ADD_TOAST"]
40
- toast: ToasterToast
41
- }
42
- | {
43
- type: ActionType["UPDATE_TOAST"]
44
- toast: Partial<ToasterToast>
45
- }
46
- | {
47
- type: ActionType["DISMISS_TOAST"]
48
- toastId?: ToasterToast["id"]
49
- }
50
- | {
51
- type: ActionType["REMOVE_TOAST"]
52
- toastId?: ToasterToast["id"]
53
- }
54
-
55
- interface State {
56
- toasts: ToasterToast[]
57
- }
58
-
59
- const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
60
-
61
- const addToRemoveQueue = (toastId: string) => {
62
- if (toastTimeouts.has(toastId)) {
63
- return
64
- }
65
-
66
- const timeout = setTimeout(() => {
67
- toastTimeouts.delete(toastId)
68
- dispatch({
69
- type: "REMOVE_TOAST",
70
- toastId: toastId,
71
- })
72
- }, TOAST_REMOVE_DELAY)
73
-
74
- toastTimeouts.set(toastId, timeout)
75
- }
76
-
77
- export const reducer = (state: State, action: Action): State => {
78
- switch (action.type) {
79
- case "ADD_TOAST":
80
- return {
81
- ...state,
82
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
83
- }
84
-
85
- case "UPDATE_TOAST":
86
- return {
87
- ...state,
88
- toasts: state.toasts.map((t) =>
89
- t.id === action.toast.id ? { ...t, ...action.toast } : t
90
- ),
91
- }
92
-
93
- case "DISMISS_TOAST": {
94
- const { toastId } = action
95
-
96
- // ! Side effects ! - This could be extracted into a dismissToast() action,
97
- // but I'll keep it here for simplicity
98
- if (toastId) {
99
- addToRemoveQueue(toastId)
100
- } else {
101
- state.toasts.forEach((toast) => {
102
- addToRemoveQueue(toast.id)
103
- })
104
- }
105
-
106
- return {
107
- ...state,
108
- toasts: state.toasts.map((t) =>
109
- t.id === toastId || toastId === undefined
110
- ? {
111
- ...t,
112
- open: false,
113
- }
114
- : t
115
- ),
116
- }
117
- }
118
- case "REMOVE_TOAST":
119
- if (action.toastId === undefined) {
120
- return {
121
- ...state,
122
- toasts: [],
123
- }
124
- }
125
- return {
126
- ...state,
127
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
128
- }
129
- }
130
- }
131
-
132
- const listeners: Array<(state: State) => void> = []
133
-
134
- let memoryState: State = { toasts: [] }
135
-
136
- function dispatch(action: Action) {
137
- memoryState = reducer(memoryState, action)
138
- listeners.forEach((listener) => {
139
- listener(memoryState)
140
- })
141
- }
142
-
143
- type Toast = Omit<ToasterToast, "id">
144
-
145
- function toast({ ...props }: Toast) {
146
- const id = genId()
147
-
148
- const update = (props: ToasterToast) =>
149
- dispatch({
150
- type: "UPDATE_TOAST",
151
- toast: { ...props, id },
152
- })
153
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
154
-
155
- dispatch({
156
- type: "ADD_TOAST",
157
- toast: {
158
- ...props,
159
- id,
160
- open: true,
161
- onOpenChange: (open) => {
162
- if (!open) dismiss()
163
- },
164
- },
165
- })
166
-
167
- return {
168
- id: id,
169
- dismiss,
170
- update,
171
- }
172
- }
173
-
174
- function useToast() {
175
- const [state, setState] = React.useState<State>(memoryState)
176
-
177
- React.useEffect(() => {
178
- listeners.push(setState)
179
- return () => {
180
- const index = listeners.indexOf(setState)
181
- if (index > -1) {
182
- listeners.splice(index, 1)
183
- }
184
- }
185
- }, [state])
186
-
187
- return {
188
- ...state,
189
- toast,
190
- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
191
- }
192
- }
193
-
194
- export { useToast, toast }