@luscii-healthtech/web-ui 0.2.0 → 0.3.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.
@@ -190,18 +190,6 @@
190
190
  .cweb-checkbox.type-switch.is-checked .cweb-checkbox-icon-container:after {
191
191
  left: 32px; }
192
192
 
193
- .vitals-confirmation-dialog {
194
- margin-top: 4rem !important; }
195
- .vitals-confirmation-dialog .vitals-confirmation-dialog-content {
196
- padding: 24px; }
197
- .vitals-confirmation-dialog .vitals-confirmation-dialog-content .vitals-confirmation-dialog-action-container {
198
- display: flex;
199
- justify-content: space-between;
200
- flex-direction: row;
201
- align-items: center;
202
- width: 100%;
203
- margin-top: 16px; }
204
-
205
193
  .cweb-box-shadow-default {
206
194
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24), 0 0 2px 0 rgba(0, 0, 0, 0.12); }
207
195
  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
@@ -444,6 +432,18 @@
444
432
  .cweb-datepicker-calendar .react-datepicker__day.react-datepicker__day--outside-month {
445
433
  color: #cccccc; }
446
434
 
435
+ .vitals-confirmation-dialog {
436
+ margin-top: 4rem !important; }
437
+ .vitals-confirmation-dialog .vitals-confirmation-dialog-content {
438
+ padding: 24px; }
439
+ .vitals-confirmation-dialog .vitals-confirmation-dialog-content .vitals-confirmation-dialog-action-container {
440
+ display: flex;
441
+ justify-content: space-between;
442
+ flex-direction: row;
443
+ align-items: center;
444
+ width: 100%;
445
+ margin-top: 16px; }
446
+
447
447
  .cweb-box-shadow-default {
448
448
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24), 0 0 2px 0 rgba(0, 0, 0, 0.12); }
449
449
  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
@@ -19,6 +19,33 @@ import htmlToDraft from 'html-to-draftjs';
19
19
  import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
20
20
 
