@skybin-tech/nebula-ui 0.0.19 → 0.0.21
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.
- package/dist/cjs/components/Alert/Alert.cjs +1 -0
- package/dist/cjs/components/Alert/Alert.cjs.map +1 -1
- package/dist/cjs/components/Avatar/Avatar.cjs +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/Badge/Badge.cjs +1 -0
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs +1 -0
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.cjs +1 -0
- package/dist/cjs/components/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
- package/dist/cjs/components/Form/Checkbox.cjs +1 -0
- package/dist/cjs/components/Form/Checkbox.cjs.map +1 -1
- package/dist/cjs/components/Form/Form.cjs +1 -0
- package/dist/cjs/components/Form/Form.cjs.map +1 -1
- package/dist/cjs/components/Form/Radio.cjs +1 -0
- package/dist/cjs/components/Form/Radio.cjs.map +1 -1
- package/dist/cjs/components/Form/Select.cjs +1 -0
- package/dist/cjs/components/Form/Select.cjs.map +1 -1
- package/dist/cjs/components/Form/Switch.cjs +1 -0
- package/dist/cjs/components/Form/Switch.cjs.map +1 -1
- package/dist/cjs/components/Form/TextArea.cjs +1 -0
- package/dist/cjs/components/Form/TextArea.cjs.map +1 -1
- package/dist/cjs/components/Form/TextBox.cjs +1 -0
- package/dist/cjs/components/Form/TextBox.cjs.map +1 -1
- package/dist/cjs/components/Form/context.cjs +1 -0
- package/dist/cjs/components/Form/context.cjs.map +1 -1
- package/dist/cjs/components/Form/hooks.cjs +1 -0
- package/dist/cjs/components/Form/hooks.cjs.map +1 -1
- package/dist/cjs/components/Form/variants.cjs +1 -0
- package/dist/cjs/components/Form/variants.cjs.map +1 -1
- package/dist/cjs/components/Input/Input.cjs +1 -0
- package/dist/cjs/components/Input/Input.cjs.map +1 -1
- package/dist/cjs/components/Label/Label.cjs +1 -0
- package/dist/cjs/components/Label/Label.cjs.map +1 -1
- package/dist/cjs/components/Separator/Separator.cjs +1 -0
- package/dist/cjs/components/Separator/Separator.cjs.map +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/cjs/components/Textarea/Textarea.cjs +1 -0
- package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounce.cjs +1 -0
- package/dist/cjs/hooks/useDebounce.cjs.map +1 -1
- package/dist/cjs/hooks/useToast.cjs +1 -0
- package/dist/cjs/hooks/useToast.cjs.map +1 -1
- package/dist/cjs/hooks/useToggle.cjs +1 -0
- package/dist/cjs/hooks/useToggle.cjs.map +1 -1
- package/dist/components/Alert/Alert.js +1 -0
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Avatar/Avatar.js +1 -0
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Button/Button.js +1 -0
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Card/Card.js +1 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/Form/Checkbox.d.ts.map +1 -1
- package/dist/components/Form/Checkbox.js +1 -0
- package/dist/components/Form/Checkbox.js.map +1 -1
- package/dist/components/Form/Form.d.ts.map +1 -1
- package/dist/components/Form/Form.js +1 -0
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/Radio.d.ts.map +1 -1
- package/dist/components/Form/Radio.js +1 -0
- package/dist/components/Form/Radio.js.map +1 -1
- package/dist/components/Form/Select.d.ts.map +1 -1
- package/dist/components/Form/Select.js +1 -0
- package/dist/components/Form/Select.js.map +1 -1
- package/dist/components/Form/Switch.d.ts.map +1 -1
- package/dist/components/Form/Switch.js +1 -0
- package/dist/components/Form/Switch.js.map +1 -1
- package/dist/components/Form/TextArea.d.ts.map +1 -1
- package/dist/components/Form/TextArea.js +1 -0
- package/dist/components/Form/TextArea.js.map +1 -1
- package/dist/components/Form/TextBox.d.ts.map +1 -1
- package/dist/components/Form/TextBox.js +1 -0
- package/dist/components/Form/TextBox.js.map +1 -1
- package/dist/components/Form/context.d.ts.map +1 -1
- package/dist/components/Form/context.js +1 -0
- package/dist/components/Form/context.js.map +1 -1
- package/dist/components/Form/hooks.d.ts.map +1 -1
- package/dist/components/Form/hooks.js +1 -0
- package/dist/components/Form/hooks.js.map +1 -1
- package/dist/components/Form/variants.js +1 -0
- package/dist/components/Form/variants.js.map +1 -1
- package/dist/components/Input/Input.js +1 -0
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Label/Label.js +1 -0
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Separator/Separator.js +1 -0
- package/dist/components/Separator/Separator.js.map +1 -1
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Textarea/Textarea.js +1 -0
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/hooks/useDebounce.d.ts.map +1 -1
- package/dist/hooks/useDebounce.js +1 -0
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +1 -0
- package/dist/hooks/useToast.js.map +1 -1
- package/dist/hooks/useToggle.d.ts.map +1 -1
- package/dist/hooks/useToggle.js +1 -0
- package/dist/hooks/useToggle.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Input as InputPrimitive } from \"../../primitives/input\"\n\nexport type InputProps = ComponentPropsWithoutRef<typeof InputPrimitive>\n\nexport const Input = forwardRef<\n ElementRef<typeof InputPrimitive>,\n InputProps\n>((props, ref) => <InputPrimitive ref={ref} {...props} />)\nInput.displayName = \"Input\"\n"],"names":["InputPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Input as InputPrimitive } from \"../../primitives/input\"\n\nexport type InputProps = ComponentPropsWithoutRef<typeof InputPrimitive>\n\nexport const Input = forwardRef<\n ElementRef<typeof InputPrimitive>,\n InputProps\n>((props, ref) => <InputPrimitive ref={ref} {...props} />)\nInput.displayName = \"Input\"\n"],"names":["InputPrimitive"],"mappings":";;;;AAMO,MAAM,QAAQ,WAGnB,CAAC,OAAO,4BAASA,SAAA,EAAe,KAAW,GAAG,OAAO,CAAE;AACzD,MAAM,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Label as LabelPrimitive } from \"../../primitives/label\"\n\nexport type LabelProps = ComponentPropsWithoutRef<typeof LabelPrimitive>\n\nexport const Label = forwardRef<\n ElementRef<typeof LabelPrimitive>,\n LabelProps\n>((props, ref) => <LabelPrimitive ref={ref} {...props} />)\nLabel.displayName = \"Label\"\n"],"names":["LabelPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Label as LabelPrimitive } from \"../../primitives/label\"\n\nexport type LabelProps = ComponentPropsWithoutRef<typeof LabelPrimitive>\n\nexport const Label = forwardRef<\n ElementRef<typeof LabelPrimitive>,\n LabelProps\n>((props, ref) => <LabelPrimitive ref={ref} {...props} />)\nLabel.displayName = \"Label\"\n"],"names":["LabelPrimitive"],"mappings":";;;;AAMO,MAAM,QAAQ,WAGnB,CAAC,OAAO,4BAASA,SAAA,EAAe,KAAW,GAAG,OAAO,CAAE;AACzD,MAAM,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.js","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Separator as SeparatorPrimitive } from \"../../primitives/separator\"\n\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive>\n>((props, ref) => <SeparatorPrimitive ref={ref} {...props} />)\nSeparator.displayName = \"Separator\"\n"],"names":["SeparatorPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Separator.js","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Separator as SeparatorPrimitive } from \"../../primitives/separator\"\n\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive>\n>((props, ref) => <SeparatorPrimitive ref={ref} {...props} />)\nSeparator.displayName = \"Separator\"\n"],"names":["SeparatorPrimitive"],"mappings":";;;;AAIO,MAAM,YAAY,WAGvB,CAAC,OAAO,4BAASA,aAAA,EAAmB,KAAW,GAAG,OAAO,CAAE;AAC7D,UAAU,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Tabs as TabsPrimitive,\n TabsList as TabsListPrimitive,\n TabsTrigger as TabsTriggerPrimitive,\n TabsContent as TabsContentPrimitive,\n} from \"../../primitives/tabs\"\n\nexport const Tabs = forwardRef<\n ElementRef<typeof TabsPrimitive>,\n ComponentPropsWithoutRef<typeof TabsPrimitive>\n>((props, ref) => <TabsPrimitive ref={ref} {...props} />)\nTabs.displayName = \"Tabs\"\n\nexport const TabsList = forwardRef<\n ElementRef<typeof TabsListPrimitive>,\n ComponentPropsWithoutRef<typeof TabsListPrimitive>\n>((props, ref) => <TabsListPrimitive ref={ref} {...props} />)\nTabsList.displayName = \"TabsList\"\n\nexport const TabsTrigger = forwardRef<\n ElementRef<typeof TabsTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof TabsTriggerPrimitive>\n>((props, ref) => <TabsTriggerPrimitive ref={ref} {...props} />)\nTabsTrigger.displayName = \"TabsTrigger\"\n\nexport const TabsContent = forwardRef<\n ElementRef<typeof TabsContentPrimitive>,\n ComponentPropsWithoutRef<typeof TabsContentPrimitive>\n>((props, ref) => <TabsContentPrimitive ref={ref} {...props} />)\nTabsContent.displayName = \"TabsContent\"\n"],"names":["TabsPrimitive","TabsListPrimitive","TabsTriggerPrimitive","TabsContentPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Tabs as TabsPrimitive,\n TabsList as TabsListPrimitive,\n TabsTrigger as TabsTriggerPrimitive,\n TabsContent as TabsContentPrimitive,\n} from \"../../primitives/tabs\"\n\nexport const Tabs = forwardRef<\n ElementRef<typeof TabsPrimitive>,\n ComponentPropsWithoutRef<typeof TabsPrimitive>\n>((props, ref) => <TabsPrimitive ref={ref} {...props} />)\nTabs.displayName = \"Tabs\"\n\nexport const TabsList = forwardRef<\n ElementRef<typeof TabsListPrimitive>,\n ComponentPropsWithoutRef<typeof TabsListPrimitive>\n>((props, ref) => <TabsListPrimitive ref={ref} {...props} />)\nTabsList.displayName = \"TabsList\"\n\nexport const TabsTrigger = forwardRef<\n ElementRef<typeof TabsTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof TabsTriggerPrimitive>\n>((props, ref) => <TabsTriggerPrimitive ref={ref} {...props} />)\nTabsTrigger.displayName = \"TabsTrigger\"\n\nexport const TabsContent = forwardRef<\n ElementRef<typeof TabsContentPrimitive>,\n ComponentPropsWithoutRef<typeof TabsContentPrimitive>\n>((props, ref) => <TabsContentPrimitive ref={ref} {...props} />)\nTabsContent.displayName = \"TabsContent\"\n"],"names":["TabsPrimitive","TabsListPrimitive","TabsTriggerPrimitive","TabsContentPrimitive"],"mappings":";;;;AASO,MAAM,OAAO,WAGlB,CAAC,OAAO,4BAASA,QAAA,EAAc,KAAW,GAAG,OAAO,CAAE;AACxD,KAAK,cAAc;AAEZ,MAAM,WAAW,WAGtB,CAAC,OAAO,4BAASC,YAAA,EAAkB,KAAW,GAAG,OAAO,CAAE;AAC5D,SAAS,cAAc;AAEhB,MAAM,cAAc,WAGzB,CAAC,OAAO,4BAASC,eAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;AAEnB,MAAM,cAAc,WAGzB,CAAC,OAAO,4BAASC,eAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sources":["../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Textarea as TextareaPrimitive } from \"../../primitives/textarea\"\n\nexport type TextareaProps = ComponentPropsWithoutRef<typeof TextareaPrimitive>\n\nexport const Textarea = forwardRef<\n ElementRef<typeof TextareaPrimitive>,\n TextareaProps\n>((props, ref) => <TextareaPrimitive ref={ref} {...props} />)\nTextarea.displayName = \"Textarea\"\n"],"names":["TextareaPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Textarea as TextareaPrimitive } from \"../../primitives/textarea\"\n\nexport type TextareaProps = ComponentPropsWithoutRef<typeof TextareaPrimitive>\n\nexport const Textarea = forwardRef<\n ElementRef<typeof TextareaPrimitive>,\n TextareaProps\n>((props, ref) => <TextareaPrimitive ref={ref} {...props} />)\nTextarea.displayName = \"Textarea\"\n"],"names":["TextareaPrimitive"],"mappings":";;;;AAMO,MAAM,WAAW,WAGtB,CAAC,OAAO,4BAASA,YAAA,EAAkB,KAAW,GAAG,OAAO,CAAE;AAC5D,SAAS,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,SAAM,GAAG,CAAC,CAcvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounce.js","sources":["../../src/hooks/useDebounce.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useDebounce.js","sources":["../../src/hooks/useDebounce.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * A hook that debounces a value by a specified delay\r\n * @param value - The value to debounce\r\n * @param delay - The delay in milliseconds (default: 500)\r\n * @returns The debounced value\r\n */\r\nexport function useDebounce<T>(value: T, delay = 500): T {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n clearTimeout(timer);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n"],"names":[],"mappings":";;AAUO,SAAS,YAAe,OAAU,QAAQ,KAAQ;AACvD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAY,KAAK;AAE7D,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAER,WAAO,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/hooks/useToast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/hooks/useToast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAKzE,KAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,QAAA,MAAM,WAAW;;;;;CAKP,CAAA;AAQV,KAAK,UAAU,GAAG,OAAO,WAAW,CAAA;AACpC,KAAK,MAAM,GACP;IAAE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAAE,CAAA;AAEtE,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAaD,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAoBtD,CAAA;AAUD,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAET,YAAY;EAcpC;AAED,iBAAS,QAAQ;;wBAcO,MAAM;YA9EpB,YAAY,EAAE;EAgFvB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
|
package/dist/hooks/useToast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.js","sources":["../../src/hooks/useToast.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useToast.js","sources":["../../src/hooks/useToast.ts"],"sourcesContent":["'use client';\n\nimport * as React from \"react\"\nimport type { ToastActionElement, ToastProps } from \"../primitives/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const\n\nlet count = 0\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\ntype Action =\n | { type: ActionType[\"ADD_TOAST\"]; toast: ToasterToast }\n | { type: ActionType[\"UPDATE_TOAST\"]; toast: Partial<ToasterToast> }\n | { type: ActionType[\"DISMISS_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n | { type: ActionType[\"REMOVE_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) return\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({ type: \"REMOVE_TOAST\", toastId })\n }, TOAST_REMOVE_DELAY)\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) }\n case \"UPDATE_TOAST\":\n return { ...state, toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t) }\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((t) => addToRemoveQueue(t.id))\n }\n return { ...state, toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined ? { ...t, open: false } : t) }\n }\n case \"REMOVE_TOAST\":\n return action.toastId === undefined\n ? { ...state, toasts: [] }\n : { ...state, toasts: state.toasts.filter((t) => t.id !== action.toastId) }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((l) => l(memoryState))\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n const update = (props: ToasterToast) => dispatch({ type: \"UPDATE_TOAST\", toast: { ...props, id } })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => { if (!open) dismiss() },\n },\n })\n\n return { id, dismiss, update }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) listeners.splice(index, 1)\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n }\n}\n\nexport { useToast, toast }\n"],"names":["props"],"mappings":";;AAKA,MAAM,cAAc;AACpB,MAAM,qBAAqB;AAgB3B,IAAI,QAAQ;AACZ,SAAS,QAAQ;AACf,WAAS,QAAQ,KAAK,OAAO;AAC7B,SAAO,MAAM,SAAA;AACf;AAaA,MAAM,oCAAoB,IAAA;AAE1B,MAAM,mBAAmB,CAAC,YAAoB;AAC5C,MAAI,cAAc,IAAI,OAAO,EAAG;AAChC,QAAM,UAAU,WAAW,MAAM;AAC/B,kBAAc,OAAO,OAAO;AAC5B,aAAS,EAAE,MAAM,gBAAgB,QAAA,CAAS;AAAA,EAC5C,GAAG,kBAAkB;AACrB,gBAAc,IAAI,SAAS,OAAO;AACpC;AAEO,MAAM,UAAU,CAAC,OAAc,WAA0B;AAC9D,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,QAAQ,CAAC,OAAO,OAAO,GAAG,MAAM,MAAM,EAAE,MAAM,GAAG,WAAW,EAAA;AAAA,IACjF,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,QAAQ,MAAM,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,OAAO,MAAM,KAAK,EAAE,GAAG,GAAG,GAAG,OAAO,UAAU,CAAC,EAAA;AAAA,IAC7G,KAAK,iBAAiB;AACpB,YAAM,EAAE,YAAY;AACpB,UAAI,SAAS;AACX,yBAAiB,OAAO;AAAA,MAC1B,OAAO;AACL,cAAM,OAAO,QAAQ,CAAC,MAAM,iBAAiB,EAAE,EAAE,CAAC;AAAA,MACpD;AACA,aAAO,EAAE,GAAG,OAAO,QAAQ,MAAM,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,WAAW,YAAY,SAAY,EAAE,GAAG,GAAG,MAAM,UAAU,CAAC,EAAA;AAAA,IAC1H;AAAA,IACA,KAAK;AACH,aAAO,OAAO,YAAY,SACtB,EAAE,GAAG,OAAO,QAAQ,GAAC,IACrB,EAAE,GAAG,OAAO,QAAQ,MAAM,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,OAAO,OAAO,EAAA;AAAA,EAAE;AAElF;AAEA,MAAM,YAA2C,CAAA;AACjD,IAAI,cAAqB,EAAE,QAAQ,GAAC;AAEpC,SAAS,SAAS,QAAgB;AAChC,gBAAc,QAAQ,aAAa,MAAM;AACzC,YAAU,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;AACzC;AAIA,SAAS,MAAM,EAAE,GAAG,SAAgB;AAClC,QAAM,KAAK,MAAA;AACX,QAAM,SAAS,CAACA,WAAwB,SAAS,EAAE,MAAM,gBAAgB,OAAO,EAAE,GAAGA,QAAO,GAAA,GAAM;AAClG,QAAM,UAAU,MAAM,SAAS,EAAE,MAAM,iBAAiB,SAAS,IAAI;AAErE,WAAS;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA,MAAM;AAAA,MACN,cAAc,CAAC,SAAS;AAAE,YAAI,CAAC,KAAM,SAAA;AAAA,MAAU;AAAA,IAAA;AAAA,EACjD,CACD;AAED,SAAO,EAAE,IAAI,SAAS,OAAA;AACxB;AAEA,SAAS,WAAW;AAClB,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAgB,WAAW;AAE3D,QAAM,UAAU,MAAM;AACpB,cAAU,KAAK,QAAQ;AACvB,WAAO,MAAM;AACX,YAAM,QAAQ,UAAU,QAAQ,QAAQ;AACxC,UAAI,QAAQ,GAAI,WAAU,OAAO,OAAO,CAAC;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,SAAS,CAAC,YAAqB,SAAS,EAAE,MAAM,iBAAiB,SAAS;AAAA,EAAA;AAE9E;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.d.ts","sourceRoot":"","sources":["../../src/hooks/useToggle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useToggle.d.ts","sourceRoot":"","sources":["../../src/hooks/useToggle.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,YAAY,UAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAQrE"}
|
package/dist/hooks/useToggle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.js","sources":["../../src/hooks/useToggle.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useToggle.js","sources":["../../src/hooks/useToggle.ts"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from \"react\";\r\n\r\n/**\r\n * A hook that returns a boolean state and a function to toggle it\r\n * @param initialValue - The initial value of the toggle (default: false)\r\n * @returns A tuple containing the current value and a toggle function\r\n */\r\nexport function useToggle(initialValue = false): [boolean, () => void] {\r\n const [value, setValue] = useState(initialValue);\r\n\r\n const toggle = useCallback(() => {\r\n setValue((prev) => !prev);\r\n }, []);\r\n\r\n return [value, toggle];\r\n}\r\n"],"names":[],"mappings":";;AASO,SAAS,UAAU,eAAe,OAA8B;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,YAAY;AAE/C,QAAM,SAAS,YAAY,MAAM;AAC/B,aAAS,CAAC,SAAS,CAAC,IAAI;AAAA,EAC1B,GAAG,CAAA,CAAE;AAEL,SAAO,CAAC,OAAO,MAAM;AACvB;"}
|
package/package.json
CHANGED