@uxf/core 11.93.0 → 11.97.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 +22 -0
- package/package.json +1 -1
- package/utils/cn.d.ts +1 -0
- package/utils/cn.js +6 -0
- package/utils/cn.test.d.ts +1 -0
- package/utils/cn.test.js +7 -0
- package/utils/human-index.d.ts +1 -0
- package/utils/human-index.js +9 -0
- package/utils/human-index.test.d.ts +1 -0
- package/utils/human-index.test.js +9 -0
package/README.md
CHANGED
|
@@ -171,6 +171,16 @@ import { capitalize } from "@uxf/core/utils/capitalize";
|
|
|
171
171
|
const example = capitalize("hello world"); /* returns "Hello world" */
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
## cn
|
|
175
|
+
|
|
176
|
+
A simple tag for template literals that returns the string as-is. Useful for tooling (e.g. Tailwind CSS IntelliSense) to recognize class strings.
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import { cn } from "@uxf/core/utils/cn";
|
|
180
|
+
|
|
181
|
+
const className = cn`flex items-center justify-center`;
|
|
182
|
+
```
|
|
183
|
+
|
|
174
184
|
## composeRefs
|
|
175
185
|
|
|
176
186
|
```tsx
|
|
@@ -277,6 +287,18 @@ escapeQuotes('The "quick" fox');
|
|
|
277
287
|
// Output: The \"quick\" fox
|
|
278
288
|
```
|
|
279
289
|
|
|
290
|
+
## humanIndex
|
|
291
|
+
|
|
292
|
+
Converts a 0-based index to a 1-based (human-readable) index.
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
import { humanIndex } from "@uxf/core/utils/human-index";
|
|
296
|
+
|
|
297
|
+
humanIndex(0); /* returns 1 */
|
|
298
|
+
humanIndex(9); /* returns 10 */
|
|
299
|
+
humanIndex(-1); /* throws error */
|
|
300
|
+
```
|
|
301
|
+
|
|
280
302
|
## filterNullish
|
|
281
303
|
|
|
282
304
|
```tsx
|
package/package.json
CHANGED
package/utils/cn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cn([className]: TemplateStringsArray): string;
|
package/utils/cn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/utils/cn.test.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function humanIndex(index: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const human_index_1 = require("./human-index");
|
|
4
|
+
test("human-index", () => {
|
|
5
|
+
expect((0, human_index_1.humanIndex)(0)).toBe(1);
|
|
6
|
+
expect((0, human_index_1.humanIndex)(1)).toBe(2);
|
|
7
|
+
expect((0, human_index_1.humanIndex)(9)).toBe(10);
|
|
8
|
+
expect(() => (0, human_index_1.humanIndex)(-1)).toThrow();
|
|
9
|
+
});
|