@aortl/admin-react 0.6.0 → 0.7.1

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
@@ -1166,6 +1166,118 @@ var Tooltip = Object.assign(TooltipShorthand, {
1166
1166
  Popup: TooltipPopup
1167
1167
  });
1168
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, compact, copyable, hideIfAllEmpty, title, className, children, ...rest }) {
1203
+ return /* @__PURE__ */ jsxs("section", {
1204
+ className: cn([
1205
+ "property-list",
1206
+ striped && "property-list-striped",
1207
+ compact && "property-list-compact",
1208
+ copyable && "property-list-copyable",
1209
+ hideIfAllEmpty && "property-list-hide-if-empty"
1210
+ ], className),
1211
+ ...rest,
1212
+ children: [title !== void 0 ? /* @__PURE__ */ jsx("h3", {
1213
+ className: cn("property-list-title", void 0),
1214
+ children: title
1215
+ }) : null, /* @__PURE__ */ jsx("dl", {
1216
+ className: cn("property-list-items", void 0),
1217
+ children
1218
+ })]
1219
+ });
1220
+ }
1221
+ function isEmptyValue(value) {
1222
+ if (value == null) return true;
1223
+ if (typeof value === "string") return value.trim() === "";
1224
+ return false;
1225
+ }
1226
+ function PropertyListItem({ label, value, numeric, copyable, copyValue, children, ...rest }) {
1227
+ if (children !== void 0) return /* @__PURE__ */ jsx(Fragment, { children });
1228
+ const empty = isEmptyValue(value);
1229
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PropertyListLabel, { children: label }), /* @__PURE__ */ jsx(PropertyListValue, {
1230
+ numeric,
1231
+ copyable,
1232
+ empty,
1233
+ copyValue: copyValue ?? (typeof value === "string" ? value : void 0),
1234
+ ...rest,
1235
+ children: empty ? "—" : value
1236
+ })] });
1237
+ }
1238
+ function PropertyListLabel({ className, ...rest }) {
1239
+ return /* @__PURE__ */ jsx("dt", {
1240
+ className: cn("property-list-label", className),
1241
+ ...rest
1242
+ });
1243
+ }
1244
+ function PropertyListValue({ numeric, copyable, empty, copyValue, className, children, ...rest }) {
1245
+ const ddRef = useRef(null);
1246
+ const [copied, setCopied] = useState(false);
1247
+ async function handleCopy() {
1248
+ const text = copyValue ?? ddRef.current?.textContent?.trim() ?? "";
1249
+ if (!text) return;
1250
+ try {
1251
+ await navigator.clipboard.writeText(text);
1252
+ setCopied(true);
1253
+ setTimeout(() => setCopied(false), 1200);
1254
+ } catch {}
1255
+ }
1256
+ return /* @__PURE__ */ jsxs("dd", {
1257
+ ref: ddRef,
1258
+ className: cn([
1259
+ "property-list-value",
1260
+ numeric && "property-list-value-numeric",
1261
+ copyable && "property-list-value-copyable",
1262
+ empty && "property-list-value-empty"
1263
+ ], className),
1264
+ ...rest,
1265
+ children: [children, /* @__PURE__ */ jsxs("button", {
1266
+ type: "button",
1267
+ "aria-label": "Copy",
1268
+ className: cn("property-list-copy", void 0),
1269
+ onClick: handleCopy,
1270
+ "data-copied": copied ? "true" : void 0,
1271
+ children: [/* @__PURE__ */ jsx(CopyGlyph, { className: cn("property-list-copy-icon", void 0) }), /* @__PURE__ */ jsx(CheckGlyph, { className: cn("property-list-copy-icon-copied", void 0) })]
1272
+ })]
1273
+ });
1274
+ }
1275
+ var PropertyList = Object.assign(PropertyListRoot, {
1276
+ Item: PropertyListItem,
1277
+ Label: PropertyListLabel,
1278
+ Value: PropertyListValue
1279
+ });
1280
+ //#endregion
1169
1281
  //#region src/Table.tsx
1170
1282
  function TableRoot({ striped, bordered, relaxed, sticky, className, ...rest }) {
1171
1283
  return /* @__PURE__ */ jsx("table", {
@@ -1395,6 +1507,6 @@ var Sidebar = Object.assign(SidebarRoot, {
1395
1507
  CollapseToggle: SidebarCollapseToggle
1396
1508
  });
1397
1509
  //#endregion
1398
- 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 };
1510
+ 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 };
1399
1511
 
1400
1512
  //# sourceMappingURL=index.mjs.map