@momoi-labs/kiso-react 0.37.0 → 0.38.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/alert.d.ts CHANGED
@@ -11,11 +11,12 @@ type AlertLabels = {
11
11
  hide?: string;
12
12
  dismiss?: string;
13
13
  };
14
- declare function Alert({ className, variant, appearance, tape, animated, pulse, placement, onDismiss, labels, role, ref, children, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
14
+ declare function Alert({ className, variant, appearance, tape, animated, pulse, placement, side, onDismiss, labels, role, ref, children, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
15
15
  tape?: AlertTape;
16
16
  animated?: boolean;
17
17
  pulse?: boolean;
18
18
  placement?: "inline" | "overlay";
19
+ side?: "top" | "middle" | "bottom";
19
20
  onDismiss?: () => void;
20
21
  labels?: AlertLabels;
21
22
  }): React.JSX.Element;
package/dist/alert.js CHANGED
@@ -47,7 +47,7 @@ function useOverlaySlot(overlay, id) {
47
47
  return { hidden: overlay && index !== -1 && !top, more: overlay && top ? stack.length - 1 : 0 };
48
48
  }
49
49
  const AlertDetailsContext = React.createContext(null);
50
- function Alert({ className, variant = "info", appearance = "tinted", tape, animated = false, pulse = false, placement = "inline", onDismiss, labels, role, ref, children, ...props }) {
50
+ function Alert({ className, variant = "info", appearance = "tinted", tape, animated = false, pulse = false, placement = "inline", side = "top", onDismiss, labels, role, ref, children, ...props }) {
51
51
  const severity = variant ?? "info";
52
52
  const loud = appearance === "loud";
53
53
  const id = React.useId();
@@ -84,7 +84,7 @@ function Alert({ className, variant = "info", appearance = "tinted", tape, anima
84
84
  });
85
85
  }
86
86
  const resolvedTape = tape ?? (severity === "error" || severity === "warning" ? "top" : "none");
87
- const alert = (_jsxs("div", { ref: setRef, "data-slot": "alert", "data-variant": variant, "data-appearance": appearance, "data-placement": placement, "data-tape": loud ? resolvedTape : undefined, "data-animated": loud && animated ? "true" : undefined, "data-pulse": loud && pulse ? "true" : undefined, role: role ?? (severity === "error" ? "alert" : "status"), hidden: hidden || undefined, className: cn(alertVariants({ variant, appearance }), placement === "overlay" && "alert-overlay", className), ...props, children: [loud && _jsx(LoudMark, { variant: severity }), _jsx(AlertDetailsContext.Provider, { value: { id: detailsId, open }, children: children }), (hasDetails || onDismiss || more > 0) && (_jsxs("div", { "data-slot": "alert-actions", className: "alert-actions", children: [more > 0 && (_jsxs("span", { className: "alert-count", "aria-label": `${more} more ${more === 1 ? "alert" : "alerts"}`, children: ["+", more] })), hasDetails && (_jsxs(Button, { size: "xs", className: "alert-details-toggle", "aria-expanded": open, "aria-controls": detailsId, onClick: () => setOpen((value) => !value), children: [_jsx(ChevronDown, { className: "icon icon-sm", "aria-hidden": "true" }), open ? (labels?.hide ?? "Hide details") : (labels?.show ?? "Details")] })), onDismiss && (_jsx(Button, { className: "btn-icon", size: "sm", variant: "ghost", "aria-label": labels?.dismiss ?? "Dismiss", onClick: dismiss, children: _jsx(X, { className: "icon icon-sm", "aria-hidden": "true" }) }))] }))] }));
87
+ const alert = (_jsxs("div", { ref: setRef, "data-slot": "alert", "data-variant": variant, "data-appearance": appearance, "data-placement": placement, "data-side": placement === "overlay" ? side : undefined, "data-tape": loud ? resolvedTape : undefined, "data-animated": loud && animated ? "true" : undefined, "data-pulse": loud && pulse ? "true" : undefined, role: role ?? (severity === "error" ? "alert" : "status"), hidden: hidden || undefined, className: cn(alertVariants({ variant, appearance }), placement === "overlay" && "alert-overlay", className), ...props, children: [loud && _jsx(LoudMark, { variant: severity }), _jsx(AlertDetailsContext.Provider, { value: { id: detailsId, open }, children: children }), (hasDetails || onDismiss || more > 0) && (_jsxs("div", { "data-slot": "alert-actions", className: "alert-actions", children: [more > 0 && (_jsxs("span", { className: "alert-count", "aria-label": `${more} more ${more === 1 ? "alert" : "alerts"}`, children: ["+", more] })), hasDetails && (_jsxs(Button, { size: "xs", className: "alert-details-toggle", "aria-expanded": open, "aria-controls": detailsId, onClick: () => setOpen((value) => !value), children: [_jsx(ChevronDown, { className: "icon icon-sm", "aria-hidden": "true" }), open ? (labels?.hide ?? "Hide details") : (labels?.show ?? "Details")] })), onDismiss && (_jsx(Button, { className: "btn-icon", size: "sm", variant: "ghost", "aria-label": labels?.dismiss ?? "Dismiss", onClick: dismiss, children: _jsx(X, { className: "icon icon-sm", "aria-hidden": "true" }) }))] }))] }));
88
88
  return placement === "overlay" ? _jsx(PortalPrimitive.Root, { asChild: true, children: alert }) : alert;
89
89
  }
90
90
  function AlertContent({ className, ...props }) {
package/dist/app-shell.js CHANGED
@@ -64,7 +64,7 @@ function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationL
64
64
  useIsomorphicLayoutEffect(() => {
65
65
  const sidebar = sidebarRef.current;
66
66
  const focused = sidebar?.ownerDocument.activeElement;
67
- if (isCollapsed && focused && sidebar?.contains(focused) && !focused.getClientRects().length) {
67
+ if (isCollapsed && focused && sidebar?.contains(focused) && (!focused.getClientRects().length || sidebar.ownerDocument.defaultView?.getComputedStyle(focused).visibility === "hidden")) {
68
68
  toggleRef.current?.focus();
69
69
  }
70
70
  }, [isCollapsed]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoi-labs/kiso-react",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Kiso React components built with shadcn/ui and Radix",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "prepack": "npm run build"
33
33
  },
34
34
  "dependencies": {
35
- "@momoi-labs/kiso": "^1.15.0",
35
+ "@momoi-labs/kiso": "^1.16.0",
36
36
  "class-variance-authority": "0.7.1",
37
37
  "clsx": "2.1.1",
38
38
  "radix-ui": "1.6.7",