@team-monolith/cds 0.1.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.
Files changed (165) hide show
  1. package/README.md +46 -0
  2. package/dist/CodleDesignSystemProvider.d.ts +5 -0
  3. package/dist/CodleDesignSystemProvider.js +96 -0
  4. package/dist/components/AlertDialog/AlertDialog.d.ts +14 -0
  5. package/dist/components/AlertDialog/AlertDialog.js +45 -0
  6. package/dist/components/AlertDialog/AlertDialogActions.d.ts +8 -0
  7. package/dist/components/AlertDialog/AlertDialogActions.js +35 -0
  8. package/dist/components/AlertDialog/AlertDialogContent.d.ts +8 -0
  9. package/dist/components/AlertDialog/AlertDialogContent.js +36 -0
  10. package/dist/components/AlertDialog/AlertDialogTitle.d.ts +13 -0
  11. package/dist/components/AlertDialog/AlertDialogTitle.js +38 -0
  12. package/dist/components/AlertDialog/index.d.ts +4 -0
  13. package/dist/components/AlertDialog/index.js +4 -0
  14. package/dist/components/Banner.d.ts +29 -0
  15. package/dist/components/Banner.js +65 -0
  16. package/dist/components/Button.d.ts +26 -0
  17. package/dist/components/Button.js +72 -0
  18. package/dist/components/CheckboxInput.d.ts +27 -0
  19. package/dist/components/CheckboxInput.js +77 -0
  20. package/dist/components/Input.d.ts +17 -0
  21. package/dist/components/Input.js +72 -0
  22. package/dist/components/InputBase.d.ts +42 -0
  23. package/dist/components/InputBase.js +52 -0
  24. package/dist/components/Pagination.d.ts +27 -0
  25. package/dist/components/Pagination.js +32 -0
  26. package/dist/components/PinInput.d.ts +36 -0
  27. package/dist/components/PinInput.js +154 -0
  28. package/dist/components/RadioInput.d.ts +23 -0
  29. package/dist/components/RadioInput.js +78 -0
  30. package/dist/components/SquareButton.d.ts +26 -0
  31. package/dist/components/SquareButton.js +80 -0
  32. package/dist/components/Switch.d.ts +19 -0
  33. package/dist/components/Switch.js +59 -0
  34. package/dist/components/Tag.d.ts +21 -0
  35. package/dist/components/Tag.js +61 -0
  36. package/dist/components/Tooltip.d.ts +26 -0
  37. package/dist/components/Tooltip.js +50 -0
  38. package/dist/foundation/color.d.ts +75 -0
  39. package/dist/foundation/color.js +75 -0
  40. package/dist/foundation/shadows.d.ts +9 -0
  41. package/dist/foundation/shadows.js +10 -0
  42. package/dist/icons/arrows.d.ts +16 -0
  43. package/dist/icons/arrows.js +17 -0
  44. package/dist/icons/brand.d.ts +4 -0
  45. package/dist/icons/brand.js +13 -0
  46. package/dist/icons/map.d.ts +4 -0
  47. package/dist/icons/map.js +13 -0
  48. package/dist/icons/system.d.ts +25 -0
  49. package/dist/icons/system.js +20 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +2 -0
  52. package/dist/patterns/Dropdown/Dropdown.d.ts +27 -0
  53. package/dist/patterns/Dropdown/Dropdown.js +41 -0
  54. package/dist/patterns/Dropdown/DropdownItem.d.ts +42 -0
  55. package/dist/patterns/Dropdown/DropdownItem.js +89 -0
  56. package/dist/patterns/Dropdown/DropdownMenu.d.ts +30 -0
  57. package/dist/patterns/Dropdown/DropdownMenu.js +85 -0
  58. package/dist/patterns/Dropdown/index.d.ts +2 -0
  59. package/dist/patterns/Dropdown/index.js +2 -0
  60. package/dist/patterns/EmptyState/EmptyState.d.ts +16 -0
  61. package/dist/patterns/EmptyState/EmptyState.js +36 -0
  62. package/dist/patterns/EmptyState/index.d.ts +2 -0
  63. package/dist/patterns/EmptyState/index.js +2 -0
  64. package/dist/patterns/Grid/EnhancedTableCell.d.ts +9 -0
  65. package/dist/patterns/Grid/EnhancedTableCell.js +122 -0
  66. package/dist/patterns/Grid/Grid.d.ts +51 -0
  67. package/dist/patterns/Grid/Grid.js +140 -0
  68. package/dist/patterns/Grid/index.d.ts +3 -0
  69. package/dist/patterns/Grid/index.js +2 -0
  70. package/dist/patterns/SegmentedControl/SegmentedControlButton.d.ts +8 -0
  71. package/dist/patterns/SegmentedControl/SegmentedControlButton.js +41 -0
  72. package/dist/patterns/SegmentedControl/SegmentedControlGroup.d.ts +26 -0
  73. package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +50 -0
  74. package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.d.ts +5 -0
  75. package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.js +5 -0
  76. package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.d.ts +8 -0
  77. package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.js +45 -0
  78. package/dist/patterns/SegmentedControl/index.d.ts +3 -0
  79. package/dist/patterns/SegmentedControl/index.js +3 -0
  80. package/dist/patterns/Table/Table.d.ts +16 -0
  81. package/dist/patterns/Table/Table.js +33 -0
  82. package/dist/patterns/Table/TableBody.d.ts +8 -0
  83. package/dist/patterns/Table/TableBody.js +26 -0
  84. package/dist/patterns/Table/TableCell.d.ts +15 -0
  85. package/dist/patterns/Table/TableCell.js +78 -0
  86. package/dist/patterns/Table/TableHead.d.ts +8 -0
  87. package/dist/patterns/Table/TableHead.js +26 -0
  88. package/dist/patterns/Table/TableRow.d.ts +12 -0
  89. package/dist/patterns/Table/TableRow.js +29 -0
  90. package/dist/patterns/Table/TableSizeContext.d.ts +7 -0
  91. package/dist/patterns/Table/TableSizeContext.js +3 -0
  92. package/dist/patterns/Table/TableVariantContext.d.ts +6 -0
  93. package/dist/patterns/Table/TableVariantContext.js +3 -0
  94. package/dist/patterns/Table/index.d.ts +7 -0
  95. package/dist/patterns/Table/index.js +6 -0
  96. package/dist/utils/hover.d.ts +3 -0
  97. package/dist/utils/hover.js +14 -0
  98. package/dist/utils/reset.d.ts +2 -0
  99. package/dist/utils/reset.js +8 -0
  100. package/dist/utils/zIndex.d.ts +3 -0
  101. package/dist/utils/zIndex.js +3 -0
  102. package/package.json +52 -0
  103. package/public/favicon.ico +0 -0
  104. package/public/index.html +43 -0
  105. package/public/logo192.png +0 -0
  106. package/public/logo512.png +0 -0
  107. package/public/manifest.json +25 -0
  108. package/public/robots.txt +3 -0
  109. package/src/App.tsx +7 -0
  110. package/src/cds/CodleDesignSystemProvider.tsx +93 -0
  111. package/src/cds/README.md +23 -0
  112. package/src/cds/components/AlertDialog/AlertDialog.tsx +101 -0
  113. package/src/cds/components/AlertDialog/AlertDialogActions.tsx +34 -0
  114. package/src/cds/components/AlertDialog/AlertDialogContent.tsx +38 -0
  115. package/src/cds/components/AlertDialog/AlertDialogTitle.tsx +63 -0
  116. package/src/cds/components/AlertDialog/index.tsx +4 -0
  117. package/src/cds/components/Banner.tsx +176 -0
  118. package/src/cds/components/Button.tsx +239 -0
  119. package/src/cds/components/CheckboxInput.tsx +270 -0
  120. package/src/cds/components/Input.tsx +166 -0
  121. package/src/cds/components/InputBase.tsx +226 -0
  122. package/src/cds/components/Pagination.tsx +99 -0
  123. package/src/cds/components/PinInput.tsx +322 -0
  124. package/src/cds/components/RadioInput.tsx +226 -0
  125. package/src/cds/components/SquareButton.tsx +229 -0
  126. package/src/cds/components/Switch.tsx +129 -0
  127. package/src/cds/components/Tag.tsx +155 -0
  128. package/src/cds/components/Tooltip.tsx +104 -0
  129. package/src/cds/emotion.d.ts +70 -0
  130. package/src/cds/foundation/color.ts +83 -0
  131. package/src/cds/foundation/shadows.ts +17 -0
  132. package/src/cds/icons/arrows.tsx +61 -0
  133. package/src/cds/icons/brand.tsx +13 -0
  134. package/src/cds/icons/map.tsx +14 -0
  135. package/src/cds/icons/system.tsx +113 -0
  136. package/src/cds/index.ts +3 -0
  137. package/src/cds/patterns/Dropdown/Dropdown.tsx +111 -0
  138. package/src/cds/patterns/Dropdown/DropdownItem.tsx +203 -0
  139. package/src/cds/patterns/Dropdown/DropdownMenu.tsx +176 -0
  140. package/src/cds/patterns/Dropdown/index.tsx +2 -0
  141. package/src/cds/patterns/EmptyState/EmptyState.tsx +91 -0
  142. package/src/cds/patterns/EmptyState/empty-state-icon.svg +36 -0
  143. package/src/cds/patterns/EmptyState/index.tsx +2 -0
  144. package/src/cds/patterns/Grid/EnhancedTableCell.tsx +180 -0
  145. package/src/cds/patterns/Grid/Grid.tsx +360 -0
  146. package/src/cds/patterns/Grid/index.tsx +4 -0
  147. package/src/cds/patterns/SegmentedControl/SegmentedControlButton.tsx +41 -0
  148. package/src/cds/patterns/SegmentedControl/SegmentedControlGroup.tsx +81 -0
  149. package/src/cds/patterns/SegmentedControl/SegmentedControlGroupPropsContext.tsx +9 -0
  150. package/src/cds/patterns/SegmentedControl/SegmentedControlSquareButton.tsx +51 -0
  151. package/src/cds/patterns/SegmentedControl/index.ts +3 -0
  152. package/src/cds/patterns/Table/Table.tsx +56 -0
  153. package/src/cds/patterns/Table/TableBody.tsx +30 -0
  154. package/src/cds/patterns/Table/TableCell.tsx +242 -0
  155. package/src/cds/patterns/Table/TableHead.tsx +30 -0
  156. package/src/cds/patterns/Table/TableRow.tsx +54 -0
  157. package/src/cds/patterns/Table/TableSizeContext.tsx +10 -0
  158. package/src/cds/patterns/Table/TableVariantContext.tsx +9 -0
  159. package/src/cds/patterns/Table/index.tsx +15 -0
  160. package/src/cds/utils/hover.tsx +24 -0
  161. package/src/cds/utils/reset.tsx +19 -0
  162. package/src/cds/utils/zIndex.tsx +3 -0
  163. package/src/index.tsx +10 -0
  164. package/src/react-app-env.d.ts +1 -0
  165. package/tsconfig.json +22 -0
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ export interface TableCellProps {
3
+ className?: string;
4
+ component?: React.ElementType;
5
+ colSpan?: number;
6
+ sort?: "asc" | "desc" | "none";
7
+ isFilterActive?: boolean;
8
+ onClick?: () => void;
9
+ onSortClick?: React.MouseEventHandler<HTMLButtonElement>;
10
+ onFilterClick?: React.MouseEventHandler<HTMLButtonElement>;
11
+ filterButttonRef?: React.MutableRefObject<HTMLButtonElement | null>;
12
+ /** Cell의 λ‚΄μš©μž…λ‹ˆλ‹€. */
13
+ children?: React.ReactNode;
14
+ }
15
+ export default function TableCell(props: TableCellProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,78 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
17
+ /** @jsxImportSource @emotion/react */
18
+ import { css, useTheme } from "@emotion/react";
19
+ import React, { useContext } from "react";
20
+ import TableVariantContext from "./TableVariantContext";
21
+ import TableSizeContext from "./TableSizeContext";
22
+ import { ArrowDownFillIcon, ArrowUpFillIcon, ExpandUpDownIcon, } from "../../icons/arrows";
23
+ import styled from "@emotion/styled";
24
+ import { RESET_BUTTON } from "../../utils/reset";
25
+ import { FilterFillIcon } from "../../icons/system";
26
+ var SIZE_TO_STYLES = function (size) {
27
+ return ({
28
+ small: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 8px 8px;\n "], ["\n padding: 8px 8px;\n "]))),
29
+ medium: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 12px 8px;\n "], ["\n padding: 12px 8px;\n "]))),
30
+ large: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 16px 8px;\n "], ["\n padding: 16px 8px;\n "]))),
31
+ }[size]);
32
+ };
33
+ export default function TableCell(props) {
34
+ var className = props.className, Component = props.component, children = props.children, sort = props.sort, colSpan = props.colSpan, isFilterActive = props.isFilterActive, onFilterClick = props.onFilterClick, onClick = props.onClick, onSortClick = props.onSortClick, filterButttonRef = props.filterButttonRef;
35
+ // variant 값에 따라 th νƒœκ·Έλ‘œ 그릴지, td νƒœκ·Έλ‘œ 그릴지λ₯Ό κ²°μ •ν•©λ‹ˆλ‹€.
36
+ var variant = useContext(TableVariantContext).variant;
37
+ var Element = (Component !== null && Component !== void 0 ? Component : variant === "head") ? "th" : "td";
38
+ var size = useContext(TableSizeContext).size;
39
+ var theme = useTheme();
40
+ if (variant === "body") {
41
+ return (_jsx(Element, __assign({ colSpan: colSpan, className: className, onClick: onClick, css: [
42
+ SIZE_TO_STYLES(size !== null && size !== void 0 ? size : "medium"),
43
+ css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n "], ["\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n "]))),
44
+ css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: table-cell;\n text-align: initial;\n\n &:first-of-type {\n padding-left: 16px;\n }\n\n &:last-of-type {\n padding-right: 16px;\n }\n "], ["\n display: table-cell;\n text-align: initial;\n\n &:first-of-type {\n padding-left: 16px;\n }\n\n &:last-of-type {\n padding-right: 16px;\n }\n "]))),
45
+ ] }, { children: children })));
46
+ }
47
+ return (_jsx(Element, __assign({ colSpan: colSpan, className: className, onClick: onClick, css: [
48
+ SIZE_TO_STYLES(size !== null && size !== void 0 ? size : "medium"),
49
+ Element === "th"
50
+ ? css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n font-style: normal;\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n "], ["\n background: ", ";\n font-style: normal;\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n "])), theme.color.background.neutralAlt) : css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n "], ["\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n "]))),
51
+ css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: table-cell;\n text-align: initial;\n\n &:first-of-type {\n padding-left: 16px;\n }\n\n &:last-of-type {\n padding-right: 16px;\n }\n "], ["\n display: table-cell;\n text-align: initial;\n\n &:first-of-type {\n padding-left: 16px;\n }\n\n &:last-of-type {\n padding-right: 16px;\n }\n "]))),
52
+ ] }, { children: _jsxs(Cell, { children: [children, _jsxs(Buttons, { children: [sort && _jsx(SortButton, { sort: sort, onSortClick: onSortClick }), isFilterActive !== undefined && (_jsx(FilterButton, { isFilterActive: isFilterActive !== null && isFilterActive !== void 0 ? isFilterActive : false, onFilterClick: onFilterClick, ref: filterButttonRef }))] })] }) })));
53
+ }
54
+ var Cell = styled.span(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
55
+ var Buttons = styled.span(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n gap: 4px;\n"], ["\n display: flex;\n gap: 4px;\n"])));
56
+ var SortButton = function (props) {
57
+ var sortIcon = _jsx(_Fragment, {});
58
+ switch (props.sort) {
59
+ case "asc":
60
+ sortIcon = _jsx(ArrowDownFillIcon, {});
61
+ break;
62
+ case "desc":
63
+ sortIcon = _jsx(ArrowUpFillIcon, {});
64
+ break;
65
+ case "none":
66
+ sortIcon = _jsx(ExpandUpDownIcon, {});
67
+ break;
68
+ }
69
+ return (_jsx("button", __assign({ onClick: props.onSortClick, css: css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", "\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 6px;\n\n cursor: pointer;\n\n svg {\n width: 12px;\n height: 12px;\n }\n "], ["\n ", "\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 6px;\n\n cursor: pointer;\n\n svg {\n width: 12px;\n height: 12px;\n }\n "])), RESET_BUTTON) }, { children: sortIcon })));
70
+ };
71
+ var FilterButton = React.forwardRef(function (props, ref) {
72
+ var theme = useTheme();
73
+ return (_jsx("button", __assign({ ref: ref, onClick: props.onFilterClick, css: [
74
+ css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", "\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 6px;\n\n cursor: pointer;\n\n svg {\n width: 12px;\n height: 12px;\n }\n "], ["\n ", "\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 6px;\n\n cursor: pointer;\n\n svg {\n width: 12px;\n height: 12px;\n }\n "])), RESET_BUTTON),
75
+ props.isFilterActive && css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.primary),
76
+ ] }, { children: _jsx(FilterFillIcon, {}) })));
77
+ });
78
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export interface TableHeadProps {
3
+ className?: string;
4
+ component?: React.ElementType;
5
+ /** Table의 λ‚΄μš©μž…λ‹ˆλ‹€. 일반적으둜 TableRow둜 κ΅¬μ„±λ©λ‹ˆλ‹€. */
6
+ children?: React.ReactNode;
7
+ }
8
+ export default function TableHead(props: TableHeadProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
+ /** @jsxImportSource @emotion/react */
18
+ import { css } from "@emotion/react";
19
+ import TableVariantContext from "./TableVariantContext";
20
+ export default function TableHead(props) {
21
+ var className = props.className, _a = props.component, Component = _a === void 0 ? "thead" : _a, children = props.children;
22
+ return (_jsx(Component, __assign({ className: className, css: [
23
+ css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: table-header-group;\n "], ["\n display: table-header-group;\n "]))),
24
+ ] }, { children: _jsx(TableVariantContext.Provider, __assign({ value: { variant: "head" } }, { children: children })) })));
25
+ }
26
+ var templateObject_1;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export interface TableRowProps {
3
+ className?: string;
4
+ component?: React.ElementType;
5
+ /** Table의 λ‚΄μš©μž…λ‹ˆλ‹€. 일반적으둜 TableCell둜 κ΅¬μ„±λ©λ‹ˆλ‹€. */
6
+ children?: React.ReactNode;
7
+ /** `true`일 λ•Œ 기본적으둜 μ μš©λ˜λŠ” hover 배경색이 λΉ„ν™œμ„±ν™”λ©λ‹ˆλ‹€. */
8
+ disableHover?: boolean;
9
+ /** 이 행이 μ„ νƒλ˜μ—ˆμŒμ„ κ²°μ •ν•˜λŠ” 속성. `true`μΌλ•Œ 배경색이 ν™œμ„±ν™”λ©λ‹ˆλ‹€. */
10
+ isSelected?: boolean;
11
+ }
12
+ export default function TableRow(props: TableRowProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
+ /** @jsxImportSource @emotion/react */
18
+ import { css, useTheme } from "@emotion/react";
19
+ import { HOVER } from "../../utils/hover";
20
+ export default function TableRow(props) {
21
+ var className = props.className, _a = props.component, Component = _a === void 0 ? "tr" : _a, isSelected = props.isSelected, disableHover = props.disableHover, children = props.children;
22
+ var theme = useTheme();
23
+ return (_jsx(Component, __assign({ className: className, css: [
24
+ css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: table-row;\n &:not(:first-of-type) {\n td {\n border-top: 1px solid ", ";\n }\n }\n "], ["\n display: table-row;\n &:not(:first-of-type) {\n td {\n border-top: 1px solid ", ";\n }\n }\n "])), theme.color.background.neutralAlt),
25
+ isSelected && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), theme.color.container.primaryContainer),
26
+ !disableHover && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), HOVER(css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), theme.color.container.primaryContainer))),
27
+ ] }, { children: children })));
28
+ }
29
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { TableSize } from "./Table";
3
+ interface TableSizeContextProps {
4
+ size?: TableSize;
5
+ }
6
+ declare const TableSizeContext: React.Context<TableSizeContextProps>;
7
+ export default TableSizeContext;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ var TableSizeContext = React.createContext({});
3
+ export default TableSizeContext;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ interface TableVariantContextProps {
3
+ variant?: "head" | "body";
4
+ }
5
+ declare const TableVariantContext: React.Context<TableVariantContextProps>;
6
+ export default TableVariantContext;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ var TableVariantContext = React.createContext({});
3
+ export default TableVariantContext;
@@ -0,0 +1,7 @@
1
+ import Table, { TableSize, TableProps } from "./Table";
2
+ import TableHead, { TableHeadProps } from "./TableHead";
3
+ import TableBody, { TableBodyProps } from "./TableBody";
4
+ import TableRow, { TableRowProps } from "./TableRow";
5
+ import TableCell, { TableCellProps } from "./TableCell";
6
+ export { Table, TableHead, TableBody, TableRow, TableCell };
7
+ export type { TableSize, TableProps, TableHeadProps, TableBodyProps, TableRowProps, TableCellProps, };
@@ -0,0 +1,6 @@
1
+ import Table from "./Table";
2
+ import TableHead from "./TableHead";
3
+ import TableBody from "./TableBody";
4
+ import TableRow from "./TableRow";
5
+ import TableCell from "./TableCell";
6
+ export { Table, TableHead, TableBody, TableRow, TableCell };
@@ -0,0 +1,3 @@
1
+ import { CSSInterpolation } from "@emotion/serialize";
2
+ export declare function HOVER(style: CSSInterpolation): import("@emotion/utils").SerializedStyles;
3
+ export declare function FOCUS(style: CSSInterpolation): import("@emotion/utils").SerializedStyles;
@@ -0,0 +1,14 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { css } from "@emotion/react";
6
+ // https://choi-jinwoo.github.io/post/development/css-media-hover/
7
+ export function HOVER(style) {
8
+ // -ms-high-contrast: none is for IE11 support.
9
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @media (hover: hover), (-ms-high-contrast: none) {\n &:hover {\n ", "\n }\n }\n "], ["\n @media (hover: hover), (-ms-high-contrast: none) {\n &:hover {\n ", "\n }\n }\n "])), style);
10
+ }
11
+ export function FOCUS(style) {
12
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n @media (hover: hover), (-ms-high-contrast: none) {\n &:focus {\n ", "\n }\n }\n "], ["\n @media (hover: hover), (-ms-high-contrast: none) {\n &:focus {\n ", "\n }\n }\n "])), style);
13
+ }
14
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,2 @@
1
+ export declare const RESET_BUTTON: import("@emotion/utils").SerializedStyles;
2
+ export declare const RESET_TABLE: import("@emotion/utils").SerializedStyles;
@@ -0,0 +1,8 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { css } from "@emotion/react";
6
+ export var RESET_BUTTON = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n border: none;\n background: none;\n font: inherit;\n text-align: inherit;\n"], ["\n display: inline-block;\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n border: none;\n background: none;\n font: inherit;\n text-align: inherit;\n"])));
7
+ export var RESET_TABLE = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0;\n border: 0;\n border-spacing: 0px;\n border-collapse: collapse;\n"], ["\n padding: 0;\n border: 0;\n border-spacing: 0px;\n border-collapse: collapse;\n"])));
8
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,3 @@
1
+ export declare const ZINDEX: {
2
+ inputBase: number;
3
+ };
@@ -0,0 +1,3 @@
1
+ export var ZINDEX = {
2
+ inputBase: 1, // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/internal/SwitchBase.js#L35
3
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@team-monolith/cds",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "dependencies": {
7
+ "@emotion/react": "^11.8.2",
8
+ "@emotion/styled": "^11.8.1",
9
+ "@mui/icons-material": "^5.11.16",
10
+ "@mui/material": "^5.3.1",
11
+ "@tanstack/react-table": "^8.9.3",
12
+ "@types/node": "^16.11.26",
13
+ "@types/react": "^17.0.39",
14
+ "@types/react-dom": "^17.0.11",
15
+ "react": "^17.0.2",
16
+ "react-dom": "^17.0.2",
17
+ "react-scripts": "5.0.0",
18
+ "typescript": "^4.5.5"
19
+ },
20
+ "scripts": {
21
+ "start": "react-scripts start",
22
+ "build": "react-script build",
23
+ "test": "react-scripts test",
24
+ "eject": "react-scripts eject",
25
+ "clean": "rimraf dist",
26
+ "compile": "npm run clean && mkdir dist && tsc"
27
+ },
28
+ "eslintConfig": {
29
+ "extends": [
30
+ "react-app",
31
+ "react-app/jest"
32
+ ]
33
+ },
34
+ "browserslist": {
35
+ "production": [
36
+ ">0.2%",
37
+ "not dead",
38
+ "not op_mini all"
39
+ ],
40
+ "development": [
41
+ "last 1 chrome version",
42
+ "last 1 firefox version",
43
+ "last 1 safari version"
44
+ ]
45
+ },
46
+ "devDependencies": {
47
+ "@babel/cli": "^7.22.5",
48
+ "@babel/preset-env": "^7.22.5",
49
+ "@babel/preset-react": "^7.22.5",
50
+ "cross-env": "^7.0.3"
51
+ }
52
+ }
Binary file
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/src/App.tsx ADDED
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+
3
+ function App() {
4
+ return <div className="App">CDS</div>;
5
+ }
6
+
7
+ export default App;
@@ -0,0 +1,93 @@
1
+ import { ThemeProvider } from "@emotion/react";
2
+ import { ThemeProvider as MuiThemeProvider } from "@mui/material";
3
+ import COLOR from "./foundation/color";
4
+ import { createTheme } from "@mui/material";
5
+
6
+ const light = {
7
+ color: {
8
+ background: {
9
+ neutralBase: COLOR.white,
10
+ neutralAlt: COLOR.grey03,
11
+ neutralAltActive: COLOR.grey04,
12
+ neutralAltDisabled: COLOR.grey03,
13
+ primary: COLOR.blue06,
14
+ primaryActive: COLOR.blue07,
15
+ primaryDisabled: COLOR.blue03,
16
+ secondary: COLOR.orange06,
17
+ secondaryActive: COLOR.orange07,
18
+ secondaryDisabled: COLOR.orange03,
19
+ danger: COLOR.red06,
20
+ dangerActive: COLOR.red07,
21
+ dangerDisabled: COLOR.red03,
22
+ success: COLOR.green06,
23
+ successActive: COLOR.green07,
24
+ successDisabled: COLOR.green03,
25
+ info: COLOR.teal06,
26
+ infoActive: COLOR.teal07,
27
+ infoDisabled: COLOR.teal03,
28
+ warning: COLOR.yellow06,
29
+ warningActive: COLOR.yellow07,
30
+ warningDisabled: COLOR.yellow03,
31
+ },
32
+ foreground: {
33
+ neutralBase: COLOR.black,
34
+ neutralBaseDisabled: COLOR.grey06,
35
+ neutralAlt: COLOR.white,
36
+ neutralAltDisabled: COLOR.white,
37
+ primary: COLOR.blue06,
38
+ primaryDisabled: COLOR.blue02,
39
+ secondary: COLOR.orange06,
40
+ secondaryDisabled: COLOR.orange02,
41
+ danger: COLOR.red06,
42
+ dangerDisabled: COLOR.red02,
43
+ success: COLOR.green06,
44
+ successDisabled: COLOR.green02,
45
+ info: COLOR.teal06,
46
+ infoDisabled: COLOR.teal02,
47
+ warning: COLOR.yellow06,
48
+ warningDisabled: COLOR.yellow02,
49
+ },
50
+ container: {
51
+ primaryContainer: COLOR.blue01,
52
+ primaryOnContainer: COLOR.blue08,
53
+ secondaryContainer: COLOR.orange01,
54
+ secondaryOnContainer: COLOR.orange08,
55
+ dangerContainer: COLOR.red01,
56
+ dangerOnContainer: COLOR.red08,
57
+ successContainer: COLOR.green01,
58
+ successOnContainer: COLOR.green08,
59
+ infoContainer: COLOR.teal01,
60
+ infoOnContainer: COLOR.teal08,
61
+ warningContainer: COLOR.yellow01,
62
+ warningOnContainer: COLOR.yellow08,
63
+ obsidianContainer: COLOR.black,
64
+ obsidianOnContainer: COLOR.grey03,
65
+ marbleContainer: COLOR.grey03,
66
+ marbleOnContainer: COLOR.grey07,
67
+ },
68
+ },
69
+ };
70
+
71
+ // eslint-disable-next-line import/no-anonymous-default-export
72
+ export default function (props: {
73
+ children: React.ReactNode;
74
+ fontFamily?: string;
75
+ }): React.ReactElement {
76
+ const muiTheme = createTheme({
77
+ typography: {
78
+ fontFamily: props.fontFamily,
79
+ },
80
+ components: {
81
+ MuiButtonBase: {
82
+ defaultProps: {
83
+ disableRipple: true, // No more ripple, on the whole application πŸ’£!
84
+ },
85
+ },
86
+ },
87
+ });
88
+ return (
89
+ <MuiThemeProvider theme={muiTheme}>
90
+ <ThemeProvider theme={light}>{props.children}</ThemeProvider>
91
+ </MuiThemeProvider>
92
+ );
93
+ }
@@ -0,0 +1,23 @@
1
+ # Codle Design System
2
+
3
+ μ½”λ“€ λ””μžμΈ μ‹œμŠ€ν…œμ„ κ΅¬ν˜„ν•©λ‹ˆλ‹€. 이 ν΄λ”λŠ” μ•žμœΌλ‘œ 독립적인 νŒ¨ν‚€μ§€λ‘œ κ΅¬ν˜„λ  수 μžˆμŠ΅λ‹ˆλ‹€.
4
+
5
+ ### /components
6
+
7
+ μ»΄ν¬λ„ŒνŠΈλ₯Ό κ΅¬ν˜„ν•©λ‹ˆλ‹€.
8
+ μ»΄ν¬λ„ŒνŠΈλŠ” λ°˜λ“œμ‹œ `className`κ³Ό `component` 인자λ₯Ό κ°€μ§‘λ‹ˆλ‹€.
9
+ μ»΄ν¬λ„ŒνŠΈλŠ” λͺ¨λ‘ μŠ€ν† λ¦¬λΆμ— 등둝해야 ν•©λ‹ˆλ‹€.
10
+
11
+ ### /foundation
12
+
13
+ 색상, 그림자 등을 μ œκ³΅ν•©λ‹ˆλ‹€.
14
+
15
+ ### /icons
16
+
17
+ μ•„μ΄μ½˜μ„ μ œκ³΅ν•©λ‹ˆλ‹€.
18
+
19
+ μ•„μ΄μ½˜μ€ [ν”Όκ·Έλ§ˆ](https://www.figma.com/file/wefLB6cN0oM2VZjwYmBA6B/Codle-PD-Kit---Foundation?type=design&node-id=1-23307&t=ASkFT82aJsgxrxvr-0)에 μ •μ˜λœλŒ€λ‘œ 24px X 24px 크기의 svg둜 μ •μ˜λ©λ‹ˆλ‹€. μƒ‰μƒμ΄λ‚˜ 크기λ₯Ό λ³€κ²½ν•˜κΈ° μœ„ν•΄ Styled Componentλ₯Ό ν™œμš©ν•  수 μžˆμœΌλ―€λ‘œ `className` 인자λ₯Ό λ°›μ•„μ•Όν•©λ‹ˆλ‹€.
20
+
21
+ svgλŠ” ν”Όκ·Έλ§ˆμ—μ„œ 받을 μˆ˜λ„ 있고 [iconify](https://iconify.design/)μ—μ„œ 받을 μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.
22
+
23
+ μ•„μ΄μ½˜μ€ `System/add-box-fill`κ³Ό 같은 이름을 κ°€μ§€λŠ”λ°, 이 경우 `icons/system.tsx` νŒŒμΌμ— `AddBoxFillIcon` μ»΄ν¬λ„ŒνŠΈλ‘œ μ •μ˜ν•©λ‹ˆλ‹€.
@@ -0,0 +1,101 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { Modal as MuiModal } from "@mui/material";
3
+ import { css, useTheme } from "@emotion/react";
4
+ import React from "react";
5
+ import shadows from "../../foundation/shadows";
6
+ import styled from "@emotion/styled";
7
+
8
+ export interface AlertDialogProps {
9
+ className?: string;
10
+ component?: React.ElementType;
11
+
12
+ /** `true` κ°’μΌλ•Œ λͺ¨λ‹¬μ΄ λ…ΈμΆœλ©λ‹ˆλ‹€. */
13
+ open: boolean;
14
+
15
+ /** λͺ¨λ‹¬μ΄ λ‹«νž λ•Œ ν˜ΈμΆœλ˜λŠ” callback */
16
+ onClose?: () => void;
17
+
18
+ /** λͺ¨λ‹¬μ˜ λ‚΄μš©μœΌλ‘œ ν‘œκΈ°λ  κ°’ */
19
+ children: React.ReactNode;
20
+
21
+ /** λͺ¨λ‹¬ μ’ŒμΈ‘μ— ν‘œκΈ°λ  μ•„μ΄μ½˜ */
22
+ icon?: React.ReactNode;
23
+ }
24
+
25
+ export const AlertDialog = React.forwardRef<any, AlertDialogProps>(
26
+ (props, ref) => {
27
+ const {
28
+ className,
29
+ component: Component = "div",
30
+ open,
31
+ onClose,
32
+ children,
33
+ icon,
34
+ ...other
35
+ } = props;
36
+ const theme = useTheme();
37
+ return (
38
+ <MuiModal open={open} onClose={onClose} ref={ref} {...other}>
39
+ <Component
40
+ className={className}
41
+ css={css`
42
+ width: 480px;
43
+ background: ${theme.color.background.neutralBase};
44
+ box-shadow: ${shadows.shadow04};
45
+ border-radius: 16px;
46
+ position: absolute;
47
+ top: 50%;
48
+ left: 50%;
49
+ transform: translate(-50%, -50%);
50
+ padding: 24px;
51
+ box-sizing: border-box;
52
+
53
+ display: grid;
54
+ ${icon
55
+ ? css`
56
+ grid-template-areas:
57
+ "icon title"
58
+ "iconPadding content"
59
+ "actions actions";
60
+ `
61
+ : css`
62
+ grid-template-areas:
63
+ "title"
64
+ "content"
65
+ "actions";
66
+ `}
67
+
68
+ gap: 8px 16px;
69
+ `}
70
+ >
71
+ {icon && (
72
+ <>
73
+ <IconDiv>{icon}</IconDiv>
74
+ <IconPadding />
75
+ </>
76
+ )}
77
+ {children}
78
+ </Component>
79
+ </MuiModal>
80
+ );
81
+ }
82
+ );
83
+
84
+ const IconDiv = styled.div`
85
+ display: flex;
86
+ justify-content: center;
87
+ align-items: center;
88
+ grid-area: icon;
89
+ ${({ theme }) =>
90
+ css`
91
+ color: ${theme.color.background.infoActive};
92
+ `}
93
+ svg {
94
+ width: 32px;
95
+ height: 32px;
96
+ }
97
+ `;
98
+
99
+ const IconPadding = styled.div`
100
+ grid-area: iconPadding;
101
+ `;