@luscii-healthtech/web-ui 12.0.0 → 12.1.1

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.
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseButtonProps } from "../ButtonV2/ButtonProps.type";
3
- import { TagColorTheme } from "../Tag/Tag";
4
3
  type TableFieldConfigBase = {
5
4
  key: string;
6
5
  headerText?: string;
@@ -29,7 +28,7 @@ export interface TableFieldText {
29
28
  breakAllWord?: boolean;
30
29
  tag?: {
31
30
  text: string;
32
- color: TagColorTheme;
31
+ color: "red" | "amber" | "green" | "gray" | "blue";
33
32
  };
34
33
  }
35
34
  export type TableFieldAction<Item> = Pick<BaseButtonProps, "isDisabled" | "title" | "icon"> & {
@@ -1,17 +1,26 @@
1
- /// <reference types="react" />
2
- import { TagSize } from "./Tag.utils";
3
- export declare enum TagColorTheme {
4
- Red = "red",
5
- Amber = "amber",
6
- Green = "green",
7
- Gray = "gray",
8
- Blue = "blue"
1
+ import React from "react";
2
+ type Color = "red" | "amber" | "green" | "gray" | "blue";
3
+ type Size = "base" | "small";
4
+ interface TagPropsShared extends React.ComponentPropsWithoutRef<"span"> {
5
+ colorTheme?: Color;
6
+ children?: string;
7
+ size?: Size;
8
+ className?: string;
9
+ }
10
+ interface PropsWithChildren extends TagPropsShared {
11
+ children?: string;
12
+ /**
13
+ * @deprecated Use `children` instead
14
+ */
15
+ text?: never;
9
16
  }
10
- export interface TagProps {
17
+ interface PropsWithText extends TagPropsShared {
18
+ children?: never;
19
+ /**
20
+ * @deprecated Use `children` instead
21
+ */
11
22
  text: string;
12
- colorTheme?: TagColorTheme;
13
- size?: TagSize;
14
- className?: string;
15
23
  }
16
- declare const Tag: ({ text, colorTheme, className, size, }: TagProps) => JSX.Element;
17
- export default Tag;
24
+ export type Props = PropsWithChildren | PropsWithText;
25
+ export declare const Tag: ({ text, colorTheme, className, size, children, ...rest }: Props) => React.JSX.Element;
26
+ export {};
@@ -1,10 +1,23 @@
1
- /// <reference types="react" />
2
- import { TagProps } from "./Tag";
3
- import { TagSize } from "./Tag.utils";
4
- interface TagGroupProps {
5
- tags: TagProps[];
6
- tagSize?: TagSize;
7
- className?: string;
1
+ import React from "react";
2
+ import { type Props as TagProps } from "./Tag";
3
+ interface PropsWithTags {
4
+ /**
5
+ * @deprecated Use `children` instead
6
+ */
7
+ tags?: TagProps[];
8
+ /**
9
+ * @deprecated Size of each tag rendered as a child is dictated by this child itself.
10
+ */
11
+ tagSize?: TagProps["size"];
12
+ children?: never;
13
+ }
14
+ interface PropsWithChildren {
15
+ tags?: never;
16
+ tagSize?: never;
17
+ children?: React.ReactNode;
8
18
  }
9
- declare const TagGroup: ({ tags, tagSize, className, }: TagGroupProps) => JSX.Element;
10
- export default TagGroup;
19
+ type Props = (PropsWithTags | PropsWithChildren) & {
20
+ className?: string;
21
+ };
22
+ export declare const TagGroup: ({ children, tags, tagSize, className, }: Props) => React.JSX.Element;
23
+ export {};
@@ -2,16 +2,30 @@ import React from "react";
2
2
  import "./Title.scss";
3
3
  import { TextColor } from "../Text/Text";
4
4
  export type TitleStyle = "xs" | "sm" | "base" | "lg" | "xl" | "2xl";
5
- export interface TitleProps {
6
- text: string;
5
+ type SharedProps = {
7
6
  type?: TitleStyle;
8
7
  color?: TextColor;
9
8
  className?: string;
10
9
  ref?: React.ForwardedRef<HTMLHeadingElement>;
11
- }
10
+ };
11
+ type WithChildrenProp = React.PropsWithChildren<SharedProps> & {
12
+ /**
13
+ * @deprecated Use children instead
14
+ */
15
+ text?: never;
16
+ };
17
+ type WithTextProp = SharedProps & {
18
+ /**
19
+ * @deprecated Use children instead
20
+ */
21
+ text: string;
22
+ children?: never;
23
+ };
24
+ export type TitleProps = WithChildrenProp | WithTextProp;
12
25
  export declare const Title: {
13
26
  (props: TitleProps): JSX.Element;
14
27
  defaultProps: {
15
- type: string;
28
+ type: "base";
16
29
  };
17
30
  };
31
+ export {};
package/dist/index.d.ts CHANGED
@@ -57,8 +57,8 @@ export { MediaPicker, TargetProps } from "./components/MediaPicker/MediaPicker";
57
57
  export { default as Tabbar, TabbarProps, TabItemDetails, } from "./components/Tabbar/Tabbar";
58
58
  export { Breadcrumbs, BreadcrumbProps } from "./components/Breadcrumbs";
59
59
  export { PageHeader, PageHeaderProps } from "./components/PageHeader";
60
- export { default as Tag } from "./components/Tag/Tag";
61
- export { default as TagGroup } from "./components/Tag/TagGroup";
60
+ export { Tag } from "./components/Tag/Tag";
61
+ export { TagGroup } from "./components/Tag/TagGroup";
62
62
  export { Textarea, TextareaProps, ResizeTypes, } from "./components/Textarea/Textarea";
63
63
  export { TextEditor } from "./components/TextEditor/TextEditor";
64
64
  export { default as TextEditorV2 } from "./components/TextEditorV2/TextEditorV2";
@@ -919,7 +919,7 @@ var css_248z$m = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FI
919
919
  styleInject(css_248z$m);
920
920
 
921
921
  const Title = (props) => {
922
- var _a;
922
+ var _a, _b;
923
923
  const isSmallTitle = props.type === "xs" || props.type === "sm";
924
924
  const containerClassName = classNames__default.default("ui-font-bold ui-leading-inherit", allowedColors[(_a = props.color) !== null && _a !== void 0 ? _a : "base"], {
925
925
  "title-inter": isSmallTitle,
@@ -954,7 +954,7 @@ const Title = (props) => {
954
954
  ContainerElement = "h4";
955
955
  break;
956
956
  }
957
- return React__namespace.default.createElement(ContainerElement, { className: containerClassName, ref: props.ref }, props.text);
957
+ return React__namespace.default.createElement(ContainerElement, { className: containerClassName, ref: props.ref }, (_b = props.text) !== null && _b !== void 0 ? _b : props.children);
958
958
  };
959
959
  Title.defaultProps = {
960
960
  type: "base"
@@ -3064,39 +3064,37 @@ function TableHeader(props) {
3064
3064
  );
3065
3065
  }
3066
3066
 
3067
- var TagSize;
3068
- (function(TagSize2) {
3069
- TagSize2["small"] = "small";
3070
- TagSize2["base"] = "base";
3071
- })(TagSize || (TagSize = {}));
3072
-
3073
- var TagColorTheme;
3074
- (function(TagColorTheme2) {
3075
- TagColorTheme2["Red"] = "red";
3076
- TagColorTheme2["Amber"] = "amber";
3077
- TagColorTheme2["Green"] = "green";
3078
- TagColorTheme2["Gray"] = "gray";
3079
- TagColorTheme2["Blue"] = "blue";
3080
- })(TagColorTheme || (TagColorTheme = {}));
3081
- const Tag = ({ text, colorTheme = TagColorTheme.Gray, className, size = TagSize.base }) => {
3082
- const textColor = {
3083
- [TagColorTheme.Red]: "red",
3084
- [TagColorTheme.Amber]: "amber",
3085
- [TagColorTheme.Green]: "green",
3086
- [TagColorTheme.Gray]: "base",
3087
- // Blue must be 800 here to pass the contrast test
3088
- [TagColorTheme.Blue]: "blue-800"
3089
- };
3067
+ const textColor = {
3068
+ red: "red",
3069
+ amber: "amber",
3070
+ green: "green",
3071
+ gray: "base",
3072
+ // Blue must be 800 here to pass the contrast test
3073
+ blue: "blue-800"
3074
+ };
3075
+ const Tag = (_a) => {
3076
+ var { text, colorTheme = "gray", className, size = "base", children } = _a, rest = __rest(_a, ["text", "colorTheme", "className", "size", "children"]);
3090
3077
  return React__namespace.default.createElement(
3091
3078
  "div",
3092
- { className: classNames__default.default("ui-inline-block ui-rounded-lg ui-px-2 ui-py-1", className, {
3093
- "ui-bg-red-50": colorTheme === TagColorTheme.Red,
3094
- "ui-bg-orange-50": colorTheme === TagColorTheme.Amber,
3095
- "ui-bg-green-50": colorTheme === TagColorTheme.Green,
3096
- "ui-bg-slate-50": colorTheme === TagColorTheme.Gray,
3097
- "ui-bg-blue-50": colorTheme === TagColorTheme.Blue
3098
- }) },
3099
- React__namespace.default.createElement(Text, { className: "ui-leading-5", color: textColor[colorTheme], text, type: size === TagSize.small ? "sm" : "base" })
3079
+ Object.assign({ className: classNames__default.default("ui-inline-block ui-rounded-lg ui-px-2 ui-py-1", className, {
3080
+ "ui-bg-red-50": colorTheme === "red",
3081
+ "ui-bg-orange-50": colorTheme === "amber",
3082
+ "ui-bg-green-50": colorTheme === "green",
3083
+ "ui-bg-slate-50": colorTheme === "gray",
3084
+ "ui-bg-blue-50": colorTheme === "blue"
3085
+ }) }, rest),
3086
+ React__namespace.default.createElement(
3087
+ Text,
3088
+ {
3089
+ /**
3090
+ * Ensures the `small` size, with smaller text, is the same height as the `base` size.
3091
+ */
3092
+ className: "ui-leading-5",
3093
+ color: textColor[colorTheme],
3094
+ variant: size === "small" ? "sm" : "base"
3095
+ },
3096
+ text !== null && text !== void 0 ? text : children
3097
+ )
3100
3098
  );
3101
3099
  };
3102
3100
 
@@ -4804,7 +4802,12 @@ const MediaPicker = (props) => {
4804
4802
  return React__namespace.default.createElement(ImagePicker, Object.assign({}, mappedProps));
4805
4803
  };
4806
4804
 
4807
- const TagGroup = ({ tags, tagSize = TagSize.base, className }) => React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-row ui-flex-wrap", className) }, tags.map((tag) => React__namespace.default.createElement(Tag, Object.assign({ size: tagSize }, tag, { className: classNames__default.default("ui-mb-2 ui-mr-2 last:ui-mr-0") }))));
4805
+ const TagGroup = ({ children, tags, tagSize = "base", className }) => React__namespace.default.createElement(
4806
+ "div",
4807
+ { className: classNames__default.default("ui-flex ui-flex-row ui-flex-wrap ui-gap-2", className) },
4808
+ children,
4809
+ tags === null || tags === void 0 ? void 0 : tags.map((tag) => React__namespace.default.createElement(Tag, Object.assign({ size: tagSize }, tag)))
4810
+ );
4808
4811
 
4809
4812
  var css_248z$2 = "/**\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.cweb-textarea {\n border: 1px solid #cccccc;\n border-radius: 4px;\n outline: none;\n background-color: #ffffff;\n resize: none;\n}\n.cweb-textarea.has-icon {\n background-size: 24px;\n background-position: 10px 10px;\n background-repeat: no-repeat;\n padding-left: 44px;\n}\n.cweb-textarea.resizable {\n resize: both;\n}\n.cweb-textarea.resizable-x {\n resize: horizontal;\n}\n.cweb-textarea.resizable-y {\n resize: vertical;\n}\n.cweb-textarea::placeholder {\n color: #737373;\n}\n.cweb-textarea:-ms-input-placeholder {\n color: #64748b !important;\n}\n.cweb-textarea::-ms-input-placeholder {\n color: #64748b;\n}\n.cweb-textarea:focus {\n border-color: #0074dd;\n}\n.cweb-textarea:disabled {\n cursor: not-allowed;\n}\n.cweb-textarea.has-error {\n border: 1px solid #ff6266;\n color: #ff6266;\n}";
4810
4813
  styleInject(css_248z$2);