maru_design2 0.0.4 → 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.
@@ -20,7 +20,7 @@ interface DropdownProps<T extends Record<string, any>> {
20
20
  /**
21
21
  * 컴포넌트 위치의 기준이 될 엘리먼트 사용자 정의. (@v1 portalAnchor)
22
22
  */
23
- anchorEl?: HTMLElement;
23
+ anchorEl?: HTMLElement | null;
24
24
  className?: string;
25
25
  /**
26
26
  * ['primary', 'secondary', 'positive', 'warning', 'danger']
@@ -46,14 +46,6 @@ interface DropdownProps<T extends Record<string, any>> {
46
46
  * 토글 안 좌측 상단에 노출할 라벨. (@v1 insideLabel)
47
47
  */
48
48
  inlineLabel?: string;
49
- /**
50
- * 메뉴 세로 크기(px). default=auto. (@v1 menuPosition.height)
51
- */
52
- height?: number;
53
- /**
54
- * 메뉴 아이템의 방향이 가로방향인지 여부. true인 경우 메뉴 뜨는 위치는 토글의 bottom-end. (@v1 isHorizonMenu)
55
- */
56
- horizonMenu?: boolean;
57
49
  label?: string;
58
50
  /**
59
51
  * 데이터가 없을때 메시지
@@ -84,6 +76,10 @@ interface DropdownProps<T extends Record<string, any>> {
84
76
  * 토글, 메뉴 가로 크기(px). default=100%. (@v1 menuPosition.width)
85
77
  */
86
78
  width?: number;
79
+ /**
80
+ * 메뉴 세로 크기(px). default=auto. (@v1 menuPosition.height)
81
+ */
82
+ height?: number;
87
83
  }
88
- export declare function Dropdown<T extends Record<string, any>>({ data, selectedId, onSelect, idKey, displayKey, anchorEl, className, color, customButton, customMenuItem, disabled, errorMessage, inlineLabel, height, horizonMenu, label, noDataMessage, noSearchedMessage, onClear, placeholder, startArrow, toggleEndNode, type, width, }: DropdownProps<T>): import("react/jsx-runtime").JSX.Element;
84
+ export declare function Dropdown<T extends Record<string, any>>({ data, selectedId, onSelect, idKey, displayKey, anchorEl, className, color, customButton, customMenuItem, disabled, errorMessage, inlineLabel, label, noDataMessage, noSearchedMessage, onClear, placeholder, startArrow, toggleEndNode, type, width, height, }: DropdownProps<T>): import("react/jsx-runtime").JSX.Element;
89
85
  export {};
