@liner-fe/prism 1.1.4 → 1.1.6

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.
Files changed (40) hide show
  1. package/lib/components/Button/index.d.ts +1 -1
  2. package/lib/components/Button/index.stories.d.ts +25 -0
  3. package/lib/design-token/border-radius/index.d.ts +1 -0
  4. package/lib/design-token/color/index.d.ts +5 -0
  5. package/lib/design-token/opacity/index.d.ts +1 -0
  6. package/lib/design-token/size/index.d.ts +1 -0
  7. package/lib/design-token/typography/index.d.ts +1 -0
  8. package/lib/index.cjs +84 -0
  9. package/lib/index.cjs.map +7 -0
  10. package/lib/index.css +112 -1
  11. package/lib/index.css.map +7 -0
  12. package/lib/index.mjs +53 -0
  13. package/lib/index.mjs.map +7 -0
  14. package/package.json +20 -14
  15. package/src/Configure.mdx +32 -0
  16. package/src/assets/design-token-cover.png +0 -0
  17. package/src/components/Button/index.stories.tsx +152 -0
  18. package/src/components/Button/index.tsx +50 -0
  19. package/src/components/Button/style.module.scss +134 -0
  20. package/src/design-token/border-radius/index.mdx +8 -0
  21. package/src/design-token/border-radius/index.stories.ts +17 -0
  22. package/src/design-token/border-radius/index.tsx +29 -0
  23. package/src/design-token/color/index.mdx +38 -0
  24. package/src/design-token/color/index.stories.ts +28 -0
  25. package/src/design-token/color/index.tsx +28 -0
  26. package/src/design-token/opacity/index.mdx +8 -0
  27. package/src/design-token/opacity/index.stories.ts +17 -0
  28. package/src/design-token/opacity/index.tsx +1 -0
  29. package/src/design-token/size/index.mdx +8 -0
  30. package/src/design-token/size/index.stories.ts +17 -0
  31. package/src/design-token/size/index.tsx +23 -0
  32. package/src/design-token/typography/index.mdx +8 -0
  33. package/src/design-token/typography/index.stories.ts +17 -0
  34. package/src/design-token/typography/index.tsx +13 -0
  35. package/src/index.ts +2 -0
  36. package/src/utils/object.ts +3 -0
  37. package/lib/components/Button/index.jsx +0 -41
  38. package/lib/index.js +0 -1
  39. package/lib/tsconfig.production.tsbuildinfo +0 -1
  40. package/lib/utils/object.js +0 -7
