@putkoff/abstract-utilities 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.
- package/dist/cjs/functions/fetch_utils/fetchIt_utils.d.ts +14 -0
- package/dist/cjs/functions/fetch_utils/index.d.ts +1 -1
- package/dist/cjs/functions/fetch_utils/src/index.d.ts +1 -1
- package/dist/cjs/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/cjs/index.js +18 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/functions/fetch_utils/fetchIt_utils.d.ts +14 -0
- package/dist/esm/functions/fetch_utils/index.d.ts +1 -1
- package/dist/esm/functions/fetch_utils/src/index.d.ts +1 -1
- package/dist/esm/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/esm/index.js +18 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/fetch_utils/fetchIt_utils.d.ts +14 -0
- package/dist/functions/fetch_utils/index.d.ts +1 -1
- package/dist/functions/fetch_utils/src/index.d.ts +1 -1
- package/dist/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
***Changes**: None, as it’s self-contained and doesn’t rely on external imports.
|
|
4
|
+
*
|
|
5
|
+
*4. **secureFetchIt** (`src/functions/fetch/secureFetchIt.ts`):
|
|
6
|
+
* Since `secureFetchIt` isn’t provided, we’ll create a minimal implementation based on its usage in `Login` and `uploadFiles`. It’s assumed to be a wrapper around `fetch` that handles authentication and JSON parsing.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
/** Pulls base-URL from AppConfig.API_BASE_URL, strips trailing slashes */
|
|
10
|
+
export declare function fetchIt(endpoint: string, body?: unknown, method?: string | null, headers?: Record<string, string> | null, blob?: boolean | null, no_api?: boolean, requireAuth?: boolean): Promise<unknown>;
|
|
11
|
+
export declare function secureFetchIt<T>(endpoint: string, body?: unknown, method?: string, headers?: Record<string, string> | null, blob?: false, noApi?: boolean, requireAuth?: boolean): Promise<T>;
|
|
12
|
+
export declare function secureFetchIt(endpoint: string, body?: unknown, method?: string, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean): Promise<Blob>;
|
|
13
|
+
export declare function requestPatch(url: string, body?: unknown): Promise<Response>;
|
|
14
|
+
export declare function fetchSharePatch(file: unknown): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './fetchIt_utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './utils';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function Button({ children, color, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1
|
+
export declare function Button({ children, color, variant, className, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
2
|
color?: 'gray' | 'green' | 'blue';
|
|
3
|
+
variant?: 'default' | 'icon' | 'primary' | 'secondary';
|
|
4
|
+
className?: string;
|
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1535,10 +1535,24 @@ function get_window_parts() {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
1537
|
function Button(_a) {
|
|
1538
|
-
var { children, color = 'gray' } = _a, rest = __rest(_a, ["children", "color"]);
|
|
1539
|
-
const base = 'rounded px-3 py-1 text-sm';
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1538
|
+
var { children, color = 'gray', variant = 'default', className = '' } = _a, rest = __rest(_a, ["children", "color", "variant", "className"]);
|
|
1539
|
+
const base = 'rounded px-3 py-1 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-150';
|
|
1540
|
+
const variantStyles = {
|
|
1541
|
+
default: '',
|
|
1542
|
+
icon: 'p-1 bg-transparent hover:bg-gray-100',
|
|
1543
|
+
primary: 'text-white',
|
|
1544
|
+
secondary: '',
|
|
1545
|
+
};
|
|
1546
|
+
const palette = {
|
|
1547
|
+
gray: variant === 'primary'
|
|
1548
|
+
? 'bg-gray-600 hover:bg-gray-700 focus:ring-gray-500'
|
|
1549
|
+
: 'bg-gray-200 hover:bg-gray-300 focus:ring-gray-400',
|
|
1550
|
+
green: 'bg-green-600 text-white hover:bg-green-700 focus:ring-green-500',
|
|
1551
|
+
blue: variant === 'primary'
|
|
1552
|
+
? 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500'
|
|
1553
|
+
: 'bg-blue-200 hover:bg-blue-300 focus:ring-blue-400',
|
|
1554
|
+
};
|
|
1555
|
+
return (jsxRuntime.jsx("button", Object.assign({ className: `${base} ${variantStyles[variant]} ${palette[color]} ${className}` }, rest, { children: children })));
|
|
1542
1556
|
}
|
|
1543
1557
|
|
|
1544
1558
|
function Checkbox(_a) {
|