maru_design2 2.13.0 → 2.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.14.0](https://github.com/42maru-ai/maru-design2/compare/v2.13.0...v2.14.0) (2024-08-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * :sparkles: Toast - UPDATE details ([9cf90fa](https://github.com/42maru-ai/maru-design2/commit/9cf90fafcbbc2b264b7538ce2eaaacd09f157a02))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * :adhesive_bandage: Toast - UPDATE details tag ([53e492f](https://github.com/42maru-ai/maru-design2/commit/53e492fb76f0faf010e5d0cde39da3d0480f6eee))
14
+ * :bug: Input - UPDATE input clear default state [#244](https://github.com/42maru-ai/maru-design2/issues/244) ([09c7f55](https://github.com/42maru-ai/maru-design2/commit/09c7f55bd691ff134086bfc83ae19596ea6fb1e1))
15
+ * :fire: Toast - REMOVE unused code ([5bec3f7](https://github.com/42maru-ai/maru-design2/commit/5bec3f71fd40676a14f532bcf57966949c32e2d9))
16
+ * :label: Toast - UPDATE IToastDetailItem ([9b42067](https://github.com/42maru-ai/maru-design2/commit/9b4206729488745f5240b1e3663ca0e889d4fb8e))
17
+ * :memo: TOAST - UPDATE storybook ([1456487](https://github.com/42maru-ai/maru-design2/commit/1456487adbf4fcf7b37fe3f201604223be4ac3ba))
18
+
3
19
  ## [2.13.0](https://github.com/42maru-ai/maru-design2/compare/v2.12.5...v2.13.0) (2024-07-23)
4
20
 
5
21
 
@@ -1,7 +1,6 @@
1
+ import { IToastDetailItem } from './types';
1
2
  interface DetailsProps {
2
- details: string[] | undefined;
3
- isDetailsOpen: boolean;
4
- handleToggleDetails: () => void;
3
+ details: IToastDetailItem[] | undefined;
5
4
  }
6
- export default function Details({ details, isDetailsOpen, handleToggleDetails, }: DetailsProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export default function Details({ details }: DetailsProps): import("react/jsx-runtime").JSX.Element | null;
7
6
  export {};
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { IToastDetailItem } from './types';
2
3
  import { TToastVariant } from '../../../enums/variant';
3
4
  export interface IToast {
4
5
  variant: TToastVariant;
5
6
  content: string;
6
7
  description?: React.ReactNode;
7
- details?: string[];
8
+ details?: IToastDetailItem[];
8
9
  disableAutoOff?: boolean;
9
10
  }
10
11
  export interface ToastProps {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IToastDetailItem } from './types';
2
3
  import { TToastVariant } from '../../../enums/variant';
3
4
  import './toast.scss';
4
5
  export interface ToastStyleProps {
@@ -14,7 +15,7 @@ export interface ToastStyleProps {
14
15
  /**
15
16
  * details, summary 태그를 활용하여 노출할 내용
16
17
  */
17
- details?: string[];
18
+ details?: IToastDetailItem[];
18
19
  onClose: () => void;
19
20
  }
20
21
  export declare function ToastStyle({ variant, content, description, details, onClose, }: ToastStyleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface IToastDetailItem {
2
+ summary: string;
3
+ subDetails: string[];
4
+ }
package/dist/index.js CHANGED
@@ -4141,6 +4141,12 @@ var Input = /*#__PURE__*/forwardRef(function (_a, inputRef) {
4141
4141
  setShowClearButton(false);
4142
4142
  };
4143
4143
  }, []);
4144
+ // 초기화 버튼이 있었다가 렌더링에 의해 value에 빈값이 들어오는 경우 초기화 버튼이 그대로 있는 이슈 있었음 #244
4145
+ useEffect(function () {
4146
+ if (!props.value) {
4147
+ setShowClearButton(false);
4148
+ }
4149
+ }, [props.value]);
4144
4150
  useEffect(function () {
4145
4151
  if (props.defaultValue) {
4146
4152
  setShowClearButton(!hiddenClearButton);
@@ -24662,52 +24668,54 @@ function Table(_a) {
24662
24668
  }
24663
24669
 
24664
24670
  function Details(_a) {
24665
- var details = _a.details,
24666
- isDetailsOpen = _a.isDetailsOpen,
24667
- handleToggleDetails = _a.handleToggleDetails;
24668
- if (!details) return null;
24669
- // 오류가 파일이 하나인 경우
24670
- if (details.length <= 1) {
24671
- return jsx("details", {
24672
- children: jsx("summary", {
24673
- children: jsx("p", {
24674
- children: details[0]
24675
- })
24676
- })
24671
+ var details = _a.details;
24672
+ var _b = useState(new Array(details === null || details === void 0 ? void 0 : details.length).fill(false)),
24673
+ openStates = _b[0],
24674
+ setOpenStates = _b[1];
24675
+ var toggleDetail = function toggleDetail(index) {
24676
+ setOpenStates(function (prev) {
24677
+ var newState = __spreadArray([], prev, true);
24678
+ newState[index] = !newState[index];
24679
+ return newState;
24677
24680
  });
24678
- }
24679
- // 오류가 파일이 이상일 경우
24680
- return jsxs("details", {
24681
- children: [jsx("summary", __assign({
24682
- onClick: handleToggleDetails
24683
- }, {
24684
- children: jsxs("div", __assign({
24685
- className: "maru-toast-details-summary"
24681
+ };
24682
+ if (!details || details.length === 0) return null;
24683
+ return jsx("div", __assign({
24684
+ className: "maru-toast-details"
24685
+ }, {
24686
+ children: details.map(function (item, index) {
24687
+ return jsxs("details", __assign({
24688
+ onToggle: function onToggle() {
24689
+ return toggleDetail(index);
24690
+ }
24686
24691
  }, {
24687
- children: [jsx("p", {
24688
- children: details[0]
24689
- }), jsx("span", __assign({
24690
- className: "maru-toast-details-summary-icon"
24691
- }, {
24692
- children: jsx(Icon, {
24693
- name: isDetailsOpen ? ICONS.Up_s16 : ICONS.Down_s16
24692
+ children: [jsx("summary", {
24693
+ children: jsxs("div", __assign({
24694
+ className: "maru-toast-details-summary"
24695
+ }, {
24696
+ children: [jsx("p", {
24697
+ children: item.summary
24698
+ }), jsx("span", __assign({
24699
+ className: "maru-toast-details-summary-icon"
24700
+ }, {
24701
+ children: jsx(Icon, {
24702
+ name: openStates[index] ? ICONS.Up_s16 : ICONS.Down_s16
24703
+ })
24704
+ }))]
24705
+ }))
24706
+ }), jsx("ul", {
24707
+ children: item.subDetails.map(function (detail, idx) {
24708
+ return jsx("li", {
24709
+ children: detail
24710
+ }, idx);
24694
24711
  })
24695
- }))]
24696
- }))
24697
- })), jsx("ul", {
24698
- children: details.slice(1).map(function (item, idx) {
24699
- return (
24700
- // eslint-disable-next-line react/no-array-index-key
24701
- jsx("li", {
24702
- children: item
24703
- }, idx)
24704
- );
24705
- })
24706
- })]
24707
- });
24712
+ })]
24713
+ }), index);
24714
+ })
24715
+ }));
24708
24716
  }
24709
24717
 
24710
- var css_248z = ".maru-toast-style {\n padding: 10px 10px 10px 12px;\n border-radius: 6px;\n background-color: #fff;\n box-shadow: 0 0 6px 0 #bdbdbd;\n}\n.maru-toast-style div:first-child {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-toast-style .maru-toast-style-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n margin-right: 8px;\n width: 24px;\n height: 24px;\n}\n.maru-toast-style .maru-toast-style-content {\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 margin-right: 16px;\n}\n.maru-toast-style details {\n background-color: #fafafa;\n padding: 10px 10px 10px 14px;\n margin-top: 8px;\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-toast-style details summary {\n display: flex;\n justify-content: flex-start;\n align-items: flex-start;\n flex-direction: row;\n white-space: pre-wrap;\n}\n.maru-toast-style details summary > div:first-child {\n position: relative;\n}\n.maru-toast-style details summary .maru-toast-details-summary {\n cursor: pointer;\n}\n.maru-toast-style details summary .maru-toast-details-summary > p {\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}\n.maru-toast-style details summary .maru-toast-details-summary-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n position: absolute;\n right: -25px;\n bottom: 3px;\n}\n\n.maru-toast {\n margin-top: 24px;\n position: relative;\n opacity: 0;\n transform: translateY(100%);\n transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease-out;\n}\n.maru-toast.entered {\n transform: translateY(0);\n opacity: 1;\n}\n.maru-toast.fade-out {\n opacity: 0;\n transform: translateX(100%);\n}\n\n.maru-toaster {\n position: fixed;\n z-index: 6007;\n right: 24px;\n bottom: 24px;\n transition: transform 0.5s ease-out;\n display: flex;\n flex-direction: column-reverse;\n align-items: flex-end;\n}";
24718
+ var css_248z = ".maru-toast-style {\n padding: 10px 10px 10px 12px;\n border-radius: 6px;\n background-color: #fff;\n box-shadow: 0 0 6px 0 #bdbdbd;\n}\n.maru-toast-style div:first-child {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-toast-style .maru-toast-style-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n margin-right: 8px;\n width: 24px;\n height: 24px;\n}\n.maru-toast-style .maru-toast-style-content {\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 margin-right: 16px;\n}\n.maru-toast-style .maru-toast-details {\n background-color: #fafafa;\n padding: 10px 10px 10px 14px;\n margin-top: 8px;\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-toast-style .maru-toast-details summary {\n margin-top: 6px;\n display: flex;\n justify-content: flex-start;\n align-items: flex-start;\n flex-direction: row;\n white-space: pre-wrap;\n}\n.maru-toast-style .maru-toast-details summary > div:first-child {\n position: relative;\n}\n.maru-toast-style .maru-toast-details summary .maru-toast-details-summary {\n cursor: pointer;\n}\n.maru-toast-style .maru-toast-details summary .maru-toast-details-summary > p {\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}\n.maru-toast-style .maru-toast-details summary .maru-toast-details-summary-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n position: absolute;\n right: -25px;\n bottom: 3px;\n}\n.maru-toast-style .maru-toast-details summary:first-child {\n margin: 0;\n}\n.maru-toast-style .maru-toast-details li {\n margin-left: 10px;\n}\n\n.maru-toast {\n margin-top: 24px;\n position: relative;\n opacity: 0;\n transform: translateY(100%);\n transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease-out;\n}\n.maru-toast.entered {\n transform: translateY(0);\n opacity: 1;\n}\n.maru-toast.fade-out {\n opacity: 0;\n transform: translateX(100%);\n}\n\n.maru-toaster {\n position: fixed;\n z-index: 6007;\n right: 24px;\n bottom: 24px;\n transition: transform 0.5s ease-out;\n display: flex;\n flex-direction: column-reverse;\n align-items: flex-end;\n}";
24711
24719
  styleInject(css_248z);
24712
24720
 
24713
24721
  function ToastStyle(_a) {
@@ -24717,17 +24725,11 @@ function ToastStyle(_a) {
24717
24725
  description = _a.description,
24718
24726
  details = _a.details,
24719
24727
  onClose = _a.onClose;
24720
- var _c = useState(false),
24721
- isDetailsOpen = _c[0],
24722
- setIsDetailsOpen = _c[1];
24723
24728
  var iconName = {
24724
24729
  success: ICONS.CheckCircleBg_s24,
24725
24730
  warning: ICONS.AlertTriangleBg_s24,
24726
24731
  danger: ICONS.XDiamondBg_s2415
24727
24732
  };
24728
- var handleDetailsToggle = function handleDetailsToggle() {
24729
- setIsDetailsOpen(!isDetailsOpen);
24730
- };
24731
24733
  var handleClose = function handleClose() {
24732
24734
  onClose();
24733
24735
  };
@@ -24757,9 +24759,7 @@ function ToastStyle(_a) {
24757
24759
  onClick: handleClose
24758
24760
  })]
24759
24761
  }), description, jsx(Details, {
24760
- details: details,
24761
- isDetailsOpen: isDetailsOpen,
24762
- handleToggleDetails: handleDetailsToggle
24762
+ details: details
24763
24763
  })]
24764
24764
  }));
24765
24765
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",