@ceed/ads 0.0.93 → 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 { IMask, 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,55 +1233,37 @@ Input.displayName = "Input";
1233
1233
  // src/components/Input/index.ts
1234
1234
  var Input_default = Input;
1235
1235
 
1236
- // src/components/CurrencyInput/CurrencyInput.tsx
1237
- function formatCurrency(value, currencyCode = "usd") {
1238
- const formatter = new IntlMessageFormat(
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(
1239
1240
  `{amount, number, ::currency/${currencyCode} unit-width-narrow}`
1240
- );
1241
- const amount = value || 0;
1242
- const formatted = formatter.format({ amount }).toString();
1243
- const symbol = formatted.replace(/[0-9.,]/g, "").trim();
1244
- const formattedAmount = formatted.replace(symbol, "").trim();
1241
+ ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1245
1242
  return {
1246
- symbol,
1247
- amount,
1248
- formattedAmount
1243
+ symbol: `${symbol} `,
1244
+ thousandSeparator,
1245
+ decimalSeparator,
1246
+ placeholder: decimalSeparator ? `${symbol} 0${decimalSeparator}00` : `${symbol} 0`,
1247
+ fixedDecimalScale: !!decimalSeparator
1249
1248
  };
1250
- }
1249
+ };
1250
+
1251
+ // src/components/CurrencyInput/CurrencyInput.tsx
1251
1252
  var TextMaskAdapter = React14.forwardRef(
1252
1253
  function TextMaskAdapter2(props, ref) {
1253
- const { onChange, currency, ...innerProps } = props;
1254
- const [formatted, setFormatted] = useState3(formatCurrency(props.value, currency));
1254
+ const { onChange, ...innerProps } = props;
1255
1255
  return /* @__PURE__ */ React14.createElement(
1256
- IMaskInput,
1256
+ NumericFormat,
1257
1257
  {
1258
1258
  ...innerProps,
1259
- inputRef: ref,
1260
- onAccept: (value) => {
1261
- const unmaskedValue = value.replace(/[^\d\.]/g, "");
1262
- setFormatted(formatCurrency(Number(unmaskedValue), currency));
1263
- onChange({
1264
- target: {
1265
- name: props.name,
1266
- value: unmaskedValue
1267
- }
1259
+ onValueChange: ({ floatValue }) => {
1260
+ onChange?.({
1261
+ target: { name: props.name, value: floatValue?.toString() }
1268
1262
  });
1269
1263
  },
1270
- mask: `${formatted.symbol} integer\`.float`,
1271
- blocks: {
1272
- integer: {
1273
- mask: Number,
1274
- thousandsSeparator: ","
1275
- },
1276
- float: {
1277
- mask: IMask.MaskedRange,
1278
- from: 0,
1279
- to: 99,
1280
- maxLength: 2
1281
- }
1282
- },
1283
- value: formatted.formattedAmount,
1284
- overwrite: "shift"
1264
+ valueIsNumericString: true,
1265
+ getInputRef: ref,
1266
+ decimalScale: 2
1285
1267
  }
1286
1268
  );
1287
1269
  }
@@ -1299,12 +1281,15 @@ var CurrencyInput = React14.forwardRef(function CurrencyInput2(props, ref) {
1299
1281
  disabled,
1300
1282
  ...innerProps
1301
1283
  } = props;
1284
+ const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale } = useCurrencySetting(currency);
1285
+ const [value, setValue] = useState3(props.value);
1302
1286
  const [isOverLimit, setIsOverLimit] = useState3(
1303
1287
  !!props.value && props.value > Number(max)
1304
1288
  );
1305
1289
  const handleChange = useCallback3(
1306
1290
  (event) => {
1307
1291
  const amount = Number(event.target.value);
1292
+ setValue(amount);
1308
1293
  onChange?.({ ...event, target: { name, value: amount } });
1309
1294
  if (amount > Number(max)) {
1310
1295
  setIsOverLimit(true);
@@ -1317,16 +1302,26 @@ var CurrencyInput = React14.forwardRef(function CurrencyInput2(props, ref) {
1317
1302
  const currencyFormatter = /* @__PURE__ */ React14.createElement(
1318
1303
  Input_default,
1319
1304
  {
1305
+ ...innerProps,
1320
1306
  size: "sm",
1321
1307
  ref,
1308
+ value,
1309
+ placeholder,
1322
1310
  onChange: handleChange,
1323
1311
  disabled,
1324
1312
  required,
1325
- slotProps: { input: { component: TextMaskAdapter, currency } },
1313
+ slotProps: {
1314
+ input: {
1315
+ component: TextMaskAdapter,
1316
+ decimalSeparator,
1317
+ thousandSeparator,
1318
+ prefix: symbol,
1319
+ fixedDecimalScale
1320
+ }
1321
+ },
1326
1322
  sx: {
1327
1323
  fontFamily: "monospace"
1328
- },
1329
- ...innerProps
1324
+ }
1330
1325
  }
1331
1326
  );
1332
1327
  if (label) {
@@ -1340,7 +1335,7 @@ var CurrencyInput = React14.forwardRef(function CurrencyInput2(props, ref) {
1340
1335
  },
1341
1336
  /* @__PURE__ */ React14.createElement(FormLabel_default, null, label),
1342
1337
  currencyFormatter,
1343
- isOverLimit ? /* @__PURE__ */ React14.createElement(FormHelperText_default, null, /* @__PURE__ */ React14.createElement(InfoOutlined, null), new IntlMessageFormat(
1338
+ isOverLimit ? /* @__PURE__ */ React14.createElement(FormHelperText_default, null, /* @__PURE__ */ React14.createElement(InfoOutlined, null), new IntlMessageFormat2(
1344
1339
  `limit: {amount, number, ::currency/${currency} unit-width-narrow}`
1345
1340
  ).format({ amount: max })) : helperText && /* @__PURE__ */ React14.createElement(FormHelperText_default, null, helperText)
1346
1341
  );
@@ -1880,7 +1875,7 @@ DataTable.displayName = "DataTable";
1880
1875
 
1881
1876
  // src/components/DatePicker/DatePicker.tsx
1882
1877
  import React17, { forwardRef as forwardRef4, useCallback as useCallback5, useState as useState5 } from "react";
1883
- import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
1878
+ import { IMaskInput, IMask } from "react-imask";
1884
1879
  import CalendarTodayIcon from "@mui/icons-material/esm/CalendarToday.js";
1885
1880
  import { styled as styled6 } from "@mui/joy";
1886
1881
  import { FocusTrap, ClickAwayListener, Popper } from "@mui/base";
@@ -1931,7 +1926,7 @@ var TextMaskAdapter3 = React17.forwardRef(
1931
1926
  function TextMaskAdapter4(props, ref) {
1932
1927
  const { onChange, ...other } = props;
1933
1928
  return /* @__PURE__ */ React17.createElement(
1934
- IMaskInput2,
1929
+ IMaskInput,
1935
1930
  {
1936
1931
  ...other,
1937
1932
  inputRef: ref,
@@ -1940,19 +1935,19 @@ var TextMaskAdapter3 = React17.forwardRef(
1940
1935
  pattern: "Y/`m/`d",
1941
1936
  blocks: {
1942
1937
  d: {
1943
- mask: IMask2.MaskedRange,
1938
+ mask: IMask.MaskedRange,
1944
1939
  from: 1,
1945
1940
  to: 31,
1946
1941
  maxLength: 2
1947
1942
  },
1948
1943
  m: {
1949
- mask: IMask2.MaskedRange,
1944
+ mask: IMask.MaskedRange,
1950
1945
  from: 1,
1951
1946
  to: 12,
1952
1947
  maxLength: 2
1953
1948
  },
1954
1949
  Y: {
1955
- mask: IMask2.MaskedRange,
1950
+ mask: IMask.MaskedRange,
1956
1951
  from: 1900,
1957
1952
  to: 9999
1958
1953
  }
@@ -2092,7 +2087,7 @@ DatePicker.displayName = "DatePicker";
2092
2087
 
2093
2088
  // src/components/DateRangePicker/DateRangePicker.tsx
2094
2089
  import React18, { forwardRef as forwardRef5, useCallback as useCallback6, useMemo as useMemo4, useState as useState6 } from "react";
2095
- import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
2090
+ import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
2096
2091
  import CalendarTodayIcon2 from "@mui/icons-material/esm/CalendarToday.js";
2097
2092
  import { styled as styled7 } from "@mui/joy";
2098
2093
  import { FocusTrap as FocusTrap2, ClickAwayListener as ClickAwayListener2, Popper as Popper2 } from "@mui/base";
@@ -2147,7 +2142,7 @@ var TextMaskAdapter5 = React18.forwardRef(
2147
2142
  function TextMaskAdapter6(props, ref) {
2148
2143
  const { onChange, ...other } = props;
2149
2144
  return /* @__PURE__ */ React18.createElement(
2150
- IMaskInput3,
2145
+ IMaskInput2,
2151
2146
  {
2152
2147
  ...other,
2153
2148
  inputRef: ref,
@@ -2156,19 +2151,19 @@ var TextMaskAdapter5 = React18.forwardRef(
2156
2151
  pattern: "Y/`m/`d - Y/`m/`d",
2157
2152
  blocks: {
2158
2153
  d: {
2159
- mask: IMask3.MaskedRange,
2154
+ mask: IMask2.MaskedRange,
2160
2155
  from: 1,
2161
2156
  to: 31,
2162
2157
  maxLength: 2
2163
2158
  },
2164
2159
  m: {
2165
- mask: IMask3.MaskedRange,
2160
+ mask: IMask2.MaskedRange,
2166
2161
  from: 1,
2167
2162
  to: 12,
2168
2163
  maxLength: 2
2169
2164
  },
2170
2165
  Y: {
2171
- mask: IMask3.MaskedRange,
2166
+ mask: IMask2.MaskedRange,
2172
2167
  from: 1900,
2173
2168
  to: 9999
2174
2169
  }
@@ -2417,7 +2412,7 @@ Grid.displayName = "Grid";
2417
2412
 
2418
2413
  // src/components/MonthRangePicker/MonthRangePicker.tsx
2419
2414
  import React23, { forwardRef as forwardRef6, useCallback as useCallback7, useMemo as useMemo5, useState as useState7 } from "react";
2420
- import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
2415
+ import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
2421
2416
  import CalendarTodayIcon3 from "@mui/icons-material/esm/CalendarToday.js";
2422
2417
  import { styled as styled12 } from "@mui/joy";
2423
2418
  import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper3 } from "@mui/base";
@@ -2461,7 +2456,7 @@ var TextMaskAdapter7 = React23.forwardRef(
2461
2456
  function TextMaskAdapter8(props, ref) {
2462
2457
  const { onChange, ...other } = props;
2463
2458
  return /* @__PURE__ */ React23.createElement(
2464
- IMaskInput4,
2459
+ IMaskInput3,
2465
2460
  {
2466
2461
  ...other,
2467
2462
  inputRef: ref,
@@ -2470,13 +2465,13 @@ var TextMaskAdapter7 = React23.forwardRef(
2470
2465
  pattern: "Y/`m - Y/`m",
2471
2466
  blocks: {
2472
2467
  m: {
2473
- mask: IMask4.MaskedRange,
2468
+ mask: IMask3.MaskedRange,
2474
2469
  from: 1,
2475
2470
  to: 12,
2476
2471
  maxLength: 2
2477
2472
  },
2478
2473
  Y: {
2479
- mask: IMask4.MaskedRange,
2474
+ mask: IMask3.MaskedRange,
2480
2475
  from: 1900,
2481
2476
  to: 9999
2482
2477
  }
@@ -2646,8 +2641,30 @@ function Select(props) {
2646
2641
  color,
2647
2642
  disabled,
2648
2643
  required,
2644
+ onChange,
2649
2645
  ...innerProps
2650
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
+ );
2651
2668
  if (label) {
2652
2669
  return /* @__PURE__ */ React25.createElement(
2653
2670
  FormControl_default,
@@ -2659,20 +2676,11 @@ function Select(props) {
2659
2676
  error
2660
2677
  },
2661
2678
  /* @__PURE__ */ React25.createElement(FormLabel_default, null, label),
2662
- /* @__PURE__ */ React25.createElement(JoySelect, { ...innerProps }),
2679
+ select,
2663
2680
  helperText && /* @__PURE__ */ React25.createElement(FormHelperText_default, null, helperText)
2664
2681
  );
2665
2682
  }
2666
- return /* @__PURE__ */ React25.createElement(
2667
- JoySelect,
2668
- {
2669
- required,
2670
- disabled,
2671
- size,
2672
- color,
2673
- ...innerProps
2674
- }
2675
- );
2683
+ return select;
2676
2684
  }
2677
2685
  Select.displayName = "Select";
2678
2686
 
@@ -2724,12 +2732,23 @@ var Switch = (props) => {
2724
2732
  Switch.displayName = "Switch";
2725
2733
 
2726
2734
  // src/components/Tabs/Tabs.tsx
2727
- 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";
2728
2743
  import { motion as motion27 } from "framer-motion";
2729
2744
  var MotionTabs = motion27(JoyTabs);
2730
2745
  var Tabs = MotionTabs;
2731
2746
  Tabs.displayName = "Tabs";
2732
- var MotionTab = motion27(JoyTab);
2747
+ var MotionTab = styled14(motion27(JoyTab))(({ theme }) => ({
2748
+ [`&:not(.${tabClasses.selected})`]: {
2749
+ color: theme.palette.neutral[700]
2750
+ }
2751
+ }));
2733
2752
  var Tab = MotionTab;
2734
2753
  Tab.displayName = "Tab";
2735
2754
  var MotionTabList = motion27(JoyTabList);