@madecki/ui 2.0.0 → 2.1.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.
package/dist/index.d.cts CHANGED
@@ -179,6 +179,23 @@ interface SpinnerOverlayProps extends SpinnerProps {
179
179
  }
180
180
  declare const SpinnerOverlay: ({ isVisible, size, className, }: SpinnerOverlayProps) => react_jsx_runtime.JSX.Element | null;
181
181
 
182
+ type ToastVariant = "danger" | "success" | "info";
183
+ type ToastPlacement = "top-left" | "top-right" | "bottom-left" | "bottom-right";
184
+ interface ToastProps {
185
+ children: ReactNode;
186
+ variant?: ToastVariant;
187
+ placement?: ToastPlacement;
188
+ /**
189
+ * Time in milliseconds before the toast dismisses itself.
190
+ * Pass `0` to disable auto-close. Default: `5000`.
191
+ */
192
+ autoCloseMs?: number;
193
+ /** Called after the user closes the toast or auto-close fires. */
194
+ onClose?: () => void;
195
+ className?: string;
196
+ }
197
+ declare const Toast: ({ children, variant, placement, autoCloseMs, onClose, className, }: ToastProps) => react_jsx_runtime.JSX.Element | null;
198
+
182
199
  interface BlockQuoteProps {
183
200
  children: ReactNode;
184
201
  className?: string;
@@ -190,14 +207,31 @@ interface HrProps {
190
207
  }
191
208
  declare const Hr: ({ className }: HrProps) => react_jsx_runtime.JSX.Element;
192
209
 
210
+ type ContentBoxVariant = "info" | "warning" | "success" | "danger";
211
+
193
212
  interface ContentBoxProps {
194
213
  children: ReactNode;
195
- variant?: "info" | "warning" | "success" | "danger";
214
+ variant?: ContentBoxVariant;
196
215
  icon?: ReactNode;
197
216
  className?: string;
198
217
  }
199
218
  declare const ContentBox: ({ children, variant, icon, className, }: ContentBoxProps) => react_jsx_runtime.JSX.Element;
200
219
 
220
+ interface DetailsPanelProps {
221
+ /** Label / title row for the native `<summary>` element. */
222
+ summary: ReactNode;
223
+ /** Shown when the panel is expanded (native `<details>` body). */
224
+ children: ReactNode;
225
+ variant?: ContentBoxVariant;
226
+ /** Optional icon before the summary text (ContentBox-style affordance, inline). */
227
+ icon?: ReactNode;
228
+ /** Initial open state; panel remains toggleable (state synced via `onToggle`). */
229
+ defaultOpen?: boolean;
230
+ className?: string;
231
+ id?: string;
232
+ }
233
+ declare const DetailsPanel: ({ summary, children, variant, icon, defaultOpen, className, id, }: DetailsPanelProps) => react_jsx_runtime.JSX.Element;
234
+
201
235
  interface ContainerProps {
202
236
  children: ReactNode;
203
237
  size?: "sm" | "md" | "lg" | "xl" | "full";
@@ -295,4 +329,4 @@ declare const TwitterIcon: ({ className, size, withWrapper, }: SocialIconProps)
295
329
  declare const LinkedInIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
296
330
  declare const InstagramIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
297
331
 
298
- export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, TwitterIcon, Warning, type WarningProps };
332
+ export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, DetailsPanel, type DetailsPanelProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, Toast, type ToastPlacement, type ToastProps, type ToastVariant, TwitterIcon, Warning, type WarningProps };
package/dist/index.d.ts CHANGED
@@ -179,6 +179,23 @@ interface SpinnerOverlayProps extends SpinnerProps {
179
179
  }
180
180
  declare const SpinnerOverlay: ({ isVisible, size, className, }: SpinnerOverlayProps) => react_jsx_runtime.JSX.Element | null;
181
181
 
