@luscii-healthtech/web-ui 37.4.0 → 37.5.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.
@@ -50,6 +50,24 @@ export interface ButtonWithPendingStateProps extends BaseButtonProps {
50
50
  isPending?: boolean;
51
51
  }
52
52
  export type PrimaryButtonProps = ButtonWithPendingStateProps;
53
+ /**
54
+ * Properties specific to the IconButtons
55
+ */
56
+ export type IconButtonProps = ButtonWithPendingStateProps & {
57
+ /**
58
+ * The icon that will be rendered in the button.
59
+ */
60
+ children: React.ReactNode;
61
+ /**
62
+ * Accessible label for the button. This will only be visible to screen readers, and will also be used to target buttons in tests.
63
+ */
64
+ label: string;
65
+ /**
66
+ * Since this button only renders one icon, we don't need leading or trailing icons.
67
+ */
68
+ leadingIcon: never;
69
+ trailingIcon: never;
70
+ };
53
71
  /**
54
72
  * All properties of BaseButtonProps and ButtonWithPendingStateProps,
55
73
  * plus other properties that are assigned internally by the button variants.
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { type IconButtonProps } from "./ButtonProps.type";
3
+ export declare const PrimaryIconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { type IconButtonProps } from "./ButtonProps.type";
3
+ export declare const SecondaryIconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { type IconButtonProps } from "./ButtonProps.type";
3
+ export declare const TertiaryIconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -23,6 +23,9 @@ export { type BaseButtonProps as NonPrimaryButtonProps, type ButtonWithPendingSt
23
23
  export { PrimaryButton } from "./components/ButtonV2/PrimaryButton";
24
24
  export { SecondaryButton } from "./components/ButtonV2/SecondaryButton";
25
25
  export { TertiaryButton } from "./components/ButtonV2/TertiaryButton";
26
+ export { PrimaryIconButton } from "./components/ButtonV2/PrimaryIconButton";
27
+ export { SecondaryIconButton } from "./components/ButtonV2/SecondaryIconButton";
28
+ export { TertiaryIconButton } from "./components/ButtonV2/TertiaryIconButton";
26
29
  export { default as Carousel } from "./components/Carousel/Carousel";
27
30
  export { default as CenteredHero } from "./components/CenteredHero/CenteredHero";
28
31
  export { Checkbox } from "./components/Checkbox/Checkbox";
@@ -1860,45 +1860,45 @@ const createSpacingClassNames = (keys, spacingProps) => {
1860
1860
  return keys.filter((key) => spacingProps[key]).map((key) => `ui-${key}-${spacingProps[key]}`).join(" ");
1861
1861
  };
1862
1862
  const Box = (props) => {
1863
- const { as: Element = "div", borderRadius, className, elevation, width } = props, attributes = __rest(props, ["as", "borderRadius", "className", "elevation", "width"]);
1863
+ const { as: Element = "div", borderRadius, className, elevation, width, backgroundColor, hoverBackgroundColor, cursor } = props, attributes = __rest(props, ["as", "borderRadius", "className", "elevation", "width", "backgroundColor", "hoverBackgroundColor", "cursor"]);
1864
1864
  const spacingClasses = createSpacingClassNames(spacingKeys, props);
1865
1865
  const shadowClassName = createShadowClassName(elevation);
1866
1866
  const borderRadiusClassName = createRadiusClassName(borderRadius);
1867
1867
  const attributesWithoutSpacingKeys = omit__default.default(attributes, spacingKeys);
1868
1868
  return React__namespace.default.createElement(Element, Object.assign({ className: classNames__default.default(spacingClasses, {
1869
- "ui-bg-surface": props.backgroundColor === "surface",
1870
- "ui-bg-background": props.backgroundColor === "background",
1871
- "ui-bg-secondary-background": props.backgroundColor === "secondary-background",
1872
- "ui-bg-slate-100": props.backgroundColor === "base",
1873
- "ui-bg-blue-50": props.backgroundColor === "blue",
1874
- "ui-bg-red-50": props.backgroundColor === "red",
1875
- "ui-bg-green-50": props.backgroundColor === "green",
1876
- "ui-bg-amber-50": props.backgroundColor === "amber",
1869
+ "ui-bg-surface": backgroundColor === "surface",
1870
+ "ui-bg-background": backgroundColor === "background",
1871
+ "ui-bg-secondary-background": backgroundColor === "secondary-background",
1872
+ "ui-bg-slate-100": backgroundColor === "base",
1873
+ "ui-bg-blue-50": backgroundColor === "blue",
1874
+ "ui-bg-red-50": backgroundColor === "red",
1875
+ "ui-bg-green-50": backgroundColor === "green",
1876
+ "ui-bg-amber-50": backgroundColor === "amber",
1877
1877
  [`ui-w-${width}`]: width && width !== "full",
1878
1878
  "ui-w-full": width === "full"
1879
1879
  }, {
1880
- "hover:ui-bg-slate-100": props.hoverBackgroundColor === "base",
1881
- "hover:ui-bg-background": props.backgroundColor === "background",
1882
- "hover:ui-bg-secondary-background": props.hoverBackgroundColor === "secondary-background",
1883
- "hover:ui-bg-blue-50": props.hoverBackgroundColor === "blue",
1884
- "hover:ui-bg-red-50": props.hoverBackgroundColor === "red",
1885
- "hover:ui-bg-green-50": props.hoverBackgroundColor === "green",
1886
- "hover:ui-bg-amber-50": props.hoverBackgroundColor === "amber"
1880
+ "hover:ui-bg-slate-100": hoverBackgroundColor === "base",
1881
+ "hover:ui-bg-background": backgroundColor === "background",
1882
+ "hover:ui-bg-secondary-background": hoverBackgroundColor === "secondary-background",
1883
+ "hover:ui-bg-blue-50": hoverBackgroundColor === "blue",
1884
+ "hover:ui-bg-red-50": hoverBackgroundColor === "red",
1885
+ "hover:ui-bg-green-50": hoverBackgroundColor === "green",
1886
+ "hover:ui-bg-amber-50": hoverBackgroundColor === "amber"
1887
1887
  }, {
1888
- "ui-transition-colors motion-reduce:ui-transition-none": props.hoverBackgroundColor !== void 0
1888
+ "ui-transition-colors motion-reduce:ui-transition-none": hoverBackgroundColor !== void 0
1889
1889
  }, {
1890
- "ui-cursor-auto": props.cursor === "auto",
1891
- "ui-cursor-default": props.cursor === "default",
1892
- "ui-cursor-pointer": props.cursor === "pointer",
1893
- "ui-cursor-wait": props.cursor === "wait",
1894
- "ui-cursor-move": props.cursor === "move",
1895
- "ui-cursor-help": props.cursor === "help",
1896
- "ui-cursor-not-allowed": props.cursor === "not-allowed",
1897
- "ui-cursor-progress": props.cursor === "progress",
1898
- "ui-cursor-copy": props.cursor === "copy",
1899
- "ui-cursor-no-drop": props.cursor === "no-drop",
1900
- "ui-cursor-grab": props.cursor === "grab",
1901
- "ui-cursor-grabbing": props.cursor === "grabbing"
1890
+ "ui-cursor-auto": cursor === "auto",
1891
+ "ui-cursor-default": cursor === "default",
1892
+ "ui-cursor-pointer": cursor === "pointer",
1893
+ "ui-cursor-wait": cursor === "wait",
1894
+ "ui-cursor-move": cursor === "move",
1895
+ "ui-cursor-help": cursor === "help",
1896
+ "ui-cursor-not-allowed": cursor === "not-allowed",
1897
+ "ui-cursor-progress": cursor === "progress",
1898
+ "ui-cursor-copy": cursor === "copy",
1899
+ "ui-cursor-no-drop": cursor === "no-drop",
1900
+ "ui-cursor-grab": cursor === "grab",
1901
+ "ui-cursor-grabbing": cursor === "grabbing"
1902
1902
  }, className, shadowClassName, borderRadiusClassName) }, attributesWithoutSpacingKeys));
1903
1903
  };
1904
1904
 
@@ -2987,6 +2987,30 @@ const Badge = (props) => {
2987
2987
  );
2988
2988
  };
2989
2989
 
2990
+ const PrimaryIconButton = React__namespace.default.forwardRef((props, innerRef) => {
2991
+ const { children: icon, size = "medium", label } = props, rest = __rest(props, ["children", "size", "label"]);
2992
+ return React__namespace.default.createElement(PrimaryButton, Object.assign({ ref: innerRef }, rest, { "aria-label": label, size, leadingIcon: icon, className: classNames__default.default({
2993
+ "ui-px-[calc(theme('spacing.xxs')-1px)]": size === "medium",
2994
+ "ui-px-[calc(theme('spacing.s')-1px)]": size === "large"
2995
+ }, props.className) }));
2996
+ });
2997
+
2998
+ const SecondaryIconButton = React__namespace.default.forwardRef((props, innerRef) => {
2999
+ const { children: icon, size = "medium", label } = props, rest = __rest(props, ["children", "size", "label"]);
3000
+ return React__namespace.default.createElement(SecondaryButton, Object.assign({ ref: innerRef }, rest, { "aria-label": label, size, leadingIcon: icon, className: classNames__default.default({
3001
+ "ui-px-[calc(theme('spacing.xxs')-1px)]": size === "medium",
3002
+ "ui-px-[calc(theme('spacing.s')-1px)]": size === "large"
3003
+ }, props.className) }));
3004
+ });
3005
+
3006
+ const TertiaryIconButton = React__namespace.default.forwardRef((props, innerRef) => {
3007
+ const { children: icon, size = "medium", label } = props, rest = __rest(props, ["children", "size", "label"]);
3008
+ return React__namespace.default.createElement(TertiaryButton, Object.assign({ ref: innerRef }, rest, { "aria-label": label, size, leadingIcon: icon, className: classNames__default.default({
3009
+ "ui-px-[calc(theme('spacing.xxs')-1px)]": size === "medium",
3010
+ "ui-px-[calc(theme('spacing.s')-1px)]": size === "large"
3011
+ }, props.className) }));
3012
+ });
3013
+
2990
3014
  const DotButton = (_a) => {
2991
3015
  var { onClick, isActive, className } = _a, rest = __rest(_a, ["onClick", "isActive", "className"]);
2992
3016
  const classes = classNames__default.default(className, "ui-rounded-full", "hover:ui-bg-primary", "ui-size-2", {
@@ -7456,6 +7480,7 @@ exports.PinIcon = PinIcon;
7456
7480
  exports.PlusIcon = PlusIcon;
7457
7481
  exports.PreviewPhone = PreviewPhone;
7458
7482
  exports.PrimaryButton = PrimaryButton;
7483
+ exports.PrimaryIconButton = PrimaryIconButton;
7459
7484
  exports.PrintIcon = PrinterIcon;
7460
7485
  exports.PrinterIcon = PrinterIcon;
7461
7486
  exports.Radio = Radio;
@@ -7469,6 +7494,7 @@ exports.RocketIcon = RocketIcon;
7469
7494
  exports.SearchIcon = SearchIcon;
7470
7495
  exports.SearchInput = SearchInput;
7471
7496
  exports.SecondaryButton = SecondaryButton;
7497
+ exports.SecondaryIconButton = SecondaryIconButton;
7472
7498
  exports.Section = Section$1;
7473
7499
  exports.SectionItem = SectionItem;
7474
7500
  exports.SectionItemWithContent = SectionItemWithContent;
@@ -7504,6 +7530,7 @@ exports.TadaIcon = TadaIcon;
7504
7530
  exports.Tag = Tag;
7505
7531
  exports.TagGroup = TagGroup;
7506
7532
  exports.TertiaryButton = TertiaryButton;
7533
+ exports.TertiaryIconButton = TertiaryIconButton;
7507
7534
  exports.Text = Text;
7508
7535
  exports.TextEditor = TextEditor;
7509
7536
  exports.TextLink = TextLink;