@adaptabletools/adaptable 24.0.0 → 24.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devtools.d.ts +13 -0
- package/index.css +76 -76
- package/package.json +1 -1
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +3 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +15 -7
- package/src/Utilities/Services/QueryLanguageService.js +1 -1
- package/src/agGrid/AdaptableAgGrid.js +22 -31
- package/src/env.js +2 -2
- package/src/migration/VersionUpgrade24.d.ts +44 -9
- package/src/migration/VersionUpgrade24.js +97 -25
- package/src/migration/legacyPredicateLowering.d.ts +1 -1
- package/src/migration/legacyPredicateLowering.js +2 -0
- package/src/migration/predicateExpressionMigration.d.ts +49 -12
- package/src/migration/predicateExpressionMigration.js +141 -10
- package/src/setupDevTools.js +106 -170
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/aql/api/QueryLanguageApi.d.ts +2 -1
- package/vendor/aql/api/QueryLanguageApi.d.ts.map +1 -1
- package/vendor/aql/api/QueryLanguageApi.js +28 -108
- package/vendor/aql/api/QueryLanguageApi.js.map +1 -1
- package/vendor/aql/contract/index.js +0 -34
- package/vendor/aql/contract/index.js.map +1 -1
- package/vendor/aql/corpus/corpusExpressions.js +0 -13
- package/vendor/aql/corpus/corpusExpressions.js.map +1 -1
- package/vendor/aql/corpus/corpusFixture.js +0 -7
- package/vendor/aql/corpus/corpusFixture.js.map +1 -1
- package/vendor/aql/draft/index.js +0 -4
- package/vendor/aql/draft/index.js.map +1 -1
- package/vendor/aql/evaluate.js +0 -22
- package/vendor/aql/evaluate.js.map +1 -1
- package/vendor/aql/evaluator/ExpressionEvaluationError.js +0 -4
- package/vendor/aql/evaluator/ExpressionEvaluationError.js.map +1 -1
- package/vendor/aql/evaluator/ExpressionNaError.js +0 -4
- package/vendor/aql/evaluator/ExpressionNaError.js.map +1 -1
- package/vendor/aql/evaluator/evaluateNode.js +0 -23
- package/vendor/aql/evaluator/evaluateNode.js.map +1 -1
- package/vendor/aql/functions/dateUtils.js +0 -63
- package/vendor/aql/functions/dateUtils.js.map +1 -1
- package/vendor/aql/functions/numberUtils.js +0 -12
- package/vendor/aql/functions/numberUtils.js.map +1 -1
- package/vendor/aql/functions/operatorFunctions.js +0 -13
- package/vendor/aql/functions/operatorFunctions.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/AND.js +0 -5
- package/vendor/aql/functions/scalar/functions/AND.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ANY_CHANGE.js +0 -4
- package/vendor/aql/functions/scalar/functions/ANY_CHANGE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ANY_CONTAINS.js +0 -4
- package/vendor/aql/functions/scalar/functions/ANY_CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/AVG.js +0 -1
- package/vendor/aql/functions/scalar/functions/AVG.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/CASE.js +2 -2
- package/vendor/aql/functions/scalar/functions/CASE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/COL.js +0 -2
- package/vendor/aql/functions/scalar/functions/COL.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/CONTAINS.js +0 -3
- package/vendor/aql/functions/scalar/functions/CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/DATE.js +0 -2
- package/vendor/aql/functions/scalar/functions/DATE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ENDS_WITH.js +0 -1
- package/vendor/aql/functions/scalar/functions/ENDS_WITH.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/EQ.js +0 -5
- package/vendor/aql/functions/scalar/functions/EQ.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/GT.js +0 -3
- package/vendor/aql/functions/scalar/functions/GT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/GTE.js +0 -3
- package/vendor/aql/functions/scalar/functions/GTE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IF.js +0 -5
- package/vendor/aql/functions/scalar/functions/IF.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IFERROR.js +0 -4
- package/vendor/aql/functions/scalar/functions/IFERROR.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IFNA.js +0 -5
- package/vendor/aql/functions/scalar/functions/IFNA.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IN.d.ts.map +1 -1
- package/vendor/aql/functions/scalar/functions/IN.js +54 -11
- package/vendor/aql/functions/scalar/functions/IN.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_BLANK.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_BLANK.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_DIFFERENT_DAY.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_DIFFERENT_DAY.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_NOT_BLANK.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_NOT_BLANK.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/LT.js +0 -3
- package/vendor/aql/functions/scalar/functions/LT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/LTE.js +0 -3
- package/vendor/aql/functions/scalar/functions/LTE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NA.js +0 -3
- package/vendor/aql/functions/scalar/functions/NA.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NOT_CONTAINS.js +0 -1
- package/vendor/aql/functions/scalar/functions/NOT_CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NOT_IN.js +0 -3
- package/vendor/aql/functions/scalar/functions/NOT_IN.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/OR.js +0 -4
- package/vendor/aql/functions/scalar/functions/OR.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/PRODUCT.js +0 -6
- package/vendor/aql/functions/scalar/functions/PRODUCT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/QUERY.js +0 -1
- package/vendor/aql/functions/scalar/functions/QUERY.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/REGEX.js +0 -1
- package/vendor/aql/functions/scalar/functions/REGEX.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SCOPE.js +0 -4
- package/vendor/aql/functions/scalar/functions/SCOPE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/STARTS_WITH.js +0 -1
- package/vendor/aql/functions/scalar/functions/STARTS_WITH.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SUB.js +0 -1
- package/vendor/aql/functions/scalar/functions/SUB.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SUM.js +0 -5
- package/vendor/aql/functions/scalar/functions/SUM.js.map +1 -1
- package/vendor/aql/functions/scalar/helpers.js +0 -3
- package/vendor/aql/functions/scalar/helpers.js.map +1 -1
- package/vendor/aql/functions/shared/FIELD.js +0 -3
- package/vendor/aql/functions/shared/FIELD.js.map +1 -1
- package/vendor/aql/functions/shared/VAR.js +0 -4
- package/vendor/aql/functions/shared/VAR.js.map +1 -1
- package/vendor/aql/functions/shared/index.js +0 -9
- package/vendor/aql/functions/shared/index.js.map +1 -1
- package/vendor/aql/functions/stringUtils.js +0 -25
- package/vendor/aql/functions/stringUtils.js.map +1 -1
- package/vendor/aql/functions/utils.js +0 -20
- package/vendor/aql/functions/utils.js.map +1 -1
- package/vendor/aql/host/access.js +0 -2
- package/vendor/aql/host/access.js.map +1 -1
- package/vendor/aql/host/createHostExpressionContext.js +0 -25
- package/vendor/aql/host/createHostExpressionContext.js.map +1 -1
- package/vendor/aql/host/createObjectDataHost.js +0 -9
- package/vendor/aql/host/createObjectDataHost.js.map +1 -1
- package/vendor/aql/index.js +0 -2
- package/vendor/aql/index.js.map +1 -1
- package/vendor/aql/normalize/canonicalize.js +0 -7
- package/vendor/aql/normalize/canonicalize.js.map +1 -1
- package/vendor/aql/normalize/migrateExpression.js +0 -8
- package/vendor/aql/normalize/migrateExpression.js.map +1 -1
- package/vendor/aql/normalize/names.js +0 -72
- package/vendor/aql/normalize/names.js.map +1 -1
- package/vendor/aql/normalize/normalizeAst.js +0 -102
- package/vendor/aql/normalize/normalizeAst.js.map +1 -1
- package/vendor/aql/normalize/print.js +0 -35
- package/vendor/aql/normalize/print.js.map +1 -1
- package/vendor/aql/operator/primitiveSlots.js +0 -4
- package/vendor/aql/operator/primitiveSlots.js.map +1 -1
- package/vendor/aql/operator/resolve.js +0 -18
- package/vendor/aql/operator/resolve.js.map +1 -1
- package/vendor/aql/parser/parser.js +4 -125
- package/vendor/aql/parser/parser.js.map +1 -1
- package/vendor/aql/plan/catalogue.js +0 -35
- package/vendor/aql/plan/catalogue.js.map +1 -1
- package/vendor/aql/plan/compile.js +0 -68
- package/vendor/aql/plan/compile.js.map +1 -1
- package/vendor/aql/plan/deepMap.js +0 -16
- package/vendor/aql/plan/deepMap.js.map +1 -1
- package/vendor/aql/plan/execute.js +0 -91
- package/vendor/aql/plan/execute.js.map +1 -1
- package/vendor/aql/plan/magnitudeLiteral.js +0 -29
- package/vendor/aql/plan/magnitudeLiteral.js.map +1 -1
- package/vendor/aql/plan/observable.js +0 -31
- package/vendor/aql/plan/observable.js.map +1 -1
- package/vendor/aql/plan/observableFixture.js +0 -3
- package/vendor/aql/plan/observableFixture.js.map +1 -1
- package/vendor/aql/plan/operators.js +0 -35
- package/vendor/aql/plan/operators.js.map +1 -1
- package/vendor/aql/plan/outer.js +0 -16
- package/vendor/aql/plan/outer.js.map +1 -1
- package/vendor/aql/predicate/mapExpressionToQlPredicate.js +1 -46
- package/vendor/aql/predicate/mapExpressionToQlPredicate.js.map +1 -1
- package/vendor/aql/predicate/mapQlPredicateToExpression.js +0 -13
- package/vendor/aql/predicate/mapQlPredicateToExpression.js.map +1 -1
- package/vendor/aql/store/computedValueStore.js +0 -35
- package/vendor/aql/store/computedValueStore.js.map +1 -1
- package/vendor/aql/store/history/clock.js +0 -1
- package/vendor/aql/store/history/clock.js.map +1 -1
- package/vendor/aql/store/history/historyStore.js +0 -14
- package/vendor/aql/store/history/historyStore.js.map +1 -1
- package/vendor/aql/store/history/monotonicDeque.js +0 -9
- package/vendor/aql/store/history/monotonicDeque.js.map +1 -1
- package/vendor/aql/store/history/operators.js +0 -13
- package/vendor/aql/store/history/operators.js.map +1 -1
- package/vendor/aql/store/history/ringBuffer.js +0 -12
- package/vendor/aql/store/history/ringBuffer.js.map +1 -1
- package/vendor/aql/store/history/rowSeries.js +0 -17
- package/vendor/aql/store/history/rowSeries.js.map +1 -1
- package/vendor/aql/store/history/types.js +0 -18
- package/vendor/aql/store/history/types.js.map +1 -1
- package/vendor/aql/tokenizer/tokenizer.js +0 -3
- package/vendor/aql/tokenizer/tokenizer.js.map +1 -1
- package/vendor/aql/types.js +0 -27
- package/vendor/aql/types.js.map +1 -1
- package/vendor/aql/utils/astUtils.js +0 -1
- package/vendor/aql/utils/astUtils.js.map +1 -1
- package/vendor/aql/utils/dependencyCycle.js +0 -5
- package/vendor/aql/utils/dependencyCycle.js.map +1 -1
- package/vendor/aql/validation/classifyExpression.js +0 -4
- package/vendor/aql/validation/classifyExpression.js.map +1 -1
- package/vendor/aql/validation/functionMetadata.js +0 -31
- package/vendor/aql/validation/functionMetadata.js.map +1 -1
- package/vendor/aql/validation/validateAqlExpression.js +2 -81
- package/vendor/aql/validation/validateAqlExpression.js.map +1 -1
- package/vendor/aql/validation/validateExpressionTypes.js +0 -64
- package/vendor/aql/validation/validateExpressionTypes.js.map +1 -1
- package/vendor/components/Button/index.js +0 -6
- package/vendor/components/Button/index.js.map +1 -1
- package/vendor/components/ColorField/index.js +0 -18
- package/vendor/components/ColorField/index.js.map +1 -1
- package/vendor/components/ColorPicker/colorPickerTab.js +0 -6
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -1
- package/vendor/components/ColorPicker/index.js +1 -66
- package/vendor/components/ColorPicker/index.js.map +1 -1
- package/vendor/components/ColorPicker/themeColors.js +0 -55
- package/vendor/components/ColorPicker/themeColors.js.map +1 -1
- package/vendor/components/Combobox/VirtualizedList.js +0 -5
- package/vendor/components/Combobox/VirtualizedList.js.map +1 -1
- package/vendor/components/Combobox/comboboxUtils.js +0 -5
- package/vendor/components/Combobox/comboboxUtils.js.map +1 -1
- package/vendor/components/Combobox/index.js +7 -106
- package/vendor/components/Combobox/index.js.map +1 -1
- package/vendor/components/Combobox/useScrollNearEnd.js +0 -6
- package/vendor/components/Combobox/useScrollNearEnd.js.map +1 -1
- package/vendor/components/DropdownButton/index.js +0 -5
- package/vendor/components/DropdownButton/index.js.map +1 -1
- package/vendor/components/NumberInput/index.js +0 -10
- package/vendor/components/NumberInput/index.js.map +1 -1
- package/vendor/components/Resizable/index.js +3 -26
- package/vendor/components/Resizable/index.js.map +1 -1
- package/vendor/components/Resizable/resizableUtils.js +0 -24
- package/vendor/components/Resizable/resizableUtils.js.map +1 -1
- package/vendor/components/SearchInput/index.js +0 -5
- package/vendor/components/SearchInput/index.js.map +1 -1
- package/vendor/components/Tree/TreeDropdown/index.js +3 -139
- package/vendor/components/Tree/TreeDropdown/index.js.map +1 -1
- package/vendor/components/Tree/treeUtils.js +0 -4
- package/vendor/components/Tree/treeUtils.js.map +1 -1
- package/vendor/components/index.css +71 -71
- package/vendor/components/index.js +0 -5
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/lib/useProperty.js +0 -18
- package/vendor/components/lib/useProperty.js.map +1 -1
- package/vendor/components/twMerge.js +0 -2
- package/vendor/components/twMerge.js.map +1 -1
- package/vendor/components/twUtils.js +3 -12
- package/vendor/components/twUtils.js.map +1 -1
- package/vendor/components/ui/alert-dialog.js +0 -4
- package/vendor/components/ui/alert-dialog.js.map +1 -1
- package/vendor/components/ui/calendar.js +1 -9
- package/vendor/components/ui/calendar.js.map +1 -1
- package/vendor/components/ui/combobox.js +2 -38
- package/vendor/components/ui/combobox.js.map +1 -1
- package/vendor/components/ui/dialog.js +0 -4
- package/vendor/components/ui/dialog.js.map +1 -1
- package/vendor/components/ui/input-group.js +3 -12
- package/vendor/components/ui/input-group.js.map +1 -1
- package/vendor/components/ui/tabs.js +0 -3
- package/vendor/components/ui/tabs.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/NumberInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AA2B3B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/NumberInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AA2B3B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;AAGzE,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,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QAAQ,KAAG,GACK,GACH,IACP,CACd,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -5,9 +5,7 @@ import { computeResize, isFixedSize, normalizeSizes, } from './resizableUtils';
|
|
|
5
5
|
const KEYBOARD_RESIZE_STEP = 10;
|
|
6
6
|
const ResizableContext = React.createContext(null);
|
|
7
7
|
export function ResizablePanel({ className, ...props }) {
|
|
8
|
-
return (_jsx("div", { "data-slot": "resizable-panel",
|
|
9
|
-
// Flex container so the panel's content stretches to fill it by default.
|
|
10
|
-
className: cn('twa:flex twa:overflow-hidden', className), ...props }));
|
|
8
|
+
return (_jsx("div", { "data-slot": "resizable-panel", className: cn('twa:flex twa:overflow-hidden', className), ...props }));
|
|
11
9
|
}
|
|
12
10
|
export function ResizableHandle({ withHandle, gripClassName, draggingClassName, constrainedClassName, className, ...props }) {
|
|
13
11
|
const context = React.useContext(ResizableContext);
|
|
@@ -15,21 +13,9 @@ export function ResizableHandle({ withHandle, gripClassName, draggingClassName,
|
|
|
15
13
|
throw new Error('ResizableHandle must be rendered inside <Resizable>');
|
|
16
14
|
}
|
|
17
15
|
const { horizontal, handleState, separatorProps } = context;
|
|
18
|
-
return (_jsx("div", { role: "separator", "aria-label": "Resize panels", tabIndex: 0, "data-slot": "resizable-handle", "data-state": handleState, "aria-orientation": horizontal ? 'vertical' : 'horizontal', ...props, ...separatorProps, className: cn('twa:relative twa:flex twa:w-px twa:items-center twa:justify-center twa:bg-border twa:ring-offset-background twa:after:absolute twa:after:inset-y-0 twa:after:left-1/2 twa:after:w-1 twa:after:-translate-x-1/2 twa:focus-visible:ring-1 twa:focus-visible:ring-ring twa:focus-visible:outline-hidden twa:aria-[orientation=horizontal]:h-px twa:aria-[orientation=horizontal]:w-full',
|
|
19
|
-
// Horizontal separator: the ::after bar spans the width and is centered
|
|
20
|
-
// vertically. `inset-y-0` above would pin it to the top once it has an
|
|
21
|
-
// explicit height, so re-anchor it at 50% and let the translate center it.
|
|
22
|
-
'twa:aria-[orientation=horizontal]:after:inset-x-0 twa:aria-[orientation=horizontal]:after:top-1/2 twa:aria-[orientation=horizontal]:after:bottom-auto twa:aria-[orientation=horizontal]:after:h-1 twa:aria-[orientation=horizontal]:after:w-full twa:aria-[orientation=horizontal]:after:translate-x-0 twa:aria-[orientation=horizontal]:after:-translate-y-1/2 twa:[&[aria-orientation=horizontal]>div]:rotate-90', 'twa:shrink-0 twa:touch-none twa:select-none', horizontal ? 'twa:cursor-col-resize' : 'twa:cursor-row-resize',
|
|
23
|
-
// Default feedback colors the 1px line and the grip — never the
|
|
24
|
-
// widened ::after hit area, so the line doesn't get thicker.
|
|
25
|
-
// Omitted when a custom class is provided so a plain `twa:bg-*`
|
|
26
|
-
// (already generated) can win without `!important` or extra variants.
|
|
27
|
-
!draggingClassName &&
|
|
16
|
+
return (_jsx("div", { role: "separator", "aria-label": "Resize panels", tabIndex: 0, "data-slot": "resizable-handle", "data-state": handleState, "aria-orientation": horizontal ? 'vertical' : 'horizontal', ...props, ...separatorProps, className: cn('twa:relative twa:flex twa:w-px twa:items-center twa:justify-center twa:bg-border twa:ring-offset-background twa:after:absolute twa:after:inset-y-0 twa:after:left-1/2 twa:after:w-1 twa:after:-translate-x-1/2 twa:focus-visible:ring-1 twa:focus-visible:ring-ring twa:focus-visible:outline-hidden twa:aria-[orientation=horizontal]:h-px twa:aria-[orientation=horizontal]:w-full', 'twa:aria-[orientation=horizontal]:after:inset-x-0 twa:aria-[orientation=horizontal]:after:top-1/2 twa:aria-[orientation=horizontal]:after:bottom-auto twa:aria-[orientation=horizontal]:after:h-1 twa:aria-[orientation=horizontal]:after:w-full twa:aria-[orientation=horizontal]:after:translate-x-0 twa:aria-[orientation=horizontal]:after:-translate-y-1/2 twa:[&[aria-orientation=horizontal]>div]:rotate-90', 'twa:shrink-0 twa:touch-none twa:select-none', horizontal ? 'twa:cursor-col-resize' : 'twa:cursor-row-resize', !draggingClassName &&
|
|
28
17
|
'twa:data-[state=dragging]:bg-accent twa:data-[state=dragging]:[&>div]:bg-accent', !constrainedClassName &&
|
|
29
|
-
'twa:data-[state=constrained]:bg-destructive twa:data-[state=constrained]:[&>div]:bg-destructive', className, handleState === 'dragging' && draggingClassName, handleState === 'constrained' && constrainedClassName), children: withHandle && (
|
|
30
|
-
// Absolutely centered on the 1px line (flex centering leaves it 1px
|
|
31
|
-
// off because the 4px grip can't center inside a 1px flex row).
|
|
32
|
-
_jsx("div", { className: cn('twa:absolute twa:left-1/2 twa:top-1/2 twa:z-10 twa:h-6 twa:w-1 twa:-translate-x-1/2 twa:-translate-y-1/2 twa:rounded-lg twa:bg-border', gripClassName) })) }));
|
|
18
|
+
'twa:data-[state=constrained]:bg-destructive twa:data-[state=constrained]:[&>div]:bg-destructive', className, handleState === 'dragging' && draggingClassName, handleState === 'constrained' && constrainedClassName), children: withHandle && (_jsx("div", { className: cn('twa:absolute twa:left-1/2 twa:top-1/2 twa:z-10 twa:h-6 twa:w-1 twa:-translate-x-1/2 twa:-translate-y-1/2 twa:rounded-lg twa:bg-border', gripClassName) })) }));
|
|
33
19
|
}
|
|
34
20
|
function panelSizeStyle(value, horizontal) {
|
|
35
21
|
const { minSize, maxSize } = value;
|
|
@@ -54,14 +40,10 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
54
40
|
const previousBodyUserSelectRef = React.useRef(null);
|
|
55
41
|
const isControlled = size !== undefined;
|
|
56
42
|
const [uncontrolledSizes, setUncontrolledSizes] = React.useState(() => normalizeSizes(defaultSize));
|
|
57
|
-
// Live sizes while a drag is in progress (committed on drop).
|
|
58
43
|
const [transient, setTransient] = React.useState(null);
|
|
59
44
|
const committedSizes = isControlled ? normalizeSizes(size) : uncontrolledSizes;
|
|
60
45
|
const sizes = transient?.sizes ?? committedSizes;
|
|
61
46
|
const horizontal = orientation === 'horizontal';
|
|
62
|
-
// Selecting text mid-drag looks broken; disable selection document-wide for
|
|
63
|
-
// the duration of the drag (the pointer routinely leaves the container).
|
|
64
|
-
// The previous inline values are saved and restored on drop.
|
|
65
47
|
const disableBodyUserSelect = () => {
|
|
66
48
|
if (previousBodyUserSelectRef.current) {
|
|
67
49
|
return;
|
|
@@ -69,7 +51,6 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
69
51
|
const bodyStyle = document.body.style;
|
|
70
52
|
previousBodyUserSelectRef.current = {
|
|
71
53
|
userSelect: bodyStyle.userSelect,
|
|
72
|
-
// Safari needs the prefixed property.
|
|
73
54
|
webkitUserSelect: bodyStyle.webkitUserSelect,
|
|
74
55
|
};
|
|
75
56
|
bodyStyle.userSelect = 'none';
|
|
@@ -89,7 +70,6 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
89
70
|
return () => {
|
|
90
71
|
restoreBodyUserSelect();
|
|
91
72
|
};
|
|
92
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
73
|
}, []);
|
|
94
74
|
const measurePanels = () => {
|
|
95
75
|
const container = containerRef.current;
|
|
@@ -122,7 +102,6 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
122
102
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
123
103
|
}
|
|
124
104
|
catch {
|
|
125
|
-
// Synthetic pointer events (tests) have no active pointer to capture.
|
|
126
105
|
}
|
|
127
106
|
disableBodyUserSelect();
|
|
128
107
|
dragRef.current = {
|
|
@@ -131,7 +110,6 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
131
110
|
startPixels,
|
|
132
111
|
lastSizes: null,
|
|
133
112
|
};
|
|
134
|
-
// Active from pointer down, not from the first moved pixel.
|
|
135
113
|
setTransient({ sizes: committedSizes, clamped: false });
|
|
136
114
|
};
|
|
137
115
|
const onPointerMove = (event) => {
|
|
@@ -165,7 +143,6 @@ export function Resizable({ orientation = 'horizontal', size, defaultSize, onSiz
|
|
|
165
143
|
if (!drag || event.pointerId !== drag.pointerId) {
|
|
166
144
|
return;
|
|
167
145
|
}
|
|
168
|
-
// Aborted gesture: revert to the committed sizes.
|
|
169
146
|
dragRef.current = null;
|
|
170
147
|
setTransient(null);
|
|
171
148
|
restoreBodyUserSelect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Resizable/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,sCAAsC,CAAC;AAE1D,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAI1B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAgBhC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAC;AAIjF,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAuB;IACzE,OAAO,CACL,2BACY,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Resizable/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,sCAAsC,CAAC;AAE1D,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAI1B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAgBhC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAC;AAIjF,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAuB;IACzE,OAAO,CACL,2BACY,iBAAiB,EAE3B,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE,SAAS,CAAC,KACpD,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAgBD,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT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,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC5C,eACE,GAAG,EAAE,YAAY,eACP,uBAAuB,gBACrB,WAAW,EACvB,SAAS,EAAE,EAAE,CAAC,gCAAgC,EAAE,CAAC,UAAU,IAAI,cAAc,EAAE,SAAS,CAAC,KACrF,IAAI,aAEP,WAAW,CAAC,CAAC,CAAC,EACd,WAAW,IAAI,KAAC,eAAe,KAAG,EAClC,WAAW,CAAC,CAAC,CAAC,IACX,GACoB,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -4,34 +4,18 @@ export function isFixedSize(value) {
|
|
|
4
4
|
export function isFlexSize(value) {
|
|
5
5
|
return value != null && 'flex' in value;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Missing entries default to `{ flex: 1 }` — so a single `{ size }` entry
|
|
9
|
-
* pairs with a flexible panel that takes the remaining space.
|
|
10
|
-
*/
|
|
11
7
|
export function normalizeSizes(input) {
|
|
12
8
|
const [first, second] = input ?? [];
|
|
13
9
|
return [first ?? { flex: 1 }, second ?? { flex: 1 }];
|
|
14
10
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Core resize computation.
|
|
17
|
-
*
|
|
18
|
-
* - a `{ size }` panel stays a fixed panel (with the new pixel size), and its
|
|
19
|
-
* `{ flex }` sibling keeps its flex value untouched;
|
|
20
|
-
* - when both panels are flex, the flexes are re-expressed as the actual pixel
|
|
21
|
-
* sizes (e.g. total 250 dragged to 143 -> flexes 143 / 107), so persisting
|
|
22
|
-
* and later restoring the sizes reproduces the exact same layout.
|
|
23
|
-
*/
|
|
24
11
|
export function computeResize({ sizes, startPixels, delta, }) {
|
|
25
12
|
const total = startPixels[0] + startPixels[1];
|
|
26
13
|
const [first, second] = sizes;
|
|
27
|
-
// Bounds for the first panel; the second panel's constraints translate into
|
|
28
|
-
// bounds on the first one since the pair always fills the total size.
|
|
29
14
|
const lowerBound = Math.max(first.minSize ?? 0, total - (second.maxSize ?? Infinity));
|
|
30
15
|
const upperBound = Math.min(first.maxSize ?? Infinity, total - (second.minSize ?? 0));
|
|
31
16
|
const requested = startPixels[0] + delta;
|
|
32
17
|
let firstPixels;
|
|
33
18
|
if (lowerBound > upperBound) {
|
|
34
|
-
// Conflicting constraints: don't move.
|
|
35
19
|
firstPixels = startPixels[0];
|
|
36
20
|
}
|
|
37
21
|
else {
|
|
@@ -44,12 +28,6 @@ export function computeResize({ sizes, startPixels, delta, }) {
|
|
|
44
28
|
clamped: firstPixels !== requested,
|
|
45
29
|
};
|
|
46
30
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Re-expresses the given pixel sizes as size definitions, preserving each
|
|
49
|
-
* panel's fixed/flex kind and its `minSize`/`maxSize` constraints (see
|
|
50
|
-
* `computeResize`). Values are rounded to whole pixels so persisted sizes
|
|
51
|
-
* stay clean.
|
|
52
|
-
*/
|
|
53
31
|
export function sizesForPixels(sizes, pixels) {
|
|
54
32
|
const [first, second] = sizes;
|
|
55
33
|
const [firstPixels, secondPixels] = [
|
|
@@ -58,8 +36,6 @@ export function sizesForPixels(sizes, pixels) {
|
|
|
58
36
|
];
|
|
59
37
|
const forPanel = (value, panelPixels) => isFixedSize(value) ? { ...value, size: panelPixels } : value;
|
|
60
38
|
if (isFlexSize(first) && isFlexSize(second)) {
|
|
61
|
-
// Both flex: pixel-valued flexes render the same proportions and are
|
|
62
|
-
// stable to persist/restore.
|
|
63
39
|
return [
|
|
64
40
|
{ ...first, flex: firstPixels },
|
|
65
41
|
{ ...second, flex: secondPixels },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizableUtils.js","sourceRoot":"","sources":["../../src/Resizable/resizableUtils.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,WAAW,CACzB,KAAiC;IAEjC,OAAO,KAAK,IAAI,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,KAAiC;IAEjC,OAAO,KA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AAM,EAAE,YAAY,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -2,11 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { SearchIcon, XIcon } from 'lucide-react';
|
|
4
4
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from '../ui/input-group';
|
|
5
|
-
/**
|
|
6
|
-
* A search text input with a leading search icon and a trailing clear button
|
|
7
|
-
* (matching the `SingleCombobox` clear). Supports controlled (`value` +
|
|
8
|
-
* `onValueChange`) and uncontrolled (`defaultValue`) modes.
|
|
9
|
-
*/
|
|
10
5
|
export const SearchInput = React.forwardRef(function SearchInput({ value: controlledValue, defaultValue, onValueChange, onChange, searchIcon = true, clearIcon = true, className, inputClassName, ...inputProps }, ref) {
|
|
11
6
|
const isControlled = controlledValue !== undefined;
|
|
12
7
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue ?? '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SearchInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SearchInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAmC3B,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU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BAAkB,GAAmB,CAAC,CAAC,CAAC,IAAI,EACpF,KAAC,eAAe,IACd,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;oBAClB,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC,EACD,SAAS,EAAE,cAAc,KACrB,UAAU,GACd,EACD,iBAAiB,IAAI,KAAK,CAAC,CAAC,CAAC,CAC5B,KAAC,eAAe,IAAC,KAAK,EAAC,YAAY,YACjC,KAAC,gBAAgB,IACf,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,SAAS,EACd,SAAS,EAAC,iBAAiB,gBAChB,OAAO,eACR,oBAAoB,EAC9B,OAAO,EAAE,GAAG,EAAE;wBACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;wBACb,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;oBAC5B,CAAC,YAEA,iBAAiB,GACD,GACH,CACnB,CAAC,CAAC,CAAC,IAAI,IACG,CACd,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -38,8 +38,6 @@ function flattenOptions(options, primaryKey, labelField, parentPath = [], result
|
|
|
38
38
|
function TreeItemLabel(props) {
|
|
39
39
|
const { node, isExpanded, onToggleExpand, selected, reserveExpandSpace } = props;
|
|
40
40
|
const handleChevronMouseDown = (e) => {
|
|
41
|
-
// Prevent the combobox from stealing focus or treating the chevron click
|
|
42
|
-
// as a selection toggle on the row.
|
|
43
41
|
e.preventDefault();
|
|
44
42
|
e.stopPropagation();
|
|
45
43
|
};
|
|
@@ -48,26 +46,16 @@ function TreeItemLabel(props) {
|
|
|
48
46
|
e.stopPropagation();
|
|
49
47
|
onToggleExpand(node.path);
|
|
50
48
|
};
|
|
51
|
-
// These elements are rendered as `children` of the `ComboboxItem`, which is
|
|
52
|
-
// a flex container. The built-in indicator is suppressed via
|
|
53
|
-
// `renderCheckboxIndicator` on the list, so we render our own tri-state checkbox
|
|
54
|
-
// at `order: 0` (middle). Chevron goes before (`-1`), label after (`1`).
|
|
55
|
-
// Rendering the indicator here lets it reflect `null`/indeterminate state
|
|
56
|
-
// that base-ui's boolean indicator can't.
|
|
57
49
|
const indent = node.depth > 0 ? `calc(${node.depth} * var(--ab-tree-indent-size))` : 0;
|
|
58
50
|
const iconProps = {
|
|
59
51
|
className: 'twa:size-4',
|
|
60
52
|
};
|
|
61
|
-
return (_jsxs(_Fragment, { children: [node.hasChildren ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": isExpanded ? 'Collapse' : 'Expand', "data-name": "expand-collapse-icon", onMouseDown: handleChevronMouseDown, onClick: handleChevronClick, style: { order: -1, marginLeft: indent }, className: cn(
|
|
62
|
-
// Prefixed Tailwind has no unprefixed button reset — kill native chrome.
|
|
63
|
-
'twa:appearance-none twa:border-0 twa:bg-transparent twa:p-0 twa:shadow-none twa:outline-none', 'twa:inline-flex twa:size-4 twa:shrink-0 twa:items-center twa:justify-center twa:rounded', 'twa:text-foreground twa:cursor-pointer'), children: isExpanded ? _jsx(ChevronDownIcon, { ...iconProps }) : _jsx(ChevronRightIcon, { ...iconProps }) })) : reserveExpandSpace ? (_jsx("span", { "aria-hidden": "true", style: { order: -1, marginLeft: indent }, className: "twa:inline-block twa:size-4 twa:shrink-0" })) : null, _jsx(CheckBox, { checked: selected, checkSquareClassName: cn(selected === true && 'twa:ring-1 twa:ring-accent-foreground') }), _jsx("span", { className: "twa:truncate twa:min-w-0 twa:flex-1", children: node.label })] }));
|
|
53
|
+
return (_jsxs(_Fragment, { children: [node.hasChildren ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": isExpanded ? 'Collapse' : 'Expand', "data-name": "expand-collapse-icon", onMouseDown: handleChevronMouseDown, onClick: handleChevronClick, style: { order: -1, marginLeft: indent }, className: cn('twa:appearance-none twa:border-0 twa:bg-transparent twa:p-0 twa:shadow-none twa:outline-none', 'twa:inline-flex twa:size-4 twa:shrink-0 twa:items-center twa:justify-center twa:rounded', 'twa:text-foreground twa:cursor-pointer'), children: isExpanded ? _jsx(ChevronDownIcon, { ...iconProps }) : _jsx(ChevronRightIcon, { ...iconProps }) })) : reserveExpandSpace ? (_jsx("span", { "aria-hidden": "true", style: { order: -1, marginLeft: indent }, className: "twa:inline-block twa:size-4 twa:shrink-0" })) : null, _jsx(CheckBox, { checked: selected, checkSquareClassName: cn(selected === true && 'twa:ring-1 twa:ring-accent-foreground') }), _jsx("span", { className: "twa:truncate twa:min-w-0 twa:flex-1", children: node.label })] }));
|
|
64
54
|
}
|
|
65
55
|
export function TreeDropdown(props) {
|
|
66
56
|
const { isLoading = false } = props;
|
|
67
57
|
const labelField = (props.labelField ?? 'label');
|
|
68
58
|
const primaryKey = (props.primaryKey ?? 'id');
|
|
69
|
-
// Walk the tree once to get every node. This is independent of expand and
|
|
70
|
-
// selection state, so it only recomputes when the options change.
|
|
71
59
|
const allNodes = useMemo(() => {
|
|
72
60
|
return flattenOptions(props.items, primaryKey, labelField);
|
|
73
61
|
}, [props.items, primaryKey, labelField]);
|
|
@@ -78,20 +66,12 @@ export function TreeDropdown(props) {
|
|
|
78
66
|
}
|
|
79
67
|
return map;
|
|
80
68
|
}, [allNodes]);
|
|
81
|
-
// All paths in the tree, used to configure TreeSelectionState so it can
|
|
82
|
-
// resolve tri-state selection across branches.
|
|
83
69
|
const treePaths = useMemo(() => allNodes.map((n) => n.path), [allNodes]);
|
|
84
|
-
// --- Selection state (backed by TreeSelectionStateObject) ----------------
|
|
85
70
|
const [internalSelection, setInternalSelection] = useState(() => ({
|
|
86
71
|
defaultSelection: false,
|
|
87
72
|
selectedPaths: normalizePaths(props.value ?? props.defaultValue),
|
|
88
73
|
deselectedPaths: [],
|
|
89
74
|
}));
|
|
90
|
-
// When used in controlled mode, sync external value into internal state
|
|
91
|
-
// whenever the caller swaps the reference. We compare against the last
|
|
92
|
-
// `value` we observed (captured in a state-paired variable, as recommended
|
|
93
|
-
// for derived-from-props state) so we don't fight the caller on every
|
|
94
|
-
// re-render while still ignoring our own onChange-driven updates.
|
|
95
75
|
const [lastPropsValue, setLastPropsValue] = useState(props.value);
|
|
96
76
|
if (props.value !== undefined && props.value !== lastPropsValue) {
|
|
97
77
|
setLastPropsValue(props.value);
|
|
@@ -107,7 +87,6 @@ export function TreeDropdown(props) {
|
|
|
107
87
|
strictCheckPaths: false,
|
|
108
88
|
});
|
|
109
89
|
}, [internalSelection, treePaths]);
|
|
110
|
-
// --- Expand state (backed by TreeExpandStateObject) ----------------------
|
|
111
90
|
const [internalExpand, setInternalExpand] = useState(() => ({
|
|
112
91
|
defaultExpanded: false,
|
|
113
92
|
expandedPaths: [],
|
|
@@ -121,13 +100,7 @@ export function TreeDropdown(props) {
|
|
|
121
100
|
next.setNodeExpanded(path, !next.isNodeExpanded(path));
|
|
122
101
|
setInternalExpand(next.getState());
|
|
123
102
|
}, [internalExpand]);
|
|
124
|
-
// Precompute branch nodes once so the Expand All / Collapse All toggle
|
|
125
|
-
// can decide which action to offer without walking the tree on every render.
|
|
126
103
|
const branchNodes = useMemo(() => allNodes.filter((n) => n.hasChildren), [allNodes]);
|
|
127
|
-
// The toggle acts as "Collapse all" whenever *anything* is expanded, so a
|
|
128
|
-
// single click after a partial expand (e.g. branches opened by a search)
|
|
129
|
-
// collapses the whole tree. Only when every branch is already collapsed
|
|
130
|
-
// does the toggle switch to "Expand all".
|
|
131
104
|
const anyBranchExpanded = useMemo(() => {
|
|
132
105
|
for (const n of branchNodes) {
|
|
133
106
|
if (expandState.isNodeExpanded(n.path)) {
|
|
@@ -146,18 +119,7 @@ export function TreeDropdown(props) {
|
|
|
146
119
|
}
|
|
147
120
|
setInternalExpand(next.getState());
|
|
148
121
|
}, [internalExpand, anyBranchExpanded]);
|
|
149
|
-
// --- Search state --------------------------------------------------------
|
|
150
|
-
// We track the search query ourselves so a query change can drive expand
|
|
151
|
-
// state updates: when the user types, every branch on the path to a match
|
|
152
|
-
// (and every branch within a matching subtree) is force-expanded so the
|
|
153
|
-
// matches surface in the items list. The user can then collapse a branch
|
|
154
|
-
// mid-search to hide that subtree again — and the next keystroke
|
|
155
|
-
// re-expands everything matching, restoring the full filtered view.
|
|
156
122
|
const [searchQuery, setSearchQuery] = useState('');
|
|
157
|
-
// Set of pathKeys for every node that either matches the query or is an
|
|
158
|
-
// ancestor of a matching node. Used by the filter callback so an ancestor
|
|
159
|
-
// whose own label doesn't match still passes when one of its descendants
|
|
160
|
-
// matches.
|
|
161
123
|
const matchAncestorKeys = useMemo(() => {
|
|
162
124
|
if (!searchQuery) {
|
|
163
125
|
return null;
|
|
@@ -173,11 +135,6 @@ export function TreeDropdown(props) {
|
|
|
173
135
|
}
|
|
174
136
|
return keys;
|
|
175
137
|
}, [allNodes, searchQuery]);
|
|
176
|
-
// Expand every branch needed to display the current search's matches.
|
|
177
|
-
// Called from the search input's onChange (so it's tied to user typing,
|
|
178
|
-
// not to incidental re-renders) and only mutates expand state when there
|
|
179
|
-
// is something new to expand — leaving any branches the user collapsed
|
|
180
|
-
// mid-search untouched until the next keystroke.
|
|
181
138
|
const expandPathsForQuery = useCallback((query) => {
|
|
182
139
|
if (!query) {
|
|
183
140
|
return;
|
|
@@ -201,10 +158,6 @@ export function TreeDropdown(props) {
|
|
|
201
158
|
next.setNodeExpanded(node.path, true);
|
|
202
159
|
mutated = true;
|
|
203
160
|
}
|
|
204
|
-
// allNodes is in depth-first order, so descendants of `node` are the
|
|
205
|
-
// contiguous run of nodes with depth > node.depth that immediately
|
|
206
|
-
// follow it. Walk that run and force every nested branch open so the
|
|
207
|
-
// entire matching subtree (not just its first level) is visible.
|
|
208
161
|
for (let j = i + 1; j < allNodes.length; j++) {
|
|
209
162
|
const desc = allNodes[j];
|
|
210
163
|
if (desc.depth <= node.depth) {
|
|
@@ -224,22 +177,6 @@ export function TreeDropdown(props) {
|
|
|
224
177
|
setSearchQuery(value);
|
|
225
178
|
expandPathsForQuery(value);
|
|
226
179
|
}, [expandPathsForQuery]);
|
|
227
|
-
// --- Combobox items & value ---------------------------------------------
|
|
228
|
-
// Only nodes whose ancestors are currently expanded are surfaced to the
|
|
229
|
-
// combobox. base-ui's `filter` prop is skipped when the search query is
|
|
230
|
-
// empty (it shows every item verbatim), so collapsing a branch has to be
|
|
231
|
-
// reflected directly in the items array rather than via a filter callback.
|
|
232
|
-
//
|
|
233
|
-
// Search doesn't override the items list directly. Instead, typing in the
|
|
234
|
-
// search input expands every branch on the path to (and inside) any match
|
|
235
|
-
// via `expandPathsForQuery`, which makes the matches part of `items`
|
|
236
|
-
// naturally. Collapsing a branch mid-search hides that subtree again, even
|
|
237
|
-
// if it contains matches — until the next keystroke re-expands everything.
|
|
238
|
-
//
|
|
239
|
-
// If no item anywhere in the tree has children (equivalent to "no top-level
|
|
240
|
-
// item has children", since deeper branches can only exist under a
|
|
241
|
-
// branching root), the tree is flat and leaf rows don't need to reserve
|
|
242
|
-
// space for a chevron placeholder.
|
|
243
180
|
const reserveExpandSpace = branchNodes.length > 0;
|
|
244
181
|
const items = useMemo(() => {
|
|
245
182
|
const visible = [];
|
|
@@ -255,9 +192,6 @@ export function TreeDropdown(props) {
|
|
|
255
192
|
continue;
|
|
256
193
|
}
|
|
257
194
|
const isExpanded = expandState.isNodeExpanded(node.path);
|
|
258
|
-
// Read tri-state from TreeSelectionState so branches with partial
|
|
259
|
-
// selection render the indeterminate state (base-ui's built-in
|
|
260
|
-
// indicator, suppressed via `renderCheckboxIndicator`, only knows boolean).
|
|
261
195
|
const selected = selectionState.isNodeSelected(node.path);
|
|
262
196
|
visible.push({
|
|
263
197
|
value: node.pathKey,
|
|
@@ -271,17 +205,6 @@ export function TreeDropdown(props) {
|
|
|
271
205
|
}
|
|
272
206
|
return visible;
|
|
273
207
|
}, [allNodes, expandState, toggleExpand, selectionState, reserveExpandSpace]);
|
|
274
|
-
// Combobox `value` is the set of path keys for currently-visible nodes that
|
|
275
|
-
// are fully selected (`TreeSelectionState.isNodeSelected(path) === true`).
|
|
276
|
-
//
|
|
277
|
-
// IMPORTANT: this must only contain *visible* items. Base-ui's combobox
|
|
278
|
-
// filters `value` through its `itemByValue` map (built from visible items),
|
|
279
|
-
// silently dropping any value whose item isn't present. If we then diffed
|
|
280
|
-
// `onValueChange`'s result against a value that included hidden items, those
|
|
281
|
-
// hidden items would look "removed" and we'd incorrectly deselect them —
|
|
282
|
-
// e.g. expanding `fruits` → strawberry is selected, collapsing fruits and
|
|
283
|
-
// clicking the `fruits` branch would select the subtree but then carve
|
|
284
|
-
// strawberry back out in the second diff loop.
|
|
285
208
|
const value = useMemo(() => {
|
|
286
209
|
const result = [];
|
|
287
210
|
for (const item of items) {
|
|
@@ -292,9 +215,6 @@ export function TreeDropdown(props) {
|
|
|
292
215
|
return result;
|
|
293
216
|
}, [items, selectionState]);
|
|
294
217
|
const valueSet = useMemo(() => new Set(value), [value]);
|
|
295
|
-
// Translate combobox value changes into TreeSelectionState mutations:
|
|
296
|
-
// clicking a branch selects the whole subtree, clicking a leaf toggles
|
|
297
|
-
// just that leaf, and Select All / Select None take the fast path.
|
|
298
218
|
const { onValueChange: onValueChangeFromProps } = props;
|
|
299
219
|
const onValueChange = useCallback((nextValues) => {
|
|
300
220
|
const next = new TreeSelectionState(internalSelection, {
|
|
@@ -320,19 +240,6 @@ export function TreeDropdown(props) {
|
|
|
320
240
|
setInternalSelection(next.getState());
|
|
321
241
|
onValueChangeFromProps?.(next.getSelectedLeafNodePaths());
|
|
322
242
|
}, [internalSelection, treePaths, valueSet, onValueChangeFromProps]);
|
|
323
|
-
// --- Filtering: search query narrows the flattened items ---------------
|
|
324
|
-
// Keep a node visible when:
|
|
325
|
-
// 1. its own label matches the query, or
|
|
326
|
-
// 2. any ancestor's label matches (so a whole matching subtree shows
|
|
327
|
-
// alongside the branch the user typed), or
|
|
328
|
-
// 3. any descendant's label matches (so parents of a deeply-nested match
|
|
329
|
-
// stay in the list to convey the hierarchy, even if they were
|
|
330
|
-
// collapsed when the search started).
|
|
331
|
-
//
|
|
332
|
-
// Rule (3) relies on `matchAncestorKeys`, which contains every ancestor of
|
|
333
|
-
// every match. Combined with `items` returning the full flattened tree when
|
|
334
|
-
// `searchQuery` is non-empty, this lets us surface matches buried inside
|
|
335
|
-
// collapsed branches without implicitly expanding them.
|
|
336
243
|
const filter = useCallback((item, query) => {
|
|
337
244
|
const q = query.toLowerCase();
|
|
338
245
|
if (item.textLabel.toLowerCase().includes(q)) {
|
|
@@ -349,7 +256,6 @@ export function TreeDropdown(props) {
|
|
|
349
256
|
}
|
|
350
257
|
return false;
|
|
351
258
|
}, [nodeByKey, matchAncestorKeys]);
|
|
352
|
-
// --- Chips: one per selected leaf path (mirrors withSelectedLeafNodesOnly)
|
|
353
259
|
const selectedLeafPaths = useMemo(() => {
|
|
354
260
|
return selectionState.getSelectedLeafNodePaths();
|
|
355
261
|
}, [selectionState]);
|
|
@@ -365,10 +271,6 @@ export function TreeDropdown(props) {
|
|
|
365
271
|
})
|
|
366
272
|
.join('-');
|
|
367
273
|
}, [nodeByKey, toDisplayValue]);
|
|
368
|
-
// Deselect a single leaf path. Used by chip remove buttons — we can't rely on
|
|
369
|
-
// base-ui's built-in `ChipRemove` because the combobox's `selectedValue`
|
|
370
|
-
// contains both branches and leaves, so index-based removal would typically
|
|
371
|
-
// target a branch and collapse its entire subtree.
|
|
372
274
|
const deselectLeafPath = useCallback((path) => {
|
|
373
275
|
const next = new TreeSelectionState(internalSelection, {
|
|
374
276
|
treePaths,
|
|
@@ -381,8 +283,6 @@ export function TreeDropdown(props) {
|
|
|
381
283
|
const showRemoveChip = showClear !== false;
|
|
382
284
|
const { renderSelectedValues } = props;
|
|
383
285
|
const renderInputValues = useCallback(() => {
|
|
384
|
-
// Callers can swap out the default chip rendering (see
|
|
385
|
-
// `GridFilterTreeDropdown` which renders a comma-separated summary).
|
|
386
286
|
if (renderSelectedValues) {
|
|
387
287
|
return renderSelectedValues({
|
|
388
288
|
selectedLeafPaths,
|
|
@@ -398,11 +298,6 @@ export function TreeDropdown(props) {
|
|
|
398
298
|
return (_jsx(ComboboxChip, { showRemove: showRemoveChip, onRemove: () => deselectLeafPath(path), className: 'twa:overflow-hidden', "aria-label": labelText, children: labelText }, key));
|
|
399
299
|
}) }));
|
|
400
300
|
}, [renderSelectedValues, selectedLeafPaths, chipLabelForPath, showRemoveChip, deselectLeafPath]);
|
|
401
|
-
// --- Tree-aware Select All ----------------------------------------------
|
|
402
|
-
// When there is no search, Select All is based on every leaf in the tree
|
|
403
|
-
// (not just currently expanded rows) so expand/collapse doesn't flip the
|
|
404
|
-
// checkbox. When searching, it only covers leaves that match the query
|
|
405
|
-
// (label or ancestor label) — same scope as the visible filtered list.
|
|
406
301
|
const allLeafPaths = useMemo(() => allNodes.filter((n) => !n.hasChildren).map((n) => n.path), [allNodes]);
|
|
407
302
|
const selectAllLeafPaths = useMemo(() => {
|
|
408
303
|
if (!searchQuery) {
|
|
@@ -458,23 +353,18 @@ export function TreeDropdown(props) {
|
|
|
458
353
|
setInternalSelection(next.getState());
|
|
459
354
|
onValueChangeFromProps?.(next.getSelectedLeafNodePaths());
|
|
460
355
|
}, [internalSelection, treePaths, onValueChangeFromProps, searchQuery, selectAllLeafPaths]);
|
|
461
|
-
// --- Search-input trailing slot (Expand All / Collapse All toggle) ------
|
|
462
356
|
const renderSearchInputTrailing = useCallback(() => {
|
|
463
357
|
if (branchNodes.length === 0) {
|
|
464
358
|
return null;
|
|
465
359
|
}
|
|
466
360
|
const title = anyBranchExpanded ? 'Collapse all' : 'Expand all';
|
|
467
361
|
return (_jsx("button", { type: "button", "data-name": "tree-expand-all-toggle", title: title, "aria-label": title, onMouseDown: (e) => {
|
|
468
|
-
// Keep focus on the search input so typing isn't interrupted.
|
|
469
362
|
e.preventDefault();
|
|
470
363
|
}, onClick: (e) => {
|
|
471
364
|
e.preventDefault();
|
|
472
365
|
toggleExpandAll();
|
|
473
|
-
}, className: cn('ab-NewTreeDropdown-expand-all',
|
|
474
|
-
// Prefixed Tailwind has no unprefixed button reset — kill native chrome.
|
|
475
|
-
'twa:appearance-none twa:border-0 twa:p-0 twa:shadow-none twa:outline-none', 'twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center', 'twa:bg-background', 'twa:size-6 twa:rounded-md twa:text-muted-foreground', 'twa:hover:text-foreground twa:hover:bg-ring/50 twa:cursor-pointer'), children: anyBranchExpanded ? (_jsx(ChevronsDownUpIcon, { className: "twa:size-4" })) : (_jsx(ChevronsUpDownIcon, { className: "twa:size-4" })) }));
|
|
366
|
+
}, className: cn('ab-NewTreeDropdown-expand-all', 'twa:appearance-none twa:border-0 twa:p-0 twa:shadow-none twa:outline-none', 'twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center', 'twa:bg-background', 'twa:size-6 twa:rounded-md twa:text-muted-foreground', 'twa:hover:text-foreground twa:hover:bg-ring/50 twa:cursor-pointer'), children: anyBranchExpanded ? (_jsx(ChevronsDownUpIcon, { className: "twa:size-4" })) : (_jsx(ChevronsUpDownIcon, { className: "twa:size-4" })) }));
|
|
476
367
|
}, [branchNodes.length, anyBranchExpanded, toggleExpandAll]);
|
|
477
|
-
// --- Open/close callbacks -----------------------------------------------
|
|
478
368
|
const comboboxProps = {
|
|
479
369
|
isLoading,
|
|
480
370
|
items,
|
|
@@ -482,37 +372,20 @@ export function TreeDropdown(props) {
|
|
|
482
372
|
onValueChange,
|
|
483
373
|
searchable: 'menulist',
|
|
484
374
|
virtualized: true,
|
|
485
|
-
// Tree-aware Select All: full leaf set when unfiltered; search-matching
|
|
486
|
-
// leaves only when a query is active (see selectAllChecked / onSelectAllChange).
|
|
487
375
|
showSelectAllCheckbox: true,
|
|
488
376
|
selectAllCheckboxValue: selectAllChecked,
|
|
489
377
|
onSelectAllCheckboxChange: onSelectAllChange,
|
|
490
|
-
// Suppress base-ui's boolean checkbox indicator; `TreeItemLabel` renders
|
|
491
|
-
// its own tri-state checkbox so partially-selected branches display the
|
|
492
|
-
// indeterminate state. A no-op render fn keeps the checkbox-indicator
|
|
493
|
-
// branch active (so the check-icon fallback stays off) while drawing nothing.
|
|
494
|
-
// Must return a ReactElement (`() => null` is not assignable under strict).
|
|
495
378
|
renderCheckboxIndicator: () => _jsx(_Fragment, {}),
|
|
496
379
|
resizable: props.resizable,
|
|
497
380
|
placeholder: props.placeholder,
|
|
498
381
|
showClear: showRemoveChip,
|
|
499
|
-
//@ts-ignore ignore
|
|
500
382
|
'data-name': props['data-name'] ?? 'Select Values',
|
|
501
383
|
renderItemLabel: (defaultLabel) => {
|
|
502
384
|
return defaultLabel;
|
|
503
385
|
},
|
|
504
386
|
filter,
|
|
505
|
-
// Control the search input with our own query state. Without this, the
|
|
506
|
-
// menulist combobox keeps the filter text in internal state that survives
|
|
507
|
-
// close/reopen — so after we reset `searchQuery` on close, base-ui would
|
|
508
|
-
// still filter by the stale text while `matchAncestorKeys` is already
|
|
509
|
-
// null, leaving a flat list of matches with no tree structure around them.
|
|
510
387
|
inputValue: searchQuery,
|
|
511
388
|
onInputValueChange: handleSearchInputChange,
|
|
512
|
-
// Reset the search query on close so the next open starts with no active
|
|
513
|
-
// filter narrowing. The expand state itself is intentionally preserved
|
|
514
|
-
// (the user explicitly expanded matches by typing), so re-opening the
|
|
515
|
-
// dropdown keeps the previously-revealed branches open.
|
|
516
389
|
onOpenChange: (open) => {
|
|
517
390
|
if (!open) {
|
|
518
391
|
setSearchQuery('');
|
|
@@ -523,15 +396,7 @@ export function TreeDropdown(props) {
|
|
|
523
396
|
renderSearchInputTrailing,
|
|
524
397
|
className: cn('ab-NewTreeDropdown', props.className),
|
|
525
398
|
};
|
|
526
|
-
return (
|
|
527
|
-
// <div
|
|
528
|
-
// className={cn('ab-NewTreeDropdown-wrap', 'twa:w-full')}
|
|
529
|
-
// style={{ ...props.fieldStyle, ...props.style }}
|
|
530
|
-
// onMouseDown={props.onMouseDown}
|
|
531
|
-
// >
|
|
532
|
-
_jsx(MultiCombobox, { ...comboboxProps })
|
|
533
|
-
// </div>
|
|
534
|
-
);
|
|
399
|
+
return (_jsx(MultiCombobox, { ...comboboxProps }));
|
|
535
400
|
}
|
|
536
401
|
export function GridFilterTreeDropdown(props) {
|
|
537
402
|
const { showSelectedCount = false, placeholder = 'Select...', renderInputValues: renderInputValuesProp, className, ...rest } = props;
|
|
@@ -541,7 +406,6 @@ export function GridFilterTreeDropdown(props) {
|
|
|
541
406
|
children = (_jsx("span", { "data-name": "placeholder", className: "twa:text-muted-foreground", children: placeholder }));
|
|
542
407
|
}
|
|
543
408
|
else if (renderInputValuesProp) {
|
|
544
|
-
// one item per selected leaf, so consumers get the correct selected count
|
|
545
409
|
children = renderInputValuesProp(selectedLeafPaths.map((path) => ({ value: path, label: getLabelForPath(path) })));
|
|
546
410
|
}
|
|
547
411
|
else {
|