@oods/components-react 0.3.2 → 0.4.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 +1 -1
- package/dist/chunk-2VEQWKGK.js +1 -0
- package/dist/{chunk-A4T7OOIY.js → chunk-OFTMKX3W.js} +202 -37
- package/dist/{chunk-YCI5AEWL.js → chunk-XEX22E24.js} +4 -3
- package/dist/index.cjs +332 -495
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -9
- package/dist/ported.cjs +207 -373
- package/dist/ported.js +2 -2
- package/dist/status.cjs +22 -342
- package/dist/status.d.cts +1 -35
- package/dist/status.d.ts +1 -35
- package/dist/status.js +1 -1
- package/dist/table.cjs +6 -304
- package/dist/table.js +2 -2
- package/dist/types.d.cts +52 -3
- package/dist/types.d.ts +52 -3
- package/evidence/react-readiness.v1.json +147 -1
- package/package.json +3 -3
- package/dist/chunk-G74PKSW3.js +0 -338
package/README.md
CHANGED
|
@@ -32,4 +32,4 @@ Use matching versions of the OODS packages. These packages are separate from the
|
|
|
32
32
|
|
|
33
33
|
## License
|
|
34
34
|
|
|
35
|
-
Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.
|
|
35
|
+
Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.0/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.0/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STATUS_DOMAINS, getBannerToneTokenSet, getStatusPresentation, getToneTokenSet, listStatuses } from '@oods/component-contracts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getStatusPresentation, getToneTokenSet,
|
|
2
|
-
import { dateTimeInputValue, currencyMinorUnits, formatDateTime, formatReadOnlyValue } from '@oods/component-contracts';
|
|
1
|
+
import { getStatusPresentation, getToneTokenSet, getBannerToneTokenSet } from './chunk-2VEQWKGK.js';
|
|
2
|
+
import { dateTimeInputValue, STATUS_ICON_SVG_ATTRS, resolveStatusIcon, currencyMinorUnits, formatDateTime, formatReadOnlyValue, STATUS_ICON_SHAPES } from '@oods/component-contracts';
|
|
3
3
|
import * as React3 from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -155,17 +155,16 @@ var InputPrimitive = React3.forwardRef(
|
|
|
155
155
|
InputPrimitive.displayName = "OODS.Input";
|
|
156
156
|
var Input = InputPrimitive;
|
|
157
157
|
var DatePicker = React3.forwardRef(
|
|
158
|
-
({ pickerClassName, pickerStyle, inputClassName, inputStyle, ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
158
|
+
({ pickerClassName, pickerStyle, inputClassName, inputStyle, className, style, ...rest }, ref) => /* @__PURE__ */ jsx("div", { className: classes("oods-date-picker", className), style, "data-oods-component": "DatePicker", children: /* @__PURE__ */ jsx(
|
|
159
159
|
Input,
|
|
160
160
|
{
|
|
161
161
|
ref,
|
|
162
162
|
type: "date",
|
|
163
|
-
"data-oods-component": "DatePicker",
|
|
164
163
|
inputClassName: classes("form-field__date-picker", inputClassName, pickerClassName),
|
|
165
164
|
inputStyle: { ...inputStyle, ...pickerStyle },
|
|
166
165
|
...rest
|
|
167
166
|
}
|
|
168
|
-
)
|
|
167
|
+
) })
|
|
169
168
|
);
|
|
170
169
|
DatePicker.displayName = "OODS.DatePicker";
|
|
171
170
|
var Checkbox = React3.forwardRef(
|
|
@@ -231,6 +230,84 @@ var Checkbox = React3.forwardRef(
|
|
|
231
230
|
}
|
|
232
231
|
);
|
|
233
232
|
Checkbox.displayName = "OODS.Checkbox";
|
|
233
|
+
var Switch = React3.forwardRef(
|
|
234
|
+
({
|
|
235
|
+
id,
|
|
236
|
+
label,
|
|
237
|
+
checked,
|
|
238
|
+
defaultChecked = false,
|
|
239
|
+
required,
|
|
240
|
+
help,
|
|
241
|
+
validation,
|
|
242
|
+
size = "md",
|
|
243
|
+
className,
|
|
244
|
+
style,
|
|
245
|
+
onClick,
|
|
246
|
+
onCheckedChange,
|
|
247
|
+
onUpdate,
|
|
248
|
+
"aria-describedby": nativeDescription,
|
|
249
|
+
...rest
|
|
250
|
+
}, ref) => {
|
|
251
|
+
const [internalChecked, setInternalChecked] = React3.useState(defaultChecked);
|
|
252
|
+
const on = checked ?? internalChecked;
|
|
253
|
+
const validationId = validation?.id ?? `${id}-validation`;
|
|
254
|
+
const describedBy = [nativeDescription, help ? `${id}-help` : void 0, validation?.message ? validationId : void 0].filter(Boolean).join(" ") || void 0;
|
|
255
|
+
const tone = validation ? validation.state === "error" ? "critical" : validation.state : void 0;
|
|
256
|
+
const handleClick = (event) => {
|
|
257
|
+
onClick?.(event);
|
|
258
|
+
if (event.defaultPrevented) return;
|
|
259
|
+
const next = !on;
|
|
260
|
+
if (checked === void 0) setInternalChecked(next);
|
|
261
|
+
onCheckedChange?.(next);
|
|
262
|
+
onUpdate?.(next);
|
|
263
|
+
};
|
|
264
|
+
return /* @__PURE__ */ jsxs(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
className: classes("oods-field", "oods-switch", className),
|
|
268
|
+
style: {
|
|
269
|
+
...tone ? {
|
|
270
|
+
"--cmp-input-message-border": `var(--sys-status-${tone}-border)`,
|
|
271
|
+
"--cmp-input-message-text": `var(--sys-status-${tone}-text)`
|
|
272
|
+
} : {},
|
|
273
|
+
...style
|
|
274
|
+
},
|
|
275
|
+
"data-oods-component": "Switch",
|
|
276
|
+
"data-size": size,
|
|
277
|
+
"data-validation-state": validation?.state,
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsxs("div", { className: "oods-switch__row", children: [
|
|
280
|
+
/* @__PURE__ */ jsx(
|
|
281
|
+
"button",
|
|
282
|
+
{
|
|
283
|
+
ref,
|
|
284
|
+
id,
|
|
285
|
+
type: "button",
|
|
286
|
+
role: "switch",
|
|
287
|
+
className: "oods-switch__control",
|
|
288
|
+
"aria-checked": on,
|
|
289
|
+
"aria-labelledby": `${id}-label`,
|
|
290
|
+
"aria-describedby": describedBy,
|
|
291
|
+
"aria-required": required || void 0,
|
|
292
|
+
"aria-invalid": validation?.state === "error" || void 0,
|
|
293
|
+
onClick: handleClick,
|
|
294
|
+
...rest,
|
|
295
|
+
children: /* @__PURE__ */ jsx("span", { className: "oods-switch__thumb", "aria-hidden": "true" })
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ jsxs("label", { id: `${id}-label`, className: "oods-field-label oods-switch__label", htmlFor: id, children: [
|
|
299
|
+
label,
|
|
300
|
+
required ? /* @__PURE__ */ jsx("span", { className: "oods-field-required", "aria-hidden": "true", children: "*" }) : null
|
|
301
|
+
] })
|
|
302
|
+
] }),
|
|
303
|
+
help ? /* @__PURE__ */ jsx("p", { id: `${id}-help`, className: "oods-field-help", children: help }) : null,
|
|
304
|
+
validation?.message ? /* @__PURE__ */ jsx("p", { id: validationId, className: "oods-field-error", role: validation.state === "error" ? "alert" : void 0, children: validation.message }) : null
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
Switch.displayName = "OODS.Switch";
|
|
234
311
|
var Select = React3.forwardRef(
|
|
235
312
|
({
|
|
236
313
|
id,
|
|
@@ -369,6 +446,20 @@ var Textarea = React3.forwardRef(
|
|
|
369
446
|
}
|
|
370
447
|
);
|
|
371
448
|
Textarea.displayName = "OODS.Textarea";
|
|
449
|
+
var REACT_NAMES = {
|
|
450
|
+
viewBox: "viewBox",
|
|
451
|
+
fill: "fill",
|
|
452
|
+
stroke: "stroke",
|
|
453
|
+
"stroke-width": "strokeWidth",
|
|
454
|
+
"stroke-linecap": "strokeLinecap",
|
|
455
|
+
"stroke-linejoin": "strokeLinejoin",
|
|
456
|
+
"aria-hidden": "aria-hidden",
|
|
457
|
+
focusable: "focusable"
|
|
458
|
+
};
|
|
459
|
+
var svgProps = Object.fromEntries(Object.entries(STATUS_ICON_SVG_ATTRS).map(([name, value]) => [REACT_NAMES[name] ?? name, value]));
|
|
460
|
+
function StatusIcon({ name }) {
|
|
461
|
+
return /* @__PURE__ */ jsx("svg", { ...svgProps, children: STATUS_ICON_SHAPES[name].map((shape, index) => React3.createElement(shape.tag, { key: index, ...shape.attrs })) });
|
|
462
|
+
}
|
|
372
463
|
var classes2 = (...values) => values.filter(Boolean).join(" ");
|
|
373
464
|
var Badge = React3.forwardRef(
|
|
374
465
|
({
|
|
@@ -391,14 +482,15 @@ var Badge = React3.forwardRef(
|
|
|
391
482
|
const tone = toneOverride ?? presentation?.tone ?? "neutral";
|
|
392
483
|
const tokenSet = toneOverride !== void 0 ? getToneTokenSet(tone) : emphasis === "solid" ? presentation?.badge.solid ?? getToneTokenSet(tone) : presentation?.badge.subtle ?? getToneTokenSet(tone);
|
|
393
484
|
const resolvedContent = children ?? content ?? presentation?.label ?? status;
|
|
394
|
-
const
|
|
485
|
+
const statusIcon = resolveStatusIcon(presentation?.iconName);
|
|
486
|
+
const resolvedIcon = icon ?? (statusIcon ? /* @__PURE__ */ jsx(StatusIcon, { name: statusIcon }) : void 0);
|
|
395
487
|
const resolvedShowIcon = showIcon ?? resolvedIcon !== void 0;
|
|
396
|
-
const iconNode = resolvedShowIcon && resolvedIcon ? /* @__PURE__ */ jsx("span", { className: "oods-badge__icon
|
|
488
|
+
const iconNode = resolvedShowIcon && resolvedIcon ? /* @__PURE__ */ jsx("span", { className: "oods-badge__icon", "aria-hidden": "true", children: resolvedIcon }) : null;
|
|
397
489
|
return /* @__PURE__ */ jsxs(
|
|
398
490
|
"span",
|
|
399
491
|
{
|
|
400
492
|
ref,
|
|
401
|
-
className: classes2("oods-badge",
|
|
493
|
+
className: classes2("oods-badge", className),
|
|
402
494
|
"data-oods-component": "Badge",
|
|
403
495
|
"data-status": status,
|
|
404
496
|
"data-domain": domain,
|
|
@@ -410,16 +502,12 @@ var Badge = React3.forwardRef(
|
|
|
410
502
|
"--cmp-badge-background": tokenSet.background,
|
|
411
503
|
"--cmp-badge-border": tokenSet.border,
|
|
412
504
|
"--cmp-badge-text": tokenSet.foreground,
|
|
413
|
-
"--statusable-badge-background": tokenSet.background,
|
|
414
|
-
"--statusable-badge-border": tokenSet.border,
|
|
415
|
-
"--statusable-badge-foreground": tokenSet.foreground,
|
|
416
|
-
"--statusable-badge-icon-color": tokenSet.foreground,
|
|
417
505
|
...style
|
|
418
506
|
},
|
|
419
507
|
...rest,
|
|
420
508
|
children: [
|
|
421
509
|
iconPosition === "start" ? iconNode : null,
|
|
422
|
-
/* @__PURE__ */ jsx("span", { className: "oods-badge__label
|
|
510
|
+
/* @__PURE__ */ jsx("span", { className: "oods-badge__label", children: resolvedContent }),
|
|
423
511
|
iconPosition === "end" ? iconNode : null
|
|
424
512
|
]
|
|
425
513
|
}
|
|
@@ -453,7 +541,8 @@ var Banner = React3.forwardRef(
|
|
|
453
541
|
const heading = title ?? presentation?.label ?? status;
|
|
454
542
|
const body = detail ?? description ?? children ?? content ?? presentation?.description;
|
|
455
543
|
const role = tone === "critical" || tone === "danger" ? "alert" : "status";
|
|
456
|
-
const
|
|
544
|
+
const statusIcon = resolveStatusIcon(presentation?.iconName);
|
|
545
|
+
const resolvedIcon = icon ?? (statusIcon ? /* @__PURE__ */ jsx(StatusIcon, { name: statusIcon }) : void 0);
|
|
457
546
|
const resolvedShowIcon = showIcon ?? resolvedIcon !== void 0;
|
|
458
547
|
return /* @__PURE__ */ jsxs(
|
|
459
548
|
"div",
|
|
@@ -461,7 +550,7 @@ var Banner = React3.forwardRef(
|
|
|
461
550
|
ref,
|
|
462
551
|
role,
|
|
463
552
|
"aria-live": role === "alert" ? "assertive" : "polite",
|
|
464
|
-
className: classes2("oods-banner",
|
|
553
|
+
className: classes2("oods-banner", className),
|
|
465
554
|
"data-oods-component": "Banner",
|
|
466
555
|
"data-status": status,
|
|
467
556
|
"data-domain": domain,
|
|
@@ -471,28 +560,24 @@ var Banner = React3.forwardRef(
|
|
|
471
560
|
"--cmp-banner-background": tokenSet.background,
|
|
472
561
|
"--cmp-banner-border": tokenSet.border,
|
|
473
562
|
"--cmp-banner-text": tokenSet.foreground,
|
|
474
|
-
"--statusable-banner-background": tokenSet.background,
|
|
475
|
-
"--statusable-banner-border": tokenSet.border,
|
|
476
|
-
"--statusable-banner-foreground": tokenSet.foreground,
|
|
477
|
-
"--statusable-banner-icon-color": tokenSet.foreground,
|
|
478
563
|
...style
|
|
479
564
|
},
|
|
480
565
|
...rest,
|
|
481
566
|
children: [
|
|
482
|
-
resolvedShowIcon && resolvedIcon ? /* @__PURE__ */ jsx("span", { className: "oods-banner__icon
|
|
483
|
-
/* @__PURE__ */ jsxs("div", { className: "oods-banner__content
|
|
484
|
-
heading ? /* @__PURE__ */ jsx("strong", { className: "oods-banner__title
|
|
485
|
-
body ? /* @__PURE__ */ jsx("p", { className: "oods-banner__detail
|
|
486
|
-
actions ? /* @__PURE__ */ jsx("div", { className: "oods-banner__actions
|
|
567
|
+
resolvedShowIcon && resolvedIcon ? /* @__PURE__ */ jsx("span", { className: "oods-banner__icon", "aria-hidden": "true", children: resolvedIcon }) : null,
|
|
568
|
+
/* @__PURE__ */ jsxs("div", { className: "oods-banner__content", children: [
|
|
569
|
+
heading ? /* @__PURE__ */ jsx("strong", { className: "oods-banner__title", children: heading }) : null,
|
|
570
|
+
body ? /* @__PURE__ */ jsx("p", { className: "oods-banner__detail", children: body }) : null,
|
|
571
|
+
actions ? /* @__PURE__ */ jsx("div", { className: "oods-banner__actions", children: actions }) : null
|
|
487
572
|
] }),
|
|
488
573
|
onDismiss ? /* @__PURE__ */ jsx(
|
|
489
574
|
"button",
|
|
490
575
|
{
|
|
491
576
|
type: "button",
|
|
492
|
-
className: "oods-banner-dismiss oods-banner__dismiss
|
|
577
|
+
className: "oods-banner-dismiss oods-banner__dismiss",
|
|
493
578
|
"aria-label": dismissLabel,
|
|
494
579
|
onClick: () => onDismiss(),
|
|
495
|
-
children: /* @__PURE__ */ jsx(
|
|
580
|
+
children: /* @__PURE__ */ jsx(StatusIcon, { name: "x" })
|
|
496
581
|
}
|
|
497
582
|
) : null
|
|
498
583
|
]
|
|
@@ -547,6 +632,84 @@ var Button = React3.forwardRef(
|
|
|
547
632
|
}
|
|
548
633
|
);
|
|
549
634
|
Button.displayName = "OODS.Button";
|
|
635
|
+
var noSubscription = () => () => void 0;
|
|
636
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React3.useEffect : React3.useLayoutEffect;
|
|
637
|
+
var canShowModal = () => typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
638
|
+
var hasContent = (node) => node !== void 0 && node !== null && node !== false && node !== "";
|
|
639
|
+
var Dialog = React3.forwardRef(
|
|
640
|
+
({
|
|
641
|
+
id,
|
|
642
|
+
open = false,
|
|
643
|
+
modal = true,
|
|
644
|
+
title,
|
|
645
|
+
description,
|
|
646
|
+
dismissLabel = "Close",
|
|
647
|
+
size = "md",
|
|
648
|
+
actions,
|
|
649
|
+
children,
|
|
650
|
+
className,
|
|
651
|
+
onClose,
|
|
652
|
+
onKeyDown,
|
|
653
|
+
...rest
|
|
654
|
+
}, ref) => {
|
|
655
|
+
const generatedId = React3.useId().replace(/[^\w-]/g, "");
|
|
656
|
+
const dialogId = id ?? `oods-dialog-${generatedId}`;
|
|
657
|
+
const element = React3.useRef(null);
|
|
658
|
+
const openRef = React3.useRef(open);
|
|
659
|
+
const serverMarkup = React3.useSyncExternalStore(noSubscription, () => false, () => true);
|
|
660
|
+
const managed = modal && !serverMarkup && canShowModal();
|
|
661
|
+
const setRef = React3.useCallback((node) => {
|
|
662
|
+
element.current = node;
|
|
663
|
+
if (typeof ref === "function") ref(node);
|
|
664
|
+
else if (ref) ref.current = node;
|
|
665
|
+
}, [ref]);
|
|
666
|
+
useIsomorphicLayoutEffect(() => {
|
|
667
|
+
openRef.current = open;
|
|
668
|
+
const dialog = element.current;
|
|
669
|
+
if (!dialog || !managed) return;
|
|
670
|
+
if (open && !dialog.open) dialog.showModal();
|
|
671
|
+
else if (!open && dialog.open) dialog.close();
|
|
672
|
+
}, [open, managed]);
|
|
673
|
+
const requestClose = (event) => {
|
|
674
|
+
event.preventDefault();
|
|
675
|
+
onClose?.();
|
|
676
|
+
};
|
|
677
|
+
return /* @__PURE__ */ jsxs(
|
|
678
|
+
"dialog",
|
|
679
|
+
{
|
|
680
|
+
ref: setRef,
|
|
681
|
+
id: dialogId,
|
|
682
|
+
className: classes2("oods-dialog", className),
|
|
683
|
+
"data-oods-component": "Dialog",
|
|
684
|
+
"data-size": size,
|
|
685
|
+
"aria-labelledby": `${dialogId}-title`,
|
|
686
|
+
"aria-describedby": hasContent(description) ? `${dialogId}-description` : void 0,
|
|
687
|
+
open: managed ? void 0 : open,
|
|
688
|
+
onKeyDown: (event) => {
|
|
689
|
+
onKeyDown?.(event);
|
|
690
|
+
if (event.key === "Escape" && !event.defaultPrevented) requestClose(event);
|
|
691
|
+
},
|
|
692
|
+
onCancel: requestClose,
|
|
693
|
+
onClose: () => {
|
|
694
|
+
if (openRef.current && !element.current?.open) onClose?.();
|
|
695
|
+
},
|
|
696
|
+
...rest,
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ jsxs("div", { className: "oods-dialog__header", children: [
|
|
699
|
+
/* @__PURE__ */ jsxs("div", { className: "oods-dialog__heading", children: [
|
|
700
|
+
/* @__PURE__ */ jsx("h2", { id: `${dialogId}-title`, className: "oods-dialog__title", children: title }),
|
|
701
|
+
hasContent(description) ? /* @__PURE__ */ jsx("p", { id: `${dialogId}-description`, className: "oods-dialog__description", children: description }) : null
|
|
702
|
+
] }),
|
|
703
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "oods-dialog__close", "aria-label": dismissLabel, onClick: () => onClose?.(), children: /* @__PURE__ */ jsx(StatusIcon, { name: "x" }) })
|
|
704
|
+
] }),
|
|
705
|
+
hasContent(children) ? /* @__PURE__ */ jsx("div", { className: "oods-dialog__body", children }) : null,
|
|
706
|
+
hasContent(actions) ? /* @__PURE__ */ jsx("div", { className: "oods-dialog__footer", children: actions }) : null
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
Dialog.displayName = "OODS.Dialog";
|
|
550
713
|
var Card = React3.forwardRef(
|
|
551
714
|
({ as = "div", elevated = false, className, ...rest }, ref) => {
|
|
552
715
|
const Element = as;
|
|
@@ -612,6 +775,7 @@ var StatusBadge = React3.forwardRef(
|
|
|
612
775
|
compact,
|
|
613
776
|
variant,
|
|
614
777
|
title,
|
|
778
|
+
className,
|
|
615
779
|
"aria-label": ariaLabel,
|
|
616
780
|
...rest
|
|
617
781
|
}, ref) => {
|
|
@@ -629,6 +793,7 @@ var StatusBadge = React3.forwardRef(
|
|
|
629
793
|
content: children ?? content,
|
|
630
794
|
title: title ?? presentation.description,
|
|
631
795
|
"aria-label": ariaLabel ?? label ?? `Status: ${presentation.label}`,
|
|
796
|
+
className: classes3("oods-status-badge", className),
|
|
632
797
|
"data-oods-component": "StatusBadge",
|
|
633
798
|
...rest
|
|
634
799
|
}
|
|
@@ -767,29 +932,29 @@ var TimelinePrimitive = React3.forwardRef(
|
|
|
767
932
|
"data-timeline-type": kind,
|
|
768
933
|
...rest,
|
|
769
934
|
children: [
|
|
770
|
-
/* @__PURE__ */ jsx("h2", { className: "oods-timeline__title", children: title }),
|
|
935
|
+
/* @__PURE__ */ jsx("h2", { className: "oods-timeline__title", "data-timeline-title": "true", children: title }),
|
|
771
936
|
kind === "status" && status ? /* @__PURE__ */ jsxs("p", { className: "oods-timeline__current", "data-timeline-current": "true", children: [
|
|
772
937
|
"Current status: ",
|
|
773
938
|
humanize(status)
|
|
774
939
|
] }) : null,
|
|
775
|
-
transitionCount > 0 ? /* @__PURE__ */ jsxs("p", { children: [
|
|
940
|
+
transitionCount > 0 ? /* @__PURE__ */ jsxs("p", { "data-timeline-transitions": "true", children: [
|
|
776
941
|
"Allowed transitions: ",
|
|
777
942
|
allowedTransitions?.join(", ")
|
|
778
943
|
] }) : null,
|
|
779
|
-
children ?? /* @__PURE__ */ jsx("ol", { className: "oods-timeline__events", children: visibleEvents.length === 0 ? /* @__PURE__ */ jsx("li", { "data-timeline-empty": "true", children: "No events" }) : visibleEvents.map((event, index) => {
|
|
944
|
+
children ?? /* @__PURE__ */ jsx("ol", { className: "oods-timeline__events", "data-timeline-events": "true", children: visibleEvents.length === 0 ? /* @__PURE__ */ jsx("li", { "data-timeline-empty": "true", children: "No events" }) : visibleEvents.map((event, index) => {
|
|
780
945
|
const timestamp = event.timestamp ?? event.datetime;
|
|
781
946
|
const actor = event.actor ?? event.actorId ?? event.actor_id;
|
|
782
947
|
const eventLabel = event.label ?? event.title ?? (event.from && event.to ? `${humanize(event.from)} \u2192 ${humanize(event.to)}` : void 0) ?? (event.status ? humanize(event.status) : void 0) ?? (event.state ? humanize(event.state) : void 0) ?? "Event";
|
|
783
948
|
const detail = event.detail ?? event.description;
|
|
784
949
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("article", { className: "oods-timeline__event", "data-timeline-event": "true", children: [
|
|
785
|
-
/* @__PURE__ */ jsx("p", { className: "oods-timeline__label", children: eventLabel }),
|
|
786
|
-
timestamp ? /* @__PURE__ */ jsx("time", { dateTime: timestamp, children: formatDateTime(timestamp) }) : null,
|
|
787
|
-
detail ? /* @__PURE__ */ jsx("p", { className: "oods-timeline__detail", children: detail }) : null,
|
|
788
|
-
showActorId && actor ? /* @__PURE__ */ jsxs("p", { className: "oods-timeline__actor", children: [
|
|
950
|
+
/* @__PURE__ */ jsx("p", { className: "oods-timeline__label", "data-timeline-label": "true", children: eventLabel }),
|
|
951
|
+
timestamp ? /* @__PURE__ */ jsx("time", { "data-timeline-time": "true", dateTime: timestamp, children: formatDateTime(timestamp) }) : null,
|
|
952
|
+
detail ? /* @__PURE__ */ jsx("p", { className: "oods-timeline__detail", "data-timeline-detail": "true", children: detail }) : null,
|
|
953
|
+
showActorId && actor ? /* @__PURE__ */ jsxs("p", { className: "oods-timeline__actor", "data-timeline-actor": "true", children: [
|
|
789
954
|
"Actor: ",
|
|
790
955
|
actor
|
|
791
956
|
] }) : null,
|
|
792
|
-
showReason && event.reason ? /* @__PURE__ */ jsxs("p", { className: "oods-timeline__reason", children: [
|
|
957
|
+
showReason && event.reason ? /* @__PURE__ */ jsxs("p", { className: "oods-timeline__reason", "data-timeline-reason": "true", children: [
|
|
793
958
|
"Reason: ",
|
|
794
959
|
event.reason
|
|
795
960
|
] }) : null
|
|
@@ -980,7 +1145,7 @@ var SearchInput = React3.forwardRef(
|
|
|
980
1145
|
"aria-label": "Clear search",
|
|
981
1146
|
disabled,
|
|
982
1147
|
onClick: clear,
|
|
983
|
-
children: "
|
|
1148
|
+
children: /* @__PURE__ */ jsx(StatusIcon, { name: "x" })
|
|
984
1149
|
}
|
|
985
1150
|
) : null
|
|
986
1151
|
]
|
|
@@ -1168,7 +1333,7 @@ var RelativeTimestamp = React3.forwardRef(
|
|
|
1168
1333
|
const date = asDate(raw);
|
|
1169
1334
|
if (hideWhenEmpty && !date) return null;
|
|
1170
1335
|
const nowDate = asDate(now) ?? /* @__PURE__ */ new Date();
|
|
1171
|
-
const iso = date?.toISOString() ?? (raw === void 0 ? void 0 : String(raw));
|
|
1336
|
+
const iso = date?.toISOString() ?? (raw === void 0 || raw === "" ? void 0 : String(raw));
|
|
1172
1337
|
const absolute = formatDateTime(date, { timeZone: timezone });
|
|
1173
1338
|
const content = relative ?? label ?? text ?? (now !== void 0 && date ? relativeLabel(date, nowDate) : absolute || children || "Unknown time");
|
|
1174
1339
|
return /* @__PURE__ */ jsx(
|
|
@@ -1188,4 +1353,4 @@ var RelativeTimestamp = React3.forwardRef(
|
|
|
1188
1353
|
);
|
|
1189
1354
|
RelativeTimestamp.displayName = "OODS.RelativeTimestamp";
|
|
1190
1355
|
|
|
1191
|
-
export { AuditTimeline, Badge, Banner, Button, CancellationSummary, Card, Checkbox, DatePicker, Input, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, Select, StatusBadge, StatusTimeline, Text, Textarea };
|
|
1356
|
+
export { AuditTimeline, Badge, Banner, Button, CancellationSummary, Card, Checkbox, DatePicker, Dialog, Input, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, Select, StatusBadge, StatusTimeline, Switch, Text, Textarea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getStatusPresentation, getToneTokenSet } from './chunk-
|
|
1
|
+
import { getStatusPresentation, getToneTokenSet } from './chunk-2VEQWKGK.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -120,6 +120,7 @@ TableCell.displayName = "OODS.Table.Cell";
|
|
|
120
120
|
var TableRoot = React.forwardRef(
|
|
121
121
|
({
|
|
122
122
|
caption,
|
|
123
|
+
showCaption = true,
|
|
123
124
|
columns,
|
|
124
125
|
rows,
|
|
125
126
|
density = "comfortable",
|
|
@@ -145,8 +146,8 @@ var TableRoot = React.forwardRef(
|
|
|
145
146
|
"data-density": density,
|
|
146
147
|
...rest,
|
|
147
148
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
-
caption ? /* @__PURE__ */ jsx(TableCaption, { children: caption }) : null,
|
|
149
|
-
/* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx("tr", { children: columns?.map((column) => /* @__PURE__ */ jsx(TableHeaderCell, { numeric: column.numeric, children: column.label }, column.key)) }) }),
|
|
149
|
+
caption ? /* @__PURE__ */ jsx(TableCaption, { "data-visually-hidden": showCaption ? void 0 : "true", children: caption }) : null,
|
|
150
|
+
/* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx("tr", { className: "oods-table__row", children: columns?.map((column) => /* @__PURE__ */ jsx(TableHeaderCell, { numeric: column.numeric, children: column.label }, column.key)) }) }),
|
|
150
151
|
/* @__PURE__ */ jsx(TableBody, { children: (rows?.length ?? 0) === 0 ? /* @__PURE__ */ jsx("tr", { className: "oods-table__row", children: /* @__PURE__ */ jsx(TableCell, { colSpan: Math.max(columns?.length ?? 0, 1), children: "No rows available." }) }) : rows?.map((row) => /* @__PURE__ */ jsx(
|
|
151
152
|
"tr",
|
|
152
153
|
{
|