@tensor_1/react 2.13.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox-model.d.ts +9 -0
- package/dist/combobox-model.js +10 -0
- package/dist/components/AsyncOperationStatus.d.ts +16 -0
- package/dist/components/AsyncOperationStatus.js +24 -0
- package/dist/components/Breadcrumbs.d.ts +18 -0
- package/dist/components/Breadcrumbs.js +14 -0
- package/dist/components/Card.d.ts +11 -2
- package/dist/components/Card.js +16 -1
- package/dist/components/CollapsibleSection.d.ts +11 -0
- package/dist/components/CollapsibleSection.js +17 -0
- package/dist/components/Combobox.d.ts +19 -0
- package/dist/components/Combobox.js +120 -0
- package/dist/components/DetailPage.d.ts +33 -0
- package/dist/components/DetailPage.js +19 -0
- package/dist/components/Dialogs.d.ts +35 -0
- package/dist/components/Dialogs.js +55 -0
- package/dist/components/Modal.d.ts +3 -1
- package/dist/components/Modal.js +6 -4
- package/dist/components/RelatedLinks.d.ts +16 -0
- package/dist/components/RelatedLinks.js +14 -0
- package/dist/components/RelativeTime.d.ts +23 -0
- package/dist/components/RelativeTime.js +40 -0
- package/dist/components/Sidebar.d.ts +7 -2
- package/dist/components/Sidebar.js +27 -9
- package/dist/components/States.d.ts +23 -4
- package/dist/components/States.js +28 -6
- package/dist/components/TableControls.d.ts +77 -0
- package/dist/components/TableControls.js +61 -0
- package/dist/components/ToggleRow.d.ts +14 -0
- package/dist/components/ToggleRow.js +16 -0
- package/dist/index.cjs +1277 -786
- package/dist/index.d.cts +280 -8
- package/dist/index.d.ts +14 -2
- package/dist/index.js +34 -2
- package/dist/relative-time-clock.d.ts +4 -0
- package/dist/relative-time-clock.js +33 -0
- package/dist/relative-time-model.d.ts +9 -0
- package/dist/relative-time-model.js +16 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22,19 +22,24 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
Alert: () => Alert,
|
|
24
24
|
AppShell: () => AppShell,
|
|
25
|
+
AsyncOperationStatus: () => AsyncOperationStatus,
|
|
25
26
|
Avatar: () => Avatar,
|
|
26
27
|
AvatarGroup: () => AvatarGroup,
|
|
27
28
|
BrandProfileEditor: () => BrandProfileEditor,
|
|
28
29
|
BrandProfiles: () => BrandProfiles,
|
|
30
|
+
Breadcrumbs: () => Breadcrumbs,
|
|
29
31
|
BuilderCanvas: () => BuilderCanvas,
|
|
30
32
|
BulkBar: () => BulkBar,
|
|
31
33
|
Button: () => Button,
|
|
32
34
|
ButtonGroup: () => ButtonGroup,
|
|
33
35
|
Card: () => Card,
|
|
36
|
+
CardLink: () => CardLink,
|
|
34
37
|
CellStrong: () => CellStrong,
|
|
35
38
|
CellSub: () => CellSub,
|
|
36
39
|
Checkbox: () => Checkbox,
|
|
40
|
+
CollapsibleSection: () => CollapsibleSection,
|
|
37
41
|
ColorPicker: () => ColorPicker,
|
|
42
|
+
Combobox: () => Combobox,
|
|
38
43
|
CommandGroup: () => CommandGroup,
|
|
39
44
|
CommandItem: () => CommandItem,
|
|
40
45
|
CommandPalette: () => CommandPalette,
|
|
@@ -42,12 +47,14 @@ __export(src_exports, {
|
|
|
42
47
|
Comments: () => Comments,
|
|
43
48
|
Composer: () => Composer,
|
|
44
49
|
ComposerBar: () => ComposerBar,
|
|
50
|
+
ConfirmDialog: () => ConfirmDialog,
|
|
45
51
|
ContentList: () => ContentList,
|
|
46
52
|
ContentListItem: () => ContentListItem,
|
|
47
53
|
DateRangePicker: () => DateRangePicker,
|
|
48
54
|
DescriptionItem: () => DescriptionItem,
|
|
49
55
|
DescriptionList: () => DescriptionList,
|
|
50
56
|
DetailLayout: () => DetailLayout,
|
|
57
|
+
DetailPage: () => DetailPage,
|
|
51
58
|
DiffViewer: () => DiffViewer,
|
|
52
59
|
Drawer: () => Drawer,
|
|
53
60
|
EmptyState: () => EmptyState,
|
|
@@ -58,6 +65,9 @@ __export(src_exports, {
|
|
|
58
65
|
FeaturedRundownItem: () => FeaturedRundownItem,
|
|
59
66
|
FeaturedStage: () => FeaturedStage,
|
|
60
67
|
Field: () => Field,
|
|
68
|
+
FilterPopover: () => FilterPopover,
|
|
69
|
+
FilteredEmptyState: () => FilteredEmptyState,
|
|
70
|
+
ForbiddenState: () => ForbiddenState,
|
|
61
71
|
Highlighted: () => Highlighted,
|
|
62
72
|
Inbox: () => Inbox,
|
|
63
73
|
InboxDetail: () => InboxDetail,
|
|
@@ -82,6 +92,7 @@ __export(src_exports, {
|
|
|
82
92
|
NavGroup: () => NavGroup,
|
|
83
93
|
NavItem: () => NavItem,
|
|
84
94
|
NewsLead: () => NewsLead,
|
|
95
|
+
NotFoundState: () => NotFoundState,
|
|
85
96
|
Note: () => Note,
|
|
86
97
|
NoticeQueue: () => NoticeQueue,
|
|
87
98
|
PageHeader: () => PageHeader,
|
|
@@ -90,14 +101,18 @@ __export(src_exports, {
|
|
|
90
101
|
Peek: () => Peek,
|
|
91
102
|
Popover: () => Popover,
|
|
92
103
|
Progress: () => Progress,
|
|
104
|
+
PromptDialog: () => PromptDialog,
|
|
93
105
|
Prose: () => Prose,
|
|
94
106
|
Radio: () => Radio,
|
|
95
107
|
RadioGroup: () => RadioGroup,
|
|
108
|
+
RelatedLinks: () => RelatedLinks,
|
|
96
109
|
RelationshipGraph: () => RelationshipGraph,
|
|
110
|
+
RelativeTime: () => RelativeTime,
|
|
97
111
|
ResourceGrid: () => ResourceGrid,
|
|
98
112
|
RowAction: () => RowAction,
|
|
99
113
|
RowActions: () => RowActions,
|
|
100
114
|
RuleBuilder: () => RuleBuilder,
|
|
115
|
+
SavedViewMenu: () => SavedViewMenu,
|
|
101
116
|
SchedulingCalendar: () => SchedulingCalendar,
|
|
102
117
|
SectionHead: () => SectionHead,
|
|
103
118
|
Segmented: () => Segmented,
|
|
@@ -125,10 +140,12 @@ __export(src_exports, {
|
|
|
125
140
|
TimelineItem: () => TimelineItem,
|
|
126
141
|
Toast: () => Toast,
|
|
127
142
|
Toaster: () => Toaster,
|
|
143
|
+
ToggleRow: () => ToggleRow,
|
|
128
144
|
Tooltip: () => Tooltip,
|
|
129
145
|
Tr: () => Tr,
|
|
130
146
|
Tree: () => Tree,
|
|
131
147
|
UserChip: () => UserChip,
|
|
148
|
+
ViewMenu: () => ViewMenu,
|
|
132
149
|
addCalendarDays: () => addCalendarDays,
|
|
133
150
|
addCalendarMonths: () => addCalendarMonths,
|
|
134
151
|
appendRuleNode: () => appendRuleNode,
|
|
@@ -143,6 +160,7 @@ __export(src_exports, {
|
|
|
143
160
|
contrastRatio: () => contrastRatio,
|
|
144
161
|
cx: () => cx,
|
|
145
162
|
enumerateDateSpan: () => enumerateDateSpan,
|
|
163
|
+
filterComboboxOptions: () => filterComboboxOptions,
|
|
146
164
|
findRuleNodeDepth: () => findRuleNodeDepth,
|
|
147
165
|
flattenTree: () => flattenTree,
|
|
148
166
|
hexToRgb: () => hexToRgb,
|
|
@@ -161,9 +179,11 @@ __export(src_exports, {
|
|
|
161
179
|
multiSort: () => multiSort,
|
|
162
180
|
nextSortDir: () => nextSortDir,
|
|
163
181
|
normalizeHex: () => normalizeHex,
|
|
182
|
+
parseDateValue: () => parseDateValue,
|
|
164
183
|
parseMetricValue: () => parseMetricValue,
|
|
165
184
|
parseView: () => parseView,
|
|
166
185
|
relationshipNeighbors: () => relationshipNeighbors,
|
|
186
|
+
relativeTimeValue: () => relativeTimeValue,
|
|
167
187
|
removeRuleNode: () => removeRuleNode,
|
|
168
188
|
reorder: () => reorder,
|
|
169
189
|
restoreBrandProfile: () => restoreBrandProfile,
|
|
@@ -761,11 +781,138 @@ function InputGroup({ children, leadingIcon, trailingIcon, className }) {
|
|
|
761
781
|
);
|
|
762
782
|
}
|
|
763
783
|
|
|
764
|
-
// src/components/
|
|
784
|
+
// src/components/Combobox.tsx
|
|
765
785
|
var import_react7 = require("react");
|
|
786
|
+
|
|
787
|
+
// src/combobox-model.ts
|
|
788
|
+
function filterComboboxOptions(options, query) {
|
|
789
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
790
|
+
if (!needle) return [...options];
|
|
791
|
+
return options.filter(
|
|
792
|
+
(option) => [option.label, option.value, ...option.keywords ?? []].some((part) => part.toLocaleLowerCase().includes(needle))
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// src/components/Combobox.tsx
|
|
766
797
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
767
|
-
|
|
768
|
-
|
|
798
|
+
function Combobox({
|
|
799
|
+
options,
|
|
800
|
+
value,
|
|
801
|
+
defaultValue,
|
|
802
|
+
onValueChange,
|
|
803
|
+
label,
|
|
804
|
+
placeholder,
|
|
805
|
+
emptyLabel,
|
|
806
|
+
name,
|
|
807
|
+
disabled,
|
|
808
|
+
className,
|
|
809
|
+
...props
|
|
810
|
+
}) {
|
|
811
|
+
const generatedId = (0, import_react7.useId)();
|
|
812
|
+
const listboxId = `${generatedId}-listbox`;
|
|
813
|
+
const rootRef = (0, import_react7.useRef)(null);
|
|
814
|
+
const [internalValue, setInternalValue] = (0, import_react7.useState)(defaultValue ?? "");
|
|
815
|
+
const selectedValue = value ?? internalValue;
|
|
816
|
+
const selected = options.find((option) => option.value === selectedValue);
|
|
817
|
+
const [query, setQuery] = (0, import_react7.useState)(selected?.label ?? "");
|
|
818
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
819
|
+
const [activeIndex, setActiveIndex] = (0, import_react7.useState)(0);
|
|
820
|
+
const filtered = (0, import_react7.useMemo)(() => filterComboboxOptions(options, open ? query : ""), [open, options, query]);
|
|
821
|
+
const activeOption = filtered[activeIndex];
|
|
822
|
+
(0, import_react7.useEffect)(() => {
|
|
823
|
+
if (!open) setQuery(options.find((option) => option.value === selectedValue)?.label ?? "");
|
|
824
|
+
}, [open, options, selectedValue]);
|
|
825
|
+
const select = (option) => {
|
|
826
|
+
if (option.disabled) return;
|
|
827
|
+
if (value == null) setInternalValue(option.value);
|
|
828
|
+
setQuery(option.label);
|
|
829
|
+
setOpen(false);
|
|
830
|
+
onValueChange?.(option.value, option);
|
|
831
|
+
};
|
|
832
|
+
const move = (step) => {
|
|
833
|
+
if (!filtered.length) return;
|
|
834
|
+
let next = activeIndex;
|
|
835
|
+
for (let attempts = 0; attempts < filtered.length; attempts += 1) {
|
|
836
|
+
next = (next + step + filtered.length) % filtered.length;
|
|
837
|
+
if (!filtered[next]?.disabled) break;
|
|
838
|
+
}
|
|
839
|
+
setActiveIndex(next);
|
|
840
|
+
};
|
|
841
|
+
const handleKeyDown = (event) => {
|
|
842
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
843
|
+
event.preventDefault();
|
|
844
|
+
if (!open) setOpen(true);
|
|
845
|
+
else move(event.key === "ArrowDown" ? 1 : -1);
|
|
846
|
+
} else if (event.key === "Enter" && open && activeOption) {
|
|
847
|
+
event.preventDefault();
|
|
848
|
+
select(activeOption);
|
|
849
|
+
} else if (event.key === "Escape") {
|
|
850
|
+
setOpen(false);
|
|
851
|
+
setQuery(selected?.label ?? "");
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
const handleBlur = (event) => {
|
|
855
|
+
if (!rootRef.current?.contains(event.relatedTarget)) {
|
|
856
|
+
setOpen(false);
|
|
857
|
+
setQuery(options.find((option) => option.value === selectedValue)?.label ?? "");
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
const handleChange = (event) => {
|
|
861
|
+
setQuery(event.target.value);
|
|
862
|
+
setActiveIndex(0);
|
|
863
|
+
setOpen(true);
|
|
864
|
+
};
|
|
865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: cx("uix-combobox", className), onBlur: handleBlur, ...props, children: [
|
|
866
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "hidden", name, value: selectedValue }),
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
868
|
+
"input",
|
|
869
|
+
{
|
|
870
|
+
className: "uix-input",
|
|
871
|
+
role: "combobox",
|
|
872
|
+
"aria-label": label,
|
|
873
|
+
"aria-autocomplete": "list",
|
|
874
|
+
"aria-expanded": open,
|
|
875
|
+
"aria-controls": listboxId,
|
|
876
|
+
"aria-activedescendant": open && activeOption ? `${listboxId}-${activeIndex}` : void 0,
|
|
877
|
+
value: query,
|
|
878
|
+
placeholder,
|
|
879
|
+
disabled,
|
|
880
|
+
onChange: handleChange,
|
|
881
|
+
onFocus: () => {
|
|
882
|
+
setQuery("");
|
|
883
|
+
setOpen(true);
|
|
884
|
+
setActiveIndex(Math.max(0, options.findIndex((option) => option.value === selectedValue)));
|
|
885
|
+
},
|
|
886
|
+
onKeyDown: handleKeyDown
|
|
887
|
+
}
|
|
888
|
+
),
|
|
889
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { id: listboxId, className: "uix-listbox uix-combobox__listbox", role: "listbox", children: [
|
|
890
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { className: "uix-listbox__empty", children: emptyLabel }),
|
|
891
|
+
filtered.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
892
|
+
"li",
|
|
893
|
+
{
|
|
894
|
+
id: `${listboxId}-${index}`,
|
|
895
|
+
className: "uix-listbox__option",
|
|
896
|
+
role: "option",
|
|
897
|
+
"aria-selected": option.value === selectedValue,
|
|
898
|
+
"aria-disabled": option.disabled || void 0,
|
|
899
|
+
"data-active": index === activeIndex || void 0,
|
|
900
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
901
|
+
onMouseEnter: () => setActiveIndex(index),
|
|
902
|
+
onClick: () => select(option),
|
|
903
|
+
children: option.label
|
|
904
|
+
},
|
|
905
|
+
option.value
|
|
906
|
+
))
|
|
907
|
+
] })
|
|
908
|
+
] });
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// src/components/Textarea.tsx
|
|
912
|
+
var import_react8 = require("react");
|
|
913
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
914
|
+
var Textarea = (0, import_react8.forwardRef)(
|
|
915
|
+
({ invalid, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
769
916
|
"textarea",
|
|
770
917
|
{
|
|
771
918
|
ref,
|
|
@@ -778,10 +925,10 @@ var Textarea = (0, import_react7.forwardRef)(
|
|
|
778
925
|
Textarea.displayName = "Textarea";
|
|
779
926
|
|
|
780
927
|
// src/components/Select.tsx
|
|
781
|
-
var
|
|
782
|
-
var
|
|
783
|
-
var Select = (0,
|
|
784
|
-
({ size = "md", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
928
|
+
var import_react9 = require("react");
|
|
929
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
930
|
+
var Select = (0, import_react9.forwardRef)(
|
|
931
|
+
({ size = "md", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
785
932
|
"select",
|
|
786
933
|
{
|
|
787
934
|
ref,
|
|
@@ -793,19 +940,19 @@ var Select = (0, import_react8.forwardRef)(
|
|
|
793
940
|
Select.displayName = "Select";
|
|
794
941
|
|
|
795
942
|
// src/components/Checkbox.tsx
|
|
796
|
-
var
|
|
797
|
-
var
|
|
798
|
-
var CheckIcon = () => /* @__PURE__ */ (0,
|
|
799
|
-
var IndeterminateIcon = () => /* @__PURE__ */ (0,
|
|
800
|
-
var Checkbox = (0,
|
|
943
|
+
var import_react10 = require("react");
|
|
944
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
945
|
+
var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "1.5,6 4.5,9 10.5,3" }) });
|
|
946
|
+
var IndeterminateIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "2", y: "5", width: "8", height: "2", rx: "1", fill: "currentColor" }) });
|
|
947
|
+
var Checkbox = (0, import_react10.forwardRef)(
|
|
801
948
|
({ label, indeterminate, className, ...props }, forwardedRef) => {
|
|
802
|
-
const innerRef = (0,
|
|
803
|
-
(0,
|
|
949
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
950
|
+
(0, import_react10.useEffect)(() => {
|
|
804
951
|
const el = innerRef.current;
|
|
805
952
|
if (el) el.indeterminate = !!indeterminate;
|
|
806
953
|
}, [indeterminate]);
|
|
807
|
-
return /* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: cx("uix-checkbox", className), children: [
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
809
956
|
"input",
|
|
810
957
|
{
|
|
811
958
|
type: "checkbox",
|
|
@@ -817,7 +964,7 @@ var Checkbox = (0, import_react9.forwardRef)(
|
|
|
817
964
|
...props
|
|
818
965
|
}
|
|
819
966
|
),
|
|
820
|
-
/* @__PURE__ */ (0,
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uix-checkbox__box", children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IndeterminateIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckIcon, {}) }),
|
|
821
968
|
label
|
|
822
969
|
] });
|
|
823
970
|
}
|
|
@@ -825,93 +972,144 @@ var Checkbox = (0, import_react9.forwardRef)(
|
|
|
825
972
|
Checkbox.displayName = "Checkbox";
|
|
826
973
|
|
|
827
974
|
// src/components/Radio.tsx
|
|
828
|
-
var
|
|
829
|
-
var
|
|
830
|
-
var Radio = (0,
|
|
831
|
-
({ label, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
833
|
-
/* @__PURE__ */ (0,
|
|
975
|
+
var import_react11 = require("react");
|
|
976
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
977
|
+
var Radio = (0, import_react11.forwardRef)(
|
|
978
|
+
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: cx("uix-radio", className), children: [
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "radio", ref, ...props }),
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "uix-radio__dot" }),
|
|
834
981
|
label
|
|
835
982
|
] })
|
|
836
983
|
);
|
|
837
984
|
Radio.displayName = "Radio";
|
|
838
985
|
function RadioGroup({ children, className }) {
|
|
839
|
-
return /* @__PURE__ */ (0,
|
|
986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cx("uix-radio-group", className), children });
|
|
840
987
|
}
|
|
841
988
|
|
|
842
989
|
// src/components/Switch.tsx
|
|
843
|
-
var
|
|
844
|
-
var
|
|
845
|
-
var Switch = (0,
|
|
846
|
-
({ label, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
848
|
-
/* @__PURE__ */ (0,
|
|
990
|
+
var import_react12 = require("react");
|
|
991
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
992
|
+
var Switch = (0, import_react12.forwardRef)(
|
|
993
|
+
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: cx("uix-switch", className), children: [
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", role: "switch", ref, ...props }),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-switch__track" }),
|
|
849
996
|
label
|
|
850
997
|
] })
|
|
851
998
|
);
|
|
852
999
|
Switch.displayName = "Switch";
|
|
853
1000
|
|
|
854
1001
|
// src/components/Field.tsx
|
|
855
|
-
var
|
|
856
|
-
var
|
|
1002
|
+
var import_react13 = require("react");
|
|
1003
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
857
1004
|
function Field({ label, hint, error, success, required, children, className, htmlFor }) {
|
|
858
|
-
const uid = (0,
|
|
1005
|
+
const uid = (0, import_react13.useId)();
|
|
859
1006
|
const msgId = `${uid}-msg`;
|
|
860
1007
|
const describedBy = error || success || hint ? msgId : void 0;
|
|
861
|
-
const control = (0,
|
|
1008
|
+
const control = (0, import_react13.isValidElement)(children) ? (0, import_react13.cloneElement)(children, {
|
|
862
1009
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
863
1010
|
"aria-invalid": error ? true : children.props["aria-invalid"]
|
|
864
1011
|
}) : children;
|
|
865
|
-
return /* @__PURE__ */ (0,
|
|
866
|
-
label && /* @__PURE__ */ (0,
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cx("uix-field", className), children: [
|
|
1013
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "uix-field__label", htmlFor, "data-required": required || void 0, children: label }),
|
|
867
1014
|
control,
|
|
868
|
-
/* @__PURE__ */ (0,
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "uix-field__error", role: "alert", children: error }) : success ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "uix-field__success", children: success }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "uix-field__hint", children: hint }) : null })
|
|
869
1016
|
] });
|
|
870
1017
|
}
|
|
871
1018
|
|
|
872
1019
|
// src/components/Modal.tsx
|
|
873
|
-
var
|
|
874
|
-
var
|
|
875
|
-
|
|
1020
|
+
var import_react14 = require("react");
|
|
1021
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1022
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
1023
|
+
function Modal({ open, onClose, title, children, footer, className, style, closeLabel = "Close dialog", role = "dialog" }) {
|
|
876
1024
|
const ref = useDialog(open);
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1025
|
+
const titleId = (0, import_react14.useId)();
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("dialog", { ref, className: cx("uix-dialog", className), style, onClose, role, "aria-labelledby": title != null ? titleId : void 0, children: [
|
|
1027
|
+
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uix-dialog__header", children: [
|
|
1028
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { id: titleId, className: "uix-dialog__title", children: title }),
|
|
1029
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "uix-dialog__close", onClick: onClose, "aria-label": closeLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CloseIcon, {}) })
|
|
881
1030
|
] }),
|
|
882
|
-
children != null && /* @__PURE__ */ (0,
|
|
883
|
-
footer != null && /* @__PURE__ */ (0,
|
|
1031
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uix-dialog__body", children }),
|
|
1032
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uix-dialog__footer", children: footer })
|
|
884
1033
|
] });
|
|
885
1034
|
}
|
|
886
1035
|
|
|
1036
|
+
// src/components/Dialogs.tsx
|
|
1037
|
+
var import_react15 = require("react");
|
|
1038
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1039
|
+
function ConfirmDialog({ open, title, description, confirmLabel, cancelLabel, closeLabel, onConfirm, onCancel, pending, destructive }) {
|
|
1040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1041
|
+
Modal,
|
|
1042
|
+
{
|
|
1043
|
+
open,
|
|
1044
|
+
onClose: onCancel,
|
|
1045
|
+
title,
|
|
1046
|
+
closeLabel,
|
|
1047
|
+
role: "alertdialog",
|
|
1048
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "button", onClick: onCancel, disabled: pending, children: cancelLabel }),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "button", variant: destructive ? "danger" : "primary", onClick: () => void onConfirm(), loading: pending, children: confirmLabel })
|
|
1051
|
+
] }),
|
|
1052
|
+
children: description
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
function PromptDialog({ open, title, description, inputLabel, defaultValue = "", placeholder, submitLabel, cancelLabel, closeLabel, onSubmit, onCancel, validate, pending }) {
|
|
1057
|
+
const inputId = (0, import_react15.useId)();
|
|
1058
|
+
const errorId = `${inputId}-error`;
|
|
1059
|
+
const [value, setValue] = (0, import_react15.useState)(defaultValue);
|
|
1060
|
+
const [error, setError] = (0, import_react15.useState)();
|
|
1061
|
+
(0, import_react15.useEffect)(() => {
|
|
1062
|
+
if (open) {
|
|
1063
|
+
setValue(defaultValue);
|
|
1064
|
+
setError(void 0);
|
|
1065
|
+
}
|
|
1066
|
+
}, [defaultValue, open]);
|
|
1067
|
+
const handleSubmit = (event) => {
|
|
1068
|
+
event.preventDefault();
|
|
1069
|
+
const issue = validate?.(value);
|
|
1070
|
+
setError(issue);
|
|
1071
|
+
if (issue == null) void onSubmit(value);
|
|
1072
|
+
};
|
|
1073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Modal, { open, onClose: onCancel, title, closeLabel, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { className: "uix-prompt", onSubmit: handleSubmit, children: [
|
|
1074
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: description }),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "uix-label", htmlFor: inputId, children: inputLabel }),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { id: inputId, value, placeholder, "aria-describedby": error ? errorId : void 0, invalid: error != null, onChange: (event) => setValue(event.currentTarget.value), autoFocus: true }),
|
|
1077
|
+
error != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { id: errorId, className: "uix-field__error", role: "alert", children: error }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uix-dialog__footer uix-prompt__actions", children: [
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "button", onClick: onCancel, disabled: pending, children: cancelLabel }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "submit", variant: "primary", loading: pending, children: submitLabel })
|
|
1081
|
+
] })
|
|
1082
|
+
] }) });
|
|
1083
|
+
}
|
|
1084
|
+
|
|
887
1085
|
// src/components/Drawer.tsx
|
|
888
|
-
var
|
|
889
|
-
var CloseIcon2 = () => /* @__PURE__ */ (0,
|
|
1086
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1087
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
890
1088
|
function Drawer({ open, onClose, title, children, footer, className }) {
|
|
891
1089
|
const ref = useDialog(open);
|
|
892
|
-
return /* @__PURE__ */ (0,
|
|
893
|
-
(title != null || onClose) && /* @__PURE__ */ (0,
|
|
894
|
-
title && /* @__PURE__ */ (0,
|
|
895
|
-
onClose && /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("dialog", { ref, className: cx("uix-drawer", className), onClose, children: [
|
|
1091
|
+
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "uix-drawer__header", children: [
|
|
1092
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontWeight: 600, fontSize: "var(--uix-text-h3)" }, children: title }),
|
|
1093
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
896
1094
|
"button",
|
|
897
1095
|
{
|
|
898
1096
|
style: { marginLeft: "auto", border: 0, background: "transparent", color: "var(--uix-text-muted)", cursor: "pointer", width: 30, height: 30, display: "grid", placeItems: "center", borderRadius: "var(--uix-radius-sm)" },
|
|
899
1097
|
onClick: onClose,
|
|
900
1098
|
"aria-label": "Close drawer",
|
|
901
|
-
children: /* @__PURE__ */ (0,
|
|
1099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon2, {})
|
|
902
1100
|
}
|
|
903
1101
|
)
|
|
904
1102
|
] }),
|
|
905
|
-
children != null && /* @__PURE__ */ (0,
|
|
906
|
-
footer != null && /* @__PURE__ */ (0,
|
|
1103
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-drawer__body", children }),
|
|
1104
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-drawer__footer", children: footer })
|
|
907
1105
|
] });
|
|
908
1106
|
}
|
|
909
1107
|
|
|
910
1108
|
// src/components/Peek.tsx
|
|
911
|
-
var
|
|
912
|
-
var CloseIcon3 = () => /* @__PURE__ */ (0,
|
|
913
|
-
var ChevronUp = () => /* @__PURE__ */ (0,
|
|
914
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
1109
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1110
|
+
var CloseIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
1111
|
+
var ChevronUp = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M2 8l4-4 4 4" }) });
|
|
1112
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
915
1113
|
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className }) {
|
|
916
1114
|
const ref = useDialog(open);
|
|
917
1115
|
const hasNav = onNavPrev != null || onNavNext != null;
|
|
@@ -922,109 +1120,190 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
922
1120
|
const outside = e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;
|
|
923
1121
|
if (outside) onClose();
|
|
924
1122
|
};
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
926
|
-
/* @__PURE__ */ (0,
|
|
927
|
-
hasNav && /* @__PURE__ */ (0,
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
929
|
-
/* @__PURE__ */ (0,
|
|
1123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("dialog", { ref, className: cx("uix-peek", className), onClose, onClick: onBackdropClick, children: [
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "uix-peek__header", children: [
|
|
1125
|
+
hasNav && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "uix-peek__nav", children: [
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavPrev, disabled: !onNavPrev, "aria-label": "Previous record", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChevronUp, {}) }),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavNext, disabled: !onNavNext, "aria-label": "Next record", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChevronDown, {}) })
|
|
930
1128
|
] }),
|
|
931
|
-
title && /* @__PURE__ */ (0,
|
|
932
|
-
hint && /* @__PURE__ */ (0,
|
|
933
|
-
onClose && /* @__PURE__ */ (0,
|
|
1129
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-peek__title", children: title }),
|
|
1130
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "uix-peek__hint", children: hint }),
|
|
1131
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "uix-peek__close", onClick: onClose, "aria-label": "Close preview", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon3, {}) })
|
|
934
1132
|
] }),
|
|
935
|
-
children != null && /* @__PURE__ */ (0,
|
|
936
|
-
footer != null && /* @__PURE__ */ (0,
|
|
1133
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-peek__body", children }),
|
|
1134
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-peek__footer", children: footer })
|
|
937
1135
|
] });
|
|
938
1136
|
}
|
|
939
1137
|
|
|
940
1138
|
// src/components/Card.tsx
|
|
941
|
-
var
|
|
1139
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
942
1140
|
function Card({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
943
1141
|
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
944
|
-
return /* @__PURE__ */ (0,
|
|
945
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
947
|
-
title && /* @__PURE__ */ (0,
|
|
948
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cx("uix-card", className), ...props, children: [
|
|
1143
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uix-card__header", children: [
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1 }, children: [
|
|
1145
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__title", children: title }),
|
|
1146
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__subtitle", children: subtitle })
|
|
1147
|
+
] }),
|
|
1148
|
+
headerAction
|
|
1149
|
+
] }),
|
|
1150
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__body", children }),
|
|
1151
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__footer", children: footer })
|
|
1152
|
+
] });
|
|
1153
|
+
}
|
|
1154
|
+
function CardLink({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
1155
|
+
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { className: cx("uix-card", "uix-card--interactive", className), ...props, children: [
|
|
1157
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uix-card__header", children: [
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1 }, children: [
|
|
1159
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__title", children: title }),
|
|
1160
|
+
subtitle != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__subtitle", children: subtitle })
|
|
949
1161
|
] }),
|
|
950
1162
|
headerAction
|
|
951
1163
|
] }),
|
|
952
|
-
children != null && /* @__PURE__ */ (0,
|
|
953
|
-
footer != null && /* @__PURE__ */ (0,
|
|
1164
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__body", children }),
|
|
1165
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-card__footer", children: footer })
|
|
954
1166
|
] });
|
|
955
1167
|
}
|
|
956
1168
|
|
|
1169
|
+
// src/components/Breadcrumbs.tsx
|
|
1170
|
+
var import_react16 = require("react");
|
|
1171
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1172
|
+
function Breadcrumbs({ items, label, separator = "/", className, ...props }) {
|
|
1173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { "aria-label": label, className, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { className: "uix-breadcrumbs", children: items.map((item, index) => {
|
|
1174
|
+
const current = item.current ?? index === items.length - 1;
|
|
1175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react16.Fragment, { children: [
|
|
1176
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: "uix-breadcrumbs__sep", "aria-hidden": "true", children: separator }),
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: item.href && !current ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { href: item.href, children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-current": current ? "page" : void 0, children: item.label }) })
|
|
1178
|
+
] }, item.id ?? `${item.href ?? "current"}-${index}`);
|
|
1179
|
+
}) }) });
|
|
1180
|
+
}
|
|
1181
|
+
|
|
957
1182
|
// src/components/PageHeader.tsx
|
|
958
|
-
var
|
|
1183
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
959
1184
|
function PageHeader({ eyebrow, title, subtitle, actions, className, ...props }) {
|
|
960
|
-
return /* @__PURE__ */ (0,
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
962
|
-
eyebrow != null && /* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
subtitle != null && /* @__PURE__ */ (0,
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: cx("uix-page-header", className), ...props, children: [
|
|
1186
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "uix-page-header__titles", children: [
|
|
1187
|
+
eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uix-page-header__eyebrow", children: eyebrow }),
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", { className: "uix-page-header__title", children: title }),
|
|
1189
|
+
subtitle != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "uix-page-header__subtitle", children: subtitle })
|
|
965
1190
|
] }),
|
|
966
|
-
actions != null && /* @__PURE__ */ (0,
|
|
1191
|
+
actions != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uix-page-header__actions", children: actions })
|
|
967
1192
|
] });
|
|
968
1193
|
}
|
|
969
1194
|
|
|
970
1195
|
// src/components/DetailLayout.tsx
|
|
971
|
-
var
|
|
1196
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
972
1197
|
function DetailLayout({ side, children, className, ...props }) {
|
|
973
|
-
return /* @__PURE__ */ (0,
|
|
974
|
-
/* @__PURE__ */ (0,
|
|
975
|
-
side != null && /* @__PURE__ */ (0,
|
|
1198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx("uix-detail", className), ...props, children: [
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "uix-detail__main", children }),
|
|
1200
|
+
side != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "uix-detail__side", children: side })
|
|
1201
|
+
] });
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// src/components/DetailPage.tsx
|
|
1205
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1206
|
+
function DetailPage({ back, eyebrow, title, subtitle, actions, tabs, metrics, side, children, tabsLabel, className, ...props }) {
|
|
1207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: cx("uix-detail-page", className), ...props, children: [
|
|
1208
|
+
back && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { className: "uix-link uix-link--quiet uix-detail-page__back", href: back.href, children: back.label }),
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PageHeader, { eyebrow, title, subtitle, actions }),
|
|
1210
|
+
metrics && metrics.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dl", { className: "uix-detail-page__metrics", children: metrics.map((metric) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dt", { children: metric.label }),
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dd", { children: metric.value })
|
|
1213
|
+
] }, metric.id)) }),
|
|
1214
|
+
tabs && tabs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("nav", { className: "uix-tabs", "aria-label": tabsLabel, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { className: "uix-tab", "aria-current": tab.active ? "page" : void 0, href: tab.href, children: tab.label }, tab.id)) }),
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DetailLayout, { side, children })
|
|
1216
|
+
] });
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
// src/components/RelatedLinks.tsx
|
|
1220
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1221
|
+
function RelatedLinks({ title, items, className, ...props }) {
|
|
1222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: cx("uix-related-links", className), ...props, children: [
|
|
1223
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "uix-related-links__title", children: title }),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "uix-related-links__list", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("a", { className: "uix-link uix-link--quiet", href: item.href, children: item.label }),
|
|
1226
|
+
item.meta != null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: item.meta })
|
|
1227
|
+
] }, item.id)) })
|
|
1228
|
+
] });
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// src/components/ToggleRow.tsx
|
|
1232
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1233
|
+
function ToggleRow({ label, description, checked, onCheckedChange, disabled, accessibleLabel, className, ...props }) {
|
|
1234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("uix-toggle-row", className), ...props, children: [
|
|
1235
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "uix-toggle-row__copy", children: [
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "uix-toggle-row__label", children: label }),
|
|
1237
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "uix-toggle-row__description", children: description })
|
|
1238
|
+
] }),
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Switch, { checked, disabled, "aria-label": accessibleLabel, onChange: (event) => onCheckedChange(event.currentTarget.checked) })
|
|
1240
|
+
] });
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
// src/components/CollapsibleSection.tsx
|
|
1244
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1245
|
+
function CollapsibleSection({ title, summary, children, className, ...props }) {
|
|
1246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("details", { className: cx("uix-collapsible", className), ...props, children: [
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("summary", { className: "uix-collapsible__summary", children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "uix-collapsible__title", children: title }),
|
|
1250
|
+
summary != null && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "uix-collapsible__meta", children: summary })
|
|
1251
|
+
] }),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "uix-collapsible__chevron", "aria-hidden": "true", children: "\u2304" })
|
|
1253
|
+
] }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "uix-collapsible__body", children })
|
|
976
1255
|
] });
|
|
977
1256
|
}
|
|
978
1257
|
|
|
979
1258
|
// src/components/List.tsx
|
|
980
|
-
var
|
|
1259
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
981
1260
|
function List({ children, className, ...props }) {
|
|
982
|
-
return /* @__PURE__ */ (0,
|
|
1261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx("uix-list", className), ...props, children });
|
|
983
1262
|
}
|
|
984
1263
|
function ListItem({ title, meta, trail, leading, children, className, ...props }) {
|
|
985
1264
|
const hasTitleBlock = title != null || meta != null;
|
|
986
|
-
return /* @__PURE__ */ (0,
|
|
1265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("uix-list__item", className), ...props, children: [
|
|
987
1266
|
leading,
|
|
988
|
-
hasTitleBlock && /* @__PURE__ */ (0,
|
|
989
|
-
title != null && /* @__PURE__ */ (0,
|
|
990
|
-
meta != null && /* @__PURE__ */ (0,
|
|
1267
|
+
hasTitleBlock && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
1268
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-list__title", children: title }),
|
|
1269
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-list__meta", children: meta })
|
|
991
1270
|
] }),
|
|
992
1271
|
children,
|
|
993
|
-
trail != null && /* @__PURE__ */ (0,
|
|
1272
|
+
trail != null && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-list__trail", children: trail })
|
|
994
1273
|
] });
|
|
995
1274
|
}
|
|
996
1275
|
|
|
997
1276
|
// src/components/DescriptionList.tsx
|
|
998
|
-
var
|
|
999
|
-
var
|
|
1277
|
+
var import_react17 = require("react");
|
|
1278
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1000
1279
|
function DescriptionList({ items, children, className, ...props }) {
|
|
1001
|
-
return /* @__PURE__ */ (0,
|
|
1002
|
-
items?.map((item, i) => /* @__PURE__ */ (0,
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("dl", { className: cx("uix-dl", className), ...props, children: [
|
|
1281
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react17.Fragment, { children: [
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dt", { children: item.term }),
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dd", { children: item.description })
|
|
1005
1284
|
] }, item.id ?? i)),
|
|
1006
1285
|
children
|
|
1007
1286
|
] });
|
|
1008
1287
|
}
|
|
1009
1288
|
function DescriptionItem({ term, children }) {
|
|
1010
|
-
return /* @__PURE__ */ (0,
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1012
|
-
/* @__PURE__ */ (0,
|
|
1289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dt", { children: term }),
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dd", { children })
|
|
1013
1292
|
] });
|
|
1014
1293
|
}
|
|
1015
1294
|
|
|
1016
1295
|
// src/components/Tabs.tsx
|
|
1017
|
-
var
|
|
1018
|
-
var
|
|
1019
|
-
var TabsCtx = (0,
|
|
1296
|
+
var import_react18 = require("react");
|
|
1297
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1298
|
+
var TabsCtx = (0, import_react18.createContext)({});
|
|
1020
1299
|
function Tabs({ variant = "line", value, onChange, children, className }) {
|
|
1021
|
-
const contextValue = (0,
|
|
1022
|
-
return /* @__PURE__ */ (0,
|
|
1300
|
+
const contextValue = (0, import_react18.useMemo)(() => ({ value, onChange }), [value, onChange]);
|
|
1301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TabsCtx.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { role: "tablist", className: cx("uix-tabs", `uix-tabs--${variant}`, className), children }) });
|
|
1023
1302
|
}
|
|
1024
1303
|
function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
1025
|
-
const ctx = (0,
|
|
1304
|
+
const ctx = (0, import_react18.useContext)(TabsCtx);
|
|
1026
1305
|
const selected = ctx.value === value;
|
|
1027
|
-
return /* @__PURE__ */ (0,
|
|
1306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1028
1307
|
"button",
|
|
1029
1308
|
{
|
|
1030
1309
|
role: "tab",
|
|
@@ -1042,8 +1321,8 @@ function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
|
1042
1321
|
}
|
|
1043
1322
|
|
|
1044
1323
|
// src/components/AppShell.tsx
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1324
|
+
var import_react19 = require("react");
|
|
1325
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1047
1326
|
function AppShell({
|
|
1048
1327
|
nav,
|
|
1049
1328
|
collapsed,
|
|
@@ -1057,7 +1336,7 @@ function AppShell({
|
|
|
1057
1336
|
...props
|
|
1058
1337
|
}) {
|
|
1059
1338
|
const navState = nav ?? (collapsed ? "rail" : "full");
|
|
1060
|
-
(0,
|
|
1339
|
+
(0, import_react19.useEffect)(() => {
|
|
1061
1340
|
if (!focus || !onExitFocus) return;
|
|
1062
1341
|
const onKey = (e) => {
|
|
1063
1342
|
if (e.key === "Escape") onExitFocus();
|
|
@@ -1065,7 +1344,7 @@ function AppShell({
|
|
|
1065
1344
|
document.addEventListener("keydown", onKey);
|
|
1066
1345
|
return () => document.removeEventListener("keydown", onKey);
|
|
1067
1346
|
}, [focus, onExitFocus]);
|
|
1068
|
-
return /* @__PURE__ */ (0,
|
|
1347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1069
1348
|
"div",
|
|
1070
1349
|
{
|
|
1071
1350
|
className: cx("uix-shell", className),
|
|
@@ -1074,100 +1353,118 @@ function AppShell({
|
|
|
1074
1353
|
"data-focus": focus || void 0,
|
|
1075
1354
|
...props,
|
|
1076
1355
|
children: [
|
|
1077
|
-
sidebar && /* @__PURE__ */ (0,
|
|
1078
|
-
topbar && /* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
focus && onExitFocus && /* @__PURE__ */ (0,
|
|
1356
|
+
sidebar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uix-shell__sidebar", children: sidebar }),
|
|
1357
|
+
topbar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uix-shell__topbar", children: topbar }),
|
|
1358
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("main", { className: cx("uix-shell__main", mainBleed && "uix-shell__main--bleed"), children }),
|
|
1359
|
+
focus && onExitFocus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uix-shell__focus-exit", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: onExitFocus, children: "Esc \xB7 Exit focus" }) })
|
|
1081
1360
|
]
|
|
1082
1361
|
}
|
|
1083
1362
|
);
|
|
1084
1363
|
}
|
|
1085
1364
|
|
|
1086
1365
|
// src/components/Sidebar.tsx
|
|
1087
|
-
var
|
|
1088
|
-
var
|
|
1089
|
-
var ChevronIcon = () => /* @__PURE__ */ (0,
|
|
1090
|
-
function Sidebar({ collapsed, onToggle, brand, toggleIcon, children, className, ...props }) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
/* @__PURE__ */ (0,
|
|
1097
|
-
/* @__PURE__ */ (0,
|
|
1366
|
+
var import_react20 = require("react");
|
|
1367
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1368
|
+
var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { className: "uix-navgroup__chevron", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
1369
|
+
function Sidebar({ collapsed, nav, onToggle, brand, toggleIcon, children, expandLabel = "Expand sidebar", collapseLabel = "Collapse sidebar", className, ...props }) {
|
|
1370
|
+
const isCollapsed = collapsed ?? nav === "rail";
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("nav", { className: cx("uix-sidebar", className), "data-collapsed": isCollapsed || void 0, "data-nav": nav, ...props, children: [
|
|
1372
|
+
(brand != null || onToggle) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uix-sidebar__head", children: [
|
|
1373
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uix-sidebar__brand", children: brand }),
|
|
1374
|
+
onToggle && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: "uix-sidebar__toggle", onClick: onToggle, "aria-label": isCollapsed ? expandLabel : collapseLabel, children: toggleIcon ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": "true", children: [
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "3", y: "4", width: "12", height: "1.5", rx: ".75" }),
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "3", y: "8.25", width: "8", height: "1.5", rx: ".75" }),
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "3", y: "12.5", width: "12", height: "1.5", rx: ".75" })
|
|
1098
1378
|
] }) })
|
|
1099
1379
|
] }),
|
|
1100
1380
|
children
|
|
1101
1381
|
] });
|
|
1102
1382
|
}
|
|
1103
1383
|
function SidebarSection({ label, children }) {
|
|
1104
|
-
return /* @__PURE__ */ (0,
|
|
1105
|
-
label && /* @__PURE__ */ (0,
|
|
1384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1385
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uix-sidebar__eyebrow", children: label }),
|
|
1106
1386
|
children
|
|
1107
1387
|
] });
|
|
1108
1388
|
}
|
|
1109
1389
|
function NavItem({ icon, badge, active, as: Tag = "a", children, className, ...props }) {
|
|
1110
1390
|
if (Tag === "button") {
|
|
1111
1391
|
const { href: _href, ...btnProps } = props;
|
|
1112
|
-
return /* @__PURE__ */ (0,
|
|
1392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1113
1393
|
"button",
|
|
1114
1394
|
{
|
|
1395
|
+
type: "button",
|
|
1115
1396
|
className: cx("uix-navitem", className),
|
|
1116
1397
|
"aria-current": active ? "page" : void 0,
|
|
1117
1398
|
...btnProps,
|
|
1118
1399
|
children: [
|
|
1119
|
-
icon && /* @__PURE__ */ (0,
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
badge != null && /* @__PURE__ */ (0,
|
|
1400
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__label", children }),
|
|
1402
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__badge", children: badge })
|
|
1122
1403
|
]
|
|
1123
1404
|
}
|
|
1124
1405
|
);
|
|
1125
1406
|
}
|
|
1126
|
-
return /* @__PURE__ */ (0,
|
|
1407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1127
1408
|
"a",
|
|
1128
1409
|
{
|
|
1129
1410
|
className: cx("uix-navitem", className),
|
|
1130
1411
|
"aria-current": active ? "page" : void 0,
|
|
1131
1412
|
...props,
|
|
1132
1413
|
children: [
|
|
1133
|
-
icon && /* @__PURE__ */ (0,
|
|
1134
|
-
/* @__PURE__ */ (0,
|
|
1135
|
-
badge != null && /* @__PURE__ */ (0,
|
|
1414
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
1415
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__label", children }),
|
|
1416
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__badge", children: badge })
|
|
1136
1417
|
]
|
|
1137
1418
|
}
|
|
1138
1419
|
);
|
|
1139
1420
|
}
|
|
1140
|
-
function NavGroup({ icon, label, children, defaultExpanded = true }) {
|
|
1141
|
-
const [
|
|
1142
|
-
|
|
1143
|
-
|
|
1421
|
+
function NavGroup({ icon, label, children, defaultExpanded = true, expanded: controlledExpanded, onExpandedChange }) {
|
|
1422
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react20.useState)(defaultExpanded);
|
|
1423
|
+
const expanded = controlledExpanded ?? internalExpanded;
|
|
1424
|
+
const panelId = (0, import_react20.useId)();
|
|
1425
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
1426
|
+
const panelRef = (0, import_react20.useRef)(null);
|
|
1427
|
+
(0, import_react20.useEffect)(() => {
|
|
1428
|
+
panelRef.current?.toggleAttribute("inert", !expanded);
|
|
1429
|
+
if (!expanded && panelRef.current?.contains(document.activeElement)) triggerRef.current?.focus();
|
|
1430
|
+
}, [expanded]);
|
|
1431
|
+
const setExpanded = (next) => {
|
|
1432
|
+
if (!next && panelRef.current?.contains(document.activeElement)) triggerRef.current?.focus();
|
|
1433
|
+
if (controlledExpanded == null) setInternalExpanded(next);
|
|
1434
|
+
onExpandedChange?.(next);
|
|
1435
|
+
};
|
|
1436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uix-navgroup", children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1144
1438
|
"button",
|
|
1145
1439
|
{
|
|
1440
|
+
ref: triggerRef,
|
|
1441
|
+
type: "button",
|
|
1146
1442
|
className: "uix-navitem uix-navgroup__trigger",
|
|
1147
1443
|
"aria-expanded": expanded,
|
|
1148
|
-
|
|
1444
|
+
"aria-controls": panelId,
|
|
1445
|
+
onClick: () => setExpanded(!expanded),
|
|
1149
1446
|
children: [
|
|
1150
|
-
icon && /* @__PURE__ */ (0,
|
|
1151
|
-
/* @__PURE__ */ (0,
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
1447
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__label", children: label }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronIcon, {})
|
|
1153
1450
|
]
|
|
1154
1451
|
}
|
|
1155
1452
|
),
|
|
1156
|
-
/* @__PURE__ */ (0,
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: panelRef, id: panelId, className: "uix-navgroup__panel", "aria-hidden": !expanded, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children }) })
|
|
1157
1454
|
] });
|
|
1158
1455
|
}
|
|
1159
1456
|
function SubNavItem({ active, as: Tag = "a", children, className, ...props }) {
|
|
1160
1457
|
const cls = cx("uix-navitem uix-subitem", className);
|
|
1161
1458
|
if (Tag === "button") {
|
|
1162
1459
|
const { href: _href, ...btnProps } = props;
|
|
1163
|
-
return /* @__PURE__ */ (0,
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: cls, "aria-current": active ? "page" : void 0, ...btnProps, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__label", children }) });
|
|
1164
1461
|
}
|
|
1165
|
-
return /* @__PURE__ */ (0,
|
|
1462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { className: cls, "aria-current": active ? "page" : void 0, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uix-navitem__label", children }) });
|
|
1166
1463
|
}
|
|
1167
1464
|
|
|
1168
1465
|
// src/components/StarButton.tsx
|
|
1169
|
-
var
|
|
1170
|
-
var StarGlyph = () => /* @__PURE__ */ (0,
|
|
1466
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1467
|
+
var StarGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1171
1468
|
"svg",
|
|
1172
1469
|
{
|
|
1173
1470
|
viewBox: "0 0 24 24",
|
|
@@ -1177,7 +1474,7 @@ var StarGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
|
1177
1474
|
strokeLinecap: "round",
|
|
1178
1475
|
strokeLinejoin: "round",
|
|
1179
1476
|
"aria-hidden": "true",
|
|
1180
|
-
children: /* @__PURE__ */ (0,
|
|
1477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M11.5 2.7a.6.6 0 0 1 1 0l2.4 5 5.4.8a.6.6 0 0 1 .3 1l-3.9 3.8.9 5.4a.6.6 0 0 1-.8.6L12 17l-4.8 2.5a.6.6 0 0 1-.8-.6l.9-5.4L3.4 9.5a.6.6 0 0 1 .3-1l5.4-.8z" })
|
|
1181
1478
|
}
|
|
1182
1479
|
);
|
|
1183
1480
|
function StarButton({
|
|
@@ -1187,7 +1484,7 @@ function StarButton({
|
|
|
1187
1484
|
onToggle,
|
|
1188
1485
|
className
|
|
1189
1486
|
}) {
|
|
1190
|
-
return /* @__PURE__ */ (0,
|
|
1487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1191
1488
|
"button",
|
|
1192
1489
|
{
|
|
1193
1490
|
type: "button",
|
|
@@ -1200,15 +1497,15 @@ function StarButton({
|
|
|
1200
1497
|
e.stopPropagation();
|
|
1201
1498
|
onToggle(!pinned);
|
|
1202
1499
|
},
|
|
1203
|
-
children: /* @__PURE__ */ (0,
|
|
1500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StarGlyph, {})
|
|
1204
1501
|
}
|
|
1205
1502
|
);
|
|
1206
1503
|
}
|
|
1207
1504
|
|
|
1208
1505
|
// src/components/NavFavourites.tsx
|
|
1209
|
-
var
|
|
1210
|
-
var
|
|
1211
|
-
var ChevronDownIcon = () => /* @__PURE__ */ (0,
|
|
1506
|
+
var import_react21 = require("react");
|
|
1507
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1508
|
+
var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1212
1509
|
"svg",
|
|
1213
1510
|
{
|
|
1214
1511
|
width: "12",
|
|
@@ -1221,10 +1518,10 @@ var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
|
1221
1518
|
strokeLinejoin: "round",
|
|
1222
1519
|
"aria-hidden": "true",
|
|
1223
1520
|
className: "uix-favourites__chevron",
|
|
1224
|
-
children: /* @__PURE__ */ (0,
|
|
1521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m6 9 6 6 6-6" })
|
|
1225
1522
|
}
|
|
1226
1523
|
);
|
|
1227
|
-
var ChevronRightIcon = () => /* @__PURE__ */ (0,
|
|
1524
|
+
var ChevronRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1228
1525
|
"svg",
|
|
1229
1526
|
{
|
|
1230
1527
|
width: "12",
|
|
@@ -1237,10 +1534,10 @@ var ChevronRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
|
1237
1534
|
strokeLinejoin: "round",
|
|
1238
1535
|
"aria-hidden": "true",
|
|
1239
1536
|
className: "uix-favourites__chevron",
|
|
1240
|
-
children: /* @__PURE__ */ (0,
|
|
1537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m9 18 6-6-6-6" })
|
|
1241
1538
|
}
|
|
1242
1539
|
);
|
|
1243
|
-
var MoreIcon = () => /* @__PURE__ */ (0,
|
|
1540
|
+
var MoreIcon = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1244
1541
|
"svg",
|
|
1245
1542
|
{
|
|
1246
1543
|
width: "14",
|
|
@@ -1253,9 +1550,9 @@ var MoreIcon = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
|
1253
1550
|
strokeLinejoin: "round",
|
|
1254
1551
|
"aria-hidden": "true",
|
|
1255
1552
|
children: [
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { cx: "12", cy: "12", r: "1" }),
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { cx: "12", cy: "5", r: "1" }),
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { cx: "12", cy: "19", r: "1" })
|
|
1259
1556
|
]
|
|
1260
1557
|
}
|
|
1261
1558
|
);
|
|
@@ -1269,13 +1566,13 @@ function NavFavourites({
|
|
|
1269
1566
|
emptyReason,
|
|
1270
1567
|
className
|
|
1271
1568
|
}) {
|
|
1272
|
-
const regionId = (0,
|
|
1273
|
-
const headerRef = (0,
|
|
1274
|
-
const regionRef = (0,
|
|
1275
|
-
const focusAfterRef = (0,
|
|
1276
|
-
const triggerRefs = (0,
|
|
1277
|
-
const order = (0,
|
|
1278
|
-
(0,
|
|
1569
|
+
const regionId = (0, import_react21.useId)();
|
|
1570
|
+
const headerRef = (0, import_react21.useRef)(null);
|
|
1571
|
+
const regionRef = (0, import_react21.useRef)(null);
|
|
1572
|
+
const focusAfterRef = (0, import_react21.useRef)(null);
|
|
1573
|
+
const triggerRefs = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
|
|
1574
|
+
const order = (0, import_react21.useMemo)(() => items.map((item) => item.id), [items]);
|
|
1575
|
+
(0, import_react21.useEffect)(() => {
|
|
1279
1576
|
const id = focusAfterRef.current;
|
|
1280
1577
|
if (!id) return;
|
|
1281
1578
|
focusAfterRef.current = null;
|
|
@@ -1292,7 +1589,7 @@ function NavFavourites({
|
|
|
1292
1589
|
}
|
|
1293
1590
|
onToggleCollapsed?.();
|
|
1294
1591
|
};
|
|
1295
|
-
const move = (0,
|
|
1592
|
+
const move = (0, import_react21.useCallback)((id, dir) => {
|
|
1296
1593
|
const idx = order.indexOf(id);
|
|
1297
1594
|
const next = idx + dir;
|
|
1298
1595
|
if (idx < 0 || next < 0 || next >= order.length) return;
|
|
@@ -1303,18 +1600,18 @@ function NavFavourites({
|
|
|
1303
1600
|
focusAfterRef.current = id;
|
|
1304
1601
|
onReorder(reordered);
|
|
1305
1602
|
}, [onReorder, order]);
|
|
1306
|
-
const remove = (0,
|
|
1603
|
+
const remove = (0, import_react21.useCallback)((id) => {
|
|
1307
1604
|
const idx = order.indexOf(id);
|
|
1308
1605
|
const neighbour = order[idx + 1] ?? order[idx - 1] ?? null;
|
|
1309
1606
|
focusAfterRef.current = neighbour;
|
|
1310
1607
|
onRemove(id);
|
|
1311
1608
|
}, [onRemove, order]);
|
|
1312
|
-
const registerTrigger = (0,
|
|
1609
|
+
const registerTrigger = (0, import_react21.useCallback)((id, element) => {
|
|
1313
1610
|
if (element) triggerRefs.current.set(id, element);
|
|
1314
1611
|
else triggerRefs.current.delete(id);
|
|
1315
1612
|
}, []);
|
|
1316
|
-
return /* @__PURE__ */ (0,
|
|
1317
|
-
/* @__PURE__ */ (0,
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cx("uix-favourites", className), children: [
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1318
1615
|
"button",
|
|
1319
1616
|
{
|
|
1320
1617
|
ref: headerRef,
|
|
@@ -1324,26 +1621,26 @@ function NavFavourites({
|
|
|
1324
1621
|
onClick: handleToggle,
|
|
1325
1622
|
className: "uix-favourites__heading uix-text-eyebrow",
|
|
1326
1623
|
children: [
|
|
1327
|
-
collapsed ? /* @__PURE__ */ (0,
|
|
1624
|
+
collapsed ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRightIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDownIcon, {}),
|
|
1328
1625
|
labels.heading
|
|
1329
1626
|
]
|
|
1330
1627
|
}
|
|
1331
1628
|
),
|
|
1332
|
-
/* @__PURE__ */ (0,
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1333
1630
|
"ul",
|
|
1334
1631
|
{
|
|
1335
1632
|
ref: regionRef,
|
|
1336
1633
|
id: regionId,
|
|
1337
1634
|
hidden: collapsed,
|
|
1338
1635
|
className: "uix-favourites__list",
|
|
1339
|
-
children: items.length === 0 ? /* @__PURE__ */ (0,
|
|
1636
|
+
children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1340
1637
|
"li",
|
|
1341
1638
|
{
|
|
1342
1639
|
className: "uix-favourites__empty uix-text-meta",
|
|
1343
1640
|
"data-empty-reason": emptyReason,
|
|
1344
1641
|
children: labels.empty
|
|
1345
1642
|
}
|
|
1346
|
-
) : items.map((item, idx) => /* @__PURE__ */ (0,
|
|
1643
|
+
) : items.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1347
1644
|
FavouriteRow,
|
|
1348
1645
|
{
|
|
1349
1646
|
item,
|
|
@@ -1360,7 +1657,7 @@ function NavFavourites({
|
|
|
1360
1657
|
)
|
|
1361
1658
|
] });
|
|
1362
1659
|
}
|
|
1363
|
-
var FavouriteRow = (0,
|
|
1660
|
+
var FavouriteRow = (0, import_react21.memo)(function FavouriteRow2({
|
|
1364
1661
|
item,
|
|
1365
1662
|
isFirst,
|
|
1366
1663
|
isLast,
|
|
@@ -1369,17 +1666,17 @@ var FavouriteRow = (0, import_react17.memo)(function FavouriteRow2({
|
|
|
1369
1666
|
onRemove,
|
|
1370
1667
|
registerTrigger
|
|
1371
1668
|
}) {
|
|
1372
|
-
const [open, setOpen] = (0,
|
|
1373
|
-
const menuId = (0,
|
|
1374
|
-
const triggerRef = (0,
|
|
1375
|
-
const itemRefs = (0,
|
|
1669
|
+
const [open, setOpen] = (0, import_react21.useState)(false);
|
|
1670
|
+
const menuId = (0, import_react21.useId)();
|
|
1671
|
+
const triggerRef = (0, import_react21.useRef)(null);
|
|
1672
|
+
const itemRefs = (0, import_react21.useRef)([]);
|
|
1376
1673
|
const optionsTemplate = labels.options ?? "{label} favourite options";
|
|
1377
1674
|
const actions = [
|
|
1378
1675
|
...isFirst ? [] : [{ label: labels.moveUp, onSelect: () => onMove(item.id, -1) }],
|
|
1379
1676
|
...isLast ? [] : [{ label: labels.moveDown, onSelect: () => onMove(item.id, 1) }],
|
|
1380
1677
|
{ label: labels.remove.replace("{label}", item.label), onSelect: () => onRemove(item.id) }
|
|
1381
1678
|
];
|
|
1382
|
-
(0,
|
|
1679
|
+
(0, import_react21.useEffect)(() => {
|
|
1383
1680
|
if (open) itemRefs.current[0]?.focus();
|
|
1384
1681
|
}, [open]);
|
|
1385
1682
|
const closeAndReturnFocus = () => {
|
|
@@ -1414,14 +1711,14 @@ var FavouriteRow = (0, import_react17.memo)(function FavouriteRow2({
|
|
|
1414
1711
|
};
|
|
1415
1712
|
return (
|
|
1416
1713
|
// biome-ignore lint/a11y/noStaticElementInteractions: keyboard accelerators on the row; the focusable controls inside carry their own semantics.
|
|
1417
|
-
/* @__PURE__ */ (0,
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1418
1715
|
"li",
|
|
1419
1716
|
{
|
|
1420
1717
|
className: "uix-favourites__row",
|
|
1421
1718
|
onKeyDown: onRowKeyDown,
|
|
1422
1719
|
children: [
|
|
1423
|
-
/* @__PURE__ */ (0,
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-favourites__link", children: item.link }),
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1425
1722
|
"button",
|
|
1426
1723
|
{
|
|
1427
1724
|
ref: (el) => {
|
|
@@ -1435,11 +1732,11 @@ var FavouriteRow = (0, import_react17.memo)(function FavouriteRow2({
|
|
|
1435
1732
|
"aria-label": optionsTemplate.replace("{label}", item.label),
|
|
1436
1733
|
onClick: () => setOpen((v) => !v),
|
|
1437
1734
|
className: "uix-favourites__menu-trigger",
|
|
1438
|
-
children: /* @__PURE__ */ (0,
|
|
1735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MoreIcon, {})
|
|
1439
1736
|
}
|
|
1440
1737
|
),
|
|
1441
|
-
open ? /* @__PURE__ */ (0,
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1738
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1443
1740
|
"div",
|
|
1444
1741
|
{
|
|
1445
1742
|
"aria-hidden": "true",
|
|
@@ -1448,14 +1745,14 @@ var FavouriteRow = (0, import_react17.memo)(function FavouriteRow2({
|
|
|
1448
1745
|
className: "uix-favourites__backdrop"
|
|
1449
1746
|
}
|
|
1450
1747
|
),
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1452
1749
|
"ul",
|
|
1453
1750
|
{
|
|
1454
1751
|
id: menuId,
|
|
1455
1752
|
role: "menu",
|
|
1456
1753
|
onKeyDown: onMenuKeyDown,
|
|
1457
1754
|
className: "uix-favourites__menu",
|
|
1458
|
-
children: actions.map((action, i) => /* @__PURE__ */ (0,
|
|
1755
|
+
children: actions.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1459
1756
|
"button",
|
|
1460
1757
|
{
|
|
1461
1758
|
ref: (el) => {
|
|
@@ -1482,21 +1779,21 @@ var FavouriteRow = (0, import_react17.memo)(function FavouriteRow2({
|
|
|
1482
1779
|
});
|
|
1483
1780
|
|
|
1484
1781
|
// src/components/Alert.tsx
|
|
1485
|
-
var
|
|
1782
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1486
1783
|
function Alert({ tone, title, icon, children, className, ...props }) {
|
|
1487
|
-
return /* @__PURE__ */ (0,
|
|
1488
|
-
icon && /* @__PURE__ */ (0,
|
|
1489
|
-
/* @__PURE__ */ (0,
|
|
1490
|
-
title && /* @__PURE__ */ (0,
|
|
1491
|
-
children && /* @__PURE__ */ (0,
|
|
1784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className), ...props, children: [
|
|
1785
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "uix-alert__icon", children: icon }),
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
1787
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "uix-alert__title", children: title }),
|
|
1788
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "uix-alert__body", children })
|
|
1492
1789
|
] })
|
|
1493
1790
|
] });
|
|
1494
1791
|
}
|
|
1495
1792
|
|
|
1496
1793
|
// src/components/Spinner.tsx
|
|
1497
|
-
var
|
|
1794
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1498
1795
|
function Spinner({ size = "md", accent, className, ...props }) {
|
|
1499
|
-
return /* @__PURE__ */ (0,
|
|
1796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1500
1797
|
"span",
|
|
1501
1798
|
{
|
|
1502
1799
|
className: cx("uix-spinner", accent && "uix-spinner--accent", size === "lg" && "uix-spinner--lg", className),
|
|
@@ -1508,10 +1805,10 @@ function Spinner({ size = "md", accent, className, ...props }) {
|
|
|
1508
1805
|
}
|
|
1509
1806
|
|
|
1510
1807
|
// src/components/Toast.tsx
|
|
1511
|
-
var
|
|
1808
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1512
1809
|
function Toast({ title, message, tone, icon, onClose, leaving, className, ...props }) {
|
|
1513
1810
|
const assertive = tone === "danger";
|
|
1514
|
-
return /* @__PURE__ */ (0,
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1515
1812
|
"div",
|
|
1516
1813
|
{
|
|
1517
1814
|
className: cx("uix-toast", tone && `uix-toast--${tone}`, className),
|
|
@@ -1520,25 +1817,25 @@ function Toast({ title, message, tone, icon, onClose, leaving, className, ...pro
|
|
|
1520
1817
|
"aria-live": assertive ? "assertive" : "polite",
|
|
1521
1818
|
...props,
|
|
1522
1819
|
children: [
|
|
1523
|
-
icon && /* @__PURE__ */ (0,
|
|
1524
|
-
/* @__PURE__ */ (0,
|
|
1525
|
-
title && /* @__PURE__ */ (0,
|
|
1526
|
-
message && /* @__PURE__ */ (0,
|
|
1820
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "uix-toast__icon", "aria-hidden": "true", children: icon }),
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "uix-toast__body", children: [
|
|
1822
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "uix-toast__title", children: title }),
|
|
1823
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "uix-toast__msg", children: message })
|
|
1527
1824
|
] }),
|
|
1528
|
-
onClose && /* @__PURE__ */ (0,
|
|
1825
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { className: "uix-toast__close", onClick: onClose, "aria-label": "Dismiss", children: "\xD7" })
|
|
1529
1826
|
]
|
|
1530
1827
|
}
|
|
1531
1828
|
);
|
|
1532
1829
|
}
|
|
1533
1830
|
function Toaster({ children, className, ...props }) {
|
|
1534
|
-
return /* @__PURE__ */ (0,
|
|
1831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cx("uix-toaster", className), ...props, children });
|
|
1535
1832
|
}
|
|
1536
1833
|
|
|
1537
1834
|
// src/components/Table.tsx
|
|
1538
|
-
var
|
|
1539
|
-
var
|
|
1540
|
-
var TableWrap = (0,
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1835
|
+
var import_react22 = require("react");
|
|
1836
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1837
|
+
var TableWrap = (0, import_react22.forwardRef)(function TableWrap2({ children, className, ...props }, ref) {
|
|
1838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref, className: cx("uix-table-wrap", className), ...props, children });
|
|
1542
1839
|
});
|
|
1543
1840
|
function Table({
|
|
1544
1841
|
density = "standard",
|
|
@@ -1551,7 +1848,7 @@ function Table({
|
|
|
1551
1848
|
children,
|
|
1552
1849
|
...props
|
|
1553
1850
|
}) {
|
|
1554
|
-
return /* @__PURE__ */ (0,
|
|
1851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1555
1852
|
"table",
|
|
1556
1853
|
{
|
|
1557
1854
|
className: cx(
|
|
@@ -1570,7 +1867,7 @@ function Table({
|
|
|
1570
1867
|
);
|
|
1571
1868
|
}
|
|
1572
1869
|
function Th({ sortable, sortDirection, sortOrder, onSort, className, children, onClick, ...props }) {
|
|
1573
|
-
return /* @__PURE__ */ (0,
|
|
1870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1574
1871
|
"th",
|
|
1575
1872
|
{
|
|
1576
1873
|
className,
|
|
@@ -1584,10 +1881,10 @@ function Th({ sortable, sortDirection, sortOrder, onSort, className, children, o
|
|
|
1584
1881
|
);
|
|
1585
1882
|
}
|
|
1586
1883
|
function Td({ pinned, className, children, ...props }) {
|
|
1587
|
-
return /* @__PURE__ */ (0,
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className, "data-pinned": pinned || void 0, ...props, children });
|
|
1588
1885
|
}
|
|
1589
1886
|
function Tr({ selected, pinned, className, children, ...props }) {
|
|
1590
|
-
return /* @__PURE__ */ (0,
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1591
1888
|
"tr",
|
|
1592
1889
|
{
|
|
1593
1890
|
className,
|
|
@@ -1599,23 +1896,23 @@ function Tr({ selected, pinned, className, children, ...props }) {
|
|
|
1599
1896
|
);
|
|
1600
1897
|
}
|
|
1601
1898
|
function BulkBar({ count, children, className, ...props }) {
|
|
1602
|
-
return /* @__PURE__ */ (0,
|
|
1603
|
-
count != null && /* @__PURE__ */ (0,
|
|
1899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx("uix-bulkbar", className), role: "toolbar", "aria-label": "Bulk actions", ...props, children: [
|
|
1900
|
+
count != null && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "uix-bulkbar__count", children: [
|
|
1604
1901
|
count,
|
|
1605
1902
|
" selected"
|
|
1606
1903
|
] }),
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "uix-bulkbar__spacer" }),
|
|
1608
1905
|
children
|
|
1609
1906
|
] });
|
|
1610
1907
|
}
|
|
1611
1908
|
function RowActions({ children, className, ...props }) {
|
|
1612
|
-
return /* @__PURE__ */ (0,
|
|
1909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: cx("uix-table__actions", className), ...props, children });
|
|
1613
1910
|
}
|
|
1614
1911
|
function RowAction({ children, className, type = "button", ...props }) {
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
1912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type, className: cx("uix-rowact", className), ...props, children });
|
|
1616
1913
|
}
|
|
1617
1914
|
function ExpandToggle({ expanded, className, type = "button", ...props }) {
|
|
1618
|
-
return /* @__PURE__ */ (0,
|
|
1915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1619
1916
|
"button",
|
|
1620
1917
|
{
|
|
1621
1918
|
type,
|
|
@@ -1623,27 +1920,27 @@ function ExpandToggle({ expanded, className, type = "button", ...props }) {
|
|
|
1623
1920
|
"aria-expanded": expanded,
|
|
1624
1921
|
"aria-label": expanded ? "Collapse row" : "Expand row",
|
|
1625
1922
|
...props,
|
|
1626
|
-
children: /* @__PURE__ */ (0,
|
|
1923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M6 4l4 4-4 4" }) })
|
|
1627
1924
|
}
|
|
1628
1925
|
);
|
|
1629
1926
|
}
|
|
1630
1927
|
function CellStrong({ children, className, ...props }) {
|
|
1631
|
-
return /* @__PURE__ */ (0,
|
|
1928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: cx("uix-cell-strong", className), ...props, children });
|
|
1632
1929
|
}
|
|
1633
1930
|
function CellSub({ children, className, ...props }) {
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: cx("uix-cell-sub", className), ...props, children });
|
|
1635
1932
|
}
|
|
1636
1933
|
function Mark({ children, className, ...props }) {
|
|
1637
|
-
return /* @__PURE__ */ (0,
|
|
1934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("mark", { className: cx("uix-mark", className), ...props, children });
|
|
1638
1935
|
}
|
|
1639
1936
|
function Highlighted({ text, query }) {
|
|
1640
|
-
return /* @__PURE__ */ (0,
|
|
1641
|
-
(seg, i) => seg.match ? /* @__PURE__ */ (0,
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: highlightSegments(text, query).map(
|
|
1938
|
+
(seg, i) => seg.match ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("mark", { className: "uix-mark", children: seg.text }, i) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: seg.text }, i)
|
|
1642
1939
|
) });
|
|
1643
1940
|
}
|
|
1644
1941
|
|
|
1645
1942
|
// src/components/Pagination.tsx
|
|
1646
|
-
var
|
|
1943
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1647
1944
|
function getPageNumbers(page, total) {
|
|
1648
1945
|
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
1649
1946
|
const pages = [1];
|
|
@@ -1657,8 +1954,8 @@ function getPageNumbers(page, total) {
|
|
|
1657
1954
|
}
|
|
1658
1955
|
function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
1659
1956
|
const pages = getPageNumbers(page, pageCount);
|
|
1660
|
-
return /* @__PURE__ */ (0,
|
|
1661
|
-
/* @__PURE__ */ (0,
|
|
1957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("nav", { "aria-label": "Pagination", className: cx("uix-pagination", className), ...props, children: [
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1662
1959
|
"button",
|
|
1663
1960
|
{
|
|
1664
1961
|
className: "uix-pagination__btn",
|
|
@@ -1669,7 +1966,7 @@ function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
|
1669
1966
|
}
|
|
1670
1967
|
),
|
|
1671
1968
|
pages.map(
|
|
1672
|
-
(p, i) => p === "ellipsis" ? /* @__PURE__ */ (0,
|
|
1969
|
+
(p, i) => p === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "uix-pagination__ellipsis", children: "\u2026" }, `e${i}`) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1673
1970
|
"button",
|
|
1674
1971
|
{
|
|
1675
1972
|
className: "uix-pagination__btn",
|
|
@@ -1680,7 +1977,7 @@ function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
|
1680
1977
|
p
|
|
1681
1978
|
)
|
|
1682
1979
|
),
|
|
1683
|
-
/* @__PURE__ */ (0,
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1684
1981
|
"button",
|
|
1685
1982
|
{
|
|
1686
1983
|
className: "uix-pagination__btn",
|
|
@@ -1694,15 +1991,15 @@ function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
|
1694
1991
|
}
|
|
1695
1992
|
|
|
1696
1993
|
// src/components/StatusPill.tsx
|
|
1697
|
-
var
|
|
1994
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1698
1995
|
function StatusPill({ tone = "neutral", treatment = "filled", dot, children, className, ...props }) {
|
|
1699
|
-
return /* @__PURE__ */ (0,
|
|
1996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1700
1997
|
"span",
|
|
1701
1998
|
{
|
|
1702
1999
|
className: cx("uix-pill", `uix-pill--${tone}`, treatment === "outline" && "uix-pill--outline", className),
|
|
1703
2000
|
...props,
|
|
1704
2001
|
children: [
|
|
1705
|
-
dot && /* @__PURE__ */ (0,
|
|
2002
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "uix-pill__dot", "aria-hidden": "true" }),
|
|
1706
2003
|
children
|
|
1707
2004
|
]
|
|
1708
2005
|
}
|
|
@@ -1710,10 +2007,10 @@ function StatusPill({ tone = "neutral", treatment = "filled", dot, children, cla
|
|
|
1710
2007
|
}
|
|
1711
2008
|
|
|
1712
2009
|
// src/components/Progress.tsx
|
|
1713
|
-
var
|
|
2010
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1714
2011
|
function Progress({ value = 0, max = 100, indeterminate, className, ...props }) {
|
|
1715
2012
|
const pct = Math.max(0, Math.min(100, value / (max || 100) * 100));
|
|
1716
|
-
return /* @__PURE__ */ (0,
|
|
2013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1717
2014
|
"div",
|
|
1718
2015
|
{
|
|
1719
2016
|
role: "progressbar",
|
|
@@ -1722,16 +2019,16 @@ function Progress({ value = 0, max = 100, indeterminate, className, ...props })
|
|
|
1722
2019
|
"aria-valuenow": indeterminate ? void 0 : value,
|
|
1723
2020
|
className: cx("uix-progress", indeterminate && "uix-progress--indeterminate", className),
|
|
1724
2021
|
...props,
|
|
1725
|
-
children: /* @__PURE__ */ (0,
|
|
2022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : { width: `${pct}%` } })
|
|
1726
2023
|
}
|
|
1727
2024
|
);
|
|
1728
2025
|
}
|
|
1729
2026
|
|
|
1730
2027
|
// src/components/Meter.tsx
|
|
1731
|
-
var
|
|
2028
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1732
2029
|
function Meter({ value = 0, tone, className, ...props }) {
|
|
1733
2030
|
const pct = Math.max(0, Math.min(100, value));
|
|
1734
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1735
2032
|
"div",
|
|
1736
2033
|
{
|
|
1737
2034
|
role: "meter",
|
|
@@ -1740,7 +2037,7 @@ function Meter({ value = 0, tone, className, ...props }) {
|
|
|
1740
2037
|
"aria-valuemax": 100,
|
|
1741
2038
|
className: cx("uix-meter", className),
|
|
1742
2039
|
...props,
|
|
1743
|
-
children: /* @__PURE__ */ (0,
|
|
2040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1744
2041
|
"div",
|
|
1745
2042
|
{
|
|
1746
2043
|
className: "uix-meter__fill",
|
|
@@ -1753,29 +2050,29 @@ function Meter({ value = 0, tone, className, ...props }) {
|
|
|
1753
2050
|
}
|
|
1754
2051
|
|
|
1755
2052
|
// src/components/Stat.tsx
|
|
1756
|
-
var
|
|
2053
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1757
2054
|
function Stat({ label, value, icon, meta, trend, className, ...props }) {
|
|
1758
|
-
return /* @__PURE__ */ (0,
|
|
1759
|
-
/* @__PURE__ */ (0,
|
|
1760
|
-
/* @__PURE__ */ (0,
|
|
2055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cx("uix-stat", className), ...props, children: [
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "uix-stat__label", children: [
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: label }),
|
|
1761
2058
|
icon
|
|
1762
2059
|
] }),
|
|
1763
|
-
/* @__PURE__ */ (0,
|
|
1764
|
-
(meta != null || trend != null) && /* @__PURE__ */ (0,
|
|
1765
|
-
trend != null && /* @__PURE__ */ (0,
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "uix-stat__value", children: value }),
|
|
2061
|
+
(meta != null || trend != null) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "uix-stat__meta", children: [
|
|
2062
|
+
trend != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cx("uix-stat__trend", `uix-stat__trend--${trend.direction}`), children: trend.label }),
|
|
1766
2063
|
meta
|
|
1767
2064
|
] })
|
|
1768
2065
|
] });
|
|
1769
2066
|
}
|
|
1770
2067
|
|
|
1771
2068
|
// src/components/Tooltip.tsx
|
|
1772
|
-
var
|
|
1773
|
-
var
|
|
2069
|
+
var import_react23 = require("react");
|
|
2070
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1774
2071
|
function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
1775
|
-
const triggerRef = (0,
|
|
1776
|
-
const bubbleRef = (0,
|
|
1777
|
-
const [open, setOpen] = (0,
|
|
1778
|
-
const id = (0,
|
|
2072
|
+
const triggerRef = (0, import_react23.useRef)(null);
|
|
2073
|
+
const bubbleRef = (0, import_react23.useRef)(null);
|
|
2074
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
2075
|
+
const id = (0, import_react23.useId)();
|
|
1779
2076
|
useAnchoredPosition(triggerRef, bubbleRef, { open, placement, offset: 6 });
|
|
1780
2077
|
const show = () => {
|
|
1781
2078
|
const b = bubbleRef.current;
|
|
@@ -1797,7 +2094,7 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
1797
2094
|
}
|
|
1798
2095
|
setOpen(false);
|
|
1799
2096
|
};
|
|
1800
|
-
(0,
|
|
2097
|
+
(0, import_react23.useEffect)(() => () => {
|
|
1801
2098
|
const b = bubbleRef.current;
|
|
1802
2099
|
if (b && b.matches(":popover-open")) {
|
|
1803
2100
|
try {
|
|
@@ -1807,7 +2104,7 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
1807
2104
|
}
|
|
1808
2105
|
}, []);
|
|
1809
2106
|
const bubbleAttr = { popover: "manual" };
|
|
1810
|
-
return /* @__PURE__ */ (0,
|
|
2107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
1811
2108
|
"span",
|
|
1812
2109
|
{
|
|
1813
2110
|
ref: triggerRef,
|
|
@@ -1823,33 +2120,52 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
1823
2120
|
...props,
|
|
1824
2121
|
children: [
|
|
1825
2122
|
children,
|
|
1826
|
-
/* @__PURE__ */ (0,
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { ref: bubbleRef, id, role: "tooltip", className: "uix-tooltip__bubble", ...bubbleAttr, children: label })
|
|
1827
2124
|
]
|
|
1828
2125
|
}
|
|
1829
2126
|
);
|
|
1830
2127
|
}
|
|
1831
2128
|
|
|
1832
2129
|
// src/components/States.tsx
|
|
1833
|
-
var
|
|
1834
|
-
function EmptyState({ icon, title, children, action, className, ...props }) {
|
|
1835
|
-
return /* @__PURE__ */ (0,
|
|
1836
|
-
icon != null && /* @__PURE__ */ (0,
|
|
1837
|
-
title != null && /* @__PURE__ */ (0,
|
|
2130
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2131
|
+
function EmptyState({ icon, title, children, action, variant = "section", className, ...props }) {
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cx("uix-empty", `uix-empty--${variant}`, className), ...props, children: [
|
|
2133
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__icon", children: icon }),
|
|
2134
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
1838
2135
|
children,
|
|
1839
2136
|
action
|
|
1840
2137
|
] });
|
|
1841
2138
|
}
|
|
1842
|
-
function ErrorState({ icon, title, detail, action, className, ...props }) {
|
|
1843
|
-
return /* @__PURE__ */ (0,
|
|
1844
|
-
icon != null && /* @__PURE__ */ (0,
|
|
1845
|
-
title != null && /* @__PURE__ */ (0,
|
|
1846
|
-
detail != null && /* @__PURE__ */ (0,
|
|
2139
|
+
function ErrorState({ icon, title, detail, action, variant = "section", className, ...props }) {
|
|
2140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cx("uix-empty", "uix-empty--danger", `uix-empty--${variant}`, className), role: "alert", ...props, children: [
|
|
2141
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__icon uix-empty__icon--danger", children: icon }),
|
|
2142
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
2143
|
+
detail != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: detail }),
|
|
1847
2144
|
action
|
|
1848
2145
|
] });
|
|
1849
2146
|
}
|
|
2147
|
+
function ForbiddenState({ icon, title, detail, action, variant = "section", className, ...props }) {
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cx("uix-empty", "uix-empty--warning", `uix-empty--${variant}`, className), ...props, children: [
|
|
2149
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__icon uix-empty__icon--warning", children: icon }),
|
|
2150
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
2151
|
+
detail != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: detail }),
|
|
2152
|
+
action
|
|
2153
|
+
] });
|
|
2154
|
+
}
|
|
2155
|
+
function NotFoundState({ icon, title, detail, action, variant = "section", className, ...props }) {
|
|
2156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cx("uix-empty", `uix-empty--${variant}`, className), ...props, children: [
|
|
2157
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__icon", children: icon }),
|
|
2158
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
2159
|
+
detail != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: detail }),
|
|
2160
|
+
action
|
|
2161
|
+
] });
|
|
2162
|
+
}
|
|
2163
|
+
function FilteredEmptyState(props) {
|
|
2164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EmptyState, { "data-filtered": "true", ...props });
|
|
2165
|
+
}
|
|
1850
2166
|
function Skeleton({ variant = "block", width, height, className, style, ...props }) {
|
|
1851
2167
|
const dims = { width, height, ...style };
|
|
1852
|
-
return /* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1853
2169
|
"div",
|
|
1854
2170
|
{
|
|
1855
2171
|
className: cx(
|
|
@@ -1863,53 +2179,156 @@ function Skeleton({ variant = "block", width, height, className, style, ...props
|
|
|
1863
2179
|
}
|
|
1864
2180
|
);
|
|
1865
2181
|
}
|
|
1866
|
-
function LoadingState({ rows = 3, className, ...props }) {
|
|
1867
|
-
return /* @__PURE__ */ (0,
|
|
2182
|
+
function LoadingState({ rows = 3, density = "comfortable", label, className, ...props }) {
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cx("uix-stack", density === "compact" && "uix-stack--compact", className), role: "status", "aria-busy": "true", "aria-label": label, ...props, children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Skeleton, { variant: "text", width: `${92 - i % 3 * 14}%` }, i)) });
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
// src/components/RelativeTime.tsx
|
|
2187
|
+
var import_react24 = require("react");
|
|
2188
|
+
|
|
2189
|
+
// src/relative-time-model.ts
|
|
2190
|
+
function parseDateValue(value) {
|
|
2191
|
+
const date = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
2192
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
2193
|
+
}
|
|
2194
|
+
function relativeTimeValue(date, now) {
|
|
2195
|
+
const seconds = (date.getTime() - now.getTime()) / 1e3;
|
|
2196
|
+
const absolute = Math.abs(seconds);
|
|
2197
|
+
if (absolute < 60) return { value: Math.round(seconds), unit: "second" };
|
|
2198
|
+
if (absolute < 3600) return { value: Math.round(seconds / 60), unit: "minute" };
|
|
2199
|
+
if (absolute < 86400) return { value: Math.round(seconds / 3600), unit: "hour" };
|
|
2200
|
+
return { value: Math.round(seconds / 86400), unit: "day" };
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
// src/relative-time-clock.ts
|
|
2204
|
+
var clocks = /* @__PURE__ */ new Map();
|
|
2205
|
+
var getClock = (interval) => {
|
|
2206
|
+
let clock = clocks.get(interval);
|
|
2207
|
+
if (!clock) {
|
|
2208
|
+
clock = { now: Date.now(), listeners: /* @__PURE__ */ new Set() };
|
|
2209
|
+
clocks.set(interval, clock);
|
|
2210
|
+
}
|
|
2211
|
+
return clock;
|
|
2212
|
+
};
|
|
2213
|
+
var readRelativeClock = (interval) => getClock(interval).now;
|
|
2214
|
+
function subscribeRelativeClock(interval, listener) {
|
|
2215
|
+
if (interval <= 0 || typeof window === "undefined") return () => {
|
|
2216
|
+
};
|
|
2217
|
+
const clock = getClock(interval);
|
|
2218
|
+
clock.listeners.add(listener);
|
|
2219
|
+
if (!clock.timer) {
|
|
2220
|
+
clock.timer = window.setInterval(() => {
|
|
2221
|
+
clock.now = Date.now();
|
|
2222
|
+
clock.listeners.forEach((notify) => notify());
|
|
2223
|
+
}, interval);
|
|
2224
|
+
}
|
|
2225
|
+
return () => {
|
|
2226
|
+
clock.listeners.delete(listener);
|
|
2227
|
+
if (clock.listeners.size === 0 && clock.timer) {
|
|
2228
|
+
window.clearInterval(clock.timer);
|
|
2229
|
+
clock.timer = void 0;
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
// src/components/RelativeTime.tsx
|
|
2235
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2236
|
+
function RelativeTime({
|
|
2237
|
+
value,
|
|
2238
|
+
now,
|
|
2239
|
+
locale,
|
|
2240
|
+
timeZone,
|
|
2241
|
+
numeric = "auto",
|
|
2242
|
+
invalidLabel = "\u2014",
|
|
2243
|
+
refreshInterval = 3e4,
|
|
2244
|
+
formatter,
|
|
2245
|
+
title,
|
|
2246
|
+
...props
|
|
2247
|
+
}) {
|
|
2248
|
+
const interval = refreshInterval === false ? 0 : Math.max(0, refreshInterval);
|
|
2249
|
+
const fixedNow = now == null ? void 0 : new Date(now).getTime();
|
|
2250
|
+
const subscribe = (0, import_react24.useCallback)((listener) => fixedNow == null ? subscribeRelativeClock(interval, listener) : () => {
|
|
2251
|
+
}, [fixedNow, interval]);
|
|
2252
|
+
const getSnapshot = (0, import_react24.useCallback)(() => fixedNow ?? readRelativeClock(interval), [fixedNow, interval]);
|
|
2253
|
+
const getServerSnapshot = (0, import_react24.useCallback)(() => fixedNow ?? Date.now(), [fixedNow]);
|
|
2254
|
+
const clock = (0, import_react24.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
2255
|
+
const date = (0, import_react24.useMemo)(() => parseDateValue(value), [value]);
|
|
2256
|
+
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("time", { "data-invalid": "true", suppressHydrationWarning: true, ...props, children: invalidLabel });
|
|
2257
|
+
const current = new Date(clock);
|
|
2258
|
+
const content = formatter ? formatter({ date, now: current, locale, timeZone }) : (() => {
|
|
2259
|
+
const relative = relativeTimeValue(date, current);
|
|
2260
|
+
if (relative.unit === "day" && Math.abs(relative.value) >= 7) {
|
|
2261
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone }).format(date);
|
|
2262
|
+
}
|
|
2263
|
+
return new Intl.RelativeTimeFormat(locale, { numeric }).format(relative.value, relative.unit);
|
|
2264
|
+
})();
|
|
2265
|
+
const absolute = new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short", timeZone }).format(date);
|
|
2266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("time", { dateTime: date.toISOString(), title: title ?? absolute, suppressHydrationWarning: true, ...props, children: content });
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
// src/components/AsyncOperationStatus.tsx
|
|
2270
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2271
|
+
var tones = {
|
|
2272
|
+
queued: "neutral",
|
|
2273
|
+
running: "info",
|
|
2274
|
+
complete: "success",
|
|
2275
|
+
failed: "danger"
|
|
2276
|
+
};
|
|
2277
|
+
function AsyncOperationStatus({ state, title, statusLabel, description, progress, progressLabel, action, className, ...props }) {
|
|
2278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cx("uix-operation", className), role: state === "failed" ? "alert" : "status", "aria-live": "polite", ...props, children: [
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "uix-operation__head", children: [
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("strong", { children: title }),
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(StatusPill, { tone: tones[state], children: statusLabel })
|
|
2282
|
+
] }),
|
|
2283
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-operation__description", children: description }),
|
|
2284
|
+
progress != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Progress, { value: progress, "aria-label": progressLabel }),
|
|
2285
|
+
action != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-operation__action", children: action })
|
|
2286
|
+
] });
|
|
1868
2287
|
}
|
|
1869
2288
|
|
|
1870
2289
|
// src/components/Label.tsx
|
|
1871
|
-
var
|
|
2290
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1872
2291
|
function Label({ color, dot, children, className, style, ...props }) {
|
|
1873
2292
|
const merged = color ? { "--label-color": color, ...style } : style;
|
|
1874
|
-
return /* @__PURE__ */ (0,
|
|
1875
|
-
dot && /* @__PURE__ */ (0,
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: cx("uix-label", className), style: merged, ...props, children: [
|
|
2294
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "uix-label__dot", "aria-hidden": "true" }),
|
|
1876
2295
|
children
|
|
1877
2296
|
] });
|
|
1878
2297
|
}
|
|
1879
2298
|
|
|
1880
2299
|
// src/components/Avatar.tsx
|
|
1881
|
-
var
|
|
2300
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1882
2301
|
function Avatar({ size = "md", src, alt, children, status, className, ...props }) {
|
|
1883
|
-
return /* @__PURE__ */ (0,
|
|
1884
|
-
src ? /* @__PURE__ */ (0,
|
|
1885
|
-
status && /* @__PURE__ */ (0,
|
|
2302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
|
|
2303
|
+
src ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("img", { src, alt: alt ?? "" }) : children,
|
|
2304
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "uix-avatar__status" })
|
|
1886
2305
|
] });
|
|
1887
2306
|
}
|
|
1888
2307
|
function AvatarGroup({ children, className, ...props }) {
|
|
1889
|
-
return /* @__PURE__ */ (0,
|
|
2308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: cx("uix-avatar-group", className), ...props, children });
|
|
1890
2309
|
}
|
|
1891
2310
|
function UserChip({ avatar, name, sub, className, children, ...props }) {
|
|
1892
|
-
return /* @__PURE__ */ (0,
|
|
2311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: cx("uix-user-chip", className), ...props, children: [
|
|
1893
2312
|
avatar,
|
|
1894
|
-
/* @__PURE__ */ (0,
|
|
1895
|
-
name != null && /* @__PURE__ */ (0,
|
|
1896
|
-
sub != null && /* @__PURE__ */ (0,
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
2314
|
+
name != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "uix-user-chip__name", children: name }),
|
|
2315
|
+
sub != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "uix-user-chip__sub", style: { display: "block" }, children: sub })
|
|
1897
2316
|
] }),
|
|
1898
2317
|
children
|
|
1899
2318
|
] });
|
|
1900
2319
|
}
|
|
1901
2320
|
|
|
1902
2321
|
// src/components/Comments.tsx
|
|
1903
|
-
var
|
|
2322
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1904
2323
|
function Comments({ children, className, ...props }) {
|
|
1905
|
-
return /* @__PURE__ */ (0,
|
|
2324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: cx("uix-comments", className), ...props, children });
|
|
1906
2325
|
}
|
|
1907
2326
|
function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
1908
|
-
return /* @__PURE__ */ (0,
|
|
1909
|
-
avatar ?? /* @__PURE__ */ (0,
|
|
1910
|
-
/* @__PURE__ */ (0,
|
|
1911
|
-
(author != null || meta != null) && /* @__PURE__ */ (0,
|
|
1912
|
-
author != null && /* @__PURE__ */ (0,
|
|
2327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: cx("uix-comment", className), ...props, children: [
|
|
2328
|
+
avatar ?? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": "true" }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "uix-comment__body", children: [
|
|
2330
|
+
(author != null || meta != null) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "uix-comment__meta", children: [
|
|
2331
|
+
author != null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "uix-comment__author", children: author }),
|
|
1913
2332
|
author != null && meta != null ? " \xB7 " : null,
|
|
1914
2333
|
meta
|
|
1915
2334
|
] }),
|
|
@@ -1919,21 +2338,21 @@ function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
|
1919
2338
|
}
|
|
1920
2339
|
|
|
1921
2340
|
// src/components/Composer.tsx
|
|
1922
|
-
var
|
|
2341
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1923
2342
|
function Composer({ children, className, ...props }) {
|
|
1924
|
-
return /* @__PURE__ */ (0,
|
|
2343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: cx("uix-composer", className), ...props, children });
|
|
1925
2344
|
}
|
|
1926
2345
|
function ComposerBar({ children, className, ...props }) {
|
|
1927
|
-
return /* @__PURE__ */ (0,
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: cx("uix-composer__bar", className), ...props, children });
|
|
1928
2347
|
}
|
|
1929
2348
|
|
|
1930
2349
|
// src/components/Segmented.tsx
|
|
1931
|
-
var
|
|
1932
|
-
var
|
|
1933
|
-
var SegmentedCtx = (0,
|
|
2350
|
+
var import_react25 = require("react");
|
|
2351
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2352
|
+
var SegmentedCtx = (0, import_react25.createContext)({});
|
|
1934
2353
|
function Segmented({ value, onChange, children, className, ...props }) {
|
|
1935
|
-
const contextValue = (0,
|
|
1936
|
-
return /* @__PURE__ */ (0,
|
|
2354
|
+
const contextValue = (0, import_react25.useMemo)(() => ({ value, onChange }), [value, onChange]);
|
|
2355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SegmentedCtx.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", className: cx("uix-segmented", className), ...props, children }) });
|
|
1937
2356
|
}
|
|
1938
2357
|
function SegmentedOption({
|
|
1939
2358
|
value,
|
|
@@ -1942,9 +2361,9 @@ function SegmentedOption({
|
|
|
1942
2361
|
onClick,
|
|
1943
2362
|
...props
|
|
1944
2363
|
}) {
|
|
1945
|
-
const ctx = (0,
|
|
2364
|
+
const ctx = (0, import_react25.useContext)(SegmentedCtx);
|
|
1946
2365
|
const selected = ctx.value === value;
|
|
1947
|
-
return /* @__PURE__ */ (0,
|
|
2366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1948
2367
|
"button",
|
|
1949
2368
|
{
|
|
1950
2369
|
type: "button",
|
|
@@ -1960,39 +2379,91 @@ function SegmentedOption({
|
|
|
1960
2379
|
);
|
|
1961
2380
|
}
|
|
1962
2381
|
|
|
2382
|
+
// src/components/TableControls.tsx
|
|
2383
|
+
var import_react26 = require("react");
|
|
2384
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2385
|
+
function ViewMenu({ density, densityLabel, densityOptions, onDensityChange, zebra, freeze, columns, columnsLabel, onColumnVisibilityChange }) {
|
|
2386
|
+
const densityLabelId = (0, import_react26.useId)();
|
|
2387
|
+
const zebraLabelId = (0, import_react26.useId)();
|
|
2388
|
+
const freezeLabelId = (0, import_react26.useId)();
|
|
2389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu", children: [
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu__group", children: [
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { id: densityLabelId, className: "uix-view-menu__label", children: densityLabel }),
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Segmented, { value: density, onChange: onDensityChange, "aria-labelledby": densityLabelId, children: densityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SegmentedOption, { value: option.value, children: option.label }, option.value)) })
|
|
2393
|
+
] }),
|
|
2394
|
+
(zebra || freeze) && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu__group", children: [
|
|
2395
|
+
zebra && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu__row", children: [
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { id: zebraLabelId, children: zebra.label }),
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Switch, { checked: zebra.checked, "aria-labelledby": zebraLabelId, onChange: (event) => zebra.onChange(event.currentTarget.checked) })
|
|
2398
|
+
] }),
|
|
2399
|
+
freeze && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu__row", children: [
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { id: freezeLabelId, children: freeze.label }),
|
|
2401
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Switch, { checked: freeze.checked, "aria-labelledby": freezeLabelId, onChange: (event) => freeze.onChange(event.currentTarget.checked) })
|
|
2402
|
+
] })
|
|
2403
|
+
] }),
|
|
2404
|
+
columns && columns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-view-menu__group", children: [
|
|
2405
|
+
columnsLabel != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "uix-view-menu__label", children: columnsLabel }),
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "uix-view-menu__cols", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Checkbox, { label: column.label, checked: column.visible, disabled: column.disabled, onChange: (event) => onColumnVisibilityChange?.(column.id, event.currentTarget.checked) }, column.id)) })
|
|
2407
|
+
] })
|
|
2408
|
+
] });
|
|
2409
|
+
}
|
|
2410
|
+
function FilterPopover({ label, type = "text", value, onValueChange, options, applyLabel, clearLabel, onApply, onClear, placeholder }) {
|
|
2411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-filter-popover", children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "uix-label", children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: label }),
|
|
2414
|
+
type === "select" || type === "enum" || type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("select", { className: "uix-select", value, onChange: (event) => onValueChange(event.currentTarget.value), children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: option.value, children: option.label }, option.value)) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Input, { type, value, placeholder, onChange: (event) => onValueChange(event.currentTarget.value) })
|
|
2415
|
+
] }),
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "uix-filter-popover__actions", children: [
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "button", onClick: onClear, children: clearLabel }),
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "button", variant: "primary", onClick: onApply, children: applyLabel })
|
|
2419
|
+
] })
|
|
2420
|
+
] });
|
|
2421
|
+
}
|
|
2422
|
+
function SavedViewMenu({ items, onSelect, onPinChange, pinLabel, unpinLabel, emptyLabel, actions, footer }) {
|
|
2423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("ul", { className: "uix-menu uix-saved-views", children: [
|
|
2424
|
+
items.length === 0 && emptyLabel != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("li", { className: "uix-menu__label", children: emptyLabel }),
|
|
2425
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("li", { className: "uix-saved-views__row", children: [
|
|
2426
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: "uix-menu__item", "data-active": item.active || void 0, onClick: () => onSelect(item.id), children: item.label }),
|
|
2427
|
+
onPinChange && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: "uix-saved-views__pin", "aria-label": item.pinned ? unpinLabel : pinLabel, "data-on": item.pinned || void 0, onClick: () => onPinChange(item.id, !item.pinned), children: "\u2605" }),
|
|
2428
|
+
actions?.(item)
|
|
2429
|
+
] }, item.id)),
|
|
2430
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("li", { className: "uix-saved-views__footer", children: footer })
|
|
2431
|
+
] });
|
|
2432
|
+
}
|
|
2433
|
+
|
|
1963
2434
|
// src/components/Timeline.tsx
|
|
1964
|
-
var
|
|
2435
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1965
2436
|
function Timeline({ children, className, ...props }) {
|
|
1966
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cx("uix-timeline", className), ...props, children });
|
|
1967
2438
|
}
|
|
1968
2439
|
function TimelineItem({ node, meta, children, className, ...props }) {
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
1971
|
-
node ?? /* @__PURE__ */ (0,
|
|
1972
|
-
/* @__PURE__ */ (0,
|
|
2440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cx("uix-timeline__item", className), ...props, children: [
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "uix-timeline__rail", children: [
|
|
2442
|
+
node ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "uix-timeline__node" }),
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "uix-timeline__line" })
|
|
1973
2444
|
] }),
|
|
1974
|
-
/* @__PURE__ */ (0,
|
|
1975
|
-
meta != null && /* @__PURE__ */ (0,
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "uix-timeline__body", children: [
|
|
2446
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "uix-timeline__meta", children: meta }),
|
|
1976
2447
|
children
|
|
1977
2448
|
] })
|
|
1978
2449
|
] });
|
|
1979
2450
|
}
|
|
1980
2451
|
|
|
1981
2452
|
// src/components/Prose.tsx
|
|
1982
|
-
var
|
|
2453
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1983
2454
|
function Prose({ children, className, ...props }) {
|
|
1984
|
-
return /* @__PURE__ */ (0,
|
|
2455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cx("uix-prose", className), ...props, children });
|
|
1985
2456
|
}
|
|
1986
2457
|
function Note({ tone, icon, children, className, ...props }) {
|
|
1987
|
-
return /* @__PURE__ */ (0,
|
|
1988
|
-
icon != null && /* @__PURE__ */ (0,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
2458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cx("uix-note", tone && `uix-note--${tone}`, className), ...props, children: [
|
|
2459
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "uix-note__icon", children: icon }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "uix-note__body", children })
|
|
1990
2461
|
] });
|
|
1991
2462
|
}
|
|
1992
2463
|
|
|
1993
2464
|
// src/components/Popover.tsx
|
|
1994
|
-
var
|
|
1995
|
-
var
|
|
2465
|
+
var import_react27 = require("react");
|
|
2466
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
1996
2467
|
function Popover({
|
|
1997
2468
|
popover = "auto",
|
|
1998
2469
|
anchor,
|
|
@@ -2002,15 +2473,15 @@ function Popover({
|
|
|
2002
2473
|
children,
|
|
2003
2474
|
...props
|
|
2004
2475
|
}) {
|
|
2005
|
-
const ref = (0,
|
|
2006
|
-
const [open, setOpen] = (0,
|
|
2476
|
+
const ref = (0, import_react27.useRef)(null);
|
|
2477
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
2007
2478
|
const popoverAttr = { popover };
|
|
2008
2479
|
const reposition = useAnchoredPosition(anchor ?? null, ref, {
|
|
2009
2480
|
open: open && !!anchor,
|
|
2010
2481
|
placement,
|
|
2011
2482
|
offset
|
|
2012
2483
|
});
|
|
2013
|
-
(0,
|
|
2484
|
+
(0, import_react27.useEffect)(() => {
|
|
2014
2485
|
const el = ref.current;
|
|
2015
2486
|
if (!el || !anchor) return;
|
|
2016
2487
|
const sync = () => {
|
|
@@ -2021,38 +2492,38 @@ function Popover({
|
|
|
2021
2492
|
el.addEventListener("toggle", sync);
|
|
2022
2493
|
return () => el.removeEventListener("toggle", sync);
|
|
2023
2494
|
}, [anchor, reposition]);
|
|
2024
|
-
return /* @__PURE__ */ (0,
|
|
2495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { ref, className: cx("uix-popover", className), ...popoverAttr, ...props, children });
|
|
2025
2496
|
}
|
|
2026
2497
|
|
|
2027
2498
|
// src/components/CommandPalette.tsx
|
|
2028
|
-
var
|
|
2499
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2029
2500
|
function CommandPalette({ inputProps, children, className, ...props }) {
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("input", { className: "uix-cmdk__input", ...inputProps }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "uix-cmdk__list", children })
|
|
2033
2504
|
] });
|
|
2034
2505
|
}
|
|
2035
2506
|
function CommandGroup({ label, children }) {
|
|
2036
|
-
return /* @__PURE__ */ (0,
|
|
2037
|
-
label != null && /* @__PURE__ */ (0,
|
|
2507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
2508
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "uix-cmdk__group", children: label }),
|
|
2038
2509
|
children
|
|
2039
2510
|
] });
|
|
2040
2511
|
}
|
|
2041
2512
|
function CommandItem({ icon, shortcut, active, children, className, ...props }) {
|
|
2042
|
-
return /* @__PURE__ */ (0,
|
|
2513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx("uix-cmdk__item", className), "data-active": active || void 0, ...props, children: [
|
|
2043
2514
|
icon,
|
|
2044
|
-
/* @__PURE__ */ (0,
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children }),
|
|
2045
2516
|
shortcut
|
|
2046
2517
|
] });
|
|
2047
2518
|
}
|
|
2048
2519
|
|
|
2049
2520
|
// src/components/Inbox.tsx
|
|
2050
|
-
var
|
|
2521
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2051
2522
|
function Inbox({ children, className, ...props }) {
|
|
2052
|
-
return /* @__PURE__ */ (0,
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx("uix-inbox", className), ...props, children });
|
|
2053
2524
|
}
|
|
2054
2525
|
function InboxList({ children, className, ...props }) {
|
|
2055
|
-
return /* @__PURE__ */ (0,
|
|
2526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx("uix-inbox__list", className), role: "listbox", ...props, children });
|
|
2056
2527
|
}
|
|
2057
2528
|
function InboxItem({
|
|
2058
2529
|
subject,
|
|
@@ -2064,7 +2535,7 @@ function InboxItem({
|
|
|
2064
2535
|
className,
|
|
2065
2536
|
...props
|
|
2066
2537
|
}) {
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
2538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2068
2539
|
"div",
|
|
2069
2540
|
{
|
|
2070
2541
|
role: "option",
|
|
@@ -2074,41 +2545,41 @@ function InboxItem({
|
|
|
2074
2545
|
...props,
|
|
2075
2546
|
children: [
|
|
2076
2547
|
leading,
|
|
2077
|
-
subject != null && /* @__PURE__ */ (0,
|
|
2078
|
-
preview != null && /* @__PURE__ */ (0,
|
|
2548
|
+
subject != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-inbox__subject", children: subject }),
|
|
2549
|
+
preview != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-inbox__preview", children: preview }),
|
|
2079
2550
|
children
|
|
2080
2551
|
]
|
|
2081
2552
|
}
|
|
2082
2553
|
);
|
|
2083
2554
|
}
|
|
2084
2555
|
function InboxDetail({ children, className, ...props }) {
|
|
2085
|
-
return /* @__PURE__ */ (0,
|
|
2556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx("uix-inbox__detail", className), ...props, children });
|
|
2086
2557
|
}
|
|
2087
2558
|
|
|
2088
2559
|
// src/components/Kanban.tsx
|
|
2089
|
-
var
|
|
2560
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2090
2561
|
function Kanban({ children, className, ...props }) {
|
|
2091
|
-
return /* @__PURE__ */ (0,
|
|
2562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cx("uix-kanban", className), ...props, children });
|
|
2092
2563
|
}
|
|
2093
2564
|
function KanbanColumn({ title, count, children, className, ...props }) {
|
|
2094
|
-
return /* @__PURE__ */ (0,
|
|
2095
|
-
(title != null || count != null) && /* @__PURE__ */ (0,
|
|
2565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
2566
|
+
(title != null || count != null) && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "uix-kanban__head", children: [
|
|
2096
2567
|
title,
|
|
2097
|
-
count != null && /* @__PURE__ */ (0,
|
|
2568
|
+
count != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "uix-kanban__count", children: count })
|
|
2098
2569
|
] }),
|
|
2099
|
-
/* @__PURE__ */ (0,
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-kanban__body", children })
|
|
2100
2571
|
] });
|
|
2101
2572
|
}
|
|
2102
2573
|
function KanbanCard({ title, meta, children, className, ...props }) {
|
|
2103
|
-
return /* @__PURE__ */ (0,
|
|
2104
|
-
title && /* @__PURE__ */ (0,
|
|
2105
|
-
meta && /* @__PURE__ */ (0,
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: cx("uix-kanban__card", className), ...props, children: [
|
|
2575
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-kanban__card-title", children: title }),
|
|
2576
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-kanban__card-meta", children: meta }),
|
|
2106
2577
|
children
|
|
2107
2578
|
] });
|
|
2108
2579
|
}
|
|
2109
2580
|
|
|
2110
2581
|
// src/components/Tree.tsx
|
|
2111
|
-
var
|
|
2582
|
+
var import_react28 = require("react");
|
|
2112
2583
|
|
|
2113
2584
|
// src/tree-model.ts
|
|
2114
2585
|
function flattenTree(nodes, expanded, level = 1) {
|
|
@@ -2158,12 +2629,12 @@ function treeNav(flat, currentId, key) {
|
|
|
2158
2629
|
}
|
|
2159
2630
|
|
|
2160
2631
|
// src/components/Tree.tsx
|
|
2161
|
-
var
|
|
2162
|
-
var ChevronIcon2 = () => /* @__PURE__ */ (0,
|
|
2632
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2633
|
+
var ChevronIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
2163
2634
|
function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle, onSelect, onFocusNode, level = 1 }) {
|
|
2164
2635
|
const hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
2165
2636
|
const isExpanded = expanded.has(node.id);
|
|
2166
|
-
return /* @__PURE__ */ (0,
|
|
2637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
2167
2638
|
"li",
|
|
2168
2639
|
{
|
|
2169
2640
|
role: "treeitem",
|
|
@@ -2183,12 +2654,12 @@ function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle,
|
|
|
2183
2654
|
onFocusNode(node.id);
|
|
2184
2655
|
},
|
|
2185
2656
|
children: [
|
|
2186
|
-
/* @__PURE__ */ (0,
|
|
2187
|
-
/* @__PURE__ */ (0,
|
|
2188
|
-
node.icon && /* @__PURE__ */ (0,
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "uix-tree__row", children: [
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uix-tree__toggle", children: hasChildren && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ChevronIcon2, {}) }),
|
|
2659
|
+
node.icon && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", children: node.icon }),
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uix-tree__label", children: node.label })
|
|
2190
2661
|
] }),
|
|
2191
|
-
hasChildren && isExpanded && /* @__PURE__ */ (0,
|
|
2662
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { role: "group", className: "uix-tree__group", children: node.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2192
2663
|
TreeNode,
|
|
2193
2664
|
{
|
|
2194
2665
|
node: child,
|
|
@@ -2220,12 +2691,12 @@ function Tree({
|
|
|
2220
2691
|
className,
|
|
2221
2692
|
...props
|
|
2222
2693
|
}) {
|
|
2223
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
2694
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react28.useState)(defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
2224
2695
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
2225
|
-
const rootRef = (0,
|
|
2226
|
-
const [focusedId, setFocusedId] = (0,
|
|
2696
|
+
const rootRef = (0, import_react28.useRef)(null);
|
|
2697
|
+
const [focusedId, setFocusedId] = (0, import_react28.useState)(void 0);
|
|
2227
2698
|
const selectable = selected !== void 0 || onSelect != null;
|
|
2228
|
-
const handleToggle = (0,
|
|
2699
|
+
const handleToggle = (0, import_react28.useCallback)((id) => {
|
|
2229
2700
|
if (!controlledExpanded) {
|
|
2230
2701
|
setInternalExpanded((prev) => {
|
|
2231
2702
|
const next = new Set(prev);
|
|
@@ -2236,11 +2707,11 @@ function Tree({
|
|
|
2236
2707
|
}
|
|
2237
2708
|
onToggle?.(id);
|
|
2238
2709
|
}, [controlledExpanded, onToggle]);
|
|
2239
|
-
const flat = (0,
|
|
2710
|
+
const flat = (0, import_react28.useMemo)(() => flattenTree(nodes, expanded), [nodes, expanded]);
|
|
2240
2711
|
const useVirtual = virtualize ?? shouldVirtualize(flat.length);
|
|
2241
2712
|
const tabbableId = focusedId ?? selected ?? nodes[0]?.id;
|
|
2242
2713
|
if (useVirtual) {
|
|
2243
|
-
return /* @__PURE__ */ (0,
|
|
2714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2244
2715
|
VirtualTreeView,
|
|
2245
2716
|
{
|
|
2246
2717
|
flat,
|
|
@@ -2310,7 +2781,7 @@ function Tree({
|
|
|
2310
2781
|
break;
|
|
2311
2782
|
}
|
|
2312
2783
|
};
|
|
2313
|
-
return /* @__PURE__ */ (0,
|
|
2784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { ref: rootRef, className: cx("uix-tree", className), role: "tree", onKeyDown, ...props, children: nodes.map((node) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2314
2785
|
TreeNode,
|
|
2315
2786
|
{
|
|
2316
2787
|
node,
|
|
@@ -2340,12 +2811,12 @@ function VirtualTreeView({
|
|
|
2340
2811
|
className,
|
|
2341
2812
|
...props
|
|
2342
2813
|
}) {
|
|
2343
|
-
const scrollRef = (0,
|
|
2344
|
-
const [scrollTop, setScrollTop] = (0,
|
|
2345
|
-
const pendingFocus = (0,
|
|
2814
|
+
const scrollRef = (0, import_react28.useRef)(null);
|
|
2815
|
+
const [scrollTop, setScrollTop] = (0, import_react28.useState)(0);
|
|
2816
|
+
const pendingFocus = (0, import_react28.useRef)(false);
|
|
2346
2817
|
const win = virtualWindow(scrollTop, maxHeight, rowHeight, flat.length);
|
|
2347
2818
|
const rows = flat.slice(win.start, win.end);
|
|
2348
|
-
(0,
|
|
2819
|
+
(0, import_react28.useEffect)(() => {
|
|
2349
2820
|
if (!pendingFocus.current || focusedId == null) return;
|
|
2350
2821
|
const el = scrollRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(focusedId)}"]`);
|
|
2351
2822
|
if (el) {
|
|
@@ -2382,7 +2853,7 @@ function VirtualTreeView({
|
|
|
2382
2853
|
}
|
|
2383
2854
|
if (act.focusId !== void 0) moveTo(act.focusId);
|
|
2384
2855
|
};
|
|
2385
|
-
return /* @__PURE__ */ (0,
|
|
2856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
2386
2857
|
"ul",
|
|
2387
2858
|
{
|
|
2388
2859
|
ref: scrollRef,
|
|
@@ -2393,10 +2864,10 @@ function VirtualTreeView({
|
|
|
2393
2864
|
onKeyDown,
|
|
2394
2865
|
...props,
|
|
2395
2866
|
children: [
|
|
2396
|
-
win.padTop > 0 && /* @__PURE__ */ (0,
|
|
2867
|
+
win.padTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { "aria-hidden": "true", style: { height: win.padTop } }),
|
|
2397
2868
|
rows.map((f) => {
|
|
2398
2869
|
const rowStyle = { height: rowHeight, paddingLeft: `calc(${f.level - 1} * var(--uix-space-5))` };
|
|
2399
|
-
return /* @__PURE__ */ (0,
|
|
2870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2400
2871
|
"li",
|
|
2401
2872
|
{
|
|
2402
2873
|
role: "treeitem",
|
|
@@ -2417,23 +2888,23 @@ function VirtualTreeView({
|
|
|
2417
2888
|
onSelect?.(f.node.id);
|
|
2418
2889
|
setFocusedId(f.node.id);
|
|
2419
2890
|
},
|
|
2420
|
-
children: /* @__PURE__ */ (0,
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2422
|
-
f.node.icon && /* @__PURE__ */ (0,
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "uix-tree__row", style: rowStyle, children: [
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uix-tree__toggle", children: f.hasChildren && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ChevronIcon2, {}) }),
|
|
2893
|
+
f.node.icon && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", children: f.node.icon }),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uix-tree__label", children: f.node.label })
|
|
2424
2895
|
] })
|
|
2425
2896
|
},
|
|
2426
2897
|
f.node.id
|
|
2427
2898
|
);
|
|
2428
2899
|
}),
|
|
2429
|
-
win.padBottom > 0 && /* @__PURE__ */ (0,
|
|
2900
|
+
win.padBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { "aria-hidden": "true", style: { height: win.padBottom } })
|
|
2430
2901
|
]
|
|
2431
2902
|
}
|
|
2432
2903
|
);
|
|
2433
2904
|
}
|
|
2434
2905
|
|
|
2435
2906
|
// src/components/EditorialHome.tsx
|
|
2436
|
-
var
|
|
2907
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2437
2908
|
function PageIntro({
|
|
2438
2909
|
kicker,
|
|
2439
2910
|
title,
|
|
@@ -2446,39 +2917,39 @@ function PageIntro({
|
|
|
2446
2917
|
children,
|
|
2447
2918
|
...props
|
|
2448
2919
|
}) {
|
|
2449
|
-
return /* @__PURE__ */ (0,
|
|
2450
|
-
/* @__PURE__ */ (0,
|
|
2451
|
-
kicker != null && /* @__PURE__ */ (0,
|
|
2452
|
-
/* @__PURE__ */ (0,
|
|
2453
|
-
lede != null && /* @__PURE__ */ (0,
|
|
2920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("section", { className: cx("uix-page-intro", className), ...props, children: [
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
2922
|
+
kicker != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-page-kicker", children: kicker }),
|
|
2923
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h1", { className: "uix-page-title", children: title }),
|
|
2924
|
+
lede != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-page-lede", children: lede })
|
|
2454
2925
|
] }),
|
|
2455
|
-
search != null && /* @__PURE__ */ (0,
|
|
2456
|
-
searchLabel != null && /* @__PURE__ */ (0,
|
|
2926
|
+
search != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
2927
|
+
searchLabel != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-intro-search__label", children: searchLabel }),
|
|
2457
2928
|
search
|
|
2458
2929
|
] }),
|
|
2459
|
-
shortcuts != null && /* @__PURE__ */ (0,
|
|
2930
|
+
shortcuts != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uix-shortcut-grid", "aria-label": shortcutsLabel, children: shortcuts }),
|
|
2460
2931
|
children
|
|
2461
2932
|
] });
|
|
2462
2933
|
}
|
|
2463
2934
|
function SectionHead({ title, titleId, action, className, ...props }) {
|
|
2464
|
-
return /* @__PURE__ */ (0,
|
|
2465
|
-
/* @__PURE__ */ (0,
|
|
2935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cx("uix-section-head", className), ...props, children: [
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "uix-section-title", id: titleId, children: title }),
|
|
2466
2937
|
action
|
|
2467
2938
|
] });
|
|
2468
2939
|
}
|
|
2469
2940
|
function NoticeQueue({ icon, title, summary, meta, position, actions, className, ...props }) {
|
|
2470
|
-
return /* @__PURE__ */ (0,
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("section", { className: cx("uix-notice", className), ...props, children: [
|
|
2471
2942
|
icon,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2473
|
-
/* @__PURE__ */ (0,
|
|
2474
|
-
title != null && /* @__PURE__ */ (0,
|
|
2943
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-notice__content", "aria-live": "polite", children: [
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("p", { className: "uix-notice__copy", children: [
|
|
2945
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("strong", { children: title }),
|
|
2475
2946
|
title != null && summary != null && " ",
|
|
2476
2947
|
summary
|
|
2477
2948
|
] }),
|
|
2478
|
-
meta != null && /* @__PURE__ */ (0,
|
|
2949
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-notice__meta", children: meta })
|
|
2479
2950
|
] }),
|
|
2480
|
-
(position != null || actions != null) && /* @__PURE__ */ (0,
|
|
2481
|
-
position != null && /* @__PURE__ */ (0,
|
|
2951
|
+
(position != null || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-notice__actions", children: [
|
|
2952
|
+
position != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-notice__position", children: position }),
|
|
2482
2953
|
actions
|
|
2483
2954
|
] })
|
|
2484
2955
|
] });
|
|
@@ -2496,8 +2967,8 @@ function FeaturedStage({
|
|
|
2496
2967
|
className,
|
|
2497
2968
|
...props
|
|
2498
2969
|
}) {
|
|
2499
|
-
return /* @__PURE__ */ (0,
|
|
2500
|
-
/* @__PURE__ */ (0,
|
|
2970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("article", { className: cx("uix-featured__stage", className), ...props, children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2501
2972
|
"div",
|
|
2502
2973
|
{
|
|
2503
2974
|
className: "uix-featured__visual",
|
|
@@ -2507,32 +2978,32 @@ function FeaturedStage({
|
|
|
2507
2978
|
children: visual
|
|
2508
2979
|
}
|
|
2509
2980
|
),
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2511
|
-
(eyebrow != null || ordinal != null) && /* @__PURE__ */ (0,
|
|
2512
|
-
ordinal != null && /* @__PURE__ */ (0,
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-featured__content", "aria-live": "polite", children: [
|
|
2982
|
+
(eyebrow != null || ordinal != null) && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("p", { className: "uix-featured__eyebrow", children: [
|
|
2983
|
+
ordinal != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-featured__now", children: ordinal }),
|
|
2513
2984
|
eyebrow
|
|
2514
2985
|
] }),
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
2516
|
-
description != null && /* @__PURE__ */ (0,
|
|
2517
|
-
meta != null && /* @__PURE__ */ (0,
|
|
2986
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "uix-featured__title", id: titleId, children: title }),
|
|
2987
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-featured__description", children: description }),
|
|
2988
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-featured__meta", children: meta }),
|
|
2518
2989
|
action
|
|
2519
2990
|
] })
|
|
2520
2991
|
] });
|
|
2521
2992
|
}
|
|
2522
2993
|
function FeaturedRundown({ eyebrow, title, titleId, meta, children, className, ...props }) {
|
|
2523
|
-
return /* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2525
|
-
/* @__PURE__ */ (0,
|
|
2526
|
-
eyebrow != null && /* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("aside", { className: cx("uix-rundown", className), ...props, children: [
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-rundown__head", children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
2997
|
+
eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-rundown__eyebrow", children: eyebrow }),
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "uix-rundown__title", id: titleId, children: title })
|
|
2528
2999
|
] }),
|
|
2529
3000
|
meta
|
|
2530
3001
|
] }),
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
3002
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uix-rundown__items", children })
|
|
2532
3003
|
] });
|
|
2533
3004
|
}
|
|
2534
3005
|
function FeaturedRundownItem({ number, topic, title, selected = false, className, ...props }) {
|
|
2535
|
-
return /* @__PURE__ */ (0,
|
|
3006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
2536
3007
|
"button",
|
|
2537
3008
|
{
|
|
2538
3009
|
type: "button",
|
|
@@ -2541,63 +3012,63 @@ function FeaturedRundownItem({ number, topic, title, selected = false, className
|
|
|
2541
3012
|
"data-selected": selected ? "true" : "false",
|
|
2542
3013
|
...props,
|
|
2543
3014
|
children: [
|
|
2544
|
-
number != null && /* @__PURE__ */ (0,
|
|
2545
|
-
/* @__PURE__ */ (0,
|
|
2546
|
-
topic != null && /* @__PURE__ */ (0,
|
|
2547
|
-
/* @__PURE__ */ (0,
|
|
3015
|
+
number != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-rundown__number", children: number }),
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { children: [
|
|
3017
|
+
topic != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-rundown__topic", children: topic }),
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-rundown__item-title", children: title })
|
|
2548
3019
|
] })
|
|
2549
3020
|
]
|
|
2550
3021
|
}
|
|
2551
3022
|
);
|
|
2552
3023
|
}
|
|
2553
3024
|
function NewsLead({ meta, title, summary, className, ...props }) {
|
|
2554
|
-
return /* @__PURE__ */ (0,
|
|
2555
|
-
meta != null && /* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
summary != null && /* @__PURE__ */ (0,
|
|
3025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("article", { className: cx("uix-news-lead", className), ...props, children: [
|
|
3026
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-news-lead__meta", children: meta }),
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h3", { className: "uix-news-lead__title", children: title }),
|
|
3028
|
+
summary != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-news-lead__summary", children: summary })
|
|
2558
3029
|
] });
|
|
2559
3030
|
}
|
|
2560
3031
|
function ContentList({ children, className, ...props }) {
|
|
2561
|
-
return /* @__PURE__ */ (0,
|
|
3032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: cx("uix-content-list", className), ...props, children });
|
|
2562
3033
|
}
|
|
2563
3034
|
function ContentListItem({ title, meta, trailing, className, ...props }) {
|
|
2564
|
-
return /* @__PURE__ */ (0,
|
|
2565
|
-
/* @__PURE__ */ (0,
|
|
2566
|
-
/* @__PURE__ */ (0,
|
|
2567
|
-
meta != null && /* @__PURE__ */ (0,
|
|
3035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: cx("uix-content-list__item", className), ...props, children: [
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-content-list__title", children: title }),
|
|
3038
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-content-list__meta", children: meta })
|
|
2568
3039
|
] }),
|
|
2569
3040
|
trailing
|
|
2570
3041
|
] });
|
|
2571
3042
|
}
|
|
2572
3043
|
function ResourceGrid({ children, className, ...props }) {
|
|
2573
|
-
return /* @__PURE__ */ (0,
|
|
3044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: cx("uix-resource-grid", className), ...props, children });
|
|
2574
3045
|
}
|
|
2575
3046
|
function StatLine({ items, children, className, ...props }) {
|
|
2576
|
-
return /* @__PURE__ */ (0,
|
|
2577
|
-
items?.map((item, i) => /* @__PURE__ */ (0,
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2579
|
-
/* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cx("uix-stat-line", className), ...props, children: [
|
|
3048
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-stat-line__item", children: [
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-stat-line__value", children: item.value }),
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-stat-line__label", children: item.label })
|
|
2580
3051
|
] }, item.id ?? i)),
|
|
2581
3052
|
children
|
|
2582
3053
|
] });
|
|
2583
3054
|
}
|
|
2584
3055
|
function EventRow({ month, day, title, meta, className, ...props }) {
|
|
2585
|
-
return /* @__PURE__ */ (0,
|
|
2586
|
-
/* @__PURE__ */ (0,
|
|
2587
|
-
/* @__PURE__ */ (0,
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
3056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cx("uix-event-row", className), ...props, children: [
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uix-event-date", children: [
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-event-date__month", children: month }),
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-event-date__day", children: day })
|
|
2589
3060
|
] }),
|
|
2590
|
-
/* @__PURE__ */ (0,
|
|
2591
|
-
/* @__PURE__ */ (0,
|
|
2592
|
-
meta != null && /* @__PURE__ */ (0,
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-event-row__title", children: title }),
|
|
3063
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "uix-event-row__meta", children: meta })
|
|
2593
3064
|
] })
|
|
2594
3065
|
] });
|
|
2595
3066
|
}
|
|
2596
3067
|
function StatusRow({ indicator, name, meta, className, ...props }) {
|
|
2597
|
-
return /* @__PURE__ */ (0,
|
|
3068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cx("uix-status-row", className), ...props, children: [
|
|
2598
3069
|
indicator,
|
|
2599
|
-
/* @__PURE__ */ (0,
|
|
2600
|
-
meta != null && /* @__PURE__ */ (0,
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-status-row__name", children: name }),
|
|
3071
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "uix-list-meta", children: meta })
|
|
2601
3072
|
] });
|
|
2602
3073
|
}
|
|
2603
3074
|
|
|
@@ -2694,7 +3165,7 @@ function summarizeRule(value, labels = {}) {
|
|
|
2694
3165
|
}
|
|
2695
3166
|
|
|
2696
3167
|
// src/components/RuleBuilder.tsx
|
|
2697
|
-
var
|
|
3168
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2698
3169
|
var ruleId = 0;
|
|
2699
3170
|
var nextId = (prefix) => `${prefix}-${Date.now().toString(36)}-${(++ruleId).toString(36)}`;
|
|
2700
3171
|
function defaultCondition(fields, operators) {
|
|
@@ -2710,21 +3181,21 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
|
|
|
2710
3181
|
combinator: "and",
|
|
2711
3182
|
conditions: [defaultCondition(fields, operators)]
|
|
2712
3183
|
}, maxDepth));
|
|
2713
|
-
return /* @__PURE__ */ (0,
|
|
2714
|
-
/* @__PURE__ */ (0,
|
|
2715
|
-
/* @__PURE__ */ (0,
|
|
2716
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("fieldset", { className: "uix-rule-builder__group", "data-depth": depth, children: [
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("legend", { className: "uix-rule-builder__group-heading", children: [
|
|
3186
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: depth === 1 ? "When" : "Group" }),
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("label", { children: [
|
|
2717
3188
|
"Match",
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2719
|
-
/* @__PURE__ */ (0,
|
|
2720
|
-
/* @__PURE__ */ (0,
|
|
3189
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("select", { className: "uix-select uix-select--sm", value: group.combinator, disabled, onChange: (event) => updateNode(group.id, (node) => ({ ...node, combinator: event.currentTarget.value })), children: [
|
|
3190
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: "and", children: "all (AND)" }),
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: "or", children: "any (OR)" })
|
|
2721
3192
|
] })
|
|
2722
3193
|
] })
|
|
2723
3194
|
] }),
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
2727
|
-
] }, node.id) : /* @__PURE__ */ (0,
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uix-rule-builder__rows", children: group.conditions.map((node, index) => isRuleGroup(node) ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uix-rule-builder__nested", children: [
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, disabled, onRootChange, labels } }),
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RowControls, { label: "group", first: index === 0, last: index === group.conditions.length - 1, disabled, onUp: () => onRootChange(moveRuleNode(root, node.id, -1)), onDown: () => onRootChange(moveRuleNode(root, node.id, 1)), onRemove: () => onRootChange(removeRuleNode(root, node.id)) })
|
|
3198
|
+
] }, node.id) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2728
3199
|
ConditionRow,
|
|
2729
3200
|
{
|
|
2730
3201
|
condition: node,
|
|
@@ -2732,13 +3203,13 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
|
|
|
2732
3203
|
operators,
|
|
2733
3204
|
disabled,
|
|
2734
3205
|
onChange: (condition) => updateNode(node.id, () => condition),
|
|
2735
|
-
controls: /* @__PURE__ */ (0,
|
|
3206
|
+
controls: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RowControls, { label: "condition", first: index === 0, last: index === group.conditions.length - 1, disabled, onUp: () => onRootChange(moveRuleNode(root, node.id, -1)), onDown: () => onRootChange(moveRuleNode(root, node.id, 1)), onRemove: () => onRootChange(removeRuleNode(root, node.id)) })
|
|
2736
3207
|
},
|
|
2737
3208
|
node.id
|
|
2738
3209
|
)) }),
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uix-rule-builder__add", children: [
|
|
3211
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: addCondition, disabled: disabled || fields.length === 0 || operators.length === 0, children: labels.addCondition }),
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: addGroup, disabled: disabled || depth >= maxDepth, children: labels.addGroup })
|
|
2742
3213
|
] })
|
|
2743
3214
|
] });
|
|
2744
3215
|
}
|
|
@@ -2751,24 +3222,24 @@ function ConditionRow({ condition, fields, operators, disabled, onChange, contro
|
|
|
2751
3222
|
const nextOperator = operators.find((item) => nextField?.operators?.includes(item.id)) ?? availableOperators[0] ?? operators[0];
|
|
2752
3223
|
onChange({ ...condition, field: id, operator: nextOperator?.id ?? "" });
|
|
2753
3224
|
};
|
|
2754
|
-
return /* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2756
|
-
/* @__PURE__ */ (0,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
3225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uix-rule-builder__condition", children: [
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("label", { children: [
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "uix-visually-hidden", children: "Field" }),
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("select", { className: "uix-select", value: condition.field, onChange: (event) => setField(event.currentTarget.value), disabled, children: fields.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: item.id, children: item.label }, item.id)) })
|
|
2758
3229
|
] }),
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("label", { children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "uix-visually-hidden", children: "Operator" }),
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("select", { className: "uix-select", value: condition.operator, onChange: (event) => onChange({ ...condition, operator: event.currentTarget.value }), disabled, children: availableOperators.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: item.id, children: item.label }, item.id)) })
|
|
2762
3233
|
] }),
|
|
2763
|
-
operator?.requiresValue !== false && /* @__PURE__ */ (0,
|
|
3234
|
+
operator?.requiresValue !== false && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uix-rule-builder__value", children: field?.renderValueEditor?.({ condition, onChange: (value) => onChange({ ...condition, value }), disabled }) ?? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("input", { className: "uix-input", value: typeof condition.value === "string" || typeof condition.value === "number" ? condition.value : condition.value == null ? "" : JSON.stringify(condition.value), onChange: (event) => onChange({ ...condition, value: event.currentTarget.value }), disabled, "aria-label": `Value for ${field?.label ?? "condition"}` }) }),
|
|
2764
3235
|
controls
|
|
2765
3236
|
] });
|
|
2766
3237
|
}
|
|
2767
3238
|
function RowControls({ label, first, last, disabled, onUp, onDown, onRemove }) {
|
|
2768
|
-
return /* @__PURE__ */ (0,
|
|
2769
|
-
/* @__PURE__ */ (0,
|
|
2770
|
-
/* @__PURE__ */ (0,
|
|
2771
|
-
/* @__PURE__ */ (0,
|
|
3239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "uix-rule-builder__row-actions", children: [
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onUp, disabled: disabled || first, "aria-label": `Move ${label} up`, children: "Up" }),
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onDown, disabled: disabled || last, "aria-label": `Move ${label} down`, children: "Down" }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onRemove, disabled, "aria-label": `Remove ${label}`, children: "Remove" })
|
|
2772
3243
|
] });
|
|
2773
3244
|
}
|
|
2774
3245
|
function RuleBuilder({
|
|
@@ -2789,9 +3260,9 @@ function RuleBuilder({
|
|
|
2789
3260
|
const fieldLabels = Object.fromEntries(fields.map((field) => [field.id, field.label]));
|
|
2790
3261
|
const operatorLabels = Object.fromEntries(operators.map((operator) => [operator.id, operator.label]));
|
|
2791
3262
|
const actionLabels = Object.fromEntries(actions.map((action) => [action.id, action.label]));
|
|
2792
|
-
if (readOnly) return /* @__PURE__ */ (0,
|
|
2793
|
-
/* @__PURE__ */ (0,
|
|
2794
|
-
issues.length > 0 && /* @__PURE__ */ (0,
|
|
3263
|
+
if (readOnly) return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("section", { className: cx("uix-rule-builder uix-rule-builder--summary", className), "aria-label": "Rule summary", children: [
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { children: summarizeRule(value, { fields: fieldLabels, operators: operatorLabels, actions: actionLabels }) }),
|
|
3265
|
+
issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("p", { className: "uix-rule-builder__invalid", children: [
|
|
2795
3266
|
"Rule has ",
|
|
2796
3267
|
issues.length,
|
|
2797
3268
|
" validation issue",
|
|
@@ -2800,16 +3271,16 @@ function RuleBuilder({
|
|
|
2800
3271
|
] })
|
|
2801
3272
|
] });
|
|
2802
3273
|
const updateActions = (next) => onChange({ ...value, then: next });
|
|
2803
|
-
return /* @__PURE__ */ (0,
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2805
|
-
/* @__PURE__ */ (0,
|
|
2806
|
-
/* @__PURE__ */ (0,
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("section", { className: cx("uix-rule-builder", className), "aria-label": "Rule builder", children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RuleGroupEditor, { group: value.when, depth: 1, root: value.when, fields, operators, maxDepth, disabled: readOnly, onRootChange: (when) => onChange({ ...value, when }), labels: { addCondition: addConditionLabel, addGroup: addGroupLabel } }),
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("fieldset", { className: "uix-rule-builder__actions", children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("legend", { children: "Then" }),
|
|
2807
3278
|
value.then.map((action, index) => {
|
|
2808
3279
|
const definition = actions.find((item) => item.id === action.type);
|
|
2809
|
-
return /* @__PURE__ */ (0,
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
3280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uix-rule-builder__action", children: [
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("select", { className: "uix-select", value: action.type, onChange: (event) => updateActions(value.then.map((item) => item.id === action.id ? { ...item, type: event.currentTarget.value } : item)), "aria-label": "Action type", children: actions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: item.id, children: item.label }, item.id)) }),
|
|
2811
3282
|
definition?.renderParameters?.(action, (parameters) => updateActions(value.then.map((item) => item.id === action.id ? { ...item, parameters } : item)), false),
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2813
3284
|
RowControls,
|
|
2814
3285
|
{
|
|
2815
3286
|
label: "action",
|
|
@@ -2831,22 +3302,22 @@ function RuleBuilder({
|
|
|
2831
3302
|
)
|
|
2832
3303
|
] }, action.id);
|
|
2833
3304
|
}),
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
3305
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", disabled: actions.length === 0, onClick: () => updateActions([...value.then, { id: nextId("action"), type: actions[0]?.id ?? "", parameters: {} }]), children: addActionLabel })
|
|
2835
3306
|
] }),
|
|
2836
|
-
/* @__PURE__ */ (0,
|
|
2837
|
-
/* @__PURE__ */ (0,
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uix-rule-builder__validation", "aria-live": "polite", children: issues.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: "Rule is valid." }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("strong", { children: [
|
|
2838
3309
|
issues.length,
|
|
2839
3310
|
" validation issue",
|
|
2840
3311
|
issues.length === 1 ? "" : "s"
|
|
2841
3312
|
] }),
|
|
2842
|
-
/* @__PURE__ */ (0,
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { children: issues.map((issue, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { children: issue.message }, `${issue.path}-${index}`)) })
|
|
2843
3314
|
] }) })
|
|
2844
3315
|
] });
|
|
2845
3316
|
}
|
|
2846
3317
|
|
|
2847
3318
|
// src/components/BuilderCanvas.tsx
|
|
2848
|
-
var
|
|
2849
|
-
var
|
|
3319
|
+
var import_react29 = require("react");
|
|
3320
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2850
3321
|
function BuilderCanvas({
|
|
2851
3322
|
items,
|
|
2852
3323
|
onItemsChange,
|
|
@@ -2861,13 +3332,13 @@ function BuilderCanvas({
|
|
|
2861
3332
|
emptyMessage = "Add an item from the palette to begin.",
|
|
2862
3333
|
className
|
|
2863
3334
|
}) {
|
|
2864
|
-
const [internalSelectedId, setInternalSelectedId] = (0,
|
|
2865
|
-
const [draggedId, setDraggedId] = (0,
|
|
2866
|
-
const propertyHeadingRef = (0,
|
|
2867
|
-
const shouldFocusProperties = (0,
|
|
3335
|
+
const [internalSelectedId, setInternalSelectedId] = (0, import_react29.useState)();
|
|
3336
|
+
const [draggedId, setDraggedId] = (0, import_react29.useState)();
|
|
3337
|
+
const propertyHeadingRef = (0, import_react29.useRef)(null);
|
|
3338
|
+
const shouldFocusProperties = (0, import_react29.useRef)(false);
|
|
2868
3339
|
const selectedId = controlledSelectedId ?? internalSelectedId;
|
|
2869
3340
|
const selected = items.find((item) => item.id === selectedId);
|
|
2870
|
-
(0,
|
|
3341
|
+
(0, import_react29.useEffect)(() => {
|
|
2871
3342
|
if (shouldFocusProperties.current && selected) {
|
|
2872
3343
|
propertyHeadingRef.current?.focus();
|
|
2873
3344
|
shouldFocusProperties.current = false;
|
|
@@ -2901,27 +3372,27 @@ function BuilderCanvas({
|
|
|
2901
3372
|
if (from >= 0 && to >= 0) onItemsChange(reorder(items, from, to));
|
|
2902
3373
|
setDraggedId(void 0);
|
|
2903
3374
|
};
|
|
2904
|
-
return /* @__PURE__ */ (0,
|
|
2905
|
-
/* @__PURE__ */ (0,
|
|
2906
|
-
/* @__PURE__ */ (0,
|
|
2907
|
-
palette.length === 0 ? /* @__PURE__ */ (0,
|
|
2908
|
-
/* @__PURE__ */ (0,
|
|
2909
|
-
item.description && /* @__PURE__ */ (0,
|
|
2910
|
-
/* @__PURE__ */ (0,
|
|
3375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("section", { className: cx("uix-builder-canvas", className), "aria-label": "Builder canvas", children: [
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("aside", { className: "uix-builder-canvas__palette", "aria-label": "Item palette", children: [
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h3", { children: "Palette" }),
|
|
3378
|
+
palette.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { children: "No item types available." }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { children: palette.map((item) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { type: "button", onClick: () => add(item), children: [
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("strong", { children: item.label }),
|
|
3380
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { children: item.description }),
|
|
3381
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-hidden": "true", children: "Add" })
|
|
2911
3382
|
] }) }, item.id)) })
|
|
2912
3383
|
] }),
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
2915
|
-
loading ? /* @__PURE__ */ (0,
|
|
2916
|
-
/* @__PURE__ */ (0,
|
|
2917
|
-
onRetry && /* @__PURE__ */ (0,
|
|
2918
|
-
] }) : items.length === 0 ? /* @__PURE__ */ (0,
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2920
|
-
palette[0] && /* @__PURE__ */ (0,
|
|
3384
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "uix-builder-canvas__workspace", children: [
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h3", { children: "Canvas" }),
|
|
3386
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "uix-builder-canvas__state", role: "status", children: "Loading canvas\u2026" }) : error ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "uix-builder-canvas__state", role: "alert", children: [
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { children: error }),
|
|
3388
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: "Try again" })
|
|
3389
|
+
] }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "uix-builder-canvas__state", children: [
|
|
3390
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { children: emptyMessage }),
|
|
3391
|
+
palette[0] && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { type: "button", className: "uix-btn uix-btn--primary", onClick: () => add(palette[0]), children: [
|
|
2921
3392
|
"Add ",
|
|
2922
3393
|
palette[0].label
|
|
2923
3394
|
] })
|
|
2924
|
-
] }) : /* @__PURE__ */ (0,
|
|
3395
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ol", { className: "uix-builder-canvas__items", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
2925
3396
|
"li",
|
|
2926
3397
|
{
|
|
2927
3398
|
draggable: true,
|
|
@@ -2931,34 +3402,34 @@ function BuilderCanvas({
|
|
|
2931
3402
|
onDrop: (event) => drop(event, item.id),
|
|
2932
3403
|
className: cx("uix-builder-canvas__item", selectedId === item.id && "uix-builder-canvas__item--selected"),
|
|
2933
3404
|
children: [
|
|
2934
|
-
/* @__PURE__ */ (0,
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2936
|
-
item.description && /* @__PURE__ */ (0,
|
|
3405
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: "uix-builder-canvas__item-main", "aria-pressed": selectedId === item.id, onClick: () => select(item.id), children: renderItem?.(item, selectedId === item.id) ?? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
3406
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("strong", { children: item.label }),
|
|
3407
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { children: item.description })
|
|
2937
3408
|
] }) }),
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
/* @__PURE__ */ (0,
|
|
2940
|
-
/* @__PURE__ */ (0,
|
|
2941
|
-
/* @__PURE__ */ (0,
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "uix-builder-canvas__item-actions", children: [
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", onClick: () => move(item.id, -1), disabled: index === 0, "aria-label": `Move ${item.label} up`, children: "Up" }),
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", onClick: () => move(item.id, 1), disabled: index === items.length - 1, "aria-label": `Move ${item.label} down`, children: "Down" }),
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", onClick: () => remove(item.id), "aria-label": `Remove ${item.label}`, children: "Remove" })
|
|
2942
3413
|
] })
|
|
2943
3414
|
]
|
|
2944
3415
|
},
|
|
2945
3416
|
item.id
|
|
2946
3417
|
)) })
|
|
2947
3418
|
] }),
|
|
2948
|
-
/* @__PURE__ */ (0,
|
|
2949
|
-
/* @__PURE__ */ (0,
|
|
2950
|
-
!selected ? /* @__PURE__ */ (0,
|
|
2951
|
-
/* @__PURE__ */ (0,
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2953
|
-
/* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("aside", { className: "uix-builder-canvas__properties", "aria-label": "Item properties", children: [
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h3", { ref: propertyHeadingRef, tabIndex: -1, children: "Properties" }),
|
|
3421
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { children: "Select a canvas item to edit its properties." }) : renderProperties?.(selected, (updated) => onItemsChange(items.map((item) => item.id === updated.id ? updated : item))) ?? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("dl", { children: [
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("dt", { children: "Type" }),
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("dd", { children: selected.type }),
|
|
3424
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("dt", { children: "Label" }),
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("dd", { children: selected.label })
|
|
2955
3426
|
] })
|
|
2956
3427
|
] })
|
|
2957
3428
|
] });
|
|
2958
3429
|
}
|
|
2959
3430
|
|
|
2960
3431
|
// src/components/SchedulingCalendar.tsx
|
|
2961
|
-
var
|
|
3432
|
+
var import_react30 = require("react");
|
|
2962
3433
|
|
|
2963
3434
|
// src/calendar-model.ts
|
|
2964
3435
|
function fromDateKey(value) {
|
|
@@ -3039,7 +3510,7 @@ function isDateUnavailable(date, options) {
|
|
|
3039
3510
|
}
|
|
3040
3511
|
|
|
3041
3512
|
// src/components/SchedulingCalendar.tsx
|
|
3042
|
-
var
|
|
3513
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3043
3514
|
var stateLabel = { scheduled: "Scheduled", conflicted: "Conflicted", "in-progress": "In progress", "blackout-violation": "Blackout violation" };
|
|
3044
3515
|
var stateTone = (state) => state === "scheduled" ? "info" : state === "in-progress" ? "success" : "danger";
|
|
3045
3516
|
var dateLabel = (date, locale) => new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`${date}T00:00:00Z`));
|
|
@@ -3061,19 +3532,19 @@ function SchedulingCalendar({
|
|
|
3061
3532
|
onRetry,
|
|
3062
3533
|
className
|
|
3063
3534
|
}) {
|
|
3064
|
-
const [internalView, setInternalView] = (0,
|
|
3535
|
+
const [internalView, setInternalView] = (0, import_react30.useState)("month");
|
|
3065
3536
|
const view = controlledView ?? internalView;
|
|
3066
|
-
const [activeDate, setActiveDate] = (0,
|
|
3067
|
-
const gridRef = (0,
|
|
3068
|
-
const visibleEntries = (0,
|
|
3069
|
-
const entrySpans = (0,
|
|
3070
|
-
const overlaySpans = (0,
|
|
3071
|
-
const monthDays = (0,
|
|
3537
|
+
const [activeDate, setActiveDate] = (0, import_react30.useState)(anchorDate);
|
|
3538
|
+
const gridRef = (0, import_react30.useRef)(null);
|
|
3539
|
+
const visibleEntries = (0, import_react30.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
3540
|
+
const entrySpans = (0, import_react30.useMemo)(() => new Map(visibleEntries.map((entry) => [entry.id, zonedDateSpan(entry.start, entry.end, timeZone)])), [visibleEntries, timeZone]);
|
|
3541
|
+
const overlaySpans = (0, import_react30.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, { start: overlay.start.slice(0, 10), end: overlay.end.slice(0, 10) }])), [overlays]);
|
|
3542
|
+
const monthDays = (0, import_react30.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate)), [anchorDate]);
|
|
3072
3543
|
const weekday = ((/* @__PURE__ */ new Date(`${anchorDate}T00:00:00Z`)).getUTCDay() + 6) % 7;
|
|
3073
3544
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
3074
|
-
const weekDays = (0,
|
|
3075
|
-
const days = (0,
|
|
3076
|
-
(0,
|
|
3545
|
+
const weekDays = (0, import_react30.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
3546
|
+
const days = (0, import_react30.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : weekDays, [view, monthDays, weekDays]);
|
|
3547
|
+
(0, import_react30.useEffect)(() => {
|
|
3077
3548
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
3078
3549
|
}, [activeDate, days, view]);
|
|
3079
3550
|
const setView = (next) => {
|
|
@@ -3107,58 +3578,58 @@ function SchedulingCalendar({
|
|
|
3107
3578
|
return date >= span.start && date <= span.end;
|
|
3108
3579
|
});
|
|
3109
3580
|
const formatInstant = (instant) => new Intl.DateTimeFormat(locale, { timeZone, dateStyle: "medium", timeStyle: "short" }).format(new Date(instant));
|
|
3110
|
-
return /* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3112
|
-
/* @__PURE__ */ (0,
|
|
3113
|
-
/* @__PURE__ */ (0,
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("section", { className: cx("uix-scheduling-calendar", className), "aria-label": `Scheduling calendar in ${timeZone}`, children: [
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "uix-scheduling-calendar__header", children: [
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { children: [
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => movePeriod(-1), disabled: !onAnchorDateChange, children: "Previous" }),
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => movePeriod(1), disabled: !onAnchorDateChange, children: "Next" })
|
|
3115
3586
|
] }),
|
|
3116
|
-
/* @__PURE__ */ (0,
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: view === "month" ? new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`${anchorDate}T00:00:00Z`)) : `${dateLabel(weekStart, locale)} \u2013 ${dateLabel(weekDays[weekDays.length - 1], locale)}` }),
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "uix-segmented", role: "group", "aria-label": "Calendar view", children: ["month", "week", "agenda"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("button", { type: "button", className: "uix-segmented__option", "aria-pressed": view === option, "data-selected": view === option || void 0, onClick: () => setView(option), children: [
|
|
3118
3589
|
option[0].toUpperCase(),
|
|
3119
3590
|
option.slice(1)
|
|
3120
3591
|
] }, option)) })
|
|
3121
3592
|
] }),
|
|
3122
|
-
loading ? /* @__PURE__ */ (0,
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3124
|
-
onRetry && /* @__PURE__ */ (0,
|
|
3125
|
-
] }) : view === "agenda" ? /* @__PURE__ */ (0,
|
|
3593
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "uix-scheduling-calendar__state", role: "status", children: "Loading schedule\u2026" }) : error ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "uix-scheduling-calendar__state", role: "alert", children: [
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { children: error }),
|
|
3595
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: "Try again" })
|
|
3596
|
+
] }) : view === "agenda" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "uix-scheduling-calendar__agenda", role: "region", "aria-label": "Schedule agenda", children: visibleEntries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { children: "No scheduled entries match the current filters." }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ol", { children: [...visibleEntries].sort((a, b) => a.start.localeCompare(b.start)).map((entry) => {
|
|
3126
3597
|
const state = entry.state ?? "scheduled";
|
|
3127
|
-
return /* @__PURE__ */ (0,
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3129
|
-
/* @__PURE__ */ (0,
|
|
3130
|
-
/* @__PURE__ */ (0,
|
|
3598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("button", { type: "button", onClick: () => onSelectEntry?.(entry), children: [
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { children: [
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: renderEntry?.(entry) ?? entry.title }),
|
|
3601
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { children: [
|
|
3131
3602
|
formatInstant(entry.start),
|
|
3132
3603
|
" \u2013 ",
|
|
3133
3604
|
formatInstant(entry.end)
|
|
3134
3605
|
] }),
|
|
3135
|
-
entry.meta && /* @__PURE__ */ (0,
|
|
3606
|
+
entry.meta && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { children: entry.meta })
|
|
3136
3607
|
] }),
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(StatusPill, { tone: stateTone(state), children: stateLabel[state] })
|
|
3138
3609
|
] }) }, entry.id);
|
|
3139
|
-
}) }) }) : /* @__PURE__ */ (0,
|
|
3610
|
+
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { ref: gridRef, className: cx("uix-scheduling-calendar__grid", view === "week" && "uix-scheduling-calendar__grid--week"), role: "group", "aria-label": `${view} schedule`, children: days.map((date, index) => {
|
|
3140
3611
|
const dayEntries = entriesFor(date);
|
|
3141
3612
|
const dayOverlays = overlaysFor(date);
|
|
3142
|
-
return /* @__PURE__ */ (0,
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3144
|
-
dayOverlays.map((overlay) => /* @__PURE__ */ (0,
|
|
3145
|
-
/* @__PURE__ */ (0,
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "uix-scheduling-calendar__day", "data-outside": view === "month" && !monthDays[index].inMonth || void 0, children: [
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: "uix-scheduling-calendar__date", "data-calendar-date": date, tabIndex: activeDate === date ? 0 : -1, onFocus: () => setActiveDate(date), onKeyDown: (event) => onDayKeyDown(event, date), "aria-label": dateLabel(date, locale), children: Number(date.slice(-2)) }),
|
|
3615
|
+
dayOverlays.map((overlay) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "uix-scheduling-calendar__overlay", "data-kind": overlay.kind, children: overlay.label }, overlay.id)),
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "uix-scheduling-calendar__entries", children: dayEntries.map((entry) => {
|
|
3146
3617
|
const span = entrySpans.get(entry.id);
|
|
3147
3618
|
const state = entry.state ?? "scheduled";
|
|
3148
|
-
return /* @__PURE__ */ (0,
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("button", { type: "button", className: "uix-scheduling-calendar__entry", "data-state": state, "data-range-start": date === span.start || void 0, "data-range-end": date === span.end || void 0, onClick: () => onSelectEntry?.(entry), "aria-label": `${entry.title}, ${stateLabel[state]}, ${formatInstant(entry.start)} to ${formatInstant(entry.end)}`, children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { children: renderEntry?.(entry) ?? entry.title }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "uix-visually-hidden", children: stateLabel[state] })
|
|
3151
3622
|
] }, entry.id);
|
|
3152
3623
|
}) })
|
|
3153
3624
|
] }, date);
|
|
3154
3625
|
}) }),
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
3626
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "uix-scheduling-calendar__legend", "aria-label": "Schedule state legend", children: ["scheduled", "conflicted", "in-progress", "blackout-violation"].map((state) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "data-state": state, children: stateLabel[state] }, state)) })
|
|
3156
3627
|
] });
|
|
3157
3628
|
}
|
|
3158
3629
|
|
|
3159
3630
|
// src/components/DateRangePicker.tsx
|
|
3160
|
-
var
|
|
3161
|
-
var
|
|
3631
|
+
var import_react31 = require("react");
|
|
3632
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3162
3633
|
var monthLabel = (date, locale) => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`${date}T00:00:00Z`));
|
|
3163
3634
|
var dateLabel2 = (date, locale) => new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`${date}T00:00:00Z`));
|
|
3164
3635
|
function DateRangePicker({
|
|
@@ -3177,25 +3648,25 @@ function DateRangePicker({
|
|
|
3177
3648
|
disabled,
|
|
3178
3649
|
className
|
|
3179
3650
|
}) {
|
|
3180
|
-
const id = (0,
|
|
3181
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
3651
|
+
const id = (0, import_react31.useId)();
|
|
3652
|
+
const [internalMonth, setInternalMonth] = (0, import_react31.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
3182
3653
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
3183
|
-
const [activeDate, setActiveDate] = (0,
|
|
3184
|
-
const rootRef = (0,
|
|
3185
|
-
const pendingFocus = (0,
|
|
3654
|
+
const [activeDate, setActiveDate] = (0, import_react31.useState)(value.end ?? value.start ?? visibleMonth);
|
|
3655
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
3656
|
+
const pendingFocus = (0, import_react31.useRef)(false);
|
|
3186
3657
|
const count = Math.max(1, Math.min(3, months));
|
|
3187
|
-
const calendars = (0,
|
|
3658
|
+
const calendars = (0, import_react31.useMemo)(() => Array.from({ length: count }, (_, index) => {
|
|
3188
3659
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
3189
3660
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
3190
3661
|
}), [visibleMonth, count]);
|
|
3191
3662
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
3192
|
-
(0,
|
|
3663
|
+
(0, import_react31.useEffect)(() => {
|
|
3193
3664
|
const first = calendars[0]?.days[0]?.date;
|
|
3194
3665
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
3195
3666
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
3196
3667
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
3197
3668
|
}, [activeDate, calendars]);
|
|
3198
|
-
(0,
|
|
3669
|
+
(0, import_react31.useEffect)(() => {
|
|
3199
3670
|
if (!pendingFocus.current) return;
|
|
3200
3671
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus();
|
|
3201
3672
|
pendingFocus.current = false;
|
|
@@ -3233,23 +3704,23 @@ function DateRangePicker({
|
|
|
3233
3704
|
}
|
|
3234
3705
|
};
|
|
3235
3706
|
const announcement = !value.start ? "No date range selected." : !value.end ? `Start date ${dateLabel2(value.start, locale)} selected. Choose an end date.` : `${dateLabel2(value.start, locale)} to ${dateLabel2(value.end, locale)} selected.`;
|
|
3236
|
-
return /* @__PURE__ */ (0,
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("section", { className: cx("uix-date-range-picker", rangeInvalid && "uix-date-range-picker--invalid", className), "aria-labelledby": `${id}-label`, children: [
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "uix-date-range-picker__header", children: [
|
|
3709
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { id: `${id}-label`, children: label }),
|
|
3710
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => setMonth(addCalendarMonths(visibleMonth, -1)), "aria-label": "Show previous month", children: "Previous" }),
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => setMonth(addCalendarMonths(visibleMonth, 1)), "aria-label": "Show next month", children: "Next" })
|
|
3242
3713
|
] })
|
|
3243
3714
|
] }),
|
|
3244
|
-
/* @__PURE__ */ (0,
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3248
|
-
Array.from({ length: ((/* @__PURE__ */ new Date(`${month}T00:00:00Z`)).getUTCDay() + 6) % 7 }, (_, index) => /* @__PURE__ */ (0,
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: rootRef, className: "uix-date-range-picker__months", children: calendars.map(({ month, days }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "uix-date-range-picker__month", children: [
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h4", { children: monthLabel(month, locale) }),
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "uix-date-range-picker__weekdays", "aria-hidden": "true", children: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((day) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: day }, day)) }),
|
|
3718
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "uix-date-range-picker__grid", role: "group", "aria-label": monthLabel(month, locale), children: [
|
|
3719
|
+
Array.from({ length: ((/* @__PURE__ */ new Date(`${month}T00:00:00Z`)).getUTCDay() + 6) % 7 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { "aria-hidden": "true" }, `blank-${index}`)),
|
|
3249
3720
|
days.map((day) => {
|
|
3250
3721
|
const unavailable = disabled || isDateUnavailable(day.date, { min, max, isDisabled: isDateDisabled });
|
|
3251
3722
|
const edge = day.date === value.start ? "start" : day.date === value.end ? "end" : void 0;
|
|
3252
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3253
3724
|
"button",
|
|
3254
3725
|
{
|
|
3255
3726
|
type: "button",
|
|
@@ -3270,13 +3741,13 @@ function DateRangePicker({
|
|
|
3270
3741
|
})
|
|
3271
3742
|
] })
|
|
3272
3743
|
] }, month)) }),
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3274
|
-
rangeInvalid && /* @__PURE__ */ (0,
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "uix-date-range-picker__selection", "aria-live": "polite", children: announcement }),
|
|
3745
|
+
rangeInvalid && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "uix-field__error", role: "alert", children: invalidMessage })
|
|
3275
3746
|
] });
|
|
3276
3747
|
}
|
|
3277
3748
|
|
|
3278
3749
|
// src/components/RelationshipGraph.tsx
|
|
3279
|
-
var
|
|
3750
|
+
var import_react32 = require("react");
|
|
3280
3751
|
|
|
3281
3752
|
// src/relationship-graph-model.ts
|
|
3282
3753
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -3343,7 +3814,7 @@ function traverseRelationshipNode(nodes, currentId, direction) {
|
|
|
3343
3814
|
}
|
|
3344
3815
|
|
|
3345
3816
|
// src/components/RelationshipGraph.tsx
|
|
3346
|
-
var
|
|
3817
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3347
3818
|
var EMPTY_IDS = /* @__PURE__ */ new Set();
|
|
3348
3819
|
var EMPTY_LEGEND = [];
|
|
3349
3820
|
function RelationshipGraph({
|
|
@@ -3365,13 +3836,13 @@ function RelationshipGraph({
|
|
|
3365
3836
|
onRetry,
|
|
3366
3837
|
className
|
|
3367
3838
|
}) {
|
|
3368
|
-
const bounded = (0,
|
|
3369
|
-
const positioned = (0,
|
|
3370
|
-
const positionedById = (0,
|
|
3371
|
-
const [zoom, setZoom] = (0,
|
|
3372
|
-
const [pan, setPan] = (0,
|
|
3373
|
-
const [focusedId, setFocusedId] = (0,
|
|
3374
|
-
const svgRef = (0,
|
|
3839
|
+
const bounded = (0, import_react32.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
3840
|
+
const positioned = (0, import_react32.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
3841
|
+
const positionedById = (0, import_react32.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
3842
|
+
const [zoom, setZoom] = (0, import_react32.useState)(1);
|
|
3843
|
+
const [pan, setPan] = (0, import_react32.useState)({ x: 0, y: 0 });
|
|
3844
|
+
const [focusedId, setFocusedId] = (0, import_react32.useState)(selectedId ?? positioned[0]?.id);
|
|
3845
|
+
const svgRef = (0, import_react32.useRef)(null);
|
|
3375
3846
|
const select = (id) => {
|
|
3376
3847
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
3377
3848
|
if (node) onSelect?.(node);
|
|
@@ -3394,44 +3865,44 @@ function RelationshipGraph({
|
|
|
3394
3865
|
setZoom(1);
|
|
3395
3866
|
setPan({ x: 0, y: 0 });
|
|
3396
3867
|
};
|
|
3397
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
3398
|
-
if (error) return /* @__PURE__ */ (0,
|
|
3399
|
-
/* @__PURE__ */ (0,
|
|
3400
|
-
onRetry && /* @__PURE__ */ (0,
|
|
3868
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: cx("uix-relationship-graph uix-relationship-graph--state", className), role: "status", children: "Loading relationships\u2026" });
|
|
3869
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cx("uix-relationship-graph uix-relationship-graph--state", className), role: "alert", children: [
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { children: error }),
|
|
3871
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: "Try again" })
|
|
3401
3872
|
] });
|
|
3402
|
-
if (bounded.nodes.length === 0) return /* @__PURE__ */ (0,
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3404
|
-
/* @__PURE__ */ (0,
|
|
3873
|
+
if (bounded.nodes.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cx("uix-relationship-graph uix-relationship-graph--state", className), children: [
|
|
3874
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { children: "No relationships to display." }),
|
|
3875
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { children: "Adjust the neighborhood or filters to include a node." })
|
|
3405
3876
|
] });
|
|
3406
|
-
return /* @__PURE__ */ (0,
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
/* @__PURE__ */ (0,
|
|
3409
|
-
/* @__PURE__ */ (0,
|
|
3410
|
-
/* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
3412
|
-
/* @__PURE__ */ (0,
|
|
3413
|
-
/* @__PURE__ */ (0,
|
|
3414
|
-
/* @__PURE__ */ (0,
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("section", { className: cx("uix-relationship-graph", `uix-relationship-graph--${density}`, className), "aria-label": "Relationship graph", children: [
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "uix-relationship-graph__toolbar", "aria-label": "Graph view controls", children: [
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, x: value.x - 24 })), "aria-label": "Pan left", children: "Left" }),
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, y: value.y - 24 })), "aria-label": "Pan up", children: "Up" }),
|
|
3881
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, y: value.y + 24 })), "aria-label": "Pan down", children: "Down" }),
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, x: value.x + 24 })), "aria-label": "Pan right", children: "Right" }),
|
|
3883
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setZoom((value) => Math.min(2, Number((value + 0.2).toFixed(1)))), "aria-label": "Zoom in", children: "Zoom in" }),
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => setZoom((value) => Math.max(0.5, Number((value - 0.2).toFixed(1)))), "aria-label": "Zoom out", children: "Zoom out" }),
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: reset, children: "Reset view" }),
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { "aria-live": "polite", children: [
|
|
3416
3887
|
"Zoom ",
|
|
3417
3888
|
Math.round(zoom * 100),
|
|
3418
3889
|
"%"
|
|
3419
3890
|
] })
|
|
3420
3891
|
] }),
|
|
3421
|
-
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0,
|
|
3892
|
+
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("p", { className: "uix-relationship-graph__bounded", role: "status", children: [
|
|
3422
3893
|
"Showing ",
|
|
3423
3894
|
bounded.nodes.length,
|
|
3424
3895
|
" nodes; ",
|
|
3425
3896
|
bounded.omittedNodeCount,
|
|
3426
3897
|
" outside this bounded neighborhood."
|
|
3427
3898
|
] }),
|
|
3428
|
-
/* @__PURE__ */ (0,
|
|
3899
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "uix-relationship-graph__visual", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("svg", { ref: svgRef, viewBox: "0 0 600 400", role: "group", "aria-label": `Graph with ${bounded.nodes.length} nodes and ${bounded.edges.length} relationships`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("g", { transform: `translate(${pan.x} ${pan.y}) scale(${zoom})`, children: [
|
|
3429
3900
|
bounded.edges.map((edge) => {
|
|
3430
3901
|
const source = positionedById.get(edge.source);
|
|
3431
3902
|
const target = positionedById.get(edge.target);
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("line", { x1: source.x * 6, y1: source.y * 4, x2: target.x * 6, y2: target.y * 4, className: "uix-relationship-graph__edge", "data-highlighted": highlightedEdgeIds.has(edge.id) || void 0, "data-conflicted": conflictedEdgeIds.has(edge.id) || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("title", { children: edge.label ?? edge.type ?? "Relationship" }) }, edge.id);
|
|
3433
3904
|
}),
|
|
3434
|
-
positioned.map((node) => /* @__PURE__ */ (0,
|
|
3905
|
+
positioned.map((node) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
3435
3906
|
"g",
|
|
3436
3907
|
{
|
|
3437
3908
|
transform: `translate(${node.x * 6} ${node.y * 4})`,
|
|
@@ -3447,27 +3918,27 @@ function RelationshipGraph({
|
|
|
3447
3918
|
onKeyDown: (event) => onNodeKeyDown(event, node.id),
|
|
3448
3919
|
onClick: () => select(node.id),
|
|
3449
3920
|
children: [
|
|
3450
|
-
/* @__PURE__ */ (0,
|
|
3451
|
-
/* @__PURE__ */ (0,
|
|
3921
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("rect", { x: "-55", y: "-18", width: "110", height: "36", rx: "8" }),
|
|
3922
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("text", { textAnchor: "middle", dominantBaseline: "middle", children: node.label.length > 16 ? `${node.label.slice(0, 15)}\u2026` : node.label })
|
|
3452
3923
|
]
|
|
3453
3924
|
},
|
|
3454
3925
|
node.id
|
|
3455
3926
|
))
|
|
3456
3927
|
] }) }) }),
|
|
3457
|
-
legend.length > 0 && /* @__PURE__ */ (0,
|
|
3458
|
-
/* @__PURE__ */ (0,
|
|
3459
|
-
/* @__PURE__ */ (0,
|
|
3460
|
-
/* @__PURE__ */ (0,
|
|
3928
|
+
legend.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "uix-relationship-graph__legend", "aria-label": "Relationship types", children: legend.map((item) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { "data-type": item.id, children: item.label }, item.id)) }),
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "uix-relationship-graph__list", role: "region", "aria-label": "Accessible relationship list", children: [
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { children: "Relationship list" }),
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { children: bounded.nodes.map((node) => {
|
|
3461
3932
|
const neighbors = relationshipNeighbors(node.id, bounded.edges).map((id) => bounded.nodes.find((item) => item.id === id)?.label ?? id);
|
|
3462
|
-
return /* @__PURE__ */ (0,
|
|
3463
|
-
/* @__PURE__ */ (0,
|
|
3464
|
-
/* @__PURE__ */ (0,
|
|
3465
|
-
node.type && /* @__PURE__ */ (0,
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
3933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { "data-selected": selectedId === node.id || void 0, children: [
|
|
3934
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("button", { type: "button", onClick: () => select(node.id), "aria-pressed": selectedId === node.id, children: [
|
|
3935
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("strong", { children: node.label }),
|
|
3936
|
+
node.type && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: node.type }),
|
|
3937
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: neighbors.length ? `Connected to ${neighbors.join(", ")}` : "No visible connections" })
|
|
3467
3938
|
] }),
|
|
3468
|
-
/* @__PURE__ */ (0,
|
|
3469
|
-
onExpandNeighbors && /* @__PURE__ */ (0,
|
|
3470
|
-
onOpenDetails && /* @__PURE__ */ (0,
|
|
3939
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "uix-relationship-graph__list-actions", children: [
|
|
3940
|
+
onExpandNeighbors && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => onExpandNeighbors(node), children: "Expand neighbors" }),
|
|
3941
|
+
onOpenDetails && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", onClick: () => onOpenDetails(node), children: "Open details" })
|
|
3471
3942
|
] })
|
|
3472
3943
|
] }, node.id);
|
|
3473
3944
|
}) })
|
|
@@ -3476,8 +3947,8 @@ function RelationshipGraph({
|
|
|
3476
3947
|
}
|
|
3477
3948
|
|
|
3478
3949
|
// src/components/MatchReview.tsx
|
|
3479
|
-
var
|
|
3480
|
-
var
|
|
3950
|
+
var import_react33 = require("react");
|
|
3951
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3481
3952
|
var valueText = (value) => value == null ? "\u2014" : typeof value === "string" ? value : JSON.stringify(value);
|
|
3482
3953
|
function MatchReview({
|
|
3483
3954
|
incoming,
|
|
@@ -3493,11 +3964,11 @@ function MatchReview({
|
|
|
3493
3964
|
onRetry,
|
|
3494
3965
|
className
|
|
3495
3966
|
}) {
|
|
3496
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
3497
|
-
const [announcement, setAnnouncement] = (0,
|
|
3498
|
-
const [bulkPending, setBulkPending] = (0,
|
|
3967
|
+
const [internalSelection, setInternalSelection] = (0, import_react33.useState)(/* @__PURE__ */ new Set());
|
|
3968
|
+
const [announcement, setAnnouncement] = (0, import_react33.useState)("");
|
|
3969
|
+
const [bulkPending, setBulkPending] = (0, import_react33.useState)(false);
|
|
3499
3970
|
const selection = selectedIds ?? internalSelection;
|
|
3500
|
-
const pending = (0,
|
|
3971
|
+
const pending = (0, import_react33.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
3501
3972
|
const setSelection = (next) => {
|
|
3502
3973
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
3503
3974
|
onSelectionChange?.(next);
|
|
@@ -3525,55 +3996,55 @@ function MatchReview({
|
|
|
3525
3996
|
setBulkPending(false);
|
|
3526
3997
|
}
|
|
3527
3998
|
};
|
|
3528
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
3529
|
-
if (error) return /* @__PURE__ */ (0,
|
|
3530
|
-
/* @__PURE__ */ (0,
|
|
3531
|
-
onRetry && /* @__PURE__ */ (0,
|
|
3999
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: cx("uix-match-review uix-match-review--state", className), role: "status", children: "Loading match candidates\u2026" });
|
|
4000
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cx("uix-match-review uix-match-review--state", className), role: "alert", children: [
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { children: error }),
|
|
4002
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: "Try again" })
|
|
3532
4003
|
] });
|
|
3533
|
-
if (candidates.length === 0) return /* @__PURE__ */ (0,
|
|
3534
|
-
/* @__PURE__ */ (0,
|
|
3535
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
if (candidates.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cx("uix-match-review uix-match-review--state", className), children: [
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { children: "No candidate matches found." }),
|
|
4006
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { children: "Choose another record source or continue without a match." })
|
|
3536
4007
|
] });
|
|
3537
|
-
return /* @__PURE__ */ (0,
|
|
3538
|
-
/* @__PURE__ */ (0,
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3540
|
-
/* @__PURE__ */ (0,
|
|
3541
|
-
/* @__PURE__ */ (0,
|
|
4008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("section", { className: cx("uix-match-review", className), "aria-label": "Match review", children: [
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "uix-match-review__summary", children: [
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { children: [
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("strong", { children: incomingLabel }),
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
|
|
3542
4013
|
pending.length,
|
|
3543
4014
|
" pending of ",
|
|
3544
4015
|
candidates.length
|
|
3545
4016
|
] })
|
|
3546
4017
|
] }),
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
4018
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "uix-match-review__incoming", children: fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
|
|
4019
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("b", { children: field.label }),
|
|
3549
4020
|
field.render?.(incoming[field.id], incoming) ?? valueText(incoming[field.id])
|
|
3550
4021
|
] }, field.id)) })
|
|
3551
4022
|
] }),
|
|
3552
|
-
onBulkDecision && /* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
4023
|
+
onBulkDecision && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "uix-match-review__bulk", "aria-label": "Bulk candidate actions", children: [
|
|
4024
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
|
|
3554
4025
|
selection.size,
|
|
3555
4026
|
" selected"
|
|
3556
4027
|
] }),
|
|
3557
|
-
/* @__PURE__ */ (0,
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
4028
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", disabled: selection.size === 0 || bulkPending, onClick: () => void runBulk("accept"), children: bulkPending ? "Applying\u2026" : "Accept selected" }),
|
|
4029
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", disabled: selection.size === 0 || bulkPending, onClick: () => void runBulk("dismiss"), children: bulkPending ? "Applying\u2026" : "Dismiss selected" })
|
|
3559
4030
|
] }),
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3564
|
-
/* @__PURE__ */ (0,
|
|
3565
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
3566
|
-
/* @__PURE__ */ (0,
|
|
3567
|
-
/* @__PURE__ */ (0,
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "uix-match-review__table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("table", { className: "uix-table uix-match-review__table", children: [
|
|
4032
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("caption", { className: "uix-visually-hidden", children: "Candidate matches and available decisions" }),
|
|
4033
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("tr", { children: [
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("th", { scope: "col", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "uix-visually-hidden", children: "Select" }) }),
|
|
4035
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("th", { scope: "col", children: "Confidence" }),
|
|
4036
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("th", { scope: "col", children: field.label }, field.id)),
|
|
4037
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("th", { scope: "col", children: "Status" }),
|
|
4038
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("th", { scope: "col", children: "Actions" })
|
|
3568
4039
|
] }) }),
|
|
3569
|
-
/* @__PURE__ */ (0,
|
|
4040
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("tbody", { children: candidates.map((candidate) => {
|
|
3570
4041
|
const resolved = candidate.status === "resolved";
|
|
3571
|
-
return /* @__PURE__ */ (0,
|
|
3572
|
-
/* @__PURE__ */ (0,
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3574
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3576
|
-
/* @__PURE__ */ (0,
|
|
4042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("tr", { "data-status": candidate.status ?? "pending", children: [
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("input", { type: "checkbox", checked: selection.has(candidate.id), onChange: () => toggle(candidate.id), "aria-label": `Select candidate ${candidate.id}` }) }),
|
|
4044
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "uix-match-review__confidence", children: candidate.confidence == null ? "Not scored" : `${Math.round(candidate.confidence * 100)}%` }) }),
|
|
4045
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("td", { children: field.render?.(candidate.record[field.id], candidate.record) ?? valueText(candidate.record[field.id]) }, field.id)),
|
|
4046
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(StatusPill, { tone: resolved ? "success" : "warning", children: resolved ? candidate.decision ?? "Resolved" : "Pending" }) }),
|
|
4047
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "uix-match-review__actions", children: ["accept", "dismiss", "split", "pick-other"].map((action) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3577
4048
|
"button",
|
|
3578
4049
|
{
|
|
3579
4050
|
type: "button",
|
|
@@ -3587,12 +4058,12 @@ function MatchReview({
|
|
|
3587
4058
|
] }, candidate.id);
|
|
3588
4059
|
}) })
|
|
3589
4060
|
] }) }),
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
4061
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "uix-visually-hidden", "aria-live": "polite", children: announcement })
|
|
3591
4062
|
] });
|
|
3592
4063
|
}
|
|
3593
4064
|
|
|
3594
4065
|
// src/components/MetricInput.tsx
|
|
3595
|
-
var
|
|
4066
|
+
var import_react34 = require("react");
|
|
3596
4067
|
|
|
3597
4068
|
// src/metric-model.ts
|
|
3598
4069
|
function decimals(value) {
|
|
@@ -3617,7 +4088,7 @@ function parseMetricValue(value) {
|
|
|
3617
4088
|
}
|
|
3618
4089
|
|
|
3619
4090
|
// src/components/MetricInput.tsx
|
|
3620
|
-
var
|
|
4091
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3621
4092
|
var defaultMetricFormat = (input) => input == null ? "" : String(input);
|
|
3622
4093
|
function MetricInput({
|
|
3623
4094
|
value,
|
|
@@ -3636,11 +4107,11 @@ function MetricInput({
|
|
|
3636
4107
|
className,
|
|
3637
4108
|
id: providedId
|
|
3638
4109
|
}) {
|
|
3639
|
-
const generatedId = (0,
|
|
4110
|
+
const generatedId = (0, import_react34.useId)();
|
|
3640
4111
|
const id = providedId ?? generatedId;
|
|
3641
4112
|
const errorId = `${id}-error`;
|
|
3642
|
-
const [text, setText] = (0,
|
|
3643
|
-
(0,
|
|
4113
|
+
const [text, setText] = (0, import_react34.useState)(() => format(value));
|
|
4114
|
+
(0, import_react34.useEffect)(() => setText(format(value)), [value, format]);
|
|
3644
4115
|
const commit = (input) => {
|
|
3645
4116
|
const parsed = parse(input);
|
|
3646
4117
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -3666,10 +4137,10 @@ function MetricInput({
|
|
|
3666
4137
|
const parsed = parse(event.currentTarget.value);
|
|
3667
4138
|
setText(parsed === null && event.currentTarget.value.trim() !== "" ? format(value) : format(parsed));
|
|
3668
4139
|
};
|
|
3669
|
-
return /* @__PURE__ */ (0,
|
|
3670
|
-
/* @__PURE__ */ (0,
|
|
3671
|
-
/* @__PURE__ */ (0,
|
|
3672
|
-
/* @__PURE__ */ (0,
|
|
4140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: cx("uix-metric-input", invalid && "uix-metric-input--invalid", className), children: [
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("label", { className: "uix-field__label", htmlFor: id, children: label }),
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uix-metric-input__control", children: [
|
|
4143
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3673
4144
|
Input,
|
|
3674
4145
|
{
|
|
3675
4146
|
id,
|
|
@@ -3688,22 +4159,22 @@ function MetricInput({
|
|
|
3688
4159
|
readOnly
|
|
3689
4160
|
}
|
|
3690
4161
|
),
|
|
3691
|
-
unit && /* @__PURE__ */ (0,
|
|
3692
|
-
/* @__PURE__ */ (0,
|
|
3693
|
-
/* @__PURE__ */ (0,
|
|
3694
|
-
/* @__PURE__ */ (0,
|
|
4162
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uix-metric-input__unit", "aria-hidden": "true", children: unit }),
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "uix-metric-input__steps", children: [
|
|
4164
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: "uix-metric-input__step", onClick: () => stepBy(1), disabled: disabled || readOnly, "aria-label": `Increase ${label}`, children: "+" }),
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: "uix-metric-input__step", onClick: () => stepBy(-1), disabled: disabled || readOnly, "aria-label": `Decrease ${label}`, children: "\u2212" })
|
|
3695
4166
|
] })
|
|
3696
4167
|
] }),
|
|
3697
|
-
unit && /* @__PURE__ */ (0,
|
|
4168
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "uix-visually-hidden", children: [
|
|
3698
4169
|
"Unit: ",
|
|
3699
4170
|
unit
|
|
3700
4171
|
] }),
|
|
3701
|
-
invalid && errorMessage && /* @__PURE__ */ (0,
|
|
4172
|
+
invalid && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { id: errorId, className: "uix-field__error", children: errorMessage })
|
|
3702
4173
|
] });
|
|
3703
4174
|
}
|
|
3704
4175
|
|
|
3705
4176
|
// src/components/LicensePositionBar.tsx
|
|
3706
|
-
var
|
|
4177
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3707
4178
|
var defaultCapacityFormat = (value) => new Intl.NumberFormat().format(value);
|
|
3708
4179
|
function LicensePositionBar({
|
|
3709
4180
|
consumed,
|
|
@@ -3724,18 +4195,18 @@ function LicensePositionBar({
|
|
|
3724
4195
|
const percent = safeEntitled === 0 ? safeConsumed > 0 ? 100 : 0 : safeConsumed / safeEntitled * 100;
|
|
3725
4196
|
const format = (value) => `${formatValue(value)}${unit ? ` ${unit}` : ""}`;
|
|
3726
4197
|
const summary = `${consumedLabel}: ${format(safeConsumed)}. ${entitledLabel}: ${format(safeEntitled)}. ${over > 0 ? `${format(over)} ${overLabel}` : `${format(available)} ${availableLabel}`}.`;
|
|
3727
|
-
return /* @__PURE__ */ (0,
|
|
3728
|
-
/* @__PURE__ */ (0,
|
|
3729
|
-
/* @__PURE__ */ (0,
|
|
4198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: cx("uix-license-position", over > 0 && "uix-license-position--over", className), ...props, children: [
|
|
4199
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uix-license-position__header", children: [
|
|
4200
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "uix-license-position__value", children: [
|
|
3730
4201
|
format(safeConsumed),
|
|
3731
4202
|
" / ",
|
|
3732
4203
|
format(safeEntitled)
|
|
3733
4204
|
] }),
|
|
3734
|
-
/* @__PURE__ */ (0,
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(StatusPill, { tone: over > 0 ? "danger" : percent >= 80 ? "warning" : "success", children: over > 0 ? `${format(over)} ${overLabel}` : `${format(available)} ${availableLabel}` })
|
|
3735
4206
|
] }),
|
|
3736
|
-
/* @__PURE__ */ (0,
|
|
3737
|
-
/* @__PURE__ */ (0,
|
|
3738
|
-
over > 0 && /* @__PURE__ */ (0,
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uix-license-position__track", children: [
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Meter, { value: Math.min(100, percent), tone: over > 0 ? "danger" : percent >= 80 ? "warning" : "success", "aria-label": summary, "aria-valuetext": summary }),
|
|
4209
|
+
over > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
3739
4210
|
"span",
|
|
3740
4211
|
{
|
|
3741
4212
|
className: "uix-license-position__overflow",
|
|
@@ -3744,12 +4215,12 @@ function LicensePositionBar({
|
|
|
3744
4215
|
}
|
|
3745
4216
|
)
|
|
3746
4217
|
] }),
|
|
3747
|
-
/* @__PURE__ */ (0,
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "uix-visually-hidden", children: summary })
|
|
3748
4219
|
] });
|
|
3749
4220
|
}
|
|
3750
4221
|
|
|
3751
4222
|
// src/components/BrandProfiles.tsx
|
|
3752
|
-
var
|
|
4223
|
+
var import_react36 = require("react");
|
|
3753
4224
|
|
|
3754
4225
|
// src/color-model.ts
|
|
3755
4226
|
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -3818,8 +4289,8 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
3818
4289
|
}
|
|
3819
4290
|
|
|
3820
4291
|
// src/components/ColorPicker.tsx
|
|
3821
|
-
var
|
|
3822
|
-
var
|
|
4292
|
+
var import_react35 = require("react");
|
|
4293
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3823
4294
|
var EMPTY_COLORS = [];
|
|
3824
4295
|
function ColorPicker({
|
|
3825
4296
|
value,
|
|
@@ -3832,17 +4303,17 @@ function ColorPicker({
|
|
|
3832
4303
|
disabled,
|
|
3833
4304
|
className
|
|
3834
4305
|
}) {
|
|
3835
|
-
const id = (0,
|
|
3836
|
-
const triggerRef = (0,
|
|
3837
|
-
const dialogRef = (0,
|
|
3838
|
-
const [open, setOpen] = (0,
|
|
4306
|
+
const id = (0, import_react35.useId)();
|
|
4307
|
+
const triggerRef = (0, import_react35.useRef)(null);
|
|
4308
|
+
const dialogRef = (0, import_react35.useRef)(null);
|
|
4309
|
+
const [open, setOpen] = (0, import_react35.useState)(false);
|
|
3839
4310
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
3840
|
-
const [hexText, setHexText] = (0,
|
|
3841
|
-
const hsv = (0,
|
|
4311
|
+
const [hexText, setHexText] = (0, import_react35.useState)(normalized);
|
|
4312
|
+
const hsv = (0, import_react35.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
3842
4313
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
3843
4314
|
const passes = ratio >= minimumContrast;
|
|
3844
|
-
(0,
|
|
3845
|
-
(0,
|
|
4315
|
+
(0, import_react35.useEffect)(() => setHexText(normalized), [normalized]);
|
|
4316
|
+
(0, import_react35.useEffect)(() => {
|
|
3846
4317
|
if (!open) return;
|
|
3847
4318
|
const dialog = dialogRef.current;
|
|
3848
4319
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -3885,8 +4356,8 @@ function ColorPicker({
|
|
|
3885
4356
|
if (next) onChange(next);
|
|
3886
4357
|
};
|
|
3887
4358
|
const sampleStyle = { backgroundColor: normalized };
|
|
3888
|
-
return /* @__PURE__ */ (0,
|
|
3889
|
-
/* @__PURE__ */ (0,
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: cx("uix-color-picker", className), children: [
|
|
4360
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
3890
4361
|
"button",
|
|
3891
4362
|
{
|
|
3892
4363
|
ref: triggerRef,
|
|
@@ -3898,12 +4369,12 @@ function ColorPicker({
|
|
|
3898
4369
|
onClick: () => setOpen((current) => !current),
|
|
3899
4370
|
disabled,
|
|
3900
4371
|
children: [
|
|
3901
|
-
/* @__PURE__ */ (0,
|
|
3902
|
-
/* @__PURE__ */ (0,
|
|
4372
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "uix-color-picker__swatch", style: sampleStyle, "aria-hidden": "true" }),
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { children: normalized })
|
|
3903
4374
|
]
|
|
3904
4375
|
}
|
|
3905
4376
|
),
|
|
3906
|
-
open && /* @__PURE__ */ (0,
|
|
4377
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
3907
4378
|
"div",
|
|
3908
4379
|
{
|
|
3909
4380
|
ref: dialogRef,
|
|
@@ -3914,57 +4385,57 @@ function ColorPicker({
|
|
|
3914
4385
|
className: "uix-color-picker__popover",
|
|
3915
4386
|
onKeyDown: onDialogKeyDown,
|
|
3916
4387
|
children: [
|
|
3917
|
-
/* @__PURE__ */ (0,
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "uix-color-picker__preview", style: sampleStyle, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { style: { color: foreground }, children: "Aa" }) }),
|
|
4389
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
3919
4390
|
"Hue ",
|
|
3920
|
-
/* @__PURE__ */ (0,
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { children: [
|
|
3921
4392
|
Math.round(hsv.h),
|
|
3922
4393
|
"\xB0"
|
|
3923
4394
|
] }),
|
|
3924
|
-
/* @__PURE__ */ (0,
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { type: "range", min: "0", max: "359", value: Math.round(hsv.h), onChange: (event) => updateHsv({ h: Number(event.currentTarget.value) }) })
|
|
3925
4396
|
] }),
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
3927
4398
|
"Saturation ",
|
|
3928
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { children: [
|
|
3929
4400
|
Math.round(hsv.s * 100),
|
|
3930
4401
|
"%"
|
|
3931
4402
|
] }),
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
4403
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { type: "range", min: "0", max: "100", value: Math.round(hsv.s * 100), onChange: (event) => updateHsv({ s: Number(event.currentTarget.value) / 100 }) })
|
|
3933
4404
|
] }),
|
|
3934
|
-
/* @__PURE__ */ (0,
|
|
4405
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
3935
4406
|
"Brightness ",
|
|
3936
|
-
/* @__PURE__ */ (0,
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { children: [
|
|
3937
4408
|
Math.round(hsv.v * 100),
|
|
3938
4409
|
"%"
|
|
3939
4410
|
] }),
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { type: "range", min: "0", max: "100", value: Math.round(hsv.v * 100), onChange: (event) => updateHsv({ v: Number(event.currentTarget.value) / 100 }) })
|
|
3941
4412
|
] }),
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
4413
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "uix-color-picker__hex", children: [
|
|
3943
4414
|
"Hex",
|
|
3944
|
-
/* @__PURE__ */ (0,
|
|
3945
|
-
/* @__PURE__ */ (0,
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "uix-color-picker__hex-row", children: [
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { className: "uix-input", value: hexText, onChange: (event) => setHexText(event.currentTarget.value), onBlur: commitHex, onKeyDown: (event) => {
|
|
3946
4417
|
if (event.key === "Enter") commitHex();
|
|
3947
4418
|
}, "aria-invalid": !normalizeHex(hexText) }),
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: commitHex, disabled: !normalizeHex(hexText), children: "Set" })
|
|
3949
4420
|
] })
|
|
3950
4421
|
] }),
|
|
3951
|
-
(presets.length > 0 || recent.length > 0) && /* @__PURE__ */ (0,
|
|
3952
|
-
presets.length > 0 && /* @__PURE__ */ (0,
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
/* @__PURE__ */ (0,
|
|
4422
|
+
(presets.length > 0 || recent.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uix-color-picker__palettes", children: [
|
|
4423
|
+
presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("fieldset", { children: [
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("legend", { children: "Presets" }),
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { children: presets.map((color) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: "uix-color-picker__preset", style: { backgroundColor: normalizeHex(color) ?? color }, onClick: () => choose(color), "aria-label": `Use preset ${color}` }, color)) })
|
|
3955
4426
|
] }),
|
|
3956
|
-
recent.length > 0 && /* @__PURE__ */ (0,
|
|
3957
|
-
/* @__PURE__ */ (0,
|
|
3958
|
-
/* @__PURE__ */ (0,
|
|
4427
|
+
recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("fieldset", { children: [
|
|
4428
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("legend", { children: "Recent" }),
|
|
4429
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { children: recent.map((color) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: "uix-color-picker__preset", style: { backgroundColor: normalizeHex(color) ?? color }, onClick: () => choose(color), "aria-label": `Use recent color ${color}` }, color)) })
|
|
3959
4430
|
] })
|
|
3960
4431
|
] }),
|
|
3961
|
-
/* @__PURE__ */ (0,
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: cx("uix-color-picker__contrast", passes ? "uix-color-picker__contrast--pass" : "uix-color-picker__contrast--fail"), role: "status", "aria-live": "polite", children: [
|
|
3962
4433
|
"Contrast ",
|
|
3963
4434
|
ratio.toFixed(2),
|
|
3964
4435
|
":1 \u2014 ",
|
|
3965
4436
|
passes ? `passes WCAG AA (${minimumContrast}:1)` : `does not meet WCAG AA (${minimumContrast}:1)`
|
|
3966
4437
|
] }),
|
|
3967
|
-
/* @__PURE__ */ (0,
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary uix-btn--sm", onClick: close, children: "Done" })
|
|
3968
4439
|
]
|
|
3969
4440
|
}
|
|
3970
4441
|
)
|
|
@@ -3972,7 +4443,7 @@ function ColorPicker({
|
|
|
3972
4443
|
}
|
|
3973
4444
|
|
|
3974
4445
|
// src/components/BrandProfiles.tsx
|
|
3975
|
-
var
|
|
4446
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3976
4447
|
var PROFILE_PROPERTIES = {
|
|
3977
4448
|
brand: "--uix-brand",
|
|
3978
4449
|
brandForeground: "--uix-brand-fg",
|
|
@@ -4041,7 +4512,7 @@ function BrandProfileEditor({
|
|
|
4041
4512
|
colorPresets = EMPTY_COLORS2,
|
|
4042
4513
|
className
|
|
4043
4514
|
}) {
|
|
4044
|
-
const [announcement, setAnnouncement] = (0,
|
|
4515
|
+
const [announcement, setAnnouncement] = (0, import_react36.useState)("");
|
|
4045
4516
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
4046
4517
|
const apply = () => {
|
|
4047
4518
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -4058,54 +4529,54 @@ function BrandProfileEditor({
|
|
|
4058
4529
|
...value.typography?.sans ? { "--uix-font-sans": value.typography.sans } : {},
|
|
4059
4530
|
...value.typography?.heading ? { "--uix-font-heading": value.typography.heading } : {}
|
|
4060
4531
|
};
|
|
4061
|
-
return /* @__PURE__ */ (0,
|
|
4062
|
-
/* @__PURE__ */ (0,
|
|
4063
|
-
profiles.length > 0 && /* @__PURE__ */ (0,
|
|
4532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("section", { className: cx("uix-brand-profiles", className), "aria-label": "Brand profile editor", children: [
|
|
4533
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "uix-brand-profiles__form", children: [
|
|
4534
|
+
profiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "uix-field__label", children: [
|
|
4064
4535
|
"Profile",
|
|
4065
|
-
/* @__PURE__ */ (0,
|
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("select", { className: "uix-select", value: value.id, onChange: (event) => {
|
|
4066
4537
|
const selected = profiles.find((profile) => profile.id === event.currentTarget.value);
|
|
4067
4538
|
if (selected) onSelectProfile?.(selected);
|
|
4068
|
-
}, children: profiles.map((profile) => /* @__PURE__ */ (0,
|
|
4539
|
+
}, children: profiles.map((profile) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("option", { value: profile.id, children: profile.name }, profile.id)) })
|
|
4069
4540
|
] }),
|
|
4070
|
-
/* @__PURE__ */ (0,
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "uix-field__label", children: [
|
|
4071
4542
|
"Name",
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4543
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("input", { className: "uix-input", value: value.name, onChange: (event) => update({ name: event.currentTarget.value }) })
|
|
4073
4544
|
] }),
|
|
4074
|
-
/* @__PURE__ */ (0,
|
|
4075
|
-
/* @__PURE__ */ (0,
|
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "uix-brand-profiles__colors", children: [
|
|
4546
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { children: [
|
|
4076
4547
|
"Brand",
|
|
4077
|
-
/* @__PURE__ */ (0,
|
|
4548
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ColorPicker, { label: "Brand color", value: value.brand, foreground: value.brandForeground, presets: colorPresets, onChange: (brand) => update({ brand }) })
|
|
4078
4549
|
] }),
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { children: [
|
|
4080
4551
|
"On brand",
|
|
4081
|
-
/* @__PURE__ */ (0,
|
|
4552
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ColorPicker, { label: "Brand foreground color", value: value.brandForeground, foreground: value.brand, presets: colorPresets, onChange: (brandForeground) => update({ brandForeground }) })
|
|
4082
4553
|
] })
|
|
4083
4554
|
] }),
|
|
4084
|
-
/* @__PURE__ */ (0,
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "uix-field__label", children: [
|
|
4085
4556
|
"Body font",
|
|
4086
|
-
/* @__PURE__ */ (0,
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("input", { className: "uix-input", value: value.typography?.sans ?? "", onChange: (event) => update({ typography: { ...value.typography, sans: event.currentTarget.value || void 0 } }) })
|
|
4087
4558
|
] }),
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "uix-field__label", children: [
|
|
4089
4560
|
"Heading font",
|
|
4090
|
-
/* @__PURE__ */ (0,
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("input", { className: "uix-input", value: value.typography?.heading ?? "", onChange: (event) => update({ typography: { ...value.typography, heading: event.currentTarget.value || void 0 } }) })
|
|
4091
4562
|
] }),
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "uix-file-upload uix-brand-profiles__upload", children: [
|
|
4093
4564
|
"Logo file",
|
|
4094
|
-
/* @__PURE__ */ (0,
|
|
4565
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("input", { type: "file", accept: "image/*", onChange: onFile })
|
|
4095
4566
|
] }),
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4097
|
-
/* @__PURE__ */ (0,
|
|
4567
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary", onClick: apply, children: "Apply profile" }),
|
|
4568
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "uix-visually-hidden", "aria-live": "polite", children: announcement })
|
|
4098
4569
|
] }),
|
|
4099
|
-
/* @__PURE__ */ (0,
|
|
4100
|
-
/* @__PURE__ */ (0,
|
|
4101
|
-
value.logo ? /* @__PURE__ */ (0,
|
|
4102
|
-
/* @__PURE__ */ (0,
|
|
4570
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "uix-brand-profiles__preview", style: previewStyle, "aria-label": `Live preview of ${value.name}`, children: [
|
|
4571
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "uix-brand-profiles__preview-header", children: [
|
|
4572
|
+
value.logo ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: value.logo.src, alt: value.logo.alt }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "uix-brand-profiles__logo-placeholder", children: "Logo" }),
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: value.name || "Brand preview" })
|
|
4103
4574
|
] }),
|
|
4104
|
-
/* @__PURE__ */ (0,
|
|
4105
|
-
/* @__PURE__ */ (0,
|
|
4106
|
-
/* @__PURE__ */ (0,
|
|
4107
|
-
/* @__PURE__ */ (0,
|
|
4108
|
-
/* @__PURE__ */ (0,
|
|
4575
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "uix-brand-profiles__preview-body", children: [
|
|
4576
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h3", { children: "Readable, serializable branding" }),
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { children: "Accent, links, rings, and muted states continue through the existing UIx token chain." }),
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary", children: "Primary action" }),
|
|
4579
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("a", { href: "#brand-profile-preview", children: "Preview link" })
|
|
4109
4580
|
] })
|
|
4110
4581
|
] })
|
|
4111
4582
|
] });
|
|
@@ -4113,7 +4584,7 @@ function BrandProfileEditor({
|
|
|
4113
4584
|
var BrandProfiles = BrandProfileEditor;
|
|
4114
4585
|
|
|
4115
4586
|
// src/components/DiffViewer.tsx
|
|
4116
|
-
var
|
|
4587
|
+
var import_react37 = require("react");
|
|
4117
4588
|
|
|
4118
4589
|
// src/diff-model.ts
|
|
4119
4590
|
function isJsonObject(value) {
|
|
@@ -4164,7 +4635,7 @@ function summarizeDiff(entries, resolutions = {}) {
|
|
|
4164
4635
|
}
|
|
4165
4636
|
|
|
4166
4637
|
// src/components/DiffViewer.tsx
|
|
4167
|
-
var
|
|
4638
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4168
4639
|
var GROUPS = [
|
|
4169
4640
|
{ kind: "conflicted", label: "Conflicted" },
|
|
4170
4641
|
{ kind: "changed", label: "Changed" },
|
|
@@ -4183,65 +4654,65 @@ function DiffViewer({
|
|
|
4183
4654
|
labels = DEFAULT_LABELS,
|
|
4184
4655
|
className
|
|
4185
4656
|
}) {
|
|
4186
|
-
const id = (0,
|
|
4187
|
-
const entries = (0,
|
|
4188
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
4657
|
+
const id = (0, import_react37.useId)();
|
|
4658
|
+
const entries = (0, import_react37.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
4659
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react37.useState)({});
|
|
4189
4660
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
4190
4661
|
const summary = summarizeDiff(entries, resolutions);
|
|
4191
4662
|
const resolve2 = (path, resolution) => {
|
|
4192
4663
|
if (controlledResolutions === void 0) setInternalResolutions((currentState) => ({ ...currentState, [path]: resolution }));
|
|
4193
4664
|
onResolutionChange?.(path, resolution);
|
|
4194
4665
|
};
|
|
4195
|
-
if (entries.length === 0) return /* @__PURE__ */ (0,
|
|
4196
|
-
/* @__PURE__ */ (0,
|
|
4197
|
-
/* @__PURE__ */ (0,
|
|
4666
|
+
if (entries.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("section", { className: cx("uix-diff-viewer uix-diff-viewer--empty", className), "aria-label": "Configuration differences", children: [
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { children: "No differences" }),
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { children: "Base, current, and incoming values are aligned." })
|
|
4198
4669
|
] });
|
|
4199
|
-
return /* @__PURE__ */ (0,
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4201
|
-
GROUPS.map((group) => /* @__PURE__ */ (0,
|
|
4202
|
-
/* @__PURE__ */ (0,
|
|
4670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("section", { className: cx("uix-diff-viewer", className), "aria-label": "Configuration differences", children: [
|
|
4671
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uix-diff-viewer__summary", "aria-label": "Difference summary", children: [
|
|
4672
|
+
GROUPS.map((group) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { children: [
|
|
4673
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("b", { children: summary[group.kind] }),
|
|
4203
4674
|
" ",
|
|
4204
4675
|
group.label.toLowerCase()
|
|
4205
4676
|
] }, group.kind)),
|
|
4206
|
-
/* @__PURE__ */ (0,
|
|
4207
|
-
/* @__PURE__ */ (0,
|
|
4677
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { children: [
|
|
4678
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("b", { children: summary.resolved }),
|
|
4208
4679
|
" resolved"
|
|
4209
4680
|
] }),
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4681
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { children: [
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("b", { children: summary.pending }),
|
|
4212
4683
|
" pending"
|
|
4213
4684
|
] })
|
|
4214
4685
|
] }),
|
|
4215
4686
|
GROUPS.map((group) => {
|
|
4216
4687
|
const grouped = entries.filter((entry) => entry.kind === group.kind);
|
|
4217
4688
|
if (!grouped.length) return null;
|
|
4218
|
-
return /* @__PURE__ */ (0,
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("section", { className: "uix-diff-viewer__group", "aria-labelledby": `${id}-${group.kind}`, children: [
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("h3", { id: `${id}-${group.kind}`, children: [
|
|
4220
4691
|
group.label,
|
|
4221
4692
|
" ",
|
|
4222
|
-
/* @__PURE__ */ (0,
|
|
4693
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { children: grouped.length })
|
|
4223
4694
|
] }),
|
|
4224
4695
|
grouped.map((entry) => {
|
|
4225
4696
|
const resolution = resolutions[entry.path] ?? "pending";
|
|
4226
|
-
return /* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4228
|
-
/* @__PURE__ */ (0,
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("details", { className: "uix-diff-viewer__entry", "data-kind": entry.kind, open: entry.kind === "conflicted", children: [
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("summary", { children: [
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("code", { children: entry.path }),
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StatusPill, { tone: resolution === "pending" ? "warning" : "success", children: resolution })
|
|
4230
4701
|
] }),
|
|
4231
|
-
/* @__PURE__ */ (0,
|
|
4232
|
-
/* @__PURE__ */ (0,
|
|
4233
|
-
/* @__PURE__ */ (0,
|
|
4702
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uix-diff-viewer__versions", children: ["base", "current", "incoming"].map((version) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "region", "aria-label": `${labels[version] ?? `${version[0].toUpperCase()}${version.slice(1)}`} value for ${entry.path}`, children: [
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("strong", { children: labels[version] ?? `${version[0].toUpperCase()}${version.slice(1)}` }),
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("pre", { children: renderValue(entry[version]) })
|
|
4234
4705
|
] }, version)) }),
|
|
4235
|
-
/* @__PURE__ */ (0,
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4237
|
-
/* @__PURE__ */ (0,
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uix-diff-viewer__actions", "aria-label": `Resolve ${entry.path}`, children: [
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary uix-btn--sm", "aria-pressed": resolution === "accept", onClick: () => resolve2(entry.path, "accept"), children: "Accept incoming" }),
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", "aria-pressed": resolution === "skip", onClick: () => resolve2(entry.path, "skip"), children: "Keep current" }),
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", "aria-pressed": resolution === "pending", onClick: () => resolve2(entry.path, "pending"), children: "Mark pending" })
|
|
4239
4710
|
] })
|
|
4240
4711
|
] }, entry.path);
|
|
4241
4712
|
})
|
|
4242
4713
|
] }, group.kind);
|
|
4243
4714
|
}),
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("p", { className: "uix-visually-hidden", "aria-live": "polite", children: [
|
|
4245
4716
|
summary.resolved,
|
|
4246
4717
|
" of ",
|
|
4247
4718
|
entries.length,
|
|
@@ -4253,19 +4724,24 @@ function DiffViewer({
|
|
|
4253
4724
|
0 && (module.exports = {
|
|
4254
4725
|
Alert,
|
|
4255
4726
|
AppShell,
|
|
4727
|
+
AsyncOperationStatus,
|
|
4256
4728
|
Avatar,
|
|
4257
4729
|
AvatarGroup,
|
|
4258
4730
|
BrandProfileEditor,
|
|
4259
4731
|
BrandProfiles,
|
|
4732
|
+
Breadcrumbs,
|
|
4260
4733
|
BuilderCanvas,
|
|
4261
4734
|
BulkBar,
|
|
4262
4735
|
Button,
|
|
4263
4736
|
ButtonGroup,
|
|
4264
4737
|
Card,
|
|
4738
|
+
CardLink,
|
|
4265
4739
|
CellStrong,
|
|
4266
4740
|
CellSub,
|
|
4267
4741
|
Checkbox,
|
|
4742
|
+
CollapsibleSection,
|
|
4268
4743
|
ColorPicker,
|
|
4744
|
+
Combobox,
|
|
4269
4745
|
CommandGroup,
|
|
4270
4746
|
CommandItem,
|
|
4271
4747
|
CommandPalette,
|
|
@@ -4273,12 +4749,14 @@ function DiffViewer({
|
|
|
4273
4749
|
Comments,
|
|
4274
4750
|
Composer,
|
|
4275
4751
|
ComposerBar,
|
|
4752
|
+
ConfirmDialog,
|
|
4276
4753
|
ContentList,
|
|
4277
4754
|
ContentListItem,
|
|
4278
4755
|
DateRangePicker,
|
|
4279
4756
|
DescriptionItem,
|
|
4280
4757
|
DescriptionList,
|
|
4281
4758
|
DetailLayout,
|
|
4759
|
+
DetailPage,
|
|
4282
4760
|
DiffViewer,
|
|
4283
4761
|
Drawer,
|
|
4284
4762
|
EmptyState,
|
|
@@ -4289,6 +4767,9 @@ function DiffViewer({
|
|
|
4289
4767
|
FeaturedRundownItem,
|
|
4290
4768
|
FeaturedStage,
|
|
4291
4769
|
Field,
|
|
4770
|
+
FilterPopover,
|
|
4771
|
+
FilteredEmptyState,
|
|
4772
|
+
ForbiddenState,
|
|
4292
4773
|
Highlighted,
|
|
4293
4774
|
Inbox,
|
|
4294
4775
|
InboxDetail,
|
|
@@ -4313,6 +4794,7 @@ function DiffViewer({
|
|
|
4313
4794
|
NavGroup,
|
|
4314
4795
|
NavItem,
|
|
4315
4796
|
NewsLead,
|
|
4797
|
+
NotFoundState,
|
|
4316
4798
|
Note,
|
|
4317
4799
|
NoticeQueue,
|
|
4318
4800
|
PageHeader,
|
|
@@ -4321,14 +4803,18 @@ function DiffViewer({
|
|
|
4321
4803
|
Peek,
|
|
4322
4804
|
Popover,
|
|
4323
4805
|
Progress,
|
|
4806
|
+
PromptDialog,
|
|
4324
4807
|
Prose,
|
|
4325
4808
|
Radio,
|
|
4326
4809
|
RadioGroup,
|
|
4810
|
+
RelatedLinks,
|
|
4327
4811
|
RelationshipGraph,
|
|
4812
|
+
RelativeTime,
|
|
4328
4813
|
ResourceGrid,
|
|
4329
4814
|
RowAction,
|
|
4330
4815
|
RowActions,
|
|
4331
4816
|
RuleBuilder,
|
|
4817
|
+
SavedViewMenu,
|
|
4332
4818
|
SchedulingCalendar,
|
|
4333
4819
|
SectionHead,
|
|
4334
4820
|
Segmented,
|
|
@@ -4356,10 +4842,12 @@ function DiffViewer({
|
|
|
4356
4842
|
TimelineItem,
|
|
4357
4843
|
Toast,
|
|
4358
4844
|
Toaster,
|
|
4845
|
+
ToggleRow,
|
|
4359
4846
|
Tooltip,
|
|
4360
4847
|
Tr,
|
|
4361
4848
|
Tree,
|
|
4362
4849
|
UserChip,
|
|
4850
|
+
ViewMenu,
|
|
4363
4851
|
addCalendarDays,
|
|
4364
4852
|
addCalendarMonths,
|
|
4365
4853
|
appendRuleNode,
|
|
@@ -4374,6 +4862,7 @@ function DiffViewer({
|
|
|
4374
4862
|
contrastRatio,
|
|
4375
4863
|
cx,
|
|
4376
4864
|
enumerateDateSpan,
|
|
4865
|
+
filterComboboxOptions,
|
|
4377
4866
|
findRuleNodeDepth,
|
|
4378
4867
|
flattenTree,
|
|
4379
4868
|
hexToRgb,
|
|
@@ -4392,9 +4881,11 @@ function DiffViewer({
|
|
|
4392
4881
|
multiSort,
|
|
4393
4882
|
nextSortDir,
|
|
4394
4883
|
normalizeHex,
|
|
4884
|
+
parseDateValue,
|
|
4395
4885
|
parseMetricValue,
|
|
4396
4886
|
parseView,
|
|
4397
4887
|
relationshipNeighbors,
|
|
4888
|
+
relativeTimeValue,
|
|
4398
4889
|
removeRuleNode,
|
|
4399
4890
|
reorder,
|
|
4400
4891
|
restoreBrandProfile,
|