Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: packages build #23

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/jotai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xionwcfm/jotai",
"version": "0.1.5",
"version": "0.2.0",
"license": "MIT",
"scripts": {
"build": "tsup",
Expand All @@ -25,15 +25,16 @@
"publishConfig": {
"access": "public"
},
"files": ["dist"],
"files": [
"dist"
],
"devDependencies": {
"@testing-library/jest-dom": "catalog:",
"@testing-library/react": "catalog:",
"@testing-library/user-event": "catalog:",
"@vitejs/plugin-react": "catalog:",
"@types/node": "^20.14.9",
"@types/react": "catalog:react18",

"@xionwcfm/typescript-config": "workspace:*",
"happy-dom": "^14.12.0",
"jotai": "^2.9.3",
Expand Down
17 changes: 17 additions & 0 deletions packages/jotai/src/create-atom-hook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { atom } from "jotai";

Check warning on line 1 in packages/jotai/src/create-atom-hook.ts

View check run for this annotation

Codecov / codecov/patch

packages/jotai/src/create-atom-hook.ts#L1

Added line #L1 was not covered by tests
import { Atom, WritableAtom, useAtom, useAtomValue, useSetAtom, useStore } from "jotai";

export const createUseSetAtom = <Value, Args extends unknown[], Result>(
atom: WritableAtom<Value, Args, Result>,
options?: Parameters<typeof useStore>[0],
) => {
return () => useSetAtom(atom, options);
};

Check warning on line 9 in packages/jotai/src/create-atom-hook.ts

View check run for this annotation

Codecov / codecov/patch

packages/jotai/src/create-atom-hook.ts#L4-L9

Added lines #L4 - L9 were not covered by tests

export const createUseAtom = <Value>(atom: Atom<Value>, options?: Parameters<typeof useStore>[0]) => {
return () => useAtom(atom, options);
};

Check warning on line 13 in packages/jotai/src/create-atom-hook.ts

View check run for this annotation

Codecov / codecov/patch

packages/jotai/src/create-atom-hook.ts#L11-L13

Added lines #L11 - L13 were not covered by tests

export const createUseAtomValue = <Value>(atom: Atom<Value>, options?: Parameters<typeof useStore>[0]) => {
return () => useAtomValue(atom, options);
};

Check warning on line 17 in packages/jotai/src/create-atom-hook.ts

View check run for this annotation

Codecov / codecov/patch

packages/jotai/src/create-atom-hook.ts#L15-L17

Added lines #L15 - L17 were not covered by tests
4 changes: 2 additions & 2 deletions packages/jotai/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createUseAtom, createUseAtomValue, createUseSetAtom } from "./create-atom-hook";

Check warning on line 1 in packages/jotai/src/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/jotai/src/index.ts#L1

Added line #L1 was not covered by tests
import { createReusableAtom } from "./create-reusable-atom";
import { createSafeAtom } from "./create-safe-atom";

export { createSafeAtom, createReusableAtom };
export { createSafeAtom, createReusableAtom, createUseSetAtom, createUseAtom, createUseAtomValue };
6 changes: 6 additions & 0 deletions packages/token/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@
--danger-900: #ffdcdc;
}

@media (maxwidth: 767px) {
:root {
--font-size: 0.875rem;
}
}

