@aortl/admin-react 0.16.2 → 0.17.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
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let clsx = require("clsx");
3
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
4
  let react = require("react");
5
+ let _base_ui_react_avatar = require("@base-ui/react/avatar");
5
6
  let _base_ui_react_button = require("@base-ui/react/button");
6
7
  let _base_ui_react_input = require("@base-ui/react/input");
7
8
  let _base_ui_react_field = require("@base-ui/react/field");
@@ -114,7 +115,7 @@ function renderIcon(icon, size = "1em") {
114
115
  }
115
116
  //#endregion
116
117
  //#region src/Alert.tsx
117
- function AlertRoot({ variant, icon, title, description, className, role, children, ...rest }) {
118
+ function AlertRoot({ variant, icon, title, description, action, className, role, children, ...rest }) {
118
119
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
119
120
  role: role ?? (variant === "danger" || variant === "warning" ? "alert" : "status"),
120
121
  className: cn(["alert", `alert-${variant}`], className),
@@ -123,7 +124,8 @@ function AlertRoot({ variant, icon, title, description, className, role, childre
123
124
  renderIcon(icon),
124
125
  title !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertTitle, { children: title }) : null,
125
126
  description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDescription, { children: description }) : null,
126
- children
127
+ children,
128
+ action !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertAction, { children: action }) : null
127
129
  ]
128
130
  });
129
131
  }
@@ -139,9 +141,16 @@ function AlertDescription({ className, ...rest }) {
139
141
  ...rest
140
142
  });
141
143
  }
144
+ function AlertAction({ className, ...rest }) {
145
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
146
+ className: cn("alert-action", className),
147
+ ...rest
148
+ });
149
+ }
142
150
  var Alert = Object.assign(AlertRoot, {
143
151
  Title: AlertTitle,
144
- Description: AlertDescription
152
+ Description: AlertDescription,
153
+ Action: AlertAction
145
154
  });
146
155
  //#endregion
147
156
  //#region src/AppShell.tsx
@@ -189,25 +198,97 @@ function AppShellMain({ className, ...rest }) {
189
198
  var AppShell = Object.assign(AppShellRoot, { Main: AppShellMain });
190
199
  //#endregion
191
200
  //#region src/Badge.tsx
192
- function Badge({ variant = "neutral", size = "md", icon, className, children, ...rest }) {
201
+ function RemoveIcon() {
202
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
203
+ width: "1em",
204
+ height: "1em",
205
+ viewBox: "0 0 24 24",
206
+ fill: "none",
207
+ stroke: "currentColor",
208
+ strokeWidth: "2",
209
+ strokeLinecap: "round",
210
+ strokeLinejoin: "round",
211
+ "aria-hidden": "true",
212
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
213
+ });
214
+ }
215
+ function Badge({ variant = "neutral", size = "md", icon, soft = false, onRemove, removeLabel = "Remove", className, children, ...rest }) {
193
216
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
194
217
  className: cn([
195
218
  "badge",
196
219
  variant !== "neutral" && `badge-${variant}`,
197
- size !== "md" && `badge-${size}`
220
+ size !== "md" && `badge-${size}`,
221
+ soft && "badge-soft"
198
222
  ], className),
199
223
  ...rest,
200
- children: [renderIcon(icon), children]
224
+ children: [
225
+ renderIcon(icon),
226
+ children,
227
+ onRemove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
228
+ type: "button",
229
+ className: cn("badge-remove", void 0),
230
+ "aria-label": removeLabel,
231
+ onClick: onRemove,
232
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RemoveIcon, {})
233
+ }) : null
234
+ ]
201
235
  });
202
236
  }
203
237
  //#endregion
204
238
  //#region src/BrandTile.tsx
