@team-monolith/cds 0.3.2 → 0.4.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.
@@ -6,7 +6,7 @@ export interface BannerProps {
6
6
  /** 컴포넌트 내 헤드라인으로 표기될 문자열 */
7
7
  headline?: string;
8
8
  /** 컴포넌트 내용으로 표기될 값 */
9
- content: React.ReactNode;
9
+ content?: React.ReactNode;
10
10
  /** 컴포넌트 좌측에 표기될 아이콘 */
11
11
  icon?: React.ReactNode;
12
12
  /** 컴포넌트의 색상 */
@@ -51,7 +51,7 @@ var Banner = React.forwardRef(function (props, ref) {
51
51
  COLOR_TO_STYLE(theme, color),
52
52
  fullWidth
53
53
  ? css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "]))) : css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border-radius: 12px;\n width: fit-content;\n min-width: 343px;\n "], ["\n border-radius: 12px;\n width: fit-content;\n min-width: 343px;\n "]))),
54
- ] }, { children: [icon && _jsx(IconDiv, { children: icon }), _jsxs(TextContainer, __assign({ setPaddingRight: !close && !buttonLabel }, { children: [headline && _jsx(HeadlineDiv, { children: headline }), _jsx("div", { children: content })] })), buttonLabel && (_jsx(BannerButton, __assign({ onClick: onButtonClick }, { children: buttonLabel }))), close && (_jsx(CloseButton, __assign({ onClick: onClose }, { children: _jsx(StyledCloseFillIcon, {}) })))] })));
54
+ ] }, { children: [icon && _jsx(IconDiv, { children: icon }), _jsxs(TextContainer, __assign({ setPaddingRight: !close && !buttonLabel }, { children: [headline && _jsx(HeadlineDiv, { children: headline }), content && _jsx("div", { children: content })] })), buttonLabel && (_jsx(BannerButton, __assign({ onClick: onButtonClick }, { children: buttonLabel }))), close && (_jsx(CloseButton, __assign({ onClick: onClose }, { children: _jsx(StyledCloseFillIcon, {}) })))] })));
55
55
  });
56
56
  var StyledCloseFillIcon = styled(CloseFillIcon)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: block;\n padding: 14px;\n width: 20px;\n height: 20px;\n\n color: currentColor;\n"], ["\n display: block;\n padding: 14px;\n width: 20px;\n height: 20px;\n\n color: currentColor;\n"])));
57
57
  var IconDiv = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 16px 0px 16px 16px;\n"], ["\n display: flex;\n align-items: center;\n padding: 16px 0px 16px 16px;\n"])));
