@embeddable.com/remarkable-ui 2.0.42 → 2.0.44

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles
3
- } from "./chunk-54RMM3OQ.js";
3
+ } from "./chunk-TZ3EDAGU.js";
4
4
 
5
5
  // src/components/charts/bars/BarChart.tsx
6
6
  import { useRef } from "react";
@@ -221,6 +221,7 @@ var getChartjsAxisOptions = () => mergician(getChartjsOptions(), {
221
221
  scales: getChartjsAxisOptionsScales()
222
222
  });
223
223
  var chartjsAxisOptionsLayoutPadding = 30;
224
+ var chartjsAxisOptionsLayoutPaddingLarge = 60;
224
225
  function isMixedValues(values) {
225
226
  const hasPos = values.some((v) => v > 0);
226
227
  const hasNeg = values.some((v) => v < 0);
@@ -325,7 +326,7 @@ var getBarHorizontalChartOptions = (config) => {
325
326
  indexAxis: "y",
326
327
  layout: {
327
328
  padding: {
328
- right: (config.stacked ? config.showTotalLabels : config.showValueLabels) ? chartjsAxisOptionsLayoutPadding : 0
329
+ right: (config.stacked ? config.showTotalLabels : config.showValueLabels) ? chartjsAxisOptionsLayoutPaddingLarge : 0
329
330
  }
330
331
  },
331
332
  plugins: {
@@ -1860,7 +1861,7 @@ var TableBodyCellWithCopy = ({
1860
1861
  value,
1861
1862
  align = "left",
1862
1863
  children,
1863
- style
1864
+ style: style2
1864
1865
  }) => {
1865
1866
  const [isPressedCopy, setIsPressedCopy] = useState5(false);
1866
1867
  const handleCopy = () => {
@@ -1873,7 +1874,7 @@ var TableBodyCellWithCopy = ({
1873
1874
  "td",
1874
1875
  {
1875
1876
  title: value,
1876
- style: { textAlign: align, ...style },
1877
+ style: { textAlign: align, ...style2 },
1877
1878
  onMouseLeave: () => setIsPressedCopy(false),
1878
1879
  children: [
1879
1880
  /* @__PURE__ */ jsx12(
@@ -1922,7 +1923,7 @@ var TablePagination = ({
1922
1923
  if (totalPages && page >= totalPages) {
1923
1924
  onPageChange(0);
1924
1925
  }
1925
- }, [totalPages, page]);
1926
+ }, [totalPages, page, onPageChange]);
1926
1927
  return /* @__PURE__ */ jsx13("div", { className: styles10.tablePagination, "aria-label": "Table pagination controls", children: /* @__PURE__ */ jsxs7("div", { className: styles10.tablePaginationCentral, children: [
1927
1928
  /* @__PURE__ */ jsxs7("div", { className: styles10.tablePaginationCentralButtons, children: [
1928
1929
  /* @__PURE__ */ jsx13(
@@ -2181,8 +2182,9 @@ var DateRangePickerChevron = ({
2181
2182
  const rotation = orientation === "left" ? void 0 : "rotate(180deg)";
2182
2183
  const isSmallChevron = size === SMALL_SIZE;
2183
2184
  return /* @__PURE__ */ jsx16(
2184
- "button",
2185
+ "span",
2185
2186
  {
2187
+ "data-testid": "date-range-picker-chevron",
2186
2188
  className: clsx9(styles12.chevron, isSmallChevron && styles12.small),
2187
2189
  style: {
2188
2190
  transform: rotation
@@ -2299,7 +2301,7 @@ import { forwardRef as forwardRef3 } from "react";
2299
2301
  // src/components/shared/GhostButton/GhostButton.tsx
2300
2302
  import React3 from "react";
2301
2303
  import clsx11 from "clsx";
2302
- import styles14 from "./GhostButton.module-JZ7YOOU5.module.css";
2304
+ import styles14 from "./GhostButton.module-33OGL7WW.module.css";
2303
2305
  import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
2304
2306
  var GhostButton = React3.forwardRef(
2305
2307
  ({ startIcon: StartIcon, endIcon: EndIcon, children, className, ...props }, ref) => {
@@ -2564,7 +2566,7 @@ import { forwardRef as forwardRef5 } from "react";
2564
2566
 
2565
2567
  // src/components/editors/inputs/shared/InputField/InputField.tsx
2566
2568
  import { IconX as IconX2 } from "@tabler/icons-react";
2567
- import styles20 from "./InputField.module-LDLOMDBK.module.css";
2569
+ import styles20 from "./InputField.module-DWUIQOWJ.module.css";
2568
2570
  import clsx16 from "clsx";
2569
2571
  import { forwardRef as forwardRef4 } from "react";
2570
2572
  import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -2692,7 +2694,7 @@ import { Fragment as Fragment6, useEffect as useEffect8, useMemo as useMemo5, us
2692
2694
 
2693
2695
  // src/components/editors/selects/shared/SelectFieldContent/SelectFieldOptions/SelectFieldOption/SelectFieldOption.tsx
2694
2696
  import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
2695
- import styles21 from "./SelectFieldOption.module-SH3TOVNB.module.css";
2697
+ import styles21 from "./SelectFieldOption.module-ZXJXUZWN.module.css";
2696
2698
  import clsx17 from "clsx";
2697
2699
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
2698
2700
  var SelectListOption = ({
@@ -3251,61 +3253,227 @@ var CardFeedback = ({
3251
3253
  ] });
3252
3254
  };
3253
3255
 
3254
- // src/components/shared/Overlay/Overlay.tsx
3256
+ // src/components/shared/GhostButtonIcon/GhostButtonIcon.tsx
3257
+ import React5 from "react";
3255
3258
  import clsx22 from "clsx";
3256
- import styles29 from "./Overlay.module-FCW64VWM.module.css";
3259
+ import style from "./GhostButtonIcon.module-6J6DJCE6.module.css";
3257
3260
  import { jsx as jsx38 } from "react/jsx-runtime";
3261
+ var GhostButtonIcon = React5.forwardRef(
3262
+ ({ icon: Icon, className, ...props }, ref) => {
3263
+ return /* @__PURE__ */ jsx38("button", { ref, className: clsx22(style.ghostButtonIcon, className), ...props, children: /* @__PURE__ */ jsx38(Icon, {}) });
3264
+ }
3265
+ );
3266
+ GhostButtonIcon.displayName = "GhostButtonIcon";
3267
+
3268
+ // src/components/shared/Overlay/Overlay.tsx
3269
+ import clsx23 from "clsx";
3270
+ import styles29 from "./Overlay.module-FCW64VWM.module.css";
3271
+ import { jsx as jsx39 } from "react/jsx-runtime";
3258
3272
  var Overlay = ({ className, children }) => {
3259
- return /* @__PURE__ */ jsx38("div", { className: clsx22(styles29.overlay, className), children });
3273
+ return /* @__PURE__ */ jsx39("div", { className: clsx23(styles29.overlay, className), children });
3260
3274
  };
3261
3275
 
3262
3276
  // src/components/shared/Skeleton/Skeleton.tsx
3263
3277
  import styles30 from "./Skeleton.module-ZN5S5VRF.module.css";
3264
- import { jsx as jsx39 } from "react/jsx-runtime";
3278
+ import { jsx as jsx40 } from "react/jsx-runtime";
3265
3279
  var Skeleton = () => {
3266
- return /* @__PURE__ */ jsx39("div", { className: styles30.skeleton });
3280
+ return /* @__PURE__ */ jsx40("div", { className: styles30.skeleton });
3267
3281
  };
3268
3282
 
3269
3283
  // src/components/shared/Typography/Typography.tsx
3270
3284
  import styles31 from "./Typography.module-SW6CT55P.module.css";
3271
- import clsx23 from "clsx";
3272
- import { jsx as jsx40 } from "react/jsx-runtime";
3285
+ import clsx24 from "clsx";
3286
+ import { jsx as jsx41 } from "react/jsx-runtime";
3273
3287
  function Typography({
3274
3288
  children,
3275
3289
  as: Component = "p",
3276
3290
  className,
3277
- style,
3291
+ style: style2,
3278
3292
  title
3279
3293
  }) {
3280
- return /* @__PURE__ */ jsx40(Component, { title, className: clsx23(styles31.typography, className), style, children });
3294
+ return /* @__PURE__ */ jsx41(Component, { title, className: clsx24(styles31.typography, className), style: style2, children });
3281
3295
  }
3282
3296
 
3283
3297
  // src/components/shared/Divider/Divider.tsx
3284
- import clsx24 from "clsx";
3298
+ import clsx25 from "clsx";
3285
3299
  import styles32 from "./Divider.module-2BOWHKT3.module.css";
3286
- import { jsx as jsx41 } from "react/jsx-runtime";
3300
+ import { jsx as jsx42 } from "react/jsx-runtime";
3287
3301
  var getStyle2 = (color, thickness, vertical) => {
3288
- const style = {};
3289
- if (color) style.backgroundColor = color;
3302
+ const style2 = {};
3303
+ if (color) style2.backgroundColor = color;
3290
3304
  if (thickness) {
3291
3305
  if (vertical) {
3292
- style.width = thickness;
3306
+ style2.width = thickness;
3293
3307
  } else {
3294
- style.height = thickness;
3308
+ style2.height = thickness;
3295
3309
  }
3296
3310
  }
3297
- return style;
3311
+ return style2;
3298
3312
  };
3299
3313
  var Divider = ({ color, thickness, vertical, className }) => {
3300
- return /* @__PURE__ */ jsx41(
3314
+ return /* @__PURE__ */ jsx42(
3301
3315
  "div",
3302
3316
  {
3303
- className: clsx24(styles32.divider, vertical && styles32.vertical, className),
3317
+ className: clsx25(styles32.divider, vertical && styles32.vertical, className),
3304
3318
  style: getStyle2(color, thickness, vertical)
3305
3319
  }
3306
3320
  );
3307
3321
  };
3308
3322
 
3323
+ // src/components/shared/Markdown/Markdown.tsx
3324
+ import { useMemo as useMemo7 } from "react";
3325
+ import ReactMarkdown from "react-markdown";
3326
+ import remarkGfm from "remark-gfm";
3327
+ import styles33 from "./Markdown.module-AIJ2C4S2.module.css";
3328
+ import { jsx as jsx43 } from "react/jsx-runtime";
3329
+ var normalizeEscapedNewlines = (input) => input?.replaceAll(String.raw`\n`, "\n");
3330
+ var Markdown = ({ content }) => {
3331
+ const resolvedContent = useMemo7(() => {
3332
+ return normalizeEscapedNewlines(content);
3333
+ }, [content]);
3334
+ return /* @__PURE__ */ jsx43("div", { className: styles33.markdown, children: /* @__PURE__ */ jsx43(ReactMarkdown, { remarkPlugins: [remarkGfm], children: resolvedContent }) });
3335
+ };
3336
+
3337
+ // src/components/shared/MarkdownEditor/MarkdownEditor.tsx
3338
+ import {
3339
+ IconBold,
3340
+ IconCode,
3341
+ IconEye,
3342
+ IconH1,
3343
+ IconItalic,
3344
+ IconLink,
3345
+ IconList,
3346
+ IconPencil,
3347
+ IconStrikethrough
3348
+ } from "@tabler/icons-react";
3349
+ import { useRef as useRef12, useState as useState10 } from "react";
3350
+ import styles34 from "./MarkdownEditor.module-2R7P4ZIL.module.css";
3351
+
3352
+ // src/components/shared/MarkdownEditor/MarkdownEditor.utils.ts
3353
+ var MAX_HISTORY = 100;
3354
+ var applyWrap = (value, start, end, syntax) => value.slice(0, start) + syntax + value.slice(start, end) + syntax + value.slice(end);
3355
+ var applyLinePrefix = (value, start, prefix) => {
3356
+ const lineStart = value.lastIndexOf("\n", start - 1) + 1;
3357
+ return value.slice(0, lineStart) + prefix + value.slice(lineStart);
3358
+ };
3359
+
3360
+ // src/components/shared/MarkdownEditor/MarkdownEditor.tsx
3361
+ import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
3362
+ var MarkdownEditor = ({
3363
+ value: valueProp,
3364
+ onChange,
3365
+ placeholder
3366
+ }) => {
3367
+ const value = valueProp ?? "";
3368
+ const textareaRef = useRef12(null);
3369
+ const [history, setHistory] = useState10({ entries: [value], index: 0 });
3370
+ const [isPreview, setIsPreview] = useState10(false);
3371
+ const handleChange = (newValue) => {
3372
+ setHistory((prev) => {
3373
+ const entries = [...prev.entries.slice(0, prev.index + 1), newValue];
3374
+ const capped = entries.length > MAX_HISTORY ? entries.slice(-MAX_HISTORY) : entries;
3375
+ return { entries: capped, index: capped.length - 1 };
3376
+ });
3377
+ onChange?.(newValue);
3378
+ };
3379
+ const applyEdit = (edit) => {
3380
+ const textarea = textareaRef.current;
3381
+ if (!textarea) return;
3382
+ const { selectionStart: start, selectionEnd: end } = textarea;
3383
+ const result = edit(value, start, end);
3384
+ handleChange(result.value);
3385
+ requestAnimationFrame(() => {
3386
+ textarea.focus();
3387
+ textarea.setSelectionRange(...result.cursor);
3388
+ });
3389
+ };
3390
+ const handleWrap = (syntax) => applyEdit((text, start, end) => ({
3391
+ value: applyWrap(text, start, end, syntax),
3392
+ cursor: [start + syntax.length, end + syntax.length]
3393
+ }));
3394
+ const handlePrefix = (prefix) => applyEdit((text, start) => ({
3395
+ value: applyLinePrefix(text, start, prefix),
3396
+ cursor: [start + prefix.length, start + prefix.length]
3397
+ }));
3398
+ const handleLink = () => applyEdit((text, start, end) => ({
3399
+ value: text.slice(0, start) + `[${text.slice(start, end)}]()` + text.slice(end),
3400
+ cursor: [end + 3, end + 3]
3401
+ // cursor inside the ()
3402
+ }));
3403
+ const navigate = (delta) => {
3404
+ const newIndex = history.index + delta;
3405
+ if (newIndex < 0 || newIndex >= history.entries.length) return;
3406
+ const entry = history.entries[newIndex];
3407
+ if (entry === void 0) return;
3408
+ setHistory((prev) => ({ ...prev, index: newIndex }));
3409
+ onChange?.(entry);
3410
+ };
3411
+ const handleKeyDown = (e) => {
3412
+ if (!e.ctrlKey && !e.metaKey) return;
3413
+ const key = `${e.shiftKey ? "shift+" : ""}${e.key.toLowerCase()}`;
3414
+ const actions = {
3415
+ z: () => navigate(-1),
3416
+ "shift+z": () => navigate(1),
3417
+ y: () => navigate(1),
3418
+ b: () => handleWrap("**"),
3419
+ i: () => handleWrap("*"),
3420
+ k: handleLink,
3421
+ "`": () => handleWrap("`"),
3422
+ "shift+x": () => handleWrap("~~")
3423
+ };
3424
+ const action = actions[key];
3425
+ if (action) {
3426
+ e.preventDefault();
3427
+ action();
3428
+ }
3429
+ };
3430
+ const toolbarButtons = [
3431
+ { icon: IconBold, label: "Bold", onClick: () => handleWrap("**") },
3432
+ { icon: IconItalic, label: "Italic", onClick: () => handleWrap("*") },
3433
+ { icon: IconStrikethrough, label: "Strikethrough", onClick: () => handleWrap("~~") },
3434
+ { icon: IconCode, label: "Code", onClick: () => handleWrap("`") },
3435
+ { icon: IconH1, label: "Heading", onClick: () => handlePrefix("# ") },
3436
+ { icon: IconList, label: "Bullet list", onClick: () => handlePrefix("- ") },
3437
+ { icon: IconLink, label: "Link", onClick: handleLink }
3438
+ ];
3439
+ return /* @__PURE__ */ jsxs25("div", { className: styles34.container, children: [
3440
+ /* @__PURE__ */ jsxs25("div", { className: styles34.toolbar, children: [
3441
+ toolbarButtons.map(({ icon, label, onClick }) => /* @__PURE__ */ jsx44(
3442
+ GhostButtonIcon,
3443
+ {
3444
+ icon,
3445
+ "aria-label": label,
3446
+ disabled: isPreview,
3447
+ onMouseDown: (e) => e.preventDefault(),
3448
+ onClick
3449
+ },
3450
+ label
3451
+ )),
3452
+ /* @__PURE__ */ jsx44("div", { className: styles34.toolbarSpacer }),
3453
+ /* @__PURE__ */ jsx44(
3454
+ GhostButtonIcon,
3455
+ {
3456
+ icon: isPreview ? IconPencil : IconEye,
3457
+ "aria-label": isPreview ? "Edit" : "Preview",
3458
+ onMouseDown: (e) => e.preventDefault(),
3459
+ onClick: () => setIsPreview((prev) => !prev)
3460
+ }
3461
+ )
3462
+ ] }),
3463
+ isPreview ? /* @__PURE__ */ jsx44("div", { className: styles34.preview, children: /* @__PURE__ */ jsx44(Markdown, { content: value }) }) : /* @__PURE__ */ jsx44(
3464
+ "textarea",
3465
+ {
3466
+ ref: textareaRef,
3467
+ className: styles34.markdownEditor,
3468
+ value,
3469
+ onChange: (e) => handleChange(e.target.value),
3470
+ onKeyDown: handleKeyDown,
3471
+ placeholder
3472
+ }
3473
+ )
3474
+ ] });
3475
+ };
3476
+
3309
3477
  // src/utils/object.utils.ts
3310
3478
  var shallowEqual = (object1, object2) => {
3311
3479
  const keys1 = Object.keys(object1 ?? {});
@@ -3337,9 +3505,12 @@ export {
3337
3505
  FieldFeedback,
3338
3506
  FieldHeader,
3339
3507
  GhostButton,
3508
+ GhostButtonIcon,
3340
3509
  HeatMap,
3341
3510
  KpiChart,
3342
3511
  LineChart,
3512
+ Markdown,
3513
+ MarkdownEditor,
3343
3514
  MultiSelectField,
3344
3515
  NumberField,
3345
3516
  Overlay,
@@ -3365,6 +3536,7 @@ export {
3365
3536
  Tooltip5 as Tooltip,
3366
3537
  Typography,
3367
3538
  chartjsAxisOptionsLayoutPadding,
3539
+ chartjsAxisOptionsLayoutPaddingLarge,
3368
3540
  endOfDayUTC,
3369
3541
  getBarChartData,
3370
3542
  getBarChartOptions,