@luscii-healthtech/web-ui 48.1.3 → 48.1.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.
@@ -5,8 +5,7 @@ var classNames = require('classnames');
5
5
  var sonner = require('sonner');
6
6
  var DOMPurify = require('dompurify');
7
7
  var React = require('react');
8
- var isString = require('lodash/isString');
9
- var omit = require('lodash/omit');
8
+ var lodashEs = require('lodash-es');
10
9
  var core = require('@dnd-kit/core');
11
10
  var sortable = require('@dnd-kit/sortable');
12
11
  var tailwindMerge = require('tailwind-merge');
@@ -14,8 +13,6 @@ var reactLazyLoadImageComponent = require('react-lazy-load-image-component');
14
13
  var utilities = require('@dnd-kit/utilities');
15
14
  var Tooltip$1 = require('@radix-ui/react-tooltip');
16
15
  var ReactModal = require('react-modal');
17
- var debounce = require('lodash/debounce');
18
- var isNil = require('lodash/isNil');
19
16
  var ReactDatePicker = require('react-datepicker');
20
17
  var enGB = require('date-fns/locale/en-GB');
21
18
  var nl = require('date-fns/locale/nl');
@@ -27,14 +24,11 @@ var PropTypes = require('prop-types');
27
24
  var FlyOutMenuPrimitive = require('@radix-ui/react-dropdown-menu');
28
25
  var RadixHC = require('@radix-ui/react-hover-card');
29
26
  var TabsPrimitive = require('@radix-ui/react-tabs');
30
- var groupBy = require('lodash/groupBy');
31
27
  var ReactSelect = require('react-select');
32
28
  var RadixSwitch = require('@radix-ui/react-switch');
33
29
  var Quill = require('quill');
34
30
  require('quill-paste-smart');
35
31
  var solid = require('@heroicons/react/20/solid');
36
- var isFunction = require('lodash/isFunction');
37
- var isObjectLike = require('lodash/isObjectLike');
38
32
  var react = require('@headlessui/react');
39
33
  var ToggleGroup = require('@radix-ui/react-toggle-group');
40
34
 
@@ -61,23 +55,16 @@ function _interopNamespace(e) {
61
55
  var classNames__default = /*#__PURE__*/_interopDefault(classNames);
62
56
  var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
63
57
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
64
- var isString__default = /*#__PURE__*/_interopDefault(isString);
65
- var omit__default = /*#__PURE__*/_interopDefault(omit);
66
58
  var Tooltip__namespace = /*#__PURE__*/_interopNamespace(Tooltip$1);
67
59
  var ReactModal__default = /*#__PURE__*/_interopDefault(ReactModal);
68
- var debounce__default = /*#__PURE__*/_interopDefault(debounce);
69
- var isNil__default = /*#__PURE__*/_interopDefault(isNil);
70
60
  var ReactDatePicker__default = /*#__PURE__*/_interopDefault(ReactDatePicker);
71
61
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
72
62
  var FlyOutMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(FlyOutMenuPrimitive);
73
63
  var RadixHC__namespace = /*#__PURE__*/_interopNamespace(RadixHC);
74
64
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
75
- var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
76
65
  var ReactSelect__default = /*#__PURE__*/_interopDefault(ReactSelect);
77
66
  var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
78
67
  var Quill__default = /*#__PURE__*/_interopDefault(Quill);
79
- var isFunction__default = /*#__PURE__*/_interopDefault(isFunction);
80
- var isObjectLike__default = /*#__PURE__*/_interopDefault(isObjectLike);
81
68
  var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
82
69
 
83
70
  const SIZES = {
@@ -1063,7 +1050,7 @@ const AccordionItem = ({ id, title, content, isCollapsedByDefault = false, onClo
1063
1050
  const Chevron = isCollapsed ? ChevronRightIcon : ChevronDownIcon;
1064
1051
  return jsxRuntime.jsxs("li", { className: "ui:border-b ui:border-slate-200 ui:bg-white ui:last:border-b-0", "data-test-id": id, children: [jsxRuntime.jsxs("div", { onClick: toggleCollapsed, className: classNames__default.default("ui:flex ui:w-full ui:select-none ui:flex-row ui:space-x-4 ui:p-4", "ui:cursor-pointer ui:transition-colors ui:duration-300 ui:ease-in-out ui:hover:bg-blue-50", {
1065
1052
  "ui:border-b ui:border-slate-200": !isCollapsed
1066
- }), children: [jsxRuntime.jsx(Chevron, { className: "ui:shrink-0 ui:self-center ui:text-slate-500" }), isString__default.default(title) ? jsxRuntime.jsx(Title, { variant: "xs", children: title }) : title] }), jsxRuntime.jsx("div", { className: classNames__default.default({ "ui:hidden": isCollapsed }), children: content })] });
1053
+ }), children: [jsxRuntime.jsx(Chevron, { className: "ui:shrink-0 ui:self-center ui:text-slate-500" }), lodashEs.isString(title) ? jsxRuntime.jsx(Title, { variant: "xs", children: title }) : title] }), jsxRuntime.jsx("div", { className: classNames__default.default({ "ui:hidden": isCollapsed }), children: content })] });
1067
1054
  };
