@bbodek/utils 0.0.3 → 0.0.5

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 (44) hide show
  1. package/dist/executeFunction/executeFunction.d.ts +1 -1
  2. package/dist/executeFunction/executeFunction.d.ts.map +1 -1
  3. package/dist/executeFunction/types/index.d.ts +1 -1
  4. package/dist/executeFunction/types/index.d.ts.map +1 -1
  5. package/dist/extractExt/extractExt.d.ts +3 -0
  6. package/dist/extractExt/extractExt.d.ts.map +1 -0
  7. package/dist/extractExt/index.d.ts +2 -0
  8. package/dist/extractExt/index.d.ts.map +1 -0
  9. package/dist/getUUID/getUUID.d.ts +2 -0
  10. package/dist/getUUID/getUUID.d.ts.map +1 -0
  11. package/dist/getUUID/index.d.ts +2 -0
  12. package/dist/getUUID/index.d.ts.map +1 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.es.js +1 -1
  16. package/dist/parseExt/index.d.ts +2 -0
  17. package/dist/parseExt/index.d.ts.map +1 -0
  18. package/dist/parseExt/parseExt.d.ts +6 -0
  19. package/dist/parseExt/parseExt.d.ts.map +1 -0
  20. package/dist/removeExt/index.d.ts +2 -0
  21. package/dist/removeExt/index.d.ts.map +1 -0
  22. package/dist/removeExt/removeExt.d.ts +3 -0
  23. package/dist/removeExt/removeExt.d.ts.map +1 -0
  24. package/dist/shared/constants/ext.d.ts +12 -0
  25. package/dist/shared/constants/ext.d.ts.map +1 -0
  26. package/dist/shared/constants/index.d.ts +2 -0
  27. package/dist/shared/constants/index.d.ts.map +1 -0
  28. package/dist/shared/index.d.ts +3 -0
  29. package/dist/shared/index.d.ts.map +1 -0
  30. package/dist/shared/types/Ext.d.ts +7 -0
  31. package/dist/shared/types/Ext.d.ts.map +1 -0
  32. package/dist/shared/types/index.d.ts +2 -0
  33. package/dist/shared/types/index.d.ts.map +1 -0
  34. package/dist/toast/components/Toaster.d.ts +3 -0
  35. package/dist/toast/components/Toaster.d.ts.map +1 -0
  36. package/dist/toast/components/index.d.ts +2 -0
  37. package/dist/toast/components/index.d.ts.map +1 -0
  38. package/dist/toast/index.d.ts +4 -0
  39. package/dist/toast/index.d.ts.map +1 -0
  40. package/dist/toast/toast.d.ts +9 -0
  41. package/dist/toast/toast.d.ts.map +1 -0
  42. package/dist/toast/types/index.d.ts +7 -0
  43. package/dist/toast/types/index.d.ts.map +1 -0
  44. package/package.json +7 -4
@@ -1,3 +1,3 @@
1
1
  import { ExecuteFunction } from '../executeFunction/types';
2
- export declare const executeFunction: <T extends () => void>({ disabled, fn, }: ExecuteFunction<T>) => void;
2
+ export declare const executeFunction: <T>({ disabled, fn, }: ExecuteFunction<T>) => T | undefined;
3
3
  //# sourceMappingURL=executeFunction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeFunction.d.ts","sourceRoot":"","sources":["../../src/executeFunction/executeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,IAAI,EAAE,mBAGnD,eAAe,CAAC,CAAC,CAAC,SAEpB,CAAC"}
