@ceed/ads 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
@@ -323,10 +323,20 @@ var MotionAlert = (0, import_joy4.styled)((0, import_framer_motion3.motion)(impo
323
323
  alignItems: "flex-start",
324
324
  fontWeight: "unset"
325
325
  });
326
+ var titleLevelMapping = {
327
+ sm: "title-sm",
328
+ md: "title-md",
329
+ lg: "title-lg"
330
+ };
331
+ var contentLevelMapping = {
332
+ sm: "body-xs",
333
+ md: "body-sm",
334
+ lg: "body-md"
335
+ };
326
336
  function Alert(props) {
327
- const { title, content, actions, color = "primary", ...innerProps } = props;
337
+ const { title, content, actions, color = "primary", size = "md", ...innerProps } = props;
328
338
  const invertedColors = props.invertedColors || props.variant === "solid";
329
- 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)));
339
+ 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)));
330
340
  }
331
341
  Alert.displayName = "Alert";
332
342
 
@@ -5217,7 +5227,9 @@ var Uploader = import_react43.default.memo(
5217
5227
  onChange,
5218
5228
  label,
5219
5229
  disabled,
5220
- onDelete
5230
+ onDelete,
5231
+ error: errorProp,
5232
+ helperText: helperTextProp
5221
5233
  } = props;
5222
5234
  const dropZoneRef = (0, import_react43.useRef)(null);
5223
5235
  const inputRef = (0, import_react43.useRef)(null);
@@ -5236,6 +5248,9 @@ var Uploader = import_react43.default.memo(
5236
5248
  [accepts]
5237
5249
  );
5238
5250
  const helperText = (0, import_react43.useMemo)(() => {
5251
+ if (helperTextProp) {
5252
+ return helperTextProp;
5253
+ }
5239
5254
  const [allAcceptedTypes, acceptedTypes] = [
5240
5255
  accepts.filter((accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
5241
5256
  const [type] = accept2.split("/");
@@ -5261,8 +5276,8 @@ var Uploader = import_react43.default.memo(
5261
5276
  helperTexts.push(`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`);
5262
5277
  }
5263
5278
  return helperTexts.join(", ");
5264
- }, [accepts, maxFileTotalSize, maxCount]);
5265
- const error = (0, import_react43.useMemo)(() => !!errorText || props.error, [props.error, errorText]);
5279
+ }, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
5280
+ const error = (0, import_react43.useMemo)(() => !!errorText || errorProp, [errorProp, errorText]);
5266
5281
  const showDropZone = (0, import_react43.useMemo)(
5267
5282
  () => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
5268
5283
  [files, maxCount, uploaded]
package/dist/index.js CHANGED
@@ -219,10 +219,20 @@ var MotionAlert = styled(motion3(JoyAlert))({
219
219
  alignItems: "flex-start",
220
220
  fontWeight: "unset"
221
221
  });
222
+ var titleLevelMapping = {
223
+ sm: "title-sm",
224
+ md: "title-md",
225
+ lg: "title-lg"
226
+ };
227
+ var contentLevelMapping = {
228
+ sm: "body-xs",
229
+ md: "body-sm",
230
+ lg: "body-md"
231
+ };
222
232
  function Alert(props) {
223
- const { title, content, actions, color = "primary", ...innerProps } = props;
233
+ const { title, content, actions, color = "primary", size = "md", ...innerProps } = props;
224
234
  const invertedColors = props.invertedColors || props.variant === "solid";
225
- 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)));
235
+ 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)));
226
236
  }
227
237
  Alert.displayName = "Alert";
228
238
 
@@ -5154,7 +5164,9 @@ var Uploader = React40.memo(
5154
5164
  onChange,
5155
5165
  label,
5156
5166
  disabled,
5157
- onDelete
5167
+ onDelete,
5168
+ error: errorProp,
5169
+ helperText: helperTextProp
5158
5170
  } = props;
5159
5171
  const dropZoneRef = useRef8(null);
5160
5172
  const inputRef = useRef8(null);
@@ -5173,6 +5185,9 @@ var Uploader = React40.memo(
5173
5185
  [accepts]
5174
5186
  );
5175
5187
  const helperText = useMemo14(() => {
5188
+ if (helperTextProp) {
5189
+ return helperTextProp;
5190
+ }
5176
5191
  const [allAcceptedTypes, acceptedTypes] = [
5177
5192
  accepts.filter((accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
5178
5193
  const [type] = accept2.split("/");
@@ -5198,8 +5213,8 @@ var Uploader = React40.memo(
5198
5213
  helperTexts.push(`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`);
5199
5214
  }
5200
5215
  return helperTexts.join(", ");
5201
- }, [accepts, maxFileTotalSize, maxCount]);
5202
- const error = useMemo14(() => !!errorText || props.error, [props.error, errorText]);
5216
+ }, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
5217
+ const error = useMemo14(() => !!errorText || errorProp, [errorProp, errorText]);
5203
5218
  const showDropZone = useMemo14(
5204
5219
  () => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
5205
5220
  [files, maxCount, uploaded]