@ceed/ads 1.2.2-next.3 → 1.2.2-next.5

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,5 +1,5 @@
1
1
  import React from "react";
2
- import { Options } from "react-markdown";
2
+ import { type Options } from "react-markdown";
3
3
  import { MotionProps } from "framer-motion";
4
4
  import { TypographyProps } from "@mui/joy";
5
5
  import { TypographySystem } from "@mui/joy";
@@ -27,7 +27,7 @@ declare const Markdown: {
27
27
  defaultLinkAction?: "_self" | "_blank" | "_parent" | "_top" | "_unfencedTop" | undefined;
28
28
  markdownOptions?: import("react-markdown").Options | undefined;
29
29
  boldFontWeight?: "sm" | "md" | "lg" | "xl" | undefined;
30
- }): React.JSX.Element;
30
+ }): React.JSX.Element | null;
31
31
  displayName: string;
32
32
  };
33
33
  export { Markdown };
package/dist/index.cjs CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,6 +30,53 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
30
  ));
28
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
32
 
33
+ // src/libs/rehype-accent/index.ts
34
+ var rehype_accent_exports = {};
35
+ __export(rehype_accent_exports, {
36
+ rehypeAccent: () => rehypeAccent
37
+ });
38
+ function rehypeAccent(options) {
39
+ const { accentColor } = options;
40
+ return (tree) => {
41
+ (0, import_unist_util_visit.visit)(tree, "text", (node, index, parent) => {
42
+ const value = node.value;
43
+ const regex = /\|\|.*?\|\|/g;
44
+ let match;
45
+ let lastIndex = 0;
46
+ const newNodes = [];
47
+ while ((match = regex.exec(value)) !== null) {
48
+ if (match.index > lastIndex) {
49
+ newNodes.push({
50
+ type: "text",
51
+ value: value.slice(lastIndex, match.index)
52
+ });
53
+ }
54
+ const innerText = match[0].split("||")[1];
55
+ newNodes.push({
56
+ type: "element",
57
+ tagName: "p",
58
+ properties: { textColor: accentColor },
59
+ children: [{ type: "text", value: innerText }]
60
+ });
61
+ lastIndex = match.index + match[0].length;
62
+ }
63
+ if (lastIndex < value.length) {
64
+ newNodes.push({ type: "text", value: value.slice(lastIndex) });
65
+ }
66
+ if (newNodes.length) {
67
+ parent.children.splice(index, 1, ...newNodes);
68
+ }
69
+ });
70
+ };
71
+ }
72
+ var import_unist_util_visit;
73
+ var init_rehype_accent = __esm({
74
+ "src/libs/rehype-accent/index.ts"() {
75
+ "use strict";
76
+ import_unist_util_visit = require("unist-util-visit");
77
+ }
78
+ });
79
+
30
80
  // src/index.ts
31
81
  var index_exports = {};