205
- function BrandTile({ monogram, icon, className, children, ...rest }) {
239
+ /**
240
+ * Brand/system mark for the navbar — monogram, icon, or shop logo. Precedence
241
+ * is `src` > `icon` > `monogram`. Monogram/icon tiles are `aria-hidden`; image
242
+ * tiles expose `alt` to assistive tech instead.
243
+ */
244
+ function BrandTile({ variant = "solid", size = "md", monogram, icon, src, alt = "", className, children, ...rest }) {
245
+ const classes = cn([
246
+ "brand-tile",
247
+ variant !== "solid" && `brand-tile-${variant}`,
248
+ size === "lg" && "brand-tile-lg"
249
+ ], className);
250
+ if (src) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
251
+ className: classes,
252
+ ...rest,
253
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
254
+ src,
255
+ alt
256
+ })
257
+ });
206
258
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
207
- className: cn("brand-tile", className),
259
+ className: classes,
208
260
  "aria-hidden": true,
209
261
  ...rest,
210
- children: icon ? renderIcon(icon, 14) : children ?? monogram
262
+ children: icon ? renderIcon(icon) : children ?? monogram
263
+ });
264
+ }
265
+ //#endregion
266
+ //#region src/Avatar.tsx
267
+ /**
268
+ * Image avatar with an initials fallback. Initials show until the image loads
269
+ * (and again, React-only, if it errors); the vanilla CSS layers the `<img>`
270
+ * over the initials instead.
271
+ */
272
+ function Avatar({ src, alt, initials, size = "md", shape = "circle", className, children, ...rest }) {
273
+ const fallback = children ?? initials;
274
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_avatar.Avatar.Root, {
275
+ className: cn([
276
+ "avatar",
277
+ size !== "md" && `avatar-${size}`,
278
+ shape === "square" && "avatar-square"
279
+ ], className),
280
+ ...rest,
281
+ children: [fallback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Fallback, { children: fallback }) : null, src !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Image, {
282
+ src,
283
+ alt
284
+ }) : null]
285
+ });
286
+ }
287
+ /** Overlapping stack of avatars; later children paint on top. */
288
+ function AvatarGroup({ className, ...rest }) {
289
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
290
+ className: cn("avatar-group", className),
291
+ ...rest
211
292
  });
212
293
  }
213
294
  //#endregion
@@ -535,8 +616,8 @@ var Breadcrumbs = Object.assign(BreadcrumbsRoot, {
535
616
  });
536
617
  //#endregion
537
618
  //#region src/Input.tsx
538
- function Input({ variant = "bordered", inputSize = "md", className, type = "text", ...rest }) {
539
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
619
+ function Input({ variant = "bordered", inputSize = "md", icon, iconTrailing, className, type = "text", ...rest }) {
620
+ const input = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
540
621
  type,
541
622
  className: cn([
542
623
  "input",
@@ -545,6 +626,15 @@ function Input({ variant = "bordered", inputSize = "md", className, type = "text
545
626
  ], className),
546
627
  ...rest
547
628
  });
629
+ if (icon == null && iconTrailing == null) return input;
630
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
631
+ className: cn("input-icon", void 0),
632
+ children: [
633
+ renderIcon(icon),
634
+ input,
635
+ renderIcon(iconTrailing)
636
+ ]
637
+ });
548
638
  }
549
639
  //#endregion
550
640
  //#region src/FileInput.tsx
@@ -627,6 +717,20 @@ function Link({ external, icon, iconTrailing, className, target, rel, children,
627
717
  });
628
718
  }
629
719
  //#endregion
720
+ //#region src/Separator.tsx
721
+ /**
722
+ * A styled `<hr>` (implicit `role="separator"`). Margins are zeroed — spacing
723
+ * comes from the parent's gap or margin utilities.
724
+ */
725
+ function Separator({ orientation = "horizontal", className, ...rest }) {
726
+ const vertical = orientation === "vertical";
727
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
728
+ className: cn(["separator", vertical && "separator-vertical"], className),
729
+ "aria-orientation": vertical ? "vertical" : void 0,
730
+ ...rest
731
+ });
732
+ }
733
+ //#endregion
630
734
  //#region src/Pagination.tsx
631
735
  /** Pure (safe during render): previous, numbers/ellipses (`boundaryCount` at each end, `siblingCount` around `page`), next. */
