@jects/jds 0.0.1

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.
@@ -0,0 +1,139 @@
1
+ import { Theme, CSSObject } from '@emotion/react';
2
+
3
+ /**
4
+ * Hex 색상 코드를 RGBA로 변환하는 함수
5
+ *
6
+ * @param hex - Hex 색상 코드 (예: '#FF5733' 또는 'FF5733') 현재 토큰의 경우 #이 붙여져서 등록되어있음
7
+ * @param alpha - 투명도 (0~1 사이의 값)
8
+ * @returns RGBA 문자열 (예: 'rgba(255, 87, 51, 0.55)')
9
+ *
10
+ * @example
11
+ * hexToRgba('토큰 명(혹은 실제 코드)',투명도)'
12
+ * hexToRgba('#FF5733', 0.55) // 'rgba(255, 87, 51, 0.55)'
13
+ * hexToRgba('FF5733', 1) // 'rgba(255, 87, 51, 1)'
14
+ */
15
+ declare function HexToRgba(hex: string, alpha: number): string;
16
+
17
+ /**
18
+ * px값을 rem 단위로 변환합니다
19
+ * @param pixels - 변환할 px 값
20
+ * @param baseFontSize - 기본 폰트 크기 (px 단위, 기본값: 16)
21
+ * @param precision - 소수점 자릿수 (기본값: 4)
22
+ * @returns rem 값이 포함된 문자열
23
+ */
24
+ declare function pxToRem(pixels: number, baseFontSize?: number, precision?: number): string;
25
+ /**
26
+ * 특정 폰트 크기를 기준으로 스페이싱 값을 em 단위로 변환합니다
27
+ * @param spacing - 변환할 스페이싱 값 (px단위)
28
+ * @param fontSize - 기준이 되는 폰트 크기 (px단위)
29
+ * @param precision - 소수점 자릿수 (기본값: 3)
30
+ * @returns em 값이 포함된 문자열
31
+ */
32
+ declare function spacingToEm(spacing: number, fontSize: number, precision?: number): string;
33
+ /**
34
+ * px값으로부터 line-height 비율을 계산합니다
35
+ * @param lineHeight - 줄 간격 값 (px단위)
36
+ * @param fontSize - 폰트 크기 (px단위)
37
+ * @param precision - 소수점 자릿수 (기본값: 1)
38
+ * @returns 단위 없는 line-height 비율 문자열
39
+ */
40
+ declare function lineHeightRatio(lineHeight: number, fontSize: number, precision?: number): number;
41
+
42
+ type Depth = "shallowest" | "shallower" | "shallow" | "standard" | "deep" | "deeper" | "deepest";
43
+ type Level = "standard" | "embossed" | "raised" | "floated" | "overlay";
44
+ type Shadow = "embossed" | "raised" | "floated" | "overlay";
45
+
46
+ type Variant = "normal" | "accent" | "positive" | "destructive";
47
+ type Density = "bold" | "normal" | "assistive" | "subtle";
48
+ type FillColor = "default" | "inverse";
49
+ type InteractionState = "default" | "readonly" | "disabled" | "locked";
50
+ type InteractionLayerState = "rest" | "hover" | "active" | "focus";
51
+
52
+ declare function depth(theme: Theme, depthToken: Depth): {
53
+ backgroundColor: "var(--semantic-surface-shallowest)";
54
+ } | {
55
+ backgroundColor: "var(--semantic-surface-shallower)";
56
+ } | {
57
+ backgroundColor: "var(--semantic-surface-shallow)";
58
+ } | {
59
+ backgroundColor: "var(--semantic-surface-standard)";
60
+ } | {
61
+ backgroundColor: "var(--semantic-surface-deep)";
62
+ } | {
63
+ backgroundColor: "var(--semantic-surface-deeper)";
64
+ } | {
65
+ backgroundColor: "var(--semantic-surface-deepest)";
66
+ } | {
67
+ backgroundColor?: undefined;
68
+ };
69
+ declare function level(theme: Theme, levelToken: Level): {
70
+ zIndex: "auto";
71
+ } | {
72
+ boxShadow: string;
73
+ zIndex: number;
74
+ } | {
75
+ boxShadow?: undefined;
76
+ zIndex: number;
77
+ } | {
78
+ zIndex?: undefined;
79
+ };
80
+ declare function shadow(theme: Theme, shadowToken: Shadow): {
81
+ boxShadow: string;
82
+ } | {
83
+ boxShadow?: undefined;
84
+ };
85
+
86
+ declare function Interaction(theme: Theme, variant: Variant, density: Density, fillColor: FillColor, state?: InteractionState, borderRadius?: string): CSSObject;
87
+
88
+ interface InteractionLayerParams {
89
+ theme: Theme;
90
+ state: InteractionLayerState;
91
+ variant: Variant;
92
+ density: Density;
93
+ fillColor: FillColor;
94
+ isReadonly?: boolean;
95
+ isDisabled?: boolean;
96
+ isLocked?: boolean;
97
+ offsetVertical?: number;
98
+ offsetHorizontal?: number;
99
+ borderRadius?: number;
100
+ }
101
+ /**
102
+ * 인터랙션 레이어 스타일 생성
103
+ *
104
+ * @description
105
+ * Figma 스펙에 맞춰 variant + density + fillColor 조합으로 색상 토큰을 결정합니다.
106
+ * ::after 의사 요소를 사용하여 주어진 state에 대한 스타일만 생성합니다.
107
+ *
108
+ * 중요: 컴포넌트의 실제 인터랙션 상태(hover, active, focus)와
109
+ * InteractionLayer의 state는 독립적으로 설정할 수 있습니다.
110
+ *
111
+ * 예: 컴포넌트 hover 시 InteractionLayer state='rest' 사용 가능
112
+ *
113
+ * @param theme - Emotion 테마 객체
114
+ * @param state - InteractionLayer 시각적 상태 (rest, hover, active, focus)
115
+ * @param variant - 색상 변형 (normal, accent, positive, destructive)
116
+ * @param density - 색상 강도 (bold, normal, assistive, subtle)
117
+ * @param fillColor - 배경 타입 (default, inverse)
118
+ * @param isReadonly - 읽기 전용 상태
119
+ * @param isDisabled - 비활성화 상태
120
+ * @param isLocked - 잠김 상태
121
+ * @param offsetVertical - 상하 방향 오프셋 (px 단위)
122
+ * @param offsetHorizontal - 좌우 방향 오프셋 (px 단위)
123
+ * @param borderRadius - 테두리 둥글기 (px 단위)
124
+ *
125
+ * @example
126
+ * // 일반적인 사용 (컴포넌트 상태 = InteractionLayer 상태)
127
+ * '&:hover': InteractionLayer({ theme, state: 'hover', ... })
128
+ *
129
+ * @example
130
+ * // 독립적인 사용 (컴포넌트 hover 시에도 InteractionLayer는 rest)
131
+ * '&:hover': InteractionLayer({ theme, state: 'rest', ... })
132
+ *
133
+ * @example
134
+ * // offset과 borderRadius를 사용하여 더 큰 터치 영역과 둥근 모서리 제공
135
+ * InteractionLayer({ theme, state: 'hover', ..., offsetVertical: 4, offsetHorizontal: 8, borderRadius: 4 })
136
+ */
137
+ declare function InteractionLayer({ theme, state, variant, density, fillColor, isReadonly, isDisabled, isLocked, offsetVertical, offsetHorizontal, borderRadius, }: InteractionLayerParams): CSSObject;
138
+
139
+ export { HexToRgba, Interaction, InteractionLayer, type InteractionLayerParams, depth, level, lineHeightRatio, pxToRem, shadow, spacingToEm };
package/dist/utils.js ADDED
@@ -0,0 +1,24 @@
1
+ import {
2
+ HexToRgba,
3
+ Interaction,
4
+ InteractionLayer,
5
+ depth,
6
+ level,
7
+ lineHeightRatio,
8
+ pxToRem,
9
+ shadow,
10
+ spacingToEm
11
+ } from "./chunk-4G7IFL4O.js";
12
+ import "./chunk-EGRHWZRV.js";
13
+ export {
14
+ HexToRgba,
15
+ Interaction,
16
+ InteractionLayer,
17
+ depth,
18
+ level,
19
+ lineHeightRatio,
20
+ pxToRem,
21
+ shadow,
22
+ spacingToEm
23
+ };
24
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@jects/jds",
3
+ "version": "0.0.1",
4
+ "description": "Ject Design System",
5
+ "author": "Ject Team",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "engines": {
9
+ "node": ">=18.0.0",
10
+ "npm": ">=10.0.0"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/JECT-Study/JECT-Official-WebSite-Client.git",
15
+ "directory": "packages/jds"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "module": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "files": [
21
+ "dist",
22
+ "README.md"
23
+ ],
24
+ "sideEffects": false,
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js",
29
+ "require": "./dist/index.cjs"
30
+ },
31
+ "./theme": {
32
+ "types": "./dist/theme.d.ts",
33
+ "import": "./dist/theme.js",
34
+ "require": "./dist/theme.cjs"
35
+ },
36
+ "./hooks": {
37
+ "types": "./dist/hooks.d.ts",
38
+ "import": "./dist/hooks.js",
39
+ "require": "./dist/hooks.cjs"
40
+ },
41
+ "./utils": {
42
+ "types": "./dist/utils.d.ts",
43
+ "import": "./dist/utils.js",
44
+ "require": "./dist/utils.cjs"
45
+ },
46
+ "./tokens": {
47
+ "types": "./dist/tokens.d.ts",
48
+ "import": "./dist/tokens.js",
49
+ "require": "./dist/tokens.cjs"
50
+ },
51
+ "./styles": "./dist/styles.css"
52
+ },
53
+ "scripts": {
54
+ "dev": "tsup --watch",
55
+ "build": "tsc --noEmit && tsup",
56
+ "lint": "eslint --fix --max-warnings 0",
57
+ "storybook": "storybook dev -p 6006",
58
+ "build-storybook": "storybook build",
59
+ "chromatic": "npx chromatic --project-token=$CHROMATIC_TOKEN",
60
+ "build:tokens": "npx tsx tokensBuilder.ts",
61
+ "clean": "rimraf dist node_modules .turbo storybook-static",
62
+ "build:icons": "svgr src/assets/icons --out-dir src/components/Icon/generated --typescript --ext tsx",
63
+ "type-check": "tsc -b --noEmit",
64
+ "format": "prettier --write ."
65
+ },
66
+ "dependencies": {
67
+ "radix-ui": "^1.4.3"
68
+ },
69
+ "devDependencies": {
70
+ "@chromatic-com/storybook": "^4.1.3",
71
+ "@emotion/babel-plugin": "^11.13.5",
72
+ "@emotion/react": "^11.14.0",
73
+ "@emotion/styled": "^11.14.1",
74
+ "@ject/eslint-config": "*",
75
+ "@storybook/addon-docs": "10.1.0",
76
+ "@storybook/addon-onboarding": "^10.1.0",
77
+ "@storybook/react-vite": "10.1.0",
78
+ "@svgr/cli": "^8.1.0",
79
+ "@svgr/core": "^8.1.0",
80
+ "@types/node": "^22.19.1",
81
+ "@types/react": "^18.3.18",
82
+ "@types/react-dom": "^18.3.5",
83
+ "chromatic": "^11.25.2",
84
+ "eslint-plugin-storybook": "10.1.0",
85
+ "react": "^18.3.1",
86
+ "react-dom": "^18.3.1",
87
+ "storybook": "10.1.0",
88
+ "style-dictionary": "^4.3.2",
89
+ "tsup": "^8.5.0",
90
+ "zod": "^3.25.76"
91
+ },
92
+ "peerDependencies": {
93
+ "@emotion/react": ">=11",
94
+ "@emotion/styled": ">=11",
95
+ "react": ">=18.0.0",
96
+ "react-dom": ">=18.0.0"
97
+ },
98
+ "publishConfig": {
99
+ "access": "public",
100
+ "registry": "https://registry.npmjs.org/"
101
+ },
102
+ "optionalDependencies": {
103
+ "@rollup/rollup-linux-x64-gnu": "4.53.2"
104
+ }
105
+ }