@ceed/cds 1.23.0 → 1.24.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.
package/dist/index.cjs CHANGED
@@ -1694,7 +1694,6 @@ Container.displayName = "Container";
1694
1694
 
1695
1695
  // src/components/CurrencyInput/CurrencyInput.tsx
1696
1696
  var import_react18 = __toESM(require("react"));
1697
- var import_intl_messageformat2 = require("intl-messageformat");
1698
1697
  var import_react_number_format = require("react-number-format");
1699
1698
 
1700
1699
  // src/components/Input/Input.tsx
@@ -1818,7 +1817,6 @@ var Input_default = Input;
1818
1817
  var import_joy24 = require("@mui/joy");
1819
1818
 
1820
1819
  // src/components/CurrencyInput/hooks/use-currency-setting.ts
1821
- var import_intl_messageformat = __toESM(require("intl-messageformat"));
1822
1820
  var CURRENCY_DECIMAL_MAP = {
1823
1821
  AED: 2,
1824
1822
  ALL: 2,
@@ -1963,9 +1961,10 @@ var CURRENCY_DECIMAL_MAP = {
1963
1961
  };
1964
1962
  var useCurrencySetting = (props) => {
1965
1963
  const { currency = "USD", placeholder } = props;
1966
- const [symbol, thousandSeparator, decimalSeparator, ...rest] = new import_intl_messageformat.default(
1967
- `{amount, number, ::currency/${currency} unit-width-narrow}`
1968
- ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1964
+ const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
1965
+ const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
1966
+ const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
1967
+ const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
1969
1968
  const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1970
1969
  return {
1971
1970
  symbol: `${symbol} `,
@@ -2042,7 +2041,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
2042
2041
  setValue(void 0);
2043
2042
  return;
2044
2043
  }
2045
- const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
2044
+ const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
2046
2045
  if (!!max && Number(event.target.value) > max) {
2047
2046
  setIsOverLimit(true);
2048
2047
  } else {
@@ -2065,9 +2064,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
2065
2064
  required,
2066
2065
  color: error || isOverLimit ? "danger" : props.color,
2067
2066
  label,
2068
- helperText: isOverLimit ? new import_intl_messageformat2.IntlMessageFormat(`limit: {amount, number, ::currency/${currency} unit-width-narrow}`).format({
2069
- amount: max
2070
- }) : helperText,
2067
+ helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
2071
2068
  slotProps: {
2072
2069
  input: {
2073
2070
  component: TextMaskAdapter,
package/dist/index.js CHANGED
@@ -1,59 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __esm = (fn, res) => function __init() {
4
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
- };
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
-
11
- // src/libs/rehype-accent/index.ts
12
- var rehype_accent_exports = {};
13
- __export(rehype_accent_exports, {
14
- rehypeAccent: () => rehypeAccent
15
- });
16
- import { visit } from "unist-util-visit";
17
- function rehypeAccent(options) {
18
- const { accentColor } = options;
19
- return (tree) => {
20
- visit(tree, "text", (node, index, parent) => {
21
- const value = node.value;
22
- const regex = /\|\|.*?\|\|/g;
23
- let match;
24
- let lastIndex = 0;
25
- const newNodes = [];
26
- while ((match = regex.exec(value)) !== null) {
27
- if (match.index > lastIndex) {
28
- newNodes.push({
29
- type: "text",
30
- value: value.slice(lastIndex, match.index)
31
- });
32
- }
33
- const innerText = match[0].split("||")[1];
34
- newNodes.push({
35
- type: "element",
36
- tagName: "span",
37
- properties: { textColor: accentColor },
38
- children: [{ type: "text", value: innerText }]
39
- });
40
- lastIndex = match.index + match[0].length;
41
- }
42
- if (lastIndex < value.length) {
43
- newNodes.push({ type: "text", value: value.slice(lastIndex) });
44
- }
45
- if (newNodes.length) {
46
- parent.children.splice(index, 1, ...newNodes);
47
- }
48
- });
49
- };
50
- }
51
- var init_rehype_accent = __esm({
52
- "src/libs/rehype-accent/index.ts"() {
53
- "use strict";
54
- }
55
- });
56
-
57
1
  // src/index.ts
58
2
  import {
59
3
  useTheme as useTheme2,
@@ -1616,7 +1560,6 @@ Container.displayName = "Container";
1616
1560
 
1617
1561
  // src/components/CurrencyInput/CurrencyInput.tsx
1618
1562
  import React16, { useCallback as useCallback7, useMemo as useMemo5, useState as useState6 } from "react";
1619
- import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
1620
1563
  import { NumericFormat } from "react-number-format";
1621
1564
 
1622
1565
  // src/components/Input/Input.tsx
@@ -1740,7 +1683,6 @@ var Input_default = Input;
1740
1683
  import { styled as styled7, useThemeProps as useThemeProps3 } from "@mui/joy";
1741
1684
 
1742
1685
  // src/components/CurrencyInput/hooks/use-currency-setting.ts
1743
- import IntlMessageFormat from "intl-messageformat";
1744
1686
  var CURRENCY_DECIMAL_MAP = {
1745
1687
  AED: 2,
1746
1688
  ALL: 2,
@@ -1885,9 +1827,10 @@ var CURRENCY_DECIMAL_MAP = {
1885
1827
  };
1886
1828
  var useCurrencySetting = (props) => {
1887
1829
  const { currency = "USD", placeholder } = props;
1888
- const [symbol, thousandSeparator, decimalSeparator, ...rest] = new IntlMessageFormat(
1889
- `{amount, number, ::currency/${currency} unit-width-narrow}`
1890
- ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1830
+ const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
1831
+ const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
1832
+ const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
1833
+ const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
1891
1834
  const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1892
1835
  return {
1893
1836
  symbol: `${symbol} `,
@@ -1964,7 +1907,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
1964
1907
  setValue(void 0);
1965
1908
  return;
1966
1909
  }
1967
- const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
1910
+ const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
1968
1911
  if (!!max && Number(event.target.value) > max) {
1969
1912
  setIsOverLimit(true);
1970
1913
  } else {
@@ -1987,9 +1930,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
1987
1930
  required,
1988
1931
  color: error || isOverLimit ? "danger" : props.color,
1989
1932
  label,
1990
- helperText: isOverLimit ? new IntlMessageFormat2(`limit: {amount, number, ::currency/${currency} unit-width-narrow}`).format({
1991
- amount: max
1992
- }) : helperText,
1933
+ helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
1993
1934
  slotProps: {
1994
1935
  input: {
1995
1936
  component: TextMaskAdapter,
@@ -5096,10 +5037,10 @@ import { Link as Link2 } from "@mui/joy";
5096
5037
  import remarkGfm from "remark-gfm";
5097
5038
  var LazyReactMarkdown = lazy(() => import("react-markdown"));
5098
5039
  var Markdown = (props) => {
5099
- const [rehypeAccent2, setRehypeAccent] = useState12(null);
5040
+ const [rehypeAccent, setRehypeAccent] = useState12(null);
5100
5041
  useEffect10(() => {
5101
5042
  const loadRehypeAccent = async () => {
5102
- const module = await Promise.resolve().then(() => (init_rehype_accent(), rehype_accent_exports));
5043
+ const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
5103
5044
  setRehypeAccent(() => module.rehypeAccent);
5104
5045
  };
5105
5046
  loadRehypeAccent();
@@ -5116,7 +5057,7 @@ var Markdown = (props) => {
5116
5057
  fallback,
5117
5058
  ...innerProps
5118
5059
  } = props;
5119
- if (!rehypeAccent2) {
5060
+ if (!rehypeAccent) {
5120
5061
  return null;
5121
5062
  }
5122
5063
  return /* @__PURE__ */ React33.createElement(Typography, { component: "div", color, textColor, level: defaultLevel, ...innerProps }, /* @__PURE__ */ React33.createElement(
@@ -5129,7 +5070,7 @@ var Markdown = (props) => {
5129
5070
  {
5130
5071
  ...markdownOptions,
5131
5072
  children: content,
5132
- rehypePlugins: [[rehypeAccent2, { accentColor }]],
5073
+ rehypePlugins: [[rehypeAccent, { accentColor }]],
5133
5074
  remarkPlugins: [remarkGfm],
5134
5075
  components: {
5135
5076
  a: ({ children, href }) => /* @__PURE__ */ React33.createElement(Link2, { href, target: defaultLinkAction }, children),