maru_design2 2.13.0 → 2.14.1

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,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.14.1](https://github.com/42maru-ai/maru-design2/compare/v2.14.0...v2.14.1) (2024-08-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * :lipstick: Toast - UPDATE toast style ([d91f6d4](https://github.com/42maru-ai/maru-design2/commit/d91f6d47f25a51717779e49f54c14fd9865a7e72))
9
+
10
+ ## [2.14.0](https://github.com/42maru-ai/maru-design2/compare/v2.13.0...v2.14.0) (2024-08-06)
11
+
12
+
13
+ ### Features
14
+
15
+ * :sparkles: Toast - UPDATE details ([9cf90fa](https://github.com/42maru-ai/maru-design2/commit/9cf90fafcbbc2b264b7538ce2eaaacd09f157a02))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * :adhesive_bandage: Toast - UPDATE details tag ([53e492f](https://github.com/42maru-ai/maru-design2/commit/53e492fb76f0faf010e5d0cde39da3d0480f6eee))
21
+ * :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))
22
+ * :fire: Toast - REMOVE unused code ([5bec3f7](https://github.com/42maru-ai/maru-design2/commit/5bec3f71fd40676a14f532bcf57966949c32e2d9))
23
+ * :label: Toast - UPDATE IToastDetailItem ([9b42067](https://github.com/42maru-ai/maru-design2/commit/9b4206729488745f5240b1e3663ca0e889d4fb8e))
24
+ * :memo: TOAST - UPDATE storybook ([1456487](https://github.com/42maru-ai/maru-design2/commit/1456487adbf4fcf7b37fe3f201604223be4ac3ba))
25
+
3
26
  ## [2.13.0](https://github.com/42maru-ai/maru-design2/compare/v2.12.5...v2.13.0) (2024-07-23)
4
27
 
5
28
 
@@ -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,52 @@ 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", {
24694
+ children: [jsx("div", {
24695
+ children: item.summary
24696
+ }), jsx("div", __assign({
24697
+ className: "maru-toast-details-summary-icon"
24698
+ }, {
24699
+ children: jsx(Icon, {
24700
+ name: openStates[index] ? ICONS.Up_s16 : ICONS.Down_s16
24701
+ })
24702
+ }))]
24694
24703
  })
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
- });
24704
+ }), jsx("ul", {
24705
+ children: item.subDetails.map(function (detail, idx) {
24706
+ return jsx("li", {
24707
+ children: detail
24708
+ }, idx);
24709
+ })
24710
+ })]
24711
+ }), index);
24712
+ })
24713
+ }));
24708
24714
  }
24709
24715
 
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}";
24716
+ 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 display: flex;\n justify-content: flex-start;\n align-items: flex-start;\n flex-direction: column;\n}\n.maru-toast-style div:first-child {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n flex-direction: row;\n width: 100%;\n}\n.maru-toast-style .maru-toast-style-content {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\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 gap: 8px;\n margin-right: 16px;\n}\n.maru-toast-style .maru-toast-details {\n width: 100%;\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 cursor: pointer;\n}\n.maru-toast-style .maru-toast-details summary > div {\n width: auto;\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 > div .maru-toast-details-summary-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n margin-left: 8px;\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
24717
  styleInject(css_248z);
24712
24718
 
24713
24719
  function ToastStyle(_a) {
@@ -24717,17 +24723,11 @@ function ToastStyle(_a) {
24717
24723
  description = _a.description,
24718
24724
  details = _a.details,
24719
24725
  onClose = _a.onClose;
24720
- var _c = useState(false),
24721
- isDetailsOpen = _c[0],
24722
- setIsDetailsOpen = _c[1];
24723
24726
  var iconName = {
24724
24727
  success: ICONS.CheckCircleBg_s24,
24725
24728
  warning: ICONS.AlertTriangleBg_s24,
24726
24729
  danger: ICONS.XDiamondBg_s2415
24727
24730
  };
24728
- var handleDetailsToggle = function handleDetailsToggle() {
24729
- setIsDetailsOpen(!isDetailsOpen);
24730
- };
24731
24731
  var handleClose = function handleClose() {
24732
24732
  onClose();
24733
24733
  };
@@ -24735,19 +24735,15 @@ function ToastStyle(_a) {
24735
24735
  className: "maru-toast-style"
24736
24736
  }, {
24737
24737
  children: [jsxs("div", {
24738
- children: [jsx("div", __assign({
24739
- className: "maru-toast-style-icon"
24738
+ children: [jsxs("div", __assign({
24739
+ className: "maru-toast-style-content"
24740
24740
  }, {
24741
- children: jsx(Icon, {
24741
+ children: [jsx(Icon, {
24742
24742
  name: iconName[variant],
24743
24743
  color: variant
24744
- })
24745
- })), jsx("div", __assign({
24746
- className: "maru-toast-style-content"
24747
- }, {
24748
- children: jsx("p", {
24744
+ }), jsx("span", {
24749
24745
  children: content
24750
- })
24746
+ })]
24751
24747
  })), jsx(Button, {
24752
24748
  startIcon: {
24753
24749
  name: ICONS.X_s1613,
@@ -24757,9 +24753,7 @@ function ToastStyle(_a) {
24757
24753
  onClick: handleClose
24758
24754
  })]
24759
24755
  }), description, jsx(Details, {
24760
- details: details,
24761
- isDetailsOpen: isDetailsOpen,
24762
- handleToggleDetails: handleDetailsToggle
24756
+ details: details
24763
24757
  })]
24764
24758
  }));
24765
24759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "2.13.0",
3
+ "version": "2.14.1",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",