632
736
  function getPaginationItems({ page, total, siblingCount = 1, boundaryCount = 1 }) {
@@ -1018,13 +1122,14 @@ function Container({ size = "md", compact, className, ...rest }) {
1018
1122
  * The bare `.card` container — no body, no title. Use this when you need to
1019
1123
  * compose the internals yourself (e.g. a media block above the body).
1020
1124
  */
1021
- function CardContainer({ variant = "default", bordered, compact, className, ...rest }) {
1125
+ function CardContainer({ variant = "default", bordered, compact, scroll, className, ...rest }) {
1022
1126
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1023
1127
  className: cn([
1024
1128
  "card",
1025
1129
  variant !== "default" && `card-${variant}`,
1026
1130
  bordered && "card-bordered",
1027
- compact && "card-compact"
1131
+ compact && "card-compact",
1132
+ scroll && "card-scroll"
1028
1133
  ], className),
1029
1134
  ...rest
1030
1135
  });
@@ -1034,23 +1139,29 @@ function CardContainer({ variant = "default", bordered, compact, className, ...r
1034
1139
  * an optional title (with icon), description, children, and actions. For
1035
1140
  * anything outside that shape, use `<Card.Container>` and compose by hand.
1036
1141
  */
1037
- function CardRoot({ variant, bordered, compact, icon, title, description, toolbar, actions, className, children, ...rest }) {
1142
+ function CardRoot({ variant, bordered, compact, media, icon, title, description, toolbar, actions, className, children, ...rest }) {
1038
1143
  const titleEl = icon !== void 0 || title !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTitle, {
1039
1144
  icon,
1040
1145
  children: title
1041
1146
  }) : null;
1042
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardContainer, {
1147
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CardContainer, {
1043
1148
  variant,
1044
1149
  bordered,
1045
1150
  compact,
1046
1151
  className,
1047
1152
  ...rest,
1048
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CardBody, { children: [
1153
+ children: [media !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardMedia, { children: media }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CardBody, { children: [
1049
1154
  toolbar !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CardHeader, { children: [titleEl, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardToolbar, { children: toolbar })] }) : titleEl,
1050
1155
  description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardDescription, { children: description }) : null,
1051
1156
  children,
1052
1157
  actions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardActions, { children: actions }) : null
1053
- ] })
1158
+ ] })]
1159
+ });
1160
+ }
1161
+ function CardMedia({ className, ...rest }) {
1162
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1163
+ className: cn("card-media", className),
1164
+ ...rest
1054
1165
  });
1055
1166
  }
1056
1167
  function CardBody({ className, ...rest }) {
@@ -1092,6 +1203,7 @@ function CardActions({ className, ...rest }) {
1092
1203
  }
1093
1204
  var Card = Object.assign(CardRoot, {
1094
1205
  Container: CardContainer,
1206
+ Media: CardMedia,
1095
1207
  Body: CardBody,
1096
1208
  Header: CardHeader,
1097
1209
  Toolbar: CardToolbar,
@@ -1989,6 +2101,7 @@ function TableBody({ className, ...rest }) {
1989
2101
  ...rest
1990
2102
  });
1991
2103
  }
2104
+ /** Footer rows are semibold by default; the first row gets a strong top divider against the body. */
1992
2105
  function TableFoot({ className, ...rest }) {
1993
2106
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tfoot", {
1994
2107
  className,
@@ -2197,6 +2310,8 @@ exports.Accordion = Accordion;
2197
2310
  exports.AdminRoot = AdminRoot;
2198
2311
  exports.Alert = Alert;
2199
2312
  exports.AppShell = AppShell;
2313
+ exports.Avatar = Avatar;
2314
+ exports.AvatarGroup = AvatarGroup;
2200
2315
  exports.Badge = Badge;
2201
2316
  exports.BarChart = BarChart;
2202
2317
  exports.BrandTile = BrandTile;
@@ -2228,6 +2343,7 @@ exports.Radio = Radio;
2228
2343
  exports.RadioGroup = RadioGroup;
2229
2344
  exports.SERIES = SERIES;
2230
2345
  exports.Select = Select;
2346
+ exports.Separator = Separator;
2231
2347
  exports.Sidebar = Sidebar;
2232
2348
  exports.Spinner = Spinner;
2233
2349
  exports.StackedBar = StackedBar;