maru_design2 2.2.0 → 2.3.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.
@@ -1,12 +1,13 @@
1
+ import React from 'react';
1
2
  import { TColor } from '../../../enums/color';
2
3
  import { TChipSize } from '../../../enums/size';
3
4
  import { TChipVariant } from '../../../enums/variant';
4
5
  import './chip.scss';
5
6
  export interface ChipProps {
6
7
  /**
7
- * 컴포넌트에 들어갈 내용. number인 경우 천의 자리마다 컴마(,) 표시됨. [string | number]. (@v1 children)
8
+ * 컴포넌트에 들어갈 내용. number인 경우 천의 자리마다 컴마(,) 표시됨. [React.ReactNode | string | number].
8
9
  */
9
- content: string | number;
10
+ children: React.ReactNode | string | number;
10
11
  className?: string;
11
12
  /**
12
13
  * ['primary', 'secondary', 'positive', 'warning', 'danger']. (@v1 variant)
@@ -21,4 +22,4 @@ export interface ChipProps {
21
22
  */
22
23
  variant?: TChipVariant;
23
24
  }
24
- export declare function Chip({ content, className, color, size, variant, }: ChipProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function Chip({ children, className, color, size, variant, }: ChipProps): import("react/jsx-runtime").JSX.Element;
@@ -124,6 +124,7 @@ export declare const ICONS: {
124
124
  readonly LineChartDown01: "LineChartDown01";
125
125
  readonly Loading02Thin: "Loading02Thin";
126
126
  readonly Loading02: "Loading02";
127
+ readonly Lock01Thin: "Lock01Thin";
127
128
  readonly LogOut01Thin: "LogOut01Thin";
128
129
  readonly MessageCheckSquare: "MessageCheckSquare";
129
130
  readonly MessageCheckThin: "MessageCheckThin";
@@ -1,3 +1,3 @@
1
1
  import { TableProps } from './types';
2
2
  import './table.scss';
3
- export declare function Table({ rowIdKey, data, formats, sort, onSort, checkedIds, onCheck, kebabMenu, className, id, tableMaxHeight, noData, loading, }: TableProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function Table({ rowIdKey, data, formats, sort, onSort, checkedIds, onCheck, kebabMenu, onRowClick, selectedRow, className, id, tableMaxHeight, noData, loading, }: TableProps): import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,11 @@ interface Props {
16
16
  isLoading: boolean;
17
17
  content?: React.ReactNode;
18
18
  };
19
+ onRowClick?: (rowId: string) => void;
20
+ selectedRow?: {
21
+ rowId: string;
22
+ className?: string;
23
+ };
19
24
  }
20
- declare function TBody({ rowIdKey, formats, data, checkedIds, onCheck, hasKebabMenu, kebabContent, noData, loading, }: Props): import("react/jsx-runtime").JSX.Element;
25
+ declare function TBody({ rowIdKey, formats, data, checkedIds, onCheck, hasKebabMenu, kebabContent, onRowClick, selectedRow, noData, loading, }: Props): import("react/jsx-runtime").JSX.Element;
21
26
  export default TBody;
@@ -50,8 +50,19 @@ export interface TableProps {
50
50
  content: (rowId: string, onClose: () => void) => React.ReactNode;
51
51
  width?: string;
52
52
  };
53
+ /**
54
+ * 테이블 행 클릭 이벤트
55
+ */
56
+ onRowClick?: (rowId: string) => void;
53
57
  className?: string;
54
58
  id?: string;
59
+ /**
60
+ * 선택된 행 스타일 지정 (@v1 focusedRowInfo)
61
+ */
62
+ selectedRow?: {
63
+ rowId: string;
64
+ className?: string;
65
+ };
55
66
  /**
56
67
  * 최대 높이
57
68
  */
package/dist/index.js CHANGED
@@ -1762,6 +1762,20 @@ var iconmap = {
1762
1762
  }],
1763
1763
  "circles": []
1764
1764
  },