21
21
  var Text = function Text(props) {
22
+ /**
23
+ * One might argue that we're duplicating strings in this file.
24
+ * That's how tailwind expects to detect used classes, so please do not make
25
+ * anything dynamic or try to string concat class names.
26
+ * https://v1.tailwindcss.com/docs/controlling-file-size
27
+ */
28
+ var allowedColors = {
29
+ base: "text-slate-700",
30
+ "slate-500": "text-slate-500",
31
+ "slate-200": "text-slate-200",
32
+ red: "text-red-700",
33
+ green: "text-green-700",
34
+ amber: "text-yellow-700",
35
+ white: "text-white",
36
+ "blue-800": "text-blue-800"
37
+ };
38
+ var allowedHoverColors = {
39
+ "blue-900": "hover:text-blue-900",
40
+ white: "hover:text-white"
41
+ }; // What is a group hover? https://v1.tailwindcss.com/docs/pseudo-class-variants#group-hover
42
+
43
+ var allowedGroupHoverColors = {
44
+ "blue-900": "group-hover:text-blue-900",
45
+ white: "group-hover:text-white"
46
+ };
47
+ var selectedHoverColor = props.hoverColor && !props.hoverInGroup && allowedHoverColors[props.hoverColor];
48
+ var selectedGroupHoverColor = props.hoverColor && props.hoverInGroup && allowedGroupHoverColors[props.hoverColor];
22
49
  var containerProps = {
23
50
  "data-test-id": props["data-test-id"],
24
51
  className: classNames( // apply different style classes
@@ -37,17 +64,7 @@ var Text = function Text(props) {
37
64
  inline: props.inline,
38
65
  // FIXME: this class doesn't do anything without a max-width
39
66
  truncate: props.truncate
40
- }, {
41
- "text-slate-700": props.color === "base",
42
- "text-slate-500": props.color === "gray-500",
43
- "text-slate-200": props.color === "gray-200",
44
- "text-red-700": props.color === "red",
45
- "text-green-700": props.color === "green",
46
- "text-yellow-700": props.color === "amber",
47
- "text-blue-700": props.color === "blue",
48
- "text-white": props.color === "white",
49
- "text-primary-dark": props.color === "blue"
50
- }, {
67
+ }, allowedColors[props.color || "base"], selectedHoverColor, selectedGroupHoverColor, {
51
68
  "in-html-link": props.containsDangerousHtml
52
69
  }, //can be used to overwrite other classes like the color
53
70
  props.className)
@@ -314,9 +331,8 @@ var ButtonV2 = function ButtonV2(_ref) {
314
331
 
315
332
  var buttonClassName = classNames(["h-11", "relative flex flex-row justify-center items-center", "border", "transition-outline transition-colors duration-300 ease-in-out", "rounded-full", "leading-none", "shadow-sm", "cursor-pointer", "focus:outline-primary"], {
316
333
  "w-11": !text && icon,
317
- "px-4": text,
318
- "py-2.5": text && icon,
319
- "py-3": text && !icon
334
+ "pl-4 pr-6": text && icon,
335
+ "px-4": text && !icon
320
336
  }, {
321
337
  "opacity-50": isDisabled,
322
338
  "pointer-events-none": isDisabled || isPending
@@ -949,13 +965,13 @@ var Checkbox = function Checkbox(_ref) {
949
965
  })), /*#__PURE__*/React__default.createElement("div", {
950
966
  className: "flex flex-col"
951
967
  }, text && /*#__PURE__*/React__default.createElement(Text, {
952
- className: "ml-2 select-none text-left",
968
+ className: "ml-2 text-left select-none",
953
969
  text: text,
954
970
  "data-test-id": "checkbox-text"
955
971
  }), explanation && /*#__PURE__*/React__default.createElement(Text, {
956
- className: "ml-2 select-none text-left",
972
+ className: "ml-2 text-left select-none",
957
973
  text: explanation,
958
- color: "gray-500",
974
+ color: "slate-500",
959
975
  "data-test-id": "checkbox-explanation"
960
976
  }))));
961
977
  };
@@ -1430,7 +1446,7 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
1430
1446
  "data-test-id": item.text,
1431
1447
  text: item.title,
1432
1448
  type: "sm",
1433
- color: "gray-500",
1449
+ color: "slate-500",
1434
1450
  truncate: true
