@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.
@@ -7,4 +7,4 @@ export interface StepProps {
7
7
  step: string;
8
8
  };
9
9
  }
10
- export declare const Step: ({ title, stepNumber, active, localization }: StepProps) => JSX.Element;
10
+ export declare const Step: ({ title, stepNumber, active, localization, }: StepProps) => JSX.Element;
@@ -13,5 +13,5 @@ export interface TagProps {
13
13
  size?: TagSize;
14
14
  className?: string;
15
15
  }
16
- declare const Tag: ({ text, colorTheme, className, size }: TagProps) => JSX.Element;
16
+ declare const Tag: ({ text, colorTheme, className, size, }: TagProps) => JSX.Element;
17
17
  export default Tag;
@@ -1,14 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { RestPropped } from "../../types/general.types";
3
3
  import "./Text.scss";
4
- export declare type TextStyle = "sm" | "sm-strong" | "base" | "strong" | "lg" | "lg-strong" | "xl" | "xl-strong" | string;
5
- export declare type TextColor = "base" | "gray-500" | "gray-200" | "white" | "blue" | "red" | "green" | "amber" | "inherit";
4
+ export declare type TextStyle = "sm" | "sm-strong" | "base" | "strong" | "lg" | "lg-strong" | "xl" | "xl-strong";
5
+ export declare type TextColor = "base" | "slate-500" | "slate-200" | "white" | "blue-800" | "red" | "green" | "amber";
6
+ export declare type TextHoverColor = "blue-900" | "white";
6
7
  export interface TextProps extends RestPropped {
7
8
  text: string;
8
9
  type?: TextStyle;
9
10
  inline?: boolean;
10
11
  color?: TextColor;
11
- hoverColor?: TextColor;
12
+ hoverColor?: TextHoverColor;
13
+ hoverInGroup?: boolean;
12
14
  className?: string;
13
15
  containsDangerousHtml?: boolean;
14
16
  truncate?: boolean;
@@ -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) {
@@ -27,6 +27,33 @@ var htmlToDraft = _interopDefault(require('html-to-draftjs'));
27
27
  require('react-draft-wysiwyg/dist/react-draft-wysiwyg.css');
28
28
 
29
29
  var Text = function Text(props) {
30
+ /**
31
+ * One might argue that we're duplicating strings in this file.
32
+ * That's how tailwind expects to detect used classes, so please do not make
33
+ * anything dynamic or try to string concat class names.
34
+ * https://v1.tailwindcss.com/docs/controlling-file-size
35
+ */
36
+ var allowedColors = {
37
+ base: "text-slate-700",
38
+ "slate-500": "text-slate-500",
39
+ "slate-200": "text-slate-200",
40
+ red: "text-red-700",
41
+ green: "text-green-700",
42
+ amber: "text-yellow-700",
43
+ white: "text-white",
44
+ "blue-800": "text-blue-800"
45
+ };
46
+ var allowedHoverColors = {
47
+ "blue-900": "hover:text-blue-900",
48
+ white: "hover:text-white"
49
+ }; // What is a group hover? https://v1.tailwindcss.com/docs/pseudo-class-variants#group-hover
50
+
51
+ var allowedGroupHoverColors = {
52
+ "blue-900": "group-hover:text-blue-900",
53
+ white: "group-hover:text-white"
54
+ };
55
+ var selectedHoverColor = props.hoverColor && !props.hoverInGroup && allowedHoverColors[props.hoverColor];
56
+ var selectedGroupHoverColor = props.hoverColor && props.hoverInGroup && allowedGroupHoverColors[props.hoverColor];
30
57
  var containerProps = {
31
58
  "data-test-id": props["data-test-id"],
32
59
  className: classNames( // apply different style classes
@@ -45,17 +72,7 @@ var Text = function Text(props) {
45
72
  inline: props.inline,
46
73
  // FIXME: this class doesn't do anything without a max-width
47
74
  truncate: props.truncate
48
- }, {
49
- "text-slate-700": props.color === "base",
50
- "text-slate-500": props.color === "gray-500",
51
- "text-slate-200": props.color === "gray-200",
52
- "text-red-700": props.color === "red",
53
- "text-green-700": props.color === "green",
54
- "text-yellow-700": props.color === "amber",
55
- "text-blue-700": props.color === "blue",
56
- "text-white": props.color === "white",
57
- "text-primary-dark": props.color === "blue"
58
- }, {
75
+ }, allowedColors[props.color || "base"], selectedHoverColor, selectedGroupHoverColor, {
59
76
  "in-html-link": props.containsDangerousHtml
60
77
  }, //can be used to overwrite other classes like the color
61
78
  props.className)
@@ -956,13 +973,13 @@ var Checkbox = function Checkbox(_ref) {
956
973
  })), /*#__PURE__*/React__default.createElement("div", {
957
974
  className: "flex flex-col"
958
975
  }, text && /*#__PURE__*/React__default.createElement(Text, {
959
- className: "ml-2 select-none text-left",
976
+ className: "ml-2 text-left select-none",
960
977
  text: text,
961
978
  "data-test-id": "checkbox-text"
962
979
  }), explanation && /*#__PURE__*/React__default.createElement(Text, {
963
- className: "ml-2 select-none text-left",
980
+ className: "ml-2 text-left select-none",
964
981
  text: explanation,
965
- color: "gray-500",
982
+ color: "slate-500",
966
983
  "data-test-id": "checkbox-explanation"
967
984
  }))));