1765
+ "Lock01Thin": {
1766
+ "width": "16",
1767
+ "height": "16",
1768
+ "viewBox": "0 0 16 16",
1769
+ "fill": "none",
1770
+ "paths": [{
1771
+ "d": "M11.3333 6.66667V5.33333C11.3333 3.49238 9.84094 2 7.99999 2C6.15904 2 4.66666 3.49238 4.66666 5.33333V6.66667M7.99999 9.66667V11M5.86666 14H10.1333C11.2534 14 11.8135 14 12.2413 13.782C12.6176 13.5903 12.9236 13.2843 13.1153 12.908C13.3333 12.4802 13.3333 11.9201 13.3333 10.8V9.86667C13.3333 8.74656 13.3333 8.18651 13.1153 7.75869C12.9236 7.38236 12.6176 7.0764 12.2413 6.88465C11.8135 6.66667 11.2534 6.66667 10.1333 6.66667H5.86666C4.74655 6.66667 4.1865 6.66667 3.75868 6.88465C3.38235 7.0764 3.07639 7.38236 2.88464 7.75869C2.66666 8.18651 2.66666 8.74656 2.66666 9.86667V10.8C2.66666 11.9201 2.66666 12.4802 2.88464 12.908C3.07639 13.2843 3.38235 13.5903 3.75868 13.782C4.1865 14 4.74655 14 5.86666 14Z",
1772
+ "stroke": "#8C8C8C",
1773
+ "strokeWidth": "1.5",
1774
+ "strokeLinecap": "round",
1775
+ "strokeLinejoin": "round"
1776
+ }],
1777
+ "circles": []
1778
+ },
1765
1779
  "LogOut01Thin": {
1766
1780
  "width": "18",
1767
1781
  "height": "18",
@@ -2778,6 +2792,7 @@ var ICONS = {
2778
2792
  "LineChartDown01": "LineChartDown01",
2779
2793
  "Loading02Thin": "Loading02Thin",
2780
2794
  "Loading02": "Loading02",
2795
+ "Lock01Thin": "Lock01Thin",
2781
2796
  "LogOut01Thin": "LogOut01Thin",
2782
2797
  "MessageCheckSquare": "MessageCheckSquare",
2783
2798
  "MessageCheckThin": "MessageCheckThin",
@@ -3075,7 +3090,7 @@ var css_248z$9 = ".maru-chip {\n display: flex;\n justify-content: center;\n
3075
3090
  styleInject(css_248z$9);
3076
3091
 
3077
3092
  function Chip(_a) {
3078
- var content = _a.content,
3093
+ var children = _a.children,
3079
3094
  className = _a.className,
3080
3095
  _b = _a.color,
3081
3096
  color = _b === void 0 ? 'primary' : _b,
@@ -3090,9 +3105,9 @@ function Chip(_a) {
3090
3105
  name: ICONS.StateThin,
3091
3106
  size: 16,
3092
3107
  color: color
3093
- }), jsx("span", {
3094
- children: content.toLocaleString('en')
3095
- })]
3108
+ }), typeof children === 'number' ? jsx("span", {
3109
+ children: children.toLocaleString('en')
3110
+ }) : children]
3096
3111
  }));
3097
3112
  }
3098
3113
 
@@ -6387,10 +6402,10 @@ function TBody(_a) {
6387
6402
  // expandingIdKey,
6388
6403
  // expandingRowIdKey,
6389
6404
  // expandingFormat,
6390
- // onRowClick,
6405
+ onRowClick = _a.onRowClick,
6406
+ selectedRow = _a.selectedRow,
6391
6407
  // onRowMouseOver,
6392
6408
  // onRowMouseLeave,
6393
- // focusedRowInfo,
6394
6409
  noData = _a.noData,
6395
6410
  loading = _a.loading;
6396
6411
  var _b = useState([]);
@@ -6419,11 +6434,13 @@ function TBody(_a) {
6419
6434
  onCheck === null || onCheck === void 0 ? void 0 : onCheck(__spreadArray([], newCheckedArray, true));
6420
6435
  }
6421
6436
  };
6422
- // const handleRowClick = (rowId: string) => () => {
6423
- // if (hasRowEvent) {
6424
- // onRowClick?.(rowId);
6425
- // }
6426
- // };
6437
+ var handleRowClick = function handleRowClick(rowId) {
6438
+ return function () {
6439
+ // if (hasRowEvent) {
6440
+ onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(rowId);
6441
+ // }
6442
+ };
6443
+ };
6427
6444
  // const handleRowEnter = (rowId: string) => () => {
6428
6445
  // if (hasRowEvent) {
6429
6446
  // onRowMouseOver?.(rowId);