@@ -0,0 +1,50 @@
1
+ import { ButtonHTMLAttributes, forwardRef } from 'react';
2
+ import style from './style.module.scss';
3
+ import { VariantProps, cva } from 'class-variance-authority';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import clsx from 'clsx';
6
+
7
+ const buttonVariants = cva(style.button, {
8
+ variants: {
9
+ level: {
10
+ primary: style.primary,
11
+ secondary: style.secondary,
12
+ tertiary: style.tertiary,
13
+ quaternary: style.quaternary,
14
+ quinary: style.quinary,
15
+ negative: style.negative,
16
+ inverse: style.inverse,
17
+ },
18
+ align: {
19
+ center: style['align-center'],
20
+ spaceBetween: style['align-space-between'],
21
+ },
22
+ size: {
23
+ cta: style.cta,
24
+ l: style.l,
25
+ m: style.m,
26
+ s: style.s,
27
+ },
28
+ },
29
+ });
30
+
31
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
32
+ asChild?: boolean;
33
+ align?: 'center' | 'spaceBetween';
34
+ level?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary' | 'negative' | 'inverse';
35
+ size?: 'cta' | 'l' | 'm' | 's';
36
+ // isLoading?: boolean;
37
+ // leftIcon?: ReactNode;
38
+ // rightIcon?: ReactNode;
39
+ }
40
+
41
+ /**
42
+ * 버튼 컴포넌트
43
+ */
44
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
45
+ ({ asChild, level = 'primary', align = 'center', size = 'cta', ...props }, ref) => {
46
+ const Comp = asChild ? Slot : 'button';
47
+
48
+ return <Comp className={clsx(buttonVariants({ level, align, size }))} ref={ref} {...props} />;
49
+ }
50
+ );
@@ -0,0 +1,134 @@
1
+ // @import "../../../../design-token/global.css";
2
+ // @use "../../../../design-token/global.css" as *;
3
+
4
+ .button {
5
+ position: relative;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ border: none;
10
+
11
+ font-size: normal;
12
+ font-weight: var(--lp-pri-font-weight-700);
13
+ line-height: 130%; // TODO: 토큰
14
+ color: var(--inverse-label-static-primary);
15
+ background: var(--lp-pri-achromatic-white); // TODO: 토큰
16
+ overflow: hidden;
17
+
18
+ cursor: pointer;
19
+ // color: var(--brand-container-mid);
20
+
21
+ &:disabled {
22
+ background: var(--neutral-container-mid);
23
+ color: var(--neutral-label-tertiary);
24
+ cursor: not-allowed;
25
+ }
26
+ }
27
+
28
+ // level
29
+ .primary {
30
+ background: #4058FF; // TODO: 토큰 업데이트 (색상 다름)
31
+
32
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
33
+ background: #3346cc;
34
+ }
35
+ }
36
+ .secondary {
37
+ background: var(--inverse-container-high);
38
+
39
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
40
+ background: #121212;
41
+ }
42
+ }
43
+ .tertiary {
44
+ background: #6D6D7014;
45
+ color: var(--neutral-label-primary);
46
+
47
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
48
+ background: #ebebeb;
49
+ }
50
+ }
51
+ .quaternary {
52
+ // TODO: 토큰 업데이트 neutral/border/overlay/normal
53
+ color: var(--neutral-label-primary);
54
+ border: 1px solid var(--neutral-border-overlay-normal);
55
+
56
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
57
+ background: #f5f5f5;
58
+ }
59
+
60
+ &:disabled {
61
+ background: var(--neutral-container-mid);
62
+ color: var(--neutral-label-tertiary);
63
+ opacity: 0.4;
64
+ }
65
+ }
66
+ .quinary {
67
+ // color: var(--neutral-label-secondary);
68
+ color: #6D6D70CC; // TODO: 토큰 업데이트
69
+
70
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
71
+ background: #f5f5f5;
72
+ }
73
+ &:disabled {
74
+ background: var(--neutral-container-mid);
75
+ color: var(--neutral-label-tertiary);
76
+ opacity: 0.4;
77
+ }
78
+ }
79
+ .negative {
80
+ // TODO: funtion/container/negative
81
+ background: var(--function-negative);
82
+
83
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
84
+ background: #af1b1c;
85
+ }
86
+ }
87
+ .inverse {
88
+ // TODO: neutral/label/static/primary
89
+ color: var(--neutral-label-primary);
90
+
91
+ &:not(:disabled):hover { // TODO: 토큰으로 변환
92
+ background: #f5f5f5;
93
+ }
94
+ }
95
+
96
+ // size
97
+ .cta {
98
+ border-radius: 8px; // TODO: 토큰
99
+ padding: 13.5px 12px; // TODO: 토큰
100
+ font-size: var(--lp-pri-font-size-16);
101
+ min-width: 129px;
102
+ max-height: 48px;
103
+ }
104
+ .l {
105
+ border-radius: 6px; // TODO: 토큰
106
+ padding: 10.5px 8px; // TODO: 토큰
107
+ font-size: var(--lp-pri-font-size-15);
108
+ min-width: 107px;
109
+ max-height: 40px;
110
+ }
111
+ .m {
112
+ border-radius: 6px; // TODO: 토큰
113
+ padding: 7px 6px; // TODO: 토큰
114
+ font-size: var(--lp-pri-font-size-14);
115
+ font-weight: var(--lp-pri-font-weight-500);
116
+ min-width: 91px;
117
+ max-height: 32px;
118
+ }
119
+ .s {
120
+ border-radius: 6px; // TODO: 토큰
121
+ padding: 3.5px 6px; // TODO: 토큰
122
+ font-size: var(--lp-pri-font-size-13);
123
+ font-weight: var(--lp-pri-font-weight-500);
124
+ min-width: 89px;
125
+ max-height: 24px;
126
+ }
127
+
128
+ // align
129
+ .align-center {
130
+ justify-content: center;
131
+ }
132
+ .align-space-between {
133
+ justify-content: space-between;
134
+ }
@@ -0,0 +1,8 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+ import * as SizeStories from './index.stories.ts';
3
+
4
+ <Meta of={SizeStories} />
5
+
6
+ <div>
7
+ <h1>Design Token: Border Radius 개발자 가이드</h1>
8
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Color } from './index';
3
+
4
+ const meta = {
5
+ title: 'DesignToken/BorderRadius',
6
+ component: Color,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ tags: ['!autodocs'],
11
+ } satisfies Meta<typeof Color>;
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const All: Story = {};
@@ -0,0 +1,29 @@
1
+ // import { radius } from '@liner-fe/design-token';
2
+
3
+ import { objectToArray } from '../../utils/object';
4
+
5
+ export const Color = () => (
6
+ <div style={{ display: 'flex', gap: '20px', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
7
+ {/* {objectToArray(radius).map(([key, value]) => {
8
+ return (
9
+ <div
10
+ style={{
11
+ backgroundColor: '#ededed',
12
+ borderRadius: `${value}px`,
13
+ width: '150px',
14
+ height: '150px',
15
+ justifyContent: 'center',
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ flexDirection: 'column',
19
+ gap: '12px',
20
+ fontWeight: 'bold',
21
+ }}
22
+ >
23
+ <div>{key}</div>
24
+ <div style={{ fontSize: '12px' }}>{value}px</div>
25
+ </div>
26
+ );
27
+ })} */}
28
+ </div>
29
+ );
@@ -0,0 +1,38 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+ import * as SizeStories from './index.stories.ts';
3
+
4
+ <Meta of={SizeStories} />
5
+
6
+ <div>
7
+ <h1>Design Token: Color 개발자 가이드</h1>
8
+ </div>
9
+
10
+ primitve, system로 위계가 나뉩니다.
11
+
12
+ ```ts
13
+ const color = {
14
+ primitive,
15
+ system,
16
+ };
17
+ ```
18
+
19
+ primitive는 원시 값(hex값과 같은 실제 값)을 매핑 하고 있습니다. system은 시멘틱한 네이밍으로 primitive를 매핑하고 있습니다.
20
+
21
+ 그래서 대부분의 경우에는 system값을 사용해야하며, 불가피하게 primitive 값을 사용할 때는 프론트엔드 플래닛에 공유해주시길 바랍니다.
22
+
23
+ <h2>스타일링 라이브러리</h2>
24
+
25
+ <h3>CSS, SCSS</h3>
26
+
27
+ 플랫폼: liner-space
28
+
29
+ <h3>CSS-in-js</h3>
30
+
31
+ 플랫폼: liner-web, liner-be
32
+
33
+ <h3>React Native</h3>
34
+
35
+ 플랫폼: liner-mobile
36
+ 확인하지 않음
37
+
38
+ <h2>DarkMode를 구현하는 방법</h2>
@@ -0,0 +1,28 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Color } from './index';
3
+ import { color } from '@liner-fe/design-token';
4
+
5
+ const meta = {
6
+ title: 'DesignToken/Color',
7
+ component: Color,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['!autodocs'],
12
+ } satisfies Meta<typeof Color>;
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ export const System: Story = {
19
+ args: {
20
+ type: 'system',
21
+ },
22
+ };
23
+
24
+ export const Primitive: Story = {
25
+ args: {
26
+ type: 'primitive',
27
+ },
28
+ };
@@ -0,0 +1,28 @@
1
+ import { useEffect } from 'react';
2
+
3
+ interface IProps {
4
+ type: 'primitive' | 'system';
5
+ }
6
+
7
+ export const Color = ({ type }: IProps) => {
8
+ // const { toggleTheme } = useDarkTheme();
9
+
10
+ return (
11
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: '10px', justifyContent: 'center', margin: '20px 0' }}>
12
+ {/* <div>
13
+ <button onClick={toggleTheme}>Dark theme</button>
14
+ {document.documentElement.getAttribute('color-theme')}
15
+ </div>
16
+
17
+ {objectToArray(type === 'primitive' ? color.color.primitive : color.color.system).map(([key, value]) => (
18
+ <div
19
+ key={key}
20
+ style={{ width: 200, height: 250, border: '1px solid #ededed', borderRadius: 10, textAlign: 'center' }}
21
+ >
22
+ <div style={{ backgroundColor: value, height: 150, borderRadius: '10px 10px 0 0' }}></div>
23
+ {key} {value}
24
+ </div>
25
+ ))} */}
26
+ </div>
27
+ );
28
+ };
@@ -0,0 +1,8 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+ import * as SizeStories from './index.stories.ts';
3
+
4
+ <Meta of={SizeStories} />
5
+
6
+ <div>
7
+ <h1>Design Token: Opacity 개발자 가이드</h1>
8
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Opacity } from './index';
3
+
4
+ const meta = {
5
+ title: 'DesignToken/Opacity',
6
+ component: Opacity,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ tags: ['!autodocs'],
11
+ } satisfies Meta<typeof Opacity>;
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const All: Story = {};
@@ -0,0 +1 @@
1
+ export const Opacity = () => <div></div>;
@@ -0,0 +1,8 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+ import * as SizeStories from './index.stories.ts';
3
+
4
+ <Meta of={SizeStories} />
5
+
6
+ <div>
7
+ <h1>Design Token: Size 개발자 가이드</h1>
8
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Size } from './index';
3
+
4
+ const meta = {
5
+ title: 'DesignToken/Size',
6
+ component: Size,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ tags: ['!autodocs'],
11
+ } satisfies Meta<typeof Size>;
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const All: Story = {};
@@ -0,0 +1,23 @@
1
+ import { objectToArray } from '@/utils/object';
2
+
3
+ export const Size = () => (
4
+ <div>
5
+ {/* {objectToArray(size).map(([key, value]) => {
6
+ return (
7
+ <div
8
+ style={{
9
+ backgroundColor: '#ededed',
10
+ width: `${value}px`,
11
+ height: `${value}px`,
12
+ justifyContent: 'center',
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ flexDirection: 'column',
16
+ gap: '12px',
17
+ fontWeight: 'bold',
18
+ }}
19
+ ></div>
20
+ );
21
+ })} */}
22
+ </div>
23
+ );
@@ -0,0 +1,8 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+ import * as SizeStories from './index.stories.ts';
3
+
4
+ <Meta of={SizeStories} />
5
+
6
+ <div>
7
+ <h1>Design Token: Typography 개발자 가이드</h1>
8
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Typography } from './index';
3
+
4
+ const meta = {
5
+ title: 'DesignToken/Typography',
6
+ component: Typography,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ tags: ['!autodocs'],
11
+ } satisfies Meta<typeof Typography>;
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const All: Story = {};
@@ -0,0 +1,13 @@
1
+ export const Typography = () => (
2
+ <div>
3
+ {/* {objectToArray(font.size).map(([key, value]) => (
4
+ <div>
5
+ {key} {value}
6
+ </div>
7
+ ))} */}
8
+
9
+ {/* <p style={{ fontSize: '16px', fontWeight: 500, fontFamily: 'pretendard', lineHeight: 26 }}>Blah Blah</p>
10
+
11
+ <Display type={'accent'}>Blah Blah</Display> */}
12
+ </div>
13
+ );
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './utils/object';
2
+ export * from './components/Button';
@@ -0,0 +1,3 @@
1
+ export const objectToArray = <T extends Record<string, any>>(obj: T) => {
2
+ return Object.entries(obj);
3
+ };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Button = void 0;
7
- const react_1 = require("react");
8
- const style_module_scss_1 = __importDefault(require("./style.module.scss"));
9
- const class_variance_authority_1 = require("class-variance-authority");
10
- const react_slot_1 = require("@radix-ui/react-slot");
11
- const clsx_1 = __importDefault(require("clsx"));
12
- const buttonVariants = (0, class_variance_authority_1.cva)(style_module_scss_1.default.button, {
13
- variants: {
14
- level: {
15
- primary: style_module_scss_1.default.primary,
16
- secondary: style_module_scss_1.default.secondary,
17
- tertiary: style_module_scss_1.default.tertiary,
18
- quaternary: style_module_scss_1.default.quaternary,
19
- quinary: style_module_scss_1.default.quinary,
20
- negative: style_module_scss_1.default.negative,
21
- inverse: style_module_scss_1.default.inverse,
22
- },
23
- align: {
24
- center: style_module_scss_1.default['align-center'],
25
- spaceBetween: style_module_scss_1.default['align-space-between'],
26
- },
27
- size: {
28
- cta: style_module_scss_1.default.cta,
29
- l: style_module_scss_1.default.l,
30
- m: style_module_scss_1.default.m,
31
- s: style_module_scss_1.default.s,
32
- },
33
- },
34
- });
35
- /**
36
- * 버튼 컴포넌트
37
- */
38
- exports.Button = (0, react_1.forwardRef)(({ asChild, level = 'primary', align = 'center', size = 'cta', ...props }, ref) => {
39
- const Comp = asChild ? react_slot_1.Slot : 'button';
40
- return <Comp className={(0, clsx_1.default)(buttonVariants({ level, align, size }))} ref={ref} {...props}/>;
41
- });
package/lib/index.js DELETED
@@ -1 +0,0 @@
1
- var v=e=>Object.entries(e);import{forwardRef as p}from"react";var r={};import{cva as s}from"class-variance-authority";import{Slot as d}from"@radix-ui/react-slot";import c from"clsx";var u=s(r.button,{variants:{level:{primary:r.primary,secondary:r.secondary,tertiary:r.tertiary,quaternary:r.quaternary,quinary:r.quinary,negative:r.negative,inverse:r.inverse},align:{center:r["align-center"],spaceBetween:r["align-space-between"]},size:{cta:r.cta,l:r.l,m:r.m,s:r.s}}}),z=p(({asChild:e,level:t="primary",align:a="center",size:n="cta",...o},i)=>React.createElement(e?d:"button",{className:c(u({level:t,align:a,size:n})),ref:i,...o}));export{z as Button,v as objectToArray};