@luscii-healthtech/web-ui 0.2.2 → 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)
@@ -948,13 +965,13 @@ var Checkbox = function Checkbox(_ref) {
948
965
  })), /*#__PURE__*/React__default.createElement("div", {
949
966
  className: "flex flex-col"
950
967
  }, text && /*#__PURE__*/React__default.createElement(Text, {
951
- className: "ml-2 select-none text-left",
968
+ className: "ml-2 text-left select-none",
952
969
  text: text,
953
970
  "data-test-id": "checkbox-text"
954
971
  }), explanation && /*#__PURE__*/React__default.createElement(Text, {
955
- className: "ml-2 select-none text-left",
972
+ className: "ml-2 text-left select-none",
956
973
  text: explanation,
957
- color: "gray-500",
974
+ color: "slate-500",
958
975
  "data-test-id": "checkbox-explanation"
959
976
  }))));
960
977
  };
@@ -1429,7 +1446,7 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
1429
1446
  "data-test-id": item.text,
1430
1447
  text: item.title,
1431
1448
  type: "sm",
1432
- color: "gray-500",
1449
+ color: "slate-500",
1433
1450
  truncate: true
1434
1451
  })), item.subItems.map(function (subItem) {
1435
1452
  return _this.renderIndividualItem(subItem);
@@ -1698,7 +1715,7 @@ var InfoField = function InfoField(props) {
1698
1715
  }, containerProps), /*#__PURE__*/React__default.createElement(Text, {
1699
1716
  text: props.label,
1700
1717
  type: "sm",
1701
- color: "gray-500",
1718
+ color: "slate-500",
1702
1719
  className: classNames({
1703
1720
  "break-words": props.supportsMultiline
1704
1721
  }, {
@@ -1904,7 +1921,7 @@ var PaginationMenuSmall = function PaginationMenuSmall(props) {
1904
1921
  className: "ml-4",
1905
1922
  text: props.currentPageNumber + " / " + props.pageCount,
1906
1923
  type: "sm",
1907
- color: "gray-500"
1924
+ color: "slate-500"
1908
1925
  }), /*#__PURE__*/React__default.createElement(TertiaryButton, {
1909
1926
  className: "ml-4",
1910
1927
  "data-test-id": "next-button",
@@ -2112,7 +2129,7 @@ var PaginationMenuLarge = function PaginationMenuLarge(props) {
2112
2129
  className: "ml-4 flex flex-row items-center"
2113
2130
  }, /*#__PURE__*/React__default.createElement(Text, {
2114
2131
  text: getSummaryText(props.pageCount, props.currentPageNumber, props.localization, props.pageSize, props.resultCount),
2115
- color: "gray-500"
2132
+ color: "slate-500"
2116
2133
  }), /*#__PURE__*/React__default.createElement(SecondaryButton, {
2117
2134
  "data-test-id": "prev-button",
2118
2135
  text: props.localization.previous,
@@ -2216,7 +2233,7 @@ function ListTableCell(_ref) {
2216
2233
  text: emptyValue
2217
2234
  }, textProps, {
2218
2235
  className: textClassName,
2219
- color: "gray-500"
2236
+ color: "slate-500"
2220
2237
  })), hasValue && isString(value) && /*#__PURE__*/React__default.createElement(Text, Object.assign({
2221
2238
  text: value
2222
2239
  }, textProps, {
@@ -2350,7 +2367,8 @@ function ListTable(_ref) {
2350
2367
  src: SearchNotFoundImage,
2351
2368
  alt: "no-image-found"
2352
2369
  }), /*#__PURE__*/React__default.createElement(Text, {
2353
- 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",
2354
2372
  text: configuration.emptyListText
2355
2373
  }))))), !showEmptyView && pageCount > 0 && onPaginationChange && /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
2356
2374
  colSpan: configuration.fields.length
@@ -2683,11 +2701,7 @@ var NavMenuItem = function NavMenuItem(props) {
2683
2701
  currentImg = _useState[0],
2684
2702
  setCurrentImg = _useState[1];
2685
2703
 
2686
- var _useState2 = useState(props.isSelected ? "white" : "gray-200"),
2687
- textColor = _useState2[0],
2688
- setTextColor = _useState2[1];
2689
-
2690
- 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"], {
2691
2705
  "bg-nav-menu": !props.isSelected,
2692
2706
  "bg-gray-600": props.isSelected
2693
2707
  });
@@ -2695,14 +2709,12 @@ var NavMenuItem = function NavMenuItem(props) {
2695
2709
  var handleOnMouseOver = function handleOnMouseOver() {
2696
2710
  if (!props.isSelected) {
2697
2711
  setCurrentImg(props.imgOnHover);
2698
- setTextColor("white");
2699
2712
  }
2700
2713
  };
2701
2714
 
2702
2715
  var handleOnMouseOut = function handleOnMouseOut() {
2703
2716
  if (!props.isSelected) {
2704
2717
  setCurrentImg(props.img);
2705
- setTextColor("gray-200");
2706
2718
  }
2707
2719
  };
2708
2720
 
@@ -2719,7 +2731,9 @@ var NavMenuItem = function NavMenuItem(props) {
2719
2731
  }), /*#__PURE__*/createElement(Text, {
2720
2732
  type: "strong",
2721
2733
  text: props.title,
2722
- color: textColor
2734
+ hoverInGroup: true,
2735
+ color: "slate-200",
2736
+ hoverColor: "white"
2723
2737
  }));
2724
2738
 
2725
2739
  function handleMenuClick(event) {
@@ -2812,18 +2826,26 @@ var TextLink = function TextLink(props) {
2812
2826
 
2813
2827
  var NotificationBanner = function NotificationBanner(props) {
2814
2828
  var classes = classNames("w-full px-6 py-2 flex flex-row items-center border border-solid rounded", props.className, {
2815
- "bg-slate-100 border-slate-700": props.color === "base",
2816
- "bg-blue-100 border-blue-700": props.color === "blue",
2817
- "bg-red-100 border-red-700": props.color === "red",
2818
- "bg-green-100 border-green-700": props.color === "green",
2819
- "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"
2820
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
+ };
2821
2843
  return /*#__PURE__*/React__default.createElement("div", {
2822
2844
  className: classes
2823
2845
  }, props.icon, /*#__PURE__*/React__default.createElement(Text, {
2824
- className: "first:ml-0 ml-4",
2846
+ className: "ml-4 first:ml-0",
2825
2847
  text: props.text,
2826
- color: props.color
2848
+ color: props.color ? textColor[props.color] : "base"
2827
2849
  }), props.linkProps && /*#__PURE__*/React__default.createElement(TextLink, {
2828
2850
  className: "ml-4",
2829
2851
  text: props.linkProps.text,
@@ -2990,7 +3012,7 @@ var Step = function Step(_ref) {
2990
3012
  }), /*#__PURE__*/React__default.createElement(Text, {
2991
3013
  text: localization.step + " " + stepNumber,
2992
3014
  type: "strong",
2993
- color: active ? "blue" : "gray-500"
3015
+ color: active ? "blue-800" : "slate-500"
2994
3016
  }), /*#__PURE__*/React__default.createElement(Text, {
2995
3017
  text: title,
2996
3018
  type: "strong"
@@ -3782,24 +3804,26 @@ var TagColorTheme;
3782
3804
  })(TagColorTheme || (TagColorTheme = {}));
3783
3805
 
3784
3806
  var Tag = function Tag(_ref) {
3807
+ var _textColor;
3808
+
3785
3809
  var text = _ref.text,
3786
3810
  _ref$colorTheme = _ref.colorTheme,
3787
3811
  colorTheme = _ref$colorTheme === void 0 ? TagColorTheme.Gray : _ref$colorTheme,
3788
3812
  className = _ref.className,
3789
3813
  _ref$size = _ref.size,
3790
3814
  size = _ref$size === void 0 ? TagSize.base : _ref$size;
3791
- var containerClassName = classNames("inline py-1 px-2 rounded-lg", className, {
3792
- "bg-red-100 text-red-700": colorTheme === TagColorTheme.Red,
3793
- "bg-orange-100 text-amber-700": colorTheme === TagColorTheme.Amber,
3794
- "bg-green-100 text-green-800": colorTheme === TagColorTheme.Green,
3795
- "bg-slate-100 text-slate-600": colorTheme === TagColorTheme.Gray,
3796
- "bg-blue-50 text-blue-800": colorTheme === TagColorTheme.Blue
3797
- });
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);
3798
3816
  return /*#__PURE__*/React__default.createElement("div", {
3799
- 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
+ })
3800
3824
  }, /*#__PURE__*/React__default.createElement(Text, {
3801
3825
  inline: true,
3802
- color: "inherit",
3826
+ color: textColor[colorTheme],
3803
3827
  text: text,
3804
3828
  type: size === TagSize.small ? "sm" : "base"
3805
3829
  }));
@@ -4051,7 +4075,7 @@ function ViewItem(_ref) {
4051
4075
  className: "vitals-view-item-title-line flex justify-start flex-row items-start"
4052
4076
  }, titlePropsMerged && /*#__PURE__*/React__default.createElement(Text, Object.assign({
4053
4077
  className: classNames(titlePropsMerged.className, "vitals-view-item-title mb-1 mr-2"),
4054
- color: "gray-500"
4078
+ color: "slate-500"
4055
4079
  }, titlePropsMerged)), titleAccessory), contentPropsMerged && (contentPropsMerged == null ? void 0 : contentPropsMerged.map(function (textProps) {
4056
4080
  return /*#__PURE__*/React__default.createElement(Text, Object.assign({}, textProps, {
4057
4081
  key: textProps.key || textProps.text