@@ -58,7 +58,7 @@ var SIZE_TO_LABEL_STYLE = {
58
58
  var Button = React.forwardRef(function Button(props, ref) {
59
59
  var className = props.className, _a = props.component, Component = _a === void 0 ? "button" : _a, disabled = props.disabled, color = props.color, size = props.size, startIcon = props.startIcon, endIcon = props.endIcon, label = props.label, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "label"]);
60
60
  var theme = useTheme();
61
- return (_jsxs(Component, __assign({}, other, { className: className, ref: ref, css: [
61
+ return (_jsxs(Component, __assign({ type: "button" }, other, { className: className, ref: ref, css: [
62
62
  css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n\n border: none;\n border-radius: 8px;\n\n cursor: pointer;\n &:disabled {\n cursor: default;\n pointer-events: none;\n }\n\n font: inherit;\n text-decoration: none;\n "], ["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n\n border: none;\n border-radius: 8px;\n\n cursor: pointer;\n &:disabled {\n cursor: default;\n pointer-events: none;\n }\n\n font: inherit;\n text-decoration: none;\n "]))),
63
63
  COLOR_TO_BUTTON_STYLE(theme, color),
64
64
  SIZE_TO_BUTTON_STYLE[size],
@@ -38,7 +38,7 @@ var SIZE_TO_STYLES = function (size) {
38
38
  };
39
39
  export function InputBase(props) {
40
40
  var className = props.className, color = props.color, size = props.size, placeholder = props.placeholder, _a = props.disabled, disabled = _a === void 0 ? false : _a, startIcon = props.startIcon, startLabel = props.startLabel, endLabel = props.endLabel, endIcon = props.endIcon, inputProps = props.inputProps, inputRef = props.inputRef, _b = props.fullWidth, fullWidth = _b === void 0 ? false : _b, onChange = props.onChange, onClear = props.onClear, defaultValue = props.defaultValue, value = props.value;
41
- return (_jsxs(InputContainer, __assign({ className: className, disabled: disabled, color: color, inputSize: size, fullWidth: fullWidth }, { children: [startIcon, startLabel && _jsx("span", { children: startLabel }), _jsx(StyledInput, __assign({}, inputProps, { ref: inputRef, onChange: onChange, placeholder: placeholder, disabled: disabled, defaultValue: defaultValue, value: value })), endLabel && _jsx("span", { children: endLabel }), endIcon, onClear && (_jsx(ClearButton, __assign({ onClick: onClear, disabled: disabled }, { children: _jsx(CloseCircleFillIcon, {}) })))] })));
41
+ return (_jsxs(InputContainer, __assign({ className: className, disabled: disabled, color: color, inputSize: size, fullWidth: fullWidth }, { children: [startIcon, startLabel && _jsx("span", { children: startLabel }), _jsx(StyledInput, __assign({}, inputProps, { ref: inputRef, onChange: onChange, placeholder: placeholder, disabled: disabled, defaultValue: defaultValue, value: value })), endLabel && _jsx("span", { children: endLabel }), endIcon, onClear && (_jsx(ClearButton, __assign({ onClick: onClear, disabled: disabled, tabIndex: -1 }, { children: _jsx(CloseCircleFillIcon, {}) })))] })));
42
42
  }
43
43
  var InputContainer = styled.div(function (_a) {
44
44
  var theme = _a.theme, color = _a.color, inputSize = _a.inputSize, disabled = _a.disabled, fullWidth = _a.fullWidth;
@@ -0,0 +1,70 @@
1
+ import "@emotion/react";
2
+
3
+ interface CodleColors {
4
+ background: {
5
+ neutralBase: string;
6
+ neutralAlt: string;
7
+ neutralAltActive: string;
8
+ neutralAltDisabled: string;
9
+ primary: string;
10
+ primaryActive: string;
11
+ primaryDisabled: string;
12
+ secondary: string;
13
+ secondaryActive: string;
14
+ secondaryDisabled: string;
15
+ danger: string;
16
+ dangerActive: string;
17
+ dangerDisabled: string;
18
+ success: string;
19
+ successActive: string;
20
+ successDisabled: string;
21
+ info: string;
22
+ infoActive: string;
23
+ infoDisabled: string;
24
+ warning: string;
25
+ warningActive: string;
26
+ warningDisabled: string;
27
+ };
28
+ foreground: {
29
+ neutralBase: string;
30
+ neutralBaseDisabled: string;
31
+ neutralAlt: string;
32
+ neutralAltDisabled: string;
33
+ primary: string;
34
+ primaryDisabled: string;
35
+ secondary: string;
36
+ secondaryDisabled: string;
37
+ danger: string;
38
+ dangerDisabled: string;
39
+ success: string;
40
+ successDisabled: string;
41
+ info: string;
42
+ infoDisabled: string;
43
+ warning: string;
44
+ warningDisabled: string;
45
+ };
46
+ container: {
47
+ primaryContainer: string;
48
+ primaryOnContainer: string;
49
+ secondaryContainer: string;
50
+ secondaryOnContainer: string;
51
+ dangerContainer: string;
52
+ dangerOnContainer: string;
53
+ successContainer: string;
54
+ successOnContainer: string;
55
+ infoContainer: string;
56
+ infoOnContainer: string;
57
+ warningContainer: string;
58
+ warningOnContainer: string;
59
+ obsidianContainer: string;
60
+ obsidianOnContainer: string;
61
+ marbleContainer: string;
62
+ marbleOnContainer: string;
63
+ };
64
+ }
65
+
66
+ declare module "@emotion/react" {
67
+ export interface Theme {
68
+ color: CodleColors;
69
+ }
70
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="./svg.d.ts" />
2
+ /// <reference path="./emotion.d.ts" />
1
3
  export * from "./components/AlertDialog";
2
4
  export { default as Banner } from "./components/Banner";
3
5
  export * from "./components/Banner";
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="./svg.d.ts" />
2
+ /// <reference path="./emotion.d.ts" />
1
3
  export * from "./components/AlertDialog";
2
4
  export { default as Banner } from "./components/Banner";
3
5
  export * from "./components/Banner";
package/dist/svg.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ declare module "*.svg" {
2
+ import * as React from "react";
3
+
4
+ export const ReactComponent: React.FunctionComponent<
5
+ React.SVGProps<SVGSVGElement> & { title?: string }
6
+ >;
7
+
8
+ const src: string;
9
+ export default src;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "0.3.2",
3
+ "version": "0.4.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -16,7 +16,7 @@ export interface BannerProps {
16
16
  headline?: string;
17
17
 
18
18
  /** 컴포넌트 내용으로 표기될 값 */
19
- content: React.ReactNode;
19
+ content?: React.ReactNode;
20
20
 
21
21
  /** 컴포넌트 좌측에 표기될 아이콘 */
22
22
  icon?: React.ReactNode;
@@ -108,7 +108,7 @@ const Banner = React.forwardRef<any, BannerProps>(
108
108
  {icon && <IconDiv>{icon}</IconDiv>}
109
109
  <TextContainer setPaddingRight={!close && !buttonLabel}>
110
110
  {headline && <HeadlineDiv>{headline}</HeadlineDiv>}
111
- <div>{content}</div>
111
+ {content && <div>{content}</div>}
112
112
  </TextContainer>
113
113
  {buttonLabel && (
114
114
  <BannerButton onClick={onButtonClick}>{buttonLabel}</BannerButton>
@@ -213,6 +213,7 @@ const Button: ButtonComponent = React.forwardRef(function Button<
213
213
 
214
214
  return (
215
215
  <Component
216
+ type="button"
216
217
  {...other}
217
218
  className={className}
218
219
  ref={ref}
@@ -167,7 +167,7 @@ export function InputBase(props: InputBaseProps): React.ReactElement {
167
167
  {endLabel && <span>{endLabel}</span>}
168
168
  {endIcon}
169
169
  {onClear && (
170
- <ClearButton onClick={onClear} disabled={disabled}>
170
+ <ClearButton onClick={onClear} disabled={disabled} tabIndex={-1}>
171
171
  <CloseCircleFillIcon />
172
172
  </ClearButton>
173
173
  )}
package/src/cds/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /// <reference path="./svg.d.ts" />
2
+ /// <reference path="./emotion.d.ts" />
3
+
1
4
  export * from "./components/AlertDialog";
2
5
 
3
6
  export { default as Banner } from "./components/Banner";
@@ -62,3 +65,4 @@ export * from "./patterns/Table";
62
65
 
63
66
  export { default as CodleDesignSystemProvider } from "./CodleDesignSystemProvider";
64
67
  export { light } from "./CodleDesignSystemProvider";
68
+
package/tsconfig.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "target": "es5",
4
4
  "lib": ["dom", "dom.iterable", "esnext"],
5
+ "typeRoots": ["./@types"],
5
6
  "outDir": "./dist",
6
7
  "declaration": true,
7
8
  "allowJs": true,
@@ -17,6 +18,6 @@
17
18
  "isolatedModules": true,
18
19
  "jsx": "react-jsx"
19
20
  },
20
- "include": ["src/cds", "src/cds/svg.d.ts"],
21
+ "include": ["src/cds"],
21
22
  "exclude": ["node_modules", "dist"]
22
23
  }