1068
1055
 
1069
1056
  const Accordion = ({ dataTestId, isCollapsedByDefault = false, items, className, footer }) => {
@@ -1260,7 +1247,7 @@ const Box = (props) => {
1260
1247
  const borderRadiusClassName = createRadiusClassName(borderRadius);
1261
1248
  const borderRadiusLeftClassName = createRadiusLeftClassName(borderRadiusLeft);
1262
1249
  const borderRadiusRightClassName = createRadiusRightClassName(borderRadiusRight);
1263
- const attributesWithoutSpacingKeys = omit__default.default(attributes, [
1250
+ const attributesWithoutSpacingKeys = lodashEs.omit(attributes, [
1264
1251
  ...spacingKeys,
1265
1252
  ...underscoredSpacingPropNames
1266
1253
  ]);
@@ -1676,11 +1663,11 @@ const List = (props) => {
1676
1663
  if ("draggableListType" in props) {
1677
1664
  switch (props.draggableListType) {
1678
1665
  case "default":
1679
- return jsxRuntime.jsx(DefaultList, Object.assign({}, omit__default.default(props, "draggableListType")));
1666
+ return jsxRuntime.jsx(DefaultList, Object.assign({}, lodashEs.omit(props, "draggableListType")));
1680
1667
  case "draggable":
1681
- return jsxRuntime.jsx(DraggableBaseList, Object.assign({}, omit__default.default(props, ["draggableListType"])));
1668
+ return jsxRuntime.jsx(DraggableBaseList, Object.assign({}, lodashEs.omit(props, ["draggableListType"])));
1682
1669
  case "sortable":
1683
- return jsxRuntime.jsx(SortableBaseList, Object.assign({}, omit__default.default(props, ["draggableListType"])));
1670
+ return jsxRuntime.jsx(SortableBaseList, Object.assign({}, lodashEs.omit(props, ["draggableListType"])));
1684
1671
  }
1685
1672
  }
1686
1673
  return jsxRuntime.jsx(DefaultList, Object.assign({}, props));
@@ -2391,7 +2378,7 @@ const Carousel = ({ id, className, slides = [], labels }) => {
2391
2378
  }
2392
2379
  scrollToIndex(nextIndex);
2393
2380
  }, [scrollToIndex, slides, currentIndex]);
2394
- const setCurrentIndexDebounced = React.useCallback(debounce__default.default((index) => {
2381
+ const setCurrentIndexDebounced = React.useCallback(lodashEs.debounce((index) => {
2395
2382
  setCurrentIndex(index);
2396
2383
  }, 300), [setCurrentIndex]);
2397
2384
  const onScroll = React.useCallback((e) => {
@@ -2652,7 +2639,7 @@ function RadioGroupInner(_a) {
2652
2639
  var { innerRef, options, defaultValue, title } = _a, registerProps = __rest(_a, ["innerRef", "options", "defaultValue", "title"]);
2653
2640
  return jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-col ui:space-y-2"), "data-test-id": `${registerProps.name}-radio-group`, children: [title && jsxRuntime.jsx(Text, { text: title }), options.map((option) => {
2654
2641
  let defaultChecked;
2655
- if (!isNil__default.default(defaultValue)) {
2642
+ if (!lodashEs.isNil(defaultValue)) {
2656
2643
  defaultChecked = defaultValue === option.value;
2657
2644
  }
2658
2645
  return jsxRuntime.jsx(RadioV2, Object.assign({ defaultChecked }, option, registerProps, { ref: innerRef }), option.value);
@@ -4142,7 +4129,7 @@ const HorizontalFlowDivider = (props) => {
4142
4129
  const transformToGroups = (items) => {
4143
4130
  const pinned = items.find((option) => option.isPinned);
4144
4131
  const itemsWithGroup = items.filter((option) => option.group);
4145
- const groups = Object.entries(groupBy__default.default(itemsWithGroup, "group")).map((group) => ({
4132
+ const groups = Object.entries(lodashEs.groupBy(itemsWithGroup, "group")).map((group) => ({
4146
4133
  title: group[0],
4147
4134
  items: group[1].sort((a, b) => a.label > b.label ? 1 : b.label > a.label ? -1 : 0)
4148
4135
  }));
@@ -4523,7 +4510,7 @@ const useWindowDimensions = () => {
4523
4510
  const [height, setHeight] = React.useState(window.innerHeight);
4524
4511
  const [width, setWidth] = React.useState(window.innerWidth);
4525
4512
  React.useEffect(() => {
4526
- const handleResize = debounce__default.default(() => {
4513
+ const handleResize = lodashEs.debounce(() => {
4527
4514
  if (height !== window.innerHeight) {
4528
4515
  setHeight(window.innerHeight);
4529
4516
  }
@@ -4914,7 +4901,7 @@ const useOnCloseAnimationFinished = ({
4914
4901
  */
4915
4902
  onCloseAnimationFinished
4916
4903
  }) => {
4917
- const debouncedOnCloseAnimationFinished = React.useCallback(debounce__default.default(onCloseAnimationFinished, 150), [onCloseAnimationFinished]);
4904
+ const debouncedOnCloseAnimationFinished = React.useCallback(lodashEs.debounce(onCloseAnimationFinished, 150), [onCloseAnimationFinished]);
4918
4905
  const onTransitionEnd = React.useCallback((event) => {
4919
4906
  if (event.target !== dialog.current) {
4920
4907
  return;
@@ -5371,6 +5358,10 @@ const TextEditorToolbar = ({ toolbarId, toolbar, hasTextSelected }) => {
5371
5358
  var css_248z$1 = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FILE IN FUTURE CHANGES. WE SHOULD BE\n * USING TAILWIND CLASSES DIRECTLY IN OUR COMPONENTS.\n */\n.ql-editor {\n resize: vertical;\n min-height: 10rem;\n padding: 1rem;\n font-size: 0.8rem;\n line-height: 1.5;\n}\n.ql-editor a {\n color: var(--ui-color-text-brand-primary-default);\n text-decoration: underline;\n cursor: pointer;\n}\n.ql-editor ul,\n.ql-editor ol {\n padding-left: 1.5rem;\n}\n.ql-editor ul {\n list-style-type: disc;\n}\n.ql-editor ol {\n list-style-type: decimal;\n}\n.ql-editor li {\n margin-bottom: 0.25rem;\n}\n.ql-editor strong {\n font-weight: 600;\n}\n.ql-editor em {\n font-style: italic;\n}\n.ql-editor u {\n text-decoration: underline;\n}\n.ql-editor s {\n text-decoration: line-through;\n}\n.ql-editor h1,\n.ql-editor h2,\n.ql-editor h3,\n.ql-editor h4,\n.ql-editor h5,\n.ql-editor h6 {\n font-weight: 600;\n margin-bottom: 0.75rem;\n margin-top: 1rem;\n}\n.ql-editor h1:first-child,\n.ql-editor h2:first-child,\n.ql-editor h3:first-child,\n.ql-editor h4:first-child,\n.ql-editor h5:first-child,\n.ql-editor h6:first-child {\n margin-top: 0;\n}\n.ql-editor h1 {\n font-size: 2rem;\n}\n.ql-editor h2 {\n font-size: 1.5rem;\n}\n.ql-editor h3 {\n font-size: 1.25rem;\n}\n.ql-editor h4 {\n font-size: 1.125rem;\n}\n.ql-editor h5,\n.ql-editor h6 {\n font-size: 1rem;\n}";
5372
5359
  styleInject(css_248z$1);
5373
5360
 
5361
+ const sanitize = (html) => DOMPurify__default.default.sanitize(html, {
5362
+ ALLOWED_TAGS: ["u", "a", "s", "ul", "ol", "li", "p", "strong", "em"],
5363
+ ALLOWED_ATTR: ["href", "target"]
5364
+ });
5374
5365
  const TextEditor = (_a) => {
5375
5366
  var { defaultValue, formats, toolbar = [
5376
5367
  ["bold", "italic", "underline", "strike"],
@@ -5379,7 +5370,7 @@ const TextEditor = (_a) => {
5379
5370
  ], placeholder, onValueChange } = _a, attrs = __rest(_a, ["defaultValue", "formats", "toolbar", "placeholder", "onValueChange"]);
5380
5371
  const rawId = React.useId();
5381
5372
  const toolbarId = `toolbar-${rawId.replace(/:/g, "")}`;
5382
- const defaultValueRef = React.useRef(defaultValue);
5373
+ const defaultValueRef = React.useRef(sanitize(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""));
5383
5374
  const onTextChangeRef = React.useRef(onValueChange);
5384
5375
  const editorRef = React.useRef(null);
5385
5376
  const quillRef = React.useRef(null);
@@ -5402,7 +5393,7 @@ const TextEditor = (_a) => {
5402
5393
  });
5403
5394
  quill.on(Quill__default.default.events.TEXT_CHANGE, (value, _, source) => {
5404
5395
  var _a2;
5405
- (_a2 = onTextChangeRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(onTextChangeRef, quill.getSemanticHTML(), value, source);
5396
+ (_a2 = onTextChangeRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(onTextChangeRef, sanitize(quill.getSemanticHTML()), value, source);
5406
5397
  });
5407
5398
  const handleSelectionChange = () => {
5408
5399
  const selection = quill.getSelection();
@@ -5851,10 +5842,10 @@ const FilterMenu = (props) => {
5851
5842
  };
5852
5843
 
5853
5844
  const isSortingOption = (option) => {
5854
- if (!option || !isObjectLike__default.default(option) || typeof option !== "object") {
5845
+ if (!option || !lodashEs.isObjectLike(option) || typeof option !== "object") {
5855
5846
  return false;
5856
5847
  }
5857
- return "isChecked" in option && "label" in option && "id" in option && "value" in option && "sortingCompare" in option && isFunction__default.default(option.sortingCompare);
5848
+ return "isChecked" in option && "label" in option && "id" in option && "value" in option && "sortingCompare" in option && lodashEs.isFunction(option.sortingCompare);
5858
5849
  };
5859
5850
  const SortMenu = (props) => {
5860
5851
  const { localization, sortingOptions, onSortOptionChange } = props;
@@ -5879,14 +5870,14 @@ const FiltersMenus = (props) => {
5879
5870
  };
5880
5871
 
5881
5872
  const isPresetFilterOption = (option) => {
5882
- if (!option || !isObjectLike__default.default(option) || typeof option !== "object") {
5873
+ if (!option || !lodashEs.isObjectLike(option) || typeof option !== "object") {
5883
5874
  return false;
5884
5875
  }
5885
5876
  const hasBasicShape = "isChecked" in option && "label" in option && "value" in option && "id" in option;
5886
5877
  if (!hasBasicShape) {
5887
5878
  return false;
5888
5879
  }
5889
- return "filterFn" in option ? isFunction__default.default(option.filterFn) : true;
5880
+ return "filterFn" in option ? lodashEs.isFunction(option.filterFn) : true;
5890
5881
  };
5891
5882
  const PresetFiltersMenu = (props) => {
5892
5883
  const { localization, presetFilterOptions, onPresetFilterOptionChange } = props;