@jirawatpyk/aura-react 5.27.0 → 5.28.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/README.md +5 -0
- package/dist/aura.bundle.js +211 -183
- package/dist/cjs/index.cjs +211 -183
- package/dist/esm/Tag.js +42 -15
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/styles.css +7 -0
- package/dist/styles.layer.css +7 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -4378,21 +4378,146 @@ var FormErrorSummary = React25.forwardRef(
|
|
|
4378
4378
|
);
|
|
4379
4379
|
|
|
4380
4380
|
// src/FilterBar.tsx
|
|
4381
|
-
var
|
|
4381
|
+
var React28 = __toESM(require("react"), 1);
|
|
4382
4382
|
|
|
4383
4383
|
// src/Tag.tsx
|
|
4384
|
+
var React27 = __toESM(require("react"), 1);
|
|
4385
|
+
|
|
4386
|
+
// src/Tooltip.tsx
|
|
4384
4387
|
var React26 = __toESM(require("react"), 1);
|
|
4385
|
-
|
|
4388
|
+
var import_react_dom7 = require("react-dom");
|
|
4389
|
+
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
4390
|
+
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
4391
|
+
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
4392
|
+
const pos = React26.useState(null), mounted = useMounted();
|
|
4393
|
+
function show2(now) {
|
|
4394
|
+
clearTimeout(timer.current);
|
|
4395
|
+
timer.current = setTimeout(
|
|
4396
|
+
function() {
|
|
4397
|
+
set(true);
|
|
4398
|
+
},
|
|
4399
|
+
now ? 0 : props.delay == null ? 400 : props.delay
|
|
4400
|
+
);
|
|
4401
|
+
}
|
|
4402
|
+
function hide() {
|
|
4403
|
+
clearTimeout(timer.current);
|
|
4404
|
+
set(false);
|
|
4405
|
+
}
|
|
4406
|
+
function hideSoon() {
|
|
4407
|
+
clearTimeout(timer.current);
|
|
4408
|
+
timer.current = setTimeout(function() {
|
|
4409
|
+
set(false);
|
|
4410
|
+
}, 120);
|
|
4411
|
+
}
|
|
4412
|
+
React26.useEffect(function() {
|
|
4413
|
+
return function() {
|
|
4414
|
+
clearTimeout(timer.current);
|
|
4415
|
+
};
|
|
4416
|
+
}, []);
|
|
4417
|
+
function place() {
|
|
4418
|
+
if (!anchor.current || !tip.current) return;
|
|
4419
|
+
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
4420
|
+
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
4421
|
+
let side = props.side || "top";
|
|
4422
|
+
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
4423
|
+
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
4424
|
+
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
4425
|
+
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
4426
|
+
const clampX = function(x) {
|
|
4427
|
+
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
4428
|
+
};
|
|
4429
|
+
const clampY = function(y) {
|
|
4430
|
+
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
4431
|
+
};
|
|
4432
|
+
let top, left;
|
|
4433
|
+
if (side === "top" || side === "bottom") {
|
|
4434
|
+
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
4435
|
+
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
4436
|
+
} else {
|
|
4437
|
+
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
4438
|
+
left = clampX(left);
|
|
4439
|
+
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
4440
|
+
}
|
|
4441
|
+
pos[1]({ top, left });
|
|
4442
|
+
}
|
|
4443
|
+
useIsoLayoutEffect(
|
|
4444
|
+
function() {
|
|
4445
|
+
if (!open) return;
|
|
4446
|
+
place();
|
|
4447
|
+
window.addEventListener("scroll", place, true);
|
|
4448
|
+
window.addEventListener("resize", place);
|
|
4449
|
+
return function() {
|
|
4450
|
+
window.removeEventListener("scroll", place, true);
|
|
4451
|
+
window.removeEventListener("resize", place);
|
|
4452
|
+
};
|
|
4453
|
+
},
|
|
4454
|
+
[open, mounted]
|
|
4455
|
+
);
|
|
4456
|
+
React26.useEffect(
|
|
4457
|
+
function() {
|
|
4458
|
+
if (!open) return;
|
|
4459
|
+
function esc(e) {
|
|
4460
|
+
if (e.key === "Escape") hide();
|
|
4461
|
+
}
|
|
4462
|
+
document.addEventListener("keydown", esc);
|
|
4463
|
+
return function() {
|
|
4464
|
+
document.removeEventListener("keydown", esc);
|
|
4465
|
+
};
|
|
4466
|
+
},
|
|
4467
|
+
[open]
|
|
4468
|
+
);
|
|
4469
|
+
const child = React26.Children.only(props.children);
|
|
4470
|
+
const trigger = /* @__PURE__ */ React26.createElement(
|
|
4471
|
+
"span",
|
|
4472
|
+
{
|
|
4473
|
+
ref: anchorMerged,
|
|
4474
|
+
className: "aura-tooltip-anchor",
|
|
4475
|
+
onMouseEnter: function() {
|
|
4476
|
+
show2(false);
|
|
4477
|
+
},
|
|
4478
|
+
onMouseLeave: hideSoon,
|
|
4479
|
+
onFocus: function() {
|
|
4480
|
+
show2(true);
|
|
4481
|
+
},
|
|
4482
|
+
onBlur: hide
|
|
4483
|
+
},
|
|
4484
|
+
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
4485
|
+
);
|
|
4486
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open && mounted ? (0, import_react_dom7.createPortal)(
|
|
4487
|
+
/* @__PURE__ */ React26.createElement(
|
|
4488
|
+
"div",
|
|
4489
|
+
{
|
|
4490
|
+
ref: tip,
|
|
4491
|
+
id,
|
|
4492
|
+
role: "tooltip",
|
|
4493
|
+
onMouseEnter: function() {
|
|
4494
|
+
clearTimeout(timer.current);
|
|
4495
|
+
},
|
|
4496
|
+
onMouseLeave: hideSoon,
|
|
4497
|
+
className: "aura-tooltip aura-tooltip--hoverable",
|
|
4498
|
+
style: { top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 }
|
|
4499
|
+
},
|
|
4500
|
+
props.content
|
|
4501
|
+
),
|
|
4502
|
+
document.body
|
|
4503
|
+
) : null);
|
|
4504
|
+
});
|
|
4505
|
+
|
|
4506
|
+
// src/Tag.tsx
|
|
4507
|
+
function textOf2(node, all) {
|
|
4386
4508
|
if (node == null || typeof node === "boolean") return "";
|
|
4387
4509
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
4388
|
-
if (Array.isArray(node))
|
|
4389
|
-
|
|
4510
|
+
if (Array.isArray(node))
|
|
4511
|
+
return node.map(function(n3) {
|
|
4512
|
+
return textOf2(n3, all);
|
|
4513
|
+
}).join("");
|
|
4514
|
+
if (React27.isValidElement(node)) {
|
|
4390
4515
|
const p = node.props;
|
|
4391
|
-
return p["aria-hidden"] === true || p["aria-hidden"] === "true" ? "" : textOf2(p.children);
|
|
4516
|
+
return !all && (p["aria-hidden"] === true || p["aria-hidden"] === "true") ? "" : textOf2(p.children, all);
|
|
4392
4517
|
}
|
|
4393
4518
|
return "";
|
|
4394
4519
|
}
|
|
4395
|
-
var Tag =
|
|
4520
|
+
var Tag = React27.forwardRef(function Tag2(props, ref) {
|
|
4396
4521
|
const t = useStrings();
|
|
4397
4522
|
const selectable = props.onClick != null || props.selected != null;
|
|
4398
4523
|
const rest = omit(props, [
|
|
@@ -4405,12 +4530,32 @@ var Tag = React26.forwardRef(function Tag2(props, ref) {
|
|
|
4405
4530
|
"removeLabel",
|
|
4406
4531
|
"touchHeight"
|
|
4407
4532
|
]);
|
|
4533
|
+
const textRef = React27.useRef(null);
|
|
4534
|
+
const cutState = React27.useState(false), isCut = cutState[0];
|
|
4535
|
+
const check = React27.useCallback(function() {
|
|
4536
|
+
const el = textRef.current;
|
|
4537
|
+
if (el) cutState[1](el.scrollWidth > el.clientWidth + 1);
|
|
4538
|
+
}, []);
|
|
4539
|
+
useIsoLayoutEffect(check);
|
|
4540
|
+
useIsoLayoutEffect(
|
|
4541
|
+
function() {
|
|
4542
|
+
const el = textRef.current;
|
|
4543
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4544
|
+
const ro = new ResizeObserver(check);
|
|
4545
|
+
ro.observe(el);
|
|
4546
|
+
return function() {
|
|
4547
|
+
ro.disconnect();
|
|
4548
|
+
};
|
|
4549
|
+
},
|
|
4550
|
+
[check]
|
|
4551
|
+
);
|
|
4552
|
+
const fullText = isCut ? textOf2(props.children, true).replace(/\s+/g, " ").trim() : "";
|
|
4408
4553
|
const inner = [
|
|
4409
|
-
props.icon ? /* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4554
|
+
props.icon ? /* @__PURE__ */ React27.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4555
|
+
/* @__PURE__ */ React27.createElement("span", { key: "t", ref: textRef, className: "aura-tag__text", title: fullText || void 0 }, props.children)
|
|
4411
4556
|
];
|
|
4412
4557
|
if (selectable) {
|
|
4413
|
-
return /* @__PURE__ */
|
|
4558
|
+
return /* @__PURE__ */ React27.createElement(
|
|
4414
4559
|
"button",
|
|
4415
4560
|
{
|
|
4416
4561
|
...rest,
|
|
@@ -4425,7 +4570,7 @@ var Tag = React26.forwardRef(function Tag2(props, ref) {
|
|
|
4425
4570
|
props.className
|
|
4426
4571
|
)
|
|
4427
4572
|
},
|
|
4428
|
-
props.selected ? /* @__PURE__ */
|
|
4573
|
+
props.selected ? /* @__PURE__ */ React27.createElement(Icon, { name: /* @__PURE__ */ React27.createElement(IconCheck, null), size: 14 }) : inner[0],
|
|
4429
4574
|
inner[1]
|
|
4430
4575
|
);
|
|
4431
4576
|
}
|
|
@@ -4435,29 +4580,32 @@ var Tag = React26.forwardRef(function Tag2(props, ref) {
|
|
|
4435
4580
|
"tag-remove-label",
|
|
4436
4581
|
'Tag: the remove button has no name \u2014 its children have no text. Pass removeLabel (e.g. "Remove Acme AB").'
|
|
4437
4582
|
);
|
|
4438
|
-
return /* @__PURE__ */
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4583
|
+
return /* @__PURE__ */ React27.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? function() {
|
|
4584
|
+
const btn = /* @__PURE__ */ React27.createElement(
|
|
4585
|
+
"button",
|
|
4586
|
+
{
|
|
4587
|
+
type: "button",
|
|
4588
|
+
className: "aura-tag__remove",
|
|
4589
|
+
"aria-label": props.removeLabel || t.remove(name),
|
|
4590
|
+
onClick: props.onRemove
|
|
4591
|
+
},
|
|
4592
|
+
/* @__PURE__ */ React27.createElement(Icon, { name: /* @__PURE__ */ React27.createElement(IconX, null), size: 12 })
|
|
4593
|
+
);
|
|
4594
|
+
return /* @__PURE__ */ React27.createElement(Tooltip, { content: fullText, open: fullText ? void 0 : false }, btn);
|
|
4595
|
+
}() : null);
|
|
4448
4596
|
});
|
|
4449
4597
|
|
|
4450
4598
|
// src/FilterBar.tsx
|
|
4451
|
-
var FilterBar =
|
|
4599
|
+
var FilterBar = React28.forwardRef(function FilterBar2(props, ref) {
|
|
4452
4600
|
const t = useStrings();
|
|
4453
4601
|
const id = uid();
|
|
4454
4602
|
const hasSearch = !!props.onSearchChange;
|
|
4455
|
-
const draft =
|
|
4456
|
-
const timer =
|
|
4457
|
-
const sent =
|
|
4458
|
-
const onChange =
|
|
4603
|
+
const draft = React28.useState(props.search || "");
|
|
4604
|
+
const timer = React28.useRef(null);
|
|
4605
|
+
const sent = React28.useRef(props.search || "");
|
|
4606
|
+
const onChange = React28.useRef(props.onSearchChange);
|
|
4459
4607
|
onChange.current = props.onSearchChange;
|
|
4460
|
-
|
|
4608
|
+
React28.useEffect(
|
|
4461
4609
|
function() {
|
|
4462
4610
|
if ((props.search || "") !== sent.current) {
|
|
4463
4611
|
sent.current = props.search || "";
|
|
@@ -4466,7 +4614,7 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4466
4614
|
},
|
|
4467
4615
|
[props.search]
|
|
4468
4616
|
);
|
|
4469
|
-
|
|
4617
|
+
React28.useEffect(function() {
|
|
4470
4618
|
return function() {
|
|
4471
4619
|
if (timer.current) clearTimeout(timer.current);
|
|
4472
4620
|
};
|
|
@@ -4491,7 +4639,7 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4491
4639
|
const filters = props.filters || [];
|
|
4492
4640
|
const anything = filters.length > 0 || !!(props.search || draft[0]);
|
|
4493
4641
|
const count = props.resultCount == null ? null : typeof props.resultCount === "number" ? t.results(props.resultCount) : props.resultCount;
|
|
4494
|
-
return /* @__PURE__ */
|
|
4642
|
+
return /* @__PURE__ */ React28.createElement(
|
|
4495
4643
|
"div",
|
|
4496
4644
|
{
|
|
4497
4645
|
ref,
|
|
@@ -4505,7 +4653,7 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4505
4653
|
props.className
|
|
4506
4654
|
)
|
|
4507
4655
|
},
|
|
4508
|
-
/* @__PURE__ */
|
|
4656
|
+
/* @__PURE__ */ React28.createElement("div", { className: "aura-filterbar__row" }, hasSearch ? /* @__PURE__ */ React28.createElement("div", { className: "aura-input has-icon aura-filterbar__search" }, /* @__PURE__ */ React28.createElement(Icon, { name: /* @__PURE__ */ React28.createElement(IconSearch, null), className: "aura-input__icon" }), /* @__PURE__ */ React28.createElement(
|
|
4509
4657
|
"input",
|
|
4510
4658
|
{
|
|
4511
4659
|
id,
|
|
@@ -4526,10 +4674,10 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4526
4674
|
}
|
|
4527
4675
|
}
|
|
4528
4676
|
}
|
|
4529
|
-
), draft[0] ? /* @__PURE__ */
|
|
4677
|
+
), draft[0] ? /* @__PURE__ */ React28.createElement(
|
|
4530
4678
|
IconButton,
|
|
4531
4679
|
{
|
|
4532
|
-
icon: /* @__PURE__ */
|
|
4680
|
+
icon: /* @__PURE__ */ React28.createElement(IconX, null),
|
|
4533
4681
|
label: t.clear((props.searchLabel || t.search).toLowerCase()),
|
|
4534
4682
|
className: "aura-filterbar__clear-search",
|
|
4535
4683
|
onClick: function() {
|
|
@@ -4537,10 +4685,10 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4537
4685
|
send("");
|
|
4538
4686
|
}
|
|
4539
4687
|
}
|
|
4540
|
-
) : null) : null, props.children ? /* @__PURE__ */
|
|
4541
|
-
filters.length || props.onClearAll && anything ? /* @__PURE__ */
|
|
4542
|
-
return /* @__PURE__ */
|
|
4543
|
-
}), props.onClearAll && anything ? /* @__PURE__ */
|
|
4688
|
+
) : null) : null, props.children ? /* @__PURE__ */ React28.createElement("div", { className: "aura-filterbar__controls" }, props.children) : null, /* @__PURE__ */ React28.createElement("span", { className: "aura-filterbar__spacer" }), count != null ? /* @__PURE__ */ React28.createElement("span", { className: "aura-filterbar__count", "aria-live": "polite" }, count) : null, props.actions ? /* @__PURE__ */ React28.createElement("div", { className: "aura-filterbar__actions" }, props.actions) : null),
|
|
4689
|
+
filters.length || props.onClearAll && anything ? /* @__PURE__ */ React28.createElement("div", { className: "aura-filterbar__chips" }, filters.map(function(f) {
|
|
4690
|
+
return /* @__PURE__ */ React28.createElement(Tag, { key: f.id, onRemove: f.onRemove }, f.label);
|
|
4691
|
+
}), props.onClearAll && anything ? /* @__PURE__ */ React28.createElement(
|
|
4544
4692
|
"button",
|
|
4545
4693
|
{
|
|
4546
4694
|
type: "button",
|
|
@@ -4558,11 +4706,11 @@ var FilterBar = React27.forwardRef(function FilterBar2(props, ref) {
|
|
|
4558
4706
|
});
|
|
4559
4707
|
|
|
4560
4708
|
// src/Command.tsx
|
|
4561
|
-
var
|
|
4562
|
-
var
|
|
4709
|
+
var React30 = __toESM(require("react"), 1);
|
|
4710
|
+
var import_react_dom8 = require("react-dom");
|
|
4563
4711
|
|
|
4564
4712
|
// src/useModal.tsx
|
|
4565
|
-
var
|
|
4713
|
+
var React29 = __toESM(require("react"), 1);
|
|
4566
4714
|
var locks = 0;
|
|
4567
4715
|
var savedOverflow = "";
|
|
4568
4716
|
function lockScroll() {
|
|
@@ -4589,11 +4737,11 @@ function tabbable(el) {
|
|
|
4589
4737
|
}
|
|
4590
4738
|
function useModal(open, ref, opts) {
|
|
4591
4739
|
const mounted = useMounted();
|
|
4592
|
-
const prev =
|
|
4740
|
+
const prev = React29.useRef(null);
|
|
4593
4741
|
const o = opts || {};
|
|
4594
|
-
const latest =
|
|
4742
|
+
const latest = React29.useRef(o);
|
|
4595
4743
|
latest.current = o;
|
|
4596
|
-
|
|
4744
|
+
React29.useEffect(
|
|
4597
4745
|
function() {
|
|
4598
4746
|
if (!open || !mounted) return;
|
|
4599
4747
|
prev.current = document.activeElement;
|
|
@@ -4656,21 +4804,21 @@ function Command(props) {
|
|
|
4656
4804
|
const t = useStrings();
|
|
4657
4805
|
const density = useDensity();
|
|
4658
4806
|
const id = uid(), listId = id + "-list";
|
|
4659
|
-
const box =
|
|
4660
|
-
const input =
|
|
4661
|
-
const qState =
|
|
4807
|
+
const box = React30.useRef(null);
|
|
4808
|
+
const input = React30.useRef(null);
|
|
4809
|
+
const qState = React30.useState(""), act = React30.useState(null);
|
|
4662
4810
|
const query = props.query !== void 0 ? props.query : qState[0];
|
|
4663
4811
|
function setQuery(v) {
|
|
4664
4812
|
if (props.query === void 0) qState[1](v);
|
|
4665
4813
|
if (props.onQueryChange) props.onQueryChange(v);
|
|
4666
4814
|
}
|
|
4667
|
-
const openRef =
|
|
4815
|
+
const openRef = React30.useRef(props.open);
|
|
4668
4816
|
openRef.current = props.open;
|
|
4669
4817
|
const close = function() {
|
|
4670
4818
|
props.onOpenChange(false);
|
|
4671
4819
|
};
|
|
4672
4820
|
const modal = useModal(props.open, box, { onEscape: close });
|
|
4673
|
-
|
|
4821
|
+
React30.useEffect(
|
|
4674
4822
|
function() {
|
|
4675
4823
|
if (props.hotkey === false) return;
|
|
4676
4824
|
function onKey2(e) {
|
|
@@ -4686,7 +4834,7 @@ function Command(props) {
|
|
|
4686
4834
|
},
|
|
4687
4835
|
[props.hotkey, props.onOpenChange]
|
|
4688
4836
|
);
|
|
4689
|
-
|
|
4837
|
+
React30.useEffect(
|
|
4690
4838
|
function() {
|
|
4691
4839
|
if (!props.open) {
|
|
4692
4840
|
if (query) setQuery("");
|
|
@@ -4726,7 +4874,7 @@ function Command(props) {
|
|
|
4726
4874
|
const optId = function(i2) {
|
|
4727
4875
|
return id + "-o" + i2;
|
|
4728
4876
|
};
|
|
4729
|
-
|
|
4877
|
+
React30.useEffect(
|
|
4730
4878
|
function() {
|
|
4731
4879
|
if (!box.current || active < 0) return;
|
|
4732
4880
|
const el = box.current.querySelector("#" + CSS.escape(optId(active)));
|
|
@@ -4770,8 +4918,8 @@ function Command(props) {
|
|
|
4770
4918
|
}
|
|
4771
4919
|
if (!modal.ready) return null;
|
|
4772
4920
|
let i = -1;
|
|
4773
|
-
return (0,
|
|
4774
|
-
/* @__PURE__ */
|
|
4921
|
+
return (0, import_react_dom8.createPortal)(
|
|
4922
|
+
/* @__PURE__ */ React30.createElement(
|
|
4775
4923
|
"div",
|
|
4776
4924
|
{
|
|
4777
4925
|
className: "aura-dialog-layer aura-command-layer",
|
|
@@ -4781,8 +4929,8 @@ function Command(props) {
|
|
|
4781
4929
|
e.stopPropagation();
|
|
4782
4930
|
}
|
|
4783
4931
|
},
|
|
4784
|
-
/* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ React30.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }),
|
|
4933
|
+
/* @__PURE__ */ React30.createElement(
|
|
4786
4934
|
"div",
|
|
4787
4935
|
{
|
|
4788
4936
|
ref: box,
|
|
@@ -4792,7 +4940,7 @@ function Command(props) {
|
|
|
4792
4940
|
tabIndex: -1,
|
|
4793
4941
|
className: cx("aura-command", props.className)
|
|
4794
4942
|
},
|
|
4795
|
-
/* @__PURE__ */
|
|
4943
|
+
/* @__PURE__ */ React30.createElement("div", { className: "aura-command__search" }, /* @__PURE__ */ React30.createElement(Icon, { name: /* @__PURE__ */ React30.createElement(IconSearch, null), className: "aura-command__search-icon" }), /* @__PURE__ */ React30.createElement(
|
|
4796
4944
|
"input",
|
|
4797
4945
|
{
|
|
4798
4946
|
ref: input,
|
|
@@ -4815,8 +4963,8 @@ function Command(props) {
|
|
|
4815
4963
|
},
|
|
4816
4964
|
onKeyDown: onKey
|
|
4817
4965
|
}
|
|
4818
|
-
), /* @__PURE__ */
|
|
4819
|
-
/* @__PURE__ */
|
|
4966
|
+
), /* @__PURE__ */ React30.createElement("kbd", { className: "aura-command__kbd" }, "Esc")),
|
|
4967
|
+
/* @__PURE__ */ React30.createElement("div", { className: "aura-command__list", "aria-busy": props.loading || void 0 }, props.loading ? /* @__PURE__ */ React30.createElement("div", { className: "aura-command__loading" }, /* @__PURE__ */ React30.createElement(Icon, { name: /* @__PURE__ */ React30.createElement(IconLoaderCircle, null), className: "aura-spin" }), t.searching) : null, !flat2.length ? props.loading ? null : /* @__PURE__ */ React30.createElement("div", { className: "aura-command__empty" }, props.empty != null ? props.empty : props.emptyText || t.noMatches) : /* @__PURE__ */ React30.createElement(
|
|
4820
4968
|
"div",
|
|
4821
4969
|
{
|
|
4822
4970
|
id: listId,
|
|
@@ -4826,7 +4974,7 @@ function Command(props) {
|
|
|
4826
4974
|
},
|
|
4827
4975
|
groups.map(function(g, gi) {
|
|
4828
4976
|
const gid = id + "-g" + gi;
|
|
4829
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ React30.createElement(
|
|
4830
4978
|
"div",
|
|
4831
4979
|
{
|
|
4832
4980
|
key: g.name || gi,
|
|
@@ -4834,11 +4982,11 @@ function Command(props) {
|
|
|
4834
4982
|
"aria-labelledby": g.name ? gid : void 0,
|
|
4835
4983
|
className: "aura-command__group"
|
|
4836
4984
|
},
|
|
4837
|
-
g.name ? /* @__PURE__ */
|
|
4985
|
+
g.name ? /* @__PURE__ */ React30.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
4838
4986
|
g.items.map(function(it) {
|
|
4839
4987
|
i++;
|
|
4840
4988
|
const n3 = i;
|
|
4841
|
-
return /* @__PURE__ */
|
|
4989
|
+
return /* @__PURE__ */ React30.createElement(
|
|
4842
4990
|
"div",
|
|
4843
4991
|
{
|
|
4844
4992
|
key: it.id,
|
|
@@ -4863,142 +5011,22 @@ function Command(props) {
|
|
|
4863
5011
|
run(it);
|
|
4864
5012
|
}
|
|
4865
5013
|
},
|
|
4866
|
-
it.icon ? /* @__PURE__ */
|
|
4867
|
-
/* @__PURE__ */
|
|
4868
|
-
it.shortcut ? /* @__PURE__ */
|
|
5014
|
+
it.icon ? /* @__PURE__ */ React30.createElement(Icon, { name: it.icon }) : null,
|
|
5015
|
+
/* @__PURE__ */ React30.createElement("span", { className: "aura-command__text" }, /* @__PURE__ */ React30.createElement("span", { className: "aura-command__label", id: it.description ? optId(n3) + "-label" : void 0 }, it.label), it.description ? /* @__PURE__ */ React30.createElement("span", { className: "aura-command__desc", id: optId(n3) + "-desc" }, it.description) : null),
|
|
5016
|
+
it.shortcut ? /* @__PURE__ */ React30.createElement("kbd", { className: "aura-command__kbd", id: it.description ? optId(n3) + "-kbd" : void 0 }, it.shortcut) : null
|
|
4869
5017
|
);
|
|
4870
5018
|
})
|
|
4871
5019
|
);
|
|
4872
5020
|
})
|
|
4873
5021
|
)),
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
5022
|
+
/* @__PURE__ */ React30.createElement("span", { className: "aura-sr-only", role: "status" }, props.loading ? t.searching : query && !flat2.length ? t.noMatches : props.loading === false && query ? t.results(flat2.length) : ""),
|
|
5023
|
+
/* @__PURE__ */ React30.createElement("div", { className: "aura-command__foot", "aria-hidden": true }, t.commandHint, /* @__PURE__ */ React30.createElement("span", { className: "aura-command__mod" }, isMac() ? "\u2318K" : "Ctrl K"))
|
|
4876
5024
|
)
|
|
4877
5025
|
),
|
|
4878
5026
|
document.body
|
|
4879
5027
|
);
|
|
4880
5028
|
}
|
|
4881
5029
|
|
|
4882
|
-
// src/Tooltip.tsx
|
|
4883
|
-
var React30 = __toESM(require("react"), 1);
|
|
4884
|
-
var import_react_dom8 = require("react-dom");
|
|
4885
|
-
var Tooltip = React30.forwardRef(function Tooltip2(props, ref) {
|
|
4886
|
-
const id = uid(), st = React30.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
4887
|
-
const anchor = React30.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React30.useRef(null), timer = React30.useRef(void 0);
|
|
4888
|
-
const pos = React30.useState(null), mounted = useMounted();
|
|
4889
|
-
function show2(now) {
|
|
4890
|
-
clearTimeout(timer.current);
|
|
4891
|
-
timer.current = setTimeout(
|
|
4892
|
-
function() {
|
|
4893
|
-
set(true);
|
|
4894
|
-
},
|
|
4895
|
-
now ? 0 : props.delay == null ? 400 : props.delay
|
|
4896
|
-
);
|
|
4897
|
-
}
|
|
4898
|
-
function hide() {
|
|
4899
|
-
clearTimeout(timer.current);
|
|
4900
|
-
set(false);
|
|
4901
|
-
}
|
|
4902
|
-
function hideSoon() {
|
|
4903
|
-
clearTimeout(timer.current);
|
|
4904
|
-
timer.current = setTimeout(function() {
|
|
4905
|
-
set(false);
|
|
4906
|
-
}, 120);
|
|
4907
|
-
}
|
|
4908
|
-
React30.useEffect(function() {
|
|
4909
|
-
return function() {
|
|
4910
|
-
clearTimeout(timer.current);
|
|
4911
|
-
};
|
|
4912
|
-
}, []);
|
|
4913
|
-
function place() {
|
|
4914
|
-
if (!anchor.current || !tip.current) return;
|
|
4915
|
-
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
4916
|
-
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
4917
|
-
let side = props.side || "top";
|
|
4918
|
-
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
4919
|
-
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
4920
|
-
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
4921
|
-
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
4922
|
-
const clampX = function(x) {
|
|
4923
|
-
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
4924
|
-
};
|
|
4925
|
-
const clampY = function(y) {
|
|
4926
|
-
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
4927
|
-
};
|
|
4928
|
-
let top, left;
|
|
4929
|
-
if (side === "top" || side === "bottom") {
|
|
4930
|
-
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
4931
|
-
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
4932
|
-
} else {
|
|
4933
|
-
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
4934
|
-
left = clampX(left);
|
|
4935
|
-
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
4936
|
-
}
|
|
4937
|
-
pos[1]({ top, left });
|
|
4938
|
-
}
|
|
4939
|
-
useIsoLayoutEffect(
|
|
4940
|
-
function() {
|
|
4941
|
-
if (!open) return;
|
|
4942
|
-
place();
|
|
4943
|
-
window.addEventListener("scroll", place, true);
|
|
4944
|
-
window.addEventListener("resize", place);
|
|
4945
|
-
return function() {
|
|
4946
|
-
window.removeEventListener("scroll", place, true);
|
|
4947
|
-
window.removeEventListener("resize", place);
|
|
4948
|
-
};
|
|
4949
|
-
},
|
|
4950
|
-
[open, mounted]
|
|
4951
|
-
);
|
|
4952
|
-
React30.useEffect(
|
|
4953
|
-
function() {
|
|
4954
|
-
if (!open) return;
|
|
4955
|
-
function esc(e) {
|
|
4956
|
-
if (e.key === "Escape") hide();
|
|
4957
|
-
}
|
|
4958
|
-
document.addEventListener("keydown", esc);
|
|
4959
|
-
return function() {
|
|
4960
|
-
document.removeEventListener("keydown", esc);
|
|
4961
|
-
};
|
|
4962
|
-
},
|
|
4963
|
-
[open]
|
|
4964
|
-
);
|
|
4965
|
-
const child = React30.Children.only(props.children);
|
|
4966
|
-
const trigger = /* @__PURE__ */ React30.createElement(
|
|
4967
|
-
"span",
|
|
4968
|
-
{
|
|
4969
|
-
ref: anchorMerged,
|
|
4970
|
-
className: "aura-tooltip-anchor",
|
|
4971
|
-
onMouseEnter: function() {
|
|
4972
|
-
show2(false);
|
|
4973
|
-
},
|
|
4974
|
-
onMouseLeave: hideSoon,
|
|
4975
|
-
onFocus: function() {
|
|
4976
|
-
show2(true);
|
|
4977
|
-
},
|
|
4978
|
-
onBlur: hide
|
|
4979
|
-
},
|
|
4980
|
-
React30.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
4981
|
-
);
|
|
4982
|
-
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, trigger, open && mounted ? (0, import_react_dom8.createPortal)(
|
|
4983
|
-
/* @__PURE__ */ React30.createElement(
|
|
4984
|
-
"div",
|
|
4985
|
-
{
|
|
4986
|
-
ref: tip,
|
|
4987
|
-
id,
|
|
4988
|
-
role: "tooltip",
|
|
4989
|
-
onMouseEnter: function() {
|
|
4990
|
-
clearTimeout(timer.current);
|
|
4991
|
-
},
|
|
4992
|
-
onMouseLeave: hideSoon,
|
|
4993
|
-
className: "aura-tooltip aura-tooltip--hoverable",
|
|
4994
|
-
style: { top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 }
|
|
4995
|
-
},
|
|
4996
|
-
props.content
|
|
4997
|
-
),
|
|
4998
|
-
document.body
|
|
4999
|
-
) : null);
|
|
5000
|
-
});
|
|
5001
|
-
|
|
5002
5030
|
// src/Dialog.tsx
|
|
5003
5031
|
var React31 = __toESM(require("react"), 1);
|
|
5004
5032
|
var import_react_dom9 = require("react-dom");
|