@ceed/ads 1.24.0 → 1.25.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/chunks/rehype-accent-FZRUD7VI.js +39 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/data-display/DataTable.md +1 -1
- package/dist/components/surfaces/Sheet.md +1 -1
- package/dist/index.browser.js +14 -16
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +6 -9
- package/dist/index.js +10 -69
- package/framer/index.js +1 -166
- package/package.json +14 -14
package/dist/index.cjs
CHANGED
|
@@ -1692,7 +1692,6 @@ Container.displayName = "Container";
|
|
|
1692
1692
|
|
|
1693
1693
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1694
1694
|
var import_react18 = __toESM(require("react"));
|
|
1695
|
-
var import_intl_messageformat2 = require("intl-messageformat");
|
|
1696
1695
|
var import_react_number_format = require("react-number-format");
|
|
1697
1696
|
|
|
1698
1697
|
// src/components/Input/Input.tsx
|
|
@@ -1816,7 +1815,6 @@ var Input_default = Input;
|
|
|
1816
1815
|
var import_joy24 = require("@mui/joy");
|
|
1817
1816
|
|
|
1818
1817
|
// src/components/CurrencyInput/hooks/use-currency-setting.ts
|
|
1819
|
-
var import_intl_messageformat = __toESM(require("intl-messageformat"));
|
|
1820
1818
|
var CURRENCY_DECIMAL_MAP = {
|
|
1821
1819
|
AED: 2,
|
|
1822
1820
|
ALL: 2,
|
|
@@ -1961,9 +1959,10 @@ var CURRENCY_DECIMAL_MAP = {
|
|
|
1961
1959
|
};
|
|
1962
1960
|
var useCurrencySetting = (props) => {
|
|
1963
1961
|
const { currency = "USD", placeholder } = props;
|
|
1964
|
-
const
|
|
1965
|
-
|
|
1966
|
-
|
|
1962
|
+
const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
|
|
1963
|
+
const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
|
|
1964
|
+
const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1965
|
+
const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1967
1966
|
const decimalScale = CURRENCY_DECIMAL_MAP[currency];
|
|
1968
1967
|
return {
|
|
1969
1968
|
symbol: `${symbol} `,
|
|
@@ -2040,7 +2039,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
|
|
|
2040
2039
|
setValue(void 0);
|
|
2041
2040
|
return;
|
|
2042
2041
|
}
|
|
2043
|
-
const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
|
|
2042
|
+
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
2044
2043
|
if (!!max && Number(event.target.value) > max) {
|
|
2045
2044
|
setIsOverLimit(true);
|
|
2046
2045
|
} else {
|
|
@@ -2063,9 +2062,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
|
|
|
2063
2062
|
required,
|
|
2064
2063
|
color: error || isOverLimit ? "danger" : props.color,
|
|
2065
2064
|
label,
|
|
2066
|
-
helperText: isOverLimit ?
|
|
2067
|
-
amount: max
|
|
2068
|
-
}) : helperText,
|
|
2065
|
+
helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
|
|
2069
2066
|
slotProps: {
|
|
2070
2067
|
input: {
|
|
2071
2068
|
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,
|
|
@@ -1606,7 +1550,6 @@ Container.displayName = "Container";
|
|
|
1606
1550
|
|
|
1607
1551
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1608
1552
|
import React16, { useCallback as useCallback7, useMemo as useMemo5, useState as useState6 } from "react";
|
|
1609
|
-
import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
|
|
1610
1553
|
import { NumericFormat } from "react-number-format";
|
|
1611
1554
|
|
|
1612
1555
|
// src/components/Input/Input.tsx
|
|
@@ -1730,7 +1673,6 @@ var Input_default = Input;
|
|
|
1730
1673
|
import { styled as styled7, useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
1731
1674
|
|
|
1732
1675
|
// src/components/CurrencyInput/hooks/use-currency-setting.ts
|
|
1733
|
-
import IntlMessageFormat from "intl-messageformat";
|
|
1734
1676
|
var CURRENCY_DECIMAL_MAP = {
|
|
1735
1677
|
AED: 2,
|
|
1736
1678
|
ALL: 2,
|
|
@@ -1875,9 +1817,10 @@ var CURRENCY_DECIMAL_MAP = {
|
|
|
1875
1817
|
};
|
|
1876
1818
|
var useCurrencySetting = (props) => {
|
|
1877
1819
|
const { currency = "USD", placeholder } = props;
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
|
|
1820
|
+
const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
|
|
1821
|
+
const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
|
|
1822
|
+
const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1823
|
+
const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1881
1824
|
const decimalScale = CURRENCY_DECIMAL_MAP[currency];
|
|
1882
1825
|
return {
|
|
1883
1826
|
symbol: `${symbol} `,
|
|
@@ -1954,7 +1897,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1954
1897
|
setValue(void 0);
|
|
1955
1898
|
return;
|
|
1956
1899
|
}
|
|
1957
|
-
const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
|
|
1900
|
+
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
1958
1901
|
if (!!max && Number(event.target.value) > max) {
|
|
1959
1902
|
setIsOverLimit(true);
|
|
1960
1903
|
} else {
|
|
@@ -1977,9 +1920,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1977
1920
|
required,
|
|
1978
1921
|
color: error || isOverLimit ? "danger" : props.color,
|
|
1979
1922
|
label,
|
|
1980
|
-
helperText: isOverLimit ?
|
|
1981
|
-
amount: max
|
|
1982
|
-
}) : helperText,
|
|
1923
|
+
helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
|
|
1983
1924
|
slotProps: {
|
|
1984
1925
|
input: {
|
|
1985
1926
|
component: TextMaskAdapter,
|
|
@@ -6094,10 +6035,10 @@ import { Link as Link2 } from "@mui/joy";
|
|
|
6094
6035
|
import remarkGfm from "remark-gfm";
|
|
6095
6036
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
6096
6037
|
var Markdown = (props) => {
|
|
6097
|
-
const [
|
|
6038
|
+
const [rehypeAccent, setRehypeAccent] = useState15(null);
|
|
6098
6039
|
useEffect12(() => {
|
|
6099
6040
|
const loadRehypeAccent = async () => {
|
|
6100
|
-
const module = await
|
|
6041
|
+
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
6101
6042
|
setRehypeAccent(() => module.rehypeAccent);
|
|
6102
6043
|
};
|
|
6103
6044
|
loadRehypeAccent();
|
|
@@ -6114,7 +6055,7 @@ var Markdown = (props) => {
|
|
|
6114
6055
|
fallback,
|
|
6115
6056
|
...innerProps
|
|
6116
6057
|
} = props;
|
|
6117
|
-
if (!
|
|
6058
|
+
if (!rehypeAccent) {
|
|
6118
6059
|
return null;
|
|
6119
6060
|
}
|
|
6120
6061
|
return /* @__PURE__ */ React44.createElement(Typography, { component: "div", color, textColor, level: defaultLevel, ...innerProps }, /* @__PURE__ */ React44.createElement(
|
|
@@ -6127,7 +6068,7 @@ var Markdown = (props) => {
|
|
|
6127
6068
|
{
|
|
6128
6069
|
...markdownOptions,
|
|
6129
6070
|
children: content,
|
|
6130
|
-
rehypePlugins: [[
|
|
6071
|
+
rehypePlugins: [[rehypeAccent, { accentColor }]],
|
|
6131
6072
|
remarkPlugins: [remarkGfm],
|
|
6132
6073
|
components: {
|
|
6133
6074
|
a: ({ children, href }) => /* @__PURE__ */ React44.createElement(Link2, { href, target: defaultLinkAction }, children),
|