182
+ type ToastVariant = "danger" | "success" | "info";
183
+ type ToastPlacement = "top-left" | "top-right" | "bottom-left" | "bottom-right";
184
+ interface ToastProps {
185
+ children: ReactNode;
186
+ variant?: ToastVariant;
187
+ placement?: ToastPlacement;
188
+ /**
189
+ * Time in milliseconds before the toast dismisses itself.
190
+ * Pass `0` to disable auto-close. Default: `5000`.
191
+ */
192
+ autoCloseMs?: number;
193
+ /** Called after the user closes the toast or auto-close fires. */
194
+ onClose?: () => void;
195
+ className?: string;
196
+ }
197
+ declare const Toast: ({ children, variant, placement, autoCloseMs, onClose, className, }: ToastProps) => react_jsx_runtime.JSX.Element | null;
198
+
182
199
  interface BlockQuoteProps {
183
200
  children: ReactNode;
184
201
  className?: string;
@@ -190,14 +207,31 @@ interface HrProps {
190
207
  }
191
208
  declare const Hr: ({ className }: HrProps) => react_jsx_runtime.JSX.Element;
192
209
 
210
+ type ContentBoxVariant = "info" | "warning" | "success" | "danger";
211
+
193
212
  interface ContentBoxProps {
194
213
  children: ReactNode;
195
- variant?: "info" | "warning" | "success" | "danger";
214
+ variant?: ContentBoxVariant;
196
215
  icon?: ReactNode;
197
216
  className?: string;
198
217
  }
199
218
  declare const ContentBox: ({ children, variant, icon, className, }: ContentBoxProps) => react_jsx_runtime.JSX.Element;
200
219
 
220
+ interface DetailsPanelProps {
221
+ /** Label / title row for the native `<summary>` element. */
222
+ summary: ReactNode;
223
+ /** Shown when the panel is expanded (native `<details>` body). */
224
+ children: ReactNode;
225
+ variant?: ContentBoxVariant;
226
+ /** Optional icon before the summary text (ContentBox-style affordance, inline). */
227
+ icon?: ReactNode;
228
+ /** Initial open state; panel remains toggleable (state synced via `onToggle`). */
229
+ defaultOpen?: boolean;
230
+ className?: string;
231
+ id?: string;
232
+ }
233
+ declare const DetailsPanel: ({ summary, children, variant, icon, defaultOpen, className, id, }: DetailsPanelProps) => react_jsx_runtime.JSX.Element;
234
+
201
235
  interface ContainerProps {
202
236
  children: ReactNode;
203
237
  size?: "sm" | "md" | "lg" | "xl" | "full";
@@ -295,4 +329,4 @@ declare const TwitterIcon: ({ className, size, withWrapper, }: SocialIconProps)
295
329
  declare const LinkedInIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
296
330
  declare const InstagramIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
297
331
 
298
- export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, TwitterIcon, Warning, type WarningProps };
332
+ export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, DetailsPanel, type DetailsPanelProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, Toast, type ToastPlacement, type ToastProps, type ToastVariant, TwitterIcon, Warning, type WarningProps };
package/dist/index.js CHANGED
@@ -1012,6 +1012,93 @@ var SpinnerOverlay = ({
1012
1012
  }
1013
1013
  );
1014
1014
  };