@@ -6,7 +6,6 @@ interface Props<T extends Record<string, any>> {
6
6
  idKey: string;
7
7
  displayKey: string;
8
8
  filteredData: T[];
9
- horizonMenu?: boolean;
10
9
  width?: number;
11
10
  height?: number;
12
11
  noMessage?: string;
@@ -17,5 +16,5 @@ interface Props<T extends Record<string, any>> {
17
16
  onSelect: (id?: string) => void;
18
17
  closeMenu: () => void;
19
18
  }
20
- declare function DropdownMenu<T extends Record<string, any>>({ parent, menuItemEls, selectedId, idKey, displayKey, filteredData, horizonMenu, width, height, noMessage, customMenuItem: CustomMenuItem, onSelect, closeMenu, }: Props<T>): import("react/jsx-runtime").JSX.Element;
19
+ declare function DropdownMenu<T extends Record<string, any>>({ parent, menuItemEls, selectedId, idKey, displayKey, filteredData, width, height, noMessage, customMenuItem: CustomMenuItem, onSelect, closeMenu, }: Props<T>): import("react/jsx-runtime").JSX.Element;
21
20
  export default DropdownMenu;
@@ -1,7 +1,8 @@
1
1
  import { TColor } from '../../../../enums/color';
2
2
  interface Props {
3
3
  open: boolean;
4
+ focus: boolean;
4
5
  color: TColor;
5
6
  }
6
- declare function Arrow({ open, color }: Props): import("react/jsx-runtime").JSX.Element;
7
+ declare function Arrow({ open, focus, color }: Props): import("react/jsx-runtime").JSX.Element;
7
8
  export default Arrow;
@@ -15,12 +15,12 @@ export interface PaginationProps {
15
15
  totalPage: number;
16
16
  className?: string;
17
17
  /**
18
- * 페이지네이션의 전후 버튼 숨김 여부. (@v1 buttonVisibility)
18
+ * prev, next 버튼 공간 차지 여부
19
19
  */
20
- hiddenButton?: boolean;
20
+ buttonVisibility?: 'visible' | 'hidden';
21
21
  /**
22
22
  * 데이터 타입. ['button', 'input'] (@v1 isSearch)
23
23
  */
24
24
  type?: TButtonType;
25
25
  }
26
- export declare function Pagination({ page, onPageChange, totalPage, className, hiddenButton, type, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function Pagination({ page, onPageChange, totalPage, className, buttonVisibility, type, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -3031,7 +3031,7 @@ function uuidv4(length) {
3031
3031
  }
3032
3032
  }
3033
3033
 
3034
- var css_248z$9 = ".maru-checkbox-wrapper-4px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 4px;\n}\n\n.maru-checkbox-wrapper-8px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n}\n\n.maru-checkbox-inner-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.maru-checkbox {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n}\n\n.maru-checkbox-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.maru-checkbox-label.label-disabled {\n color: #8c8c8c;\n}\n\n.maru-checkbox:disabled,\n.label-disabled {\n cursor: default;\n}";
3034
+ var css_248z$9 = ".maru-checkbox-wrapper-4px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 4px;\n}\n\n.maru-checkbox-wrapper-8px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n}\n\n.maru-checkbox-inner-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n position: relative;\n}\n\n.maru-checkbox {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n}\n\n.maru-checkbox-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.maru-checkbox-label.label-disabled {\n color: #8c8c8c;\n}\n\n.maru-checkbox:disabled,\n.label-disabled {\n cursor: default;\n}";
3035
3035
  styleInject(css_248z$9);
3036
3036
 
3037
3037
  var Checkbox = /*#__PURE__*/forwardRef(function (_a, ref) {
@@ -3098,11 +3098,10 @@ function Chip(_a) {
3098
3098
  return jsxs("div", __assign({
3099
3099
  className: classNames('maru-chip', "maru-chip-".concat(color, "-").concat(variant), "maru-chip-size-".concat(size), className)
3100
3100
  }, {
3101
- children: [variant === 'dot' &&
3102
- // TODO: modify icon color to enum+string
3103
- jsx(Icon, {
3101
+ children: [variant === 'dot' && jsx(Icon, {
3104
3102
  name: ICONS.StateThin,
3105
- size: 16
3103
+ size: 16,
3104
+ color: color
3106
3105
  }), jsx("span", {
3107
3106
  children: content.toLocaleString('en')
3108
3107
  })]
@@ -5315,7 +5314,7 @@ function Toggle(_a) {
5315
5314
  });
5316
5315
  }
5317
5316
 
5318
- var css_248z$3 = ".maru-tooltip-wrapper {\n position: relative;\n display: inline-flex;\n}\n\n.maru-tooltip {\n z-index: 1612;\n position: absolute;\n border-radius: 5px;\n padding: 2px 4px;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n}\n\n.maru-tooltip-default {\n background-color: rgba(92, 92, 92, 0.5019607843);\n}\n.maru-tooltip-default,\n.maru-tooltip-default span,\n.maru-tooltip-default p,\n.maru-tooltip-default pre {\n color: white;\n white-space: pre-wrap;\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\n.maru-tooltip-danger {\n background-color: rgba(229, 62, 62, 0.1019607843);\n}\n.maru-tooltip-danger,\n.maru-tooltip-danger span,\n.maru-tooltip-danger p,\n.maru-tooltip-danger pre {\n color: #e53e3e;\n white-space: pre-wrap;\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}";
5317
+ var css_248z$3 = ".maru-tooltip {\n z-index: 1612;\n border-radius: 5px;\n padding: 2px 4px;\n display: none;\n}\n.maru-tooltip[data-open=true] {\n display: block;\n}\n.maru-tooltip[data-open=false] {\n display: none;\n}\n\n.maru-tooltip-default {\n background-color: rgba(92, 92, 92, 0.5019607843);\n}\n.maru-tooltip-default,\n.maru-tooltip-default span,\n.maru-tooltip-default p,\n.maru-tooltip-default pre {\n color: white;\n white-space: pre-wrap;\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\n.maru-tooltip-danger {\n background-color: rgba(229, 62, 62, 0.1019607843);\n}\n.maru-tooltip-danger,\n.maru-tooltip-danger span,\n.maru-tooltip-danger p,\n.maru-tooltip-danger pre {\n color: #e53e3e;\n white-space: pre-wrap;\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}";
5319
5318
  styleInject(css_248z$3);
5320
5319
 
5321
5320
  function Tooltip(_a) {
@@ -5365,15 +5364,18 @@ function Tooltip(_a) {
5365
5364
  instance_1.update();
5366
5365
  }
5367
5366
  }, [open]);
5368
- var Tootip = open ? jsx("div", __assign({
5369
- ref: tooltipRef,
5370
- className: classNames('maru-tooltip', "maru-tooltip-".concat(color)),
5371
- role: "tooltip"
5372
- }, {
5373
- children: content
5374
- })) : null;
5367
+ var Tootip = useMemo(function () {
5368
+ return jsx("div", __assign({
5369
+ className: classNames('maru-tooltip', "maru-tooltip-".concat(color)),
5370
+ ref: tooltipRef,
5371
+ role: "tooltip",
5372
+ "data-open": open
5373
+ }, {
5374
+ children: content
5375
+ }));
5376
+ }, [open]);
5375
5377
  return jsxs("div", __assign({
5376
- className: classNames('maru-tooltip-wrapper', className),
5378
+ className: className,
5377
5379
  ref: wrapperRef,
5378
5380
  onMouseOver: function onMouseOver() {
5379
5381
  return setOpen(true);
@@ -5450,13 +5452,14 @@ var setHighlightTextOnDataExceptSpace = function setHighlightTextOnDataExceptSpa
5450
5452
 
5451
5453
  function Arrow(_a) {
5452
5454
  var open = _a.open,
5455
+ focus = _a.focus,
5453
5456
  color = _a.color;
5454
5457
  return jsx("span", __assign({
5455
5458
  className: "maru-dropdown-toggle-arrow"
5456
5459
  }, {
5457
5460
  children: jsx(Icon, {
5458
5461
  name: open ? ICONS.ChevronUp : ICONS.ChevronDown,
5459
- color: color,
5462
+ color: focus || open ? color : '#e4e4e4',
5460
5463
  size: 16
5461
5464
  })
5462
5465
  }));
@@ -5484,7 +5487,6 @@ function Clear(_a) {
5484
5487
  }, {
5485
5488
  children: jsx(Icon, {
5486
5489
  name: ICONS.XSmallThin,
5487
- color: "gray",
5488
5490
  size: 20
5489
5491
  })
5490
5492
  }))
@@ -5510,6 +5512,9 @@ function DropdownToggleButton(_a) {
5510
5512
  clearSelected = _a.clearSelected,
5511
5513
  onClear = _a.onClear,
5512
5514
  onKeyDown = _a.onKeyDown;
5515
+ var _b = useState(false),
5516
+ focus = _b[0],
5517
+ setFocus = _b[1];
5513
5518
  var handleClick = function handleClick() {
5514
5519
  if (disabled) return;
5515
5520
  initFilteredData();
@@ -5522,6 +5527,18 @@ function DropdownToggleButton(_a) {
5522
5527
  }),
5523
5528
  style: {
5524
5529
  width: width || '100%'
5530
+ },
5531
+ onMouseOver: function onMouseOver() {
5532
+ return setFocus(true);
5533
+ },
5534
+ onMouseLeave: function onMouseLeave() {
5535
+ return setFocus(open);
5536
+ },
5537
+ onFocus: function onFocus() {
5538
+ return setFocus(true);
5539
+ },
5540
+ onBlur: function onBlur() {
5541
+ return setFocus(false);
5525
5542
  }
5526
5543
  }, {
5527
5544
  children: [inlineLabel && jsx("span", __assign({
@@ -5537,6 +5554,7 @@ function DropdownToggleButton(_a) {
5537
5554
  }, {
5538
5555
  children: [startArrow && !disabled && jsx(Arrow, {
5539
5556
  open: open,
5557
+ focus: focus,
5540
5558
  color: color
5541
5559
  }), jsx("span", __assign({
5542
5560
  className: classNames('maru-dropdown-button-contents', {
@@ -5553,6 +5571,7 @@ function DropdownToggleButton(_a) {
5553
5571
  initFilteredData: initFilteredData
5554
5572
  }), !startArrow && !disabled && jsx(Arrow, {
5555
5573
  open: open,
5574
+ focus: focus,
5556
5575
  color: color
5557
5576
  })]
5558
5577
  }))]
@@ -5578,6 +5597,9 @@ function DropdownToggleInput(_a) {
5578
5597
  clearSelected = _a.clearSelected,
5579
5598
  onClear = _a.onClear,
5580
5599
  onKeyDown = _a.onKeyDown;
5600
+ var _b = useState(false),
5601
+ focus = _b[0],
5602
+ setFocus = _b[1];
5581
5603
  var handleClick = function handleClick() {
5582
5604
  if (disabled) return;
5583
5605
  initFilteredData();
@@ -5595,7 +5617,19 @@ function DropdownToggleInput(_a) {
5595
5617
  style: {
5596
5618
  width: width || '100%'
5597
5619
  },
5598
- onKeyDown: onKeyDown
5620
+ onKeyDown: onKeyDown,
5621
+ onMouseOver: function onMouseOver() {
5622
+ return setFocus(true);
5623
+ },
5624
+ onMouseLeave: function onMouseLeave() {
5625
+ return setFocus(open);
5626
+ },
5627
+ onFocus: function onFocus() {
5628
+ return setFocus(true);
5629
+ },
5630
+ onBlur: function onBlur() {
5631
+ return setFocus(false);
5632
+ }
5599
5633
  }, {
5600
5634
  children: [inlineLabel && jsx("span", __assign({
5601
5635
  className: "inline-label"
@@ -5606,6 +5640,7 @@ function DropdownToggleInput(_a) {
5606
5640
  }, {
5607
5641
  children: [startArrow && !disabled && jsx(Arrow, {
5608
5642
  open: open,
5643
+ focus: focus,
5609
5644
  color: color
5610
5645
  }), jsx("input", {
5611
5646
  "aria-autocomplete": "none",
@@ -5622,6 +5657,7 @@ function DropdownToggleInput(_a) {
5622
5657
  initFilteredData: initFilteredData
5623
5658
  }), !startArrow && !disabled && jsx(Arrow, {
5624
5659
  open: open,
5660
+ focus: focus,
5625
5661
  color: color
5626
5662
  })]
5627
5663
  }))]
@@ -5635,11 +5671,9 @@ function DropdownMenu(_a) {
5635
5671
  idKey = _a.idKey,
5636
5672
  displayKey = _a.displayKey,
5637
5673
  filteredData = _a.filteredData,
5638
- horizonMenu = _a.horizonMenu,
5639
5674
  width = _a.width,
5640
5675
  height = _a.height,
5641
5676
  noMessage = _a.noMessage,
5642
- // menuBottomButton,
5643
5677
  CustomMenuItem = _a.customMenuItem,
5644
5678
  onSelect = _a.onSelect,
5645
5679
  closeMenu = _a.closeMenu;
@@ -5656,12 +5690,12 @@ function DropdownMenu(_a) {
5656
5690
  pl = _a.left;
5657
5691
  var newWidth = width || pw;
5658
5692
  menu.style.width = "".concat(newWidth, "px");
5659
- if (!horizonMenu) {
5660
- menu.style.left = "".concat(pl, "px");
5661
- } else {
5662
- // TODO: horizon menu test
5663
- menu.style.left = "".concat(pl + pw - newWidth, "px");
5664
- }
5693
+ // if (!horizonMenu) {
5694
+ menu.style.left = "".concat(pl, "px");
5695
+ // } else {
5696
+ // TODO: horizon menu test
5697
+ // menu.style.left = `${pl + pw - newWidth}px`;
5698
+ // }
5665
5699
  // FIXME: 무슨 조건인지 잘 모르겠음
5666
5700
  if (ph + pt + menu.offsetHeight + 10 > document.body.offsetHeight) {
5667
5701
  menu.style.top = "".concat(pt - menu.offsetHeight - 4, "px");
@@ -5672,7 +5706,8 @@ function DropdownMenu(_a) {
5672
5706
  menuWrapperRef.current.style.display = 'block';
5673
5707
  }
5674
5708
  }
5675
- }, [horizonMenu]);
5709
+ }, [width]);
5710
+ // }, [horizonMenu]);
5676
5711
  var handleWrapperClick = function handleWrapperClick(e) {
5677
5712
  e.stopPropagation();
5678
5713
  closeMenu();
@@ -5760,6 +5795,7 @@ function DropdownMenu(_a) {
5760
5795
  var css_248z$2 = ".maru-dropdown .maru-dropdown-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: 600;\n color: #5c5c5c;\n display: block;\n margin-bottom: 4px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper {\n width: 100%;\n border-radius: 8px;\n border: 1px solid #e4e4e4;\n cursor: pointer;\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-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover {\n border: 1px solid var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within {\n border: 1px solid var(--p);\n outline: none;\n background-color: var(--p-10);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover {\n border: 1px solid #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within {\n border: 1px solid #8c8c8c;\n outline: none;\n background-color: #fafafa;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover {\n border: 1px solid #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within {\n border: 1px solid #58c5a6;\n outline: none;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover {\n border: 1px solid #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within {\n border: 1px solid #ffb020;\n outline: none;\n background-color: #fff7e9;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover {\n border: 1px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within {\n border: 1px solid #e53e3e;\n outline: none;\n background-color: #fcecec;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.inline-label-wrapper .maru-dropdown-button {\n padding: 2px 10px 2px 14px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .inline-label {\n display: block;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 10px;\n letter-spacing: -0.4px;\n font-weight: 500;\n color: #bdbdbd;\n padding: 2px 10px 0 14px;\n transform: translateY(3px);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents.placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input {\n width: 100%;\n height: 100%;\n border: unset;\n outline: unset;\n background-color: unset;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-toggle-arrow {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.errored {\n border: 2px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-error-message {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n display: block;\n margin-top: 4px;\n}\n\n.maru-dropdown-menu-wrapper {\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 1600;\n display: none;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu {\n margin-top: 4px;\n position: absolute;\n z-index: 1601;\n border-radius: 8px;\n box-shadow: 0px 0px 6px #e4e4e4;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper {\n overflow-y: auto;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n background-color: white;\n border: unset;\n cursor: pointer;\n height: 37px;\n padding: 8px 14px;\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}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-selected, .maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item:hover {\n background-color: #fafafa;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n text-align: start;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span em {\n font-style: unset;\n background-color: var(--p-20-per);\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-no-data {\n background-color: transparent;\n border: unset;\n}";
5761
5796
  styleInject(css_248z$2);
5762
5797
 
5798
+ // eslint-disable-next-line import/prefer-default-export
5763
5799
  function Dropdown(_a) {
5764
5800
  var data = _a.data,
5765
5801
  selectedId = _a.selectedId,
@@ -5775,8 +5811,6 @@ function Dropdown(_a) {
5775
5811
  disabled = _a.disabled,
5776
5812
  errorMessage = _a.errorMessage,
5777
5813
  inlineLabel = _a.inlineLabel,
5778
- height = _a.height,
5779
- horizonMenu = _a.horizonMenu,
5780
5814
  label = _a.label,
5781
5815
  noDataMessage = _a.noDataMessage,
5782
5816
  noSearchedMessage = _a.noSearchedMessage,
@@ -5786,7 +5820,8 @@ function Dropdown(_a) {
5786
5820
  toggleEndNode = _a.toggleEndNode,
5787
5821
  _c = _a.type,
5788
5822
  type = _c === void 0 ? 'button' : _c,
5789
- width = _a.width;
5823
+ width = _a.width,
5824
+ height = _a.height;
5790
5825
  var _d = useState(false),
5791
5826
  open = _d[0],
5792
5827
  setOpen = _d[1];
@@ -5957,11 +5992,9 @@ function Dropdown(_a) {
5957
5992
  idKey: idKey,
5958
5993
  displayKey: displayKey,
5959
5994
  filteredData: filteredData,
5960
- horizonMenu: horizonMenu,
5961
5995
  width: width,
5962
5996
  height: height,
5963
5997
  noMessage: type === 'button' ? noDataMessage : noSearchedMessage,
5964
- // menuBottomButton={menuBottomButton}
5965
5998
  customMenuItem: customMenuItem,
5966
5999
  onSelect: onSelect,
5967
6000
  closeMenu: closeMenu
@@ -5970,7 +6003,7 @@ function Dropdown(_a) {
5970
6003
  }));
5971
6004
  }
5972
6005
 
5973
- var css_248z$1 = ".maru-modal-wrapper {\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n background-color: rgba(92, 92, 92, 0.5019607843);\n display: none;\n z-index: 6006;\n}\n.maru-modal-wrapper[data-show=true] {\n display: block;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-modal-wrapper .maru-modal {\n background-color: white;\n padding: 40px;\n border-radius: 20px;\n box-shadow: 0px 5px 20px 5px #8c8c8c;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xs {\n width: 300px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-s {\n width: 400px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m {\n width: 550px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l {\n width: 860px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl {\n width: 1160px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n margin-bottom: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header > h1 {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 16px;\n letter-spacing: -0.64px;\n font-weight: 700;\n color: #5c5c5c;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n flex-direction: row;\n margin-top: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer button {\n margin: 0 0 0 8px;\n}";
6006
+ var css_248z$1 = ".maru-modal-wrapper {\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n background-color: rgba(92, 92, 92, 0.5019607843);\n z-index: 6006;\n display: block;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-modal-wrapper .maru-modal {\n background-color: white;\n padding: 40px;\n border-radius: 20px;\n box-shadow: 0px 5px 20px 5px #8c8c8c;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xs {\n width: 300px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-s {\n width: 400px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m {\n width: 550px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l {\n width: 860px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl {\n width: 1160px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n margin-bottom: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header > h1 {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 16px;\n letter-spacing: -0.64px;\n font-weight: 700;\n color: #5c5c5c;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n flex-direction: row;\n margin-top: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer button {\n margin: 0 0 0 8px;\n}";
5974
6007
  styleInject(css_248z$1);
5975
6008
 
5976
6009
  function Modal(_a) {
@@ -6009,6 +6042,9 @@ function Modal(_a) {
6009
6042
  (_a = okButton === null || okButton === void 0 ? void 0 : okButton.onClick) === null || _a === void 0 ? void 0 : _a.call(okButton);
6010
6043
  }
6011
6044
  };
6045
+ var handleClose = function handleClose() {
6046
+ onClose();
6047
+ };
6012
6048
  var handleModalClick = function handleModalClick(e) {
6013
6049
  e.stopPropagation();
6014
6050
  };
@@ -6016,9 +6052,6 @@ function Modal(_a) {
6016
6052
  e.stopPropagation();
6017
6053
  };
6018
6054
  // FIXME: 취소에서 탭 > 엔터하면 confirm 동작. 확인 필요
6019
- var handleCancelClick = function handleCancelClick() {
6020
- onClose();
6021
- };
6022
6055
  var handleOkButtonClick = function handleOkButtonClick() {
6023
6056
  var _a;
6024
6057
  (_a = okButton === null || okButton === void 0 ? void 0 : okButton.onClick) === null || _a === void 0 ? void 0 : _a.call(okButton);
@@ -6031,7 +6064,6 @@ function Modal(_a) {
6031
6064
  className: "maru-modal-wrapper",
6032
6065
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
6033
6066
  tabIndex: 0,
6034
- "data-show": open,
6035
6067
  onClick: handleWrapperClick,
6036
6068
  onKeyDown: handleWrapperKeyDown,
6037
6069
  role: "presentation"
@@ -6048,8 +6080,14 @@ function Modal(_a) {
6048
6080
  }, {
6049
6081
  children: [title && jsx("h1", {
6050
6082
  children: title
6051
- }), !hiddenCloseButton && jsx("span", {
6052
- children: "X"
6083
+ }), !hiddenCloseButton && jsx(Button, {
6084
+ startIcon: {
6085
+ name: ICONS.XLarge,
6086
+ size: 20,
6087
+ color: '#5c5c5c'
6088
+ },
6089
+ color: "secondary",
6090
+ onClick: handleClose
6053
6091
  })]
6054
6092
  })), jsx("main", __assign({
6055
6093
  className: "maru-modal-body"
@@ -6060,7 +6098,7 @@ function Modal(_a) {
6060
6098
  }, {
6061
6099
  children: [cancelButton && jsx(Button, __assign({
6062
6100
  color: "secondary",
6063
- onClick: handleCancelClick,
6101
+ onClick: handleClose,
6064
6102
  onKeyDown: handleFooterKeyDown,
6065
6103
  disabled: cancelButton.disabled
6066
6104
  }, {
@@ -6093,36 +6131,37 @@ function Pagination(_a) {
6093
6131
  onPageChange = _a.onPageChange,
6094
6132
  totalPage = _a.totalPage,
6095
6133
  className = _a.className,
6096
- hiddenButton = _a.hiddenButton,
6097
- _b = _a.type,
6098
- type = _b === void 0 ? 'button' : _b;
6099
- var _c = useState(false),
6100
- prevDisabled = _c[0],
6101
- setPrevDisabled = _c[1];
6134
+ _b = _a.buttonVisibility,
6135
+ buttonVisibility = _b === void 0 ? 'visible' : _b,
6136
+ _c = _a.type,
6137
+ type = _c === void 0 ? 'button' : _c;
6102
6138
  var _d = useState(false),
6103
- nextDisabled = _d[0],
6104
- setNextDisabled = _d[1];
6105
- var _e = useState(-1),
6106
- inputValue = _e[0],
6107
- setInputValue = _e[1];
6139
+ prevDisabled = _d[0],
6140
+ setPrevDisabled = _d[1];
6141
+ var _e = useState(false),
6142
+ nextDisabled = _e[0],
6143
+ setNextDisabled = _e[1];
6144
+ var _f = useState(-1),
6145
+ inputValue = _f[0],
6146
+ setInputValue = _f[1];
6108
6147
  var prevVisibility = useMemo(function () {
6109
6148
  if (totalPage > 1 && !prevDisabled) {
6110
6149
  return 'visible';
6111
6150
  }
6112
- if (hiddenButton) {
6151
+ if (buttonVisibility === 'hidden') {
6113
6152
  return 'hidden';
6114
6153
  }
6115
6154
  return undefined;
6116
- }, [totalPage, prevDisabled, hiddenButton]);
6155
+ }, [totalPage, prevDisabled, buttonVisibility]);
6117
6156
  var nextVisibility = useMemo(function () {
6118
6157
  if (totalPage > 1 && !nextDisabled) {
6119
6158
  return 'visible';
6120
6159
  }
6121
- if (hiddenButton) {
6160
+ if (buttonVisibility === 'hidden') {
6122
6161
  return 'hidden';
6123
6162
  }
6124
6163
  return undefined;
6125
- }, [totalPage, nextDisabled, hiddenButton]);
6164
+ }, [totalPage, nextDisabled, buttonVisibility]);
6126
6165
  var defaultRange = useMemo(function () {
6127
6166
  var pageRange = [];
6128
6167
  var start = Math.floor((page - 1) / 10) * 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",
package/.babelrc.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "sourceType": "unambiguous",
3
- "presets": [
4
- [
5
- "@babel/preset-env",
6
- {
7
- "targets": {
8
- "chrome": 100
9
- }
10
- }
11
- ],
12
- [
13
- "@babel/preset-react",
14
- { "runtime": "automatic" }
15
- ],
16
- ["@babel/preset-typescript"]
17
- ],
18
- }
package/.eslintrc.json DELETED
@@ -1,110 +0,0 @@
1
- {
2
- "extends": [
3
- "airbnb",
4
- "plugin:react/recommended",
5
- "plugin:@typescript-eslint/recommended"
6
- ],
7
- "plugins": ["react", "@typescript-eslint", "prettier", "simple-import-sort"],
8
- "rules": {
9
- "no-tabs": [
10
- "error",
11
- {
12
- "allowIndentationTabs": true
13
- }
14
- ],
15
- "no-mixed-spaces-and-tabs": 0,
16
- "simple-import-sort/imports": [
17
- "warn",
18
- {
19
- "groups": [
20
- ["^react", "^(?!src)(?=@?\\w)"],
21
- [
22
- "constants",
23
- "hooks",
24
- "reducers",
25
- "routes",
26
- "store",
27
- "types",
28
- "utils"
29
- ],
30
- [
31
- "views",
32
- "^\\.\\.(?!/?$)",
33
- "^\\.\\./?$",
34
- "^\\./(?=.*/)(?!/?$)",
35
- "^\\.(?!/?$)",
36
- "^\\./?$",
37
- "components"
38
- ],
39
- ["assets", "^.+\\.s?css$"]
40
- ]
41
- }
42
- ],
43
- "import/order": "off",
44
- "import/extensions": [
45
- "off",
46
- {
47
- "ts": "always",
48
- "tsx": "always",
49
- "js": "always",
50
- "jsx": "always"
51
- }
52
- ],
53
- "import/no-unresolved": "off",
54
- "react/jsx-filename-extension": [
55
- "warn",
56
- {
57
- "extensions": [".ts", ".tsx"]
58
- }
59
- ],
60
- "react/destructuring-assignment": 0,
61
- "no-use-before-define": "off",
62
- "@typescript-eslint/no-use-before-define": ["error"],
63
- "import/no-extraneous-dependencies": [
64
- "error",
65
- {
66
- "devDependencies": true,
67
- "optionalDependencies": true,
68
- "peerDependencies": true
69
- }
70
- ],
71
- "linebreak-style": "off",
72
- "object-curly-newline": "off",
73
- "comma-dangle": "off",
74
- "react/prop-types": "off",
75
- "operator-linebreak": "off",
76
- "import/prefer-default-export": "warn",
77
- "no-console": "off",
78
- "implicit-arrow-linebreak": "off",
79
- "react/jsx-curly-newline": "off",
80
- "no-param-reassign": [
81
- "error",
82
- {
83
- "props": false
84
- }
85
- ],
86
- "@typescript-eslint/ban-types": "warn",
87
- "no-nested-ternary": "off",
88
- "indent": "off",
89
- "camelcase": "off",
90
- "no-confusing-arrow": "off",
91
- "function-paren-newline": "off",
92
- "@typescript-eslint/no-empty-function": "warn",
93
- "no-plusplus": "warn",
94
- "react/jsx-wrap-multilines": "off",
95
- "no-restricted-syntax": "off",
96
- "no-await-in-loop": "off",
97
- "react/require-default-props": [
98
- 1,
99
- {
100
- "functions": "ignore"
101
- }
102
- ],
103
- "jsx-a11y/label-has-associated-control": [
104
- 2,
105
- {
106
- "labelAttributes": ["htmlFor"]
107
- }
108
- ]
109
- }
110
- }
@@ -1,19 +0,0 @@
1
- name: "Chromatic"
2
-
3
- on: push
4
-
5
- jobs:
6
- chromatic-release:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- with:
11
- fetch-depth: 0
12
- - uses: actions/setup-node@v3
13
- with:
14
- node-version: 18
15
- - run: yarn
16
- - uses: chromaui/action@latest
17
- with:
18
- projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
19
- token: ${{ secrets.GITHUB_TOKEN }}
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "semi": true,
4
- "useTabs": false,
5
- "tabWidth": 2,
6
- "trailingComma": "all",
7
- "printWidth": 80
8
- }
@@ -1,29 +0,0 @@
1
- yarn run v1.22.22
2
- $ storybook build --output-dir /var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
3
- @storybook/cli v8.0.6
4
-
5
- info => Cleaning outputDir: ../../../../../var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
6
- info => Loading presets
7
- info => Building manager..
8
- info => Manager built (106 ms)
9
- info => Building preview..
10
- WARN No story files found for the specified pattern: src/**/*.mdx
11
- info Addon-docs: using MDX3
12
- info => Using implicit CSS loaders
13
- info => Using default Webpack5 setup
14
- info Using tsconfig paths for react-docgen
15
- WARN asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
16
- WARN This can impact web performance.
17
- WARN Assets:
18
- WARN 841.8b90d07c.iframe.bundle.js (1.51 MiB)
19
- WARN 589.80a80dfc.iframe.bundle.js (628 KiB)
20
- WARN entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
21
- WARN Entrypoints:
22
- WARN main (1.53 MiB)
23
- WARN runtime~main.fb7a63fd.iframe.bundle.js
24
- WARN 841.8b90d07c.iframe.bundle.js
25
- WARN main.26a48fe5.iframe.bundle.js
26
- WARN
27
- info => Preview built (5.97 s)
28
- info => Output directory: /var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
29
- Done in 8.54s.
@@ -1,224 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- const inputDir = './src/assets/icons';
6
- const outputDir = './src/components/atoms/icon';
7
- const svgs = fs.readdirSync(inputDir);
8
-
9
- // 아이콘의 정보들을 모을 객체
10
- const icons = {};
11
- // 아이콘의 이름을 모을 객체
12
- const names = {};
13
-
14
- const toCamelCase = (pascalStr) =>
15
- pascalStr
16
- .split('-')
17
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
18
- .join('');
19
-
20
- const readFile = (filePath, fileName, fileExtension) =>
21
- new Promise((resolve, reject) => {
22
- fs.readFile(filePath, 'utf8', (err, data) => {
23
- if (err) {
24
- reject(err);
25
- return;
26
- }
27
-
28
- console.log('---------- parsing start ----------');
29
-
30
- console.log('((data))', data);
31
-
32
- // svg args 추출
33
- const svgStartRegex = /<svg/g;
34
- const svgEndRegex = />/;
35
- const svgArgs = data.split(svgStartRegex)[1].split(svgEndRegex)[0];
36
-
37
- console.log('**svgArgs', svgArgs);
38
-
39
- // width 추출
40
- const widthRegex = /width=".{1,9}"/g;
41
- const width = svgArgs.match(widthRegex)?.[0]?.split('"')?.[1];
42
- console.log('*width', width);
43
-
44
- // height 추출
45
- const heightRegex = /height=".{1,9}"/g;
46
- const height = svgArgs.match(heightRegex)?.[0]?.split('"')?.[1];
47
- console.log('*height', height);
48
-
49
- // viewBox 추출
50
- const viewBoxRegex = /viewBox="[0-9\s-.]*"/;
51
- const viewBox = svgArgs.match(viewBoxRegex)?.[0]?.split('"')?.[1];
52
- console.log('*viewBox', viewBox);
53
-
54
- // svgFill 추출
55
- const fillRegex = /fill=".{1,9}"/g;
56
- const svgFill = svgArgs.match(fillRegex)?.[0]?.split('"')?.[1];
57
- console.log('*svgFill', svgFill);
58
-
59
- // path args 추출
60
- const pathStartRegex = /<path/g;
61
- const paths = data
62
- .split(pathStartRegex)
63
- .filter((_, idx) => idx > 0)
64
- .map((pathArgs) => {
65
- // d 추출
66
- const dRegex = /d=".*"/g;
67
- const d = pathArgs.match(dRegex)?.[0]?.split('"')?.[1];
68
- console.log('*d', d);
69
-
70
- // pathFill 추출
71
- const pathFill = pathArgs.match(fillRegex)?.[0]?.split('"')?.[1];
72
- console.log('*pathFill', pathFill);
73
-
74
- // fillRule 추출
75
- const fillRuleRegex = /fill-rule=".{1,9}"/g;
76
- const fillRule = pathArgs.match(fillRuleRegex)?.[0]?.split('"')?.[1];
77
- console.log('*fillRule', fillRule);
78
-
79
- // clipRule 추출
80
- const clipRuleRegex = /clip-rule=".{1,9}"/g;
81
- const clipRule = pathArgs.match(clipRuleRegex)?.[0]?.split('"')?.[1];
82
- console.log('*clipRule', clipRule);
83
-
84
- // stroke 추출
85
- const strokeRegex = /stroke=".{1,9}"/g;
86
- const stroke = pathArgs.match(strokeRegex)?.[0]?.split('"')?.[1];
87
- console.log('*stroke', stroke);
88
-
89
- // strokeWidth 추출
90
- const strokeWidthRegex = /stroke-width=".{1,9}"/g;
91
- const strokeWidth = pathArgs
92
- .match(strokeWidthRegex)?.[0]
93
- ?.split('"')?.[1];
94
- console.log('*strokeWidth', strokeWidth);
95
-
96
- // strokeLinecap 추출
97
- const strokeLinecapRegex = /stroke-linecap=".{1,9}"/g;
98
- const strokeLinecap = pathArgs
99
- .match(strokeLinecapRegex)?.[0]
100
- ?.split('"')?.[1];
101
- console.log('*strokeLinecap', strokeLinecap);
102
-
103
- // strokeLinejoin 추출
104
- const strokeLinejoinRegex = /stroke-linejoin=".{1,9}"/g;
105
- const strokeLinejoin = pathArgs
106
- .match(strokeLinejoinRegex)?.[0]
107
- ?.split('"')?.[1];
108
- console.log('*strokeLinejoin', strokeLinejoin);
109
-
110
- return {
111
- d,
112
- fill: pathFill,
113
- fillRule,
114
- clipRule,
115
- stroke,
116
- strokeWidth,
117
- strokeLinecap,
118
- strokeLinejoin,
119
- };
120
- });
121
-
122
- // circle args 추출
123
- const circleStartRegex = /<circle/g;
124
- const circles = data
125
- .split(circleStartRegex)
126
- .filter((_, idx) => idx > 0)
127
- .map((circleArgs) => {
128
- // cx 추출
129
- const cxRegex = /cx=".{1,9}"/g;
130
- const cx = circleArgs.match(cxRegex)?.[0]?.split('"')?.[1];
131
- console.log('*cx', cx);
132
-
133
- // cy 추출
134
- const cyRegex = /cy=".{1,9}"/g;
135
- const cy = circleArgs.match(cyRegex)?.[0]?.split('"')?.[1];
136
- console.log('*cy', cy);
137
-
138
- // r 추출
139
- const rRegex = /r=".{1,9}"/g;
140
- const r = circleArgs.match(rRegex)?.[0]?.split('"')?.[1];
141
- console.log('*r', r);
142
-
143
- // circleFill 추출
144
- const circleFill = circleArgs.match(fillRegex)?.[0]?.split('"')?.[1];
145
- console.log('*circleFill', circleFill);
146
-
147
- return { cx, cy, r, fill: circleFill };
148
- });
149
-
150
- const fileNameWithoutExtension = toCamelCase(
151
- fileName.split(fileExtension)[0],
152
- );
153
- console.log('fileNameWithoutExtension', fileNameWithoutExtension);
154
-
155
- icons[fileNameWithoutExtension] = {
156
- width,
157
- height,
158
- viewBox,
159
- fill: svgFill,
160
- paths,
161
- circles,
162
- };
163
- names[fileNameWithoutExtension] = fileNameWithoutExtension;
164
-
165
- resolve();
166
- });
167
- });
168
-
169
- async function main() {
170
- for (const svg of svgs) {
171
- const extension = path.extname(svg);
172
- if (extension === '.svg' && !svg.includes('NoConvert')) {
173
- await readFile(`${inputDir}/${svg}`, svg, extension);
174
- }
175
- }
176
-
177
- console.log('### icons', icons);
178
- console.log('### names', names);
179
-
180
- fs.writeFileSync(
181
- `${outputDir}/iconmap.ts`,
182
- `/* eslint-disable no-multiple-empty-lines */
183
- /* eslint-disable no-trailing-spaces */
184
- /* eslint-disable eol-last */
185
- /* eslint-disable object-curly-spacing */
186
- /* eslint-disable comma-spacing */
187
- /* eslint-disable key-spacing */
188
- /* eslint-disable quotes */
189
- /* eslint-disable quote-props */
190
- export const iconmap: {
191
- [key: string]: {
192
- width: string;
193
- height: string;
194
- viewBox: string;
195
- fill: string;
196
- paths: {
197
- d: string;
198
- fill?: string;
199
- fillRule?: string;
200
- clipRule?: string;
201
- stroke?: string;
202
- strokeWidth?: string;
203
- strokeLinecap?: string;
204
- strokeLinejoin?: string;
205
- }[];
206
- circles: {
207
- cx: string;
208
- cy: string;
209
- r: string;
210
- fill: string;
211
- }[];
212
- };
213
- } = ${JSON.stringify(icons)};
214
- export const ICONS = ${JSON.stringify(names)} as const;
215
- export type TIcons = (typeof ICONS)[keyof typeof ICONS];
216
- `,
217
- 'utf8',
218
- (error) => {
219
- if (error) throw error;
220
- },
221
- );
222
- }
223
-
224
- main();