968
985
  };
@@ -1437,7 +1454,7 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
1437
1454
  "data-test-id": item.text,
1438
1455
  text: item.title,
1439
1456
  type: "sm",
1440
- color: "gray-500",
1457
+ color: "slate-500",
1441
1458
  truncate: true
1442
1459
  })), item.subItems.map(function (subItem) {
1443
1460
  return _this.renderIndividualItem(subItem);
@@ -1706,7 +1723,7 @@ var InfoField = function InfoField(props) {
1706
1723
  }, containerProps), /*#__PURE__*/React__default.createElement(Text, {
1707
1724
  text: props.label,
1708
1725
  type: "sm",
1709
- color: "gray-500",
1726
+ color: "slate-500",
1710
1727
  className: classNames({
1711
1728
  "break-words": props.supportsMultiline
1712
1729
  }, {
@@ -1912,7 +1929,7 @@ var PaginationMenuSmall = function PaginationMenuSmall(props) {
1912
1929
  className: "ml-4",
1913
1930
  text: props.currentPageNumber + " / " + props.pageCount,
1914
1931
  type: "sm",
1915
- color: "gray-500"
1932
+ color: "slate-500"
1916
1933
  }), /*#__PURE__*/React__default.createElement(TertiaryButton, {
1917
1934
  className: "ml-4",
1918
1935
  "data-test-id": "next-button",
@@ -2120,7 +2137,7 @@ var PaginationMenuLarge = function PaginationMenuLarge(props) {
2120
2137
  className: "ml-4 flex flex-row items-center"
2121
2138
  }, /*#__PURE__*/React__default.createElement(Text, {
2122
2139
  text: getSummaryText(props.pageCount, props.currentPageNumber, props.localization, props.pageSize, props.resultCount),
2123
- color: "gray-500"
2140
+ color: "slate-500"
2124
2141
  }), /*#__PURE__*/React__default.createElement(SecondaryButton, {
2125
2142
  "data-test-id": "prev-button",
2126
2143
  text: props.localization.previous,
@@ -2224,7 +2241,7 @@ function ListTableCell(_ref) {
2224
2241
  text: emptyValue
2225
2242
  }, textProps, {
2226
2243
  className: textClassName,
2227
- color: "gray-500"
2244
+ color: "slate-500"
2228
2245
  })), hasValue && isString(value) && /*#__PURE__*/React__default.createElement(Text, Object.assign({
2229
2246
  text: value
2230
2247
  }, textProps, {
@@ -2358,7 +2375,8 @@ function ListTable(_ref) {
2358
2375
  src: SearchNotFoundImage,
2359
2376
  alt: "no-image-found"
2360
2377
  }), /*#__PURE__*/React__default.createElement(Text, {
2361
- className: classNames("no-item-found-text", "w-56 text-base text-gray-600 text-center whitespace-pre-wrap"),
2378
+ className: classNames("no-item-found-text", "w-56 text-base text-center whitespace-pre-wrap"),
2379
+ color: "slate-500",
2362
2380
  text: configuration.emptyListText
2363
2381
  }))))), !showEmptyView && pageCount > 0 && onPaginationChange && /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
2364
2382
  colSpan: configuration.fields.length
@@ -2691,11 +2709,7 @@ var NavMenuItem = function NavMenuItem(props) {
2691
2709
  currentImg = _useState[0],
2692
2710
  setCurrentImg = _useState[1];
2693
2711
 
2694
- var _useState2 = React.useState(props.isSelected ? "white" : "gray-200"),
2695
- textColor = _useState2[0],
2696
- setTextColor = _useState2[1];
2697
-
2698
- 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"], {
2712
+ 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"], {
2699
2713
  "bg-nav-menu": !props.isSelected,
2700
2714
  "bg-gray-600": props.isSelected
2701
2715
  });
@@ -2703,14 +2717,12 @@ var NavMenuItem = function NavMenuItem(props) {
2703
2717
  var handleOnMouseOver = function handleOnMouseOver() {
2704
2718
  if (!props.isSelected) {
2705
2719
  setCurrentImg(props.imgOnHover);
2706
- setTextColor("white");
2707
2720
  }
2708
2721
  };
2709
2722
 
2710
2723
  var handleOnMouseOut = function handleOnMouseOut() {
2711
2724
  if (!props.isSelected) {
2712
2725
  setCurrentImg(props.img);
2713
- setTextColor("gray-200");
2714
2726
  }
2715
2727
  };
2716
2728
 
@@ -2727,7 +2739,9 @@ var NavMenuItem = function NavMenuItem(props) {
2727
2739
  }), /*#__PURE__*/React.createElement(Text, {
2728
2740
  type: "strong",
2729
2741
  text: props.title,
2730
- color: textColor
2742
+ hoverInGroup: true,
2743
+ color: "slate-200",
2744
+ hoverColor: "white"
2731
2745
  }));
2732
2746
 
2733
2747
  function handleMenuClick(event) {
@@ -2820,18 +2834,26 @@ var TextLink = function TextLink(props) {
2820
2834
 
2821
2835
  var NotificationBanner = function NotificationBanner(props) {
2822
2836
  var classes = classNames("w-full px-6 py-2 flex flex-row items-center border border-solid rounded", props.className, {
2823
- "bg-slate-100 border-slate-700": props.color === "base",
2824
- "bg-blue-100 border-blue-700": props.color === "blue",
2825
- "bg-red-100 border-red-700": props.color === "red",
2826
- "bg-green-100 border-green-700": props.color === "green",
2827
- "bg-yellow-100 border-yellow-700": props.color === "amber"
2837
+ "bg-slate-50 border-slate-700": props.color === "base",
2838
+ "bg-blue-50 border-blue-700": props.color === "blue",
2839
+ "bg-red-50 border-red-700": props.color === "red",
2840
+ "bg-green-50 border-green-700": props.color === "green",
2841
+ "bg-yellow-50 border-yellow-700": props.color === "amber"
2828
2842
  });
2843
+ var textColor = {
2844
+ red: "red",
2845
+ amber: "amber",
2846
+ green: "green",
2847
+ base: "base",
2848
+ // Blue must be 800 here to pass the contrast test
2849
+ blue: "blue-800"
2850
+ };
2829
2851
  return /*#__PURE__*/React__default.createElement("div", {
2830
2852
  className: classes
2831
2853
  }, props.icon, /*#__PURE__*/React__default.createElement(Text, {
2832
- className: "first:ml-0 ml-4",
2854
+ className: "ml-4 first:ml-0",
2833
2855
  text: props.text,
2834
- color: props.color
2856
+ color: props.color ? textColor[props.color] : "base"
2835
2857
  }), props.linkProps && /*#__PURE__*/React__default.createElement(TextLink, {
2836
2858
  className: "ml-4",
2837
2859
  text: props.linkProps.text,
@@ -2998,7 +3020,7 @@ var Step = function Step(_ref) {
2998
3020
  }), /*#__PURE__*/React__default.createElement(Text, {
2999
3021
  text: localization.step + " " + stepNumber,
3000
3022
  type: "strong",
3001
- color: active ? "blue" : "gray-500"
3023
+ color: active ? "blue-800" : "slate-500"
3002
3024
  }), /*#__PURE__*/React__default.createElement(Text, {
3003
3025
  text: title,
3004
3026
  type: "strong"
@@ -3790,24 +3812,26 @@ var TagColorTheme;
3790
3812
  })(TagColorTheme || (TagColorTheme = {}));
3791
3813
 
3792
3814
  var Tag = function Tag(_ref) {
3815
+ var _textColor;
3816
+
3793
3817
  var text = _ref.text,
3794
3818
  _ref$colorTheme = _ref.colorTheme,
3795
3819
  colorTheme = _ref$colorTheme === void 0 ? TagColorTheme.Gray : _ref$colorTheme,
3796
3820
  className = _ref.className,
3797
3821
  _ref$size = _ref.size,
3798
3822
  size = _ref$size === void 0 ? TagSize.base : _ref$size;
3799
- var containerClassName = classNames("inline py-1 px-2 rounded-lg", className, {
3800
- "bg-red-100 text-red-700": colorTheme === TagColorTheme.Red,
3801
- "bg-orange-100 text-amber-700": colorTheme === TagColorTheme.Amber,
3802
- "bg-green-100 text-green-800": colorTheme === TagColorTheme.Green,
3803
- "bg-slate-100 text-slate-600": colorTheme === TagColorTheme.Gray,
3804
- "bg-blue-50 text-blue-800": colorTheme === TagColorTheme.Blue
3805
- });
3823
+ 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);
3806
3824
  return /*#__PURE__*/React__default.createElement("div", {
3807
- className: containerClassName
3825
+ className: classNames("inline py-1 px-2 rounded-lg", className, {
3826
+ "bg-red-50": colorTheme === TagColorTheme.Red,
3827
+ "bg-orange-50": colorTheme === TagColorTheme.Amber,
3828
+ "bg-green-50": colorTheme === TagColorTheme.Green,
3829
+ "bg-slate-50": colorTheme === TagColorTheme.Gray,
3830
+ "bg-blue-50": colorTheme === TagColorTheme.Blue
3831
+ })
3808
3832
  }, /*#__PURE__*/React__default.createElement(Text, {
3809
3833
  inline: true,
3810
- color: "inherit",
3834
+ color: textColor[colorTheme],
3811
3835
  text: text,
3812
3836
  type: size === TagSize.small ? "sm" : "base"
3813
3837
  }));
@@ -4059,7 +4083,7 @@ function ViewItem(_ref) {
4059
4083
  className: "vitals-view-item-title-line flex justify-start flex-row items-start"
4060
4084
  }, titlePropsMerged && /*#__PURE__*/React__default.createElement(Text, Object.assign({
4061
4085
  className: classNames(titlePropsMerged.className, "vitals-view-item-title mb-1 mr-2"),
4062
- color: "gray-500"
4086
+ color: "slate-500"
4063
4087
  }, titlePropsMerged)), titleAccessory), contentPropsMerged && (contentPropsMerged == null ? void 0 : contentPropsMerged.map(function (textProps) {
4064
4088
  return /*#__PURE__*/React__default.createElement(Text, Object.assign({}, textProps, {
4065
4089
  key: textProps.key || textProps.text