32
82
  __export(index_exports, {
@@ -4678,48 +4728,17 @@ var import_joy42 = require("@mui/joy");
4678
4728
 
4679
4729
  // src/components/Markdown/Markdown.tsx
4680
4730
  var import_react32 = __toESM(require("react"));
4681
- var import_react_markdown = __toESM(require("react-markdown"));
4682
4731
  var import_joy43 = require("@mui/joy");
4683
-
4684
- // src/libs/rehype-accent/index.ts
4685
- var import_unist_util_visit = require("unist-util-visit");
4686
- function rehypeAccent(options) {
4687
- const { accentColor } = options;
4688
- return (tree) => {
4689
- (0, import_unist_util_visit.visit)(tree, "text", (node, index, parent) => {
4690
- const value = node.value;
4691
- const regex = /\|\|.*?\|\|/g;
4692
- let match;
4693
- let lastIndex = 0;
4694
- const newNodes = [];
4695
- while ((match = regex.exec(value)) !== null) {
4696
- if (match.index > lastIndex) {
4697
- newNodes.push({
4698
- type: "text",
4699
- value: value.slice(lastIndex, match.index)
4700
- });
4701
- }
4702
- const innerText = match[0].split("||")[1];
4703
- newNodes.push({
4704
- type: "element",
4705
- tagName: "p",
4706
- properties: { textColor: accentColor },
4707
- children: [{ type: "text", value: innerText }]
4708
- });
4709
- lastIndex = match.index + match[0].length;
4710
- }
4711
- if (lastIndex < value.length) {
4712
- newNodes.push({ type: "text", value: value.slice(lastIndex) });
4713
- }
4714
- if (newNodes.length) {
4715
- parent.children.splice(index, 1, ...newNodes);
4716
- }
4717
- });
4718
- };
4719
- }
4720
-
4721
- // src/components/Markdown/Markdown.tsx
4732
+ var LazyReactMarkdown = (0, import_react32.lazy)(() => import("react-markdown"));
4722
4733
  var Markdown = (props) => {
4734
+ const [rehypeAccent2, setRehypeAccent] = (0, import_react32.useState)(null);
4735
+ (0, import_react32.useEffect)(() => {
4736
+ const loadRehypeAccent = async () => {
4737
+ const module2 = await Promise.resolve().then(() => (init_rehype_accent(), rehype_accent_exports));
4738
+ setRehypeAccent(() => module2.rehypeAccent);
4739
+ };
4740
+ loadRehypeAccent();
4741
+ }, []);
4723
4742
  const {
4724
4743
  color,
4725
4744
  textColor,
@@ -4731,6 +4750,9 @@ var Markdown = (props) => {
4731
4750
  content,
4732
4751
  ...innerProps
4733
4752
  } = props;
4753
+ if (!rehypeAccent2) {
4754
+ return null;
4755
+ }
4734
4756
  return /* @__PURE__ */ import_react32.default.createElement(
4735
4757
  Typography,
4736
4758
  {
@@ -4740,29 +4762,27 @@ var Markdown = (props) => {
4740
4762
  level: defaultLevel,
4741
4763
  ...innerProps
4742
4764
  },
4743
- /* @__PURE__ */ import_react32.default.createElement(
4744
- import_react_markdown.default,
4765
+ /* @__PURE__ */ import_react32.default.createElement(import_react32.Suspense, { fallback: null }, /* @__PURE__ */ import_react32.default.createElement(
4766
+ LazyReactMarkdown,
4745
4767
  {
4746
4768
  ...markdownOptions,
4747
4769
  children: content,
4748
- rehypePlugins: [[rehypeAccent, { accentColor }]],
4770
+ rehypePlugins: [[rehypeAccent2, { accentColor }]],
4749
4771
  components: {
4750
4772
  h1: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h1" }, children),
4751
4773
  h2: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h2" }, children),
4752
4774
  h3: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h3" }, children),
4753
4775
  h4: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h4" }, children),
4754
- p: ({ children, node }) => {
4755
- return /* @__PURE__ */ import_react32.default.createElement(
4756
- Typography,
4757
- {
4758
- color,
4759
- textColor,
4760
- level: defaultLevel,
4761
- ...node?.properties
4762
- },
4763
- children
4764
- );
4765
- },
4776
+ p: ({ children, node }) => /* @__PURE__ */ import_react32.default.createElement(
4777
+ Typography,
4778
+ {
4779
+ color,
4780
+ textColor,
4781
+ level: defaultLevel,
4782
+ ...node?.properties
4783
+ },
4784
+ children
4785
+ ),
4766
4786
  a: ({ children, href }) => /* @__PURE__ */ import_react32.default.createElement(import_joy43.Link, { href, target: defaultLinkAction }, children),
4767
4787
  hr: () => /* @__PURE__ */ import_react32.default.createElement(Divider, null),
4768
4788
  b: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { fontWeight: boldFontWeight }, children),
@@ -4770,7 +4790,7 @@ var Markdown = (props) => {
4770
4790
  ...markdownOptions?.components
4771
4791
  }
4772
4792
  }
4773
- )
4793
+ ))
4774
4794
  );
4775
4795
  };
4776
4796
  Markdown.displayName = "Markdown";
package/dist/index.js CHANGED
@@ -1,3 +1,59 @@
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: "p",
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
+
1
57
  // src/index.ts
2
58
  import {
3
59
  useTheme as useTheme2,
@@ -4639,49 +4695,18 @@ Uploader.displayName = "Uploader";
4639
4695
  import { Grid } from "@mui/joy";
4640
4696
 
4641
4697
  // src/components/Markdown/Markdown.tsx
4642
- import React30 from "react";
4643
- import ReactMarkdown from "react-markdown";
4698
+ import React30, { lazy, Suspense, useEffect as useEffect8, useState as useState9 } from "react";
4644
4699
  import { Link as Link2 } from "@mui/joy";
4645
-
4646
- // src/libs/rehype-accent/index.ts
4647
- import { visit } from "unist-util-visit";
4648
- function rehypeAccent(options) {
4649
- const { accentColor } = options;
4650
- return (tree) => {
4651
- visit(tree, "text", (node, index, parent) => {
4652
- const value = node.value;
4653
- const regex = /\|\|.*?\|\|/g;
4654
- let match;
4655
- let lastIndex = 0;
4656
- const newNodes = [];
4657
- while ((match = regex.exec(value)) !== null) {
4658
- if (match.index > lastIndex) {
4659
- newNodes.push({
4660
- type: "text",
4661
- value: value.slice(lastIndex, match.index)
4662
- });
4663
- }
4664
- const innerText = match[0].split("||")[1];
4665
- newNodes.push({
4666
- type: "element",
4667
- tagName: "p",
4668
- properties: { textColor: accentColor },
4669
- children: [{ type: "text", value: innerText }]
4670
- });
4671
- lastIndex = match.index + match[0].length;
4672
- }
4673
- if (lastIndex < value.length) {
4674
- newNodes.push({ type: "text", value: value.slice(lastIndex) });
4675
- }
4676
- if (newNodes.length) {
4677
- parent.children.splice(index, 1, ...newNodes);
4678
- }
4679
- });
4680
- };
4681
- }
4682
-
4683
- // src/components/Markdown/Markdown.tsx
4700
+ var LazyReactMarkdown = lazy(() => import("react-markdown"));
4684
4701
  var Markdown = (props) => {
4702
+ const [rehypeAccent2, setRehypeAccent] = useState9(null);
4703
+ useEffect8(() => {
4704
+ const loadRehypeAccent = async () => {
4705
+ const module = await Promise.resolve().then(() => (init_rehype_accent(), rehype_accent_exports));
4706
+ setRehypeAccent(() => module.rehypeAccent);
4707
+ };
4708
+ loadRehypeAccent();
4709
+ }, []);
4685
4710
  const {
4686
4711
  color,
4687
4712
  textColor,
@@ -4693,6 +4718,9 @@ var Markdown = (props) => {
4693
4718
  content,
4694
4719
  ...innerProps
4695
4720
  } = props;
4721
+ if (!rehypeAccent2) {
4722
+ return null;
4723
+ }
4696
4724
  return /* @__PURE__ */ React30.createElement(
4697
4725
  Typography,
4698
4726
  {
@@ -4702,29 +4730,27 @@ var Markdown = (props) => {
4702
4730
  level: defaultLevel,
4703
4731
  ...innerProps
4704
4732
  },
4705
- /* @__PURE__ */ React30.createElement(
4706
- ReactMarkdown,
4733
+ /* @__PURE__ */ React30.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React30.createElement(
4734
+ LazyReactMarkdown,
4707
4735
  {
4708
4736
  ...markdownOptions,
4709
4737
  children: content,
4710
- rehypePlugins: [[rehypeAccent, { accentColor }]],
4738
+ rehypePlugins: [[rehypeAccent2, { accentColor }]],
4711
4739
  components: {
4712
4740
  h1: ({ children }) => /* @__PURE__ */ React30.createElement(Typography, { color, textColor, level: "h1" }, children),
4713
4741
  h2: ({ children }) => /* @__PURE__ */ React30.createElement(Typography, { color, textColor, level: "h2" }, children),
4714
4742
  h3: ({ children }) => /* @__PURE__ */ React30.createElement(Typography, { color, textColor, level: "h3" }, children),
4715
4743
  h4: ({ children }) => /* @__PURE__ */ React30.createElement(Typography, { color, textColor, level: "h4" }, children),
4716
- p: ({ children, node }) => {
4717
- return /* @__PURE__ */ React30.createElement(
4718
- Typography,
4719
- {
4720
- color,
4721
- textColor,
4722
- level: defaultLevel,
4723
- ...node?.properties
4724
- },
4725
- children
4726
- );
4727
- },
4744
+ p: ({ children, node }) => /* @__PURE__ */ React30.createElement(
4745
+ Typography,
4746
+ {
4747
+ color,
4748
+ textColor,
4749
+ level: defaultLevel,
4750
+ ...node?.properties
4751
+ },
4752
+ children
4753
+ ),
4728
4754
  a: ({ children, href }) => /* @__PURE__ */ React30.createElement(Link2, { href, target: defaultLinkAction }, children),
4729
4755
  hr: () => /* @__PURE__ */ React30.createElement(Divider, null),
4730
4756
  b: ({ children }) => /* @__PURE__ */ React30.createElement(Typography, { fontWeight: boldFontWeight }, children),
@@ -4732,7 +4758,7 @@ var Markdown = (props) => {
4732
4758
  ...markdownOptions?.components
4733
4759
  }
4734
4760
  }
4735
- )
4761
+ ))
4736
4762
  );
4737
4763
  };
4738
4764
  Markdown.displayName = "Markdown";
@@ -4804,10 +4830,10 @@ MenuButton.displayName = "MenuButton";
4804
4830
  import React32, {
4805
4831
  forwardRef as forwardRef9,
4806
4832
  useCallback as useCallback12,
4807
- useEffect as useEffect8,
4833
+ useEffect as useEffect9,
4808
4834
  useImperativeHandle as useImperativeHandle4,
4809
4835
  useRef as useRef7,
4810
- useState as useState9
4836
+ useState as useState10
4811
4837
  } from "react";
4812
4838
  import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
4813
4839
  import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
@@ -4920,9 +4946,9 @@ var MonthPicker = forwardRef9(
4920
4946
  ),
4921
4947
  { disableStrict: true }
4922
4948
  );
4923
- const [anchorEl, setAnchorEl] = useState9(null);
4949
+ const [anchorEl, setAnchorEl] = useState10(null);
4924
4950
  const open = Boolean(anchorEl);
4925
- useEffect8(() => {
4951
+ useEffect9(() => {
4926
4952
  if (!anchorEl) {
4927
4953
  innerRef.current?.blur();
4928
4954
  }
@@ -5053,11 +5079,11 @@ var MonthPicker = forwardRef9(
5053
5079
  import React33, {
5054
5080
  forwardRef as forwardRef10,
5055
5081
  useCallback as useCallback13,
5056
- useEffect as useEffect9,
5082
+ useEffect as useEffect10,
5057
5083
  useImperativeHandle as useImperativeHandle5,
5058
5084
  useMemo as useMemo11,
5059
5085
  useRef as useRef8,
5060
- useState as useState10
5086
+ useState as useState11
5061
5087
  } from "react";
5062
5088
  import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
5063
5089
  import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
@@ -5179,13 +5205,13 @@ var MonthRangePicker = forwardRef10(
5179
5205
  ),
5180
5206
  { disableStrict: true }
5181
5207
  );
5182
- const [anchorEl, setAnchorEl] = useState10(null);
5208
+ const [anchorEl, setAnchorEl] = useState11(null);
5183
5209
  const open = Boolean(anchorEl);
5184
5210
  const calendarValue = useMemo11(
5185
5211
  () => value ? parseDates2(value) : void 0,
5186
5212
  [value]
5187
5213
  );
5188
- useEffect9(() => {
5214
+ useEffect10(() => {
5189
5215
  if (!anchorEl) {
5190
5216
  innerRef.current?.blur();
5191
5217
  }
@@ -5434,7 +5460,7 @@ function Navigator(props) {
5434
5460
  Navigator.displayName = "Navigator";
5435
5461
 
5436
5462
  // src/components/PercentageInput/PercentageInput.tsx
5437
- import React37, { useCallback as useCallback14, useMemo as useMemo12, useState as useState11 } from "react";
5463
+ import React37, { useCallback as useCallback14, useMemo as useMemo12, useState as useState12 } from "react";
5438
5464
  import { NumericFormat as NumericFormat2 } from "react-number-format";
5439
5465
  import { styled as styled23, useThemeProps as useThemeProps8 } from "@mui/joy";
5440
5466
  var padDecimal = (value, decimalScale) => {
@@ -5497,7 +5523,7 @@ var PercentageInput = React37.forwardRef(function PercentageInput2(inProps, ref)
5497
5523
  [onChange, name]
5498
5524
  )
5499
5525
  );
5500
- const [internalError, setInternalError] = useState11(
5526
+ const [internalError, setInternalError] = useState12(
5501
5527
  max && _value && _value > max || min && _value && _value < min
5502
5528
  );
5503
5529
  const value = useMemo12(() => {