@@ -6453,11 +6470,14 @@ function TBody(_a) {
6453
6470
  }) : data.map(function (row) {
6454
6471
  return jsx(React.Fragment, {
6455
6472
  children: jsxs("tr", __assign({
6456
- // onClick={handleRowClick(row[rowIdKey])}
6473
+ onClick: handleRowClick(row[rowIdKey]),
6457
6474
  // onMouseEnter={handleRowEnter(row[rowIdKey])}
6458
6475
  // onMouseLeave={handleRowLeave(row[rowIdKey])}
6459
6476
  // aria-hidden={hasRowEvent}
6460
- className: classNames()
6477
+ className: classNames({
6478
+ 'clickable-row': onRowClick,
6479
+ 'selected-row': selectedRow && (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.rowId) === row[rowIdKey]
6480
+ }, selectedRow && (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.className))
6461
6481
  }, {
6462
6482
  children: [checkedIds != null && jsx(CheckboxTd, {
6463
6483
  rowId: row[rowIdKey],
@@ -6569,7 +6589,7 @@ function Colgroup(_a) {
6569
6589
  });
6570
6590
  }
6571
6591
 
6572
- var css_248z = ".maru-table-wrapper {\n width: 100%;\n background-color: white;\n box-shadow: 0px 0px 6px #e4e4e4;\n border-radius: 15px;\n}\n.maru-table-wrapper .maru-table-header-wrapper,\n.maru-table-wrapper .maru-table-body-wrapper {\n width: 100%;\n}\n.maru-table-wrapper tr {\n height: 54px;\n}\n.maru-table-wrapper th,\n.maru-table-wrapper td {\n text-align: start;\n vertical-align: middle;\n padding: 16.5px 15px;\n word-break: break-word;\n}\n.maru-table-wrapper .maru-table-header tr {\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-table-wrapper .maru-table-header tr th {\n color: #5c5c5c;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 700;\n}\n.maru-table-wrapper .maru-table-header .maru-table-header-sortable {\n padding: unset;\n margin: unset;\n color: #5c5c5c;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 700;\n}\n.maru-table-wrapper .maru-table-body-scroll-wrapper {\n overflow-y: auto;\n}\n.maru-table-wrapper .maru-table-body-scroll-wrapper .maru-table-scroll {\n overflow-y: auto;\n}\n.maru-table-wrapper .maru-table-body tr:not(:last-of-type) {\n border-bottom: 1px solid #fafafa;\n}\n.maru-table-wrapper .maru-table-body tr:hover,\n.maru-table-wrapper .maru-table-body .row-clickable:hover {\n background-color: var(--p-10) !important;\n}\n.maru-table-wrapper .maru-table-body td {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}\n.maru-table-wrapper .maru-table-body tr:last-of-type td:first-of-type {\n border-bottom-left-radius: 15px;\n}\n.maru-table-wrapper .maru-table-body tr:last-of-type td:last-of-type {\n border-bottom-right-radius: 15px;\n}\n.maru-table-wrapper .maru-table-body .row-clickable {\n cursor: pointer;\n}\n.maru-table-wrapper .maru-table-body .expanding {\n border-bottom: unset !important;\n}\n.maru-table-wrapper .maru-checkbox {\n border-color: #bdbdbd;\n}\n.maru-table-wrapper .maru-table-body-kebab-wrapper {\n text-align: center;\n}\n.maru-table-wrapper .maru-table-body-kebab {\n margin: unset;\n padding: unset;\n height: auto;\n}\n.maru-table-wrapper .maru-table-body-empty-tr > td {\n width: 100%;\n vertical-align: middle;\n text-align: center;\n padding: 61px 0;\n}\n.maru-table-wrapper .maru-table-body-empty-tr > td p {\n margin-top: 10px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #bdbdbd;\n}\n.maru-table-wrapper .maru-table-body-expandable-button {\n width: 24px;\n height: 24px;\n padding: 0.2rem;\n}\n.maru-table-wrapper .maru-table-body-expanding-row {\n border: unset !important;\n}\n.maru-table-wrapper .maru-table-body-expanding-row.empty-last-expanding-row {\n border-bottom: 1px solid #bdbdbd !important;\n height: 12px !important;\n}";
6592
+ var css_248z = ".maru-table-wrapper {\n width: 100%;\n background-color: white;\n box-shadow: 0px 0px 6px #e4e4e4;\n border-radius: 15px;\n}\n.maru-table-wrapper .maru-table-header-wrapper,\n.maru-table-wrapper .maru-table-body-wrapper {\n width: 100%;\n}\n.maru-table-wrapper tr {\n height: 54px;\n}\n.maru-table-wrapper th,\n.maru-table-wrapper td {\n text-align: start;\n vertical-align: middle;\n padding: 16.5px 15px;\n word-break: break-word;\n}\n.maru-table-wrapper .maru-table-header tr {\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-table-wrapper .maru-table-header tr th {\n color: #5c5c5c;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 700;\n}\n.maru-table-wrapper .maru-table-header .maru-table-header-sortable {\n padding: unset;\n margin: unset;\n color: #5c5c5c;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 700;\n}\n.maru-table-wrapper .maru-table-body-scroll-wrapper {\n overflow-y: auto;\n}\n.maru-table-wrapper .maru-table-body-scroll-wrapper .maru-table-scroll {\n overflow-y: auto;\n}\n.maru-table-wrapper .maru-table-body tr:not(:last-of-type) {\n border-bottom: 1px solid #fafafa;\n}\n.maru-table-wrapper .maru-table-body tr:hover,\n.maru-table-wrapper .maru-table-body .clickable-row:hover,\n.maru-table-wrapper .maru-table-body .selected-row {\n background-color: var(--p-10) !important;\n}\n.maru-table-wrapper .maru-table-body td {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}\n.maru-table-wrapper .maru-table-body tr:last-of-type td:first-of-type {\n border-bottom-left-radius: 15px;\n}\n.maru-table-wrapper .maru-table-body tr:last-of-type td:last-of-type {\n border-bottom-right-radius: 15px;\n}\n.maru-table-wrapper .maru-table-body .clickable-row {\n cursor: pointer;\n}\n.maru-table-wrapper .maru-table-body .expanding {\n border-bottom: unset !important;\n}\n.maru-table-wrapper .maru-checkbox {\n border-color: #bdbdbd;\n}\n.maru-table-wrapper .maru-table-body-kebab-wrapper {\n text-align: center;\n}\n.maru-table-wrapper .maru-table-body-kebab {\n margin: unset;\n padding: unset;\n height: auto;\n}\n.maru-table-wrapper .maru-table-body-empty-tr > td {\n width: 100%;\n vertical-align: middle;\n text-align: center;\n padding: 61px 0;\n}\n.maru-table-wrapper .maru-table-body-empty-tr > td p {\n margin-top: 10px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #bdbdbd;\n}\n.maru-table-wrapper .maru-table-body-expandable-button {\n width: 24px;\n height: 24px;\n padding: 0.2rem;\n}\n.maru-table-wrapper .maru-table-body-expanding-row {\n border: unset !important;\n}\n.maru-table-wrapper .maru-table-body-expanding-row.empty-last-expanding-row {\n border-bottom: 1px solid #bdbdbd !important;\n height: 12px !important;\n}";
6573
6593
  styleInject(css_248z);
6574
6594
 
6575
6595
  // eslint-disable-next-line import/prefer-default-export
@@ -6588,12 +6608,12 @@ function Table(_a) {
6588
6608
  // expandingFormat,
6589
6609
  // onTableMouseEnter,
6590
6610
  // onTableMouseLeave,
6591
- // onRowClick,
6611
+ onRowClick = _a.onRowClick,
6612
+ selectedRow = _a.selectedRow,
6592
6613
  // onRowMouseOver,
6593
6614
  // onRowMouseLeave,
6594
6615
  className = _a.className,
6595
6616
  id = _a.id,
6596
- // focusedRowInfo,
6597
6617
  tableMaxHeight = _a.tableMaxHeight,
6598
6618
  noData = _a.noData,
6599
6619
  loading = _a.loading;
@@ -6744,10 +6764,10 @@ function Table(_a) {
6744
6764
  // expandingIdKey={expandingIdKey}
6745
6765
  // expandingRowIdKey={expandingRowIdKey}
6746
6766
  // expandingFormat={expandingFormat}
6747
- // onRowClick={onRowClick}
6767
+ onRowClick: onRowClick,
6748
6768
  // onRowMouseOver={onRowMouseOver}
6749
6769
  // onRowMouseLeave={onRowMouseLeave}
6750
- // focusedRowInfo={focusedRowInfo}
6770
+ selectedRow: selectedRow,
6751
6771
  noData: noData,
6752
6772
  loading: loading
6753
6773
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",