maru_design2 2.16.0 → 2.16.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.16.2](https://github.com/42maru-ai/maru-design2/compare/v2.16.1...v2.16.2) (2024-09-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * :bento: Icon - UPDATE,ADD sort icons ([c9b14c0](https://github.com/42maru-ai/maru-design2/commit/c9b14c094b4425f9e74d373bf67eb3212a7dbfce))
9
+ * :bug: Dropdown - UPDATE input type condition ([6dbf931](https://github.com/42maru-ai/maru-design2/commit/6dbf931fc35a1b5d8d1052ae15a7e196e0a18b11))
10
+ * :children_crossing: Table - UPDATE sort icon ([7be523c](https://github.com/42maru-ai/maru-design2/commit/7be523c625aa69560dd8ea0d0093b6f6a6cbdbb8))
11
+
12
+ ## [2.16.1](https://github.com/42maru-ai/maru-design2/compare/v2.16.0...v2.16.1) (2024-09-23)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * :lipstick: Radio - UPDATE primary color hover style ([2ecfdb6](https://github.com/42maru-ai/maru-design2/commit/2ecfdb696c8b14b2ab4d2c64f0a72e5ea9196b04))
18
+
3
19
  ## [2.16.0](https://github.com/42maru-ai/maru-design2/compare/v2.15.2...v2.16.0) (2024-09-10)
4
20
 
5
21
 
@@ -197,7 +197,9 @@ export declare const ICONS: {
197
197
  readonly Settings02_s2420: "Settings02_s2420";
198
198
  readonly Share03_s1215: "Share03_s1215";
199
199
  readonly Share03_s1613: "Share03_s1613";
200
- readonly SortOutline_s18: "SortOutline_s18";
200
+ readonly SortDown_s0815: "SortDown_s0815";
201
+ readonly SortOutline_s1415: "SortOutline_s1415";
202
+ readonly SortUp_s0815: "SortUp_s0815";
201
203
  readonly State_s16: "State_s16";
202
204
  readonly State_s18: "State_s18";
203
205
  readonly StopCircle_s1413: "StopCircle_s1413";
@@ -1,8 +1,15 @@
1
1
  import { IColumnFormats, ISort } from '../types';
2
2
  interface Props {
3
3
  format: IColumnFormats;
4
- currentSort?: ISort;
5
- onSortClick: (columnName: string, sortable: boolean) => () => void;
4
+ sort?: ISort;
5
+ onSortClick: (columnName: string) => () => void;
6
6
  }
7
- declare function SortableColumn({ format, currentSort, onSortClick }: Props): import("react/jsx-runtime").JSX.Element;
7
+ /**
8
+ * 정렬 아닌거 마우스오버하면 쌍방 화살표
9
+ * 내림차순 정렬이면 아래 화살표
10
+ * 오름차순 정렬이면 위 화살표
11
+ * 색깔은 언제나 b500 #5c5c5c
12
+ * @returns
13
+ */
14
+ declare function SortableColumn({ format, sort, onSortClick }: Props): import("react/jsx-runtime").JSX.Element;
8
15
  export default SortableColumn;
@@ -1,8 +1,8 @@
1
1
  import { IColumnFormats, ISort } from '../types';
2
2
  interface Props {
3
3
  formats: IColumnFormats[];
4
- currentSort?: ISort;
5
- onSortClick: (columnName: string, sortable: boolean) => () => void;
4
+ sort?: ISort;
5
+ onSortClick: (columnName: string) => () => void;
6
6
  hasCheckbox?: boolean;
7
7
  allCheckbox: boolean;
8
8
  onAllCheck: (checked: boolean) => void;
@@ -12,5 +12,5 @@ interface Props {
12
12
  onReset: () => void;
13
13
  };
14
14
  }
15
- declare function THead({ formats, currentSort, onSortClick, hasCheckbox, allCheckbox, onAllCheck, hasActionCol, filter, }: Props): import("react/jsx-runtime").JSX.Element;
15
+ declare function THead({ formats, sort, onSortClick, hasCheckbox, allCheckbox, onAllCheck, hasActionCol, filter, }: Props): import("react/jsx-runtime").JSX.Element;
16
16
  export default THead;
package/dist/index.js CHANGED
@@ -3031,26 +3031,89 @@ var iconmap = {
3031
3031
  "circles": [],
3032
3032
  "rects": []
3033
3033
  },
3034
- "SortOutline_s18": {
3035
- "width": "18",
3036
- "height": "18",
3037
- "viewBox": "0 0 18 18",
3034
+ "SortDown_s0815": {
3035
+ "width": "8",
3036
+ "height": "12",
3037
+ "viewBox": "0 0 8 12",
3038
3038
  "fill": "none",
3039
3039
  "paths": [{
3040
- "d": "M12.45 13.7988C12.0772 13.7988 11.775 13.4966 11.775 13.1238L11.775 6.78959L10.2273 8.33729C9.96367 8.6009 9.53629 8.6009 9.27268 8.33729C9.00908 8.07369 9.00908 7.6463 9.27269 7.3827L11.9197 4.73573C12.2125 4.44284 12.6874 4.44284 12.9803 4.73574L15.6273 7.38271C15.8909 7.64631 15.8909 8.0737 15.6273 8.3373C15.3637 8.6009 14.9363 8.6009 14.6727 8.3373L13.125 6.7896L13.125 13.1238C13.125 13.4966 12.8228 13.7988 12.45 13.7988Z",
3041
- "fill": "#8C8C8C",
3042
- "fillRule": "evenodd",
3043
- "clipRule": "evenodd"
3040
+ "d": "M3.85693 1V11",
3041
+ "stroke": "#8C8C8C",
3042
+ "strokeWidth": "1.5",
3043
+ "strokeLinecap": "round",
3044
+ "strokeLinejoin": "round"
3044
3045
  }, {
3045
- "d": "M4.94999 12.8388L4.94998 5.175C4.94998 4.80221 5.25219 4.5 5.62498 4.5C5.99777 4.5 6.29998 4.80221 6.29998 5.175L6.29999 12.8388C6.29999 13.2116 5.99778 13.5138 5.62499 13.5138C5.2522 13.5138 4.94999 13.2116 4.94999 12.8388Z",
3046
- "fill": "#8C8C8C",
3047
- "fillRule": "evenodd",
3048
- "clipRule": "evenodd"
3046
+ "d": "M6.71408 8.14258L3.85693 10.9997",
3047
+ "stroke": "#8C8C8C",
3048
+ "strokeWidth": "1.5",
3049
+ "strokeLinecap": "round",
3050
+ "strokeLinejoin": "round"
3049
3051
  }, {
3050
- "d": "M8.80229 9.96152C9.06589 10.2251 9.06589 10.6525 8.80229 10.9161L6.15532 13.5631C5.86243 13.856 5.38755 13.856 5.09466 13.5631L2.4477 10.9161C2.1841 10.6525 2.1841 10.2251 2.4477 9.96151C2.71131 9.69791 3.13869 9.69791 3.4023 9.96152L5.62499 12.1842L7.8477 9.96152C8.1113 9.69792 8.53869 9.69792 8.80229 9.96152Z",
3051
- "fill": "#8C8C8C",
3052
- "fillRule": "evenodd",
3053
- "clipRule": "evenodd"
3052
+ "d": "M1 8.14258L3.85714 10.9997",
3053
+ "stroke": "#8C8C8C",
3054
+ "strokeWidth": "1.5",
3055
+ "strokeLinecap": "round",
3056
+ "strokeLinejoin": "round"
3057
+ }],
3058
+ "circles": [],
3059
+ "rects": []
3060
+ },
3061
+ "SortOutline_s1415": {
3062
+ "width": "14",
3063
+ "height": "12",
3064
+ "viewBox": "0 0 14 12",
3065
+ "fill": "none",
3066
+ "paths": [{
3067
+ "d": "M3.61914 1V11",
3068
+ "stroke": "#8C8C8C",
3069
+ "strokeWidth": "1.5",
3070
+ "strokeLinecap": "round",
3071
+ "strokeLinejoin": "round"
3072
+ }, {
3073
+ "d": "M6.23809 3.61905L3.61905 1L1 3.61905",
3074
+ "stroke": "#8C8C8C",
3075
+ "strokeWidth": "1.5",
3076
+ "strokeLinecap": "round",
3077
+ "strokeLinejoin": "round"
3078
+ }, {
3079
+ "d": "M12.7937 8.38086L10.1747 10.9999L7.71436 8.38086",
3080
+ "stroke": "#8C8C8C",
3081
+ "strokeWidth": "1.5",
3082
+ "strokeLinecap": "round",
3083
+ "strokeLinejoin": "round"
3084
+ }, {
3085
+ "d": "M10.1748 11V1",
3086
+ "stroke": "#8C8C8C",
3087
+ "strokeWidth": "1.5",
3088
+ "strokeLinecap": "round",
3089
+ "strokeLinejoin": "round"
3090
+ }],
3091
+ "circles": [],
3092
+ "rects": []
3093
+ },
3094
+ "SortUp_s0815": {
3095
+ "width": "8",
3096
+ "height": "12",
3097
+ "viewBox": "0 0 8 12",
3098
+ "fill": "none",
3099
+ "paths": [{
3100
+ "d": "M3.85693 1V11",
3101
+ "stroke": "#8C8C8C",
3102
+ "strokeWidth": "1.5",
3103
+ "strokeLinecap": "round",
3104
+ "strokeLinejoin": "round"
3105
+ }, {
3106
+ "d": "M6.71408 3.85714L3.85693 1",
3107
+ "stroke": "#8C8C8C",
3108
+ "strokeWidth": "1.5",
3109
+ "strokeLinecap": "round",
3110
+ "strokeLinejoin": "round"
3111
+ }, {
3112
+ "d": "M1 3.85714L3.85714 1",
3113
+ "stroke": "#8C8C8C",
3114
+ "strokeWidth": "1.5",
3115
+ "strokeLinecap": "round",
3116
+ "strokeLinejoin": "round"
3054
3117
  }],
3055
3118
  "circles": [],
3056
3119
  "rects": []
@@ -3794,7 +3857,9 @@ var ICONS = {
3794
3857
  "Settings02_s2420": "Settings02_s2420",
3795
3858
  "Share03_s1215": "Share03_s1215",
3796
3859
  "Share03_s1613": "Share03_s1613",
3797
- "SortOutline_s18": "SortOutline_s18",
3860
+ "SortDown_s0815": "SortDown_s0815",
3861
+ "SortOutline_s1415": "SortOutline_s1415",
3862
+ "SortUp_s0815": "SortUp_s0815",
3798
3863
  "State_s16": "State_s16",
3799
3864
  "State_s18": "State_s18",
3800
3865
  "StopCircle_s1413": "StopCircle_s1413",
@@ -6197,7 +6262,7 @@ function Popover(_a) {
6197
6262
  }) : PopoverBody;
6198
6263
  }
6199
6264
 
6200
- var css_248z$b = ".maru-radio-wrapper-8px {\n display: flex;\n gap: 8px;\n}\n\n.maru-radio-wrapper-4px {\n display: flex;\n gap: 4px;\n}\n\n.maru-radio-wrapper-2px {\n display: flex;\n gap: 2px;\n}\n\n.maru-radio {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n border: 2px solid #5c5c5c;\n position: relative;\n display: inline-block;\n cursor: pointer;\n}\n.maru-radio:checked::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #5c5c5c;\n}\n\n.maru-radio:not(:disabled):hover::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #5c5c5c;\n}\n\n.maru-radio-primary {\n border: 2px solid var(--p);\n}\n.maru-radio-primary:hover::before, .maru-radio-primary:checked::before {\n background-color: var(--p);\n}\n\n.maru-radio-label {\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: #5c5c5c;\n cursor: pointer;\n}\n\n.maru-radio:disabled,\n.label-disabled {\n cursor: default;\n opacity: 0.5;\n}";
6265
+ var css_248z$b = ".maru-radio-wrapper-8px {\n display: flex;\n gap: 8px;\n}\n\n.maru-radio-wrapper-4px {\n display: flex;\n gap: 4px;\n}\n\n.maru-radio-wrapper-2px {\n display: flex;\n gap: 2px;\n}\n\n.maru-radio {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n border: 2px solid #5c5c5c;\n position: relative;\n display: inline-block;\n cursor: pointer;\n}\n.maru-radio:checked::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #5c5c5c;\n}\n.maru-radio:not(:disabled):hover::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #5c5c5c;\n}\n\n.maru-radio-primary {\n border: 2px solid var(--p);\n}\n.maru-radio-primary:checked::before {\n background-color: var(--p);\n}\n.maru-radio-primary:not(:disabled):hover::before {\n background-color: var(--p);\n}\n\n.maru-radio-label {\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: #5c5c5c;\n cursor: pointer;\n}\n\n.maru-radio:disabled,\n.label-disabled {\n cursor: default;\n opacity: 0.5;\n}";
6201
6266
  styleInject(css_248z$b);
6202
6267
 
6203
6268
  var Radio = /*#__PURE__*/forwardRef(function (_a, ref) {
@@ -23629,22 +23694,26 @@ function Dropdown(_a) {
23629
23694
  initInputValue();
23630
23695
  };
23631
23696
  useEffect(function () {
23632
- if (selected === null || selected === void 0 ? void 0 : selected[displayKey]) {
23633
- setInputValue(selected[displayKey]);
23634
- } else {
23635
- // selected === undefined
23636
- setInputValue('');
23697
+ if (type === 'input') {
23698
+ if (selected === null || selected === void 0 ? void 0 : selected[displayKey]) {
23699
+ setInputValue(selected[displayKey]);
23700
+ } else {
23701
+ // selected === undefined
23702
+ setInputValue('');
23703
+ }
23637
23704
  }
23638
- }, [selected]);
23705
+ }, [type, selected]);
23639
23706
  // type=input 일때, inputValue 변경 시(사용자가 타이핑) 메뉴 아이템 파싱하여 표시하기 위한 useEffect
23640
23707
  useEffect(function () {
23641
- var pretreatedQeury = noSpace(inputValue).toLowerCase();
23642
- if (pretreatedQeury !== '') {
23643
- setFilteredData(setHighlightTextOnDataExceptSpace(data, displayKey, pretreatedQeury));
23644
- } else {
23645
- initFilteredData();
23708
+ if (type === 'input') {
23709
+ var pretreatedQeury = noSpace(inputValue).toLowerCase();
23710
+ if (pretreatedQeury !== '') {
23711
+ setFilteredData(setHighlightTextOnDataExceptSpace(data, displayKey, pretreatedQeury));
23712
+ } else {
23713
+ initFilteredData();
23714
+ }
23646
23715
  }
23647
- }, [inputValue]);
23716
+ }, [type, inputValue]);
23648
23717
  var handleInputChange = function handleInputChange(e) {
23649
23718
  setInputValue(e.currentTarget.value);
23650
23719
  };
@@ -24419,22 +24488,43 @@ function FilterTh(_a) {
24419
24488
  }));
24420
24489
  }
24421
24490
 
24491
+ /**
24492
+ * 정렬 아닌거 마우스오버하면 쌍방 화살표
24493
+ * 내림차순 정렬이면 아래 화살표
24494
+ * 오름차순 정렬이면 위 화살표
24495
+ * 색깔은 언제나 b500 #5c5c5c
24496
+ * @returns
24497
+ */
24422
24498
  function SortableColumn(_a) {
24423
24499
  var format = _a.format,
24424
- currentSort = _a.currentSort,
24500
+ sort = _a.sort,
24425
24501
  onSortClick = _a.onSortClick;
24426
24502
  var _b = useState(false),
24427
24503
  hover = _b[0],
24428
24504
  setHover = _b[1];
24429
- var color = (currentSort === null || currentSort === void 0 ? void 0 : currentSort.columnName) === format.columnIdKey ? 'primary' : hover ? '#84B188' : '#8c8c8c';
24505
+ var iconName = useMemo(function () {
24506
+ // 정렬 아닌거 마우스오버하면 쌍방 화살표
24507
+ if (sort && sort.columnName !== format.columnIdKey && hover) {
24508
+ return ICONS.SortOutline_s1415;
24509
+ }
24510
+ if (sort && sort.columnName === format.columnIdKey) {
24511
+ // 내림차순 정렬이면 아래 화살표
24512
+ if (sort.desc) {
24513
+ return ICONS.SortDown_s0815;
24514
+ }
24515
+ // 오름차순 정렬이면 위 화살표
24516
+ return ICONS.SortUp_s0815;
24517
+ }
24518
+ return undefined;
24519
+ }, [sort, format, hover]);
24430
24520
  return !format.sortable ? jsx("span", {
24431
24521
  children: format.columnName
24432
24522
  }) : jsx(Button, __assign({
24433
- onClick: onSortClick(format.columnIdKey, format.sortable),
24523
+ onClick: onSortClick(format.columnIdKey),
24434
24524
  variant: "text",
24435
- endIcon: {
24436
- name: ICONS.SortOutline_s18,
24437
- color: color
24525
+ endIcon: iconName && {
24526
+ name: iconName,
24527
+ color: '#5c5c5c'
24438
24528
  },
24439
24529
  color: "secondary",
24440
24530
  className: "maru-table-header-sortable",
@@ -24451,7 +24541,7 @@ function SortableColumn(_a) {
24451
24541
 
24452
24542
  function THead(_a) {
24453
24543
  var formats = _a.formats,
24454
- currentSort = _a.currentSort,
24544
+ sort = _a.sort,
24455
24545
  onSortClick = _a.onSortClick,
24456
24546
  hasCheckbox = _a.hasCheckbox,
24457
24547
  allCheckbox = _a.allCheckbox,
@@ -24506,12 +24596,12 @@ function THead(_a) {
24506
24596
  }, {
24507
24597
  children: jsx(SortableColumn, {
24508
24598
  format: format,
24509
- currentSort: currentSort,
24599
+ sort: sort,
24510
24600
  onSortClick: onSortClick
24511
24601
  })
24512
24602
  })) : jsx(SortableColumn, {
24513
24603
  format: format,
24514
- currentSort: currentSort,
24604
+ sort: sort,
24515
24605
  onSortClick: onSortClick
24516
24606
  })
24517
24607
  }, "column-".concat(format.columnIdKey));
@@ -24631,19 +24721,14 @@ function Table(_a) {
24631
24721
  }
24632
24722
  }
24633
24723
  }, [data, checkedIds]);
24634
- var handleSortClick = function handleSortClick(columnName, sortable) {
24635
- if (sortable === void 0) {
24636
- sortable = false;
24637
- }
24724
+ var handleSortClick = function handleSortClick(columnName) {
24638
24725
  return function () {
24639
- var desc = function desc() {
24640
- if ((sort === null || sort === void 0 ? void 0 : sort.columnName) !== columnName) return true;
24641
- return !sort.desc;
24642
- };
24643
- if (sortable) {
24726
+ if (sort) {
24727
+ // 현재 정렬중인건 방향만 바꾸고 다른거 정렬시키려면 내림차순으로
24728
+ var desc = sort.columnName === columnName ? !sort.desc : true;
24644
24729
  onSort === null || onSort === void 0 ? void 0 : onSort({
24645
24730
  columnName: columnName,
24646
- desc: desc()
24731
+ desc: desc
24647
24732
  });
24648
24733
  }
24649
24734
  };
@@ -24690,7 +24775,7 @@ function Table(_a) {
24690
24775
  hasActionCol: hasActionCol
24691
24776
  }), jsx(THead, {
24692
24777
  formats: formats,
24693
- currentSort: sort,
24778
+ sort: sort,
24694
24779
  onSortClick: handleSortClick,
24695
24780
  hasCheckbox: checkedIds != null,
24696
24781
  allCheckbox: allChecked,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "2.16.0",
3
+ "version": "2.16.2",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",