1015
+
1016
+ // src/components/contentBoxVariants.ts
1017
+ var contentBoxVariantBorderClasses = {
1018
+ info: "border-blue",
1019
+ warning: "border-warning",
1020
+ success: "border-success",
1021
+ danger: "border-danger"
1022
+ };
1023
+ var placementClassNames = {
1024
+ "top-left": "top-5 left-5",
1025
+ "top-right": "top-5 right-5",
1026
+ "bottom-left": "bottom-5 left-5",
1027
+ "bottom-right": "bottom-5 right-5"
1028
+ };
1029
+ function CloseIcon({ className = "" }) {
1030
+ return /* @__PURE__ */ jsx(
1031
+ "svg",
1032
+ {
1033
+ width: 16,
1034
+ height: 16,
1035
+ viewBox: "0 0 16 16",
1036
+ fill: "none",
1037
+ xmlns: "http://www.w3.org/2000/svg",
1038
+ className,
1039
+ "aria-hidden": true,
1040
+ children: /* @__PURE__ */ jsx(
1041
+ "path",
1042
+ {
1043
+ d: "M4 4L12 12M12 4L4 12",
1044
+ stroke: "currentColor",
1045
+ strokeWidth: "2",
1046
+ strokeLinecap: "round"
1047
+ }
1048
+ )
1049
+ }
1050
+ );
1051
+ }
1052
+ var Toast = ({
1053
+ children,
1054
+ variant = "info",
1055
+ placement = "bottom-right",
1056
+ autoCloseMs = 5e3,
1057
+ onClose,
1058
+ className = ""
1059
+ }) => {
1060
+ const [open, setOpen] = useState(true);
1061
+ const onCloseRef = useRef(onClose);
1062
+ onCloseRef.current = onClose;
1063
+ const dismiss = useCallback(() => {
1064
+ setOpen(false);
1065
+ onCloseRef.current?.();
1066
+ }, []);
1067
+ useEffect(() => {
1068
+ if (!open || autoCloseMs <= 0) {
1069
+ return;
1070
+ }
1071
+ const id = window.setTimeout(dismiss, autoCloseMs);
1072
+ return () => window.clearTimeout(id);
1073
+ }, [open, autoCloseMs, dismiss]);
1074
+ if (!open) {
1075
+ return null;
1076
+ }
1077
+ const border = contentBoxVariantBorderClasses[variant];
1078
+ const live = variant === "danger" ? "assertive" : "polite";
1079
+ const role = variant === "danger" ? "alert" : "status";
1080
+ return /* @__PURE__ */ jsxs(
1081
+ "div",
1082
+ {
1083
+ role,
1084
+ "aria-live": live,
1085
+ className: `fixed z-50 flex max-w-sm gap-3 rounded-md border-2 bg-darkgray p-5 text-md text-white shadow-lg dark:bg-gray ${placementClassNames[placement]} ${border} ${className}`,
1086
+ children: [
1087
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children }),
1088
+ /* @__PURE__ */ jsx(
1089
+ "button",
1090
+ {
1091
+ type: "button",
1092
+ onClick: dismiss,
1093
+ className: "shrink-0 rounded-sm p-2 text-icongray transition-colors hover:bg-white/10 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue",
1094
+ "aria-label": "Close",
1095
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
1096
+ }
1097
+ )
1098
+ ]
1099
+ }
1100
+ );
1101
+ };
1015
1102
  var BlockQuote = ({ children, className = "" }) => {
1016
1103
  return /* @__PURE__ */ jsx(
1017
1104
  "blockquote",
@@ -1025,12 +1112,6 @@ var Hr = ({ className = "" }) => {
1025
1112
  const defaultClassNames = "border border-gray my-4";
1026
1113
  return /* @__PURE__ */ jsx("hr", { className: `${defaultClassNames} ${className}` });
1027
1114
  };
1028
- var variantStyles = {
1029
- info: "border-blue",
1030
- warning: "border-warning",
1031
- success: "border-success",
1032
- danger: "border-danger"
1033
- };
1034
1115
  var ContentBox = ({
1035
1116
  children,
1036
1117
  variant = "info",
@@ -1040,7 +1121,7 @@ var ContentBox = ({
1040
1121
  return /* @__PURE__ */ jsxs(
1041
1122
  "div",
1042
1123
  {
1043
- className: `relative border rounded-md my-9 ${variantStyles[variant]} ${className}`,
1124
+ className: `relative border rounded-md my-9 ${contentBoxVariantBorderClasses[variant]} ${className}`,
1044
1125
  children: [
1045
1126
  icon && /* @__PURE__ */ jsx("div", { className: "absolute flex items-center justify-center p-3 -top-6 right-8 bg-primary border border-darkgray", children: icon }),
1046
1127
  /* @__PURE__ */ jsx("div", { className: "m-7", children })
@@ -1048,6 +1129,65 @@ var ContentBox = ({
1048
1129
  }
1049
1130
  );
1050
1131
  };
1132
+ function ChevronDown2({ className = "" }) {
1133
+ return /* @__PURE__ */ jsx(
1134
+ "svg",
1135
+ {
1136
+ width: 20,
1137
+ height: 20,
1138
+ viewBox: "0 0 20 20",
1139
+ fill: "none",
1140
+ xmlns: "http://www.w3.org/2000/svg",
1141
+ className,
1142
+ "aria-hidden": true,
1143
+ children: /* @__PURE__ */ jsx(
1144
+ "path",
1145
+ {
1146
+ d: "M5 7.5L10 12.5L15 7.5",
1147
+ stroke: "currentColor",
1148
+ strokeWidth: "1.5",
1149
+ strokeLinecap: "round",
1150
+ strokeLinejoin: "round"
1151
+ }
1152
+ )
1153
+ }
1154
+ );
1155
+ }
1156
+ var DetailsPanel = ({
1157
+ summary,
1158
+ children,
1159
+ variant = "info",
1160
+ icon,
1161
+ defaultOpen = false,
1162
+ className = "",
1163
+ id
1164
+ }) => {
1165
+ const border = contentBoxVariantBorderClasses[variant];
1166
+ const [open, setOpen] = useState(defaultOpen);
1167
+ return /* @__PURE__ */ jsxs(
1168
+ "details",
1169
+ {
1170
+ id,
1171
+ className: `group relative border rounded-md my-9 ${border} ${className}`,
1172
+ open,
1173
+ onToggle: (e) => setOpen(e.currentTarget.open),
1174
+ children: [
1175
+ /* @__PURE__ */ jsxs(
1176
+ "summary",
1177
+ {
1178
+ className: "flex cursor-pointer list-none items-center gap-3 p-7 text-white outline-none transition-colors hover:bg-darkgray/40 dark:hover:bg-white/5 focus-visible:ring-2 focus-visible:ring-blue group-open:pb-3 [&::-webkit-details-marker]:hidden",
1179
+ children: [
1180
+ /* @__PURE__ */ jsx(ChevronDown2, { className: "size-5 shrink-0 text-icongray transition-transform group-open:rotate-180" }),
1181
+ icon ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: icon }) : null,
1182
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 text-md font-medium text-white dark:text-white", children: summary })
1183
+ ]
1184
+ }
1185
+ ),
1186
+ /* @__PURE__ */ jsx("div", { className: "border-t border-gray px-7 pb-7 pt-3 dark:border-gray", children })
1187
+ ]
1188
+ }
1189
+ );
1190
+ };
1051
1191
  var sizeStyles2 = {
1052
1192
  sm: "max-w-screen-sm",
1053
1193
  md: "max-w-screen-md",
@@ -1580,6 +1720,6 @@ var InstagramIcon = ({
1580
1720
  return icon;
1581
1721
  };
1582
1722
 
1583
- export { BlockQuote, Button, ButtonTransparent, Container, ContentBox, GradientButton, Grid, GridItem, Heading, Heart, Hr, Info, Input, InstagramIcon, LinkedInIcon, RadioButtons, Search, Select, Share, Spinner, SpinnerOverlay, Stack, Tabs, Tag, Text, Textarea, TwitterIcon, Warning };
1723
+ export { BlockQuote, Button, ButtonTransparent, Container, ContentBox, DetailsPanel, GradientButton, Grid, GridItem, Heading, Heart, Hr, Info, Input, InstagramIcon, LinkedInIcon, RadioButtons, Search, Select, Share, Spinner, SpinnerOverlay, Stack, Tabs, Tag, Text, Textarea, Toast, TwitterIcon, Warning };
1584
1724
  //# sourceMappingURL=index.js.map
1585
1725
  //# sourceMappingURL=index.js.map