@vespiario-thailand/design-system 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.
- package/README.md +1 -0
- package/dist/components/Button/index.d.ts +5 -0
- package/dist/components/Chip/index.d.ts +11 -0
- package/dist/components/Dialog/index.d.ts +8 -0
- package/dist/components/Icon/index.d.ts +15 -0
- package/dist/components/Label/index.d.ts +8 -0
- package/dist/components/Stack/index.d.ts +6 -0
- package/dist/components/Typo/index.d.ts +12 -0
- package/dist/constance/Button/index.d.ts +3 -0
- package/dist/constance/Icon/index.d.ts +4 -0
- package/dist/custom-theme.cjs +174 -0
- package/dist/hooks/hooks/index.ts +5 -0
- package/dist/hooks/hooks/useClickOutside.ts +33 -0
- package/dist/hooks/hooks/useIsClient.ts +13 -0
- package/dist/hooks/hooks/useIsMounted.ts +17 -0
- package/dist/hooks/hooks/useIsomorphicLayoutEffect.ts +5 -0
- package/dist/hooks/hooks/useMergeRefs.ts +15 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useClickOutside.d.ts +5 -0
- package/dist/hooks/useIsClient.d.ts +2 -0
- package/dist/hooks/useIsMounted.d.ts +2 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/hooks/useMergeRefs.d.ts +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +1 -0
- package/dist/types/Button/index.d.ts +35 -0
- package/dist/types/Icon/index.d.ts +11 -0
- package/dist/types/Typo/index.d.ts +27 -0
- package/dist/vespa-design-system.cjs +240 -0
- package/dist/vespa-design-system.js +21779 -0
- package/dist/vespa-design-system.umd.cjs +240 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +86 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# init-vite-storybook
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** types */
|
|
2
|
+
import { CommonButtonType, ConditionButtonIconType } from '../../types/Button';
|
|
3
|
+
export type ButtonPropType = CommonButtonType & ConditionButtonIconType;
|
|
4
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonPropType & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export default Button;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** lib */
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
export declare const ChipVariants: readonly ["light", "dark"];
|
|
4
|
+
export type ChipVariantsType = typeof ChipVariants[number];
|
|
5
|
+
export type ChipProps = HTMLAttributes<HTMLSpanElement> & {
|
|
6
|
+
variants: ChipVariantsType;
|
|
7
|
+
};
|
|
8
|
+
declare const Chip: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
9
|
+
variants: ChipVariantsType;
|
|
10
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
export default Chip;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
2
|
+
export declare const fixedPositionCss = "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2";
|
|
3
|
+
declare const CompoundDialog: ((props: RadixDialog.DialogProps) => JSX.Element) & {
|
|
4
|
+
Confirm: (props: RadixDialog.DialogCloseProps) => JSX.Element;
|
|
5
|
+
Content: import("react").ForwardRefExoticComponent<RadixDialog.DialogContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
Trigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
};
|
|
8
|
+
export default CompoundDialog;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** lib */
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
/** type */
|
|
4
|
+
import { IconColorType, IconSizeType, IconType } from '../../types/Icon';
|
|
5
|
+
export type IconProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
icon: IconType;
|
|
7
|
+
size?: IconSizeType;
|
|
8
|
+
color?: IconColorType;
|
|
9
|
+
};
|
|
10
|
+
declare const Icon: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
11
|
+
icon: IconType;
|
|
12
|
+
size?: "12" | "16" | "20" | "24" | "32" | "40" | "48" | "56" | "60" | "72" | "80" | undefined;
|
|
13
|
+
color?: "blue" | "green" | "light-green" | "yellow" | "dark" | "light" | "shade-dark" | "shade-light" | undefined;
|
|
14
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export default Icon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export declare const LabelSizes: readonly ["small", "medium", "large"];
|
|
3
|
+
declare const Label: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
isBorder: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
size: '';
|
|
7
|
+
} & React.RefAttributes<unknown>>;
|
|
8
|
+
export default Label;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
declare const Stack: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
direction: 'horizon' | 'vertical';
|
|
4
|
+
gap: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40;
|
|
5
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export default Stack;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** libs */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/** types */
|
|
4
|
+
import { HTMLTagType, TextSizeType, TextStyleType, TextWeightType } from '../../types/Typo';
|
|
5
|
+
type TypoForwardRefType = HTMLHeadingElement & HTMLParagraphElement & HTMLSpanElement;
|
|
6
|
+
declare const Typo: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement & HTMLParagraphElement & HTMLSpanElement> & {
|
|
7
|
+
as: HTMLTagType;
|
|
8
|
+
size: TextSizeType;
|
|
9
|
+
textStyle: TextStyleType;
|
|
10
|
+
weight: TextWeightType;
|
|
11
|
+
} & React.RefAttributes<TypoForwardRefType>>;
|
|
12
|
+
export default Typo;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const IconLists: readonly ["null-1", "null-2", "arrowhead-top", "arrowhead-left", "arrowhead-right", "arrowhead-bottom", "arrowhead-sm-top", "arrowhead-sm-left", "arrowhead-sm-right", "arrowhead-sm-bottom", "round-arrow-top", "round-arrow-left", "round-arrow-right", "round-arrow-bottom", "round-solid-arrow-top", "round-solid-arrow-left", "round-solid-arrow-right", "round-solid-arrow-bottom", "bar", "bar-1", "bar-2", "double-bar", "bow-tie", "play", "stop", "pause", "first", "last", "globe", "tako", "kebab", "cheese", "veggie", "meatball", "hamburger", "vespa", "check"];
|
|
2
|
+
declare const IconColors: readonly ["blue", "green", "light-green", "yellow", "dark", "light", "shade-dark", "shade-light"];
|
|
3
|
+
declare const IconSizes: readonly ["12", "16", "20", "24", "32", "40", "48", "56", "60", "72", "80"];
|
|
4
|
+
export { IconColors, IconLists, IconSizes, };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
theme: {
|
|
5
|
+
boxShadow: {
|
|
6
|
+
100: '0px 4px 4px -1px rgba(0, 0, 0, 0.25)',
|
|
7
|
+
200: '0px 8px 8px -2px rgba(0, 0, 0, 0.25)',
|
|
8
|
+
300: '0px 12px 12px -3px rgba(0, 0, 0, 0.25)',
|
|
9
|
+
400: '0px 16px 16px -4px rgba(0, 0, 0, 0.25)',
|
|
10
|
+
},
|
|
11
|
+
backdropBlur: {
|
|
12
|
+
100: '2px',
|
|
13
|
+
200: '4px',
|
|
14
|
+
300: '6px',
|
|
15
|
+
400: '8px',
|
|
16
|
+
500: '10px',
|
|
17
|
+
},
|
|
18
|
+
blur: {
|
|
19
|
+
100: '2px',
|
|
20
|
+
200: '4px',
|
|
21
|
+
300: '6px',
|
|
22
|
+
400: '8px',
|
|
23
|
+
500: '10px',
|
|
24
|
+
},
|
|
25
|
+
fontFamily: {
|
|
26
|
+
'vespa-thai': ['Vespiario Thai', 'system-ui', 'sans-serif'],
|
|
27
|
+
'vespa-thai-italic': ['Vespiario Condensed Italic', 'system-ui', 'sans-serif']
|
|
28
|
+
},
|
|
29
|
+
fontSize: {
|
|
30
|
+
/** name: [fontSize, lineHeight] */
|
|
31
|
+
'title-large': ['72px', 1.4],
|
|
32
|
+
'title-medium': ['60px', 1.4],
|
|
33
|
+
'title-small': ['48px', 1.4],
|
|
34
|
+
'title-small-alt': ['32px', 1.4],
|
|
35
|
+
'body-large': ['24px', 1.4],
|
|
36
|
+
body: ['16px', 1.4],
|
|
37
|
+
'body-small': ['13px', 1.4],
|
|
38
|
+
caption: ['11px', 1.4],
|
|
39
|
+
},
|
|
40
|
+
fontWeight: {
|
|
41
|
+
light: '300',
|
|
42
|
+
normal: '400',
|
|
43
|
+
'semi-bold': '600',
|
|
44
|
+
bold: '700',
|
|
45
|
+
},
|
|
46
|
+
spacing: {
|
|
47
|
+
0: '0',
|
|
48
|
+
4: '4px',
|
|
49
|
+
8: '8px',
|
|
50
|
+
12: '12px',
|
|
51
|
+
16: '16px',
|
|
52
|
+
20: '20px',
|
|
53
|
+
24: '24px',
|
|
54
|
+
32: '32px',
|
|
55
|
+
40: '40px',
|
|
56
|
+
48: '48px',
|
|
57
|
+
56: '56px',
|
|
58
|
+
60: '60px',
|
|
59
|
+
72: '72px',
|
|
60
|
+
80: '80px',
|
|
61
|
+
},
|
|
62
|
+
colors: {
|
|
63
|
+
transparent: 'transparent',
|
|
64
|
+
blue: {
|
|
65
|
+
100: '#89CAE5',
|
|
66
|
+
200: '#6EBEDF',
|
|
67
|
+
300: '#52B1DA',
|
|
68
|
+
400: '#37A5D4',
|
|
69
|
+
500: '#1C99CE',
|
|
70
|
+
600: '#1987B5',
|
|
71
|
+
700: '#15749D',
|
|
72
|
+
800: '#126284',
|
|
73
|
+
900: '#0F506B',
|
|
74
|
+
},
|
|
75
|
+
green: {
|
|
76
|
+
100: '#98CFBF',
|
|
77
|
+
200: '#80C4B1',
|
|
78
|
+
300: '#68B9A2',
|
|
79
|
+
400: '#50AE94',
|
|
80
|
+
500: '#38A385',
|
|
81
|
+
600: '#318F75',
|
|
82
|
+
700: '#2B7C65',
|
|
83
|
+
800: '#246855',
|
|
84
|
+
900: '#1D5545',
|
|
85
|
+
},
|
|
86
|
+
'light-green': {
|
|
87
|
+
100: '#d0f5c2',
|
|
88
|
+
200: '#c5f3b3',
|
|
89
|
+
300: '#bbf0a5',
|
|
90
|
+
400: '#b0ee97',
|
|
91
|
+
500: '#A5EC89',
|
|
92
|
+
600: '#91d079',
|
|
93
|
+
700: '#7db368',
|
|
94
|
+
800: '#6a9758',
|
|
95
|
+
900: '#567b47',
|
|
96
|
+
},
|
|
97
|
+
yellow: {
|
|
98
|
+
100: '#ffe87a',
|
|
99
|
+
200: '#ffe35c',
|
|
100
|
+
300: '#ffde3d',
|
|
101
|
+
400: '#ffd81f',
|
|
102
|
+
500: '#FFD300',
|
|
103
|
+
600: '#e0ba00',
|
|
104
|
+
700: '#c2a000',
|
|
105
|
+
800: '#a38700',
|
|
106
|
+
900: '#856e00',
|
|
107
|
+
},
|
|
108
|
+
dark: {
|
|
109
|
+
100: '#000000',
|
|
110
|
+
200: '#1f1f1f',
|
|
111
|
+
300: '#3d3d3d',
|
|
112
|
+
400: '#5c5c5c',
|
|
113
|
+
500: '#7a7a7a',
|
|
114
|
+
600: '#999999',
|
|
115
|
+
700: '#b8b8b8',
|
|
116
|
+
800: '#d6d6d6',
|
|
117
|
+
900: '#f5f5f5',
|
|
118
|
+
},
|
|
119
|
+
light: {
|
|
120
|
+
100: '#ffffff',
|
|
121
|
+
200: '#e0e0e0',
|
|
122
|
+
300: '#c2c2c2',
|
|
123
|
+
400: '#a3a3a3',
|
|
124
|
+
500: '#858585',
|
|
125
|
+
600: '#666666',
|
|
126
|
+
700: '#474747',
|
|
127
|
+
800: '#292929',
|
|
128
|
+
900: '#0a0a0a',
|
|
129
|
+
},
|
|
130
|
+
'shade-dark': {
|
|
131
|
+
100: 'rgba(0, 0, 0, 0.1)',
|
|
132
|
+
200: 'rgba(0, 0, 0, 0.2)',
|
|
133
|
+
300: 'rgba(0, 0, 0, 0.3)',
|
|
134
|
+
400: 'rgba(0, 0, 0, 0.4)',
|
|
135
|
+
500: 'rgba(0, 0, 0, 0.5)',
|
|
136
|
+
600: 'rgba(0, 0, 0, 0.6)',
|
|
137
|
+
700: 'rgba(0, 0, 0, 0.7)',
|
|
138
|
+
800: 'rgba(0, 0, 0, 0.8)',
|
|
139
|
+
900: 'rgba(0, 0, 0, 0.9)',
|
|
140
|
+
},
|
|
141
|
+
'shade-light': {
|
|
142
|
+
100: 'rgba(255, 255, 255, 0.1)',
|
|
143
|
+
200: 'rgba(255, 255, 255, 0.2)',
|
|
144
|
+
300: 'rgba(255, 255, 255, 0.3)',
|
|
145
|
+
400: 'rgba(255, 255, 255, 0.4)',
|
|
146
|
+
500: 'rgba(255, 255, 255, 0.5)',
|
|
147
|
+
600: 'rgba(255, 255, 255, 0.6)',
|
|
148
|
+
700: 'rgba(255, 255, 255, 0.7)',
|
|
149
|
+
800: 'rgba(255, 255, 255, 0.8)',
|
|
150
|
+
900: 'rgba(255, 255, 255, 0.9)',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
animation: {
|
|
154
|
+
overlayShow: 'overlayShow 0.25s ease-in-out',
|
|
155
|
+
contentShow: 'contentShow 0.25s ease-in-out',
|
|
156
|
+
},
|
|
157
|
+
keyframes: {
|
|
158
|
+
overlayShow: {
|
|
159
|
+
from: { opacity: 0 },
|
|
160
|
+
to: { opacity: 1 }
|
|
161
|
+
},
|
|
162
|
+
contentShow: {
|
|
163
|
+
from: {
|
|
164
|
+
opacity: 0,
|
|
165
|
+
transform: 'translate(-50%, -48%) scale(0.96)'
|
|
166
|
+
},
|
|
167
|
+
to: {
|
|
168
|
+
opacity: 1,
|
|
169
|
+
transform: 'translate(-50%, -50%) scale(1)'
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as useClickOutside } from './useClickOutside'
|
|
2
|
+
export { default as useIsClient } from './useIsClient'
|
|
3
|
+
export { default as useIsMounted } from './useIsMounted'
|
|
4
|
+
export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
|
|
5
|
+
export { default as useMergeRefs } from './useMergeRefs'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** libs */
|
|
2
|
+
import React, { useEffect, useCallback, RefObject } from 'react'
|
|
3
|
+
|
|
4
|
+
type Event = MouseEvent | TouchEvent
|
|
5
|
+
|
|
6
|
+
const useClickOutside = (refs: RefObject<Element | null>[], handler: (event: Event) => void): void => {
|
|
7
|
+
const listener = useCallback(
|
|
8
|
+
(event: Event) => {
|
|
9
|
+
const results: boolean[] = refs.map((ref) => {
|
|
10
|
+
const el = ref?.current
|
|
11
|
+
return !el || el.contains(event.target as Node) ? true : false
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
if (results.includes(true)) return
|
|
15
|
+
|
|
16
|
+
/** Call the handler only if the click is outside of the element passed. */
|
|
17
|
+
handler(event)
|
|
18
|
+
},
|
|
19
|
+
[handler, refs],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
document.addEventListener('mousedown', listener)
|
|
24
|
+
document.addEventListener('touchstart', listener)
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
document.removeEventListener('mousedown', listener)
|
|
28
|
+
document.removeEventListener('touchstart', listener)
|
|
29
|
+
}
|
|
30
|
+
}, [listener])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default useClickOutside
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
const useIsClient = (): boolean => {
|
|
4
|
+
const [isClient, setClient] = useState<boolean>(false)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setClient(true)
|
|
8
|
+
}, [])
|
|
9
|
+
|
|
10
|
+
return isClient
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default useIsClient
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
const useIsMounted = (): () => boolean => {
|
|
4
|
+
const isMounted = useRef<boolean>(false)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
isMounted.current = true
|
|
8
|
+
|
|
9
|
+
return () => {
|
|
10
|
+
isMounted.current = false
|
|
11
|
+
}
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
return useCallback(() => isMounted.current, [])
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default useIsMounted
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { MutableRefObject, LegacyRef, RefCallback } from 'react'
|
|
2
|
+
|
|
3
|
+
const useMergeRefs = <T = any>(refs: Array<LegacyRef<T> | MutableRefObject<T>>): RefCallback<T> => {
|
|
4
|
+
return (value) => {
|
|
5
|
+
refs?.forEach((ref) => {
|
|
6
|
+
if (typeof ref === 'function') {
|
|
7
|
+
ref(value)
|
|
8
|
+
} else if (ref != null) {
|
|
9
|
+
;(ref as MutableRefObject<T | null>).current = value
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default useMergeRefs
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as useClickOutside } from './useClickOutside';
|
|
2
|
+
export { default as useIsClient } from './useIsClient';
|
|
3
|
+
export { default as useIsMounted } from './useIsMounted';
|
|
4
|
+
export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
|
5
|
+
export { default as useMergeRefs } from './useMergeRefs';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** components */
|
|
2
|
+
import Button from './components/Button';
|
|
3
|
+
import Icon from './components/Icon';
|
|
4
|
+
import Typo from './components/Typo';
|
|
5
|
+
import Dialog from './components/Dialog';
|
|
6
|
+
import Chip from './components/Chip';
|
|
7
|
+
/** constance */
|
|
8
|
+
import { ButtonSizeList, ButtonVariantList } from './constance/Button';
|
|
9
|
+
import { IconColors, IconLists, IconSizes } from './constance/Icon';
|
|
10
|
+
/** types */
|
|
11
|
+
import type { ButtonSizeType, ButtonVariantType, CommonButtonType, ConditionButtonIconType } from './types/Button';
|
|
12
|
+
import type { IconType, IconSizeType, IconColorType } from './types/Icon';
|
|
13
|
+
export {
|
|
14
|
+
/** components */
|
|
15
|
+
Button, Icon, Typo, Dialog, Chip,
|
|
16
|
+
/** constance */
|
|
17
|
+
ButtonSizeList, ButtonVariantList, IconColors, IconLists, IconSizes, };
|
|
18
|
+
/** Type */
|
|
19
|
+
export type { ButtonSizeType, ButtonVariantType, CommonButtonType, ConditionButtonIconType, IconType, IconSizeType, IconColorType, };
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.css';
|