1435
1451
  })), item.subItems.map(function (subItem) {
1436
1452
  return _this.renderIndividualItem(subItem);
@@ -1699,7 +1715,7 @@ var InfoField = function InfoField(props) {
1699
1715
  }, containerProps), /*#__PURE__*/React__default.createElement(Text, {
1700
1716
  text: props.label,
1701
1717
  type: "sm",
1702
- color: "gray-500",
1718
+ color: "slate-500",
1703
1719
  className: classNames({
1704
1720
  "break-words": props.supportsMultiline
1705
1721
  }, {
@@ -1905,7 +1921,7 @@ var PaginationMenuSmall = function PaginationMenuSmall(props) {
1905
1921
  className: "ml-4",
1906
1922
  text: props.currentPageNumber + " / " + props.pageCount,
1907
1923
  type: "sm",
1908
- color: "gray-500"
1924
+ color: "slate-500"
1909
1925
  }), /*#__PURE__*/React__default.createElement(TertiaryButton, {
1910
1926
  className: "ml-4",
1911
1927
  "data-test-id": "next-button",
@@ -2113,7 +2129,7 @@ var PaginationMenuLarge = function PaginationMenuLarge(props) {
2113
2129
  className: "ml-4 flex flex-row items-center"
2114
2130
  }, /*#__PURE__*/React__default.createElement(Text, {
2115
2131
  text: getSummaryText(props.pageCount, props.currentPageNumber, props.localization, props.pageSize, props.resultCount),
2116
- color: "gray-500"
2132
+ color: "slate-500"
2117
2133
  }), /*#__PURE__*/React__default.createElement(SecondaryButton, {
2118
2134
  "data-test-id": "prev-button",
2119
2135
  text: props.localization.previous,
@@ -2217,7 +2233,7 @@ function ListTableCell(_ref) {
2217
2233
  text: emptyValue
2218
2234
  }, textProps, {
2219
2235
  className: textClassName,
2220
- color: "gray-500"
2236
+ color: "slate-500"
2221
2237
  })), hasValue && isString(value) && /*#__PURE__*/React__default.createElement(Text, Object.assign({
2222
2238
  text: value
2223
2239
  }, textProps, {
@@ -2294,7 +2310,7 @@ function ListTableHeader(_ref) {
2294
2310
  })));
2295
2311
  }
2296
2312
 
2297
- var _excluded$9 = ["items", "configuration", "pageCount", "currentPage", "onPaginationChange", "onRowClick", "isLoading", "showHeader", "className", "localization"];
2313
+ var _excluded$9 = ["items", "configuration", "pageCount", "currentPage", "onPaginationChange", "pageSize", "localization", "resultCount", "onRowClick", "isLoading", "showHeader", "className"];
2298
2314
  function ListTable(_ref) {
2299
2315
  var _ref$items = _ref.items,
2300
2316
  items = _ref$items === void 0 ? [] : _ref$items,
@@ -2304,13 +2320,15 @@ function ListTable(_ref) {
2304
2320
  _ref$currentPage = _ref.currentPage,
2305
2321
  currentPage = _ref$currentPage === void 0 ? 1 : _ref$currentPage,
2306
2322
  onPaginationChange = _ref.onPaginationChange,
2323
+ pageSize = _ref.pageSize,
2324
+ localization = _ref.localization,
2325
+ resultCount = _ref.resultCount,
2307
2326
  onRowClick = _ref.onRowClick,
2308
2327
  _ref$isLoading = _ref.isLoading,
2309
2328
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
2310
2329
  _ref$showHeader = _ref.showHeader,
2311
2330
  showHeader = _ref$showHeader === void 0 ? true : _ref$showHeader,
2312
2331
  className = _ref.className,
2313
- localization = _ref.localization,
2314
2332
  restProps = _objectWithoutPropertiesLoose(_ref, _excluded$9);
2315
2333
 
2316
2334
  // For not displaying empty view at creation
@@ -2349,17 +2367,20 @@ function ListTable(_ref) {
2349
2367
  src: SearchNotFoundImage,
2350
2368
  alt: "no-image-found"
2351
2369
  }), /*#__PURE__*/React__default.createElement(Text, {
2352
- className: classNames("no-item-found-text", "w-56 text-base text-gray-600 text-center whitespace-pre-wrap"),
2370
+ className: classNames("no-item-found-text", "w-56 text-base text-center whitespace-pre-wrap"),
2371
+ color: "slate-500",
2353
2372
  text: configuration.emptyListText
2354
2373
  }))))), !showEmptyView && pageCount > 0 && onPaginationChange && /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
2355
2374
  colSpan: configuration.fields.length
2356
2375
  }, /*#__PURE__*/React__default.createElement("div", {
2357
2376
  className: classNames("cweb-list-table-footer", "flex justify-center flex-row items-center", "h-20 py-4 px-4")
2358
2377
  }, /*#__PURE__*/React__default.createElement(PaginationMenu, {
2359
- onChange: onPaginationChange,
2360
2378
  pageCount: pageCount,
2361
2379
  currentPageNumber: currentPage,
2362
- localization: localization
2380
+ onChange: onPaginationChange,
2381
+ pageSize: pageSize,
2382
+ localization: localization,
2383
+ resultCount: resultCount
2363
2384
  })))))));
2364
2385
  }
2365
2386
 
