@oods/components-react 0.4.0 → 0.4.2
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-OFTMKX3W.js → chunk-ICXOX5B3.js} +51 -2
- package/dist/index.cjs +488 -155
- package/dist/index.d.cts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +399 -117
- package/dist/ported.cjs +50 -1
- package/dist/ported.d.cts +2 -0
- package/dist/ported.d.ts +2 -0
- package/dist/ported.js +1 -1
- package/dist/types.d.cts +62 -1
- package/dist/types.d.ts +62 -1
- package/evidence/react-readiness.v1.json +146 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React9 = require('react');
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var componentContracts = require('@oods/component-contracts');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -23,7 +23,7 @@ function _interopNamespace(e) {
|
|
|
23
23
|
return Object.freeze(n);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var React9__namespace = /*#__PURE__*/_interopNamespace(React9);
|
|
27
27
|
|
|
28
28
|
// src/presentational.tsx
|
|
29
29
|
var REACT_NAMES = {
|
|
@@ -38,10 +38,10 @@ var REACT_NAMES = {
|
|
|
38
38
|
};
|
|
39
39
|
var svgProps = Object.fromEntries(Object.entries(componentContracts.STATUS_ICON_SVG_ATTRS).map(([name, value]) => [REACT_NAMES[name] ?? name, value]));
|
|
40
40
|
function StatusIcon({ name }) {
|
|
41
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { ...svgProps, children: componentContracts.STATUS_ICON_SHAPES[name].map((shape, index) =>
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { ...svgProps, children: componentContracts.STATUS_ICON_SHAPES[name].map((shape, index) => React9__namespace.createElement(shape.tag, { key: index, ...shape.attrs })) });
|
|
42
42
|
}
|
|
43
43
|
var classes = (...values) => values.filter(Boolean).join(" ");
|
|
44
|
-
var Badge =
|
|
44
|
+
var Badge = React9__namespace.forwardRef(
|
|
45
45
|
({
|
|
46
46
|
content,
|
|
47
47
|
status,
|
|
@@ -95,7 +95,7 @@ var Badge = React8__namespace.forwardRef(
|
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
Badge.displayName = "OODS.Badge";
|
|
98
|
-
var Banner =
|
|
98
|
+
var Banner = React9__namespace.forwardRef(
|
|
99
99
|
({
|
|
100
100
|
title,
|
|
101
101
|
detail,
|
|
@@ -166,7 +166,7 @@ var Banner = React8__namespace.forwardRef(
|
|
|
166
166
|
}
|
|
167
167
|
);
|
|
168
168
|
Banner.displayName = "OODS.Banner";
|
|
169
|
-
var Button =
|
|
169
|
+
var Button = React9__namespace.forwardRef(
|
|
170
170
|
({
|
|
171
171
|
asChild = false,
|
|
172
172
|
content,
|
|
@@ -213,10 +213,35 @@ var Button = React8__namespace.forwardRef(
|
|
|
213
213
|
);
|
|
214
214
|
Button.displayName = "OODS.Button";
|
|
215
215
|
var noSubscription = () => () => void 0;
|
|
216
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
216
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React9__namespace.useEffect : React9__namespace.useLayoutEffect;
|
|
217
217
|
var canShowModal = () => typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
218
218
|
var hasContent = (node) => node !== void 0 && node !== null && node !== false && node !== "";
|
|
219
|
-
var
|
|
219
|
+
var pageLocks = 0;
|
|
220
|
+
var pageStyle;
|
|
221
|
+
function lockPageScroll() {
|
|
222
|
+
const page = document.documentElement;
|
|
223
|
+
if (pageLocks++ === 0) {
|
|
224
|
+
const scrollbar = window.innerWidth - page.clientWidth;
|
|
225
|
+
pageStyle = { overflow: page.style.overflow, paddingRight: page.style.paddingRight };
|
|
226
|
+
if (scrollbar > 0) page.style.paddingRight = `${parseFloat(getComputedStyle(page).paddingRight) + scrollbar}px`;
|
|
227
|
+
page.style.overflow = "hidden";
|
|
228
|
+
}
|
|
229
|
+
let held = true;
|
|
230
|
+
return () => {
|
|
231
|
+
if (!held) return;
|
|
232
|
+
held = false;
|
|
233
|
+
if (--pageLocks === 0 && pageStyle) {
|
|
234
|
+
page.style.overflow = pageStyle.overflow;
|
|
235
|
+
page.style.paddingRight = pageStyle.paddingRight;
|
|
236
|
+
pageStyle = void 0;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
var outsideBox = (event, dialog) => {
|
|
241
|
+
const box = dialog.getBoundingClientRect();
|
|
242
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
243
|
+
};
|
|
244
|
+
var Dialog = React9__namespace.forwardRef(
|
|
220
245
|
({
|
|
221
246
|
id,
|
|
222
247
|
open = false,
|
|
@@ -230,26 +255,36 @@ var Dialog = React8__namespace.forwardRef(
|
|
|
230
255
|
className,
|
|
231
256
|
onClose,
|
|
232
257
|
onKeyDown,
|
|
258
|
+
onMouseDown,
|
|
259
|
+
onClick,
|
|
233
260
|
...rest
|
|
234
261
|
}, ref) => {
|
|
235
|
-
const generatedId =
|
|
262
|
+
const generatedId = React9__namespace.useId().replace(/[^\w-]/g, "");
|
|
236
263
|
const dialogId = id ?? `oods-dialog-${generatedId}`;
|
|
237
|
-
const element =
|
|
238
|
-
const openRef =
|
|
239
|
-
const
|
|
264
|
+
const element = React9__namespace.useRef(null);
|
|
265
|
+
const openRef = React9__namespace.useRef(open);
|
|
266
|
+
const scrollLock = React9__namespace.useRef(null);
|
|
267
|
+
const pressedBackdrop = React9__namespace.useRef(false);
|
|
268
|
+
const serverMarkup = React9__namespace.useSyncExternalStore(noSubscription, () => false, () => true);
|
|
240
269
|
const managed = modal && !serverMarkup && canShowModal();
|
|
241
|
-
const setRef =
|
|
270
|
+
const setRef = React9__namespace.useCallback((node) => {
|
|
242
271
|
element.current = node;
|
|
243
272
|
if (typeof ref === "function") ref(node);
|
|
244
273
|
else if (ref) ref.current = node;
|
|
245
274
|
}, [ref]);
|
|
275
|
+
const releaseScroll = React9__namespace.useCallback(() => {
|
|
276
|
+
scrollLock.current?.();
|
|
277
|
+
scrollLock.current = null;
|
|
278
|
+
}, []);
|
|
246
279
|
useIsomorphicLayoutEffect(() => {
|
|
247
280
|
openRef.current = open;
|
|
248
281
|
const dialog = element.current;
|
|
249
282
|
if (!dialog || !managed) return;
|
|
250
283
|
if (open && !dialog.open) dialog.showModal();
|
|
251
284
|
else if (!open && dialog.open) dialog.close();
|
|
285
|
+
if (open && dialog.open) scrollLock.current ??= lockPageScroll();
|
|
252
286
|
}, [open, managed]);
|
|
287
|
+
React9__namespace.useEffect(() => releaseScroll, [releaseScroll]);
|
|
253
288
|
const requestClose = (event) => {
|
|
254
289
|
event.preventDefault();
|
|
255
290
|
onClose?.();
|
|
@@ -271,7 +306,19 @@ var Dialog = React8__namespace.forwardRef(
|
|
|
271
306
|
},
|
|
272
307
|
onCancel: requestClose,
|
|
273
308
|
onClose: () => {
|
|
274
|
-
if (
|
|
309
|
+
if (element.current?.open) return;
|
|
310
|
+
releaseScroll();
|
|
311
|
+
if (openRef.current) onClose?.();
|
|
312
|
+
},
|
|
313
|
+
onMouseDown: (event) => {
|
|
314
|
+
onMouseDown?.(event);
|
|
315
|
+
pressedBackdrop.current = managed && event.target === event.currentTarget && outsideBox(event, event.currentTarget);
|
|
316
|
+
},
|
|
317
|
+
onClick: (event) => {
|
|
318
|
+
onClick?.(event);
|
|
319
|
+
const backdrop = pressedBackdrop.current && event.target === event.currentTarget && outsideBox(event, event.currentTarget);
|
|
320
|
+
pressedBackdrop.current = false;
|
|
321
|
+
if (backdrop && !event.defaultPrevented) onClose?.();
|
|
275
322
|
},
|
|
276
323
|
...rest,
|
|
277
324
|
children: [
|
|
@@ -290,7 +337,7 @@ var Dialog = React8__namespace.forwardRef(
|
|
|
290
337
|
}
|
|
291
338
|
);
|
|
292
339
|
Dialog.displayName = "OODS.Dialog";
|
|
293
|
-
var Card =
|
|
340
|
+
var Card = React9__namespace.forwardRef(
|
|
294
341
|
({ as = "div", elevated = false, className, ...rest }, ref) => {
|
|
295
342
|
const Element = as;
|
|
296
343
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -306,7 +353,7 @@ var Card = React8__namespace.forwardRef(
|
|
|
306
353
|
}
|
|
307
354
|
);
|
|
308
355
|
Card.displayName = "OODS.Card";
|
|
309
|
-
var Text =
|
|
356
|
+
var Text = React9__namespace.forwardRef(
|
|
310
357
|
({
|
|
311
358
|
as = "span",
|
|
312
359
|
content,
|
|
@@ -415,7 +462,7 @@ var FieldFrame = ({
|
|
|
415
462
|
}
|
|
416
463
|
);
|
|
417
464
|
};
|
|
418
|
-
var InputPrimitive =
|
|
465
|
+
var InputPrimitive = React9__namespace.forwardRef(
|
|
419
466
|
({
|
|
420
467
|
id,
|
|
421
468
|
label,
|
|
@@ -485,7 +532,7 @@ var InputPrimitive = React8__namespace.forwardRef(
|
|
|
485
532
|
);
|
|
486
533
|
InputPrimitive.displayName = "OODS.Input";
|
|
487
534
|
var Input = InputPrimitive;
|
|
488
|
-
var DatePicker =
|
|
535
|
+
var DatePicker = React9__namespace.forwardRef(
|
|
489
536
|
({ pickerClassName, pickerStyle, inputClassName, inputStyle, className, style, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes2("oods-date-picker", className), style, "data-oods-component": "DatePicker", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
490
537
|
Input,
|
|
491
538
|
{
|
|
@@ -498,7 +545,7 @@ var DatePicker = React8__namespace.forwardRef(
|
|
|
498
545
|
) })
|
|
499
546
|
);
|
|
500
547
|
DatePicker.displayName = "OODS.DatePicker";
|
|
501
|
-
var Checkbox =
|
|
548
|
+
var Checkbox = React9__namespace.forwardRef(
|
|
502
549
|
({
|
|
503
550
|
id,
|
|
504
551
|
label,
|
|
@@ -561,7 +608,7 @@ var Checkbox = React8__namespace.forwardRef(
|
|
|
561
608
|
}
|
|
562
609
|
);
|
|
563
610
|
Checkbox.displayName = "OODS.Checkbox";
|
|
564
|
-
var Switch =
|
|
611
|
+
var Switch = React9__namespace.forwardRef(
|
|
565
612
|
({
|
|
566
613
|
id,
|
|
567
614
|
label,
|
|
@@ -579,7 +626,7 @@ var Switch = React8__namespace.forwardRef(
|
|
|
579
626
|
"aria-describedby": nativeDescription,
|
|
580
627
|
...rest
|
|
581
628
|
}, ref) => {
|
|
582
|
-
const [internalChecked, setInternalChecked] =
|
|
629
|
+
const [internalChecked, setInternalChecked] = React9__namespace.useState(defaultChecked);
|
|
583
630
|
const on = checked ?? internalChecked;
|
|
584
631
|
const validationId = validation?.id ?? `${id}-validation`;
|
|
585
632
|
const describedBy = [nativeDescription, help ? `${id}-help` : void 0, validation?.message ? validationId : void 0].filter(Boolean).join(" ") || void 0;
|
|
@@ -639,7 +686,7 @@ var Switch = React8__namespace.forwardRef(
|
|
|
639
686
|
}
|
|
640
687
|
);
|
|
641
688
|
Switch.displayName = "OODS.Switch";
|
|
642
|
-
var Select =
|
|
689
|
+
var Select = React9__namespace.forwardRef(
|
|
643
690
|
({
|
|
644
691
|
id,
|
|
645
692
|
label,
|
|
@@ -707,7 +754,7 @@ var Select = React8__namespace.forwardRef(
|
|
|
707
754
|
}
|
|
708
755
|
);
|
|
709
756
|
Select.displayName = "OODS.Select";
|
|
710
|
-
var Textarea =
|
|
757
|
+
var Textarea = React9__namespace.forwardRef(
|
|
711
758
|
({
|
|
712
759
|
id,
|
|
713
760
|
label,
|
|
@@ -790,7 +837,7 @@ var maxColumns = (columns) => {
|
|
|
790
837
|
const count = Number(columns);
|
|
791
838
|
return Number.isFinite(count) && count > 0 ? count : void 0;
|
|
792
839
|
};
|
|
793
|
-
var Grid =
|
|
840
|
+
var Grid = React9__namespace.forwardRef(
|
|
794
841
|
({
|
|
795
842
|
columns = "auto-fit",
|
|
796
843
|
minColumnWidth = "16rem",
|
|
@@ -820,7 +867,7 @@ var Grid = React8__namespace.forwardRef(
|
|
|
820
867
|
)
|
|
821
868
|
);
|
|
822
869
|
Grid.displayName = "OODS.Grid";
|
|
823
|
-
var Stack =
|
|
870
|
+
var Stack = React9__namespace.forwardRef(
|
|
824
871
|
({
|
|
825
872
|
direction = "column",
|
|
826
873
|
gap = "md",
|
|
@@ -852,19 +899,19 @@ var Stack = React8__namespace.forwardRef(
|
|
|
852
899
|
);
|
|
853
900
|
Stack.displayName = "OODS.Stack";
|
|
854
901
|
var classes4 = (...values) => values.filter(Boolean).join(" ");
|
|
855
|
-
var TableHead =
|
|
902
|
+
var TableHead = React9__namespace.forwardRef(
|
|
856
903
|
({ className, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: classes4("oods-table__header", className), ...rest })
|
|
857
904
|
);
|
|
858
905
|
TableHead.displayName = "OODS.Table.Head";
|
|
859
|
-
var TableBody =
|
|
906
|
+
var TableBody = React9__namespace.forwardRef(
|
|
860
907
|
({ className, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: classes4("oods-table__body", className), ...rest })
|
|
861
908
|
);
|
|
862
909
|
TableBody.displayName = "OODS.Table.Body";
|
|
863
|
-
var TableCaption =
|
|
910
|
+
var TableCaption = React9__namespace.forwardRef(
|
|
864
911
|
({ className, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className: classes4("oods-table__caption", className), ...rest })
|
|
865
912
|
);
|
|
866
913
|
TableCaption.displayName = "OODS.Table.Caption";
|
|
867
|
-
var TableRow =
|
|
914
|
+
var TableRow = React9__namespace.forwardRef(
|
|
868
915
|
({
|
|
869
916
|
selectable = false,
|
|
870
917
|
selected = false,
|
|
@@ -903,7 +950,7 @@ var TableRow = React8__namespace.forwardRef(
|
|
|
903
950
|
}
|
|
904
951
|
);
|
|
905
952
|
TableRow.displayName = "OODS.Table.Row";
|
|
906
|
-
var TableHeaderCell =
|
|
953
|
+
var TableHeaderCell = React9__namespace.forwardRef(
|
|
907
954
|
({ numeric = false, className, scope = "col", ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
908
955
|
"th",
|
|
909
956
|
{
|
|
@@ -920,7 +967,7 @@ var TableHeaderCell = React8__namespace.forwardRef(
|
|
|
920
967
|
)
|
|
921
968
|
);
|
|
922
969
|
TableHeaderCell.displayName = "OODS.Table.HeaderCell";
|
|
923
|
-
var TableCell =
|
|
970
|
+
var TableCell = React9__namespace.forwardRef(
|
|
924
971
|
({
|
|
925
972
|
numeric = false,
|
|
926
973
|
status,
|
|
@@ -966,7 +1013,7 @@ var TableCell = React8__namespace.forwardRef(
|
|
|
966
1013
|
}
|
|
967
1014
|
);
|
|
968
1015
|
TableCell.displayName = "OODS.Table.Cell";
|
|
969
|
-
var TableRoot =
|
|
1016
|
+
var TableRoot = React9__namespace.forwardRef(
|
|
970
1017
|
({
|
|
971
1018
|
caption,
|
|
972
1019
|
showCaption = true,
|
|
@@ -1048,7 +1095,7 @@ var partitionForOverflow = (items, visibleCount, selectedId) => {
|
|
|
1048
1095
|
overflowItems: items.filter((item) => !visibleIds.has(item.id))
|
|
1049
1096
|
};
|
|
1050
1097
|
};
|
|
1051
|
-
var Tabs =
|
|
1098
|
+
var Tabs = React9__namespace.forwardRef(
|
|
1052
1099
|
({
|
|
1053
1100
|
items,
|
|
1054
1101
|
selectedId,
|
|
@@ -1062,22 +1109,22 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1062
1109
|
"aria-label": ariaLabelAttribute,
|
|
1063
1110
|
...rest
|
|
1064
1111
|
}, ref) => {
|
|
1065
|
-
const instanceId =
|
|
1112
|
+
const instanceId = React9__namespace.useId().replaceAll(":", "");
|
|
1066
1113
|
const controlled = selectedId !== void 0;
|
|
1067
1114
|
const firstEnabled = items.find((item) => !item.disabled && !item.isDisabled)?.id ?? "";
|
|
1068
|
-
const [internalSelectedId, setInternalSelectedId] =
|
|
1115
|
+
const [internalSelectedId, setInternalSelectedId] = React9__namespace.useState(
|
|
1069
1116
|
defaultSelectedId ?? firstEnabled
|
|
1070
1117
|
);
|
|
1071
1118
|
const activeId = controlled ? selectedId : internalSelectedId;
|
|
1072
|
-
const [focusedId, setFocusedId] =
|
|
1073
|
-
const [visibleCount, setVisibleCount] =
|
|
1074
|
-
const [menuOpen, setMenuOpen] =
|
|
1075
|
-
const listRef =
|
|
1076
|
-
const tabRefs =
|
|
1077
|
-
const itemWidths =
|
|
1078
|
-
const focusRequestedByUser =
|
|
1079
|
-
|
|
1080
|
-
const select =
|
|
1119
|
+
const [focusedId, setFocusedId] = React9__namespace.useState(activeId);
|
|
1120
|
+
const [visibleCount, setVisibleCount] = React9__namespace.useState(items.length);
|
|
1121
|
+
const [menuOpen, setMenuOpen] = React9__namespace.useState(false);
|
|
1122
|
+
const listRef = React9__namespace.useRef(null);
|
|
1123
|
+
const tabRefs = React9__namespace.useRef(/* @__PURE__ */ new Map());
|
|
1124
|
+
const itemWidths = React9__namespace.useRef(/* @__PURE__ */ new Map());
|
|
1125
|
+
const focusRequestedByUser = React9__namespace.useRef(false);
|
|
1126
|
+
React9__namespace.useEffect(() => setFocusedId(activeId), [activeId]);
|
|
1127
|
+
const select = React9__namespace.useCallback(
|
|
1081
1128
|
(id) => {
|
|
1082
1129
|
const item = items.find((candidate) => candidate.id === id);
|
|
1083
1130
|
if (!item || item.disabled || item.isDisabled) return;
|
|
@@ -1089,7 +1136,7 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1089
1136
|
},
|
|
1090
1137
|
[controlled, items, onChange, onUpdate]
|
|
1091
1138
|
);
|
|
1092
|
-
const measure =
|
|
1139
|
+
const measure = React9__namespace.useCallback(() => {
|
|
1093
1140
|
const list = listRef.current;
|
|
1094
1141
|
if (!list || items.length < 2) return;
|
|
1095
1142
|
const available = list.offsetWidth;
|
|
@@ -1113,7 +1160,7 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1113
1160
|
}
|
|
1114
1161
|
setVisibleCount(Math.max(1, count));
|
|
1115
1162
|
}, [items.length]);
|
|
1116
|
-
|
|
1163
|
+
React9__namespace.useLayoutEffect(() => {
|
|
1117
1164
|
measure();
|
|
1118
1165
|
const list = listRef.current;
|
|
1119
1166
|
if (!list || typeof ResizeObserver === "undefined") return void 0;
|
|
@@ -1141,7 +1188,7 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1141
1188
|
if (!nextId) return;
|
|
1142
1189
|
select(nextId);
|
|
1143
1190
|
};
|
|
1144
|
-
|
|
1191
|
+
React9__namespace.useEffect(() => {
|
|
1145
1192
|
if (focusRequestedByUser.current && visibleItems.some((item) => item.id === focusedId)) {
|
|
1146
1193
|
focusRequestedByUser.current = false;
|
|
1147
1194
|
tabRefs.current.get(focusedId)?.focus();
|
|
@@ -1204,40 +1251,44 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1204
1251
|
"aria-label": ariaLabel ?? ariaLabelAttribute,
|
|
1205
1252
|
children: [
|
|
1206
1253
|
visibleItems.map(renderTab),
|
|
1207
|
-
overflowItems.length ?
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
item.id === activeId
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1254
|
+
overflowItems.length ? (
|
|
1255
|
+
// s224-m01 (#2542 ruling 2): the overflow markup is Vue's too: both class families, the trigger's data
|
|
1256
|
+
// attribute and aria-current="true" on an item.
|
|
1257
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oods-tabs__overflow oods-tabs-overflow", children: [
|
|
1258
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1259
|
+
"button",
|
|
1260
|
+
{
|
|
1261
|
+
type: "button",
|
|
1262
|
+
className: "tabs__overflow-trigger oods-tabs-overflow-trigger",
|
|
1263
|
+
"aria-label": `${overflowLabel} tabs`,
|
|
1264
|
+
"aria-haspopup": "menu",
|
|
1265
|
+
"aria-expanded": menuOpen,
|
|
1266
|
+
"data-tabs-overflow-trigger": "true",
|
|
1267
|
+
onClick: () => setMenuOpen((open) => !open),
|
|
1268
|
+
children: overflowLabel
|
|
1269
|
+
}
|
|
1270
|
+
),
|
|
1271
|
+
menuOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tabs__overflow-menu oods-tabs-overflow-menu", role: "menu", children: overflowItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1272
|
+
"button",
|
|
1273
|
+
{
|
|
1274
|
+
type: "button",
|
|
1275
|
+
role: "menuitem",
|
|
1276
|
+
disabled: item.disabled || item.isDisabled,
|
|
1277
|
+
"aria-current": item.id === activeId ? "true" : void 0,
|
|
1278
|
+
className: classes5(
|
|
1279
|
+
"tabs__overflow-item",
|
|
1280
|
+
item.id === activeId && "tabs__overflow-item--selected"
|
|
1281
|
+
),
|
|
1282
|
+
onClick: () => {
|
|
1283
|
+
select(item.id);
|
|
1284
|
+
setMenuOpen(false);
|
|
1285
|
+
},
|
|
1286
|
+
children: item.label
|
|
1235
1287
|
},
|
|
1236
|
-
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
] }) : null
|
|
1288
|
+
item.id
|
|
1289
|
+
)) }) : null
|
|
1290
|
+
] })
|
|
1291
|
+
) : null
|
|
1241
1292
|
]
|
|
1242
1293
|
}
|
|
1243
1294
|
),
|
|
@@ -1263,9 +1314,73 @@ var Tabs = React8__namespace.forwardRef(
|
|
|
1263
1314
|
}
|
|
1264
1315
|
);
|
|
1265
1316
|
Tabs.displayName = "OODS.Tabs";
|
|
1317
|
+
var SegmentedControl = React9__namespace.forwardRef(
|
|
1318
|
+
({
|
|
1319
|
+
id,
|
|
1320
|
+
label,
|
|
1321
|
+
options,
|
|
1322
|
+
value,
|
|
1323
|
+
defaultValue,
|
|
1324
|
+
name,
|
|
1325
|
+
size = "md",
|
|
1326
|
+
disabled,
|
|
1327
|
+
className,
|
|
1328
|
+
style,
|
|
1329
|
+
onChange,
|
|
1330
|
+
onValueChange,
|
|
1331
|
+
onUpdate,
|
|
1332
|
+
...rest
|
|
1333
|
+
}, ref) => {
|
|
1334
|
+
const handleChange = (event) => {
|
|
1335
|
+
onChange?.(event);
|
|
1336
|
+
if (event.defaultPrevented) return;
|
|
1337
|
+
onValueChange?.(event.currentTarget.value);
|
|
1338
|
+
onUpdate?.(event.currentTarget.value);
|
|
1339
|
+
};
|
|
1340
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1341
|
+
"div",
|
|
1342
|
+
{
|
|
1343
|
+
className: className ? `oods-field oods-segmented-control ${className}` : "oods-field oods-segmented-control",
|
|
1344
|
+
style,
|
|
1345
|
+
"data-oods-component": "SegmentedControl",
|
|
1346
|
+
"data-size": size,
|
|
1347
|
+
children: [
|
|
1348
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: `${id}-label`, className: "oods-field-label", children: label }),
|
|
1349
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
|
+
"div",
|
|
1351
|
+
{
|
|
1352
|
+
ref,
|
|
1353
|
+
id,
|
|
1354
|
+
role: "radiogroup",
|
|
1355
|
+
"aria-labelledby": `${id}-label`,
|
|
1356
|
+
className: "oods-segmented-control__track",
|
|
1357
|
+
...rest,
|
|
1358
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "oods-segmented-control__option", children: [
|
|
1359
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1360
|
+
"input",
|
|
1361
|
+
{
|
|
1362
|
+
type: "radio",
|
|
1363
|
+
className: "oods-segmented-control__input",
|
|
1364
|
+
name: name || id,
|
|
1365
|
+
value: option.value,
|
|
1366
|
+
...value === void 0 ? { defaultChecked: option.value === defaultValue } : { checked: option.value === value },
|
|
1367
|
+
disabled: disabled || option.disabled,
|
|
1368
|
+
onChange: handleChange
|
|
1369
|
+
}
|
|
1370
|
+
),
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "oods-segmented-control__label", children: option.label })
|
|
1372
|
+
] }, option.value))
|
|
1373
|
+
}
|
|
1374
|
+
)
|
|
1375
|
+
]
|
|
1376
|
+
}
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
);
|
|
1380
|
+
SegmentedControl.displayName = "OODS.SegmentedControl";
|
|
1266
1381
|
var classes6 = (...values) => values.filter(Boolean).join(" ");
|
|
1267
1382
|
var humanize = (value) => value.split(/[_-]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join(" ");
|
|
1268
|
-
var StatusBadge =
|
|
1383
|
+
var StatusBadge = React9__namespace.forwardRef(
|
|
1269
1384
|
({
|
|
1270
1385
|
status,
|
|
1271
1386
|
value,
|
|
@@ -1321,7 +1436,7 @@ function formatPrice(amount, currency, fallback) {
|
|
|
1321
1436
|
return `${currency.toUpperCase()} ${amount.toFixed(2)}`;
|
|
1322
1437
|
}
|
|
1323
1438
|
}
|
|
1324
|
-
var PriceBadge =
|
|
1439
|
+
var PriceBadge = React9__namespace.forwardRef(
|
|
1325
1440
|
({
|
|
1326
1441
|
amountCents,
|
|
1327
1442
|
unitAmountCents,
|
|
@@ -1396,7 +1511,7 @@ function normalizeTimelineEvents(values) {
|
|
|
1396
1511
|
}];
|
|
1397
1512
|
});
|
|
1398
1513
|
}
|
|
1399
|
-
var TimelinePrimitive =
|
|
1514
|
+
var TimelinePrimitive = React9__namespace.forwardRef(
|
|
1400
1515
|
({
|
|
1401
1516
|
componentId,
|
|
1402
1517
|
defaultTitle,
|
|
@@ -1474,7 +1589,7 @@ var TimelinePrimitive = React8__namespace.forwardRef(
|
|
|
1474
1589
|
}
|
|
1475
1590
|
);
|
|
1476
1591
|
TimelinePrimitive.displayName = "OODS.TimelinePrimitive";
|
|
1477
|
-
var StatusTimeline =
|
|
1592
|
+
var StatusTimeline = React9__namespace.forwardRef(
|
|
1478
1593
|
(props, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1479
1594
|
TimelinePrimitive,
|
|
1480
1595
|
{
|
|
@@ -1487,7 +1602,7 @@ var StatusTimeline = React8__namespace.forwardRef(
|
|
|
1487
1602
|
)
|
|
1488
1603
|
);
|
|
1489
1604
|
StatusTimeline.displayName = "OODS.StatusTimeline";
|
|
1490
|
-
var AuditTimeline =
|
|
1605
|
+
var AuditTimeline = React9__namespace.forwardRef(
|
|
1491
1606
|
({ auditLog, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1492
1607
|
TimelinePrimitive,
|
|
1493
1608
|
{
|
|
@@ -1501,7 +1616,7 @@ var AuditTimeline = React8__namespace.forwardRef(
|
|
|
1501
1616
|
)
|
|
1502
1617
|
);
|
|
1503
1618
|
AuditTimeline.displayName = "OODS.AuditTimeline";
|
|
1504
|
-
var CancellationSummary =
|
|
1619
|
+
var CancellationSummary = React9__namespace.forwardRef(
|
|
1505
1620
|
({
|
|
1506
1621
|
label,
|
|
1507
1622
|
title = label ?? "Cancellation Summary",
|
|
@@ -1515,10 +1630,12 @@ var CancellationSummary = React8__namespace.forwardRef(
|
|
|
1515
1630
|
requestedAtField,
|
|
1516
1631
|
reasonField,
|
|
1517
1632
|
codeField,
|
|
1633
|
+
hideWhenDefault,
|
|
1518
1634
|
className,
|
|
1519
1635
|
...rest
|
|
1520
1636
|
}, ref) => {
|
|
1521
1637
|
const childValue = typeof children === "boolean" ? children ? "Yes" : "No" : children;
|
|
1638
|
+
if (hideWhenDefault === true && cancelAtPeriodEnd === false && !requestedAt && !reason && !code && (childValue === void 0 || childValue === null)) return null;
|
|
1522
1639
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1523
1640
|
"section",
|
|
1524
1641
|
{
|
|
@@ -1558,7 +1675,7 @@ var CancellationSummary = React8__namespace.forwardRef(
|
|
|
1558
1675
|
}
|
|
1559
1676
|
);
|
|
1560
1677
|
CancellationSummary.displayName = "OODS.CancellationSummary";
|
|
1561
|
-
var SearchInput =
|
|
1678
|
+
var SearchInput = React9__namespace.forwardRef(
|
|
1562
1679
|
({
|
|
1563
1680
|
id,
|
|
1564
1681
|
label = "Search",
|
|
@@ -1584,13 +1701,13 @@ var SearchInput = React8__namespace.forwardRef(
|
|
|
1584
1701
|
onKeyDown,
|
|
1585
1702
|
...rest
|
|
1586
1703
|
}, ref) => {
|
|
1587
|
-
const generatedId =
|
|
1704
|
+
const generatedId = React9__namespace.useId();
|
|
1588
1705
|
const resolvedId = id ?? `oods-search-${generatedId.replace(/:/g, "")}`;
|
|
1589
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
1706
|
+
const [uncontrolledValue, setUncontrolledValue] = React9__namespace.useState(defaultValue);
|
|
1590
1707
|
const currentValue = value ?? uncontrolledValue;
|
|
1591
|
-
const timerRef =
|
|
1708
|
+
const timerRef = React9__namespace.useRef(void 0);
|
|
1592
1709
|
const delay = Math.max(0, debounceMs ?? debounce ?? 0);
|
|
1593
|
-
|
|
1710
|
+
React9__namespace.useEffect(() => () => {
|
|
1594
1711
|
if (timerRef.current !== void 0) clearTimeout(timerRef.current);
|
|
1595
1712
|
}, []);
|
|
1596
1713
|
const publish = (nextValue) => {
|
|
@@ -1674,7 +1791,7 @@ function visiblePages(page, totalPages) {
|
|
|
1674
1791
|
}
|
|
1675
1792
|
return result;
|
|
1676
1793
|
}
|
|
1677
|
-
var PaginationBar =
|
|
1794
|
+
var PaginationBar = React9__namespace.forwardRef(
|
|
1678
1795
|
({
|
|
1679
1796
|
page = 1,
|
|
1680
1797
|
pageSize = 25,
|
|
@@ -1815,7 +1932,7 @@ function relativeLabel(date, now) {
|
|
|
1815
1932
|
unit
|
|
1816
1933
|
);
|
|
1817
1934
|
}
|
|
1818
|
-
var RelativeTimestamp =
|
|
1935
|
+
var RelativeTimestamp = React9__namespace.forwardRef(
|
|
1819
1936
|
({
|
|
1820
1937
|
datetime,
|
|
1821
1938
|
timestamp,
|
|
@@ -1863,8 +1980,8 @@ RelativeTimestamp.displayName = "OODS.RelativeTimestamp";
|
|
|
1863
1980
|
var classes7 = (...values) => values.filter(Boolean).join(" ");
|
|
1864
1981
|
var firstText = (...values) => values.find((value) => typeof value === "string" && value.trim().length > 0);
|
|
1865
1982
|
function childContent(children) {
|
|
1866
|
-
const flatten = (value) =>
|
|
1867
|
-
if (
|
|
1983
|
+
const flatten = (value) => React9__namespace.Children.toArray(value).flatMap((node) => {
|
|
1984
|
+
if (React9__namespace.isValidElement(node) && node.type === React9__namespace.Fragment) {
|
|
1868
1985
|
return flatten(node.props.children);
|
|
1869
1986
|
}
|
|
1870
1987
|
return [node];
|
|
@@ -1885,7 +2002,7 @@ function notEcho(supporting, heading) {
|
|
|
1885
2002
|
if (!supporting || !heading) return supporting;
|
|
1886
2003
|
return supporting.trim() === heading.trim() ? void 0 : supporting;
|
|
1887
2004
|
}
|
|
1888
|
-
var DetailHeader =
|
|
2005
|
+
var DetailHeader = React9__namespace.forwardRef(
|
|
1889
2006
|
({ title, label, text, subtitle, sublabel, description, metadata, meta, level, as, children, className, ...rest }, ref) => {
|
|
1890
2007
|
const Heading = headingElement(as, level, 2);
|
|
1891
2008
|
const content = childContent(children);
|
|
@@ -1900,7 +2017,7 @@ var DetailHeader = React8__namespace.forwardRef(
|
|
|
1900
2017
|
}
|
|
1901
2018
|
);
|
|
1902
2019
|
DetailHeader.displayName = "OODS.DetailHeader";
|
|
1903
|
-
var CardHeader =
|
|
2020
|
+
var CardHeader = React9__namespace.forwardRef(
|
|
1904
2021
|
({ title, label, text, supporting, supportingText, subtitle, description, level, as, children, className, ...rest }, ref) => {
|
|
1905
2022
|
const Heading = headingElement(as, level, 2);
|
|
1906
2023
|
const content = childContent(children);
|
|
@@ -1913,7 +2030,7 @@ var CardHeader = React8__namespace.forwardRef(
|
|
|
1913
2030
|
}
|
|
1914
2031
|
);
|
|
1915
2032
|
CardHeader.displayName = "OODS.CardHeader";
|
|
1916
|
-
var ColorSwatch =
|
|
2033
|
+
var ColorSwatch = React9__namespace.forwardRef(
|
|
1917
2034
|
({ color, value, state, label, children, className, style, ...rest }, ref) => {
|
|
1918
2035
|
const resolvedColor = firstText(color, value, state);
|
|
1919
2036
|
const content = childContent(children);
|
|
@@ -1938,7 +2055,7 @@ var ColorSwatch = React8__namespace.forwardRef(
|
|
|
1938
2055
|
}
|
|
1939
2056
|
);
|
|
1940
2057
|
ColorSwatch.displayName = "OODS.ColorSwatch";
|
|
1941
|
-
var ColorizedBadge =
|
|
2058
|
+
var ColorizedBadge = React9__namespace.forwardRef(
|
|
1942
2059
|
({ label, text, state, value, status, color, hue, swatch, variant, tone, emphasis, children, className, style, ...rest }, ref) => {
|
|
1943
2060
|
const content = childContent(children);
|
|
1944
2061
|
const resolvedLabel = content.scalar ?? firstText(label, text, state, value) ?? "Color";
|
|
@@ -1968,7 +2085,7 @@ var ColorizedBadge = React8__namespace.forwardRef(
|
|
|
1968
2085
|
}
|
|
1969
2086
|
);
|
|
1970
2087
|
ColorizedBadge.displayName = "OODS.ColorizedBadge";
|
|
1971
|
-
var VizAreaPreview =
|
|
2088
|
+
var VizAreaPreview = React9__namespace.forwardRef(
|
|
1972
2089
|
({ width = 640, height = 360, svg, svgNarrow, svgWide, svgDark, svgDarkNarrow, svgDarkWide, svgHc, svgHcNarrow, svgHcWide, title, description, children, className, style, ...rest }, ref) => {
|
|
1973
2090
|
const content = childContent(children);
|
|
1974
2091
|
if (svg !== void 0) {
|
|
@@ -2037,7 +2154,7 @@ var descriptorLabel = (descriptor) => firstText(
|
|
|
2037
2154
|
typeof descriptor.field === "string" ? descriptor.field : void 0
|
|
2038
2155
|
) ?? "Filter";
|
|
2039
2156
|
function createPanelSection(component, className, panelType, defaultTitle) {
|
|
2040
|
-
const Panel =
|
|
2157
|
+
const Panel = React9__namespace.forwardRef(
|
|
2041
2158
|
({ title, label, heading, name, subtitle, description, metadata, summary: summary2, text, body, emptyMessage, children, className: consumerClassName, ...rest }, ref) => {
|
|
2042
2159
|
const content = childContent(children);
|
|
2043
2160
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2070,7 +2187,7 @@ var ClassificationPanel = createPanelSection("ClassificationPanel", "oods-classi
|
|
|
2070
2187
|
var AddressCollectionPanel = createPanelSection("AddressCollectionPanel", "oods-address-collection-panel", "address", "Addresses");
|
|
2071
2188
|
var MembershipPanel = createPanelSection("MembershipPanel", "oods-membership-panel", "membership", "Membership");
|
|
2072
2189
|
var PreferencePanel = createPanelSection("PreferencePanel", "oods-preference-panel", "preference", "Preferences");
|
|
2073
|
-
var FilterPanel =
|
|
2190
|
+
var FilterPanel = React9__namespace.forwardRef(
|
|
2074
2191
|
({ filters, activeFilters, mode, collapsible = true, children, className, ...rest }, ref) => {
|
|
2075
2192
|
const content = childContent(children);
|
|
2076
2193
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2104,7 +2221,7 @@ var FilterPanel = React8__namespace.forwardRef(
|
|
|
2104
2221
|
}
|
|
2105
2222
|
);
|
|
2106
2223
|
FilterPanel.displayName = "OODS.FilterPanel";
|
|
2107
|
-
var PriceSummary =
|
|
2224
|
+
var PriceSummary = React9__namespace.forwardRef(
|
|
2108
2225
|
({
|
|
2109
2226
|
title,
|
|
2110
2227
|
label,
|
|
@@ -2177,7 +2294,7 @@ var normalizeTagItems = (value) => {
|
|
|
2177
2294
|
}
|
|
2178
2295
|
return items.filter((item) => item.length > 0);
|
|
2179
2296
|
};
|
|
2180
|
-
var TagManager =
|
|
2297
|
+
var TagManager = React9__namespace.forwardRef(
|
|
2181
2298
|
({ title, label, heading, name, description, subtitle, hint, tags, value, children, className, onSubmit, ...rest }, ref) => {
|
|
2182
2299
|
const content = childContent(children);
|
|
2183
2300
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2223,10 +2340,12 @@ var asCount = (value) => {
|
|
|
2223
2340
|
return void 0;
|
|
2224
2341
|
};
|
|
2225
2342
|
function createBadgeFamily(options) {
|
|
2226
|
-
const consumed = /* @__PURE__ */ new Set([...options.labelKeys, ...options.statusKeys, "variant", "tone", "emphasis"]);
|
|
2227
|
-
const Family =
|
|
2343
|
+
const consumed = /* @__PURE__ */ new Set([...options.labelKeys, ...options.statusKeys, "variant", "tone", "emphasis", ...options.booleanProps ? ["hideWhenFalse"] : []]);
|
|
2344
|
+
const Family = React9__namespace.forwardRef((allProps, ref) => {
|
|
2228
2345
|
const { children, className, ...rest } = allProps;
|
|
2229
2346
|
const record = rest;
|
|
2347
|
+
const flag = options.booleanProps?.map((key) => record[key]).find((value) => typeof value === "boolean");
|
|
2348
|
+
if (record.hideWhenFalse === true && flag === false) return null;
|
|
2230
2349
|
const scalar = (key) => {
|
|
2231
2350
|
const value = record[key];
|
|
2232
2351
|
if (typeof value === "boolean" && options.booleanProps?.includes(key)) return String(value);
|
|
@@ -2284,7 +2403,7 @@ var PreferenceSummaryBadge = createBadgeFamily({
|
|
|
2284
2403
|
labelKeys: ["label", "text", "namespace", "value"],
|
|
2285
2404
|
statusKeys: ["status", "state", "version"]
|
|
2286
2405
|
});
|
|
2287
|
-
var RoleBadgeList =
|
|
2406
|
+
var RoleBadgeList = React9__namespace.forwardRef(
|
|
2288
2407
|
({ roles, badges, roleLabels, value, variant, tone, label, text, children, className, ...rest }, ref) => {
|
|
2289
2408
|
const content = childContent(children);
|
|
2290
2409
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2304,7 +2423,7 @@ var RoleBadgeList = React8__namespace.forwardRef(
|
|
|
2304
2423
|
}
|
|
2305
2424
|
);
|
|
2306
2425
|
RoleBadgeList.displayName = "OODS.RoleBadgeList";
|
|
2307
|
-
var TagPills =
|
|
2426
|
+
var TagPills = React9__namespace.forwardRef(
|
|
2308
2427
|
({ tags, value, maxVisible, overflowLabel, children, className, ...rest }, ref) => {
|
|
2309
2428
|
const content = childContent(children);
|
|
2310
2429
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2356,7 +2475,7 @@ var normalizeTimelineItems = (raw) => {
|
|
|
2356
2475
|
};
|
|
2357
2476
|
function createTimelineFamily(options) {
|
|
2358
2477
|
const consumed = /* @__PURE__ */ new Set(["title", "label", "heading", "name", ...options.eventKeys]);
|
|
2359
|
-
const Family =
|
|
2478
|
+
const Family = React9__namespace.forwardRef((allProps, ref) => {
|
|
2360
2479
|
const { children, className, ...rest } = allProps;
|
|
2361
2480
|
const record = rest;
|
|
2362
2481
|
const text = (key) => {
|
|
@@ -2421,7 +2540,7 @@ var PreferenceTimeline = createTimelineFamily({
|
|
|
2421
2540
|
timelineType: "preference",
|
|
2422
2541
|
eventKeys: ["events", "changes", "history"]
|
|
2423
2542
|
});
|
|
2424
|
-
var AuditEvent =
|
|
2543
|
+
var AuditEvent = React9__namespace.forwardRef(
|
|
2425
2544
|
({
|
|
2426
2545
|
label,
|
|
2427
2546
|
title,
|
|
@@ -2507,7 +2626,7 @@ var addressRecord = (form) => {
|
|
|
2507
2626
|
};
|
|
2508
2627
|
return { street: read("street"), city: read("city"), region: read("region"), postalCode: read("postalCode") };
|
|
2509
2628
|
};
|
|
2510
|
-
var AddressEditor =
|
|
2629
|
+
var AddressEditor = React9__namespace.forwardRef(
|
|
2511
2630
|
({
|
|
2512
2631
|
title,
|
|
2513
2632
|
label,
|
|
@@ -2565,8 +2684,8 @@ var AddressEditor = React8__namespace.forwardRef(
|
|
|
2565
2684
|
}
|
|
2566
2685
|
);
|
|
2567
2686
|
AddressEditor.displayName = "OODS.AddressEditor";
|
|
2568
|
-
var PreferenceEditor =
|
|
2569
|
-
({ title, label, heading, name, description, subtitle, hint, namespaces, namespace, document, json, value, children, className, onSubmit, ...rest }, ref) => {
|
|
2687
|
+
var PreferenceEditor = React9__namespace.forwardRef(
|
|
2688
|
+
({ title, label, heading, name, description, subtitle, hint, namespaces, namespace, document: document2, json, value, children, className, onSubmit, ...rest }, ref) => {
|
|
2570
2689
|
const content = childContent(children);
|
|
2571
2690
|
const authored = content.authored || content.scalar !== void 0;
|
|
2572
2691
|
const resolvedTitle = firstText(title, label, heading, name) ?? "Preference Editor";
|
|
@@ -2593,7 +2712,7 @@ var PreferenceEditor = React8__namespace.forwardRef(
|
|
|
2593
2712
|
] }),
|
|
2594
2713
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { "data-form-control": "textarea", children: [
|
|
2595
2714
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Preference Document" }),
|
|
2596
|
-
/* @__PURE__ */ jsxRuntime.jsx("textarea", { name: "preferenceDocument", defaultValue: firstScalar(
|
|
2715
|
+
/* @__PURE__ */ jsxRuntime.jsx("textarea", { name: "preferenceDocument", defaultValue: firstScalar(document2, json, value) ?? "" })
|
|
2597
2716
|
] })
|
|
2598
2717
|
] }) })
|
|
2599
2718
|
]
|
|
@@ -2602,7 +2721,7 @@ var PreferenceEditor = React8__namespace.forwardRef(
|
|
|
2602
2721
|
}
|
|
2603
2722
|
);
|
|
2604
2723
|
PreferenceEditor.displayName = "OODS.PreferenceEditor";
|
|
2605
|
-
var RoleAssignmentForm =
|
|
2724
|
+
var RoleAssignmentForm = React9__namespace.forwardRef(
|
|
2606
2725
|
({ title, label, heading, name, description, subtitle, hint, roles, availableRoles, role, defaultRoleId, assignee, member, children, className, onSubmit, ...rest }, ref) => {
|
|
2607
2726
|
const content = childContent(children);
|
|
2608
2727
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2639,7 +2758,7 @@ var RoleAssignmentForm = React8__namespace.forwardRef(
|
|
|
2639
2758
|
}
|
|
2640
2759
|
);
|
|
2641
2760
|
RoleAssignmentForm.displayName = "OODS.RoleAssignmentForm";
|
|
2642
|
-
var StatusSelector =
|
|
2761
|
+
var StatusSelector = React9__namespace.forwardRef(
|
|
2643
2762
|
({ label, title, help, options, states, value, status, children, className, onChange, onValueChange, onUpdate, ...rest }, ref) => {
|
|
2644
2763
|
const content = childContent(children);
|
|
2645
2764
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2681,7 +2800,7 @@ var StatusSelector = React8__namespace.forwardRef(
|
|
|
2681
2800
|
}
|
|
2682
2801
|
);
|
|
2683
2802
|
StatusSelector.displayName = "OODS.StatusSelector";
|
|
2684
|
-
var TagInput =
|
|
2803
|
+
var TagInput = React9__namespace.forwardRef(
|
|
2685
2804
|
({ title, label, heading, name, description, subtitle, hint, tags, value, placeholder, children, className, onChange, onValueChange, onUpdate, ...rest }, ref) => {
|
|
2686
2805
|
const content = childContent(children);
|
|
2687
2806
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2728,7 +2847,7 @@ var TagInput = React8__namespace.forwardRef(
|
|
|
2728
2847
|
}
|
|
2729
2848
|
);
|
|
2730
2849
|
TagInput.displayName = "OODS.TagInput";
|
|
2731
|
-
var TemplatePicker =
|
|
2850
|
+
var TemplatePicker = React9__namespace.forwardRef(
|
|
2732
2851
|
({ title, label, heading, name, description, subtitle, hint, templates, options, templateId, value, channels, channel, children, className, ...rest }, ref) => {
|
|
2733
2852
|
const content = childContent(children);
|
|
2734
2853
|
const authored = content.authored || content.scalar !== void 0;
|
|
@@ -2766,14 +2885,14 @@ var truncateLabel = (value, maxLength) => {
|
|
|
2766
2885
|
const limit = typeof maxLength === "number" ? maxLength : Number(maxLength);
|
|
2767
2886
|
return !Number.isFinite(limit) || limit <= 0 || value.length <= limit ? value : `${value.slice(0, Math.max(0, limit - 1)).trimEnd()}...`;
|
|
2768
2887
|
};
|
|
2769
|
-
var InlineLabel =
|
|
2888
|
+
var InlineLabel = React9__namespace.forwardRef(
|
|
2770
2889
|
({ label, text, value, maxLength, children, className, ...rest }, ref) => {
|
|
2771
2890
|
const content = childContent(children);
|
|
2772
2891
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: classes7("oods-inline-label", className), "data-oods-component": "InlineLabel", ...rest, children: content.authored || content.scalar !== void 0 ? children : truncateLabel(firstText(label, text, value) ?? "", maxLength) });
|
|
2773
2892
|
}
|
|
2774
2893
|
);
|
|
2775
2894
|
InlineLabel.displayName = "OODS.InlineLabel";
|
|
2776
|
-
var LabelCell =
|
|
2895
|
+
var LabelCell = React9__namespace.forwardRef(
|
|
2777
2896
|
({ label, text, value, description, subtitle, sublabel, supporting, truncate, maxLength, children, className, ...rest }, ref) => {
|
|
2778
2897
|
const content = childContent(children);
|
|
2779
2898
|
const limit = truncate ? maxLength ?? 40 : maxLength;
|
|
@@ -2786,7 +2905,7 @@ var LabelCell = React8__namespace.forwardRef(
|
|
|
2786
2905
|
}
|
|
2787
2906
|
);
|
|
2788
2907
|
LabelCell.displayName = "OODS.LabelCell";
|
|
2789
|
-
var FormLabelGroup =
|
|
2908
|
+
var FormLabelGroup = React9__namespace.forwardRef(
|
|
2790
2909
|
({ label, text, title, placeholder, hint, description, htmlFor, for: forId, inputId, children, className, ...rest }, ref) => {
|
|
2791
2910
|
const detail = firstText(placeholder, hint, description);
|
|
2792
2911
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { ref, className: classes7("oods-form-label-group", className), "data-oods-component": "FormLabelGroup", htmlFor: htmlFor ?? forId ?? inputId, ...rest, children: [
|
|
@@ -2805,7 +2924,7 @@ var ClassificationBadge = createBadgeFamily({
|
|
|
2805
2924
|
labelKeys: ["label", "text", "category", "value"],
|
|
2806
2925
|
statusKeys: ["status", "state", "mode"]
|
|
2807
2926
|
});
|
|
2808
|
-
var ClassificationEditor =
|
|
2927
|
+
var ClassificationEditor = React9__namespace.forwardRef(
|
|
2809
2928
|
({ title, label, heading, name, description, subtitle, hint, category, primaryCategory, tags, modes, mode, classificationMode, children, className, onSubmit, ...rest }, ref) => {
|
|
2810
2929
|
const content = childContent(children);
|
|
2811
2930
|
const tagText = typeof tags === "string" ? tags : tags === void 0 ? "" : JSON.stringify(tags);
|
|
@@ -2851,7 +2970,7 @@ var OwnerBadge = createBadgeFamily({
|
|
|
2851
2970
|
labelKeys: ["label", "text", "owner", "ownerType", "value"],
|
|
2852
2971
|
statusKeys: ["status", "state"]
|
|
2853
2972
|
});
|
|
2854
|
-
var OwnershipSummary =
|
|
2973
|
+
var OwnershipSummary = React9__namespace.forwardRef(
|
|
2855
2974
|
({ title, label, heading, name, ownerLabel, ownerId, owner_id, ownerType, owner_type, role, ownershipRole, summary: summary2, text, description, children, className, ...rest }, ref) => {
|
|
2856
2975
|
const content = childContent(children);
|
|
2857
2976
|
const terms = [["Owner", ownerId === void 0 && owner_id === void 0 && ownerLabel === void 0 ? void 0 : componentContracts.formatReferenceLabel(ownerId ?? owner_id, ownerLabel, "Owner")], ["Owner Type", firstScalar(ownerType, owner_type)], ["Role", firstScalar(role, ownershipRole)]].filter((entry) => entry[1] !== void 0);
|
|
@@ -2866,7 +2985,7 @@ var OwnershipSummary = React8__namespace.forwardRef(
|
|
|
2866
2985
|
}
|
|
2867
2986
|
);
|
|
2868
2987
|
OwnershipSummary.displayName = "OODS.OwnershipSummary";
|
|
2869
|
-
var TagSummary =
|
|
2988
|
+
var TagSummary = React9__namespace.forwardRef(
|
|
2870
2989
|
({ title, label, heading, name, tagCount, count, tags, summary: summary2, text, description, children, className, ...rest }, ref) => {
|
|
2871
2990
|
const content = childContent(children);
|
|
2872
2991
|
const tagText = Array.isArray(tags) ? normalizeTagItems(tags).join(", ") || void 0 : firstText(tags);
|
|
@@ -2882,11 +3001,12 @@ var TagSummary = React8__namespace.forwardRef(
|
|
|
2882
3001
|
}
|
|
2883
3002
|
);
|
|
2884
3003
|
TagSummary.displayName = "OODS.TagSummary";
|
|
2885
|
-
var OwnershipMeta =
|
|
2886
|
-
({ title, label, heading, name, ownerType, owner_type, role, ownershipRole, children, className, ...rest }, ref) => {
|
|
3004
|
+
var OwnershipMeta = React9__namespace.forwardRef(
|
|
3005
|
+
({ title, label, heading, name, ownerType, owner_type, role, ownershipRole, ownerLabel, children, className, ...rest }, ref) => {
|
|
2887
3006
|
const content = childContent(children);
|
|
2888
3007
|
const terms = [["Owner Type", firstScalar(ownerType, owner_type)], ["Role", firstScalar(role, ownershipRole)]].filter((entry) => entry[1] !== void 0);
|
|
2889
|
-
|
|
3008
|
+
const phrase = ownerLabel !== void 0 ? componentContracts.ownershipPhrase(ownerLabel, firstScalar(ownerType, owner_type), firstScalar(role, ownershipRole)) : void 0;
|
|
3009
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: classes7("oods-ownership-meta", className), "data-oods-component": "OwnershipMeta", "data-meta-type": "ownership", ...rest, children: content.authored || content.scalar !== void 0 ? children : phrase ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-meta-item": "true", children: phrase }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2890
3010
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-meta-title": "true", children: firstText(title, label, heading, name) ?? "Ownership" }),
|
|
2891
3011
|
terms.map(([term, value]) => /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-meta-item": "true", children: [
|
|
2892
3012
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
@@ -2920,9 +3040,10 @@ var CancellationBadge = createBadgeFamily({
|
|
|
2920
3040
|
booleanProps: ["cancelAtPeriodEnd", "isCancelled", "value"],
|
|
2921
3041
|
booleanLabels: ["Cancellation scheduled", "No cancellation scheduled"]
|
|
2922
3042
|
});
|
|
2923
|
-
var ArchiveSummary =
|
|
2924
|
-
({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, children, className, ...rest }, ref) => {
|
|
3043
|
+
var ArchiveSummary = React9__namespace.forwardRef(
|
|
3044
|
+
({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, hideWhenDefault, children, className, ...rest }, ref) => {
|
|
2925
3045
|
const content = childContent(children);
|
|
3046
|
+
if (hideWhenDefault === true && (isArchived ?? archived ?? status) === false && !archivedAt && !firstText(reason, archiveReason) && !content.authored && content.scalar === void 0) return null;
|
|
2926
3047
|
const terms = [["Archived", componentContracts.summaryValue(isArchived ?? archived ?? status)], ["Archived At", archivedAt ? componentContracts.formatDateTime(archivedAt) : void 0], ["Reason", firstText(reason, archiveReason)]].filter((entry) => entry[1] !== void 0);
|
|
2927
3048
|
const fallback = firstText(summary2, text, description);
|
|
2928
3049
|
return /* @__PURE__ */ jsxRuntime.jsxs("section", { ref, className: classes7("oods-archive-summary", className), "data-oods-component": "ArchiveSummary", "data-summary-type": "archive", ...rest, children: [
|
|
@@ -2935,7 +3056,7 @@ var ArchiveSummary = React8__namespace.forwardRef(
|
|
|
2935
3056
|
}
|
|
2936
3057
|
);
|
|
2937
3058
|
ArchiveSummary.displayName = "OODS.ArchiveSummary";
|
|
2938
|
-
var PriceCardMeta =
|
|
3059
|
+
var PriceCardMeta = React9__namespace.forwardRef(
|
|
2939
3060
|
({ title, label, heading, name, model, pricingModel, interval, billingInterval, children, className, ...rest }, ref) => {
|
|
2940
3061
|
const content = childContent(children);
|
|
2941
3062
|
const terms = [["Model", componentContracts.formatPriceCode(firstText(model, pricingModel))], ["Interval", componentContracts.formatPriceCode(firstText(interval, billingInterval))]].filter((entry) => entry[1] !== void 0);
|
|
@@ -2953,12 +3074,12 @@ var PriceCardMeta = React8__namespace.forwardRef(
|
|
|
2953
3074
|
}
|
|
2954
3075
|
);
|
|
2955
3076
|
PriceCardMeta.displayName = "OODS.PriceCardMeta";
|
|
2956
|
-
var CancellationForm =
|
|
3077
|
+
var CancellationForm = React9__namespace.forwardRef(
|
|
2957
3078
|
({ title, label, heading, name, description, subtitle, hint, allowedReasons, reasonCode, reason, cancellationReason, embedded, reasonHelp, codeHelp, children, className, onSubmit, ...rest }, ref) => {
|
|
2958
3079
|
const content = childContent(children);
|
|
2959
3080
|
const choices = normalizeSelectOptions(allowedReasons ?? ["no_longer_needed", "budget", "duplicate"]);
|
|
2960
3081
|
if (reasonCode && !choices.some((choice) => choice.value === reasonCode)) choices.unshift({ value: reasonCode, label: reasonCode });
|
|
2961
|
-
return
|
|
3082
|
+
return React9__namespace.createElement(embedded ? "fieldset" : "form", {
|
|
2962
3083
|
...rest,
|
|
2963
3084
|
ref,
|
|
2964
3085
|
className: classes7("oods-cancellation-form", className),
|
|
@@ -2990,11 +3111,11 @@ function BillingSummaryBadge({ id, amount, currency, minorUnits, interval, showI
|
|
|
2990
3111
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { id, className: `oods-billing-summary ${className ?? ""}`.trim(), "data-oods-component": "BillingSummaryBadge", children: showInterval ? componentContracts.billingSummary(amount, currency, minorUnits, interval) : componentContracts.formatBillingAmount(amount, currency, minorUnits) });
|
|
2991
3112
|
}
|
|
2992
3113
|
function BillingAmountInput({ id, amount, currency = "usd", minorUnits = componentContracts.BILLING_MINOR_UNITS, label = "Billing amount", name, disabled, className, help, onChange }) {
|
|
2993
|
-
const generatedId =
|
|
3114
|
+
const generatedId = React9__namespace.useId();
|
|
2994
3115
|
const controlId = id ?? `billing-amount-${generatedId}`;
|
|
2995
|
-
const [text, setText] =
|
|
2996
|
-
const [error, setError] =
|
|
2997
|
-
|
|
3116
|
+
const [text, setText] = React9__namespace.useState(() => componentContracts.billingAmountText(amount, minorUnits));
|
|
3117
|
+
const [error, setError] = React9__namespace.useState(() => componentContracts.billingAmountMessage(amount, minorUnits));
|
|
3118
|
+
React9__namespace.useEffect(() => {
|
|
2998
3119
|
setText(componentContracts.billingAmountText(amount, minorUnits));
|
|
2999
3120
|
setError(componentContracts.billingAmountMessage(amount, minorUnits));
|
|
3000
3121
|
}, [amount, minorUnits]);
|
|
@@ -3028,10 +3149,10 @@ function BillingAmountInput({ id, amount, currency = "usd", minorUnits = compone
|
|
|
3028
3149
|
] });
|
|
3029
3150
|
}
|
|
3030
3151
|
function BillingIntervalSelector({ id, interval, intervals = componentContracts.BILLING_INTERVALS, label = "Billing interval", name, disabled, className, help, onChange }) {
|
|
3031
|
-
const generatedId =
|
|
3152
|
+
const generatedId = React9__namespace.useId();
|
|
3032
3153
|
const controlId = id ?? `billing-interval-${generatedId}`;
|
|
3033
|
-
const [value, setValue] =
|
|
3034
|
-
|
|
3154
|
+
const [value, setValue] = React9__namespace.useState(interval ?? "");
|
|
3155
|
+
React9__namespace.useEffect(() => {
|
|
3035
3156
|
setValue(interval ?? "");
|
|
3036
3157
|
}, [interval]);
|
|
3037
3158
|
const error = componentContracts.billingIntervalMessage(value || void 0, intervals);
|
|
@@ -3139,8 +3260,8 @@ function AuditSummaryCard({ id, title = "Audit summary", showTransitionCount = t
|
|
|
3139
3260
|
] });
|
|
3140
3261
|
}
|
|
3141
3262
|
function SortIndicator({ id, label = "Sort", onChange, "data-oods-action": action, ...values }) {
|
|
3142
|
-
const [state, setState] =
|
|
3143
|
-
|
|
3263
|
+
const [state, setState] = React9__namespace.useState(() => componentContracts.initialSort(values));
|
|
3264
|
+
React9__namespace.useEffect(() => setState(componentContracts.initialSort(values)), [values.sortField, values.sortDirection, values.sortActive, values.defaultSortField, values.defaultSortDirection]);
|
|
3144
3265
|
const sort = componentContracts.ariaSort(state);
|
|
3145
3266
|
return /* @__PURE__ */ jsxRuntime.jsx("table", { id, className: "oods-sort-indicator", "data-oods-component": "SortIndicator", "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", "aria-sort": sort, children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "data-oods-action": action, "aria-label": `${label} ${state.field}`, onClick: () => {
|
|
3146
3267
|
const next = componentContracts.nextSort(state, values.triStateSort);
|
|
@@ -3148,14 +3269,15 @@ function SortIndicator({ id, label = "Sort", onChange, "data-oods-action": actio
|
|
|
3148
3269
|
onChange?.(next);
|
|
3149
3270
|
}, children: `${state.field}: ${sort}` }) }) }) }) });
|
|
3150
3271
|
}
|
|
3151
|
-
var TimelineEntryLabel =
|
|
3272
|
+
var TimelineEntryLabel = React9__namespace.forwardRef(({ compact = true, maxLength, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(InlineLabel, { ...props, ref, maxLength: maxLength ?? (compact ? 40 : void 0), "data-oods-component": "TimelineEntryLabel", "data-timeline-label": "true", "data-compact": compact }));
|
|
3152
3273
|
TimelineEntryLabel.displayName = "OODS.TimelineEntryLabel";
|
|
3153
3274
|
function eventRecipe(id, kind, title) {
|
|
3154
3275
|
return function TraitEvent({ id: elementId, title: heading = title, ...values }) {
|
|
3155
3276
|
const rows = componentContracts.traitEventRows(kind, values);
|
|
3277
|
+
if (!rows.length) return null;
|
|
3156
3278
|
return /* @__PURE__ */ jsxRuntime.jsxs("article", { id: elementId, className: "oods-trait-recipe", "data-oods-component": id, "aria-label": heading, children: [
|
|
3157
3279
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: heading }),
|
|
3158
|
-
|
|
3280
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { children: rows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3159
3281
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: row.title }),
|
|
3160
3282
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: row.at ? /* @__PURE__ */ jsxRuntime.jsx("time", { dateTime: row.at, children: row.time }) : row.time }),
|
|
3161
3283
|
row.actor && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
@@ -3170,7 +3292,7 @@ function eventRecipe(id, kind, title) {
|
|
|
3170
3292
|
"Code: ",
|
|
3171
3293
|
row.code
|
|
3172
3294
|
] })
|
|
3173
|
-
] }, index)) })
|
|
3295
|
+
] }, index)) })
|
|
3174
3296
|
] });
|
|
3175
3297
|
};
|
|
3176
3298
|
}
|
|
@@ -3191,9 +3313,9 @@ function CommunicationDetailPanel({ id, title = "Communication", channels = [],
|
|
|
3191
3313
|
] });
|
|
3192
3314
|
}
|
|
3193
3315
|
function ColorStatePicker({ id, title = "Color state", colorStates = componentContracts.DEFAULT_COLOR_STATES, value, disabled, onChange }) {
|
|
3194
|
-
const generatedId =
|
|
3195
|
-
const [selected, setSelected] =
|
|
3196
|
-
|
|
3316
|
+
const generatedId = React9__namespace.useId();
|
|
3317
|
+
const [selected, setSelected] = React9__namespace.useState(value ?? colorStates[0] ?? "");
|
|
3318
|
+
React9__namespace.useEffect(() => setSelected(value ?? colorStates[0] ?? ""), [value, colorStates]);
|
|
3197
3319
|
return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { id, className: "oods-trait-recipe", "data-oods-component": "ColorStatePicker", children: [
|
|
3198
3320
|
/* @__PURE__ */ jsxRuntime.jsx("legend", { children: title }),
|
|
3199
3321
|
/* @__PURE__ */ jsxRuntime.jsx(Select, { id: `${id ?? generatedId}-state`, label: "Color state", name: "color_state", value: selected, disabled, options: [...!colorStates.includes(selected) ? [{ value: selected, label: selected || "Choose state", disabled: true }] : [], ...colorStates.map((value2) => ({ value: value2, label: componentContracts.formatReadOnlyValue(value2, "string", true) }))], onValueChange: (next) => {
|
|
@@ -3215,9 +3337,9 @@ function StatusColorLegend({ id, title = "Status colors", colorStates = componen
|
|
|
3215
3337
|
] });
|
|
3216
3338
|
}
|
|
3217
3339
|
function GeoFieldMappingForm({ id, title = "Geographic fields", embedded = false, disabled, onChange, ...values }) {
|
|
3218
|
-
const generatedId =
|
|
3219
|
-
const [value, setValue] =
|
|
3220
|
-
|
|
3340
|
+
const generatedId = React9__namespace.useId();
|
|
3341
|
+
const [value, setValue] = React9__namespace.useState(() => componentContracts.geoFieldMapping(values));
|
|
3342
|
+
React9__namespace.useEffect(() => setValue(componentContracts.geoFieldMapping(values)), [values.latitude, values.longitude, values.identifier, values.autoDetect]);
|
|
3221
3343
|
const update = (patch) => {
|
|
3222
3344
|
const next = { ...value, ...patch };
|
|
3223
3345
|
setValue(next);
|
|
@@ -3251,11 +3373,11 @@ function GeocodablePreview({ id, title = "Geographic data", resolution, requires
|
|
|
3251
3373
|
}
|
|
3252
3374
|
function controls(id) {
|
|
3253
3375
|
const Component = ({ id: htmlId, title = componentContracts.VIZ_CONTROL_TITLES[id], value, channel = "x", disabled, onChange }) => {
|
|
3254
|
-
const generatedId =
|
|
3255
|
-
const [current, setCurrent] =
|
|
3256
|
-
const [drafts, setDrafts] =
|
|
3257
|
-
const [errors, setErrors] =
|
|
3258
|
-
|
|
3376
|
+
const generatedId = React9__namespace.useId();
|
|
3377
|
+
const [current, setCurrent] = React9__namespace.useState(value ?? {});
|
|
3378
|
+
const [drafts, setDrafts] = React9__namespace.useState({});
|
|
3379
|
+
const [errors, setErrors] = React9__namespace.useState({});
|
|
3380
|
+
React9__namespace.useEffect(() => {
|
|
3259
3381
|
setCurrent(value ?? {});
|
|
3260
3382
|
setDrafts({});
|
|
3261
3383
|
setErrors({});
|
|
@@ -3329,6 +3451,215 @@ var VizLinePreview = preview("VizLinePreview", "line");
|
|
|
3329
3451
|
var VizMarkPreview = preview("VizMarkPreview", "bar");
|
|
3330
3452
|
var VizPointPreview = preview("VizPointPreview", "scatter");
|
|
3331
3453
|
var VizScatterPreview = preview("VizScatterPreview", "scatter");
|
|
3454
|
+
var classes8 = (...values) => values.filter(Boolean).join(" ");
|
|
3455
|
+
var Combobox = React9__namespace.forwardRef(
|
|
3456
|
+
({
|
|
3457
|
+
id,
|
|
3458
|
+
label,
|
|
3459
|
+
options = [],
|
|
3460
|
+
value,
|
|
3461
|
+
defaultValue = "",
|
|
3462
|
+
placeholder,
|
|
3463
|
+
name,
|
|
3464
|
+
required,
|
|
3465
|
+
disabled,
|
|
3466
|
+
help,
|
|
3467
|
+
validation,
|
|
3468
|
+
size = "md",
|
|
3469
|
+
className,
|
|
3470
|
+
style,
|
|
3471
|
+
onValueChange,
|
|
3472
|
+
onUpdate,
|
|
3473
|
+
onKeyDown,
|
|
3474
|
+
onBlur,
|
|
3475
|
+
onClick,
|
|
3476
|
+
"aria-describedby": nativeDescription,
|
|
3477
|
+
...rest
|
|
3478
|
+
}, ref) => {
|
|
3479
|
+
const [internalValue, setInternalValue] = React9__namespace.useState(defaultValue);
|
|
3480
|
+
const [query, setQuery] = React9__namespace.useState(null);
|
|
3481
|
+
const [open, setOpen] = React9__namespace.useState(false);
|
|
3482
|
+
const [active, setActive] = React9__namespace.useState(-1);
|
|
3483
|
+
const rootRef = React9__namespace.useRef(null);
|
|
3484
|
+
const listboxRef = React9__namespace.useRef(null);
|
|
3485
|
+
const chosenValue = value ?? internalValue;
|
|
3486
|
+
const chosen = options.find((option) => option.value === chosenValue);
|
|
3487
|
+
const text = query ?? chosen?.label ?? "";
|
|
3488
|
+
const needle = (query ?? "").trim().toLowerCase();
|
|
3489
|
+
const matches = options.map((option) => needle === "" || option.label.toLowerCase().includes(needle));
|
|
3490
|
+
const matchCount = matches.filter(Boolean).length;
|
|
3491
|
+
const reachable = options.flatMap((option, index) => matches[index] && !option.disabled ? [index] : []);
|
|
3492
|
+
const optionId = (index) => `${id}-option-${index}`;
|
|
3493
|
+
const validationId = validation?.id ?? `${id}-validation`;
|
|
3494
|
+
const describedBy = [nativeDescription, help ? `${id}-help` : void 0, validation?.message ? validationId : void 0].filter(Boolean).join(" ") || void 0;
|
|
3495
|
+
const tone = validation ? validation.state === "error" ? "critical" : validation.state : void 0;
|
|
3496
|
+
const close = () => {
|
|
3497
|
+
setOpen(false);
|
|
3498
|
+
setActive(-1);
|
|
3499
|
+
};
|
|
3500
|
+
const emit = (next) => {
|
|
3501
|
+
if (value === void 0) setInternalValue(next);
|
|
3502
|
+
onValueChange?.(next);
|
|
3503
|
+
onUpdate?.(next);
|
|
3504
|
+
};
|
|
3505
|
+
const pick = (index) => {
|
|
3506
|
+
const option = options[index];
|
|
3507
|
+
if (!option || option.disabled) return;
|
|
3508
|
+
setQuery(null);
|
|
3509
|
+
close();
|
|
3510
|
+
if (option.value !== chosenValue) emit(option.value);
|
|
3511
|
+
};
|
|
3512
|
+
React9__namespace.useEffect(() => {
|
|
3513
|
+
if (!open) return void 0;
|
|
3514
|
+
const outside = (event) => {
|
|
3515
|
+
if (!rootRef.current?.contains(event.target)) close();
|
|
3516
|
+
};
|
|
3517
|
+
document.addEventListener("pointerdown", outside);
|
|
3518
|
+
return () => document.removeEventListener("pointerdown", outside);
|
|
3519
|
+
}, [open]);
|
|
3520
|
+
React9__namespace.useEffect(() => {
|
|
3521
|
+
if (!open || active < 0) return;
|
|
3522
|
+
const element = listboxRef.current?.children[active];
|
|
3523
|
+
element?.scrollIntoView?.({ block: "nearest" });
|
|
3524
|
+
}, [open, active]);
|
|
3525
|
+
const handleKeyDown = (event) => {
|
|
3526
|
+
onKeyDown?.(event);
|
|
3527
|
+
if (event.defaultPrevented || disabled || event.nativeEvent.isComposing) return;
|
|
3528
|
+
const first = reachable[0] ?? -1;
|
|
3529
|
+
const last = reachable[reachable.length - 1] ?? -1;
|
|
3530
|
+
const at = reachable.indexOf(active);
|
|
3531
|
+
switch (event.key) {
|
|
3532
|
+
case "ArrowDown":
|
|
3533
|
+
event.preventDefault();
|
|
3534
|
+
setOpen(true);
|
|
3535
|
+
setActive(!open || at === -1 ? first : reachable[(at + 1) % reachable.length]);
|
|
3536
|
+
return;
|
|
3537
|
+
case "ArrowUp":
|
|
3538
|
+
event.preventDefault();
|
|
3539
|
+
setOpen(true);
|
|
3540
|
+
setActive(!open || at <= 0 ? last : reachable[at - 1]);
|
|
3541
|
+
return;
|
|
3542
|
+
case "Home":
|
|
3543
|
+
case "End":
|
|
3544
|
+
if (!open) return;
|
|
3545
|
+
event.preventDefault();
|
|
3546
|
+
setActive(event.key === "Home" ? first : last);
|
|
3547
|
+
return;
|
|
3548
|
+
case "Enter":
|
|
3549
|
+
if (!open) return;
|
|
3550
|
+
event.preventDefault();
|
|
3551
|
+
if (active >= 0) pick(active);
|
|
3552
|
+
return;
|
|
3553
|
+
case "Escape":
|
|
3554
|
+
if (open) {
|
|
3555
|
+
event.preventDefault();
|
|
3556
|
+
close();
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
if (text === "" && chosenValue === "") return;
|
|
3560
|
+
event.preventDefault();
|
|
3561
|
+
setQuery(null);
|
|
3562
|
+
if (chosenValue !== "") emit("");
|
|
3563
|
+
return;
|
|
3564
|
+
case "Tab":
|
|
3565
|
+
if (open) close();
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3569
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3570
|
+
"div",
|
|
3571
|
+
{
|
|
3572
|
+
ref: rootRef,
|
|
3573
|
+
className: classes8("oods-field", "oods-combobox", className),
|
|
3574
|
+
style: {
|
|
3575
|
+
...tone ? {
|
|
3576
|
+
"--cmp-input-message-border": `var(--sys-status-${tone}-border)`,
|
|
3577
|
+
"--cmp-input-message-text": `var(--sys-status-${tone}-text)`
|
|
3578
|
+
} : {},
|
|
3579
|
+
...style
|
|
3580
|
+
},
|
|
3581
|
+
"data-oods-component": "Combobox",
|
|
3582
|
+
"data-size": size,
|
|
3583
|
+
"data-validation-state": validation?.state,
|
|
3584
|
+
children: [
|
|
3585
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { id: `${id}-label`, className: "oods-field-label", htmlFor: id, children: [
|
|
3586
|
+
label,
|
|
3587
|
+
required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oods-field-required", "aria-hidden": "true", children: "*" }) : null
|
|
3588
|
+
] }),
|
|
3589
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oods-combobox__control", children: [
|
|
3590
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3591
|
+
"input",
|
|
3592
|
+
{
|
|
3593
|
+
...rest,
|
|
3594
|
+
ref,
|
|
3595
|
+
id,
|
|
3596
|
+
type: "text",
|
|
3597
|
+
role: "combobox",
|
|
3598
|
+
className: "oods-field-control oods-combobox__input",
|
|
3599
|
+
value: text,
|
|
3600
|
+
placeholder,
|
|
3601
|
+
autoComplete: "off",
|
|
3602
|
+
"aria-autocomplete": "list",
|
|
3603
|
+
"aria-expanded": open,
|
|
3604
|
+
"aria-controls": `${id}-listbox`,
|
|
3605
|
+
"aria-activedescendant": open && active >= 0 ? optionId(active) : void 0,
|
|
3606
|
+
"aria-describedby": describedBy,
|
|
3607
|
+
"aria-invalid": validation?.state === "error" || void 0,
|
|
3608
|
+
required,
|
|
3609
|
+
disabled,
|
|
3610
|
+
onChange: (event) => {
|
|
3611
|
+
setQuery(event.currentTarget.value);
|
|
3612
|
+
setOpen(true);
|
|
3613
|
+
setActive(-1);
|
|
3614
|
+
},
|
|
3615
|
+
onKeyDown: handleKeyDown,
|
|
3616
|
+
onClick: (event) => {
|
|
3617
|
+
onClick?.(event);
|
|
3618
|
+
if (!event.defaultPrevented && !disabled) setOpen(true);
|
|
3619
|
+
},
|
|
3620
|
+
onBlur: (event) => {
|
|
3621
|
+
onBlur?.(event);
|
|
3622
|
+
setQuery(null);
|
|
3623
|
+
close();
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
),
|
|
3627
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "oods-combobox__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { name: "chevron-down" }) }),
|
|
3628
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oods-combobox__popup", hidden: !open, onMouseDown: (event) => event.preventDefault(), children: [
|
|
3629
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { ref: listboxRef, id: `${id}-listbox`, className: "oods-combobox__listbox", role: "listbox", "aria-labelledby": `${id}-label`, children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3630
|
+
"li",
|
|
3631
|
+
{
|
|
3632
|
+
id: optionId(index),
|
|
3633
|
+
className: "oods-combobox__option",
|
|
3634
|
+
role: "option",
|
|
3635
|
+
"aria-selected": option.value === chosenValue,
|
|
3636
|
+
"aria-disabled": option.disabled || void 0,
|
|
3637
|
+
"data-value": option.value,
|
|
3638
|
+
"data-active": index === active ? "true" : void 0,
|
|
3639
|
+
hidden: !matches[index],
|
|
3640
|
+
onClick: () => pick(index),
|
|
3641
|
+
onPointerMove: () => {
|
|
3642
|
+
if (!option.disabled && index !== active) setActive(index);
|
|
3643
|
+
},
|
|
3644
|
+
children: [
|
|
3645
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "oods-combobox__option-label", children: option.label }),
|
|
3646
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "oods-combobox__check", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { name: "check" }) })
|
|
3647
|
+
]
|
|
3648
|
+
},
|
|
3649
|
+
option.value
|
|
3650
|
+
)) }),
|
|
3651
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "oods-combobox__empty", role: "status", children: open && matchCount === 0 ? "No matches" : "" })
|
|
3652
|
+
] })
|
|
3653
|
+
] }),
|
|
3654
|
+
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: chosenValue }) : null,
|
|
3655
|
+
help ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: `${id}-help`, className: "oods-field-help", children: help }) : null,
|
|
3656
|
+
validation?.message ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: validationId, className: "oods-field-error", role: validation.state === "error" ? "alert" : void 0, children: validation.message }) : null
|
|
3657
|
+
]
|
|
3658
|
+
}
|
|
3659
|
+
);
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
Combobox.displayName = "OODS.Combobox";
|
|
3332
3663
|
|
|
3333
3664
|
exports.AddressCollectionPanel = AddressCollectionPanel;
|
|
3334
3665
|
exports.AddressEditor = AddressEditor;
|
|
@@ -3361,6 +3692,7 @@ exports.ClassificationPanel = ClassificationPanel;
|
|
|
3361
3692
|
exports.ColorStatePicker = ColorStatePicker;
|
|
3362
3693
|
exports.ColorSwatch = ColorSwatch;
|
|
3363
3694
|
exports.ColorizedBadge = ColorizedBadge;
|
|
3695
|
+
exports.Combobox = Combobox;
|
|
3364
3696
|
exports.CommunicationDetailPanel = CommunicationDetailPanel;
|
|
3365
3697
|
exports.CycleProgressCard = CycleProgressCard;
|
|
3366
3698
|
exports.DatePicker = DatePicker;
|
|
@@ -3396,6 +3728,7 @@ exports.RelativeTimestamp = RelativeTimestamp;
|
|
|
3396
3728
|
exports.RoleAssignmentForm = RoleAssignmentForm;
|
|
3397
3729
|
exports.RoleBadgeList = RoleBadgeList;
|
|
3398
3730
|
exports.SearchInput = SearchInput;
|
|
3731
|
+
exports.SegmentedControl = SegmentedControl;
|
|
3399
3732
|
exports.Select = Select;
|
|
3400
3733
|
exports.SortIndicator = SortIndicator;
|
|
3401
3734
|
exports.Stack = Stack;
|