nudge-ui 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/bin/nudge-ui.mjs +7 -0
- package/dist/LICENSE +21 -0
- package/dist/client.mjs +261 -0
- package/dist/compiler/ast.d.ts +18 -0
- package/dist/compiler/ast.js +75 -0
- package/dist/compiler/componentContractTypes.d.ts +19 -0
- package/dist/compiler/componentContractTypes.js +1 -0
- package/dist/compiler/componentContracts.d.ts +2 -0
- package/dist/compiler/componentContracts.js +260 -0
- package/dist/compiler/componentInstrumentation.d.ts +32 -0
- package/dist/compiler/componentInstrumentation.js +140 -0
- package/dist/compiler/componentPolicyResolution.d.ts +71 -0
- package/dist/compiler/componentPolicyResolution.js +388 -0
- package/dist/compiler/index.d.ts +9 -0
- package/dist/compiler/index.js +9 -0
- package/dist/compiler/packageComponentContracts.d.ts +32 -0
- package/dist/compiler/packageComponentContracts.js +308 -0
- package/dist/compiler/reactComponentProtocols.d.ts +145 -0
- package/dist/compiler/reactComponentProtocols.js +47 -0
- package/dist/compiler/reactIdentity.d.ts +15 -0
- package/dist/compiler/reactIdentity.js +339 -0
- package/dist/compiler/sourcePaths.d.ts +12 -0
- package/dist/compiler/sourcePaths.js +27 -0
- package/dist/css/dialects/index.d.ts +62 -0
- package/dist/css/dialects/index.js +103 -0
- package/dist/css/dialects/tailwind.d.ts +46 -0
- package/dist/css/dialects/tailwind.js +119 -0
- package/dist/css/dialects/vanillaExtract.d.ts +20 -0
- package/dist/css/dialects/vanillaExtract.js +32 -0
- package/dist/css/index.d.ts +10 -0
- package/dist/css/index.js +10 -0
- package/dist/css/model/index.d.ts +190 -0
- package/dist/css/model/index.js +10 -0
- package/dist/css/token-inventory/index.d.ts +26 -0
- package/dist/css/token-inventory/index.js +24 -0
- package/dist/css/token-inventory/inventory.d.ts +8 -0
- package/dist/css/token-inventory/inventory.js +421 -0
- package/dist/css/token-inventory/parseStylesheet.d.ts +16 -0
- package/dist/css/token-inventory/parseStylesheet.js +155 -0
- package/dist/css/token-inventory/policy.d.ts +47 -0
- package/dist/css/token-inventory/policy.js +50 -0
- package/dist/css/token-inventory/types.d.ts +97 -0
- package/dist/css/token-inventory/types.js +1 -0
- package/dist/css/value-semantics/borderSemantics.d.ts +28 -0
- package/dist/css/value-semantics/borderSemantics.js +91 -0
- package/dist/css/value-semantics/boxSemantics.d.ts +37 -0
- package/dist/css/value-semantics/boxSemantics.js +71 -0
- package/dist/css/value-semantics/colorSemantics.d.ts +99 -0
- package/dist/css/value-semantics/colorSemantics.js +526 -0
- package/dist/css/value-semantics/cssSyntax.d.ts +19 -0
- package/dist/css/value-semantics/cssSyntax.js +111 -0
- package/dist/css/value-semantics/fontSemantics.d.ts +35 -0
- package/dist/css/value-semantics/fontSemantics.js +131 -0
- package/dist/css/value-semantics/index.d.ts +20 -0
- package/dist/css/value-semantics/index.js +15 -0
- package/dist/css/value-semantics/propertyPolicy.d.ts +118 -0
- package/dist/css/value-semantics/propertyPolicy.js +356 -0
- package/dist/css/value-semantics/stringMaps.d.ts +2 -0
- package/dist/css/value-semantics/stringMaps.js +1 -0
- package/dist/css/value-semantics/structuredValues.d.ts +64 -0
- package/dist/css/value-semantics/structuredValues.js +250 -0
- package/dist/css/value-semantics/tokenInterpretation.d.ts +90 -0
- package/dist/css/value-semantics/tokenInterpretation.js +193 -0
- package/dist/css/virtual-design-tokens.d.ts +17 -0
- package/dist/hosts/astro/astroRuntimeConfig.d.ts +12 -0
- package/dist/hosts/astro/astroRuntimeConfig.js +26 -0
- package/dist/hosts/astro/clientAsset.d.ts +12 -0
- package/dist/hosts/astro/clientAsset.js +51 -0
- package/dist/hosts/astro/clientTransport.d.ts +3 -0
- package/dist/hosts/astro/clientTransport.js +57 -0
- package/dist/hosts/astro/index.d.ts +3 -0
- package/dist/hosts/astro/index.js +2 -0
- package/dist/hosts/astro/integration.d.ts +35 -0
- package/dist/hosts/astro/integration.js +96 -0
- package/dist/hosts/astro/middleware.d.ts +13 -0
- package/dist/hosts/astro/middleware.js +22 -0
- package/dist/hosts/astro/projectContext.d.ts +11 -0
- package/dist/hosts/astro/projectContext.js +34 -0
- package/dist/hosts/astro/responseInstrumentation.d.ts +41 -0
- package/dist/hosts/astro/responseInstrumentation.js +80 -0
- package/dist/hosts/next/index.d.ts +4 -0
- package/dist/hosts/next/index.js +7 -0
- package/dist/hosts/next/loader.d.ts +66 -0
- package/dist/hosts/next/loader.js +346 -0
- package/dist/hosts/next/loaders/identity-loader.cjs +228257 -0
- package/dist/hosts/next/loaders/loader-plugin.cjs +228257 -0
- package/dist/hosts/next/manifest.d.ts +38 -0
- package/dist/hosts/next/manifest.js +30 -0
- package/dist/hosts/next/mount.d.ts +12 -0
- package/dist/hosts/next/mount.js +23 -0
- package/dist/hosts/next/repositoryScope.d.ts +20 -0
- package/dist/hosts/next/repositoryScope.js +33 -0
- package/dist/hosts/next/sidecar.d.ts +27 -0
- package/dist/hosts/next/sidecar.js +526 -0
- package/dist/hosts/next/wrapper.d.ts +67 -0
- package/dist/hosts/next/wrapper.js +310 -0
- package/dist/hosts/static/cli.d.ts +12 -0
- package/dist/hosts/static/cli.js +77 -0
- package/dist/hosts/static/html/bootstrap.d.ts +27 -0
- package/dist/hosts/static/html/bootstrap.js +93 -0
- package/dist/hosts/static/index.d.ts +4 -0
- package/dist/hosts/static/index.js +4 -0
- package/dist/hosts/static/manifest.d.ts +18 -0
- package/dist/hosts/static/manifest.js +51 -0
- package/dist/hosts/static/server.d.ts +72 -0
- package/dist/hosts/static/server.js +554 -0
- package/dist/hosts/vite/index.d.ts +20 -0
- package/dist/hosts/vite/index.js +48 -0
- package/dist/hosts/vite/react.d.ts +67 -0
- package/dist/hosts/vite/react.js +231 -0
- package/dist/hosts/vite/tokens/activeStylesheets.d.ts +28 -0
- package/dist/hosts/vite/tokens/activeStylesheets.js +70 -0
- package/dist/hosts/vite/tokens/fileMap.d.ts +2 -0
- package/dist/hosts/vite/tokens/fileMap.js +1 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +46 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +104 -0
- package/dist/hosts/vite/virtual/design-tokens.d.ts +9 -0
- package/dist/hosts/vite/virtual/design-tokens.js +7 -0
- package/dist/hosts/vite/virtual-design-tokens.d.ts +1 -0
- package/dist/hosts/vite/vite.d.ts +62 -0
- package/dist/hosts/vite/vite.js +854 -0
- package/dist/html/dom.d.ts +13 -0
- package/dist/html/dom.js +46 -0
- package/dist/html/identity.d.ts +40 -0
- package/dist/html/identity.js +196 -0
- package/dist/html/insertions.d.ts +26 -0
- package/dist/html/insertions.js +59 -0
- package/dist/inspector/agent/McpConnectionDialog.d.ts +26 -0
- package/dist/inspector/agent/McpConnectionDialog.js +135 -0
- package/dist/inspector/agent/client.d.ts +98 -0
- package/dist/inspector/agent/client.js +728 -0
- package/dist/inspector/agent/connectionStatus.d.ts +13 -0
- package/dist/inspector/agent/connectionStatus.js +35 -0
- package/dist/inspector/agent/httpTransport.d.ts +21 -0
- package/dist/inspector/agent/httpTransport.js +347 -0
- package/dist/inspector/agent/protocol.d.ts +95 -0
- package/dist/inspector/agent/protocol.js +9 -0
- package/dist/inspector/agent/verification.d.ts +39 -0
- package/dist/inspector/agent/verification.js +207 -0
- package/dist/inspector/canvas/CanvasCard.d.ts +10 -0
- package/dist/inspector/canvas/CanvasCard.js +275 -0
- package/dist/inspector/canvas/CanvasElementOverlay.d.ts +2 -0
- package/dist/inspector/canvas/CanvasElementOverlay.js +301 -0
- package/dist/inspector/canvas/CanvasWorkspace.d.ts +2 -0
- package/dist/inspector/canvas/CanvasWorkspace.js +301 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +6 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.js +17 -0
- package/dist/inspector/canvas/StaleChangeIndicator.d.ts +7 -0
- package/dist/inspector/canvas/StaleChangeIndicator.js +43 -0
- package/dist/inspector/canvas/agentPresentation.d.ts +87 -0
- package/dist/inspector/canvas/agentPresentation.js +421 -0
- package/dist/inspector/canvas/canvasGestures.d.ts +12 -0
- package/dist/inspector/canvas/canvasGestures.js +21 -0
- package/dist/inspector/canvas/canvasStore.d.ts +108 -0
- package/dist/inspector/canvas/canvasStore.js +448 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +231 -0
- package/dist/inspector/canvas/frameProtocol.js +165 -0
- package/dist/inspector/canvas/linkEligibility.d.ts +8 -0
- package/dist/inspector/canvas/linkEligibility.js +68 -0
- package/dist/inspector/canvas/measurementProjection.d.ts +8 -0
- package/dist/inspector/canvas/measurementProjection.js +16 -0
- package/dist/inspector/canvas/normalizeUrl.d.ts +7 -0
- package/dist/inspector/canvas/normalizeUrl.js +27 -0
- package/dist/inspector/canvas/projection.d.ts +41 -0
- package/dist/inspector/canvas/projection.js +232 -0
- package/dist/inspector/canvas/rendererBootstrap.d.ts +4 -0
- package/dist/inspector/canvas/rendererBootstrap.js +410 -0
- package/dist/inspector/canvas/rendererCidIndex.d.ts +11 -0
- package/dist/inspector/canvas/rendererCidIndex.js +21 -0
- package/dist/inspector/canvas/rendererElementSelector.d.ts +2 -0
- package/dist/inspector/canvas/rendererElementSelector.js +378 -0
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +2 -0
- package/dist/inspector/canvas/rendererSelectionProxy.js +61 -0
- package/dist/inspector/canvas/rendererStylesheet.d.ts +16 -0
- package/dist/inspector/canvas/rendererStylesheet.js +221 -0
- package/dist/inspector/canvas/resizeHandleScale.d.ts +13 -0
- package/dist/inspector/canvas/resizeHandleScale.js +20 -0
- package/dist/inspector/canvas/roleDetection.d.ts +5 -0
- package/dist/inspector/canvas/roleDetection.js +21 -0
- package/dist/inspector/canvas/sessionStore.d.ts +71 -0
- package/dist/inspector/canvas/sessionStore.js +453 -0
- package/dist/inspector/canvas/staleChangeDetector.d.ts +11 -0
- package/dist/inspector/canvas/staleChangeDetector.js +217 -0
- package/dist/inspector/canvas/toolbarScale.d.ts +7 -0
- package/dist/inspector/canvas/toolbarScale.js +11 -0
- package/dist/inspector/canvas/workspaceLease.d.ts +26 -0
- package/dist/inspector/canvas/workspaceLease.js +214 -0
- package/dist/inspector/changes/changesLog.d.ts +46 -0
- package/dist/inspector/changes/changesLog.js +209 -0
- package/dist/inspector/changes/codecs.d.ts +98 -0
- package/dist/inspector/changes/codecs.js +389 -0
- package/dist/inspector/changes/editModel.d.ts +74 -0
- package/dist/inspector/changes/editModel.js +120 -0
- package/dist/inspector/changes/managedStyleProjection.d.ts +6 -0
- package/dist/inspector/changes/managedStyleProjection.js +109 -0
- package/dist/inspector/changes/model.d.ts +13 -0
- package/dist/inspector/changes/model.js +163 -0
- package/dist/inspector/changes/presentation.d.ts +14 -0
- package/dist/inspector/changes/presentation.js +81 -0
- package/dist/inspector/changes/previewDiagnostics.d.ts +39 -0
- package/dist/inspector/changes/previewDiagnostics.js +172 -0
- package/dist/inspector/changes/structuralTypes.d.ts +35 -0
- package/dist/inspector/changes/structuralTypes.js +1 -0
- package/dist/inspector/changes/types.d.ts +76 -0
- package/dist/inspector/changes/types.js +16 -0
- package/dist/inspector/changes/workspaceChanges.d.ts +43 -0
- package/dist/inspector/changes/workspaceChanges.js +239 -0
- package/dist/inspector/clientManifest.d.ts +24 -0
- package/dist/inspector/clientManifest.js +69 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +5 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +44 -0
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +11 -0
- package/dist/inspector/componentSemantics/adapterRegistry.js +75 -0
- package/dist/inspector/componentSemantics/boundaries.d.ts +2 -0
- package/dist/inspector/componentSemantics/boundaries.js +10 -0
- package/dist/inspector/componentSemantics/changeAction.d.ts +3 -0
- package/dist/inspector/componentSemantics/changeAction.js +6 -0
- package/dist/inspector/componentSemantics/changeModel.d.ts +8 -0
- package/dist/inspector/componentSemantics/changeModel.js +60 -0
- package/dist/inspector/componentSemantics/index.d.ts +4 -0
- package/dist/inspector/componentSemantics/index.js +2 -0
- package/dist/inspector/componentSemantics/reactRuntime.d.ts +10 -0
- package/dist/inspector/componentSemantics/reactRuntime.js +186 -0
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +25 -0
- package/dist/inspector/componentSemantics/runtimeBridge.js +161 -0
- package/dist/inspector/componentSemantics/runtimeTypes.d.ts +2 -0
- package/dist/inspector/componentSemantics/runtimeTypes.js +1 -0
- package/dist/inspector/componentSemantics/textBinding.d.ts +69 -0
- package/dist/inspector/componentSemantics/textBinding.js +514 -0
- package/dist/inspector/componentSemantics/types.d.ts +96 -0
- package/dist/inspector/componentSemantics/types.js +5 -0
- package/dist/inspector/conformance/borderCases.d.ts +7 -0
- package/dist/inspector/conformance/borderCases.js +428 -0
- package/dist/inspector/conformance/colorCases.d.ts +8 -0
- package/dist/inspector/conformance/colorCases.js +470 -0
- package/dist/inspector/conformance/fixture.d.ts +68 -0
- package/dist/inspector/conformance/fixture.js +153 -0
- package/dist/inspector/conformance/projection.d.ts +2 -0
- package/dist/inspector/conformance/projection.js +3 -0
- package/dist/inspector/conformance/spacingCases.d.ts +6 -0
- package/dist/inspector/conformance/spacingCases.js +417 -0
- package/dist/inspector/conformance/typographyCases.d.ts +7 -0
- package/dist/inspector/conformance/typographyCases.js +174 -0
- package/dist/inspector/editScope.d.ts +4 -0
- package/dist/inspector/editScope.js +5 -0
- package/dist/inspector/index.d.ts +20 -0
- package/dist/inspector/index.js +236 -0
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +74 -0
- package/dist/inspector/inline-text/inlineTextEditor.js +1207 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.d.ts +2 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.js +17 -0
- package/dist/inspector/inline-text/textChangeBoundary.d.ts +6 -0
- package/dist/inspector/inline-text/textChangeBoundary.js +1 -0
- package/dist/inspector/inspection/bridge.d.ts +72 -0
- package/dist/inspector/inspection/bridge.js +134 -0
- package/dist/inspector/inspection/browserCssInspection.d.ts +74 -0
- package/dist/inspector/inspection/browserCssInspection.js +317 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +12 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +66 -0
- package/dist/inspector/inspection/selectionProperty.d.ts +32 -0
- package/dist/inspector/inspection/selectionProperty.js +33 -0
- package/dist/inspector/inspection/useBrowserCssInspection.d.ts +20 -0
- package/dist/inspector/inspection/useBrowserCssInspection.js +159 -0
- package/dist/inspector/overlay/DropGuideOverlay.d.ts +17 -0
- package/dist/inspector/overlay/DropGuideOverlay.js +17 -0
- package/dist/inspector/overlay/InspectorOverlay.d.ts +5 -0
- package/dist/inspector/overlay/InspectorOverlay.js +328 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +19 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.js +40 -0
- package/dist/inspector/overlay/clickPolicy.d.ts +7 -0
- package/dist/inspector/overlay/clickPolicy.js +13 -0
- package/dist/inspector/overlay/dropGuide.d.ts +22 -0
- package/dist/inspector/overlay/dropGuide.js +48 -0
- package/dist/inspector/overlay/elementSelector.d.ts +1 -0
- package/dist/inspector/overlay/elementSelector.js +100 -0
- package/dist/inspector/overlay/frameThrottle.d.ts +10 -0
- package/dist/inspector/overlay/frameThrottle.js +38 -0
- package/dist/inspector/overlay/interactionStyles.d.ts +3 -0
- package/dist/inspector/overlay/interactionStyles.js +70 -0
- package/dist/inspector/overlay/measurementGeometry.d.ts +25 -0
- package/dist/inspector/overlay/measurementGeometry.js +104 -0
- package/dist/inspector/overlay/overlayGeometry.d.ts +40 -0
- package/dist/inspector/overlay/overlayGeometry.js +59 -0
- package/dist/inspector/overlay/selectedGeometry.d.ts +7 -0
- package/dist/inspector/overlay/selectedGeometry.js +51 -0
- package/dist/inspector/overlay/structuralGestures.d.ts +28 -0
- package/dist/inspector/overlay/structuralGestures.js +180 -0
- package/dist/inspector/projection/cssEscapes.d.ts +3 -0
- package/dist/inspector/projection/cssEscapes.js +20 -0
- package/dist/inspector/projection/managedStylesheet.d.ts +33 -0
- package/dist/inspector/projection/managedStylesheet.js +240 -0
- package/dist/inspector/projection/renderedInstance.d.ts +56 -0
- package/dist/inspector/projection/renderedInstance.js +306 -0
- package/dist/inspector/projection/structuralProjection.d.ts +93 -0
- package/dist/inspector/projection/structuralProjection.js +560 -0
- package/dist/inspector/projection/structuralProjectionBoundary.d.ts +5 -0
- package/dist/inspector/projection/structuralProjectionBoundary.js +65 -0
- package/dist/inspector/projection/textProjection.d.ts +53 -0
- package/dist/inspector/projection/textProjection.js +705 -0
- package/dist/inspector/projection/workspaceProjection.d.ts +43 -0
- package/dist/inspector/projection/workspaceProjection.js +58 -0
- package/dist/inspector/prompt/PromptSettingsDialog.d.ts +15 -0
- package/dist/inspector/prompt/PromptSettingsDialog.js +17 -0
- package/dist/inspector/prompt/clipboardHandoff.d.ts +34 -0
- package/dist/inspector/prompt/clipboardHandoff.js +212 -0
- package/dist/inspector/prompt/copyToClipboard.d.ts +1 -0
- package/dist/inspector/prompt/copyToClipboard.js +34 -0
- package/dist/inspector/prompt/detectFramework.d.ts +6 -0
- package/dist/inspector/prompt/detectFramework.js +4 -0
- package/dist/inspector/prompt/generatePrompt.d.ts +7 -0
- package/dist/inspector/prompt/generatePrompt.js +391 -0
- package/dist/inspector/prompt/promptSettings.d.ts +8 -0
- package/dist/inspector/prompt/promptSettings.js +28 -0
- package/dist/inspector/runtime/devFlag.d.ts +28 -0
- package/dist/inspector/runtime/devFlag.js +50 -0
- package/dist/inspector/runtime/documentStylesheetOrder.d.ts +19 -0
- package/dist/inspector/runtime/documentStylesheetOrder.js +89 -0
- package/dist/inspector/runtime/domRealm.d.ts +4 -0
- package/dist/inspector/runtime/domRealm.js +11 -0
- package/dist/inspector/runtime/runtimeConfig.d.ts +119 -0
- package/dist/inspector/runtime/runtimeConfig.js +276 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +32 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +149 -0
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +10 -0
- package/dist/inspector/runtime/useRuntimeConfig.js +13 -0
- package/dist/inspector/selection/editScope.d.ts +32 -0
- package/dist/inspector/selection/editScope.js +140 -0
- package/dist/inspector/selection/editTarget.d.ts +8 -0
- package/dist/inspector/selection/editTarget.js +11 -0
- package/dist/inspector/selection/hierarchy.d.ts +7 -0
- package/dist/inspector/selection/hierarchy.js +42 -0
- package/dist/inspector/selection/resolveSelection.d.ts +10 -0
- package/dist/inspector/selection/resolveSelection.js +60 -0
- package/dist/inspector/selection/selectionStore.d.ts +41 -0
- package/dist/inspector/selection/selectionStore.js +262 -0
- package/dist/inspector/selection/selectionTarget.d.ts +5 -0
- package/dist/inspector/selection/selectionTarget.js +50 -0
- package/dist/inspector/selection/sourceSite.d.ts +2 -0
- package/dist/inspector/selection/sourceSite.js +12 -0
- package/dist/inspector/selection/styleSelection.d.ts +22 -0
- package/dist/inspector/selection/styleSelection.js +104 -0
- package/dist/inspector/session/index.d.ts +3 -0
- package/dist/inspector/session/index.js +2 -0
- package/dist/inspector/session/lifecycle.d.ts +22 -0
- package/dist/inspector/session/lifecycle.js +63 -0
- package/dist/inspector/session/sessionContext.d.ts +21 -0
- package/dist/inspector/session/sessionContext.js +28 -0
- package/dist/inspector/session/sessionFactory.d.ts +29 -0
- package/dist/inspector/session/sessionFactory.js +73 -0
- package/dist/inspector/settings/SettingsDialog.d.ts +12 -0
- package/dist/inspector/settings/SettingsDialog.js +46 -0
- package/dist/inspector/shell/AppShell.d.ts +2 -0
- package/dist/inspector/shell/AppShell.js +9 -0
- package/dist/inspector/shell/ChangesLog.d.ts +6 -0
- package/dist/inspector/shell/ChangesLog.js +92 -0
- package/dist/inspector/shell/CopyPromptButton.d.ts +9 -0
- package/dist/inspector/shell/CopyPromptButton.js +159 -0
- package/dist/inspector/shell/DomNavigation.d.ts +8 -0
- package/dist/inspector/shell/DomNavigation.js +30 -0
- package/dist/inspector/shell/EmptyState.d.ts +2 -0
- package/dist/inspector/shell/EmptyState.js +15 -0
- package/dist/inspector/shell/InspectorShell.d.ts +11 -0
- package/dist/inspector/shell/InspectorShell.js +268 -0
- package/dist/inspector/shell/openStore.d.ts +6 -0
- package/dist/inspector/shell/openStore.js +29 -0
- package/dist/inspector/shell/panelLayout.d.ts +2 -0
- package/dist/inspector/shell/panelLayout.js +29 -0
- package/dist/inspector/shell/shortcuts.d.ts +3 -0
- package/dist/inspector/shell/shortcuts.js +25 -0
- package/dist/inspector/shell/stateValue.d.ts +3 -0
- package/dist/inspector/shell/stateValue.js +34 -0
- package/dist/inspector/shell/styleState.d.ts +7 -0
- package/dist/inspector/shell/styleState.js +13 -0
- package/dist/inspector/spacing/projection.d.ts +43 -0
- package/dist/inspector/spacing/projection.js +136 -0
- package/dist/inspector/styleEditors/AppearanceSection.d.ts +13 -0
- package/dist/inspector/styleEditors/AppearanceSection.js +6 -0
- package/dist/inspector/styleEditors/AspectRatioField.d.ts +17 -0
- package/dist/inspector/styleEditors/AspectRatioField.js +10 -0
- package/dist/inspector/styleEditors/BorderEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BorderEditor.js +295 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.d.ts +14 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +108 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.js +13 -0
- package/dist/inspector/styleEditors/ColorPicker.d.ts +15 -0
- package/dist/inspector/styleEditors/ColorPicker.js +73 -0
- package/dist/inspector/styleEditors/GapField.d.ts +17 -0
- package/dist/inspector/styleEditors/GapField.js +12 -0
- package/dist/inspector/styleEditors/GridChildSection.d.ts +14 -0
- package/dist/inspector/styleEditors/GridChildSection.js +91 -0
- package/dist/inspector/styleEditors/GridPicker.d.ts +13 -0
- package/dist/inspector/styleEditors/GridPicker.js +179 -0
- package/dist/inspector/styleEditors/GridSection.d.ts +17 -0
- package/dist/inspector/styleEditors/GridSection.js +27 -0
- package/dist/inspector/styleEditors/GridValueField.d.ts +17 -0
- package/dist/inspector/styleEditors/GridValueField.js +70 -0
- package/dist/inspector/styleEditors/InsetSection.d.ts +15 -0
- package/dist/inspector/styleEditors/InsetSection.js +15 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +6 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +6 -0
- package/dist/inspector/styleEditors/LayoutComboField.d.ts +18 -0
- package/dist/inspector/styleEditors/LayoutComboField.js +138 -0
- package/dist/inspector/styleEditors/LayoutDropdown.d.ts +14 -0
- package/dist/inspector/styleEditors/LayoutDropdown.js +34 -0
- package/dist/inspector/styleEditors/LayoutSection.d.ts +13 -0
- package/dist/inspector/styleEditors/LayoutSection.js +342 -0
- package/dist/inspector/styleEditors/OpacityEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/OpacityEditor.js +34 -0
- package/dist/inspector/styleEditors/PositionInsets.d.ts +15 -0
- package/dist/inspector/styleEditors/PositionInsets.js +12 -0
- package/dist/inspector/styleEditors/SpacingBox.d.ts +29 -0
- package/dist/inspector/styleEditors/SpacingBox.js +189 -0
- package/dist/inspector/styleEditors/Typography.d.ts +13 -0
- package/dist/inspector/styleEditors/Typography.js +137 -0
- package/dist/inspector/styleEditors/completeCssValue.d.ts +8 -0
- package/dist/inspector/styleEditors/completeCssValue.js +34 -0
- package/dist/inspector/styleEditors/gridChildModel.d.ts +74 -0
- package/dist/inspector/styleEditors/gridChildModel.js +138 -0
- package/dist/inspector/styleEditors/layoutValue.d.ts +24 -0
- package/dist/inspector/styleEditors/layoutValue.js +103 -0
- package/dist/inspector/styleEditors/nudgeValue.d.ts +8 -0
- package/dist/inspector/styleEditors/nudgeValue.js +71 -0
- package/dist/inspector/styleEditors/rowLookup.d.ts +11 -0
- package/dist/inspector/styleEditors/rowLookup.js +13 -0
- package/dist/inspector/styleEditors/stringRecord.d.ts +4 -0
- package/dist/inspector/styleEditors/stringRecord.js +1 -0
- package/dist/inspector/styleEditors/valuePolicy.d.ts +20 -0
- package/dist/inspector/styleEditors/valuePolicy.js +82 -0
- package/dist/inspector/testing.d.ts +10 -0
- package/dist/inspector/testing.js +9 -0
- package/dist/inspector/tokens/TokenChip.d.ts +24 -0
- package/dist/inspector/tokens/TokenChip.js +23 -0
- package/dist/inspector/tokens/TokenDropdown.d.ts +13 -0
- package/dist/inspector/tokens/TokenDropdown.js +59 -0
- package/dist/inspector/tokens/TokenField.d.ts +68 -0
- package/dist/inspector/tokens/TokenField.js +485 -0
- package/dist/inspector/tokens/TokenLabel.d.ts +7 -0
- package/dist/inspector/tokens/TokenLabel.js +23 -0
- package/dist/inspector/tokens/TokensPanel.d.ts +5 -0
- package/dist/inspector/tokens/TokensPanel.js +47 -0
- package/dist/inspector/tokens/catalog.d.ts +51 -0
- package/dist/inspector/tokens/catalog.js +184 -0
- package/dist/inspector/tokens/editActions.d.ts +35 -0
- package/dist/inspector/tokens/editActions.js +164 -0
- package/dist/inspector/tokens/resolution/cascade.d.ts +14 -0
- package/dist/inspector/tokens/resolution/cascade.js +31 -0
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +43 -0
- package/dist/inspector/tokens/resolution/cssomCollector.js +528 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +12 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.js +106 -0
- package/dist/inspector/tokens/resolution.d.ts +56 -0
- package/dist/inspector/tokens/resolution.js +1401 -0
- package/dist/inspector/tokens/tokenEdits.d.ts +3 -0
- package/dist/inspector/tokens/tokenEdits.js +22 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +6 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.js +68 -0
- package/dist/inspector/ui/AtRuleContext.d.ts +18 -0
- package/dist/inspector/ui/AtRuleContext.js +54 -0
- package/dist/inspector/ui/Button.d.ts +9 -0
- package/dist/inspector/ui/Button.js +4 -0
- package/dist/inspector/ui/ColorSwatch.d.ts +7 -0
- package/dist/inspector/ui/ColorSwatch.js +6 -0
- package/dist/inspector/ui/ControlSurface.d.ts +14 -0
- package/dist/inspector/ui/ControlSurface.js +10 -0
- package/dist/inspector/ui/FieldRow.d.ts +14 -0
- package/dist/inspector/ui/FieldRow.js +15 -0
- package/dist/inspector/ui/IconButton.d.ts +14 -0
- package/dist/inspector/ui/IconButton.js +5 -0
- package/dist/inspector/ui/InspectorPopover.d.ts +17 -0
- package/dist/inspector/ui/InspectorPopover.js +13 -0
- package/dist/inspector/ui/PopoverListbox.d.ts +37 -0
- package/dist/inspector/ui/PopoverListbox.js +21 -0
- package/dist/inspector/ui/SegmentedControl.d.ts +24 -0
- package/dist/inspector/ui/SegmentedControl.js +16 -0
- package/dist/inspector/ui/Select.d.ts +25 -0
- package/dist/inspector/ui/Select.js +56 -0
- package/dist/inspector/ui/SideValuesField.d.ts +44 -0
- package/dist/inspector/ui/SideValuesField.js +76 -0
- package/dist/inspector/ui/StatusCallout.d.ts +9 -0
- package/dist/inspector/ui/StatusCallout.js +4 -0
- package/dist/inspector/ui/TextInput.d.ts +12 -0
- package/dist/inspector/ui/TextInput.js +5 -0
- package/dist/inspector/ui/ToggleButton.d.ts +11 -0
- package/dist/inspector/ui/ToggleButton.js +6 -0
- package/dist/inspector/ui/assets/grid.svg +14 -0
- package/dist/inspector/ui/css.d.ts +9 -0
- package/dist/inspector/ui/labels.d.ts +1 -0
- package/dist/inspector/ui/labels.js +7 -0
- package/dist/inspector/ui/styles.d.ts +1 -0
- package/dist/inspector/ui/styles.js +68 -0
- package/dist/inspector/virtual-modules.d.ts +7 -0
- package/dist/inspector/vite-env.d.ts +10 -0
- package/dist/internal/agent-protocol.d.ts +232 -0
- package/dist/internal/agent-protocol.js +237 -0
- package/dist/nudge-ui.mjs +15722 -0
- package/dist/project/files.d.ts +19 -0
- package/dist/project/files.js +226 -0
- package/dist/project/identity.d.ts +6 -0
- package/dist/project/identity.js +19 -0
- package/dist/project/pathPolicy.d.ts +8 -0
- package/dist/project/pathPolicy.js +12 -0
- package/dist/project/tokens.d.ts +36 -0
- package/dist/project/tokens.js +223 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/routes.d.ts +13 -0
- package/dist/transport/routes.js +16 -0
- package/package.json +137 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { appendChange } from "../changes/changesLog.js";
|
|
2
|
+
export function setGlobalTokenValue(row, value) {
|
|
3
|
+
const nextValue = value.trim();
|
|
4
|
+
if (!row.activeDeclaration || !nextValue)
|
|
5
|
+
return null;
|
|
6
|
+
const record = {
|
|
7
|
+
kind: "token",
|
|
8
|
+
tokenName: row.definition.cssName,
|
|
9
|
+
file: row.file,
|
|
10
|
+
line: row.line,
|
|
11
|
+
selector: row.selector,
|
|
12
|
+
property: row.definition.cssName,
|
|
13
|
+
rawValue: nextValue,
|
|
14
|
+
oldRawValue: row.authoredValue,
|
|
15
|
+
important: row.activeDeclaration.important,
|
|
16
|
+
context: row.styleContext,
|
|
17
|
+
contextLabel: row.contextLabel,
|
|
18
|
+
source: { file: row.file, line: row.line, component: "Global token" },
|
|
19
|
+
};
|
|
20
|
+
appendChange(record);
|
|
21
|
+
return record;
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TokenEntry } from "../../css/model/index.js";
|
|
2
|
+
import type { TokenOrigin, TokenTable } from "../../css/model/index.js";
|
|
3
|
+
import type { Directionality, ValueSemanticsContext } from "../../css/value-semantics/index.js";
|
|
4
|
+
export declare function inspectorTokenOrigin(entry: TokenEntry | undefined): TokenOrigin;
|
|
5
|
+
/** Inspector Adapter for framework-specific token attribution facts. */
|
|
6
|
+
export declare function createInspectorValueContext(tokenTable: TokenTable, localAliases?: ReadonlyMap<string, string>, directionality?: Directionality): ValueSemanticsContext;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const EMPTY_LOCAL_ALIASES = new Map();
|
|
2
|
+
export function inspectorTokenOrigin(entry) {
|
|
3
|
+
if (!entry)
|
|
4
|
+
return "runtime";
|
|
5
|
+
if (entry.origin)
|
|
6
|
+
return entry.origin;
|
|
7
|
+
if (entry.adapter === "tailwind-v3" || entry.adapter === "tailwind-v4")
|
|
8
|
+
return "framework";
|
|
9
|
+
return "project";
|
|
10
|
+
}
|
|
11
|
+
function colorTuple(value) {
|
|
12
|
+
const trimmed = value.trim().toLowerCase().replace(/\s*\/\s*var\([^)]*\)/, "");
|
|
13
|
+
const hex = /^#([\da-f]{3}|[\da-f]{6})$/.exec(trimmed);
|
|
14
|
+
if (hex) {
|
|
15
|
+
const raw = hex[1];
|
|
16
|
+
const expanded = raw.length === 3 ? raw.split("").map((part) => part + part).join("") : raw;
|
|
17
|
+
return [expanded.slice(0, 2), expanded.slice(2, 4), expanded.slice(4, 6)]
|
|
18
|
+
.map((part) => Number.parseInt(part, 16))
|
|
19
|
+
.join(",");
|
|
20
|
+
}
|
|
21
|
+
const rgb = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/.exec(trimmed);
|
|
22
|
+
return rgb ? [rgb[1], rgb[2], rgb[3]].map((part) => String(Math.round(Number(part)))).join(",") : null;
|
|
23
|
+
}
|
|
24
|
+
function directFrameworkColor(value, tokenTable) {
|
|
25
|
+
const tuple = colorTuple(value);
|
|
26
|
+
if (!tuple)
|
|
27
|
+
return undefined;
|
|
28
|
+
return Object.values(tokenTable).find((entry) => entry.adapter === "tailwind-v3" && colorTuple(entry.value) === tuple);
|
|
29
|
+
}
|
|
30
|
+
function twLocalAliasPolicy(ref, inner) {
|
|
31
|
+
if (!ref.startsWith("--tw-")) {
|
|
32
|
+
return {
|
|
33
|
+
known: true,
|
|
34
|
+
tokenName: ref,
|
|
35
|
+
resolvedValue: inner.resolvedValue,
|
|
36
|
+
leafTokenName: inner.leafTokenName ?? ref,
|
|
37
|
+
cycle: inner.cycle,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return inner.tokenName
|
|
41
|
+
? {
|
|
42
|
+
known: true,
|
|
43
|
+
tokenName: inner.tokenName,
|
|
44
|
+
resolvedValue: inner.resolvedValue,
|
|
45
|
+
leafTokenName: inner.leafTokenName ?? null,
|
|
46
|
+
cycle: inner.cycle,
|
|
47
|
+
}
|
|
48
|
+
: {
|
|
49
|
+
known: false,
|
|
50
|
+
tokenName: null,
|
|
51
|
+
resolvedValue: `var(${ref})`,
|
|
52
|
+
leafTokenName: null,
|
|
53
|
+
cycle: inner.cycle,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Inspector Adapter for framework-specific token attribution facts. */
|
|
57
|
+
export function createInspectorValueContext(tokenTable, localAliases = EMPTY_LOCAL_ALIASES, directionality) {
|
|
58
|
+
return {
|
|
59
|
+
tokenContext: {
|
|
60
|
+
table: tokenTable,
|
|
61
|
+
localAliases,
|
|
62
|
+
resolveDirectToken: (value) => directFrameworkColor(value, tokenTable),
|
|
63
|
+
resolveOrigin: inspectorTokenOrigin,
|
|
64
|
+
resolveAlias: twLocalAliasPolicy,
|
|
65
|
+
},
|
|
66
|
+
...(directionality ? { directionality } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { AtRuleCandidate, AtRuleContext, ResolvedProperty } from "../../css/model/index.js";
|
|
3
|
+
export interface AtRuleContextProviderProps {
|
|
4
|
+
rows: readonly ResolvedProperty[];
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Makes the active conditional source context available to fields that only
|
|
9
|
+
* receive a property name (not their resolved property row) as props.
|
|
10
|
+
*/
|
|
11
|
+
export declare function AtRuleContextProvider({ rows, children }: AtRuleContextProviderProps): ReactElement;
|
|
12
|
+
export declare function useFieldAtRules(property: string): readonly AtRuleCandidate[];
|
|
13
|
+
export interface AtRuleIndicatorProps {
|
|
14
|
+
atRules?: readonly (AtRuleContext | AtRuleCandidate)[];
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Compact, field-level attribution for the conditional rule that currently wins. */
|
|
18
|
+
export declare function AtRuleIndicator({ atRules, className }: AtRuleIndicatorProps): ReactElement | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
4
|
+
const EMPTY_AT_RULES = [];
|
|
5
|
+
const FieldAtRuleContext = createContext(new Map());
|
|
6
|
+
/**
|
|
7
|
+
* Makes the active conditional source context available to fields that only
|
|
8
|
+
* receive a property name (not their resolved property row) as props.
|
|
9
|
+
*/
|
|
10
|
+
export function AtRuleContextProvider({ rows, children }) {
|
|
11
|
+
const atRulesByProperty = useMemo(() => {
|
|
12
|
+
const next = new Map();
|
|
13
|
+
for (const row of rows) {
|
|
14
|
+
if (row.atRuleCandidates?.length) {
|
|
15
|
+
next.set(row.property, row.atRuleCandidates);
|
|
16
|
+
}
|
|
17
|
+
else if (row.atRules?.length) {
|
|
18
|
+
next.set(row.property, row.atRules.map((atRule) => ({ ...atRule, active: true })));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return next;
|
|
22
|
+
}, [rows]);
|
|
23
|
+
return (_jsx(FieldAtRuleContext.Provider, { value: atRulesByProperty, children: children }));
|
|
24
|
+
}
|
|
25
|
+
export function useFieldAtRules(property) {
|
|
26
|
+
return useContext(FieldAtRuleContext).get(property) ?? EMPTY_AT_RULES;
|
|
27
|
+
}
|
|
28
|
+
function labelFor(atRules) {
|
|
29
|
+
const kinds = Array.from(new Set(atRules.map((atRule) => atRule.kind)));
|
|
30
|
+
if (kinds.length === 1) {
|
|
31
|
+
if (kinds[0] === "media")
|
|
32
|
+
return "Media query";
|
|
33
|
+
if (kinds[0] === "container")
|
|
34
|
+
return "Container query";
|
|
35
|
+
return "Feature query";
|
|
36
|
+
}
|
|
37
|
+
return "Conditional query";
|
|
38
|
+
}
|
|
39
|
+
function countLabel(label, count) {
|
|
40
|
+
const noun = label.toLowerCase().replace(/query$/, count === 1 ? "query" : "queries");
|
|
41
|
+
return `${count} ${noun}`;
|
|
42
|
+
}
|
|
43
|
+
function portalContainer() {
|
|
44
|
+
return document.getElementById("nudge-ui-root")?.shadowRoot ?? document.body;
|
|
45
|
+
}
|
|
46
|
+
/** Compact, field-level attribution for the conditional rule that currently wins. */
|
|
47
|
+
export function AtRuleIndicator({ atRules = EMPTY_AT_RULES, className }) {
|
|
48
|
+
if (atRules.length === 0)
|
|
49
|
+
return null;
|
|
50
|
+
const label = labelFor(atRules);
|
|
51
|
+
const activeCount = atRules.filter((atRule) => !("active" in atRule) || atRule.active).length;
|
|
52
|
+
const count = countLabel(label, atRules.length);
|
|
53
|
+
return (_jsx(Tooltip.Provider, { children: _jsxs(Tooltip.Root, { disableHoverablePopup: true, children: [_jsx(Tooltip.Trigger, { type: "button", delay: 0, className: `at-rule-indicator${className ? ` ${className}` : ""}`, "data-test": "at-rule-indicator", "aria-label": activeCount > 0 ? `Active ${count}` : count, children: _jsx("span", { className: "at-rule-indicator__symbol", "aria-hidden": "true", children: atRules.length }) }), _jsx(Tooltip.Portal, { container: portalContainer(), children: _jsx(Tooltip.Positioner, { className: "at-rule-tooltip-positioner", side: "top", align: "end", sideOffset: 7, children: _jsx(Tooltip.Popup, { className: "at-rule-tooltip", "data-test": "at-rule-tooltip", children: _jsx("div", { className: "at-rule-tooltip__rules", children: atRules.map((atRule, index) => (_jsx("div", { className: `at-rule-tooltip__rule${!("active" in atRule) || atRule.active ? " at-rule-tooltip__rule--active" : ""}`, "data-active": !("active" in atRule) || atRule.active ? "true" : "false", children: _jsx("code", { children: atRule.params }) }, `${atRule.kind}-${atRule.params}-${index}`))) }) }) }) })] }) }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactElement } from "react";
|
|
2
|
+
export type ButtonVariant = "primary" | "secondary" | "quiet" | "danger" | "disabled";
|
|
3
|
+
export type ButtonSize = "default" | "compact";
|
|
4
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
"data-test"?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function Button({ variant, size, className, ...props }: ButtonProps): ReactElement;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function Button({ variant = "secondary", size = "default", className, ...props }) {
|
|
3
|
+
return (_jsx("button", { ...props, className: `button button--${variant} button--${size}${className ? ` ${className}` : ""}` }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function ColorSwatch({ color, className, "data-test": dataTest }) {
|
|
3
|
+
return (_jsx("span", { className: `color-swatch${className ? ` ${className}` : ""}`, "data-test": dataTest,
|
|
4
|
+
// SAFETY: React CSSProperties permits custom properties through index signatures; only --swatch-color is set.
|
|
5
|
+
style: { "--swatch-color": color || "transparent" }, "aria-hidden": "true" }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Visual boundary for an inspector control. It owns the shared control chrome
|
|
4
|
+
* while the child owns its particular input or selection behaviour.
|
|
5
|
+
*/
|
|
6
|
+
export type ControlAppearance = "default" | "embedded";
|
|
7
|
+
export type ControlDensity = "default" | "compact";
|
|
8
|
+
export interface ControlSurfaceProps extends HTMLAttributes<HTMLSpanElement> {
|
|
9
|
+
appearance?: ControlAppearance;
|
|
10
|
+
density?: ControlDensity;
|
|
11
|
+
"data-test"?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function ControlSurface({ appearance, density, className, children, ...props }: ControlSurfaceProps): ReactElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function ControlSurface({ appearance = "default", density = "default", className, children, ...props }) {
|
|
3
|
+
const classes = [
|
|
4
|
+
"control-surface",
|
|
5
|
+
appearance === "embedded" ? "control-surface--embedded" : "",
|
|
6
|
+
density === "compact" ? "control-surface--compact" : "",
|
|
7
|
+
className ?? "",
|
|
8
|
+
].filter(Boolean).join(" ");
|
|
9
|
+
return _jsx("span", { ...props, className: classes, children: children });
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode, ReactElement } from "react";
|
|
2
|
+
import type { AtRuleContext } from "../../css/model/index.js";
|
|
3
|
+
export interface FieldRowProps {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
property?: string;
|
|
10
|
+
atRules?: readonly AtRuleContext[];
|
|
11
|
+
className?: string;
|
|
12
|
+
"data-test"?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function FieldRow({ label, children, action, hint, hideLabel, property, atRules, className, "data-test": dataTest }: FieldRowProps): ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatInspectorLabel } from "./labels.js";
|
|
3
|
+
import { AtRuleIndicator, useFieldAtRules } from "./AtRuleContext.js";
|
|
4
|
+
export function FieldRow({ label, children, action, hint, hideLabel = false, property, atRules, className, "data-test": dataTest }) {
|
|
5
|
+
const displayLabel = typeof label === "string" ? formatInspectorLabel(label) : label;
|
|
6
|
+
const inheritedAtRules = useFieldAtRules(property ?? "");
|
|
7
|
+
const fieldAtRules = atRules ?? inheritedAtRules;
|
|
8
|
+
const hasAtRules = fieldAtRules.length > 0;
|
|
9
|
+
const rowClassName = [
|
|
10
|
+
"field-row",
|
|
11
|
+
action ? "field-row--has-action" : "",
|
|
12
|
+
className ?? "",
|
|
13
|
+
].filter(Boolean).join(" ");
|
|
14
|
+
return (_jsxs("label", { className: rowClassName, "data-test": dataTest, children: [_jsx("span", { className: `field-row__label${hideLabel ? " field-row__label--hidden" : ""}`, children: displayLabel }), _jsxs("span", { className: "field-row__control", "data-has-at-rule": hasAtRules ? "true" : undefined, children: [children, _jsx(AtRuleIndicator, { atRules: fieldAtRules }), hint ? _jsx("span", { className: "field-row__hint", children: hint }) : null] }), action ? _jsx("span", { className: "field-row__action", children: action }) : null] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from "react";
|
|
2
|
+
import type { ButtonSize, ButtonVariant } from "./Button.js";
|
|
3
|
+
export type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
|
+
label: string;
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
"data-test"?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
label: string;
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
"data-test"?: string;
|
|
14
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
export const IconButton = forwardRef(function IconButton({ label, variant = "secondary", size = "default", className, ...props }, ref) {
|
|
4
|
+
return (_jsx("button", { ref: ref, ...props, type: props.type ?? "button", "aria-label": label, className: `icon-button icon-button--${variant} icon-button--${size}${className ? ` ${className}` : ""}` }));
|
|
5
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface InspectorPopoverProps {
|
|
3
|
+
triggerElement: ReactElement;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
8
|
+
align?: "start" | "center" | "end";
|
|
9
|
+
sideOffset?: number;
|
|
10
|
+
"data-test"?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base UI popover anchored inside the inspector shadow root. Unlike the
|
|
14
|
+
* listbox popover, this leaves the popup content to the caller for compound
|
|
15
|
+
* settings panels and field controls.
|
|
16
|
+
*/
|
|
17
|
+
export declare function InspectorPopover({ triggerElement, children, open, onOpenChange, side, align, sideOffset, "data-test": dataTest, }: InspectorPopoverProps): ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
3
|
+
/**
|
|
4
|
+
* Base UI popover anchored inside the inspector shadow root. Unlike the
|
|
5
|
+
* listbox popover, this leaves the popup content to the caller for compound
|
|
6
|
+
* settings panels and field controls.
|
|
7
|
+
*/
|
|
8
|
+
export function InspectorPopover({ triggerElement, children, open, onOpenChange, side = "bottom", align = "center", sideOffset = 6, "data-test": dataTest, }) {
|
|
9
|
+
const portalContainer = typeof document !== "undefined"
|
|
10
|
+
? document.getElementById("nudge-ui-root")?.shadowRoot ?? document.body
|
|
11
|
+
: null;
|
|
12
|
+
return (_jsxs(BasePopover.Root, { open: open, onOpenChange: onOpenChange, children: [_jsx(BasePopover.Trigger, { render: triggerElement, "data-test": dataTest }), _jsx(BasePopover.Portal, { container: portalContainer, children: _jsx(BasePopover.Positioner, { className: "inspector-popover__positioner", side: side, align: align, sideOffset: sideOffset, children: _jsx(BasePopover.Popup, { className: "inspector-popover__popup", "data-test": dataTest ? `${dataTest}-popover` : undefined, children: children }) }) })] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FocusEventHandler, KeyboardEventHandler, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import type { ControlAppearance } from "./ControlSurface.js";
|
|
3
|
+
export interface PopoverListboxItem {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
leading?: ReactNode;
|
|
7
|
+
trailing?: ReactNode;
|
|
8
|
+
"data-test"?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PopoverListboxProps {
|
|
11
|
+
value?: string | null;
|
|
12
|
+
query: string;
|
|
13
|
+
items: PopoverListboxItem[];
|
|
14
|
+
open: boolean;
|
|
15
|
+
trigger?: ReactNode;
|
|
16
|
+
triggerElement?: ReactElement;
|
|
17
|
+
triggerClassName?: string;
|
|
18
|
+
triggerDataTest?: string;
|
|
19
|
+
triggerAriaLabel?: string;
|
|
20
|
+
searchable?: boolean;
|
|
21
|
+
searchPlaceholder?: string;
|
|
22
|
+
searchAriaLabel?: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
25
|
+
inputClassName?: string;
|
|
26
|
+
inputAppearance?: ControlAppearance;
|
|
27
|
+
inputDataTest?: string;
|
|
28
|
+
inputOnFocus?: FocusEventHandler<HTMLInputElement>;
|
|
29
|
+
inputOnBlur?: FocusEventHandler<HTMLInputElement>;
|
|
30
|
+
inputOnKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
onQueryChange: (query: string) => void;
|
|
34
|
+
onOpenChange: (open: boolean) => void;
|
|
35
|
+
onSelect: (value: string) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function PopoverListbox({ value, query, items, open, trigger, triggerElement, triggerClassName, triggerDataTest, triggerAriaLabel, searchable, searchPlaceholder, searchAriaLabel, placeholder, inputRef, inputClassName, inputAppearance, inputDataTest, inputOnFocus, inputOnBlur, inputOnKeyDown, disabled, className, onQueryChange, onOpenChange, onSelect, }: PopoverListboxProps): ReactElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
3
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
4
|
+
export function PopoverListbox({ value = null, query, items, open, trigger, triggerElement, triggerClassName, triggerDataTest, triggerAriaLabel, searchable = false, searchPlaceholder = "Search…", searchAriaLabel = "Search options", placeholder, inputRef, inputClassName, inputAppearance = "default", inputDataTest, inputOnFocus, inputOnBlur, inputOnKeyDown, disabled = false, className, onQueryChange, onOpenChange, onSelect, }) {
|
|
5
|
+
const portalContainer = typeof document !== "undefined"
|
|
6
|
+
? document.getElementById("nudge-ui-root")?.shadowRoot ?? document.body
|
|
7
|
+
: null;
|
|
8
|
+
const itemByValue = new Map(items.map((item) => [item.value, item]));
|
|
9
|
+
function renderComboboxItem(item) {
|
|
10
|
+
return (_jsxs(Combobox.Item, { value: item.value, className: "popover-listbox__item", "data-test": item["data-test"], children: [item.leading ? _jsx("span", { className: "popover-listbox__leading", children: item.leading }) : null, _jsx("span", { className: "popover-listbox__label", children: item.label }), item.trailing ? _jsx("span", { className: "popover-listbox__trailing", children: item.trailing }) : null] }, item.value));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx("div", { className: `popover-listbox${className ? ` ${className}` : ""}`, children: trigger || triggerElement ? (_jsxs(Combobox.Root, { value: value, inputValue: searchable ? undefined : query, open: open, items: items.map((item) => item.value), filteredItems: searchable ? undefined : items.map((item) => item.value), autoHighlight: true, itemToStringLabel: (item) => itemByValue.get(item)?.label ?? item, onInputValueChange: (next) => onQueryChange(next), onOpenChange: (next) => onOpenChange(next), onValueChange: (next) => {
|
|
13
|
+
if (typeof next === "string")
|
|
14
|
+
onSelect(next);
|
|
15
|
+
}, children: [triggerElement ? (_jsx(Combobox.Trigger, { render: triggerElement, className: `popover-listbox__trigger${triggerClassName ? ` ${triggerClassName}` : ""}`, "data-test": triggerDataTest, "aria-label": triggerAriaLabel, disabled: disabled })) : (_jsx(Combobox.Trigger, { className: `popover-listbox__trigger${triggerClassName ? ` ${triggerClassName}` : ""}`, "data-test": triggerDataTest, "aria-label": triggerAriaLabel, disabled: disabled, children: trigger })), _jsx(Combobox.Portal, { container: portalContainer, children: _jsx(Combobox.Positioner, { className: "popover-listbox__positioner", children: _jsxs(Combobox.Popup, { className: `popover-listbox__popup${searchable ? " popover-listbox__popup--searchable" : ""}`, children: [searchable ? (_jsxs(_Fragment, { children: [_jsx(Combobox.Input, { className: "popover-listbox__search-input", placeholder: searchPlaceholder, "aria-label": searchAriaLabel, "data-test": triggerDataTest ? `${triggerDataTest}-search` : "popover-listbox-search" }), _jsx(Combobox.Empty, { className: "popover-listbox__empty", children: "No matching options." })] })) : null, _jsx(Combobox.List, { className: `popover-listbox__list${searchable ? " popover-listbox__list--searchable" : ""}`, children: searchable
|
|
16
|
+
? ((itemValue) => {
|
|
17
|
+
const item = itemByValue.get(itemValue);
|
|
18
|
+
return item ? renderComboboxItem(item) : null;
|
|
19
|
+
})
|
|
20
|
+
: items.map((item) => renderComboboxItem(item)) })] }) }) })] })) : (_jsxs(Autocomplete.Root, { value: query, open: open, items: items.map((item) => item.value), filteredItems: items.map((item) => item.value), autoHighlight: true, mode: "none", openOnInputClick: true, onValueChange: onQueryChange, onOpenChange: (next) => onOpenChange(next), children: [_jsx(Autocomplete.Input, { ref: inputRef, className: `text-input${inputAppearance === "embedded" ? " text-input--embedded" : ""}${inputClassName ? ` ${inputClassName}` : ""}`, placeholder: placeholder, "data-test": inputDataTest, onFocus: inputOnFocus, onBlur: inputOnBlur, onKeyDownCapture: inputOnKeyDown, disabled: disabled }), _jsx(Autocomplete.Portal, { container: portalContainer, children: _jsx(Autocomplete.Positioner, { className: "popover-listbox__positioner", children: _jsx(Autocomplete.Popup, { className: "popover-listbox__popup", children: _jsx(Autocomplete.List, { className: "popover-listbox__list", children: items.map((item) => (_jsxs(Autocomplete.Item, { value: item.value, className: "popover-listbox__item", "data-test": item["data-test"], onClick: () => onSelect(item.value), children: [item.leading ? _jsx("span", { className: "popover-listbox__leading", children: item.leading }) : null, _jsx("span", { className: "popover-listbox__label", children: item.label }), item.trailing ? _jsx("span", { className: "popover-listbox__trailing", children: item.trailing }) : null] }, item.value))) }) }) }) })] })) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface SegmentedControlOption<T extends string> {
|
|
3
|
+
value: T;
|
|
4
|
+
/** Accessible name; also the visible label when `icon` is omitted. */
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
interface SegmentedControlProps<T extends string> {
|
|
10
|
+
value: T | null;
|
|
11
|
+
options: readonly SegmentedControlOption<T>[];
|
|
12
|
+
onChange: (value: T) => void;
|
|
13
|
+
"aria-label": string;
|
|
14
|
+
"data-test"?: string;
|
|
15
|
+
"data-property"?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Allows the active option to be cleared by clicking it again. */
|
|
18
|
+
allowDeselect?: boolean;
|
|
19
|
+
/** Restores the value represented by an unselected control. */
|
|
20
|
+
onDeselect?: () => void;
|
|
21
|
+
}
|
|
22
|
+
/** A compact single-choice control for adjacent, peer actions. */
|
|
23
|
+
export declare function SegmentedControl<T extends string>({ value, options, onChange, "aria-label": ariaLabel, "data-test": dataTest, "data-property": dataProperty, className, allowDeselect, onDeselect, }: SegmentedControlProps<T>): ReactElement;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
3
|
+
/** A compact single-choice control for adjacent, peer actions. */
|
|
4
|
+
export function SegmentedControl({ value, options, onChange, "aria-label": ariaLabel, "data-test": dataTest, "data-property": dataProperty, className, allowDeselect = false, onDeselect, }) {
|
|
5
|
+
return (_jsx("div", { className: `segmented-control${className ? ` ${className}` : ""}`, role: "group", "aria-label": ariaLabel, "data-test": dataTest, "data-property": dataProperty, children: options.map((option) => {
|
|
6
|
+
const selected = option.value === value;
|
|
7
|
+
return (_jsx(Toggle, { type: "button", className: `button segmented-control__button${selected ? " segmented-control__button--selected" : ""}`, pressed: selected, "aria-label": option.label, title: option.label, "data-test": option.testId, "data-active": selected ? "true" : "false", onPressedChange: (pressed) => {
|
|
8
|
+
if (pressed) {
|
|
9
|
+
onChange(option.value);
|
|
10
|
+
}
|
|
11
|
+
else if (allowDeselect) {
|
|
12
|
+
onDeselect?.();
|
|
13
|
+
}
|
|
14
|
+
}, children: option.icon ?? _jsx("span", { className: "segmented-control__label", children: option.label }) }, option.value));
|
|
15
|
+
}) }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactElement } from "react";
|
|
2
|
+
import type { ControlAppearance } from "./ControlSurface.js";
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectGroup {
|
|
9
|
+
label: string;
|
|
10
|
+
options: SelectOption[];
|
|
11
|
+
}
|
|
12
|
+
export type SelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "value"> & {
|
|
13
|
+
value?: string;
|
|
14
|
+
options?: SelectOption[];
|
|
15
|
+
groups?: SelectGroup[];
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
compact?: boolean;
|
|
18
|
+
appearance?: ControlAppearance;
|
|
19
|
+
searchable?: boolean;
|
|
20
|
+
searchPlaceholder?: string;
|
|
21
|
+
searchAriaLabel?: string;
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
"data-test"?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function Select(props: SelectProps): ReactElement;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
3
|
+
import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
|
|
4
|
+
import { IconCheck, IconChevronDown } from "@tabler/icons-react";
|
|
5
|
+
export function Select(props) {
|
|
6
|
+
if (props.searchable)
|
|
7
|
+
return _jsx(SearchableSelect, { ...props });
|
|
8
|
+
return _jsx(NativeSelect, { ...props });
|
|
9
|
+
}
|
|
10
|
+
function NativeSelect({ value, options = [], groups = [], placeholder, compact, appearance = "default", searchable: _searchable, searchPlaceholder: _searchPlaceholder, searchAriaLabel: _searchAriaLabel, className, disabled, children, ...props }) {
|
|
11
|
+
const allOptions = [...options, ...groups.flatMap((group) => group.options)];
|
|
12
|
+
const selectedOption = allOptions.find((option) => option.value === value);
|
|
13
|
+
const portalContainer = typeof document !== "undefined"
|
|
14
|
+
? document.getElementById("nudge-ui-root")?.shadowRoot ?? document.body
|
|
15
|
+
: null;
|
|
16
|
+
function handleValueChange(next) {
|
|
17
|
+
if (typeof next === "string")
|
|
18
|
+
props.onValueChange?.(next);
|
|
19
|
+
}
|
|
20
|
+
const { onValueChange: _onValueChange, ...triggerProps } = props;
|
|
21
|
+
return (_jsxs(BaseSelect.Root, { value: value || null, disabled: disabled, items: allOptions.map((option) => ({ value: option.value, label: option.label })), onValueChange: handleValueChange, children: [_jsxs(BaseSelect.Trigger, { ...triggerProps, disabled: disabled, className: `select${compact ? " select--compact" : ""}${appearance === "embedded" ? " select--embedded" : ""}${className ? ` ${className}` : ""}`, children: [_jsx(BaseSelect.Value, { className: "select__value", placeholder: placeholder, children: selectedOption?.label ?? (value || undefined) }), _jsx(BaseSelect.Icon, { className: "select__icon", children: _jsx(IconChevronDown, { size: 15, stroke: 1.8, "aria-hidden": "true" }) }), children] }), _jsx(BaseSelect.Portal, { container: portalContainer, children: _jsx(BaseSelect.Positioner, { className: "select__positioner", sideOffset: 4, children: _jsx(BaseSelect.Popup, { className: "select__popup", children: _jsxs(BaseSelect.List, { className: "select__list", children: [options.map((option) => _jsx(SelectItem, { option: option }, option.value)), groups.map((group) => (_jsxs(BaseSelect.Group, { className: "select__group", children: [_jsx(BaseSelect.GroupLabel, { className: "select__group-label", children: group.label }), group.options.map((option) => _jsx(SelectItem, { option: option }, `${group.label}-${option.value}`))] }, group.label)))] }) }) }) })] }));
|
|
22
|
+
}
|
|
23
|
+
function SearchableSelect({ value, options = [], groups = [], placeholder, compact, appearance = "default", searchable: _searchable, searchPlaceholder = "Search…", searchAriaLabel = "Search options", className, disabled, children, "data-test": dataTest, ...props }) {
|
|
24
|
+
const allOptions = [...options, ...groups.flatMap((group) => group.options)];
|
|
25
|
+
const selectedOption = allOptions.find((option) => option.value === value);
|
|
26
|
+
const optionByValue = new Map(allOptions.map((option) => [option.value, option]));
|
|
27
|
+
const searchableGroups = [
|
|
28
|
+
...(options.length > 0
|
|
29
|
+
? [{ value: "__ungrouped__", items: options.map((option) => option.value) }]
|
|
30
|
+
: []),
|
|
31
|
+
...groups.map((group, index) => ({
|
|
32
|
+
value: `group-${index}-${group.label}`,
|
|
33
|
+
label: group.label,
|
|
34
|
+
items: group.options.map((option) => option.value),
|
|
35
|
+
})),
|
|
36
|
+
];
|
|
37
|
+
const portalContainer = typeof document !== "undefined"
|
|
38
|
+
? document.getElementById("nudge-ui-root")?.shadowRoot ?? document.body
|
|
39
|
+
: null;
|
|
40
|
+
function handleValueChange(next) {
|
|
41
|
+
if (typeof next === "string")
|
|
42
|
+
props.onValueChange?.(next);
|
|
43
|
+
}
|
|
44
|
+
const { onValueChange: _onValueChange, ...triggerProps } = props;
|
|
45
|
+
const triggerClassName = `select${compact ? " select--compact" : ""}${appearance === "embedded" ? " select--embedded" : ""}${className ? ` ${className}` : ""}`;
|
|
46
|
+
return (_jsxs(BaseCombobox.Root, { value: value || null, disabled: disabled, items: searchableGroups, itemToStringLabel: (item) => optionByValue.get(item)?.label ?? item, autoHighlight: true, onValueChange: handleValueChange, children: [_jsxs(BaseCombobox.Trigger, { ...triggerProps, "data-test": dataTest, disabled: disabled, className: triggerClassName, children: [_jsx("span", { className: "select__value", children: _jsx(BaseCombobox.Value, { placeholder: placeholder, children: selectedOption?.label ?? (value || undefined) }) }), _jsx(BaseCombobox.Icon, { className: "select__icon", children: _jsx(IconChevronDown, { size: 15, stroke: 1.8, "aria-hidden": "true" }) }), children] }), _jsx(BaseCombobox.Portal, { container: portalContainer, children: _jsx(BaseCombobox.Positioner, { className: "select__positioner", sideOffset: 4, children: _jsxs(BaseCombobox.Popup, { className: "select__popup select__popup--searchable", children: [_jsx(BaseCombobox.Input, { className: "select__search-input", placeholder: searchPlaceholder, "aria-label": searchAriaLabel, "data-test": dataTest ? `${dataTest}-search` : "select-search" }), _jsx(BaseCombobox.Empty, { className: "select__empty", children: "No matching options." }), _jsx(BaseCombobox.List, { className: "select__list select__list--searchable", children: (group) => (_jsxs(BaseCombobox.Group, { className: "select__group", items: group.items, children: [group.label ? (_jsx(BaseCombobox.GroupLabel, { className: "select__group-label", children: group.label })) : null, _jsx(BaseCombobox.Collection, { children: (item) => {
|
|
47
|
+
const option = optionByValue.get(item);
|
|
48
|
+
return option ? _jsx(SearchableSelectItem, { option: option }, item) : null;
|
|
49
|
+
} })] }, group.value)) })] }) }) })] }));
|
|
50
|
+
}
|
|
51
|
+
function SelectItem({ option }) {
|
|
52
|
+
return (_jsxs(BaseSelect.Item, { className: "select__item", value: option.value, label: option.label, disabled: option.disabled, "data-value": option.value, children: [_jsx(BaseSelect.ItemText, { className: "select__item-text", children: option.label }), _jsx(BaseSelect.ItemIndicator, { className: "select__item-indicator", children: _jsx(IconCheck, { size: 15, stroke: 2.4, "aria-hidden": "true" }) })] }));
|
|
53
|
+
}
|
|
54
|
+
function SearchableSelectItem({ option }) {
|
|
55
|
+
return (_jsxs(BaseCombobox.Item, { className: "select__item", value: option.value, disabled: option.disabled, "data-value": option.value, children: [_jsx("span", { className: "select__item-text", children: option.label }), _jsx(BaseCombobox.ItemIndicator, { className: "select__item-indicator", children: _jsx(IconCheck, { size: 15, stroke: 2.4, "aria-hidden": "true" }) })] }));
|
|
56
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
export declare const SIDE_NAMES: readonly ["top", "right", "bottom", "left"];
|
|
3
|
+
export type SideName = (typeof SIDE_NAMES)[number];
|
|
4
|
+
export type SideValueAxis = "horizontal" | "vertical";
|
|
5
|
+
export type SideControlsLayout = "sides" | "corners";
|
|
6
|
+
export interface SideValueSlot {
|
|
7
|
+
side: SideName;
|
|
8
|
+
control: ReactNode;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
sideLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SideValuePairSlot {
|
|
13
|
+
axis: SideValueAxis;
|
|
14
|
+
control: ReactNode;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface SideValuesFieldProps {
|
|
18
|
+
label: ReactNode;
|
|
19
|
+
sides: readonly SideValueSlot[];
|
|
20
|
+
pairedControls?: readonly SideValuePairSlot[];
|
|
21
|
+
defaultExpanded?: boolean;
|
|
22
|
+
showLabel?: boolean;
|
|
23
|
+
empty?: boolean;
|
|
24
|
+
onAdd?: () => void;
|
|
25
|
+
emptyAction?: ReactNode;
|
|
26
|
+
resetKey?: unknown;
|
|
27
|
+
"data-test"?: string;
|
|
28
|
+
"data-property"?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A compact side editor. Callers provide grouped horizontal/vertical controls
|
|
32
|
+
* that expand into the four physical sides (or omit `pairedControls` to show
|
|
33
|
+
* the four sides directly). The field owns presentation and expand state
|
|
34
|
+
* while callers own the actual CSS/token controls rendered in each slot.
|
|
35
|
+
*/
|
|
36
|
+
export declare function SideValuesField({ label, sides, pairedControls, defaultExpanded, showLabel, empty, onAdd, emptyAction, resetKey, "data-test": dataTest, "data-property": dataProperty, }: SideValuesFieldProps): ReactElement;
|
|
37
|
+
export declare function SideControls({ label, sides, layout, }: {
|
|
38
|
+
label: ReactNode;
|
|
39
|
+
sides: readonly SideValueSlot[];
|
|
40
|
+
layout?: SideControlsLayout;
|
|
41
|
+
}): ReactElement;
|
|
42
|
+
export declare function MarginSideIndicator({ side }: {
|
|
43
|
+
side: SideName;
|
|
44
|
+
}): ReactElement;
|