@ceed/cds 1.11.0 → 1.12.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,11 +1,20 @@
1
1
  import React from 'react';
2
2
  import { AlertProps } from '@mui/joy';
3
3
  import { MotionProps } from 'framer-motion';
4
- declare function Alert(props: {
4
+ declare const titleLevelMapping: {
5
+ readonly sm: "title-sm";
6
+ readonly md: "title-md";
7
+ readonly lg: "title-lg";
8
+ };
9
+ type AlertSize = keyof typeof titleLevelMapping;
10
+ interface CustomAlertProps {
5
11
  content: React.ReactNode;
6
12
  actions?: React.ReactNode;
7
13
  title?: string;
8
- } & AlertProps & MotionProps): React.JSX.Element;
14
+ size?: AlertSize;
15
+ }
16
+ type AlertComponentProps = CustomAlertProps & Omit<AlertProps, 'content' | 'actions' | 'title' | 'size'> & Omit<MotionProps, 'children'>;
17
+ declare function Alert(props: AlertComponentProps): React.JSX.Element;
9
18
  declare namespace Alert {
10
19
  var displayName: string;
11
20
  }
@@ -29,5 +29,10 @@ declare const Uploader: React.MemoExoticComponent<(props: {
29
29
  */
30
30
  maxFileTotalSize: number;
31
31
  uploaded?: UserUpload[] | undefined;
32
+ /**
33
+ * 모든 안내 메세지/에러 메세지보다 해당 메세지가 우선적으로 보여진다.
34
+ * 기본 안내 메세지 및 에러 메세지를 사용하려면 해당 필드를 비워야 한다.
35
+ */
36
+ helperText?: string | undefined;
32
37
  }) => React.JSX.Element>;
33
38
  export { Uploader };
package/dist/index.cjs CHANGED
@@ -320,10 +320,20 @@ var MotionAlert = (0, import_joy4.styled)((0, import_framer_motion3.motion)(impo
320
320
  alignItems: "flex-start",
321
321
  fontWeight: "unset"
322
322
  });
323
+ var titleLevelMapping = {
324
+ sm: "title-sm",
325
+ md: "title-md",
326
+ lg: "title-lg"
327
+ };
328
+ var contentLevelMapping = {
329
+ sm: "body-xs",
330
+ md: "body-sm",
331
+ lg: "body-md"
332
+ };
323
333
  function Alert(props) {
324
- const { title, content, actions, color = "primary", ...innerProps } = props;
334
+ const { title, content, actions, color = "primary", size = "md", ...innerProps } = props;
325
335
  const invertedColors = props.invertedColors || props.variant === "solid";
326
- return /* @__PURE__ */ import_react3.default.createElement(MotionAlert, { ...innerProps, color, endDecorator: actions, invertedColors }, /* @__PURE__ */ import_react3.default.createElement(Stack_default, null, title && /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "title-md", fontWeight: "bold", color }, title), /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "body-sm", fontWeight: 500, color }, content)));
336
+ return /* @__PURE__ */ import_react3.default.createElement(MotionAlert, { ...innerProps, color, endDecorator: actions, invertedColors, size }, /* @__PURE__ */ import_react3.default.createElement(Stack_default, null, title && /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: titleLevelMapping[size], fontWeight: "bold", color }, title), /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: contentLevelMapping[size], fontWeight: 500, color }, content)));
327
337
  }
328
338
  Alert.displayName = "Alert";
329
339
 
@@ -5906,7 +5916,9 @@ var Uploader = import_react48.default.memo(
5906
5916
  onChange,
5907
5917
  label,
5908
5918
  disabled,
5909
- onDelete
5919
+ onDelete,
5920
+ error: errorProp,
5921
+ helperText: helperTextProp
5910
5922
  } = props;
5911
5923
  const dropZoneRef = (0, import_react48.useRef)(null);
5912
5924
  const inputRef = (0, import_react48.useRef)(null);
@@ -5925,6 +5937,9 @@ var Uploader = import_react48.default.memo(
5925
5937
  [accepts]
5926
5938
  );