@media (prefers-color-scheme: dark) {
:root {
--neutral-50: #1a1a1a;
Expand Down
6 changes: 3 additions & 3 deletions packages/xds/src/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
},
render: () => (
<div className="space-x-4">
<Button startIcon={<ArrowRightIcon />}>Start Icon</Button>
<Button endIcon={<ArrowRightIcon />}>End Icon</Button>
<Button startIcon={<ReloadIcon />} endIcon={<ArrowRightIcon />}>
<Button left={<ArrowRightIcon />}>Start Icon</Button>
<Button right={<ArrowRightIcon />}>End Icon</Button>
<Button left={<ReloadIcon />} right={<ArrowRightIcon />}>

Check warning on line 138 in packages/xds/src/button.stories.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.stories.tsx#L136-L138

Added lines #L136 - L138 were not covered by tests
Both Icons
</Button>
</div>
Expand Down
20 changes: 9 additions & 11 deletions packages/xds/src/button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { colors } from "@xionwcfm/token";
import { type VariantProps, cva } from "class-variance-authority";
import { type ElementType, type ReactNode, forwardRef } from "react";
import { Box, type BoxProps } from "./box";
import { cn } from "./cn";
import { PolymorphicComponentPropsWithRef, PolymorphicRef } from "./internal-type/polymorphic";
import { Spinner } from "./spinner";
import { ThreeDotLoadingSpinner } from "./three-dot-loading-spinner";

export const buttonVariants = cva(
`items-center justify-center whitespace-nowrap
Expand Down Expand Up @@ -65,8 +63,8 @@
);

type ButtonOptionProps = {
startIcon?: ReactNode;
endIcon?: ReactNode;
left?: ReactNode;
right?: ReactNode;
loading?: boolean;
};

Expand All @@ -84,16 +82,16 @@
size,
loading,
disabled,
endIcon,
right,

Check warning on line 85 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L85

Added line #L85 was not covered by tests
type,
startIcon,
left,

Check warning on line 87 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L87

Added line #L87 was not covered by tests
rounded,
asChild = false,
w,
...rest
} = props;
const typedRest = rest as PolymorphicComponentPropsWithRef<C, BoxProps<C>>;
const slotClass = !!startIcon || !!endIcon ? "flex items-center justify-center gap-x-4" : "";
const slotClass = !!left || !!right ? "flex items-center justify-center gap-x-4" : "";

Check warning on line 94 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L94

Added line #L94 was not covered by tests
const ComponentAs = as || "button";
const ariaLabel = props["aria-label"] ?? loading ? "loading progress" : "button";

Expand All @@ -115,15 +113,15 @@
<Spinner color={"primary"} />
</Box>
) : null}
{startIcon && !loading ? (
{left && !loading ? (

Check warning on line 116 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L116

Added line #L116 was not covered by tests
<Box as="span" className=" mr-2">
{startIcon}
{left}

Check warning on line 118 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L118

Added line #L118 was not covered by tests
</Box>
) : null}
<div className={`${loading ? "invisible" : ""}`}>{children}</div>
{endIcon ? (
{right ? (

Check warning on line 122 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L122

Added line #L122 was not covered by tests
<Box as="span" className="ml-2">
{endIcon}
{right}

Check warning on line 124 in packages/xds/src/button.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/button.tsx#L124

Added line #L124 was not covered by tests
</Box>
) : null}
</>
Expand Down
8 changes: 4 additions & 4 deletions packages/xds/src/collapsible.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<Collapsible.Trigger asChild>
<Button
variant="outline"
endIcon={<ChevronDownIcon className={`transition-transform duration-200 ${open ? "rotate-180" : ""}`} />}
right={<ChevronDownIcon className={`transition-transform duration-200 ${open ? "rotate-180" : ""}`} />}

Check warning on line 49 in packages/xds/src/collapsible.stories.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/collapsible.stories.tsx#L49

Added line #L49 was not covered by tests
>
상세 정보 보기
</Button>
Expand Down Expand Up @@ -77,7 +77,7 @@
<Button
variant="ghost"
className="w-full justify-between"
endIcon={<ChevronDownIcon className={`transition-transform duration-200 ${open ? "rotate-180" : ""}`} />}
right={<ChevronDownIcon className={`transition-transform duration-200 ${open ? "rotate-180" : ""}`} />}

Check warning on line 80 in packages/xds/src/collapsible.stories.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/collapsible.stories.tsx#L80

Added line #L80 was not covered by tests
>
최근 주문 내역 (3)
</Button>
Expand Down Expand Up @@ -116,7 +116,7 @@
<Collapsible.Trigger asChild>
<Button
variant="outline"
endIcon={
right={

Check warning on line 119 in packages/xds/src/collapsible.stories.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/collapsible.stories.tsx#L119

Added line #L119 was not covered by tests
<ChevronDownIcon className={`transition-transform duration-200 ${parentOpen ? "rotate-180" : ""}`} />
}
>
Expand All @@ -132,7 +132,7 @@
<Button
variant="ghost"
size="sm"
endIcon={
right={

Check warning on line 135 in packages/xds/src/collapsible.stories.tsx

View check run for this annotation

Codecov / codecov/patch

packages/xds/src/collapsible.stories.tsx#L135

Added line #L135 was not covered by tests
<ChevronDownIcon className={`transition-transform duration-200 ${childOpen ? "rotate-180" : ""}`} />
}
>
Expand Down
Loading