Skip to content

Commit

Permalink
fix: remove few deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nahoc committed Oct 23, 2024
1 parent 496f3f3 commit ef45575
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui

| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](https://img.shields.io/badge/statements-37.14%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.26%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-37.14%25-red.svg?style=flat) |
| ![Statements](https://img.shields.io/badge/statements-36.94%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.51%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-36.94%25-red.svg?style=flat) |
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@risc0/ui",
"version": "0.0.194",
"version": "0.0.196",
"private": false,
"sideEffects": false,
"type": "module",
Expand Down Expand Up @@ -35,15 +35,13 @@
"class-variance-authority": "0.7.1-canary.2",
"clsx": "2.1.1",
"cmdk": "1.0.0",
"deepmerge": "4.3.1",
"lucide-react": "0.453.0",
"next-themes": "0.3.0",
"p-safe": "1.0.0",
"radash": "12.1.0",
"react-hook-form": "7.52.2",
"recharts": "2.13.0",
"simplebar-react": "3.2.6",
"sonner": "1.5.0",
"string-ts": "2.2.0",
"tailwind-merge": "2.5.4",
"tailwindcss": "3.4.14",
"tailwindcss-animate": "1.0.7",
Expand All @@ -59,7 +57,6 @@
"@testing-library/react-hooks": "8.0.1",
"@vitejs/plugin-react-swc": "3.7.1",
"@vitest/coverage-v8": "2.0.5",
"deepmerge": "4.3.1",
"happy-dom": "15.7.4",
"istanbul-badges-readme": "1.9.0",
"npm-run-all": "4.1.5"
Expand Down
5 changes: 1 addition & 4 deletions tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import * as TabsPrimitive from "@radix-ui/react-tabs";
import { type ComponentPropsWithoutRef, type ElementRef, forwardRef } from "react";
import { cn } from "./cn";
import "simplebar-react/dist/simplebar.min.css";
import SimpleBar from "simplebar-react";

const Tabs = TabsPrimitive.Root;
const TabsOverflowWrapper = SimpleBar;

const TabsList = forwardRef<ElementRef<typeof TabsPrimitive.List>, ComponentPropsWithoutRef<typeof TabsPrimitive.List>>(
({ className, ...rest }, ref) => (
Expand Down Expand Up @@ -55,4 +52,4 @@ TabsList.displayName = TabsPrimitive.List.displayName;
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
TabsContent.displayName = TabsPrimitive.Content.displayName;

export { Tabs, TabsList, TabsTrigger, TabsContent, TabsOverflowWrapper };
export { Tabs, TabsList, TabsTrigger, TabsContent };
8 changes: 3 additions & 5 deletions utils/join-words.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { join, toLowerCase } from "string-ts";

const DONT_FORMAT_THESE_WORDS = [
"INSN",
"OS",
Expand All @@ -14,7 +12,7 @@ const DONT_FORMAT_THESE_WORDS = [
"BTC",
"AVAX",
];
const DONT_FORMAT_THESE_WORDS_LOWERCASE = DONT_FORMAT_THESE_WORDS.map(toLowerCase);
const DONT_FORMAT_THESE_WORDS_LOWERCASE = DONT_FORMAT_THESE_WORDS.map((word) => word.toLowerCase());

export function joinWords(str: string): string {
if (!str) {
Expand All @@ -26,7 +24,7 @@ export function joinWords(str: string): string {
const wordsList = formattedString.split(/[\s-_\/\\.,]/); // Remove spaces, hyphens, underscores, slashes, backslashes, dots, and commas

const formattedWords = wordsList.map((word) => {
const lowerCaseWord = toLowerCase(word);
const lowerCaseWord = word.toLowerCase();
const index = DONT_FORMAT_THESE_WORDS_LOWERCASE.indexOf(lowerCaseWord);

if (index !== -1) {
Expand All @@ -36,5 +34,5 @@ export function joinWords(str: string): string {
return word;
});

return join(formattedWords, " ");
return formattedWords.join(" ");
}
8 changes: 3 additions & 5 deletions utils/truncate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { slice } from "string-ts";

const MAX_LAST_CHUNK_LENGTH = 4;

export const truncate = (text: string, chars = 9): string => {
Expand All @@ -8,13 +6,13 @@ export const truncate = (text: string, chars = 9): string => {
}

if (chars < MAX_LAST_CHUNK_LENGTH * 2) {
const firstChunk = slice(text, 0, Math.max(0, Math.round(chars / 2)));
const lastChunk = slice(text, -Math.floor(chars / 2));
const firstChunk = text.slice(0, Math.max(0, Math.round(chars / 2)));
const lastChunk = text.slice(-Math.floor(chars / 2));

return `${firstChunk}${lastChunk}`;
}

const firstChunk = slice(text, 0, Math.max(0, chars - MAX_LAST_CHUNK_LENGTH));
const firstChunk = text.slice(0, Math.max(0, chars - MAX_LAST_CHUNK_LENGTH));
const lastChunk = text.substr(text.length - MAX_LAST_CHUNK_LENGTH, chars);

return `${firstChunk}${lastChunk}`;
Expand Down

0 comments on commit ef45575

Please sign in to comment.