5927
5939
  const helperText = (0, import_react48.useMemo)(() => {
5940
+ if (helperTextProp) {
5941
+ return helperTextProp;
5942
+ }
5928
5943
  const [allAcceptedTypes, acceptedTypes] = [
5929
5944
  accepts.filter((accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
5930
5945
  const [type] = accept2.split("/");
@@ -5950,8 +5965,8 @@ var Uploader = import_react48.default.memo(
5950
5965
  helperTexts.push(`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`);
5951
5966
  }
5952
5967
  return helperTexts.join(", ");
5953
- }, [accepts, maxFileTotalSize, maxCount]);
5954
- const error = (0, import_react48.useMemo)(() => !!errorText || props.error, [props.error, errorText]);
5968
+ }, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
5969
+ const error = (0, import_react48.useMemo)(() => !!errorText || errorProp, [errorProp, errorText]);
5955
5970
  const showDropZone = (0, import_react48.useMemo)(
5956
5971
  () => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
5957
5972
  [files, maxCount, uploaded]
package/dist/index.js CHANGED
@@ -224,10 +224,20 @@ var MotionAlert = styled(motion3(JoyAlert))({
224
224
  alignItems: "flex-start",
225
225
  fontWeight: "unset"
226
226
  });
227
+ var titleLevelMapping = {
228
+ sm: "title-sm",
229
+ md: "title-md",
230
+ lg: "title-lg"
231
+ };
232
+ var contentLevelMapping = {
233
+ sm: "body-xs",
234
+ md: "body-sm",
235
+ lg: "body-md"
236
+ };
227
237
  function Alert(props) {
228
- const { title, content, actions, color = "primary", ...innerProps } = props;
238
+ const { title, content, actions, color = "primary", size = "md", ...innerProps } = props;
229
239
  const invertedColors = props.invertedColors || props.variant === "solid";
230
- return /* @__PURE__ */ React3.createElement(MotionAlert, { ...innerProps, color, endDecorator: actions, invertedColors }, /* @__PURE__ */ React3.createElement(Stack_default, null, title && /* @__PURE__ */ React3.createElement(Typography_default, { level: "title-md", fontWeight: "bold", color }, title), /* @__PURE__ */ React3.createElement(Typography_default, { level: "body-sm", fontWeight: 500, color }, content)));
240
+ return /* @__PURE__ */ React3.createElement(MotionAlert, { ...innerProps, color, endDecorator: actions, invertedColors, size }, /* @__PURE__ */ React3.createElement(Stack_default, null, title && /* @__PURE__ */ React3.createElement(Typography_default, { level: titleLevelMapping[size], fontWeight: "bold", color }, title), /* @__PURE__ */ React3.createElement(Typography_default, { level: contentLevelMapping[size], fontWeight: 500, color }, content)));
231
241
  }
232
242
  Alert.displayName = "Alert";
233
243
 
@@ -5884,7 +5894,9 @@ var Uploader = React45.memo(
5884
5894
  onChange,
5885
5895
  label,
5886
5896
  disabled,
5887
- onDelete
5897
+ onDelete,
5898
+ error: errorProp,
5899
+ helperText: helperTextProp
5888
5900
  } = props;
5889
5901
  const dropZoneRef = useRef10(null);
5890
5902
  const inputRef = useRef10(null);
@@ -5903,6 +5915,9 @@ var Uploader = React45.memo(
5903
5915
  [accepts]
5904
5916
  );
5905
5917
  const helperText = useMemo14(() => {
5918
+ if (helperTextProp) {
5919
+ return helperTextProp;
5920
+ }
5906
5921
  const [allAcceptedTypes, acceptedTypes] = [
5907
5922
  accepts.filter((accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
5908
5923
  const [type] = accept2.split("/");
@@ -5928,8 +5943,8 @@ var Uploader = React45.memo(
5928
5943
  helperTexts.push(`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`);
5929
5944
  }
5930
5945
  return helperTexts.join(", ");
5931
- }, [accepts, maxFileTotalSize, maxCount]);
5932
- const error = useMemo14(() => !!errorText || props.error, [props.error, errorText]);
5946
+ }, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
5947
+ const error = useMemo14(() => !!errorText || errorProp, [errorProp, errorText]);
5933
5948
  const showDropZone = useMemo14(
5934
5949
  () => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
5935
5950
  [files, maxCount, uploaded]