@bds-web/ui 1.0.0
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/dist/ArrowIcon/index.d.ts +2 -0
- package/dist/ArrowIcon/index.d.ts.map +1 -0
- package/dist/ArrowIcon/index.js +1 -0
- package/dist/ArrowIcon/ui/index.d.ts +2 -0
- package/dist/ArrowIcon/ui/index.d.ts.map +1 -0
- package/dist/ArrowIcon/ui/index.js +5 -0
- package/dist/Button/index.d.ts +3 -0
- package/dist/Button/index.d.ts.map +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/types/props.d.ts +8 -0
- package/dist/Button/types/props.d.ts.map +1 -0
- package/dist/Button/types/props.js +1 -0
- package/dist/Button/ui/index.d.ts +3 -0
- package/dist/Button/ui/index.d.ts.map +1 -0
- package/dist/Button/ui/index.js +7 -0
- package/dist/Button/ui/style.d.ts +9 -0
- package/dist/Button/ui/style.d.ts.map +1 -0
- package/dist/Button/ui/style.js +18 -0
- package/dist/Button/utils/get-size.d.ts +3 -0
- package/dist/Button/utils/get-size.d.ts.map +1 -0
- package/dist/Button/utils/get-size.js +8 -0
- package/dist/Button/utils/get-style.d.ts +3 -0
- package/dist/Button/utils/get-style.d.ts.map +1 -0
- package/dist/Button/utils/get-style.js +79 -0
- package/dist/CloseIcon/index.d.ts +2 -0
- package/dist/CloseIcon/index.d.ts.map +1 -0
- package/dist/CloseIcon/index.js +1 -0
- package/dist/CloseIcon/ui/index.d.ts +6 -0
- package/dist/CloseIcon/ui/index.d.ts.map +1 -0
- package/dist/CloseIcon/ui/index.js +5 -0
- package/dist/Dropdown/hooks/useDropdown.d.ts +7 -0
- package/dist/Dropdown/hooks/useDropdown.d.ts.map +1 -0
- package/dist/Dropdown/hooks/useDropdown.js +19 -0
- package/dist/Dropdown/hooks/useOutsideClick.d.ts +2 -0
- package/dist/Dropdown/hooks/useOutsideClick.d.ts.map +1 -0
- package/dist/Dropdown/hooks/useOutsideClick.js +21 -0
- package/dist/Dropdown/index.d.ts +4 -0
- package/dist/Dropdown/index.d.ts.map +1 -0
- package/dist/Dropdown/index.js +3 -0
- package/dist/Dropdown/types/dropdown-item.d.ts +5 -0
- package/dist/Dropdown/types/dropdown-item.d.ts.map +1 -0
- package/dist/Dropdown/types/dropdown-item.js +1 -0
- package/dist/Dropdown/types/props.d.ts +10 -0
- package/dist/Dropdown/types/props.d.ts.map +1 -0
- package/dist/Dropdown/types/props.js +1 -0
- package/dist/Dropdown/ui/index.d.ts +3 -0
- package/dist/Dropdown/ui/index.d.ts.map +1 -0
- package/dist/Dropdown/ui/index.js +11 -0
- package/dist/Dropdown/ui/style.d.ts +31 -0
- package/dist/Dropdown/ui/style.d.ts.map +1 -0
- package/dist/Dropdown/ui/style.js +60 -0
- package/dist/Dropdown/utils/get-style.d.ts +3 -0
- package/dist/Dropdown/utils/get-style.d.ts.map +1 -0
- package/dist/Dropdown/utils/get-style.js +29 -0
- package/dist/Modal/hooks/useModal.d.ts +8 -0
- package/dist/Modal/hooks/useModal.d.ts.map +1 -0
- package/dist/Modal/hooks/useModal.js +50 -0
- package/dist/Modal/hooks/useModalStore.d.ts +12 -0
- package/dist/Modal/hooks/useModalStore.d.ts.map +1 -0
- package/dist/Modal/hooks/useModalStore.js +33 -0
- package/dist/Modal/index.d.ts +4 -0
- package/dist/Modal/index.d.ts.map +1 -0
- package/dist/Modal/index.js +3 -0
- package/dist/Modal/types/modal-item.d.ts +9 -0
- package/dist/Modal/types/modal-item.d.ts.map +1 -0
- package/dist/Modal/types/modal-item.js +1 -0
- package/dist/Modal/types/props.d.ts +4 -0
- package/dist/Modal/types/props.d.ts.map +1 -0
- package/dist/Modal/types/props.js +1 -0
- package/dist/Modal/ui/index.d.ts +3 -0
- package/dist/Modal/ui/index.d.ts.map +1 -0
- package/dist/Modal/ui/index.js +12 -0
- package/dist/Modal/ui/style.d.ts +19 -0
- package/dist/Modal/ui/style.d.ts.map +1 -0
- package/dist/Modal/ui/style.js +61 -0
- package/dist/Modal/utils/modal.d.ts +7 -0
- package/dist/Modal/utils/modal.d.ts.map +1 -0
- package/dist/Modal/utils/modal.js +12 -0
- package/dist/TextInput/index.d.ts +3 -0
- package/dist/TextInput/index.d.ts.map +1 -0
- package/dist/TextInput/index.js +2 -0
- package/dist/TextInput/types/props.d.ts +5 -0
- package/dist/TextInput/types/props.d.ts.map +1 -0
- package/dist/TextInput/types/props.js +1 -0
- package/dist/TextInput/ui/index.d.ts +3 -0
- package/dist/TextInput/ui/index.d.ts.map +1 -0
- package/dist/TextInput/ui/index.js +6 -0
- package/dist/TextInput/ui/style.d.ts +19 -0
- package/dist/TextInput/ui/style.d.ts.map +1 -0
- package/dist/TextInput/ui/style.js +50 -0
- package/dist/TriangleIcon/index.d.ts +2 -0
- package/dist/TriangleIcon/index.d.ts.map +1 -0
- package/dist/TriangleIcon/index.js +1 -0
- package/dist/TriangleIcon/ui/index.d.ts +2 -0
- package/dist/TriangleIcon/ui/index.d.ts.map +1 -0
- package/dist/TriangleIcon/ui/index.js +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/next/BdsRegistry.d.ts +4 -0
- package/dist/next/BdsRegistry.d.ts.map +1 -0
- package/dist/next/BdsRegistry.js +20 -0
- package/dist/next/index.d.ts +2 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ArrowIcon/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ArrowIcon/ui/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,+CAgBrB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export const ArrowIcon = () => {
|
|
4
|
+
return (_jsx("svg", { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.146894 0.146894C0.193339 0.100331 0.248515 0.0633878 0.30926 0.0381813C0.370005 0.0129749 0.435126 0 0.500894 0C0.566661 0 0.631782 0.0129749 0.692527 0.0381813C0.753272 0.0633878 0.808448 0.100331 0.854894 0.146894L6.85489 6.14689C6.90146 6.19334 6.9384 6.24852 6.96361 6.30926C6.98881 6.37001 7.00179 6.43513 7.00179 6.50089C7.00179 6.56666 6.98881 6.63178 6.96361 6.69253C6.9384 6.75327 6.90146 6.80845 6.85489 6.85489L0.854894 12.8549C0.761007 12.9488 0.633669 13.0015 0.500894 13.0015C0.368118 13.0015 0.24078 12.9488 0.146894 12.8549C0.0530069 12.761 0.000261784 12.6337 0.000261784 12.5009C0.000261784 12.3681 0.0530069 12.2408 0.146894 12.1469L5.79389 6.50089L0.146894 0.854894C0.10033 0.808448 0.0633873 0.753273 0.0381808 0.692528C0.0129744 0.631782 0 0.566661 0 0.500894C0 0.435127 0.0129744 0.370005 0.0381808 0.30926C0.0633873 0.248515 0.10033 0.19334 0.146894 0.146894Z", fill: "currentColor" }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Button/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ButtonType = "primary" | "secondary" | "ghost" | "text" | "danger";
|
|
2
|
+
export type ButtonSize = "small" | "medium" | "large";
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
buttonType?: ButtonType;
|
|
5
|
+
buttonSize?: ButtonSize;
|
|
6
|
+
showIcon?: boolean;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Button/types/props.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Button/ui/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,eAAO,MAAM,MAAM,GAAI,0DAMpB,WAAW,4CAOb,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as S from "./style";
|
|
4
|
+
import { ArrowIcon } from "../../ArrowIcon";
|
|
5
|
+
export const Button = ({ buttonSize = "small", buttonType = "primary", showIcon = false, children, ...props }) => {
|
|
6
|
+
return (_jsxs(S.Button, { "$buttonSize": buttonSize, "$buttonType": buttonType, ...props, children: [children, showIcon && _jsx(ArrowIcon, {})] }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonSize, ButtonType } from "../types/props";
|
|
2
|
+
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
} & {
|
|
6
|
+
$buttonType: ButtonType;
|
|
7
|
+
$buttonSize: ButtonSize;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
9
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/Button/ui/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMxD,eAAO,MAAM,MAAM;;;;iBACJ,UAAU;iBACV,UAAU;qHAaxB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { getStyle } from "../utils/get-style";
|
|
3
|
+
import { getSize } from "../utils/get-size";
|
|
4
|
+
import { typoCss } from "@bds-web/typography";
|
|
5
|
+
import { shapes } from "@bds-web/shapes";
|
|
6
|
+
export const Button = styled.button `
|
|
7
|
+
${typoCss("Caption2")};
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
${({ $buttonType }) => getStyle($buttonType)};
|
|
10
|
+
height: ${({ $buttonSize }) => getSize($buttonSize)};
|
|
11
|
+
padding: 12px ${({ $buttonSize }) => getSize($buttonSize)};
|
|
12
|
+
border-radius: ${shapes.medium};
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
gap: 10px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-size.d.ts","sourceRoot":"","sources":["../../../src/Button/utils/get-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAQ3C,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,6BAEvC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-style.d.ts","sourceRoot":"","sources":["../../../src/Button/utils/get-style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6D5C,eAAO,MAAM,QAAQ,GAAI,YAAY,UAAU,8CA+B9C,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { colors } from "@bds-web/colors";
|
|
2
|
+
import { css } from "@emotion/react";
|
|
3
|
+
const bg = {
|
|
4
|
+
enabled: {
|
|
5
|
+
primary: colors.blue.light,
|
|
6
|
+
secondary: colors.green.light,
|
|
7
|
+
ghost: "transparent",
|
|
8
|
+
text: "transparent",
|
|
9
|
+
danger: colors.red.light,
|
|
10
|
+
},
|
|
11
|
+
hover: {
|
|
12
|
+
primary: colors.blue.dark,
|
|
13
|
+
secondary: colors.green.dark,
|
|
14
|
+
ghost: "transparent",
|
|
15
|
+
text: colors.greyScale[10],
|
|
16
|
+
danger: colors.red.dark,
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
primary: colors.greyScale[40],
|
|
20
|
+
secondary: colors.greyScale[40],
|
|
21
|
+
ghost: "transparent",
|
|
22
|
+
text: "transparent",
|
|
23
|
+
danger: colors.greyScale[40],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const text = {
|
|
27
|
+
enabled: {
|
|
28
|
+
primary: colors.static.white,
|
|
29
|
+
secondary: colors.static.white,
|
|
30
|
+
ghost: colors.blue.light,
|
|
31
|
+
text: colors.blue.light,
|
|
32
|
+
danger: colors.static.white,
|
|
33
|
+
},
|
|
34
|
+
hover: {
|
|
35
|
+
primary: colors.static.white,
|
|
36
|
+
secondary: colors.static.white,
|
|
37
|
+
ghost: colors.blue.light,
|
|
38
|
+
text: colors.blue.light,
|
|
39
|
+
danger: colors.static.white,
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
primary: colors.greyScale[50],
|
|
43
|
+
secondary: colors.greyScale[50],
|
|
44
|
+
ghost: colors.greyScale[20],
|
|
45
|
+
text: colors.greyScale[20],
|
|
46
|
+
danger: colors.greyScale[50],
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const border = {
|
|
50
|
+
enabled: colors.blue.light,
|
|
51
|
+
hover: colors.blue.dark,
|
|
52
|
+
disabled: colors.greyScale[20],
|
|
53
|
+
};
|
|
54
|
+
export const getStyle = (buttonType) => {
|
|
55
|
+
return css `
|
|
56
|
+
background-color: ${bg.enabled[buttonType]};
|
|
57
|
+
color: ${text.enabled[buttonType]};
|
|
58
|
+
border: ${buttonType === "ghost"
|
|
59
|
+
? `1px solid ${border.enabled}`
|
|
60
|
+
: "none"};
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background-color: ${bg.hover[buttonType]};
|
|
64
|
+
color: ${text.hover[buttonType]};
|
|
65
|
+
border: ${buttonType === "ghost"
|
|
66
|
+
? `1px solid ${border.hover}`
|
|
67
|
+
: "none"};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:disabled {
|
|
71
|
+
background-color: ${bg.disabled[buttonType]};
|
|
72
|
+
color: ${text.disabled[buttonType]};
|
|
73
|
+
border: ${buttonType === "ghost"
|
|
74
|
+
? `1px solid ${border.disabled}`
|
|
75
|
+
: "none"};
|
|
76
|
+
cursor: not-allowed;
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/CloseIcon/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/CloseIcon/ui/index.tsx"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,GAAI,aAAa,KAAK,4CAiB3C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export const CloseIcon = ({ onClose }) => {
|
|
4
|
+
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", onClick: onClose, style: { cursor: onClose ? "pointer" : "default" }, children: _jsx("path", { d: "M1.6 16L0 14.4L6.4 8L0 1.6L1.6 0L8 6.4L14.4 0L16 1.6L9.6 8L16 14.4L14.4 16L8 9.6L1.6 16Z", fill: "currentColor" }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDropdown.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/hooks/useDropdown.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;CAqBvB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
export const useDropdown = () => {
|
|
3
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
4
|
+
const openDropdown = useCallback(() => {
|
|
5
|
+
setIsOpen(true);
|
|
6
|
+
}, []);
|
|
7
|
+
const closeDropdown = useCallback(() => {
|
|
8
|
+
setIsOpen(false);
|
|
9
|
+
}, []);
|
|
10
|
+
const toggleDropdown = useCallback(() => {
|
|
11
|
+
setIsOpen((prev) => !prev);
|
|
12
|
+
}, []);
|
|
13
|
+
return {
|
|
14
|
+
isOpen,
|
|
15
|
+
openDropdown,
|
|
16
|
+
closeDropdown,
|
|
17
|
+
toggleDropdown,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOutsideClick.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/hooks/useOutsideClick.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,QAAQ,OAAO,EAAE,eAAe,MAAM,IAAI,qDAoBzE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
export const useOutsideClick = (isOpen, closeDropdown) => {
|
|
3
|
+
const containerRef = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!isOpen)
|
|
6
|
+
return;
|
|
7
|
+
const onPointerDown = (event) => {
|
|
8
|
+
const target = event.target;
|
|
9
|
+
const container = containerRef.current;
|
|
10
|
+
if (!container || !target)
|
|
11
|
+
return;
|
|
12
|
+
if (!container.contains(target))
|
|
13
|
+
closeDropdown();
|
|
14
|
+
};
|
|
15
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
16
|
+
return () => {
|
|
17
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
18
|
+
};
|
|
19
|
+
}, [isOpen, closeDropdown]);
|
|
20
|
+
return containerRef;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Dropdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,MAAM,CAAC;AACrB,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-item.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/types/dropdown-item.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DropdownItem } from "./dropdown-item";
|
|
2
|
+
export type DropdownSize = "small" | "medium" | "large";
|
|
3
|
+
export interface DropdownProps {
|
|
4
|
+
dropdownSize?: DropdownSize;
|
|
5
|
+
options: DropdownItem[];
|
|
6
|
+
selected: DropdownItem | null;
|
|
7
|
+
onSelect: (item: DropdownItem | null) => void;
|
|
8
|
+
width?: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/ui/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,eAAO,MAAM,QAAQ,GAAI,uDAMtB,aAAa,4CA+Bf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { TriangleIcon } from "../../TriangleIcon";
|
|
4
|
+
import { useDropdown } from "../hooks/useDropdown";
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
import { useOutsideClick } from "../hooks/useOutsideClick";
|
|
7
|
+
export const Dropdown = ({ dropdownSize = "small", onSelect, options, selected, width = "auto", }) => {
|
|
8
|
+
const { isOpen, closeDropdown, toggleDropdown } = useDropdown();
|
|
9
|
+
const containerRef = useOutsideClick(isOpen, closeDropdown);
|
|
10
|
+
return (_jsxs(S.Container, { ref: containerRef, "$size": dropdownSize, "$width": width, onClick: toggleDropdown, children: [_jsxs(S.SelectedItem, { children: [_jsx(S.SelectedText, { children: selected ? selected.name : "선택해주세요." }), _jsx(TriangleIcon, {})] }), isOpen && (_jsx(S.OptionsList, { "$size": dropdownSize, "$isOpen": true, children: options.map((option, idx) => (_jsx(S.OptionItem, { "$isSelected": selected?.value === option.value, "$size": dropdownSize, onClick: () => onSelect(option), children: option.name }, idx))) }))] }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DropdownSize } from "../types/props";
|
|
2
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
} & {
|
|
6
|
+
$size: DropdownSize;
|
|
7
|
+
$width: string;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
export declare const SelectedItem: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
export declare const SelectedText: import("@emotion/styled").StyledComponent<{
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
17
|
+
export declare const OptionsList: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
} & {
|
|
21
|
+
$size: DropdownSize;
|
|
22
|
+
$isOpen: boolean;
|
|
23
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
24
|
+
export declare const OptionItem: import("@emotion/styled").StyledComponent<{
|
|
25
|
+
theme?: import("@emotion/react").Theme;
|
|
26
|
+
as?: React.ElementType;
|
|
27
|
+
} & {
|
|
28
|
+
$size: DropdownSize;
|
|
29
|
+
$isSelected: boolean;
|
|
30
|
+
}, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
31
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/ui/style.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,eAAO,MAAM,SAAS;;;;WAAuB,YAAY;YAAU,MAAM;yGASxE,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAOxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;2GAIxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;WAAsB,YAAY;aAAW,OAAO;6GAkB3E,CAAC;AAEF,eAAO,MAAM,UAAU;;;;WACd,YAAY;iBACN,OAAO;yGAerB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { shapes } from "@bds-web/shapes";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { getStyle } from "../utils/get-style";
|
|
4
|
+
import { colors } from "@bds-web/colors";
|
|
5
|
+
import { typoCss } from "@bds-web/typography";
|
|
6
|
+
export const Container = styled.div `
|
|
7
|
+
border-radius: ${shapes.large};
|
|
8
|
+
padding: 0 20px;
|
|
9
|
+
${({ $size }) => getStyle($size)};
|
|
10
|
+
width: ${({ $width }) => $width};
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
position: relative;
|
|
13
|
+
user-select: none;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
`;
|
|
16
|
+
export const SelectedItem = styled.div `
|
|
17
|
+
width: 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
height: 100%;
|
|
22
|
+
user-select: none;
|
|
23
|
+
`;
|
|
24
|
+
export const SelectedText = styled.span `
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
`;
|
|
29
|
+
export const OptionsList = styled.ul `
|
|
30
|
+
min-width: calc(100% + 2px);
|
|
31
|
+
background-color: ${colors.static.white};
|
|
32
|
+
border-radius: ${shapes.large};
|
|
33
|
+
${({ $size }) => $size === "small"
|
|
34
|
+
? `
|
|
35
|
+
border: 1px solid ${colors.greyScale[20]};
|
|
36
|
+
`
|
|
37
|
+
: `
|
|
38
|
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
|
|
39
|
+
`};
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: calc(100% + ${({ $size }) => ($size === "small" ? "4px" : "10px")});
|
|
42
|
+
left: -1px;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
z-index: ${({ $isOpen }) => ($isOpen ? 100 : -1)};
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
`;
|
|
47
|
+
export const OptionItem = styled.li `
|
|
48
|
+
padding: 0 12px;
|
|
49
|
+
height: ${({ $size }) => ($size === "small" ? "28px" : "36px")};
|
|
50
|
+
${typoCss("Body")};
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
background-color: ${({ $isSelected }) => $isSelected ? colors.greyScale[10] : "transparent"};
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
background-color: ${colors.greyScale[10]};
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-style.d.ts","sourceRoot":"","sources":["../../../src/Dropdown/utils/get-style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA8B9C,eAAO,MAAM,QAAQ,GAAI,MAAM,YAAY,8CAE1C,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
2
|
+
import { colors } from "@bds-web/colors";
|
|
3
|
+
import { typoCss } from "@bds-web/typography";
|
|
4
|
+
const map = {
|
|
5
|
+
small: css `
|
|
6
|
+
min-width: 98px;
|
|
7
|
+
border: 1px solid ${colors.greyScale[20]};
|
|
8
|
+
background-color: ${colors.static.white};
|
|
9
|
+
height: 28px;
|
|
10
|
+
${typoCss("Body")};
|
|
11
|
+
`,
|
|
12
|
+
medium: css `
|
|
13
|
+
min-width: 152px;
|
|
14
|
+
box-shadow: 0 2px 4px 0px rgba(0, 0, 0, 0.05);
|
|
15
|
+
background-color: ${colors.static.white};
|
|
16
|
+
height: 36px;
|
|
17
|
+
${typoCss("Body")};
|
|
18
|
+
`,
|
|
19
|
+
large: css `
|
|
20
|
+
min-width: 164px;
|
|
21
|
+
box-shadow: 0 2px 4px 0px rgba(0, 0, 0, 0.05);
|
|
22
|
+
background-color: ${colors.static.white};
|
|
23
|
+
height: 48px;
|
|
24
|
+
${typoCss("H4")};
|
|
25
|
+
`
|
|
26
|
+
};
|
|
27
|
+
export const getStyle = (size) => {
|
|
28
|
+
return map[size];
|
|
29
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useModal: () => {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
content: import("../types/modal-item").Modal | null;
|
|
4
|
+
modals: import("../types/modal-item").ModalItem[];
|
|
5
|
+
closeModal: () => void;
|
|
6
|
+
mountedRoot: HTMLElement | null;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../../src/Modal/hooks/useModal.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;CAoDpB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useModalStore } from "./useModalStore";
|
|
4
|
+
export const useModal = () => {
|
|
5
|
+
const { isOpen, content, modals, closeModal } = useModalStore();
|
|
6
|
+
const [mountedRoot, setMountedRoot] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let modalRoot = document.getElementById("dds-dialog-root");
|
|
9
|
+
if (!modalRoot) {
|
|
10
|
+
modalRoot = document.createElement("div");
|
|
11
|
+
modalRoot.id = "dds-dialog-root";
|
|
12
|
+
document.body.appendChild(modalRoot);
|
|
13
|
+
}
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
setMountedRoot(modalRoot);
|
|
16
|
+
}, 0);
|
|
17
|
+
return () => {
|
|
18
|
+
if (modalRoot && modalRoot.childNodes.length === 0) {
|
|
19
|
+
modalRoot.remove();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (modals.length > 0) {
|
|
25
|
+
document.body.style.overflow = "hidden";
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
document.body.style.overflow = "";
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
document.body.style.overflow = "";
|
|
32
|
+
};
|
|
33
|
+
}, [modals.length]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const handleEscape = (e) => {
|
|
36
|
+
if (e.key === "Escape" && modals.length > 0) {
|
|
37
|
+
closeModal();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
window.addEventListener("keydown", handleEscape);
|
|
41
|
+
return () => window.removeEventListener("keydown", handleEscape);
|
|
42
|
+
}, [modals.length, closeModal]);
|
|
43
|
+
return {
|
|
44
|
+
isOpen,
|
|
45
|
+
content,
|
|
46
|
+
modals,
|
|
47
|
+
closeModal,
|
|
48
|
+
mountedRoot,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Modal, ModalItem } from "../types/modal-item";
|
|
2
|
+
interface ModalState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
content: Modal | null;
|
|
5
|
+
modals: ModalItem[];
|
|
6
|
+
openModal: (content: Modal) => void;
|
|
7
|
+
closeModal: () => void;
|
|
8
|
+
closeAllModal: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const useModalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ModalState>>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=useModalStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalStore.d.ts","sourceRoot":"","sources":["../../../src/Modal/hooks/useModalStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvD,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,yEA6BvB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
export const useModalStore = create((set, get) => ({
|
|
4
|
+
isOpen: false,
|
|
5
|
+
content: null,
|
|
6
|
+
modals: [],
|
|
7
|
+
openModal: (content) => {
|
|
8
|
+
const id = crypto.randomUUID();
|
|
9
|
+
const newModals = [...get().modals, { id, content }];
|
|
10
|
+
set({
|
|
11
|
+
isOpen: true,
|
|
12
|
+
content: newModals[newModals.length - 1].content,
|
|
13
|
+
modals: newModals,
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
closeModal: () => {
|
|
17
|
+
const currentModals = get().modals;
|
|
18
|
+
if (currentModals.length <= 1) {
|
|
19
|
+
set({ isOpen: false, content: null, modals: [] });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const newModals = currentModals.slice(0, -1);
|
|
23
|
+
set({
|
|
24
|
+
isOpen: true,
|
|
25
|
+
content: newModals[newModals.length - 1].content,
|
|
26
|
+
modals: newModals,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
closeAllModal: () => {
|
|
31
|
+
set({ isOpen: false, content: null, modals: [] });
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modal/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal-item.d.ts","sourceRoot":"","sources":["../../../src/Modal/types/modal-item.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Modal/types/props.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Modal/ui/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,eAAO,MAAM,aAAa,GAAI,gBAAwB,kBAAkB,uCAwBvE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useModal } from "../hooks/useModal";
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
import { CloseIcon } from "../../CloseIcon";
|
|
7
|
+
export const ModalProvider = ({ baseZIndex = 10000 }) => {
|
|
8
|
+
const { modals, closeModal, mountedRoot } = useModal();
|
|
9
|
+
if (modals.length === 0 || !mountedRoot)
|
|
10
|
+
return null;
|
|
11
|
+
return createPortal(_jsx(_Fragment, { children: modals.map((modal, index) => (_jsx(S.Overlay, { "$zIndex": baseZIndex + index, onClick: index === modals.length - 1 ? closeModal : undefined, children: _jsxs(S.Modal, { onClick: (e) => e.stopPropagation(), children: [_jsxs(S.ModalHeader, { children: [_jsx(S.ModalTitle, { children: modal.content.title }), _jsx(CloseIcon, { onClose: closeModal })] }), modal.content.content] }) }, modal.id))) }), mountedRoot);
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const Overlay: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
} & {
|
|
5
|
+
$zIndex: number;
|
|
6
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
+
export declare const Modal: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme;
|
|
9
|
+
as?: React.ElementType;
|
|
10
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
11
|
+
export declare const ModalHeader: import("@emotion/styled").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
15
|
+
export declare const ModalTitle: import("@emotion/styled").StyledComponent<{
|
|
16
|
+
theme?: import("@emotion/react").Theme;
|
|
17
|
+
as?: React.ElementType;
|
|
18
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>;
|
|
19
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/Modal/ui/style.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO;;;;aAAyB,MAAM;yGASlD,CAAC;AAEF,eAAO,MAAM,KAAK;;;yGAyBjB,CAAC;AAEF,eAAO,MAAM,WAAW;;;yGAMvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;iHAItB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { colors } from "@bds-web/colors";
|
|
2
|
+
import { shapes } from "@bds-web/shapes";
|
|
3
|
+
import { typoCss } from "@bds-web/typography";
|
|
4
|
+
import { keyframes } from "@emotion/react";
|
|
5
|
+
import styled from "@emotion/styled";
|
|
6
|
+
const fadeIn = keyframes `
|
|
7
|
+
from { opacity: 0; }
|
|
8
|
+
to { opacity: 1; }
|
|
9
|
+
`;
|
|
10
|
+
const slideUp = keyframes `
|
|
11
|
+
from { opacity: 0; transform: translateY(20px); }
|
|
12
|
+
to { opacity: 1; transform: translateY(0); }
|
|
13
|
+
`;
|
|
14
|
+
export const Overlay = styled.div `
|
|
15
|
+
position: fixed;
|
|
16
|
+
inset: 0;
|
|
17
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
z-index: ${({ $zIndex }) => $zIndex};
|
|
22
|
+
animation: ${fadeIn} 300ms ease-out;
|
|
23
|
+
`;
|
|
24
|
+
export const Modal = styled.div `
|
|
25
|
+
position: relative;
|
|
26
|
+
background: ${colors.static.white};
|
|
27
|
+
border-radius: ${shapes.large};
|
|
28
|
+
padding: 20px;
|
|
29
|
+
max-height: 90vh;
|
|
30
|
+
overflow-y: auto;
|
|
31
|
+
animation: ${slideUp} 300ms ease-out;
|
|
32
|
+
|
|
33
|
+
&::-webkit-scrollbar {
|
|
34
|
+
width: 6px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::-webkit-scrollbar-track {
|
|
38
|
+
background: transparent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&::-webkit-scrollbar-thumb {
|
|
42
|
+
background: rgba(0, 0, 0, 0.2);
|
|
43
|
+
border-radius: 3px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
47
|
+
background: rgba(0, 0, 0, 0.3);
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
export const ModalHeader = styled.div `
|
|
51
|
+
min-width: 360px;
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
align-items: center;
|
|
55
|
+
margin-bottom: 10px;
|
|
56
|
+
`;
|
|
57
|
+
export const ModalTitle = styled.h2 `
|
|
58
|
+
${typoCss("Accent")};
|
|
59
|
+
color: ${colors.static.black};
|
|
60
|
+
margin: 0;
|
|
61
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/utils/modal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,KAAK;oBACA,KAAK,KAAG,IAAI;iBAGjB,IAAI;oBAGD,IAAI;CAGnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useModalStore } from "../hooks/useModalStore";
|
|
2
|
+
export const modal = {
|
|
3
|
+
open: (content) => {
|
|
4
|
+
useModalStore.getState().openModal(content);
|
|
5
|
+
},
|
|
6
|
+
close: () => {
|
|
7
|
+
useModalStore.getState().closeModal();
|
|
8
|
+
},
|
|
9
|
+
closeAll: () => {
|
|
10
|
+
useModalStore.getState().closeAllModal();
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TextInput/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/TextInput/types/props.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/TextInput/ui/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,eAAO,MAAM,SAAS,GAAI,mCAAmC,cAAc,4CAQ1E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as S from "./style";
|
|
4
|
+
export const TextInput = ({ label, errorMessage, ...props }) => {
|
|
5
|
+
return (_jsxs(S.Container, { children: [label && _jsx(S.Label, { children: label }), _jsx(S.TextInput, { "$isError": !!errorMessage, ...props }), errorMessage && _jsx(S.ErrorMessage, { children: errorMessage })] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const TextInput: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
} & {
|
|
9
|
+
$isError: boolean;
|
|
10
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
11
|
+
export declare const Label: import("@emotion/styled").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
|
|
15
|
+
export declare const ErrorMessage: import("@emotion/styled").StyledComponent<{
|
|
16
|
+
theme?: import("@emotion/react").Theme;
|
|
17
|
+
as?: React.ElementType;
|
|
18
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
19
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/TextInput/ui/style.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;yGAKrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;cAA4B,OAAO;kHA+BxD,CAAC;AAEF,eAAO,MAAM,KAAK;;;kHAGjB,CAAC;AAEF,eAAO,MAAM,YAAY;;;2GAGxB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { colors } from "@bds-web/colors";
|
|
2
|
+
import { shapes } from "@bds-web/shapes";
|
|
3
|
+
import { typoCss } from "@bds-web/typography";
|
|
4
|
+
import styled from "@emotion/styled";
|
|
5
|
+
export const Container = styled.div `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
`;
|
|
11
|
+
export const TextInput = styled.input `
|
|
12
|
+
${typoCss("Body")};
|
|
13
|
+
height: 48px;
|
|
14
|
+
border-radius: ${shapes.medium};
|
|
15
|
+
background-color: ${colors.static.white};
|
|
16
|
+
outline: none;
|
|
17
|
+
border: 1px solid
|
|
18
|
+
${({ $isError }) => ($isError ? colors.red.light : colors.static.white)};
|
|
19
|
+
padding: 0 16px;
|
|
20
|
+
color: ${colors.static.black};
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
|
|
23
|
+
|
|
24
|
+
&::placeholder {
|
|
25
|
+
color: ${colors.greyScale[60]};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:focus:not(:disabled) {
|
|
29
|
+
border: 1px solid
|
|
30
|
+
${({ $isError }) => ($isError ? colors.red.light : colors.blue.light)};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
border-bottom: 1px solid ${colors.blue.light};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:disabled {
|
|
38
|
+
border: 1px solid ${colors.greyScale[10]};
|
|
39
|
+
background-color: ${colors.greyScale[10]};
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
export const Label = styled.label `
|
|
44
|
+
${typoCss("Caption1")};
|
|
45
|
+
color: ${colors.static.black};
|
|
46
|
+
`;
|
|
47
|
+
export const ErrorMessage = styled.span `
|
|
48
|
+
${typoCss("Caption1")};
|
|
49
|
+
color: ${colors.red.light};
|
|
50
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TriangleIcon/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/TriangleIcon/ui/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,+CAWxB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { colors } from "@bds-web/colors";
|
|
4
|
+
export const TriangleIcon = () => {
|
|
5
|
+
return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M5 10L0 0L10 0L5 10Z", fill: colors.blue.light }) }));
|
|
6
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BdsRegistry.d.ts","sourceRoot":"","sources":["../../src/next/BdsRegistry.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW,GAAI,eAEzB;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,4CAmBA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CacheProvider as EmotionCacheProvider } from '@emotion/react';
|
|
4
|
+
import createCache from '@emotion/cache';
|
|
5
|
+
import { useServerInsertedHTML } from 'next/navigation';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
const CacheProvider = EmotionCacheProvider;
|
|
8
|
+
export const BdsRegistry = ({ children, }) => {
|
|
9
|
+
const [cache] = useState(() => {
|
|
10
|
+
const cache = createCache({ key: 'css' });
|
|
11
|
+
cache.compat = true;
|
|
12
|
+
return cache;
|
|
13
|
+
});
|
|
14
|
+
useServerInsertedHTML(() => {
|
|
15
|
+
return (_jsx("style", { "data-emotion": `${cache.key} ${Object.keys(cache.inserted).join(' ')}`, dangerouslySetInnerHTML: {
|
|
16
|
+
__html: Object.values(cache.inserted).join(' '),
|
|
17
|
+
} }));
|
|
18
|
+
});
|
|
19
|
+
return _jsx(CacheProvider, { value: cache, children: children });
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BdsRegistry";
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bds-web/ui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"prepack": "pnpm run build",
|
|
21
|
+
"typecheck": "tsc -b"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@bds-web/colors": "^1.1.0",
|
|
25
|
+
"@bds-web/shapes": "^1.1.0",
|
|
26
|
+
"@bds-web/themes": "^1.0.0",
|
|
27
|
+
"@bds-web/typography": "^1.1.0",
|
|
28
|
+
"@emotion/react": "^11.14.0",
|
|
29
|
+
"@emotion/styled": "^11.14.1",
|
|
30
|
+
"@emotion/cache": "^11.14.0",
|
|
31
|
+
"lucide-react": "^0.562.0",
|
|
32
|
+
"next": ">=16",
|
|
33
|
+
"react": ">=19",
|
|
34
|
+
"react-dom": ">=19",
|
|
35
|
+
"zustand": "^5.0.10"
|
|
36
|
+
}
|
|
37
|
+
}
|