@ceed/cds 1.2.2-next.4 → 1.2.2

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.
@@ -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, {
@@ -4236,47 +4286,16 @@ var import_joy41 = require("@mui/joy");
4236
4286
  // src/components/Markdown/Markdown.tsx
4237
4287
  var import_react31 = __toESM(require("react"));
4238
4288
  var import_joy42 = require("@mui/joy");
4239
-
4240
- // src/libs/rehype-accent/index.ts
4241
- var import_unist_util_visit = require("unist-util-visit");
4242
- function rehypeAccent(options) {
4243
- const { accentColor } = options;
4244
- return (tree) => {
4245
- (0, import_unist_util_visit.visit)(tree, "text", (node, index, parent) => {
4246
- const value = node.value;
4247
- const regex = /\|\|.*?\|\|/g;
4248
- let match;
4249
- let lastIndex = 0;
4250
- const newNodes = [];
4251
- while ((match = regex.exec(value)) !== null) {
4252
- if (match.index > lastIndex) {
4253
- newNodes.push({
4254
- type: "text",
4255
- value: value.slice(lastIndex, match.index)
4256
- });
4257
- }
4258
- const innerText = match[0].split("||")[1];
4259
- newNodes.push({
4260
- type: "element",
4261
- tagName: "p",
4262
- properties: { textColor: accentColor },
4263
- children: [{ type: "text", value: innerText }]
4264
- });
4265
- lastIndex = match.index + match[0].length;
4266
- }
4267
- if (lastIndex < value.length) {
4268
- newNodes.push({ type: "text", value: value.slice(lastIndex) });
4269
- }
4270
- if (newNodes.length) {
4271
- parent.children.splice(index, 1, ...newNodes);
4272
- }
4273
- });
4274
- };
4275
- }
4276
-
4277
- // src/components/Markdown/Markdown.tsx
4278
4289
  var LazyReactMarkdown = (0, import_react31.lazy)(() => import("react-markdown"));
4279
4290
  var Markdown = (props) => {
4291
+ const [rehypeAccent2, setRehypeAccent] = (0, import_react31.useState)(null);
4292
+ (0, import_react31.useEffect)(() => {
4293
+ const loadRehypeAccent = async () => {
4294
+ const module2 = await Promise.resolve().then(() => (init_rehype_accent(), rehype_accent_exports));
4295
+ setRehypeAccent(() => module2.rehypeAccent);
4296
+ };
4297
+ loadRehypeAccent();
4298
+ }, []);
4280
4299
  const {
4281
4300
  color,
4282
4301
  textColor,
@@ -4288,6 +4307,9 @@ var Markdown = (props) => {
4288
4307
  content,
4289
4308
  ...innerProps
4290
4309
  } = props;
4310
+ if (!rehypeAccent2) {
4311
+ return null;
4312
+ }
4291
4313
  return /* @__PURE__ */ import_react31.default.createElement(
4292
4314
  Typography,
4293
4315
  {
@@ -4302,7 +4324,7 @@ var Markdown = (props) => {
4302
4324
  {
4303
4325
  ...markdownOptions,
4304
4326
  children: content,
4305
- rehypePlugins: [[rehypeAccent, { accentColor }]],
4327
+ rehypePlugins: [[rehypeAccent2, { accentColor }]],
4306
4328
  components: {
4307
4329
  h1: ({ children }) => /* @__PURE__ */ import_react31.default.createElement(Typography, { color, textColor, level: "h1" }, children),
4308
4330
  h2: ({ children }) => /* @__PURE__ */ import_react31.default.createElement(Typography, { color, textColor, level: "h2" }, children),
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 useTheme3,
@@ -4202,49 +4258,18 @@ InsetDrawer.displayName = "InsetDrawer";
4202
4258
  import { Grid } from "@mui/joy";
4203
4259
 
4204
4260
  // src/components/Markdown/Markdown.tsx
4205
- import React29, { lazy, Suspense } from "react";
4261
+ import React29, { lazy, Suspense, useEffect as useEffect7, useState as useState8 } from "react";
4206
4262
  import { Link as Link2 } from "@mui/joy";
4207
-
4208
- // src/libs/rehype-accent/index.ts
4209
- import { visit } from "unist-util-visit";
4210
- function rehypeAccent(options) {
4211
- const { accentColor } = options;
4212
- return (tree) => {
4213
- visit(tree, "text", (node, index, parent) => {
4214
- const value = node.value;
4215
- const regex = /\|\|.*?\|\|/g;
4216
- let match;
4217
- let lastIndex = 0;
4218
- const newNodes = [];
4219
- while ((match = regex.exec(value)) !== null) {
4220
- if (match.index > lastIndex) {
4221
- newNodes.push({
4222
- type: "text",
4223
- value: value.slice(lastIndex, match.index)
4224
- });
4225
- }
4226
- const innerText = match[0].split("||")[1];
4227
- newNodes.push({
4228
- type: "element",
4229
- tagName: "p",
4230
- properties: { textColor: accentColor },
4231
- children: [{ type: "text", value: innerText }]
4232
- });
4233
- lastIndex = match.index + match[0].length;
4234
- }
4235
- if (lastIndex < value.length) {
4236
- newNodes.push({ type: "text", value: value.slice(lastIndex) });
4237
- }
4238
- if (newNodes.length) {
4239
- parent.children.splice(index, 1, ...newNodes);
4240
- }
4241
- });
4242
- };
4243
- }
4244
-
4245
- // src/components/Markdown/Markdown.tsx
4246
4263
  var LazyReactMarkdown = lazy(() => import("react-markdown"));
4247
4264
  var Markdown = (props) => {
4265
+ const [rehypeAccent2, setRehypeAccent] = useState8(null);
4266
+ useEffect7(() => {
4267
+ const loadRehypeAccent = async () => {
4268
+ const module = await Promise.resolve().then(() => (init_rehype_accent(), rehype_accent_exports));
4269
+ setRehypeAccent(() => module.rehypeAccent);
4270
+ };
4271
+ loadRehypeAccent();
4272
+ }, []);
4248
4273
  const {
4249
4274
  color,
4250
4275
  textColor,
@@ -4256,6 +4281,9 @@ var Markdown = (props) => {
4256
4281
  content,
4257
4282
  ...innerProps
4258
4283
  } = props;
4284
+ if (!rehypeAccent2) {
4285
+ return null;
4286
+ }
4259
4287
  return /* @__PURE__ */ React29.createElement(
4260
4288
  Typography,
4261
4289
  {
@@ -4270,7 +4298,7 @@ var Markdown = (props) => {
4270
4298
  {
4271
4299
  ...markdownOptions,
4272
4300
  children: content,
4273
- rehypePlugins: [[rehypeAccent, { accentColor }]],
4301
+ rehypePlugins: [[rehypeAccent2, { accentColor }]],
4274
4302
  components: {
4275
4303
  h1: ({ children }) => /* @__PURE__ */ React29.createElement(Typography, { color, textColor, level: "h1" }, children),
4276
4304
  h2: ({ children }) => /* @__PURE__ */ React29.createElement(Typography, { color, textColor, level: "h2" }, children),
@@ -4365,10 +4393,10 @@ MenuButton.displayName = "MenuButton";
4365
4393
  import React31, {
4366
4394
  forwardRef as forwardRef9,
4367
4395
  useCallback as useCallback11,
4368
- useEffect as useEffect7,
4396
+ useEffect as useEffect8,
4369
4397
  useImperativeHandle as useImperativeHandle4,
4370
4398
  useRef as useRef6,
4371
- useState as useState8
4399
+ useState as useState9
4372
4400
  } from "react";
4373
4401
  import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
4374
4402
  import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
@@ -4481,9 +4509,9 @@ var MonthPicker = forwardRef9(
4481
4509
  ),
4482
4510
  { disableStrict: true }
4483
4511
  );
4484
- const [anchorEl, setAnchorEl] = useState8(null);
4512
+ const [anchorEl, setAnchorEl] = useState9(null);
4485
4513
  const open = Boolean(anchorEl);
4486
- useEffect7(() => {
4514
+ useEffect8(() => {
4487
4515
  if (!anchorEl) {
4488
4516
  innerRef.current?.blur();
4489
4517
  }
@@ -4614,11 +4642,11 @@ var MonthPicker = forwardRef9(
4614
4642
  import React32, {
4615
4643
  forwardRef as forwardRef10,
4616
4644
  useCallback as useCallback12,
4617
- useEffect as useEffect8,
4645
+ useEffect as useEffect9,
4618
4646
  useImperativeHandle as useImperativeHandle5,
4619
4647
  useMemo as useMemo10,
4620
4648
  useRef as useRef7,
4621
- useState as useState9
4649
+ useState as useState10
4622
4650
  } from "react";
4623
4651
  import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
4624
4652
  import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
@@ -4740,13 +4768,13 @@ var MonthRangePicker = forwardRef10(
4740
4768
  ),
4741
4769
  { disableStrict: true }
4742
4770
  );
4743
- const [anchorEl, setAnchorEl] = useState9(null);
4771
+ const [anchorEl, setAnchorEl] = useState10(null);
4744
4772
  const open = Boolean(anchorEl);
4745
4773
  const calendarValue = useMemo10(
4746
4774
  () => value ? parseDates2(value) : void 0,
4747
4775
  [value]
4748
4776
  );
4749
- useEffect8(() => {
4777
+ useEffect9(() => {
4750
4778
  if (!anchorEl) {
4751
4779
  innerRef.current?.blur();
4752
4780
  }
@@ -4995,7 +5023,7 @@ function Navigator(props) {
4995
5023
  Navigator.displayName = "Navigator";
4996
5024
 
4997
5025
  // src/components/PercentageInput/PercentageInput.tsx
4998
- import React36, { useCallback as useCallback13, useMemo as useMemo11, useState as useState10 } from "react";
5026
+ import React36, { useCallback as useCallback13, useMemo as useMemo11, useState as useState11 } from "react";
4999
5027
  import { NumericFormat as NumericFormat2 } from "react-number-format";
5000
5028
  import { styled as styled21, useThemeProps as useThemeProps8 } from "@mui/joy";
5001
5029
  var padDecimal = (value, decimalScale) => {
@@ -5058,7 +5086,7 @@ var PercentageInput = React36.forwardRef(function PercentageInput2(inProps, ref)
5058
5086
  [onChange, name]
5059
5087
  )
5060
5088
  );
5061
- const [internalError, setInternalError] = useState10(
5089
+ const [internalError, setInternalError] = useState11(
5062
5090
  max && _value && _value > max || min && _value && _value < min
5063
5091
  );
5064
5092
  const value = useMemo11(() => {
@@ -5541,10 +5569,10 @@ ThemeProvider.displayName = "ThemeProvider";
5541
5569
  // src/components/Uploader/Uploader.tsx
5542
5570
  import React41, {
5543
5571
  useCallback as useCallback14,
5544
- useEffect as useEffect9,
5572
+ useEffect as useEffect10,
5545
5573
  useMemo as useMemo12,
5546
5574
  useRef as useRef8,
5547
- useState as useState11
5575
+ useState as useState12
5548
5576
  } from "react";
5549
5577
  import { styled as styled24, Input as Input2 } from "@mui/joy";
5550
5578
  import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
@@ -5726,12 +5754,12 @@ var Uploader = React41.memo(
5726
5754
  } = props;
5727
5755
  const dropZoneRef = useRef8(null);
5728
5756
  const inputRef = useRef8(null);
5729
- const [errorText, setErrorText] = useState11();
5730
- const [files, setFiles] = useState11([]);
5731
- const [uploaded, setUploaded] = useState11(
5757
+ const [errorText, setErrorText] = useState12();
5758
+ const [files, setFiles] = useState12([]);
5759
+ const [uploaded, setUploaded] = useState12(
5732
5760
  props.uploaded || []
5733
5761
  );
5734
- const [previewState, setPreviewState] = useState11("idle");
5762
+ const [previewState, setPreviewState] = useState12("idle");
5735
5763
  const accepts = useMemo12(
5736
5764
  () => accept.split(",").map((accept2) => accept2.trim()),
5737
5765
  [accept]
@@ -5843,7 +5871,7 @@ var Uploader = React41.memo(
5843
5871
  onChange
5844
5872
  ]
5845
5873
  );
5846
- useEffect9(() => {
5874
+ useEffect10(() => {
5847
5875
  if (!dropZoneRef.current || disabled) {
5848
5876
  return;
5849
5877
  }
@@ -5891,7 +5919,7 @@ var Uploader = React41.memo(
5891
5919
  );
5892
5920
  return () => cleanup?.();
5893
5921
  }, [disabled, addFiles]);
5894
- useEffect9(() => {
5922
+ useEffect10(() => {
5895
5923
  if (inputRef.current && minCount) {
5896
5924
  if (files.length < minCount) {
5897
5925
  inputRef.current.setCustomValidity(