@aortl/admin-react 0.15.1 → 0.16.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.cjs CHANGED
@@ -158,7 +158,7 @@ var AppShellContext = (0, react.createContext)(null);
158
158
  function useAppShell() {
159
159
  return (0, react.useContext)(AppShellContext);
160
160
  }
161
- function AppShellRoot({ hasSidebar = false, hasFooter = false, mobileDrawerOpen, defaultMobileDrawerOpen = false, onMobileDrawerOpenChange, systemAccent, className, style, children, ...rest }) {
161
+ function AppShellRoot({ hasSidebar = false, mobileDrawerOpen, defaultMobileDrawerOpen = false, onMobileDrawerOpenChange, systemAccent, className, style, children, ...rest }) {
162
162
  const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultMobileDrawerOpen);
163
163
  const isControlled = mobileDrawerOpen !== void 0;
164
164
  const open = isControlled ? mobileDrawerOpen : uncontrolledOpen;
@@ -182,11 +182,7 @@ function AppShellRoot({ hasSidebar = false, hasFooter = false, mobileDrawerOpen,
182
182
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppShellContext.Provider, {
183
183
  value,
184
184
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
185
- className: cn([
186
- "app-shell",
187
- hasSidebar && "app-shell-with-sidebar",
188
- hasFooter && "app-shell-with-footer"
189
- ], className),
185
+ className: cn(["app-shell", hasSidebar && "app-shell-with-sidebar"], className),
190
186
  style: rootStyle,
191
187
  ...rest,
192
188
  children
@@ -210,7 +206,7 @@ function Badge({ variant = "neutral", size = "md", icon, className, children, ..
210
206
  size !== "md" && `badge-${size}`
211
207
  ], className),
212
208
  ...rest,
213
- children: [renderIcon(icon, size === "sm" ? 10 : 12), children]
209
+ children: [renderIcon(icon), children]
214
210
  });
215
211
  }
216
212
  //#endregion
@@ -624,7 +620,7 @@ function InputGroupAddon({ className, ...rest }) {
624
620
  var InputGroup = Object.assign(InputGroupRoot, { Addon: InputGroupAddon });
625
621
  //#endregion
626
622
  //#region src/Indicator.tsx
627
- function Indicator({ label, variant = "neutral", size = "sm", icon, placement = "top-end", offset, className, "aria-label": ariaLabel, children }) {
623
+ function Indicator({ label, variant = "neutral", size = "sm", icon, placement = "top-end", offset, className, "aria-label": ariaLabel, style: styleProp, children, ...rest }) {
628
624
  const [vertical, horizontal] = placement.split("-");
629
625
  const placementClasses = [
630
626
  "indicator-item",
@@ -632,10 +628,14 @@ function Indicator({ label, variant = "neutral", size = "sm", icon, placement =
632
628
  horizontal !== "end" && `indicator-${horizontal}`
633
629
  ];
634
630
  const hasContent = label !== void 0 || icon !== void 0;
635
- const style = offset !== void 0 ? { "--indicator-offset": `${offset}px` } : void 0;
631
+ const style = offset !== void 0 ? {
632
+ ...styleProp,
633
+ "--indicator-offset": `${offset}px`
634
+ } : styleProp;
636
635
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
637
636
  className: cn("indicator", className),
638
637
  style,
638
+ ...rest,
639
639
  children: [hasContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
640
640
  className: cn(placementClasses, void 0),
641
641
  variant,
@@ -909,13 +909,13 @@ function RadioGroup({ orientation = "horizontal", className, ...rest }) {
909
909
  }
910
910
  //#endregion
911
911
  //#region src/Progress.tsx
912
- function Progress({ value, max = 100, variant = "primary", size = "md", className, ...rest }) {
912
+ function Progress({ value, max = 100, variant = "info", size = "md", className, ...rest }) {
913
913
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("progress", {
914
914
  value,
915
915
  max,
916
916
  className: cn([
917
917
  "progress",
918
- variant !== "primary" && `progress-${variant}`,
918
+ variant !== "info" && `progress-${variant}`,
919
919
  size !== "md" && `progress-${size}`
920
920
  ], className),
921
921
  ...rest
@@ -1166,7 +1166,7 @@ var Card = Object.assign(CardRoot, {
1166
1166
  * label/value tables, use `<PropertyList>`.
1167
1167
  */
1168
1168
  function StatCard({ variant = "default", label, value, detail, icon, compact, bordered, className, children, ...rest }) {
1169
- const hasLabel = icon !== void 0 || label !== void 0;
1169
+ const hasLabel = label !== void 0;
1170
1170
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1171
1171
  className: cn([
1172
1172
  "card",
@@ -1271,7 +1271,7 @@ function mergeStyle(vars, incoming) {
1271
1271
  * The bare bar-chart grid — no bars. Compose `<BarChart.Bar>` children by hand
1272
1272
  * (e.g. to interleave a reference line). Sets `role="img"`; pass `aria-label`.
1273
1273
  */
1274
- function BarChartContainer({ orientation = "horizontal", size = "md", showValues, inline, variant = "primary", className, ...rest }) {
1274
+ function BarChartContainer({ orientation = "horizontal", size = "md", showValues, inline, variant = "info", className, ...rest }) {
1275
1275
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1276
1276
  role: "img",
1277
1277
  className: cn([
@@ -1281,7 +1281,7 @@ function BarChartContainer({ orientation = "horizontal", size = "md", showValues
1281
1281
  size !== "md" && `chart-${size}`,
1282
1282
  showValues && "chart-values",
1283
1283
  inline && "chart-inline",
1284
- variant !== "primary" && `chart-${variant}`
1284
+ variant !== "info" && `chart-${variant}`
1285
1285
  ], className),
1286
1286
  ...rest
1287
1287
  });
@@ -1328,7 +1328,7 @@ function Bar({ datum, value, label, color, className, style, ...rest }) {
1328
1328
  * Horizontal by default; pass `orientation="vertical"` for columns. For
1329
1329
  * hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`.
1330
1330
  */
1331
- function BarChartRoot({ data, max, orientation = "horizontal", size = "md", showValues, inline, variant = "primary", style, "aria-label": ariaLabel, ...rest }) {
1331
+ function BarChartRoot({ data, max, orientation = "horizontal", size = "md", showValues, inline, variant = "info", style, "aria-label": ariaLabel, ...rest }) {
1332
1332
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarChartContainer, {
1333
1333
  orientation,
1334
1334
  size,
@@ -1491,10 +1491,15 @@ function DefaultCloseIcon() {
1491
1491
  * Use this when the default `<Dialog>` layout doesn't fit (custom header,
1492
1492
  * media block, multi-step content).
1493
1493
  */
1494
- function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ...rest }) {
1494
+ function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
1495
1495
  const ref = (0, react.useRef)(null);
1496
1496
  const onOpenChangeRef = (0, react.useRef)(onOpenChange);
1497
1497
  onOpenChangeRef.current = onOpenChange;
1498
+ const setRef = (0, react.useCallback)((node) => {
1499
+ ref.current = node;
1500
+ if (typeof consumerRef === "function") consumerRef(node);
1501
+ else if (consumerRef) consumerRef.current = node;
1502
+ }, [consumerRef]);
1498
1503
  (0, react.useEffect)(() => {
1499
1504
  const el = ref.current;
1500
1505
  if (!el || open === void 0) return;
@@ -1513,7 +1518,7 @@ function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", cl
1513
1518
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
1514
1519
  value: ref,
1515
1520
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
1516
- ref,
1521
+ ref: setRef,
1517
1522
  className: cn(["dialog", size !== "md" && `dialog-${size}`], className),
1518
1523
  closedby,
1519
1524
  ...rest,
@@ -1717,14 +1722,23 @@ function MenuPopup({ className, role = "menu", ...rest }) {
1717
1722
  function MenuItem(props) {
1718
1723
  const ref = (0, react.useRef)(null);
1719
1724
  const hotkey = props.hotkey;
1720
- const { ariaKeyShortcuts, primaryChord } = useHotkey(hotkey, () => ref.current?.click(), { enabled: !("disabled" in props && props.disabled) });
1725
+ const ariaDisabled = props["aria-disabled"];
1726
+ const isDisabled = "disabled" in props && props.disabled === true || ariaDisabled === true || ariaDisabled === "true";
1727
+ const { ariaKeyShortcuts, primaryChord } = useHotkey(hotkey, () => ref.current?.click(), { enabled: !isDisabled });
1721
1728
  if (props.href !== void 0) {
1722
- const { className, role = "menuitem", icon, children, hotkey: _hk, ...rest } = props;
1729
+ const { className, role = "menuitem", icon, children, hotkey: _hk, onClick, ...rest } = props;
1723
1730
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
1724
1731
  ref,
1725
1732
  role,
1726
1733
  "aria-keyshortcuts": ariaKeyShortcuts,
1727
1734
  className: cn("menu-item", className),
1735
+ onClick: (event) => {
1736
+ if (isDisabled) {
1737
+ event.preventDefault();
1738
+ return;
1739
+ }
1740
+ onClick?.(event);
1741
+ },
1728
1742
  ...rest,
1729
1743
  children: [
1730
1744
  renderIcon(icon),
@@ -1890,6 +1904,28 @@ function CodeBlock({ nowrap, className, ...rest }) {
1890
1904
  });
1891
1905
  }
1892
1906
  //#endregion
1907
+ //#region src/Prose.tsx
1908
+ /**
1909
+ * A styled container for HTML the system can't annotate with its semantic class
1910
+ * names — backend-rendered markdown, CMS bodies, model output. Styles its
1911
+ * descendant flow elements (`p`, `ul`, `a`, `code`, `blockquote`, `table`, …)
1912
+ * from the design tokens, scoped to this wrapper so the rest of the admin UI
1913
+ * keeps the global element reset.
1914
+ *
1915
+ * ```tsx
1916
+ * <Prose dangerouslySetInnerHTML={{ __html: renderedMarkdown }} />
1917
+ * ```
1918
+ *
1919
+ * Accepts children too — `<Prose><h2>…</h2><p>…</p></Prose>` — for content
1920
+ * authored directly in JSX.
1921
+ */
1922
+ function Prose({ className, ...rest }) {
1923
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1924
+ className: cn("prose", className),
1925
+ ...rest
1926
+ });
1927
+ }
1928
+ //#endregion
1893
1929
  //#region src/Tooltip.tsx
1894
1930
  function TooltipProvider(props) {
1895
1931
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Provider, { ...props });
@@ -2306,6 +2342,7 @@ exports.Navbar = Navbar;
2306
2342
  exports.Pagination = Pagination;
2307
2343
  exports.Progress = Progress;
2308
2344
  exports.PropertyList = PropertyList;
2345
+ exports.Prose = Prose;
2309
2346
  exports.Radio = Radio;
2310
2347
  exports.RadioGroup = RadioGroup;
2311
2348
  exports.SERIES = SERIES;