@aortl/admin-react 0.6.0 → 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
@@ -1166,6 +1166,117 @@ 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, 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
1169
1280
  //#region src/Table.tsx
1170
1281
  function TableRoot({ striped, bordered, relaxed, sticky, className, ...rest }) {
1171
1282
  return /* @__PURE__ */ jsx("table", {
@@ -1395,6 +1506,6 @@ var Sidebar = Object.assign(SidebarRoot, {
1395
1506
  CollapseToggle: SidebarCollapseToggle
1396
1507
  });
1397
1508
  //#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 };
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 };
1399
1510
 
1400
1511
  //# sourceMappingURL=index.mjs.map