@orianatech/pire 1.4.0 → 1.4.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.js CHANGED
@@ -3214,7 +3214,7 @@ function Pagination({
3214
3214
  // src/components/navigation/Ribbon.tsx
3215
3215
  import * as React24 from "react";
3216
3216
  import { Tabs as AriaTabs2, TabList as TabList2, Tab as AriaTab2, TabPanel as TabPanel2, Toolbar, Button as Button3 } from "react-aria-components";
3217
- import { jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
3217
+ import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
3218
3218
  var outside = (what, parent) => {
3219
3219
  const Config = () => {
3220
3220
  throw new Error(`[pire] ${what} must be a child of ${parent}.`);
@@ -3288,6 +3288,33 @@ function Group8({ group, selectionCount }) {
3288
3288
  /* @__PURE__ */ jsx44("div", { className: "pire-ribbon-caption", "aria-hidden": "true", children: group.caption })
3289
3289
  ] });
3290
3290
  }
3291
+ function useTrailingOverflow() {
3292
+ const ref = React24.useRef(null);
3293
+ const [overflow, setOverflow] = React24.useState(false);
3294
+ React24.useEffect(() => {
3295
+ const node = ref.current;
3296
+ if (!node) return;
3297
+ const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
3298
+ measure();
3299
+ node.addEventListener("scroll", measure, { passive: true });
3300
+ const resize = new ResizeObserver(measure);
3301
+ resize.observe(node);
3302
+ for (const child of node.children) resize.observe(child);
3303
+ return () => {
3304
+ node.removeEventListener("scroll", measure);
3305
+ resize.disconnect();
3306
+ };
3307
+ }, []);
3308
+ return [ref, overflow];
3309
+ }
3310
+ function Surface({ className, id, label, trailing, children }) {
3311
+ const [scrollRef, overflow] = useTrailingOverflow();
3312
+ const domId = id ? { id } : {};
3313
+ return /* @__PURE__ */ jsxs35(Toolbar, { ...domId, className, "aria-label": label, children: [
3314
+ /* @__PURE__ */ jsx44("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
3315
+ /* @__PURE__ */ jsx44("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
3316
+ ] });
3317
+ }
3291
3318
  function barBlocks(tabs) {
3292
3319
  const blocks = [];
3293
3320
  for (const tab of tabs) {
@@ -3345,7 +3372,6 @@ function Ribbon({
3345
3372
  toggleRef.current?.focus();
3346
3373
  });
3347
3374
  const bandId = React24.useId();
3348
- const bandDomId = { id: bandId };
3349
3375
  const toggle = /* @__PURE__ */ jsx44(
3350
3376
  Button3,
3351
3377
  {
@@ -3364,16 +3390,24 @@ function Ribbon({
3364
3390
  );
3365
3391
  if (collapsed) {
3366
3392
  const blocks = barBlocks(tabs);
3367
- return /* @__PURE__ */ jsx44("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs35(Toolbar, { className: "pire-ribbon-bar", "aria-label": rest["aria-label"], children: [
3368
- leading ? /* @__PURE__ */ jsx44("div", { className: "pire-ribbon-leading", children: leading }) : null,
3369
- blocks.map((block, i) => /* @__PURE__ */ jsxs35(React24.Fragment, { children: [
3370
- i > 0 || leading ? /* @__PURE__ */ jsx44("span", { className: "pire-ribbon-bar-sep" }) : null,
3371
- block.commands.map((c) => /* @__PURE__ */ jsx44(Command, { command: c, selectionCount: count, inBar: true }, c.key))
3372
- ] }, block.key)),
3373
- /* @__PURE__ */ jsx44("span", { className: "pire-ribbon-bar-spacer" }),
3374
- actions,
3375
- toggle
3376
- ] }) });
3393
+ return /* @__PURE__ */ jsx44("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs35(
3394
+ Surface,
3395
+ {
3396
+ className: "pire-ribbon-bar",
3397
+ label: rest["aria-label"],
3398
+ trailing: /* @__PURE__ */ jsxs35(Fragment6, { children: [
3399
+ actions,
3400
+ toggle
3401
+ ] }),
3402
+ children: [
3403
+ leading ? /* @__PURE__ */ jsx44("div", { className: "pire-ribbon-leading", children: leading }) : null,
3404
+ blocks.map((block, i) => /* @__PURE__ */ jsxs35(React24.Fragment, { children: [
3405
+ i > 0 || leading ? /* @__PURE__ */ jsx44("span", { className: "pire-ribbon-bar-sep" }) : null,
3406
+ block.commands.map((c) => /* @__PURE__ */ jsx44(Command, { command: c, selectionCount: count, inBar: true }, c.key))
3407
+ ] }, block.key))
3408
+ ]
3409
+ }
3410
+ ) });
3377
3411
  }
3378
3412
  return /* @__PURE__ */ jsx44("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs35(AriaTabs2, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
3379
3413
  /* @__PURE__ */ jsx44(TabList2, { className: "pire-ribbon-tablist", "aria-label": rest["aria-label"], children: visible.map((tab) => /* @__PURE__ */ jsx44(
@@ -3386,12 +3420,19 @@ function Ribbon({
3386
3420
  },
3387
3421
  tab.key
3388
3422
  )) }),
3389
- visible.map((tab) => /* @__PURE__ */ jsx44(TabPanel2, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ jsxs35(Toolbar, { ...bandDomId, className: "pire-ribbon-band", "aria-label": msg.ribbonLabel, children: [
3390
- tab.groups.map((group) => /* @__PURE__ */ jsx44(Group8, { group, selectionCount: count }, group.key)),
3391
- /* @__PURE__ */ jsx44("span", { className: "pire-ribbon-bar-spacer" }),
3392
- actions,
3393
- toggle
3394
- ] }) }, tab.key))
3423
+ visible.map((tab) => /* @__PURE__ */ jsx44(TabPanel2, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ jsx44(
3424
+ Surface,
3425
+ {
3426
+ id: bandId,
3427
+ className: "pire-ribbon-band",
3428
+ label: msg.ribbonLabel,
3429
+ trailing: /* @__PURE__ */ jsxs35(Fragment6, { children: [
3430
+ actions,
3431
+ toggle
3432
+ ] }),
3433
+ children: tab.groups.map((group) => /* @__PURE__ */ jsx44(Group8, { group, selectionCount: count }, group.key))
3434
+ }
3435
+ ) }, tab.key))
3395
3436
  ] }) });
