@uxf/core 11.32.0 → 11.42.0

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/README.md CHANGED
@@ -52,6 +52,18 @@ import staticImage from "./path/to/static-image.png";
52
52
  <img src={resizerImageUrl(staticImage, width, height, params)}/>
53
53
  ```
54
54
 
55
+ ## QR code generator
56
+
57
+ Helper function for qr code generator.
58
+
59
+ https://gitlab.uxf.cz/uxf-internal-projects/qr#qr-code-generator
60
+
61
+ ```tsx
62
+ import { qrCodeUrl } from "@uxf/core/qr";
63
+
64
+ qrCodeUrl("https://www.uxf.cz", { width: 200, margin: 5, errorCorrectionLevel: "H" });
65
+ ```
66
+
55
67
  ## Cookie
56
68
 
57
69
  - Cookie options
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "@uxf/core",
3
- "version": "11.32.0",
4
- "description": "UXF Core",
5
- "author": "Petr Vejvoda <vejvoda@uxf.cz>",
6
- "homepage": "https://gitlab.com/uxf-npm/core#readme",
7
- "license": "ISC",
8
- "main": "index.js",
9
- "typings": "index.d.ts",
10
- "module": "index.js",
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://gitlab.com/uxf-npm/core.git"
17
- },
18
- "scripts": {
19
- "build": "tsc -P tsconfig.json",
20
- "typecheck": "tsc --noEmit --skipLibCheck"
21
- },
22
- "bugs": {
23
- "url": "https://gitlab.com/uxf-npm/core/issues"
24
- },
25
- "peerDependencies": {
26
- "react": ">=18.2.0"
27
- },
28
- "devDependencies": {
29
- "@types/react": "18.3.5",
30
- "react": "18.3.1"
31
- },
32
- "gitHead": "a2dee6aa67621f6eda17e63e88d0edf14f88455a"
33
- }
2
+ "name": "@uxf/core",
3
+ "version": "11.42.0",
4
+ "description": "UXF Core",
5
+ "author": "Petr Vejvoda <vejvoda@uxf.cz>",
6
+ "homepage": "https://gitlab.com/uxf-npm/core#readme",
7
+ "license": "ISC",
8
+ "main": "index.js",
9
+ "typings": "index.d.ts",
10
+ "module": "index.js",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://gitlab.com/uxf-npm/core.git"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc -P tsconfig.json",
20
+ "typecheck": "tsc --noEmit --skipLibCheck"
21
+ },
22
+ "bugs": {
23
+ "url": "https://gitlab.com/uxf-npm/core/issues"
24
+ },
25
+ "peerDependencies": {
26
+ "react": ">=18.2.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/react": "18.3.5",
30
+ "react": "18.3.1"
31
+ },
32
+ "gitHead": "a2dee6aa67621f6eda17e63e88d0edf14f88455a"
33
+ }
package/qr/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ interface Config {
2
+ width?: number;
3
+ errorCorrectionLevel?: "L" | "M" | "Q" | "H";
4
+ margin?: number;
5
+ }
6
+ export declare function qrCodeUrl(url: string, config?: Config): string;
7
+ export {};
package/qr/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.qrCodeUrl = qrCodeUrl;
4
+ const is_not_nil_1 = require("../utils/is-not-nil");
5
+ function qrCodeUrl(url, config) {
6
+ const params = (0, is_not_nil_1.isNotNil)(config) ? { url, config: btoa(JSON.stringify(config)) } : { url };
7
+ const query = new URLSearchParams(params).toString();
8
+ return `https://qr.uxf.cz/v1/qr.svg?${query}`;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("./index");
4
+ test("qrCodeUrl", () => {
5
+ expect((0, index_1.qrCodeUrl)("https://www.uxf.cz")).toBe("https://qr.uxf.cz/v1/qr.svg?url=https%3A%2F%2Fwww.uxf.cz");
6
+ expect((0, index_1.qrCodeUrl)("https://www.uxf.cz", { margin: 10, width: 200 })).toBe("https://qr.uxf.cz/v1/qr.svg?url=https%3A%2F%2Fwww.uxf.cz&config=eyJtYXJnaW4iOjEwLCJ3aWR0aCI6MjAwfQ%3D%3D");
7
+ });
@@ -0,0 +1 @@
1
+ export declare function capitalize(value: string): string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.capitalize = capitalize;
4
+ function capitalize(value) {
5
+ return value.charAt(0).toUpperCase() + value.slice(1);
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const capitalize_1 = require("./capitalize");
4
+ test("capitalize", () => {
5
+ expect((0, capitalize_1.capitalize)("some text")).toBe("Some text");
6
+ expect((0, capitalize_1.capitalize)("Already capitalized")).toBe("Already capitalized");
7
+ expect((0, capitalize_1.capitalize)(" space at start")).toBe(" space at start");
8
+ });