@optigrit/optigrit-ui 0.0.19 → 0.0.20

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.
@@ -345,6 +345,40 @@ interface CardFooterProps extends React__default.HTMLAttributes<HTMLDivElement>
345
345
  }
346
346
  declare const CardFooter: React__default.ForwardRefExoticComponent<CardFooterProps & React__default.RefAttributes<HTMLDivElement>>;
347
347
 
348
+ type AvatarProps = IconButtonProps & {
349
+ src?: string;
350
+ alt?: string;
351
+ label?: string;
352
+ labelProps?: Omit<TooltipProps, 'label'>;
353
+ };
354
+ declare function Avatar(props: AvatarProps): react_jsx_runtime.JSX.Element;
355
+
356
+ type AvatarStackProps = {
357
+ avatars: Array<Pick<AvatarProps, 'alt' | 'src' | 'label' | 'color' | 'variant'> & {
358
+ id: string;
359
+ }>;
360
+ max?: number;
361
+ size?: AvatarProps['size'];
362
+ onClickAvatar?: (id: string) => void;
363
+ };
364
+ declare function AvatarStack(props: AvatarStackProps): react_jsx_runtime.JSX.Element;
365
+
366
+ declare const SearchIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
367
+
368
+ declare const CrossIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
369
+
370
+ declare const SuccessIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
371
+
372
+ declare const ErrorIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
373
+
374
+ declare const WarningIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
375
+
376
+ declare const InfoIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
377
+
378
+ declare const CloseIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
379
+
380
+ declare const ChevronDownIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
381
+
348
382
  declare function FlagAD(props: SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
349
383
 
350
384
  declare function FlagAE(props: SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
@@ -1169,4 +1203,12 @@ type FlagProps = HTMLAttributes<HTMLSpanElement> & {
1169
1203
  };
1170
1204
  declare function FlagIcon(props: FlagProps): react_jsx_runtime.JSX.Element;
1171
1205
 
1172
- export { Button, type ButtonColor, type ButtonProps, type ButtonRoundness, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, Carousel, type CarouselItem, type CarouselProps, type Column, type Country, DataTable, type DataTableProps, DatePicker, type DatePickerProps, type DatePickerValue, Dialog, DialogContent, DialogFooter, DialogHeader, type DialogProps, Drawer, DrawerContent, DrawerFooter, DrawerHeader, type DrawerProps, FlagIcon, type FlagName, type FlagProps, IconButton, type IconButtonProps, InputField, type InputFieldProps, MultiSelect, type MultiSelectProps, SearchBar, type SearchBarProps, Select, type SelectProps, Separator, type SeparatorProps, TabList, type TabListProps, TabPanel, type TabPanelProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TablePaginationConfig, type TableProps, TableRow, type TableRowProps, TelInput, type TelInputProps, type TelInputValue, TimePicker, type TimePickerProps, type TimePickerValue, Tooltip, type TooltipProps, handleAlert, handleError, isValidPhoneChars, isValidPhoneLength, sanitizePhoneNumber, validatePhoneNumber };
1206
+ declare const CalendarIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
1207
+
1208
+ declare const ClockIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
1209
+
1210
+ declare const ChevronLeftIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
1211
+
1212
+ declare const ChevronRightIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
1213
+
1214
+ export { Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Button, type ButtonColor, type ButtonProps, type ButtonRoundness, type ButtonSize, type ButtonVariant, CalendarIcon, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, Carousel, type CarouselItem, type CarouselProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, CloseIcon, type Column, type Country, CrossIcon, DataTable, type DataTableProps, DatePicker, type DatePickerProps, type DatePickerValue, Dialog, DialogContent, DialogFooter, DialogHeader, type DialogProps, Drawer, DrawerContent, DrawerFooter, DrawerHeader, type DrawerProps, ErrorIcon, FlagIcon, type FlagName, type FlagProps, IconButton, type IconButtonProps, InfoIcon, InputField, type InputFieldProps, MultiSelect, type MultiSelectProps, SearchBar, type SearchBarProps, SearchIcon, Select, type SelectProps, Separator, type SeparatorProps, SuccessIcon, TabList, type TabListProps, TabPanel, type TabPanelProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TablePaginationConfig, type TableProps, TableRow, type TableRowProps, TelInput, type TelInputProps, type TelInputValue, TimePicker, type TimePickerProps, type TimePickerValue, Tooltip, type TooltipProps, WarningIcon, handleAlert, handleError, isValidPhoneChars, isValidPhoneLength, sanitizePhoneNumber, validatePhoneNumber };
@@ -6,7 +6,7 @@ import {
6
6
  ShowWithAnimation,
7
7
  Spinner,
8
8
  cn
9
- } from "../chunk-AGDACE33.js";
9
+ } from "../chunk-4KHU7KPD.js";
10
10
  import "../chunk-MCQS3QNN.js";
11
11
  import {
12
12
  useKeyboardShortcuts
@@ -34,12 +34,12 @@ var getVariantClasses = (variant, color) => {
34
34
  info: "bg-info text-white shadow-sm hover:shadow"
35
35
  },
36
36
  outlined: {
37
- primary: "border border-primary-500 text-primary hover:border-primary hover:bg-[color-mix(in_srgb,var(--primary)_4%,transparent)]",
38
- secondary: "border border-primary-secondary-500 text-secondary hover:border-primary-secondary hover:bg-[color-mix(in_srgb,var(--primary-secondary)_4%,transparent)]",
39
- error: "border border-error-500 text-error hover:border-error hover:bg-[color-mix(in_srgb,var(--error)_4%,transparent)]",
40
- success: "border border-success-500 text-success hover:border-success hover:bg-[color-mix(in_srgb,var(--success)_4%,transparent)]",
41
- warning: "border border-warning-500 text-warning hover:border-warning hover:bg-[color-mix(in_srgb,var(--warning)_4%,transparent)]",
42
- info: "border border-info-500 text-info hover:border-info hover:bg-[color-mix(in_srgb,var(--info)_4%,transparent)]"
37
+ primary: "border border-primary-500 text-primary hover:border-primary hover:bg-[color-mix(in_srgb,var(--primary)_4%,transparent)] backdrop-blur-sm",
38
+ secondary: "border border-primary-secondary-500 text-secondary hover:border-primary-secondary hover:bg-[color-mix(in_srgb,var(--primary-secondary)_4%,transparent)] backdrop-blur-sm",
39
+ error: "border border-error-500 text-error hover:border-error hover:bg-[color-mix(in_srgb,var(--error)_4%,transparent)] backdrop-blur-sm",
40
+ success: "border border-success-500 text-success hover:border-success hover:bg-[color-mix(in_srgb,var(--success)_4%,transparent)] backdrop-blur-sm",
41
+ warning: "border border-warning-500 text-warning hover:border-warning hover:bg-[color-mix(in_srgb,var(--warning)_4%,transparent)] backdrop-blur-sm",
42
+ info: "border border-info-500 text-info hover:border-info hover:bg-[color-mix(in_srgb,var(--info)_4%,transparent)] backdrop-blur-sm"
43
43
  },
44
44
  soft: {
45
45
  primary: "bg-primary-100 text-primary hover:bg-primary-200",
@@ -157,11 +157,11 @@ import {
157
157
  } from "react";
158
158
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
159
159
  var iconOnlySizeClasses = {
160
- xs: "text-xs h-7 w-7",
161
- sm: "text-sm h-9 w-9",
162
- md: "text-base h-11 w-11",
163
- lg: "text-base h-13 w-13",
164
- xl: "text-lg h-15 w-15"
160
+ xs: "text-xs h-6 w-6",
161
+ sm: "text-sm h-8 w-8",
162
+ md: "text-base h-12 w-12",
163
+ lg: "text-base h-14 w-14",
164
+ xl: "text-lg h-16 w-16"
165
165
  };
166
166
  var roundnessClasses2 = {
167
167
  none: "rounded-none",
@@ -170,6 +170,13 @@ var roundnessClasses2 = {
170
170
  lg: "rounded-[16px]",
171
171
  full: "rounded-full"
172
172
  };
173
+ var borderWidthClasses = {
174
+ xs: "border-[1px]",
175
+ sm: "border-[1px]",
176
+ md: "border-[2px]",
177
+ lg: "border-[3px]",
178
+ xl: "border-[3px]"
179
+ };
173
180
  var IconButton = forwardRef2(
174
181
  ({
175
182
  variant = "contained",
@@ -217,12 +224,13 @@ var IconButton = forwardRef2(
217
224
  getVariantClasses(variant, color),
218
225
  iconOnlySizeClasses[size],
219
226
  roundnessClasses2[roundness],
227
+ variant === "outlined" && borderWidthClasses[size],
220
228
  className
221
229
  ),
222
230
  ...rest,
223
231
  children: [
224
232
  /* @__PURE__ */ jsx2(Ripple, { ref: rippleRef, color: getRippleColor(variant, color) }),
225
- loading ? /* @__PURE__ */ jsx2(Spinner, { size: spinnerSize[size], color: "inherit" }) : /* @__PURE__ */ jsx2("span", { className: "z-10 inline-flex items-center justify-center shrink-0", children })
233
+ loading ? /* @__PURE__ */ jsx2(Spinner, { size: spinnerSize[size], color: "inherit" }) : children
226
234
  ]
227
235
  }
228
236
  );
@@ -15642,13 +15650,143 @@ var CardFooter = React8.forwardRef(
15642
15650
  }
15643
15651
  );
15644
15652
  CardFooter.displayName = "CardFooter";
15653
+
15654
+ // src/components/Primitives/Avatar/index.tsx
15655
+ import { Fragment as Fragment9, useLayoutEffect as useLayoutEffect2, useState as useState12 } from "react";
15656
+ import { jsx as jsx323, jsxs as jsxs297 } from "react/jsx-runtime";
15657
+ function Avatar(props) {
15658
+ const {
15659
+ label,
15660
+ labelProps,
15661
+ src = "",
15662
+ alt = "Avatar",
15663
+ variant = "outlined",
15664
+ color = "secondary",
15665
+ size = "md",
15666
+ ...iconButtonProps
15667
+ } = props;
15668
+ const [hasError, setHasError] = useState12(false);
15669
+ const fallbackText = getInitials(alt);
15670
+ const shouldRenderImage = Boolean(src) && !hasError;
15671
+ useLayoutEffect2(() => {
15672
+ setHasError(false);
15673
+ }, [src]);
15674
+ return /* @__PURE__ */ jsx323(
15675
+ Tooltip,
15676
+ {
15677
+ ...labelProps,
15678
+ label,
15679
+ labelContainerProps: {
15680
+ ...labelProps?.labelContainerProps,
15681
+ style: {
15682
+ ...labelProps?.labelContainerProps?.style,
15683
+ display: label ? "flex" : "none"
15684
+ }
15685
+ },
15686
+ children: /* @__PURE__ */ jsx323(
15687
+ IconButton_default,
15688
+ {
15689
+ role: "img",
15690
+ "aria-label": alt,
15691
+ ...iconButtonProps,
15692
+ variant,
15693
+ color,
15694
+ size,
15695
+ children: shouldRenderImage ? /* @__PURE__ */ jsxs297(Fragment9, { children: [
15696
+ /* @__PURE__ */ jsx323(
15697
+ "img",
15698
+ {
15699
+ src,
15700
+ alt: "",
15701
+ "aria-hidden": "true",
15702
+ className: "h-full w-full object-fill blur-sm absolute z-[-1]",
15703
+ onError: () => setHasError(true),
15704
+ loading: "lazy",
15705
+ decoding: "async"
15706
+ }
15707
+ ),
15708
+ /* @__PURE__ */ jsx323(
15709
+ "img",
15710
+ {
15711
+ src,
15712
+ alt: "",
15713
+ "aria-hidden": "true",
15714
+ className: "h-full w-full object-contain",
15715
+ onError: () => setHasError(true),
15716
+ loading: "lazy",
15717
+ decoding: "async"
15718
+ }
15719
+ )
15720
+ ] }) : /* @__PURE__ */ jsx323("span", { "aria-hidden": "true", className: "select-none leading-none", children: fallbackText })
15721
+ }
15722
+ )
15723
+ }
15724
+ );
15725
+ }
15726
+ function getInitials(label) {
15727
+ const trimmedLabel = label.trim();
15728
+ if (!trimmedLabel) return "?";
15729
+ const words = trimmedLabel.split(/\s+/).filter(Boolean);
15730
+ if (words.length === 1) {
15731
+ return words[0].slice(0, 2).toUpperCase();
15732
+ }
15733
+ return words.slice(0, 2).map((word) => word[0]?.toUpperCase() ?? "").join("");
15734
+ }
15735
+
15736
+ // src/components/Primitives/AvatarStack/index.tsx
15737
+ import { useState as useState13 } from "react";
15738
+ import { jsx as jsx324 } from "react/jsx-runtime";
15739
+ import { createElement } from "react";
15740
+ function AvatarStack(props) {
15741
+ const {
15742
+ avatars = [],
15743
+ max = Infinity,
15744
+ size = "md",
15745
+ onClickAvatar
15746
+ } = props;
15747
+ const allowAvatars = avatars.slice(0, max);
15748
+ const [hoverIndex, setHoverIndex] = useState13(-1);
15749
+ return /* @__PURE__ */ jsx324("div", { className: cn(
15750
+ "flex items-center",
15751
+ {
15752
+ "xs": "-space-x-2",
15753
+ "sm": "-space-x-3",
15754
+ "md": "-space-x-4",
15755
+ "lg": "-space-x-5",
15756
+ "xl": "-space-x-6"
15757
+ }[size]
15758
+ ), children: allowAvatars.map((avatarProps, index) => /* @__PURE__ */ createElement(
15759
+ Avatar,
15760
+ {
15761
+ ...avatarProps,
15762
+ size,
15763
+ key: avatarProps.id,
15764
+ className: "hover:scale-105 transition-all border-2",
15765
+ style: {
15766
+ zIndex: hoverIndex === index ? avatars.length + 1 : avatars.length - index
15767
+ },
15768
+ onClick: () => onClickAvatar?.(avatarProps.id),
15769
+ onMouseEnter: () => setHoverIndex(index),
15770
+ onMouseLeave: () => setHoverIndex(-1)
15771
+ }
15772
+ )) });
15773
+ }
15645
15774
  export {
15775
+ Avatar,
15776
+ AvatarStack,
15646
15777
  Button_default as Button,
15778
+ CalendarIcon,
15647
15779
  Card,
15648
15780
  CardContent,
15649
15781
  CardFooter,
15650
15782
  CardHeader,
15651
15783
  Carousel,
15784
+ ChevronDownIcon,
15785
+ ChevronLeftIcon,
15786
+ ChevronRightIcon,
15787
+ ClockIcon,
15788
+ CloseIcon,
15789
+ CrossIcon,
15652
15790
  DataTable_default as DataTable,
15653
15791
  DatePicker,
15654
15792
  Dialog,
@@ -15659,13 +15797,17 @@ export {
15659
15797
  DrawerContent,
15660
15798
  DrawerFooter,
15661
15799
  DrawerHeader,
15800
+ ErrorIcon,
15662
15801
  FlagIcon,
15663
15802
  IconButton_default as IconButton,
15803
+ InfoIcon,
15664
15804
  InputField,
15665
15805
  MultiSelect,
15666
15806
  SearchBar,
15807
+ SearchIcon,
15667
15808
  Select,
15668
15809
  Separator,
15810
+ SuccessIcon,
15669
15811
  TabList,
15670
15812
  TabPanel,
15671
15813
  Table_default as Table,
@@ -15678,6 +15820,7 @@ export {
15678
15820
  TelInput,
15679
15821
  TimePicker,
15680
15822
  Tooltip,
15823
+ WarningIcon,
15681
15824
  handleAlert,
15682
15825
  handleError,
15683
15826
  isValidPhoneChars,
@@ -68,4 +68,10 @@ type ShowProps = {
68
68
  };
69
69
  declare function Show({ when, children, otherwise }: ShowProps): ReactNode;
70
70
 
71
- export { Popover, PopoverProps, Ripple, type RippleProps, type RippleRef, Show, type ShowProps, ShowWithAnimation, ShowWithAnimationProps, Spinner, type SpinnerColor, type SpinnerProps };
71
+ /**
72
+ * Utility function to merge tailwind classes safely.
73
+ * Uses `twMerge` to correctly override conflicting tailwind utility classes.
74
+ */
75
+ declare function cn(...inputs: (string | undefined | null | false | boolean)[]): string;
76
+
77
+ export { Popover, PopoverProps, Ripple, type RippleProps, type RippleRef, Show, type ShowProps, ShowWithAnimation, ShowWithAnimationProps, Spinner, type SpinnerColor, type SpinnerProps, cn };
@@ -4,8 +4,9 @@ import {
4
4
  Ripple,
5
5
  Show,
6
6
  ShowWithAnimation,
7
- Spinner
8
- } from "../chunk-AGDACE33.js";
7
+ Spinner,
8
+ cn
9
+ } from "../chunk-4KHU7KPD.js";
9
10
  import "../chunk-MCQS3QNN.js";
10
11
  import "../chunk-OP7KGPEN.js";
11
12
  export {
@@ -14,5 +15,6 @@ export {
14
15
  Ripple,
15
16
  Show,
16
17
  ShowWithAnimation,
17
- Spinner
18
+ Spinner,
19
+ cn
18
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optigrit/optigrit-ui",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "UI components library for optigrit apps",
5
5
  "license": "ISC",
6
6
  "author": "",
File without changes