1
+ {"version":3,"file":"executeFunction.d.ts","sourceRoot":"","sources":["../../src/executeFunction/executeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,mBAGhC,eAAe,CAAC,CAAC,CAAC,kBAEpB,CAAC"}
@@ -1,4 +1,4 @@
1
- export interface ExecuteFunction<T extends () => void> {
1
+ export interface ExecuteFunction<T> {
2
2
  disabled?: boolean;
3
3
  fn: T;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/executeFunction/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,CAAC,CAAC;CACP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/executeFunction/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,CAAC,CAAC;CACP"}
@@ -0,0 +1,3 @@
1
+ import { ExtFnProps } from '../shared/types/Ext';
2
+ export declare const extractExt: ({ accept, str }: ExtFnProps) => string;
3
+ //# sourceMappingURL=extractExt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractExt.d.ts","sourceRoot":"","sources":["../../src/extractExt/extractExt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,GAAI,iBAAgC,UAAU,WAIlE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './extractExt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractExt/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const getUUID: () => `${string}-${string}-${string}-${string}-${string}`;
2
+ //# sourceMappingURL=getUUID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUUID.d.ts","sourceRoot":"","sources":["../../src/getUUID/getUUID.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,2DAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './getUUID';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/getUUID/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  export * from './composeEventHandler';
2
2
  export * from './executeFunction';
3
+ export * from './extractExt';
4
+ export * from './getUUID';
3
5
  export * from './highlightText';
4
6
  export * from './isServer';
5
7
  export * from './mergeRefs';
8
+ export * from './parseExt';
9
+ export * from './removeExt';
10
+ export * from './toast';
11
+ export { ACCEPT_FILE_EXT, ACCEPT_FILES } from './shared';
12
+ export type { ExtFnProps } from './shared';
6
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";const t=({internalEventHandler:e,externalEventHandler:t})=>(n,...r)=>{n.stopPropagation(),e(n,...r),t&&t(n,...r)},n=({disabled:e=!1,fn:t})=>e?void 0:t(),r=({text:t,targetText:n})=>{if(""===n||""===t)return t;const r=new RegExp(`(${n})`,"gi");return t.split(r).map(((t,r)=>t.toLowerCase()===n.toLowerCase()?e("span",{className:"text-in-primary-06",children:t},r):t))},o=()=>"undefined"==typeof window,a=(...e)=>t=>{e.forEach((e=>{"function"==typeof e?e(t):e&&(e.current=t)}))};export{t as composeEventHandler,n as executeFunction,r as highlightText,o as isServer,a as mergeRefs};
1
+ import{jsx as e}from"react/jsx-runtime";import t,{Toaster as r}from"react-hot-toast";import{TOAST_TYPES as o,Toast as n}from"@bbodek/internal-ui";const s=({internalEventHandler:e,externalEventHandler:t})=>(r,...o)=>{r.stopPropagation(),e(r,...o),t&&t(r,...o)},i=({disabled:e=!1,fn:t})=>e?void 0:t,a={PNG:"png",JPEG:"jpeg",HEIC:"heic",WEBP:"webp",PDF:"pdf",XLSX:"xlsx",DOCX:"docx",JPG:"jpg"},c=Object.values(a),p=({accept:e=c,str:t})=>e.reduce(((e,r)=>t.toLowerCase().endsWith(r)?r:e),""),d=()=>self.crypto.randomUUID(),l=({text:t,targetText:r})=>{if(""===r||""===t)return t;const o=new RegExp(`(${r})`,"gi");return t.split(o).map(((t,o)=>t.toLowerCase()===r.toLowerCase()?e("span",{className:"text-in-primary-06",children:t},o):t))},u=()=>"undefined"==typeof window,m=(...e)=>t=>{e.forEach((e=>{"function"==typeof e?e(t):e&&(e.current=t)}))},f=({accept:e=c,str:t})=>e.reduce(((e,t)=>e.endsWith(t)?e.replace(t,""):e),t.toLowerCase()),x=({accept:e=c,str:t})=>{const r={removedExt:"",ext:""};return t?e.reduce(((e,r)=>t.toLowerCase().endsWith(r)?{removedExt:f({str:t}),ext:p({str:t})}:e),r):r},C=()=>e(r,{containerStyle:{top:24,left:24,bottom:24,right:24}}),E=({useClose:r,duration:o=3e3,onClose:s,...i})=>t.custom((o=>e(n,{visible:o.visible,useClose:r,onClose:()=>(({id:e})=>{r&&(t.dismiss(e),s?.())})({id:o.id}),...i})),{position:"top-center",duration:o,ariaProps:{role:"alert","aria-live":"assertive"}}),v={info:(e,t)=>E({type:o.INFO,content:e,...t}),success:(e,t)=>E({type:o.SUCCESS,content:e,...t}),warning:(e,t)=>E({type:o.WARNING,content:e,...t}),error:(e,t)=>E({type:o.ERROR,content:e,...t})};export{c as ACCEPT_FILES,a as ACCEPT_FILE_EXT,C as Toaster,s as composeEventHandler,i as executeFunction,p as extractExt,d as getUUID,l as highlightText,u as isServer,m as mergeRefs,x as parseExt,f as removeExt,v as toast};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -0,0 +1,2 @@
1
+ export * from './parseExt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parseExt/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ExtFnProps } from '../shared';
2
+ export declare const parseExt: ({ accept, str }: ExtFnProps) => {
3
+ removedExt: string;
4
+ ext: string;
5
+ };
6
+ //# sourceMappingURL=parseExt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseExt.d.ts","sourceRoot":"","sources":["../../src/parseExt/parseExt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpD,eAAO,MAAM,QAAQ,GAAI,iBAAgC,UAAU;;;CAkBlE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './removeExt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/removeExt/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ExtFnProps } from '../shared';
2
+ export declare const removeExt: ({ accept, str }: ExtFnProps) => string;
3
+ //# sourceMappingURL=removeExt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeExt.d.ts","sourceRoot":"","sources":["../../src/removeExt/removeExt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpD,eAAO,MAAM,SAAS,GAAI,iBAAgC,UAAU,WAIjE,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const ACCEPT_FILE_EXT: {
2
+ readonly PNG: "png";
3
+ readonly JPEG: "jpeg";
4
+ readonly HEIC: "heic";
5
+ readonly WEBP: "webp";
6
+ readonly PDF: "pdf";
7
+ readonly XLSX: "xlsx";
8
+ readonly DOCX: "docx";
9
+ readonly JPG: "jpg";
10
+ };
11
+ export declare const ACCEPT_FILES: ("png" | "jpeg" | "heic" | "webp" | "pdf" | "xlsx" | "docx" | "jpg")[];
12
+ //# sourceMappingURL=ext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ext.d.ts","sourceRoot":"","sources":["../../../src/shared/constants/ext.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX,eAAO,MAAM,YAAY,wEAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './ext';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ACCEPT_FILE_EXT } from '../../shared/constants/ext';
2
+ export type AcceptFileExt = (typeof ACCEPT_FILE_EXT)[keyof typeof ACCEPT_FILE_EXT];
3
+ export interface ExtFnProps {
4
+ str: string;
5
+ accept?: AcceptFileExt[];
6
+ }
7
+ //# sourceMappingURL=Ext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ext.d.ts","sourceRoot":"","sources":["../../../src/shared/types/Ext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,aAAa,GACvB,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export * from './Ext';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const Toaster: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Toaster;
3
+ //# sourceMappingURL=Toaster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/toast/components/Toaster.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,+CAMZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as Toaster } from './Toaster';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toast/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './components';
2
+ export * from './toast';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ToastProps } from '@bbodek/internal-ui';
2
+ import { ToastOption } from '../toast/types';
3
+ export declare const toast: {
4
+ info: (content: ToastProps["content"], option?: ToastOption) => string;
5
+ success: (content: ToastProps["content"], option?: ToastOption) => string;
6
+ warning: (content: ToastProps["content"], option?: ToastOption) => string;
7
+ error: (content: ToastProps["content"], option?: ToastOption) => string;
8
+ };
9
+ //# sourceMappingURL=toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/toast/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGrE,OAAO,EAAqB,WAAW,EAAE,MAAM,eAAe,CAAC;AA+C/D,eAAO,MAAM,KAAK;oBAZK,UAAU,CAAC,SAAS,CAAC,WAAW,WAAW;uBAGxC,UAAU,CAAC,SAAS,CAAC,WAAW,WAAW;uBAG3C,UAAU,CAAC,SAAS,CAAC,WAAW,WAAW;qBAG7C,UAAU,CAAC,SAAS,CAAC,WAAW,WAAW;CAQlE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ToastProps } from '@bbodek/internal-ui';
2
+ import { ToastOptions } from 'react-hot-toast';
3
+ export interface CreateToastOption extends Omit<ToastProps, 'visible' | 'onClose'>, Partial<Pick<ToastProps, 'onClose'>>, Pick<ToastOptions, 'duration'> {
4
+ }
5
+ export interface ToastOption extends Omit<CreateToastOption, 'type' | 'content'> {
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toast/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC,EAC7C,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,EACpC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;CAAG;AAErC,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbodek/utils",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "scripts": {
16
- "dev": "next dev",
16
+ "dev": "rollup -c --watch & tsc -p tsconfig.build.json --watch & tsc-alias -p tsconfig.build.json --watch",
17
17
  "build": "rollup -c && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
18
18
  "start": "next start",
19
19
  "lint": "next lint"
@@ -21,12 +21,15 @@
21
21
  "dependencies": {
22
22
  "next": "^15.3.1",
23
23
  "react": "^19.1.0",
24
- "react-dom": "^19.1.0"
24
+ "react-dom": "^19.1.0",
25
+ "react-hot-toast": "^2.5.2"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "next": "^15.3.1",
28
29
  "react": "^19.1.0",
29
- "react-dom": "^19.1.0"
30
+ "react-dom": "^19.1.0",
31
+ "react-hot-toast": "^2.5.2",
32
+ "@bbodek/internal-ui": "^0.0.31"
30
33
  },
31
34
  "devDependencies": {
32
35
  "@dotoli/eslint-config": "workspace:*",