3396
3437
  }
3397
3438
  Ribbon.Tab = RibbonTab;
@@ -3483,7 +3524,7 @@ function useToast() {
3483
3524
 
3484
3525
  // src/components/data/KpiTile.tsx
3485
3526
  import { Button as AriaButton14 } from "react-aria-components";
3486
- import { Fragment as Fragment6, jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
3527
+ import { Fragment as Fragment7, jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
3487
3528
  function KpiTile({
3488
3529
  label,
3489
3530
  value,
@@ -3499,7 +3540,7 @@ function KpiTile({
3499
3540
  style
3500
3541
  }) {
3501
3542
  const tone = deltaTone ?? (deltaDirection === "down" ? "negative" : "positive");
3502
- const body = /* @__PURE__ */ jsxs38(Fragment6, { children: [
3543
+ const body = /* @__PURE__ */ jsxs38(Fragment7, { children: [
3503
3544
  /* @__PURE__ */ jsxs38("span", { className: "pire-kpi-label", children: [
3504
3545
  icon ? /* @__PURE__ */ jsx47(Icon, { name: icon, size: 16 }) : null,
3505
3546
  label
@@ -4282,7 +4323,7 @@ function SplitPane({
4282
4323
  }
4283
4324
 
4284
4325
  // src/components/patterns/ConfirmDialog.tsx
4285
- import { Fragment as Fragment7, jsx as jsx66, jsxs as jsxs56 } from "react/jsx-runtime";
4326
+ import { Fragment as Fragment8, jsx as jsx66, jsxs as jsxs56 } from "react/jsx-runtime";
4286
4327
  function ConfirmDialog({
4287
4328
  isOpen,
4288
4329
  title,
@@ -4308,7 +4349,7 @@ function ConfirmDialog({
4308
4349
  onClose: onCancel,
4309
4350
  isDismissable: !isBusy,
4310
4351
  showClose: false,
4311
- footer: /* @__PURE__ */ jsxs56(Fragment7, { children: [
4352
+ footer: /* @__PURE__ */ jsxs56(Fragment8, { children: [
4312
4353
  /* @__PURE__ */ jsx66(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
4313
4354
  /* @__PURE__ */ jsx66(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? "Working\u2026" : confirmLabel })
4314
4355
  ] }),
@@ -4341,7 +4382,7 @@ import {
4341
4382
  Header as Header2,
4342
4383
  useFilter
4343
4384
  } from "react-aria-components";
4344
- import { Fragment as Fragment8, jsx as jsx67, jsxs as jsxs57 } from "react/jsx-runtime";
4385
+ import { Fragment as Fragment9, jsx as jsx67, jsxs as jsxs57 } from "react/jsx-runtime";
4345
4386
  var RESULTS_SECTION_KEY = "__pire_results__";
4346
4387
  var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
4347
4388
  function CommandPalette({
@@ -4434,7 +4475,7 @@ function CommandPalette({
4434
4475
  // aria-hidden: the glyphs are a sighted affordance for discovering the keys. A screen
4435
4476
  // reader already announces the listbox semantics that make those keys work, so reading
4436
4477
  // "up arrow down arrow navigate" out loud is noise on every open.
4437
- /* @__PURE__ */ jsx67("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ jsxs57(Fragment8, { children: [
4478
+ /* @__PURE__ */ jsx67("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ jsxs57(Fragment9, { children: [
4438
4479
  /* @__PURE__ */ jsxs57("span", { className: "pire-cp-hint", children: [
4439
4480
  /* @__PURE__ */ jsx67(Kbd, { children: "\u2191" }),
4440
4481
  /* @__PURE__ */ jsx67(Kbd, { children: "\u2193" }),
@@ -4479,7 +4520,7 @@ import {
4479
4520
  Dialog as AriaDialog5,
4480
4521
  useFilter as useFilter2
4481
4522
  } from "react-aria-components";
4482
- import { Fragment as Fragment9, jsx as jsx68, jsxs as jsxs58 } from "react/jsx-runtime";
4523
+ import { Fragment as Fragment10, jsx as jsx68, jsxs as jsxs58 } from "react/jsx-runtime";
4483
4524
  var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
4484
4525
  function AppLauncher({
4485
4526
  sections,
@@ -4522,7 +4563,7 @@ function AppLauncher({
4522
4563
  offset: 0,
4523
4564
  crossOffset: 0,
4524
4565
  containerPadding: 0,
4525
- children: /* @__PURE__ */ jsx68(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs58(Fragment9, { children: [
4566
+ children: /* @__PURE__ */ jsx68(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs58(Fragment10, { children: [
4526
4567
  /* @__PURE__ */ jsxs58("div", { className: "pire-launcher-head", children: [
4527
4568
  /* @__PURE__ */ jsx68("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
4528
4569
  meta ? /* @__PURE__ */ jsx68("span", { className: "pire-launcher-meta", children: meta }) : null