@aortl/admin-react 0.5.2 → 0.7.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.mjs CHANGED
@@ -696,18 +696,18 @@ function CardContainer({ bordered, compact, className, ...rest }) {
696
696
  * an optional title (with icon), description, children, and actions. For
697
697
  * anything outside that shape, use `<Card.Container>` and compose by hand.
698
698
  */
699
- function CardRoot({ bordered, compact, icon, title, description, actions, className, children, ...rest }) {
700
- const hasTitle = icon !== void 0 || title !== void 0;
699
+ function CardRoot({ bordered, compact, icon, title, description, toolbar, actions, className, children, ...rest }) {
700
+ const titleEl = icon !== void 0 || title !== void 0 ? /* @__PURE__ */ jsx(CardTitle, {
701
+ icon,
702
+ children: title
703
+ }) : null;
701
704
  return /* @__PURE__ */ jsx(CardContainer, {
702
705
  bordered,
703
706
  compact,
704
707
  className,
705
708
  ...rest,
706
709
  children: /* @__PURE__ */ jsxs(CardBody, { children: [
707
- hasTitle ? /* @__PURE__ */ jsx(CardTitle, {
708
- icon,
709
- children: title
710
- }) : null,
710
+ toolbar !== void 0 ? /* @__PURE__ */ jsxs(CardHeader, { children: [titleEl, /* @__PURE__ */ jsx(CardToolbar, { children: toolbar })] }) : titleEl,
711
711
  description !== void 0 ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
712
712
  children,
713
713
  actions !== void 0 ? /* @__PURE__ */ jsx(CardActions, { children: actions }) : null
@@ -720,6 +720,18 @@ function CardBody({ className, ...rest }) {
720
720
  ...rest
721
721
  });
722
722
  }
723
+ function CardHeader({ className, ...rest }) {
724
+ return /* @__PURE__ */ jsx("div", {
725
+ className: cn("card-header", className),
726
+ ...rest
727
+ });
728
+ }
729
+ function CardToolbar({ className, ...rest }) {
730
+ return /* @__PURE__ */ jsx("div", {
731
+ className: cn("card-toolbar", className),
732
+ ...rest
733
+ });
734
+ }
723
735
  function CardTitle({ icon, className, children, ...rest }) {
724
736
  return /* @__PURE__ */ jsxs("h3", {
725
737
  className: cn("card-title", className),
@@ -742,6 +754,8 @@ function CardActions({ className, ...rest }) {
742
754
  var Card = Object.assign(CardRoot, {
743
755
  Container: CardContainer,
744
756
  Body: CardBody,
757
+ Header: CardHeader,
758
+ Toolbar: CardToolbar,
745
759
  Title: CardTitle,
746
760
  Description: CardDescription,
747
761
  Actions: CardActions
@@ -1152,6 +1166,117 @@ var Tooltip = Object.assign(TooltipShorthand, {
1152
1166
  Popup: TooltipPopup
1153
1167
  });
1154
1168
  //#endregion
1169
+ //#region src/PropertyList.tsx
1170
+ function CopyGlyph({ className }) {
1171
+ return /* @__PURE__ */ jsxs("svg", {
1172
+ xmlns: "http://www.w3.org/2000/svg",
1173
+ width: "14",
1174
+ height: "14",
1175
+ viewBox: "0 0 24 24",
1176
+ fill: "none",
1177
+ stroke: "currentColor",
1178
+ strokeWidth: "2",
1179
+ strokeLinecap: "round",
1180
+ strokeLinejoin: "round",
1181
+ "aria-hidden": "true",
1182
+ className,
1183
+ children: [/* @__PURE__ */ jsx("path", { d: "M7 7m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" }), /* @__PURE__ */ jsx("path", { d: "M15 7v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })]
1184
+ });
1185
+ }
1186
+ function CheckGlyph({ className }) {
1187
+ return /* @__PURE__ */ jsx("svg", {
1188
+ xmlns: "http://www.w3.org/2000/svg",
1189
+ width: "14",
1190
+ height: "14",
1191
+ viewBox: "0 0 24 24",
1192
+ fill: "none",
1193
+ stroke: "currentColor",
1194
+ strokeWidth: "2",
1195
+ strokeLinecap: "round",
1196
+ strokeLinejoin: "round",
1197
+ "aria-hidden": "true",
1198
+ className,
1199
+ children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5l10 -10" })
1200
+ });
1201
+ }
1202
+ function PropertyListRoot({ striped, copyable, hideIfAllEmpty, title, className, children, ...rest }) {
1203
+ return /* @__PURE__ */ jsxs("section", {
1204
+ className: cn([
1205
+ "property-list",
1206
+ striped && "property-list-striped",
1207
+ copyable && "property-list-copyable",
1208
+ hideIfAllEmpty && "property-list-hide-if-empty"
1209
+ ], className),
1210
+ ...rest,
1211
+ children: [title !== void 0 ? /* @__PURE__ */ jsx("h3", {
1212
+ className: cn("property-list-title", void 0),
1213
+ children: title
1214
+ }) : null, /* @__PURE__ */ jsx("dl", {
1215
+ className: cn("property-list-items", void 0),
1216
+ children
1217
+ })]
1218
+ });
1219
+ }
1220
+ function isEmptyValue(value) {
1221
+ if (value == null) return true;
1222
+ if (typeof value === "string") return value.trim() === "";
1223
+ return false;
1224
+ }
1225
+ function PropertyListItem({ label, value, numeric, copyable, copyValue, children, ...rest }) {
1226
+ if (children !== void 0) return /* @__PURE__ */ jsx(Fragment, { children });
1227
+ const empty = isEmptyValue(value);
1228
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PropertyListLabel, { children: label }), /* @__PURE__ */ jsx(PropertyListValue, {
1229
+ numeric,
1230
+ copyable,
1231
+ empty,
1232
+ copyValue: copyValue ?? (typeof value === "string" ? value : void 0),
1233
+ ...rest,
1234
+ children: empty ? "—" : value
1235
+ })] });
1236
+ }
1237
+ function PropertyListLabel({ className, ...rest }) {
1238
+ return /* @__PURE__ */ jsx("dt", {
1239
+ className: cn("property-list-label", className),
1240
+ ...rest
1241
+ });
1242
+ }
1243
+ function PropertyListValue({ numeric, copyable, empty, copyValue, className, children, ...rest }) {
1244
+ const ddRef = useRef(null);
1245
+ const [copied, setCopied] = useState(false);
1246
+ async function handleCopy() {
1247
+ const text = copyValue ?? ddRef.current?.textContent?.trim() ?? "";
1248
+ if (!text) return;
1249
+ try {
1250
+ await navigator.clipboard.writeText(text);
1251
+ setCopied(true);
1252
+ setTimeout(() => setCopied(false), 1200);
1253
+ } catch {}
1254
+ }
1255
+ return /* @__PURE__ */ jsxs("dd", {
1256
+ ref: ddRef,
1257
+ className: cn([
1258
+ "property-list-value",
1259
+ numeric && "property-list-value-numeric",
1260
+ copyable && "property-list-value-copyable",
1261
+ empty && "property-list-value-empty"
1262
+ ], className),
1263
+ ...rest,
1264
+ children: [children, /* @__PURE__ */ jsxs("button", {
1265
+ type: "button",
1266
+ "aria-label": "Copy",
1267
+ className: cn("property-list-copy", void 0),
1268
+ onClick: handleCopy,
1269
+ "data-copied": copied ? "true" : void 0,
1270
+ children: [/* @__PURE__ */ jsx(CopyGlyph, { className: cn("property-list-copy-icon", void 0) }), /* @__PURE__ */ jsx(CheckGlyph, { className: cn("property-list-copy-icon-copied", void 0) })]
1271
+ })]
1272
+ });
1273
+ }
1274
+ var PropertyList = Object.assign(PropertyListRoot, {
1275
+ Item: PropertyListItem,
1276
+ Label: PropertyListLabel,
1277
+ Value: PropertyListValue
1278
+ });
1279
+ //#endregion
1155
1280
  //#region src/Table.tsx
1156
1281
  function TableRoot({ striped, bordered, relaxed, sticky, className, ...rest }) {
1157
1282
  return /* @__PURE__ */ jsx("table", {
@@ -1381,6 +1506,6 @@ var Sidebar = Object.assign(SidebarRoot, {
1381
1506
  CollapseToggle: SidebarCollapseToggle
1382
1507
  });
1383
1508
  //#endregion
1384
- export { Accordion, AdminRoot, Alert, AppShell, Badge, BrandTile, Breadcrumbs, Button, ButtonGroup, Card, Checkbox, Dialog, Field, FileInput, Footer, Input, InputGroup, Menu, Navbar, Pagination, Progress, Radio, RadioGroup, Select, Sidebar, Spinner, Switch, Table, Tabs, Textarea, Tooltip, getPaginationItems, useAppShell };
1509
+ export { Accordion, AdminRoot, Alert, AppShell, Badge, BrandTile, Breadcrumbs, Button, ButtonGroup, Card, Checkbox, Dialog, Field, FileInput, Footer, Input, InputGroup, Menu, Navbar, Pagination, Progress, PropertyList, Radio, RadioGroup, Select, Sidebar, Spinner, Switch, Table, Tabs, Textarea, Tooltip, getPaginationItems, useAppShell };
1385
1510
 
1386
1511
  //# sourceMappingURL=index.mjs.map