@customafk/lunas-ui 0.0.2-g → 0.0.2-h

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.
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
7
  variant?: "default" | "secondary" | "outline" | "destructive" | "destructive-secondary" | "destructive-outline" | "sort-outline" | "normal" | null | undefined;
8
- size?: "default" | "small" | "base" | "large" | null | undefined;
8
+ size?: "base" | "small" | "default" | "large" | null | undefined;
9
9
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
10
10
 
11
11
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
8
8
  ref?: React.Ref<HTMLDivElement>;
9
9
  } & {
10
10
  asChild?: boolean;
11
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
11
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
12
12
  label?: string;
13
13
  shouldFilter?: boolean;
14
14
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -26,7 +26,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
26
26
  ref?: React.Ref<HTMLInputElement>;
27
27
  } & {
28
28
  asChild?: boolean;
29
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
29
+ }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
30
30
  value?: string;
31
31
  onValueChange?: (search: string) => void;
32
32
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -36,7 +36,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
36
36
  ref?: React.Ref<HTMLDivElement>;
37
37
  } & {
38
38
  asChild?: boolean;
39
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
39
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
40
40
  label?: string;
41
41
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
42
42
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -45,14 +45,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
45
45
  ref?: React.Ref<HTMLDivElement>;
46
46
  } & {
47
47
  asChild?: boolean;
48
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
49
49
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
50
50
  children?: React.ReactNode;
51
51
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
52
52
  ref?: React.Ref<HTMLDivElement>;
53
53
  } & {
54
54
  asChild?: boolean;
55
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
55
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
56
56
  heading?: React.ReactNode;
57
57
  value?: string;
58
58
  forceMount?: boolean;
@@ -61,7 +61,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
61
61
  ref?: React.Ref<HTMLDivElement>;
62
62
  } & {
63
63
  asChild?: boolean;
64
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
64
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
65
65
  alwaysRender?: boolean;
66
66
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
67
67
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -70,7 +70,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
70
70
  ref?: React.Ref<HTMLDivElement>;
71
71
  } & {
72
72
  asChild?: boolean;
73
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "value" | "disabled"> & {
73
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
74
74
  disabled?: boolean;
75
75
  onSelect?: (value: string) => void;
76
76
  value?: string;
@@ -1,8 +1,4 @@
1
- import * as React from 'react';
2
1
  import React__default, { useEffect } from 'react';
3
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
4
- import * as ToastPrimitives from '@radix-ui/react-toast';
5
- import { VariantProps } from 'class-variance-authority';
6
2
 
7
3
  type TUseBoolean = {
8
4
  value: boolean;
@@ -58,59 +54,10 @@ declare const useOnClickOutside: <T extends HTMLElement = HTMLElement>(reference
58
54
 
59
55
  declare const useTimeout: (callback: () => void, delay: number | null) => void;
60
56
 
61
- declare const Toast$1: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
62
- variant?: "default" | "destructive" | null | undefined;
63
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
64
- declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
65
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast$1>;
66
- type ToastActionElement = React.ReactElement<typeof ToastAction>;
67
-
68
- type ToasterToast = ToastProps & {
69
- id: string;
70
- title?: React.ReactNode;
71
- description?: React.ReactNode;
72
- action?: ToastActionElement;
73
- };
74
- declare const actionTypes: {
75
- readonly ADD_TOAST: "ADD_TOAST";
76
- readonly UPDATE_TOAST: "UPDATE_TOAST";
77
- readonly DISMISS_TOAST: "DISMISS_TOAST";
78
- readonly REMOVE_TOAST: "REMOVE_TOAST";
79
- };
80
- type ActionType = typeof actionTypes;
81
- type Action = {
82
- type: ActionType['ADD_TOAST'];
83
- toast: ToasterToast;
84
- } | {
85
- type: ActionType['UPDATE_TOAST'];
86
- toast: Partial<ToasterToast>;
87
- } | {
88
- type: ActionType['DISMISS_TOAST'];
89
- toastId?: ToasterToast['id'];
90
- } | {
91
- type: ActionType['REMOVE_TOAST'];
92
- toastId?: ToasterToast['id'];
93
- };
94
- interface State {
95
- toasts: ToasterToast[];
96
- }
97
- declare const reducer: (state: State, action: Action) => State;
98
- type Toast = Omit<ToasterToast, 'id'>;
99
- declare function toast({ duration, ...props }: Toast): {
100
- id: string;
101
- dismiss: () => void;
102
- update: (props: ToasterToast) => void;
103
- };
104
- declare function useToast(): {
105
- toast: typeof toast;
106
- dismiss: (toastId?: string) => void;
107
- toasts: ToasterToast[];
108
- };
109
-
110
57
  /**
111
58
  * Custom hook that runs a cleanup function when the component is unmounted
112
59
  * @param func
113
60
  */
114
61
  declare const useUnmount: (callback: () => void) => void;
115
62
 
116
- export { reducer, toast, useBoolean, useClickAnyWhere, useCopyToClipboard, useEventListener, useHover, useInterval, useIsomorphicLayoutEffect, useOnClickOutside, useTimeout, useToast, useUnmount };
63
+ export { useBoolean, useClickAnyWhere, useCopyToClipboard, useEventListener, useHover, useInterval, useIsomorphicLayoutEffect, useOnClickOutside, useTimeout, useUnmount };
@@ -127,133 +127,12 @@ var useTimeout = (callback, delay) => {
127
127
  };
128
128
  var useTimeout_default = useTimeout;
129
129
 
130
- // packages/hooks/useToast.tsx
131
- import * as React7 from "react";
132
- var TOAST_LIMIT = 1;
133
- var TOAST_REMOVE_DELAY = 1e6;
134
- var count = 0;
135
- function genId() {
136
- count = (count + 1) % Number.MAX_SAFE_INTEGER;
137
- return count.toString();
138
- }
139
- var toastTimeouts = /* @__PURE__ */ new Map();
140
- var addToRemoveQueue = (toastId) => {
141
- if (toastTimeouts.has(toastId)) {
142
- return;
143
- }
144
- const timeout = setTimeout(() => {
145
- toastTimeouts.delete(toastId);
146
- dispatch({
147
- type: "REMOVE_TOAST",
148
- toastId
149
- });
150
- }, TOAST_REMOVE_DELAY);
151
- toastTimeouts.set(toastId, timeout);
152
- };
153
- var reducer = (state, action) => {
154
- switch (action.type) {
155
- case "ADD_TOAST": {
156
- return {
157
- ...state,
158
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
159
- };
160
- }
161
- case "UPDATE_TOAST": {
162
- return {
163
- ...state,
164
- toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t)
165
- };
166
- }
167
- case "DISMISS_TOAST": {
168
- const { toastId } = action;
169
- if (toastId) {
170
- addToRemoveQueue(toastId);
171
- } else {
172
- state.toasts.forEach((toast2) => {
173
- addToRemoveQueue(toast2.id);
174
- });
175
- }
176
- return {
177
- ...state,
178
- toasts: state.toasts.map(
179
- (t) => t.id === toastId || toastId === void 0 ? {
180
- ...t,
181
- open: false
182
- } : t
183
- )
184
- };
185
- }
186
- case "REMOVE_TOAST": {
187
- if (action.toastId === void 0) {
188
- return {
189
- ...state,
190
- toasts: []
191
- };
192
- }
193
- return {
194
- ...state,
195
- toasts: state.toasts.filter((t) => t.id !== action.toastId)
196
- };
197
- }
198
- }
199
- };
200
- var listeners = [];
201
- var memoryState = { toasts: [] };
202
- function dispatch(action) {
203
- memoryState = reducer(memoryState, action);
204
- listeners.forEach((listener) => {
205
- listener(memoryState);
206
- });
207
- }
208
- function toast({ duration = 2e3, ...props }) {
209
- const id = genId();
210
- const update = (props2) => dispatch({
211
- type: "UPDATE_TOAST",
212
- toast: { ...props2, id }
213
- });
214
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
215
- dispatch({
216
- type: "ADD_TOAST",
217
- toast: {
218
- ...props,
219
- id,
220
- open: true,
221
- duration,
222
- onOpenChange: (open) => {
223
- if (!open) dismiss();
224
- }
225
- }
226
- });
227
- return {
228
- id,
229
- dismiss,
230
- update
231
- };
232
- }
233
- function useToast() {
234
- const [state, setState] = React7.useState(memoryState);
235
- React7.useEffect(() => {
236
- listeners.push(setState);
237
- return () => {
238
- const index = listeners.indexOf(setState);
239
- if (index > -1) {
240
- listeners.splice(index, 1);
241
- }
242
- };
243
- }, [state]);
244
- return {
245
- ...state,
246
- toast,
247
- dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
248
- };
249
- }
250
-
251
130
  // packages/hooks/useUnmount.ts
252
- import React8 from "react";
131
+ import React7 from "react";
253
132
  var useUnmount = (callback) => {
254
- const functionReference = React8.useRef(callback);
133
+ const functionReference = React7.useRef(callback);
255
134
  functionReference.current = callback;
256
- React8.useEffect(
135
+ React7.useEffect(
257
136
  () => () => {
258
137
  functionReference.current();
259
138
  },
@@ -262,8 +141,6 @@ var useUnmount = (callback) => {
262
141
  };
263
142
  var useUnmount_default = useUnmount;
264
143
  export {
265
- reducer,
266
- toast,
267
144
  useBoolean_default as useBoolean,
268
145
  useClickAnyWhere_default as useClickAnyWhere,
269
146
  useCopyToClipboard_default as useCopyToClipboard,
@@ -273,6 +150,5 @@ export {
273
150
  useIsomorphicLayoutEffect_default as useIsomorphicLayoutEffect,
274
151
  useOnClickOutside_default as useOnClickOutside,
275
152
  useTimeout_default as useTimeout,
276
- useToast,
277
153
  useUnmount_default as useUnmount
278
154
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@customafk/lunas-ui",
3
3
  "private": false,
4
- "version": "0.0.2-g",
4
+ "version": "0.0.2-h",
5
5
  "type": "module",
6
6
  "homepage": "https://docs.customafk.com",
7
7
  "repository": {
@@ -308,7 +308,6 @@
308
308
  "@radix-ui/react-slider": "^1.2.1",
309
309
  "@radix-ui/react-slot": "^1.1.0",
310
310
  "@radix-ui/react-switch": "^1.1.1",
311
- "@radix-ui/react-toast": "^1.2.1",
312
311
  "class-variance-authority": "^0.7.0",
313
312
  "clsx": "^2.1.1",
314
313
  "cmdk": "^1.0.0",