@persona/design-system 0.10.12 → 0.10.14
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/CHANGELOG.md +41 -0
- package/dist/{CheckboxGroupField-XSVAmESI.d.mts → CheckboxGroupField-tBvP22Bo.d.mts} +2 -2
- package/dist/CheckboxGroupField.d.mts +1 -1
- package/dist/{Combobox-BNjYEAmv.mjs → Combobox-DmFQ5cAy.mjs} +63 -51
- package/dist/Combobox-DmFQ5cAy.mjs.map +1 -0
- package/dist/{Combobox-DbcSss15.d.mts → Combobox-RX4DfO5L.d.mts} +3 -3
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-CrFweFGi.d.mts → ComboboxBase-VIGR58Uc.d.mts} +2 -2
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-Cp5GBGQj.d.mts → ComboboxMultiSelect-D5TWGGKZ.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-u7fK3Yvy.d.mts → ComboboxSingleSelect-D9It8t6W.d.mts} +3 -3
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/{CompactBar-BLZZWtIE.d.mts → CompactBar-tNtY2EhN.d.mts} +2 -2
- package/dist/CompactBar.d.mts +1 -1
- package/dist/{ControlBar-B3Jn8G0k.d.mts → ControlBar-CDb6b1_6.d.mts} +5 -3
- package/dist/ControlBar.d.mts +1 -1
- package/dist/{DataTable-C1mdfmQa.d.mts → DataTable-0nhT5_Fe.d.mts} +31 -7
- package/dist/{DataTable-DdSY9mzT.mjs → DataTable-6t5ryaEq.mjs} +146 -77
- package/dist/DataTable-6t5ryaEq.mjs.map +1 -0
- package/dist/DataTable.d.mts +1 -1
- package/dist/{DatePicker-DiilpYQg.mjs → DatePicker-CHVYVKB-.mjs} +2 -2
- package/dist/{DatePicker-DiilpYQg.mjs.map → DatePicker-CHVYVKB-.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +1 -1
- package/dist/{DropdownMenu-CQR0U-zM.d.mts → DropdownMenu-Db6N6ZNB.d.mts} +2 -2
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{FloatingActionBar-BUgSKimy.d.mts → FloatingActionBar-CfgjHs81.d.mts} +5 -1
- package/dist/FloatingActionBar.d.mts +1 -1
- package/dist/{FormField-yYJFkJ6R.mjs → FormField-BfVrDOY0.mjs} +4 -4
- package/dist/{FormField-yYJFkJ6R.mjs.map → FormField-BfVrDOY0.mjs.map} +1 -1
- package/dist/{HoverCopyableField-X2XfKTTh.mjs → HoverCopyableField-CJ_p3llp.mjs} +2 -2
- package/dist/{HoverCopyableField-X2XfKTTh.mjs.map → HoverCopyableField-CJ_p3llp.mjs.map} +1 -1
- package/dist/IndexTableLayout.d.mts +3 -3
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Link-B29ZMN6m.mjs → Link-Df3zJrj2.mjs} +1 -1
- package/dist/{Link-B29ZMN6m.mjs.map → Link-Df3zJrj2.mjs.map} +1 -1
- package/dist/{ListBox-4rTgr3IJ.mjs → ListBox-BRgjgUSp.mjs} +2 -2
- package/dist/{ListBox-4rTgr3IJ.mjs.map → ListBox-BRgjgUSp.mjs.map} +1 -1
- package/dist/{ListBox-ZDaitaXR.d.mts → ListBox-l47zUDj4.d.mts} +2 -2
- package/dist/ListBox.d.mts +1 -1
- package/dist/{ListBoxField-CGvVWKyL.d.mts → ListBoxField-Di_6uD3S.d.mts} +4 -4
- package/dist/ListBoxField.d.mts +1 -1
- package/dist/{LogicRow-Bzp5o1sL.d.mts → LogicRow-7f17CKrW.d.mts} +2 -2
- package/dist/LogicRow.d.mts +1 -1
- package/dist/MaskedInput.d.mts +1 -1
- package/dist/{Menu-DviYNrFd.d.mts → Menu-DvzoR8e7.d.mts} +2 -2
- package/dist/Menu.d.mts +1 -1
- package/dist/{Modal-CiPFqr0L.mjs → Modal-C_vSgqgl.mjs} +20 -16
- package/dist/Modal-C_vSgqgl.mjs.map +1 -0
- package/dist/{Modal-CujB7DuB.d.mts → Modal-IVXc4p8Y.d.mts} +7 -2
- package/dist/Modal.d.mts +1 -1
- package/dist/{Pii-jSYND7Cn.mjs → Pii-BYPkrBuT.mjs} +1 -1
- package/dist/{Pii-jSYND7Cn.mjs.map → Pii-BYPkrBuT.mjs.map} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs → Popover-DP9DXReH.mjs} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs.map → Popover-DP9DXReH.mjs.map} +1 -1
- package/dist/{Select-DsVeAyZy.d.mts → Select-boZ6XP8k.d.mts} +2 -2
- package/dist/Select.d.mts +1 -1
- package/dist/SmartTextInputField.d.mts +2 -2
- package/dist/SmartTextInputListbox.d.mts +8 -3
- package/dist/{TableBox-D9NA-s9l.mjs → TableBox-RxpwflEb.mjs} +3 -3
- package/dist/{TableBox-D9NA-s9l.mjs.map → TableBox-RxpwflEb.mjs.map} +1 -1
- package/dist/TableBox.d.mts +1 -1
- package/dist/{TableBoxCell-CQOL30et.d.mts → TableBoxCell-B6Z23mby.d.mts} +4 -4
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/{TableBoxField-z0GIFeQw.d.mts → TableBoxField-6qAOW8t9.d.mts} +5 -5
- package/dist/TableBoxField.d.mts +1 -1
- package/dist/{TableBoxRow-tb9-KMr9.d.mts → TableBoxRow-CpgNWdLS.d.mts} +2 -2
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-BZwulsFP.d.mts → TableBoxRowActions-BDx5naRj.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableControls-DE6eHq8h.d.mts → TableControls-BGKL7_zF.d.mts} +4 -4
- package/dist/{TableControls-BXykbUBf.mjs → TableControls-BwZl4TjJ.mjs} +31 -12
- package/dist/TableControls-BwZl4TjJ.mjs.map +1 -0
- package/dist/TableControls.d.mts +1 -1
- package/dist/{TableControlsContext-C2_2EuMh.d.mts → TableControlsContext-DhABbtVY.d.mts} +2 -2
- package/dist/TableControlsContext.d.mts +1 -1
- package/dist/{TableViewConfigurationDropdown-DE9HFXYY.d.mts → TableViewConfigurationDropdown-D76ApJ_-.d.mts} +2 -2
- package/dist/TableViewConfigurationDropdown.d.mts +1 -1
- package/dist/WizardModal.d.mts +1 -1
- package/dist/{clientFilterUtils-2TBUC31K.d.mts → clientFilterUtils-WH_Dqtv4.d.mts} +2 -2
- package/dist/clientFilterUtils.d.mts +1 -1
- package/dist/components/Combobox/index.d.mts +4 -4
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/DataTable/TableControls/index.d.mts +7 -7
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.d.mts +6 -6
- package/dist/components/DataTable/index.mjs +1 -1
- package/dist/components/DataTable/types.d.mts +1 -1
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/FormField/index.d.mts +4 -4
- package/dist/components/FormField/index.mjs +1 -1
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/Link/index.mjs +1 -1
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Modal/index.d.mts +1 -1
- package/dist/components/Modal/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/Popover/index.mjs +1 -1
- package/dist/components/RichTextEditor/index.mjs +2 -2
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/SmartTextInput/index.mjs +128 -59
- package/dist/components/SmartTextInput/index.mjs.map +1 -1
- package/dist/components/TableBox/index.d.mts +1 -1
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/VersionHistory/index.mjs +1 -1
- package/dist/fieldPickerOptions.d.mts +1 -1
- package/dist/{filters-DW7pqWv3.d.mts → filters-BXtKuft3.d.mts} +2 -2
- package/dist/filters.d.mts +1 -1
- package/dist/{helpers-BTD2kXLs.d.mts → helpers-gpO42h8t.d.mts} +5 -3
- package/dist/helpers.d.mts +1 -1
- package/dist/{index-B4tE0RxY.d.mts → index-bkzLg85W.d.mts} +3 -3
- package/dist/{inputFields-DnBb3NhK.d.mts → inputFields-B7parF2l.d.mts} +4 -4
- package/dist/inputFields.d.mts +1 -1
- package/dist/lib/PDSProvider.d.mts +2 -1
- package/dist/lib/PDSProvider.mjs +8 -3
- package/dist/lib/PDSProvider.mjs.map +1 -1
- package/dist/lib/colorMode.d.mts +18 -7
- package/dist/lib/colorMode.mjs +47 -13
- package/dist/lib/colorMode.mjs.map +1 -1
- package/dist/lib/schemaOptions.mjs +1 -1
- package/dist/lib/schemaOptions.mjs.map +1 -1
- package/dist/patterns/IndexTableLayout/index.mjs +1 -1
- package/dist/patterns/WizardModal/index.mjs +1 -1
- package/dist/{types-NO2GRlM-.d.mts → types-BvaXqjUm.d.mts} +2 -2
- package/dist/{types-Dws2XDz2.d.mts → types-CuH-sUJ2.d.mts} +6 -4
- package/dist/types5.d.mts +1 -1
- package/dist/useColumnConfiguration.d.mts +2 -2
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/{useTableColumns-tITjHasE.d.mts → useTableColumns-I7StvoRs.d.mts} +17 -2
- package/dist/useTableColumns.d.mts +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/dist/utils4.d.mts +1 -1
- package/dist/withDisabledReason.d.mts +19 -0
- package/llms.txt +4 -3
- package/package.json +4 -12
- package/skills/ui-authoring/COMPONENTS.md +0 -1
- package/skills/ui-authoring/PATTERNS.md +0 -64
- package/skills/ui-authoring/TOKENS.md +14 -25
- package/dist/ChartFrame.d.mts +0 -61
- package/dist/ChartLegend.d.mts +0 -60
- package/dist/ChartPopover.d.mts +0 -155
- package/dist/Combobox-BNjYEAmv.mjs.map +0 -1
- package/dist/DataTable-DdSY9mzT.mjs.map +0 -1
- package/dist/Modal-CiPFqr0L.mjs.map +0 -1
- package/dist/TableControls-BXykbUBf.mjs.map +0 -1
- package/dist/chartColors.d.mts +0 -92
- package/dist/chartFrameLayout.d.mts +0 -46
- package/dist/components/Chart/index.d.mts +0 -9
- package/dist/components/Chart/index.mjs +0 -680
- package/dist/components/Chart/index.mjs.map +0 -1
- package/dist/useChartColors.d.mts +0 -30
- package/dist/useChartSeriesVisibility.d.mts +0 -22
- package/dist/useChartStyles.d.mts +0 -108
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as styled, r as css } from "../../styledComponentsInterop-Cs5CCPRy.mjs";
|
|
2
|
+
import { semanticColor } from "../../lib/semanticColor.mjs";
|
|
2
3
|
import { i as Paragraph } from "../../Text-D0vEReED.mjs";
|
|
3
4
|
import { rotate } from "../../variables/keyframes.mjs";
|
|
4
5
|
import { JsonSchemaStringifiableTypes, getNonNullableRefSchema, getNonNullableType, isFunctionSchema, isJsonSchemaArray, isSchemaTypeAllowed } from "../../lib/jsonSchema.mjs";
|
|
@@ -16,7 +17,7 @@ import { n as Button } from "../../IconButton-Bj1fry_K.mjs";
|
|
|
16
17
|
import { n as useFormField } from "../../useFormField-pOVkb5BK.mjs";
|
|
17
18
|
import Input_default from "../Input/index.mjs";
|
|
18
19
|
import { n as ErrorText } from "../../FormControl-BoKGiWdQ.mjs";
|
|
19
|
-
import { m as FormField, n as TableBoxField, p as splitOutFormFieldProps } from "../../FormField-
|
|
20
|
+
import { m as FormField, n as TableBoxField, p as splitOutFormFieldProps } from "../../FormField-BfVrDOY0.mjs";
|
|
20
21
|
import PillType from "./PillType.mjs";
|
|
21
22
|
import { ErrorMessageByKind, NodeType, isASTChainNode, isASTContainerNode, isMethodChainNode } from "./parser/smart-text/types.mjs";
|
|
22
23
|
import { enclosingExpr, findAll, resolve } from "./parser/tree.mjs";
|
|
@@ -81,7 +82,7 @@ const Overlay = styled.div`
|
|
|
81
82
|
overflow: hidden;
|
|
82
83
|
|
|
83
84
|
${({ $size }) => $size === "sm" && css`
|
|
84
|
-
font-size:
|
|
85
|
+
font-size: ${Typography.TextSmall.fontSize};
|
|
85
86
|
margin: 0 9px;
|
|
86
87
|
`};
|
|
87
88
|
${({ $variant }) => $variant === "table-cell" && css`
|
|
@@ -115,7 +116,7 @@ const MonoSpan = styled.span`
|
|
|
115
116
|
content: '';
|
|
116
117
|
position: absolute;
|
|
117
118
|
inset: -2px;
|
|
118
|
-
background-color: ${Color.CoreRed600};
|
|
119
|
+
background-color: ${({ theme }) => semanticColor(theme, "FeedbackDanger3", Color.CoreRed600)};
|
|
119
120
|
opacity: 0.1;
|
|
120
121
|
pointer-events: none;
|
|
121
122
|
}
|
|
@@ -133,7 +134,7 @@ const MonoSpan = styled.span`
|
|
|
133
134
|
content: '';
|
|
134
135
|
position: absolute;
|
|
135
136
|
inset: -2px;
|
|
136
|
-
background-color: ${Color.CoreBlue600};
|
|
137
|
+
background-color: ${({ theme }) => semanticColor(theme, "FeedbackInfo3", Color.CoreBlue600)};
|
|
137
138
|
opacity: 0.1;
|
|
138
139
|
pointer-events: none;
|
|
139
140
|
}
|
|
@@ -274,6 +275,7 @@ const HighlightedTextOverlay = forwardRef(function HighlightedTextOverlay({ chil
|
|
|
274
275
|
const HighlightedText = ({ value, tree, focused, interactive, schemaValidator, onLinkMouseDown, dontHighlightErrors = false, cursorIdx }) => {
|
|
275
276
|
const runs = buildHighlights(tree, value, focused, schemaValidator);
|
|
276
277
|
const linkMap = /* @__PURE__ */ new Map();
|
|
278
|
+
const paramEntries = /* @__PURE__ */ new Map();
|
|
277
279
|
findAll(tree, NodeType.Chain).forEach((chainNode) => {
|
|
278
280
|
if (!isASTChainNode(chainNode)) return;
|
|
279
281
|
chainNode.children.forEach((link) => {
|
|
@@ -284,7 +286,7 @@ const HighlightedText = ({ value, tree, focused, interactive, schemaValidator, o
|
|
|
284
286
|
});
|
|
285
287
|
if (link.type === NodeType.Function || link.type === NodeType.CustomFunction) {
|
|
286
288
|
if (link.children.some((child) => child.type === NodeType.ParenClose)) {
|
|
287
|
-
for (const child of link.children) if (child.type !== NodeType.Error && child.type !== NodeType.ParenOpen && child.type !== NodeType.ParenClose)
|
|
289
|
+
for (const child of link.children) if (child.type !== NodeType.Error && child.type !== NodeType.ParenOpen && child.type !== NodeType.ParenClose) paramEntries.set(child.start, {
|
|
288
290
|
start: child.start,
|
|
289
291
|
end: child.start
|
|
290
292
|
});
|
|
@@ -293,6 +295,7 @@ const HighlightedText = ({ value, tree, focused, interactive, schemaValidator, o
|
|
|
293
295
|
}
|
|
294
296
|
});
|
|
295
297
|
});
|
|
298
|
+
paramEntries.forEach((entry, start) => linkMap.set(start, entry));
|
|
296
299
|
let pos = 0;
|
|
297
300
|
return /* @__PURE__ */ jsx(Fragment$1, { children: runs.map((r) => {
|
|
298
301
|
const start = pos;
|
|
@@ -402,8 +405,9 @@ const scrollInputToCursor = (inputRef, cursorIdx) => {
|
|
|
402
405
|
* accepted chain roots.
|
|
403
406
|
*/
|
|
404
407
|
const isChainWithValidRoot = (value, chainRoots, { onlyAllowSingleLink = false } = {}) => {
|
|
405
|
-
const
|
|
406
|
-
|
|
408
|
+
const tree = safeParse(value, { startRule: "ChainRoot" });
|
|
409
|
+
const firstChild = (tree.children ?? [])[0];
|
|
410
|
+
return !findAll(tree, NodeType.Error).some((e) => !e.wip) && firstChild != null && firstChild.type === NodeType.Chain && isASTChainNode(firstChild) && chainRoots.some((r) => {
|
|
407
411
|
const firstLink = firstChild.children[0];
|
|
408
412
|
return firstLink != null && isMethodChainNode(firstLink) && r.label === firstLink.name;
|
|
409
413
|
}) && (!onlyAllowSingleLink || firstChild.children.length === 1);
|
|
@@ -462,7 +466,7 @@ const replaceChainAtCursor = (value, valueType, cursorIdx, tree, newChainString)
|
|
|
462
466
|
newCursorIdx: cursorIdx ?? value.length
|
|
463
467
|
};
|
|
464
468
|
const before = value.slice(0, openNode.end);
|
|
465
|
-
const after =
|
|
469
|
+
const after = value.slice(closeNode ? closeNode.start : expr.end);
|
|
466
470
|
return {
|
|
467
471
|
newValue: before + newChainString + after,
|
|
468
472
|
newCursorIdx: before.length + newChainString.length
|
|
@@ -582,7 +586,8 @@ const getConfirmLinkCursorPos = (tree, valueType, currentChain, chain, schema, c
|
|
|
582
586
|
*
|
|
583
587
|
* TODO: Add more sophistication here (e.g. fuzzy matching, etc.)
|
|
584
588
|
*/
|
|
585
|
-
const isQueryMatch = (
|
|
589
|
+
const isQueryMatch = (rawQuery, chain) => {
|
|
590
|
+
const query = rawQuery.toLowerCase();
|
|
586
591
|
const prop = chain.property.toLowerCase();
|
|
587
592
|
if (query.startsWith("@")) return prop.startsWith(query);
|
|
588
593
|
return (prop.startsWith("@") ? prop.slice(1) : prop).startsWith(query);
|
|
@@ -861,6 +866,7 @@ const SmartTextInputPopover = ({ id, children, comboboxState, inputRef, popoverR
|
|
|
861
866
|
$isDialog: isDialog,
|
|
862
867
|
id,
|
|
863
868
|
style: {
|
|
869
|
+
...popoverProps.style,
|
|
864
870
|
zIndex: Z_INDICES.modalDropdown,
|
|
865
871
|
width: popoverWidth
|
|
866
872
|
},
|
|
@@ -951,6 +957,7 @@ const buildTextModeHeading = (nodes) => {
|
|
|
951
957
|
parts.push("String");
|
|
952
958
|
return parts.join(", ");
|
|
953
959
|
};
|
|
960
|
+
const isListboxEmptyState = (collection, mode, isLoading) => [...collection].length === 0 || mode !== "text" && !!isLoading;
|
|
954
961
|
const ListboxOption = ({ item, state }) => {
|
|
955
962
|
const ref = useRef(null);
|
|
956
963
|
const { optionProps, isFocused } = useOption({ key: item.id }, state, ref);
|
|
@@ -1002,44 +1009,59 @@ const ListboxOption = ({ item, state }) => {
|
|
|
1002
1009
|
});
|
|
1003
1010
|
}
|
|
1004
1011
|
};
|
|
1005
|
-
const SmartTextInputListbox = ({ comboboxState, listBoxRef, listBoxProps, mode, isLoading, openCodeChainFunctionPanel }) => {
|
|
1012
|
+
const SmartTextInputListbox = ({ comboboxState, listBoxRef, listBoxProps, mode, isLoading, openCodeChainFunctionPanel, footerButtonId, isFooterHighlighted = false }) => {
|
|
1006
1013
|
const listBox = useListBox({
|
|
1007
1014
|
...listBoxProps,
|
|
1008
1015
|
"aria-label": mode === "text" ? "Context menu" : "Data path options"
|
|
1009
1016
|
}, comboboxState, listBoxRef);
|
|
1010
1017
|
const nodes = [...comboboxState.collection];
|
|
1011
|
-
|
|
1018
|
+
const showEmptyState = isListboxEmptyState(comboboxState.collection, mode, isLoading);
|
|
1019
|
+
const footerButtonRef = useRef(null);
|
|
1020
|
+
useEffect(() => {
|
|
1021
|
+
if (isFooterHighlighted) footerButtonRef.current?.scrollIntoView?.({ block: "nearest" });
|
|
1022
|
+
}, [isFooterHighlighted]);
|
|
1023
|
+
const headings = /* @__PURE__ */ jsxs(Fragment$1, { children: [mode === "method-chain" && nodes[0]?.value?.id !== "exitMethodChainValueType" && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(StyledListboxOption, {
|
|
1024
|
+
$bottomBorder: true,
|
|
1025
|
+
children: /* @__PURE__ */ jsx(OptionLabel, {
|
|
1026
|
+
$heading: true,
|
|
1027
|
+
children: "Data path"
|
|
1028
|
+
})
|
|
1029
|
+
}) }), mode === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(StyledListboxOption, {
|
|
1030
|
+
$bottomBorder: true,
|
|
1031
|
+
children: /* @__PURE__ */ jsx(OptionLabel, {
|
|
1032
|
+
$heading: true,
|
|
1033
|
+
children: buildTextModeHeading(nodes)
|
|
1034
|
+
})
|
|
1035
|
+
}), /* @__PURE__ */ jsx(StyledListboxOption, { children: /* @__PURE__ */ jsx(OptionLabel, {
|
|
1036
|
+
$heading: true,
|
|
1037
|
+
children: "Modes"
|
|
1038
|
+
}) })] })] });
|
|
1039
|
+
const footer = showEmptyState && openCodeChainFunctionPanel ? /* @__PURE__ */ jsx(FooterContainer, { children: /* @__PURE__ */ jsx(Button, {
|
|
1040
|
+
ref: footerButtonRef,
|
|
1041
|
+
id: footerButtonId,
|
|
1042
|
+
role: "option",
|
|
1043
|
+
"aria-selected": isFooterHighlighted,
|
|
1044
|
+
type: "button",
|
|
1045
|
+
tabIndex: -1,
|
|
1046
|
+
variant: "basic",
|
|
1047
|
+
size: "sm",
|
|
1048
|
+
active: isFooterHighlighted,
|
|
1049
|
+
onClick: openCodeChainFunctionPanel,
|
|
1050
|
+
children: "Create custom chain"
|
|
1051
|
+
}) }) : null;
|
|
1052
|
+
const listBoxElement = showEmptyState ? /* @__PURE__ */ jsx(StyledListBox, {
|
|
1012
1053
|
ref: listBoxRef,
|
|
1013
1054
|
...listBox.listBoxProps,
|
|
1014
|
-
children:
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
mode === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(StyledListboxOption, {
|
|
1023
|
-
$bottomBorder: true,
|
|
1024
|
-
children: /* @__PURE__ */ jsx(OptionLabel, {
|
|
1025
|
-
$heading: true,
|
|
1026
|
-
children: buildTextModeHeading(nodes)
|
|
1027
|
-
})
|
|
1028
|
-
}), /* @__PURE__ */ jsx(StyledListboxOption, { children: /* @__PURE__ */ jsx(OptionLabel, {
|
|
1029
|
-
$heading: true,
|
|
1030
|
-
children: "Modes"
|
|
1031
|
-
}) })] }),
|
|
1032
|
-
nodes.length === 0 || mode !== "text" && isLoading ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(EmptyOptionList, { children: "No options available" }), openCodeChainFunctionPanel && /* @__PURE__ */ jsx(FooterContainer, { children: /* @__PURE__ */ jsx(Button, {
|
|
1033
|
-
variant: "basic",
|
|
1034
|
-
size: "sm",
|
|
1035
|
-
onClick: openCodeChainFunctionPanel,
|
|
1036
|
-
children: "Create custom chain"
|
|
1037
|
-
}) })] }) : nodes.map((node) => node.value ? /* @__PURE__ */ jsx(ListboxOption, {
|
|
1038
|
-
item: node.value,
|
|
1039
|
-
state: comboboxState
|
|
1040
|
-
}, node.key) : null)
|
|
1041
|
-
]
|
|
1055
|
+
children: footer
|
|
1056
|
+
}) : /* @__PURE__ */ jsxs(StyledListBox, {
|
|
1057
|
+
ref: listBoxRef,
|
|
1058
|
+
...listBox.listBoxProps,
|
|
1059
|
+
children: [headings, nodes.map((node) => node.value ? /* @__PURE__ */ jsx(ListboxOption, {
|
|
1060
|
+
item: node.value,
|
|
1061
|
+
state: comboboxState
|
|
1062
|
+
}, node.key) : null)]
|
|
1042
1063
|
});
|
|
1064
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [showEmptyState && /* @__PURE__ */ jsxs(Fragment$1, { children: [headings, /* @__PURE__ */ jsx(EmptyOptionList, { children: "No options available" })] }), listBoxElement] });
|
|
1043
1065
|
};
|
|
1044
1066
|
//#endregion
|
|
1045
1067
|
//#region src/components/SmartTextInput/useChainAtCursor.ts
|
|
@@ -1091,7 +1113,10 @@ function extractChainContextAtCursor(tree, cursorIdx, valueType, assumeOnNextLin
|
|
|
1091
1113
|
}
|
|
1092
1114
|
if (!shouldInclude) {
|
|
1093
1115
|
cutoffIdx = i;
|
|
1094
|
-
if (!assumeOnNextLink && link.start < idx)
|
|
1116
|
+
if (!assumeOnNextLink && link.start < idx) {
|
|
1117
|
+
const linkText = link.type === NodeType.CustomFunction ? `@${link.name}` : link.name;
|
|
1118
|
+
partialQuery = linkText.slice(0, Math.min(idx - link.start, linkText.length));
|
|
1119
|
+
}
|
|
1095
1120
|
break;
|
|
1096
1121
|
}
|
|
1097
1122
|
}
|
|
@@ -1372,12 +1397,12 @@ const StyledInput = styled(Input_default)`
|
|
|
1372
1397
|
overflow: hidden;
|
|
1373
1398
|
|
|
1374
1399
|
${({ size }) => size === "sm" && css`
|
|
1375
|
-
font-size:
|
|
1400
|
+
font-size: ${Typography.TextSmall.fontSize};
|
|
1376
1401
|
`}
|
|
1377
1402
|
${({ $variant }) => $variant === "table-cell" && css`
|
|
1378
1403
|
border: none;
|
|
1379
1404
|
padding: 0;
|
|
1380
|
-
height:
|
|
1405
|
+
height: ${Typography.TextSmall.lineHeight};
|
|
1381
1406
|
border-radius: 0;
|
|
1382
1407
|
`}
|
|
1383
1408
|
`;
|
|
@@ -1399,18 +1424,15 @@ const getInitialValueType = (chainRoots, initialValue, allowedValueType) => {
|
|
|
1399
1424
|
* Smart text input for configuring access to data, interpolated strings, or inline code.
|
|
1400
1425
|
*/
|
|
1401
1426
|
const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueType, allowedInterpolationModes, chainRoots, platformObjectJsonSchema, defaultPrimitiveUtilities, codeChainFunctionSchema, useChainRootDescriptions = false, primitivesSchema = "default", isLoading = false, portalContainerRef, getSchemaOptionsOverride, creatable = false, renderFunctionForm, renderCustomFunctionDetail, renderCodeChainFunctionPanel, canCreateCodeChainFunction = false, sortOptionsBy, onValidationChange, contextMenuExamples, popoverFooter, id, placeholder = "Select or type", disabled = false, size = "md", variant = "default", ...props }) => {
|
|
1402
|
-
const lastNotifiedValueRef = useRef(passedValue ?? "");
|
|
1403
1427
|
const [value, setValue] = useState(passedValue ?? "");
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
}, [passedValue]);
|
|
1428
|
+
const [valueType, setValueType] = useState(getInitialValueType(chainRoots, passedValue, allowedValueType));
|
|
1429
|
+
const lastNotifiedRef = useRef({
|
|
1430
|
+
value: passedValue ?? "",
|
|
1431
|
+
valueType
|
|
1432
|
+
});
|
|
1410
1433
|
const onChangeRef = useRef(onChange);
|
|
1411
1434
|
onChangeRef.current = onChange;
|
|
1412
1435
|
const [cursorIdx, setCursor] = useState(null);
|
|
1413
|
-
const [valueType, setValueType] = useState(getInitialValueType(chainRoots, passedValue, allowedValueType));
|
|
1414
1436
|
const [assumeOnNextLinkState, setAssumeOnNextLink] = useState(false);
|
|
1415
1437
|
const [forceFunctionDialog, setForceFunctionDialog] = useState(false);
|
|
1416
1438
|
const inputRef = useRef(null);
|
|
@@ -1463,14 +1485,30 @@ const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueT
|
|
|
1463
1485
|
}
|
|
1464
1486
|
});
|
|
1465
1487
|
useEffect(() => {
|
|
1466
|
-
if (value ===
|
|
1467
|
-
|
|
1488
|
+
if (value === lastNotifiedRef.current.value && valueType === lastNotifiedRef.current.valueType) return;
|
|
1489
|
+
lastNotifiedRef.current = {
|
|
1490
|
+
value,
|
|
1491
|
+
valueType
|
|
1492
|
+
};
|
|
1468
1493
|
onChangeRef.current?.(value, {
|
|
1469
1494
|
valueType,
|
|
1470
1495
|
schema: resolveSchema(value),
|
|
1471
1496
|
ast: tree
|
|
1472
1497
|
});
|
|
1473
|
-
}, [value]);
|
|
1498
|
+
}, [value, valueType]);
|
|
1499
|
+
useEffect(() => {
|
|
1500
|
+
if (passedValue !== void 0 && passedValue !== lastNotifiedRef.current.value) {
|
|
1501
|
+
setValue(passedValue);
|
|
1502
|
+
setValueType(getInitialValueType(chainRoots, passedValue, allowedValueType));
|
|
1503
|
+
lastNotifiedRef.current = {
|
|
1504
|
+
...lastNotifiedRef.current,
|
|
1505
|
+
value: passedValue
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
}, [passedValue]);
|
|
1509
|
+
useEffect(() => {
|
|
1510
|
+
if (allowedValueType != null) setValueType(allowedValueType);
|
|
1511
|
+
}, [allowedValueType]);
|
|
1474
1512
|
const functionAtCursor = getFunctionAtCursor(tree, cursorIdx, valueType);
|
|
1475
1513
|
const popupMode = functionAtCursor != null && (functionAtCursor.cursorInParens || forceFunctionDialog) ? "function-dialog" : mode === "code" ? "code-dialog" : "listbox";
|
|
1476
1514
|
const comboboxItems = useMemo(() => {
|
|
@@ -1729,6 +1767,19 @@ const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueT
|
|
|
1729
1767
|
});
|
|
1730
1768
|
const showFunctionDialog = popupMode === "function-dialog" && comboboxState.isOpen;
|
|
1731
1769
|
const showCodeDialog = popupMode === "code-dialog" && comboboxState.isOpen;
|
|
1770
|
+
const openCustomChainPanel = openCcfPanel ? () => openCcfPanel({
|
|
1771
|
+
initialName: query,
|
|
1772
|
+
inputSchema: currentSchema
|
|
1773
|
+
}) : void 0;
|
|
1774
|
+
const customChainButtonId = `${id}__create-custom-chain`;
|
|
1775
|
+
const showCustomChainFooter = openCustomChainPanel != null && comboboxState.isOpen && !showFunctionDialog && !showCodeDialog && isListboxEmptyState(comboboxState.collection, mode, isLoading);
|
|
1776
|
+
const [isCustomChainHighlighted, setIsCustomChainHighlighted] = useState(false);
|
|
1777
|
+
useEffect(() => {
|
|
1778
|
+
if (!showCustomChainFooter) setIsCustomChainHighlighted(false);
|
|
1779
|
+
}, [showCustomChainFooter]);
|
|
1780
|
+
useEffect(() => {
|
|
1781
|
+
setIsCustomChainHighlighted(false);
|
|
1782
|
+
}, [value]);
|
|
1732
1783
|
const popoverFooterRendered = useMemo(() => {
|
|
1733
1784
|
return popoverFooter == null ? void 0 : popoverFooter({ closePopover() {
|
|
1734
1785
|
comboboxState.setOpen(false);
|
|
@@ -1767,6 +1818,26 @@ const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueT
|
|
|
1767
1818
|
dialogFocusRef.current?.focusFirst();
|
|
1768
1819
|
return;
|
|
1769
1820
|
}
|
|
1821
|
+
if (showCustomChainFooter) {
|
|
1822
|
+
if (e.key === "ArrowDown") {
|
|
1823
|
+
e.preventDefault();
|
|
1824
|
+
e.stopPropagation();
|
|
1825
|
+
setIsCustomChainHighlighted(true);
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
if (e.key === "ArrowUp") {
|
|
1829
|
+
e.preventDefault();
|
|
1830
|
+
e.stopPropagation();
|
|
1831
|
+
setIsCustomChainHighlighted(false);
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
if (e.key === "Enter" && isCustomChainHighlighted) {
|
|
1835
|
+
e.preventDefault();
|
|
1836
|
+
e.stopPropagation();
|
|
1837
|
+
openCustomChainPanel?.();
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1770
1841
|
inputProps.onKeyDown?.(e);
|
|
1771
1842
|
}
|
|
1772
1843
|
}, {
|
|
@@ -1880,6 +1951,7 @@ const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueT
|
|
|
1880
1951
|
disabled,
|
|
1881
1952
|
size,
|
|
1882
1953
|
$variant: variant,
|
|
1954
|
+
"aria-activedescendant": isCustomChainHighlighted ? customChainButtonId : inputProps["aria-activedescendant"],
|
|
1883
1955
|
"aria-haspopup": popupMode === "function-dialog" || popupMode === "code-dialog" ? "dialog" : inputProps["aria-haspopup"],
|
|
1884
1956
|
...suppressPopover ? { "aria-expanded": false } : {}
|
|
1885
1957
|
})
|
|
@@ -1916,12 +1988,9 @@ const SmartTextInput = ({ value: passedValue, onChange, valueType: allowedValueT
|
|
|
1916
1988
|
listBoxProps: combobox.listBoxProps,
|
|
1917
1989
|
mode,
|
|
1918
1990
|
isLoading,
|
|
1919
|
-
openCodeChainFunctionPanel:
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
inputSchema: currentSchema
|
|
1923
|
-
});
|
|
1924
|
-
} : void 0
|
|
1991
|
+
openCodeChainFunctionPanel: openCustomChainPanel,
|
|
1992
|
+
footerButtonId: customChainButtonId,
|
|
1993
|
+
isFooterHighlighted: isCustomChainHighlighted
|
|
1925
1994
|
})
|
|
1926
1995
|
})]
|
|
1927
1996
|
}), renderCcfPanel()] });
|