@@ -2680,11 +2701,7 @@ var NavMenuItem = function NavMenuItem(props) {
2680
2701
  currentImg = _useState[0],
2681
2702
  setCurrentImg = _useState[1];
2682
2703
 
2683
- var _useState2 = useState(props.isSelected ? "white" : "gray-200"),
2684
- textColor = _useState2[0],
2685
- setTextColor = _useState2[1];
2686
-
2687
- var classes = classNames(["flex", "flex-row", "items-center", "w-auto", "rounded", "px-2", "py-1", "my-2", "mx-2", "hover:bg-gray-600", "transition", "ease-in", "duration-150", "lg:last:pb-2", "focus:outline-primary"], {
2704
+ var classes = classNames(["flex", "flex-row", "items-center", "w-auto", "rounded", "px-2", "py-1", "my-2", "mx-2", "hover:bg-gray-600", "transition", "ease-in", "duration-150", "lg:last:pb-2", "focus:outline-primary", "group"], {
2688
2705
  "bg-nav-menu": !props.isSelected,
2689
2706
  "bg-gray-600": props.isSelected
2690
2707
  });
@@ -2692,14 +2709,12 @@ var NavMenuItem = function NavMenuItem(props) {
2692
2709
  var handleOnMouseOver = function handleOnMouseOver() {
2693
2710
  if (!props.isSelected) {
2694
2711
  setCurrentImg(props.imgOnHover);
2695
- setTextColor("white");
2696
2712
  }
2697
2713
  };
2698
2714
 
2699
2715
  var handleOnMouseOut = function handleOnMouseOut() {
2700
2716
  if (!props.isSelected) {
2701
2717
  setCurrentImg(props.img);
2702
- setTextColor("gray-200");
2703
2718
  }
2704
2719
  };
2705
2720
 
@@ -2716,7 +2731,9 @@ var NavMenuItem = function NavMenuItem(props) {
2716
2731
  }), /*#__PURE__*/createElement(Text, {
2717
2732
  type: "strong",
2718
2733
  text: props.title,
2719
- color: textColor
2734
+ hoverInGroup: true,
2735
+ color: "slate-200",
2736
+ hoverColor: "white"
2720
2737
  }));
2721
2738
 
2722
2739
  function handleMenuClick(event) {
@@ -2809,18 +2826,26 @@ var TextLink = function TextLink(props) {
2809
2826
 
2810
2827
  var NotificationBanner = function NotificationBanner(props) {
2811
2828
  var classes = classNames("w-full px-6 py-2 flex flex-row items-center border border-solid rounded", props.className, {
2812
- "bg-slate-100 border-slate-700": props.color === "base",
2813
- "bg-blue-100 border-blue-700": props.color === "blue",
2814
- "bg-red-100 border-red-700": props.color === "red",
2815
- "bg-green-100 border-green-700": props.color === "green",
2816
- "bg-yellow-100 border-yellow-700": props.color === "amber"
2829
+ "bg-slate-50 border-slate-700": props.color === "base",
2830
+ "bg-blue-50 border-blue-700": props.color === "blue",
2831
+ "bg-red-50 border-red-700": props.color === "red",
2832
+ "bg-green-50 border-green-700": props.color === "green",
2833
+ "bg-yellow-50 border-yellow-700": props.color === "amber"
2817
2834
  });
2835
+ var textColor = {
2836
+ red: "red",
2837
+ amber: "amber",
2838
+ green: "green",
2839
+ base: "base",
2840
+ // Blue must be 800 here to pass the contrast test
2841
+ blue: "blue-800"
2842
+ };
2818
2843
  return /*#__PURE__*/React__default.createElement("div", {
2819
2844
  className: classes
2820
2845
  }, props.icon, /*#__PURE__*/React__default.createElement(Text, {
2821
- className: "first:ml-0 ml-4",
2846
+ className: "ml-4 first:ml-0",
2822
2847
  text: props.text,
2823
- color: props.color
2848
+ color: props.color ? textColor[props.color] : "base"
2824
2849
  }), props.linkProps && /*#__PURE__*/React__default.createElement(TextLink, {
2825
2850
  className: "ml-4",
2826
2851
  text: props.linkProps.text,
@@ -2987,7 +3012,7 @@ var Step = function Step(_ref) {
2987
3012
  }), /*#__PURE__*/React__default.createElement(Text, {
2988
3013
  text: localization.step + " " + stepNumber,
2989
3014
  type: "strong",
2990
- color: active ? "blue" : "gray-500"
3015
+ color: active ? "blue-800" : "slate-500"
2991
3016
  }), /*#__PURE__*/React__default.createElement(Text, {
2992
3017
  text: title,
2993
3018
  type: "strong"
@@ -3779,24 +3804,26 @@ var TagColorTheme;
3779
3804
  })(TagColorTheme || (TagColorTheme = {}));
3780
3805
 
3781
3806
  var Tag = function Tag(_ref) {
3807
+ var _textColor;
3808
+
3782
3809
  var text = _ref.text,
3783
3810
  _ref$colorTheme = _ref.colorTheme,
3784
3811
  colorTheme = _ref$colorTheme === void 0 ? TagColorTheme.Gray : _ref$colorTheme,
3785
3812
  className = _ref.className,
3786
3813
  _ref$size = _ref.size,
3787
3814
  size = _ref$size === void 0 ? TagSize.base : _ref$size;
3788
- var containerClassName = classNames("inline py-1 px-2 rounded-lg", className, {
3789
- "bg-red-100 text-red-700": colorTheme === TagColorTheme.Red,
3790
- "bg-orange-100 text-amber-700": colorTheme === TagColorTheme.Amber,
3791
- "bg-green-100 text-green-800": colorTheme === TagColorTheme.Green,
3792
- "bg-slate-100 text-slate-600": colorTheme === TagColorTheme.Gray,
3793
- "bg-blue-50 text-blue-800": colorTheme === TagColorTheme.Blue
3794
- });
3815
+ var textColor = (_textColor = {}, _textColor[TagColorTheme.Red] = "red", _textColor[TagColorTheme.Amber] = "amber", _textColor[TagColorTheme.Green] = "green", _textColor[TagColorTheme.Gray] = "base", _textColor[TagColorTheme.Blue] = "blue-800", _textColor);
3795
3816
  return /*#__PURE__*/React__default.createElement("div", {
3796
- className: containerClassName
3817
+ className: classNames("inline py-1 px-2 rounded-lg", className, {
3818
+ "bg-red-50": colorTheme === TagColorTheme.Red,
3819
+ "bg-orange-50": colorTheme === TagColorTheme.Amber,
3820
+ "bg-green-50": colorTheme === TagColorTheme.Green,
3821
+ "bg-slate-50": colorTheme === TagColorTheme.Gray,
3822
+ "bg-blue-50": colorTheme === TagColorTheme.Blue
3823
+ })
3797
3824
  }, /*#__PURE__*/React__default.createElement(Text, {
3798
3825
  inline: true,
3799
- color: "inherit",
3826
+ color: textColor[colorTheme],
3800
3827
  text: text,
3801
3828
  type: size === TagSize.small ? "sm" : "base"
3802
3829
  }));
@@ -4048,7 +4075,7 @@ function ViewItem(_ref) {
4048
4075
  className: "vitals-view-item-title-line flex justify-start flex-row items-start"
4049
4076
  }, titlePropsMerged && /*#__PURE__*/React__default.createElement(Text, Object.assign({
4050
4077
  className: classNames(titlePropsMerged.className, "vitals-view-item-title mb-1 mr-2"),
4051
- color: "gray-500"
4078
+ color: "slate-500"
4052
4079
  }, titlePropsMerged)), titleAccessory), contentPropsMerged && (contentPropsMerged == null ? void 0 : contentPropsMerged.map(function (textProps) {
4053
4080
  return /*#__PURE__*/React__default.createElement(Text, Object.assign({}, textProps, {
4054
4081
  key: textProps.key || textProps.text