@ceed/ads 0.0.92 → 0.0.94

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.
@@ -0,0 +1,7 @@
1
+ export declare const useCurrencySetting: (currencyCode?: "usd" | "krw") => {
2
+ symbol: string;
3
+ thousandSeparator: string;
4
+ decimalSeparator: string;
5
+ placeholder: string;
6
+ fixedDecimalScale: boolean;
7
+ };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { type SelectProps } from "@mui/joy";
3
3
  import { type MotionProps } from "framer-motion";
4
+ import { SelectValue } from "@mui/base";
4
5
  declare const Option: import("framer-motion").CustomDomComponent<{
5
6
  color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").OptionPropsColorOverrides> | undefined;
6
7
  children?: React.ReactNode;
@@ -13,10 +14,16 @@ declare const Option: import("framer-motion").CustomDomComponent<{
13
14
  ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
14
15
  }, "label" | "children" | "color" | "variant" | "sx" | "disabled" | "value" | keyof import("@mui/joy").OptionSlotsAndSlotProps>>;
15
16
  export { Option };
16
- declare function Select<OptionValue extends {}, Multiple extends boolean = false>(props: {
17
+ declare function Select<OptionValue extends string, Multiple extends boolean = false>(props: {
17
18
  label?: string;
18
19
  helperText?: string;
19
20
  error?: boolean;
21
+ onChange?: (event: {
22
+ target: {
23
+ name?: string;
24
+ value?: SelectValue<OptionValue, Multiple>;
25
+ };
26
+ }) => void;
20
27
  } & SelectProps<OptionValue, Multiple> & MotionProps): React.JSX.Element;
21
28
  declare namespace Select {
22
29
  var displayName: string;
@@ -8,7 +8,7 @@ declare const Tabs: import("framer-motion").CustomDomComponent<Omit<import("@mui
8
8
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
9
9
  }, "children" | "color" | "direction" | "defaultValue" | "className" | "onChange" | "variant" | "sx" | "size" | "orientation" | "value" | "selectionFollowsFocus" | keyof import("@mui/joy").TabsSlotsAndSlotProps>>;
10
10
  export { Tabs };
11
- declare const Tab: import("framer-motion").CustomDomComponent<{
11
+ declare const Tab: import("@emotion/styled").StyledComponent<Omit<{
12
12
  action?: React.Ref<{
13
13
  focusVisible(): void;
14
14
  }> | undefined;
@@ -24,7 +24,7 @@ declare const Tab: import("framer-motion").CustomDomComponent<{
24
24
  variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").TabPropsVariantOverrides> | undefined;
25
25
  } & import("@mui/joy").TabSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
26
26
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
27
- }, "color" | "onChange" | "variant" | "sx" | "disabled" | "orientation" | "value" | "action" | "disableIndicator" | "indicatorPlacement" | "indicatorInset" | keyof import("@mui/joy").TabSlotsAndSlotProps>>;
27
+ }, "color" | "onChange" | "variant" | "sx" | "disabled" | "orientation" | "value" | "action" | "disableIndicator" | "indicatorPlacement" | "indicatorInset" | keyof import("@mui/joy").TabSlotsAndSlotProps> & import("framer-motion").MotionProps, "ref"> & React.RefAttributes<HTMLElement | SVGElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/joy").Theme>, {}, {}>;
28
28
  export { Tab };
29
29
  declare const TabList: import("framer-motion").CustomDomComponent<{
30
30
  color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").TabListPropsColorOverrides> | undefined;
package/dist/index.js CHANGED
@@ -1181,8 +1181,8 @@ Container.displayName = "Container";
1181
1181
 
1182
1182
  // src/components/CurrencyInput/CurrencyInput.tsx
1183
1183
  import React14, { useCallback as useCallback3, useState as useState3 } from "react";
1184
- import { IntlMessageFormat } from "intl-messageformat";
1185
- import { IMaskInput } from "react-imask";
1184
+ import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
1185
+ import { NumericFormat } from "react-number-format";
1186
1186
  import InfoOutlined from "@mui/icons-material/esm/InfoOutlined.js";
1187
1187
 
1188
1188
  // src/components/Input/Input.tsx
@@ -1233,116 +1233,115 @@ Input.displayName = "Input";
1233
1233
  // src/components/Input/index.ts
1234
1234
  var Input_default = Input;
1235
1235
 
1236
+ // src/components/CurrencyInput/hooks/use-currency-setting.ts
1237
+ import IntlMessageFormat from "intl-messageformat";
1238
+ var useCurrencySetting = (currencyCode = "usd") => {
1239
+ const [symbol, thousandSeparator, decimalSeparator] = new IntlMessageFormat(
1240
+ `{amount, number, ::currency/${currencyCode} unit-width-narrow}`
1241
+ ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1242
+ return {
1243
+ symbol: `${symbol} `,
1244
+ thousandSeparator,
1245
+ decimalSeparator,
1246
+ placeholder: decimalSeparator ? `${symbol} 0${decimalSeparator}00` : `${symbol} 0`,
1247
+ fixedDecimalScale: !!decimalSeparator
1248
+ };
1249
+ };
1250
+
1236
1251
  // src/components/CurrencyInput/CurrencyInput.tsx
1237
- function getCurrencySymbol(currencyCode) {
1238
- const formatted = new Intl.NumberFormat("en-us", {
1239
- style: "currency",
1240
- currency: currencyCode
1241
- }).format(0);
1242
- return formatted.replace(/[\d\s.,]/g, "");
1243
- }
1244
1252
  var TextMaskAdapter = React14.forwardRef(
1245
1253
  function TextMaskAdapter2(props, ref) {
1246
- const { onChange, currency, ...innerProps } = props;
1247
- const [value, setValue] = useState3(props.value || 0);
1248
- const currencySymbol = getCurrencySymbol(currency);
1254
+ const { onChange, ...innerProps } = props;
1249
1255
  return /* @__PURE__ */ React14.createElement(
1250
- IMaskInput,
1256
+ NumericFormat,
1251
1257
  {
1252
1258
  ...innerProps,
1253
- inputRef: ref,
1254
- mask: `${currencySymbol}num`,
1255
- lazy: false,
1256
- overwrite: true,
1257
- onAccept: (value2) => {
1258
- setValue(Number(value2));
1259
- onChange({
1260
- target: {
1261
- name: props.name,
1262
- value: value2
1263
- }
1259
+ onValueChange: ({ floatValue }) => {
1260
+ onChange?.({
1261
+ target: { name: props.name, value: floatValue?.toString() }
1264
1262
  });
1265
1263
  },
1266
- value: value.toString(),
1267
- unmask: true,
1268
- blocks: {
1269
- num: {
1270
- mask: Number,
1271
- thousandsSeparator: ",",
1272
- radix: ".",
1273
- expose: true,
1274
- scale: 2,
1275
- padFractionalZeros: currency !== "krw"
1276
- }
1277
- },
1278
- placeholder: `${currencySymbol}0.00`
1264
+ valueIsNumericString: true,
1265
+ getInputRef: ref,
1266
+ decimalScale: 2
1279
1267
  }
1280
1268
  );
1281
1269
  }
1282
1270
  );
1283
- var CurrencyInput = React14.forwardRef(
1284
- function CurrencyInput2(props, ref) {
1285
- const {
1286
- currency = "usd",
1287
- max = 1e5,
1288
- name,
1289
- onChange,
1290
- label,
1291
- error,
1292
- helperText,
1293
- required,
1271
+ var CurrencyInput = React14.forwardRef(function CurrencyInput2(props, ref) {
1272
+ const {
1273
+ currency = "usd",
1274
+ max = 1e5,
1275
+ name,
1276
+ onChange,
1277
+ label,
1278
+ error,
1279
+ helperText,
1280
+ required,
1281
+ disabled,
1282
+ ...innerProps
1283
+ } = props;
1284
+ const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale } = useCurrencySetting(currency);
1285
+ const [value, setValue] = useState3(props.value);
1286
+ const [isOverLimit, setIsOverLimit] = useState3(
1287
+ !!props.value && props.value > Number(max)
1288
+ );
1289
+ const handleChange = useCallback3(
1290
+ (event) => {
1291
+ const amount = Number(event.target.value);
1292
+ setValue(amount);
1293
+ onChange?.({ ...event, target: { name, value: amount } });
1294
+ if (amount > Number(max)) {
1295
+ setIsOverLimit(true);
1296
+ } else {
1297
+ setIsOverLimit(false);
1298
+ }
1299
+ },
1300
+ []
1301
+ );
1302
+ const currencyFormatter = /* @__PURE__ */ React14.createElement(
1303
+ Input_default,
1304
+ {
1305
+ ...innerProps,
1306
+ size: "sm",
1307
+ ref,
1308
+ value,
1309
+ placeholder,
1310
+ onChange: handleChange,
1294
1311
  disabled,
1295
- ...innerProps
1296
- } = props;
1297
- const [isOverLimit, setIsOverLimit] = useState3(
1298
- !!props.value && props.value > Number(max)
1299
- );
1300
- const handleChange = useCallback3(
1301
- (event) => {
1302
- const amount = Number(event.target.value);
1303
- onChange?.({ ...event, target: { name, value: amount } });
1304
- if (amount > Number(max)) {
1305
- setIsOverLimit(true);
1306
- } else {
1307
- setIsOverLimit(false);
1312
+ required,
1313
+ slotProps: {
1314
+ input: {
1315
+ component: TextMaskAdapter,
1316
+ decimalSeparator,
1317
+ thousandSeparator,
1318
+ prefix: symbol,
1319
+ fixedDecimalScale
1308
1320
  }
1309
1321
  },
1310
- []
1311
- );
1312
- const currencyFormatter = /* @__PURE__ */ React14.createElement(
1313
- Input_default,
1322
+ sx: {
1323
+ fontFamily: "monospace"
1324
+ }
1325
+ }
1326
+ );
1327
+ if (label) {
1328
+ return /* @__PURE__ */ React14.createElement(
1329
+ FormControl_default,
1314
1330
  {
1315
1331
  size: "sm",
1316
- ref,
1317
- onChange: handleChange,
1318
1332
  disabled,
1319
1333
  required,
1320
- slotProps: { input: { component: TextMaskAdapter, currency, max } },
1321
- sx: {
1322
- fontFamily: "monospace"
1323
- },
1324
- ...innerProps
1325
- }
1334
+ error: error || isOverLimit
1335
+ },
1336
+ /* @__PURE__ */ React14.createElement(FormLabel_default, null, label),
1337
+ currencyFormatter,
1338
+ isOverLimit ? /* @__PURE__ */ React14.createElement(FormHelperText_default, null, /* @__PURE__ */ React14.createElement(InfoOutlined, null), new IntlMessageFormat2(
1339
+ `limit: {amount, number, ::currency/${currency} unit-width-narrow}`
1340
+ ).format({ amount: max })) : helperText && /* @__PURE__ */ React14.createElement(FormHelperText_default, null, helperText)
1326
1341
  );
1327
- if (label) {
1328
- return /* @__PURE__ */ React14.createElement(
1329
- FormControl_default,
1330
- {
1331
- size: "sm",
1332
- disabled,
1333
- required,
1334
- error: error || isOverLimit
1335
- },
1336
- /* @__PURE__ */ React14.createElement(FormLabel_default, null, label),
1337
- currencyFormatter,
1338
- isOverLimit ? /* @__PURE__ */ React14.createElement(FormHelperText_default, null, /* @__PURE__ */ React14.createElement(InfoOutlined, null), new IntlMessageFormat(
1339
- `limit: {amount, number, ::currency/${currency} unit-width-narrow}`
1340
- ).format({ amount: max })) : helperText && /* @__PURE__ */ React14.createElement(FormHelperText_default, null, helperText)
1341
- );
1342
- }
1343
- return currencyFormatter;
1344
1342
  }
1345
- );
1343
+ return currencyFormatter;
1344
+ });
1346
1345
 
1347
1346
  // src/components/DataTable/DataTable.tsx
1348
1347
  import React16, {
@@ -1876,7 +1875,7 @@ DataTable.displayName = "DataTable";
1876
1875
 
1877
1876
  // src/components/DatePicker/DatePicker.tsx
1878
1877
  import React17, { forwardRef as forwardRef4, useCallback as useCallback5, useState as useState5 } from "react";
1879
- import { IMaskInput as IMaskInput2, IMask } from "react-imask";
1878
+ import { IMaskInput, IMask } from "react-imask";
1880
1879
  import CalendarTodayIcon from "@mui/icons-material/esm/CalendarToday.js";
1881
1880
  import { styled as styled6 } from "@mui/joy";
1882
1881
  import { FocusTrap, ClickAwayListener, Popper } from "@mui/base";
@@ -1927,7 +1926,7 @@ var TextMaskAdapter3 = React17.forwardRef(
1927
1926
  function TextMaskAdapter4(props, ref) {
1928
1927
  const { onChange, ...other } = props;
1929
1928
  return /* @__PURE__ */ React17.createElement(
1930
- IMaskInput2,
1929
+ IMaskInput,
1931
1930
  {
1932
1931
  ...other,
1933
1932
  inputRef: ref,
@@ -2088,7 +2087,7 @@ DatePicker.displayName = "DatePicker";
2088
2087
 
2089
2088
  // src/components/DateRangePicker/DateRangePicker.tsx
2090
2089
  import React18, { forwardRef as forwardRef5, useCallback as useCallback6, useMemo as useMemo4, useState as useState6 } from "react";
2091
- import { IMaskInput as IMaskInput3, IMask as IMask2 } from "react-imask";
2090
+ import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
2092
2091
  import CalendarTodayIcon2 from "@mui/icons-material/esm/CalendarToday.js";
2093
2092
  import { styled as styled7 } from "@mui/joy";
2094
2093
  import { FocusTrap as FocusTrap2, ClickAwayListener as ClickAwayListener2, Popper as Popper2 } from "@mui/base";
@@ -2143,7 +2142,7 @@ var TextMaskAdapter5 = React18.forwardRef(
2143
2142
  function TextMaskAdapter6(props, ref) {
2144
2143
  const { onChange, ...other } = props;
2145
2144
  return /* @__PURE__ */ React18.createElement(
2146
- IMaskInput3,
2145
+ IMaskInput2,
2147
2146
  {
2148
2147
  ...other,
2149
2148
  inputRef: ref,
@@ -2413,7 +2412,7 @@ Grid.displayName = "Grid";
2413
2412
 
2414
2413
  // src/components/MonthRangePicker/MonthRangePicker.tsx
2415
2414
  import React23, { forwardRef as forwardRef6, useCallback as useCallback7, useMemo as useMemo5, useState as useState7 } from "react";
2416
- import { IMaskInput as IMaskInput4, IMask as IMask3 } from "react-imask";
2415
+ import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
2417
2416
  import CalendarTodayIcon3 from "@mui/icons-material/esm/CalendarToday.js";
2418
2417
  import { styled as styled12 } from "@mui/joy";
2419
2418
  import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper3 } from "@mui/base";
@@ -2457,7 +2456,7 @@ var TextMaskAdapter7 = React23.forwardRef(
2457
2456
  function TextMaskAdapter8(props, ref) {
2458
2457
  const { onChange, ...other } = props;
2459
2458
  return /* @__PURE__ */ React23.createElement(
2460
- IMaskInput4,
2459
+ IMaskInput3,
2461
2460
  {
2462
2461
  ...other,
2463
2462
  inputRef: ref,
@@ -2642,8 +2641,30 @@ function Select(props) {
2642
2641
  color,
2643
2642
  disabled,
2644
2643
  required,
2644
+ onChange,
2645
2645
  ...innerProps
2646
2646
  } = props;
2647
+ const handleChange = (event, newValue) => {
2648
+ const _event = event || { target: {} };
2649
+ const newEvent = {
2650
+ ..._event,
2651
+ // @ts-expect-error target에 name이 있을 수 있다.
2652
+ target: { name: _event.target?.name, value: newValue || void 0 }
2653
+ };
2654
+ console.log(newEvent);
2655
+ onChange?.(newEvent);
2656
+ };
2657
+ const select = /* @__PURE__ */ React25.createElement(
2658
+ JoySelect,
2659
+ {
2660
+ ...innerProps,
2661
+ required,
2662
+ disabled,
2663
+ size,
2664
+ color,
2665
+ onChange: handleChange
2666
+ }
2667
+ );
2647
2668
  if (label) {
2648
2669
  return /* @__PURE__ */ React25.createElement(
2649
2670
  FormControl_default,
@@ -2655,20 +2676,11 @@ function Select(props) {
2655
2676
  error
2656
2677
  },
2657
2678
  /* @__PURE__ */ React25.createElement(FormLabel_default, null, label),
2658
- /* @__PURE__ */ React25.createElement(JoySelect, { ...innerProps }),
2679
+ select,
2659
2680
  helperText && /* @__PURE__ */ React25.createElement(FormHelperText_default, null, helperText)
2660
2681
  );
2661
2682
  }
2662
- return /* @__PURE__ */ React25.createElement(
2663
- JoySelect,
2664
- {
2665
- required,
2666
- disabled,
2667
- size,
2668
- color,
2669
- ...innerProps
2670
- }
2671
- );
2683
+ return select;
2672
2684
  }
2673
2685
  Select.displayName = "Select";
2674
2686
 
@@ -2720,12 +2732,23 @@ var Switch = (props) => {
2720
2732
  Switch.displayName = "Switch";
2721
2733
 
2722
2734
  // src/components/Tabs/Tabs.tsx
2723
- import { Tabs as JoyTabs, Tab as JoyTab, TabList as JoyTabList, TabPanel as JoyTabPanel } from "@mui/joy";
2735
+ import {
2736
+ Tabs as JoyTabs,
2737
+ Tab as JoyTab,
2738
+ TabList as JoyTabList,
2739
+ TabPanel as JoyTabPanel,
2740
+ styled as styled14,
2741
+ tabClasses
2742
+ } from "@mui/joy";
2724
2743
  import { motion as motion27 } from "framer-motion";
2725
2744
  var MotionTabs = motion27(JoyTabs);
2726
2745
  var Tabs = MotionTabs;
2727
2746
  Tabs.displayName = "Tabs";
2728
- var MotionTab = motion27(JoyTab);
2747
+ var MotionTab = styled14(motion27(JoyTab))(({ theme }) => ({
2748
+ [`&:not(.${tabClasses.selected})`]: {
2749
+ color: theme.palette.neutral[700]
2750
+ }
2751
+ }));
2729
2752
  var Tab = MotionTab;
2730
2753
  Tab.displayName = "Tab";
2731
2754
  var MotionTabList = motion27(JoyTabList);