@pyric/ui 0.1.0-alpha.7
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 +79 -0
- package/dist/agents/ContextWindowUsage.d.ts +67 -0
- package/dist/agents/ContextWindowUsage.d.ts.map +1 -0
- package/dist/agents/ContextWindowUsage.js +115 -0
- package/dist/agents/ContextWindowUsage.js.map +1 -0
- package/dist/agents/EmptyState.d.ts +18 -0
- package/dist/agents/EmptyState.d.ts.map +1 -0
- package/dist/agents/EmptyState.js +11 -0
- package/dist/agents/EmptyState.js.map +1 -0
- package/dist/agents/Fold.d.ts +37 -0
- package/dist/agents/Fold.d.ts.map +1 -0
- package/dist/agents/Fold.js +18 -0
- package/dist/agents/Fold.js.map +1 -0
- package/dist/agents/Modal.d.ts +25 -0
- package/dist/agents/Modal.d.ts.map +1 -0
- package/dist/agents/Modal.js +28 -0
- package/dist/agents/Modal.js.map +1 -0
- package/dist/agents/PulsingDot.d.ts +21 -0
- package/dist/agents/PulsingDot.d.ts.map +1 -0
- package/dist/agents/PulsingDot.js +18 -0
- package/dist/agents/PulsingDot.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +15 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/auth/authApi.d.ts +32 -0
- package/dist/auth/authApi.d.ts.map +1 -0
- package/dist/auth/authApi.js +27 -0
- package/dist/auth/authApi.js.map +1 -0
- package/dist/auth/claims.d.ts +27 -0
- package/dist/auth/claims.d.ts.map +1 -0
- package/dist/auth/claims.js +58 -0
- package/dist/auth/claims.js.map +1 -0
- package/dist/auth/components/AuthProviderToggles.d.ts +31 -0
- package/dist/auth/components/AuthProviderToggles.d.ts.map +1 -0
- package/dist/auth/components/AuthProviderToggles.js +48 -0
- package/dist/auth/components/AuthProviderToggles.js.map +1 -0
- package/dist/auth/components/AuthSignInHelper.d.ts +57 -0
- package/dist/auth/components/AuthSignInHelper.d.ts.map +1 -0
- package/dist/auth/components/AuthSignInHelper.js +69 -0
- package/dist/auth/components/AuthSignInHelper.js.map +1 -0
- package/dist/auth/components/AuthUserForm.d.ts +84 -0
- package/dist/auth/components/AuthUserForm.d.ts.map +1 -0
- package/dist/auth/components/AuthUserForm.js +89 -0
- package/dist/auth/components/AuthUserForm.js.map +1 -0
- package/dist/auth/components/AuthUserList.d.ts +51 -0
- package/dist/auth/components/AuthUserList.d.ts.map +1 -0
- package/dist/auth/components/AuthUserList.js +46 -0
- package/dist/auth/components/AuthUserList.js.map +1 -0
- package/dist/auth/components/ClaimsField.d.ts +22 -0
- package/dist/auth/components/ClaimsField.d.ts.map +1 -0
- package/dist/auth/components/ClaimsField.js +11 -0
- package/dist/auth/components/ClaimsField.js.map +1 -0
- package/dist/auth/components/confirmActions.d.ts +40 -0
- package/dist/auth/components/confirmActions.d.ts.map +1 -0
- package/dist/auth/components/confirmActions.js +49 -0
- package/dist/auth/components/confirmActions.js.map +1 -0
- package/dist/auth/controller.d.ts +73 -0
- package/dist/auth/controller.d.ts.map +1 -0
- package/dist/auth/controller.js +139 -0
- package/dist/auth/controller.js.map +1 -0
- package/dist/auth/hooks/index.d.ts +7 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +7 -0
- package/dist/auth/hooks/index.js.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.js +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.js.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts +37 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.js +98 -0
- package/dist/auth/hooks/useAuthProviderConfig.js.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts +30 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.js +27 -0
- package/dist/auth/hooks/useAuthUserEditor.js.map +1 -0
- package/dist/auth/hooks/useAuthUsers.d.ts +38 -0
- package/dist/auth/hooks/useAuthUsers.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUsers.js +111 -0
- package/dist/auth/hooks/useAuthUsers.js.map +1 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/providers.d.ts +11 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +28 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/reducers/userEditor.d.ts +55 -0
- package/dist/auth/reducers/userEditor.d.ts.map +1 -0
- package/dist/auth/reducers/userEditor.js +136 -0
- package/dist/auth/reducers/userEditor.js.map +1 -0
- package/dist/events/components/ActivityActionItems.d.ts +45 -0
- package/dist/events/components/ActivityActionItems.d.ts.map +1 -0
- package/dist/events/components/ActivityActionItems.js +68 -0
- package/dist/events/components/ActivityActionItems.js.map +1 -0
- package/dist/events/components/ActivityGrid.d.ts +65 -0
- package/dist/events/components/ActivityGrid.d.ts.map +1 -0
- package/dist/events/components/ActivityGrid.js +61 -0
- package/dist/events/components/ActivityGrid.js.map +1 -0
- package/dist/events/components/ActivityGridRow.d.ts +31 -0
- package/dist/events/components/ActivityGridRow.d.ts.map +1 -0
- package/dist/events/components/ActivityGridRow.js +23 -0
- package/dist/events/components/ActivityGridRow.js.map +1 -0
- package/dist/events/components/ProposedChangeDiff.d.ts +46 -0
- package/dist/events/components/ProposedChangeDiff.d.ts.map +1 -0
- package/dist/events/components/ProposedChangeDiff.js +60 -0
- package/dist/events/components/ProposedChangeDiff.js.map +1 -0
- package/dist/events/components/format.d.ts +11 -0
- package/dist/events/components/format.d.ts.map +1 -0
- package/dist/events/components/format.js +26 -0
- package/dist/events/components/format.js.map +1 -0
- package/dist/events/components/index.d.ts +6 -0
- package/dist/events/components/index.d.ts.map +1 -0
- package/dist/events/components/index.js +6 -0
- package/dist/events/components/index.js.map +1 -0
- package/dist/events/digest.d.ts +167 -0
- package/dist/events/digest.d.ts.map +1 -0
- package/dist/events/digest.js +426 -0
- package/dist/events/digest.js.map +1 -0
- package/dist/events/hooks/index.d.ts +3 -0
- package/dist/events/hooks/index.d.ts.map +1 -0
- package/dist/events/hooks/index.js +3 -0
- package/dist/events/hooks/index.js.map +1 -0
- package/dist/events/hooks/useActivityDigest.d.ts +27 -0
- package/dist/events/hooks/useActivityDigest.d.ts.map +1 -0
- package/dist/events/hooks/useActivityDigest.js +18 -0
- package/dist/events/hooks/useActivityDigest.js.map +1 -0
- package/dist/events/hooks/useActivityStream.d.ts +44 -0
- package/dist/events/hooks/useActivityStream.d.ts.map +1 -0
- package/dist/events/hooks/useActivityStream.js +38 -0
- package/dist/events/hooks/useActivityStream.js.map +1 -0
- package/dist/events/index.d.ts +15 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +14 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +160 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +21 -0
- package/dist/events/types.js.map +1 -0
- package/dist/firestore/components/CollectionList.d.ts +22 -0
- package/dist/firestore/components/CollectionList.d.ts.map +1 -0
- package/dist/firestore/components/CollectionList.js +21 -0
- package/dist/firestore/components/CollectionList.js.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts +38 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.js +33 -0
- package/dist/firestore/components/DeleteWithConfirm.js.map +1 -0
- package/dist/firestore/components/DocumentEditor.d.ts +47 -0
- package/dist/firestore/components/DocumentEditor.d.ts.map +1 -0
- package/dist/firestore/components/DocumentEditor.js +176 -0
- package/dist/firestore/components/DocumentEditor.js.map +1 -0
- package/dist/firestore/components/DocumentList.d.ts +60 -0
- package/dist/firestore/components/DocumentList.d.ts.map +1 -0
- package/dist/firestore/components/DocumentList.js +39 -0
- package/dist/firestore/components/DocumentList.js.map +1 -0
- package/dist/firestore/components/DocumentPreview.d.ts +68 -0
- package/dist/firestore/components/DocumentPreview.d.ts.map +1 -0
- package/dist/firestore/components/DocumentPreview.js +76 -0
- package/dist/firestore/components/DocumentPreview.js.map +1 -0
- package/dist/firestore/components/FieldRenderer.d.ts +17 -0
- package/dist/firestore/components/FieldRenderer.d.ts.map +1 -0
- package/dist/firestore/components/FieldRenderer.js +16 -0
- package/dist/firestore/components/FieldRenderer.js.map +1 -0
- package/dist/firestore/components/QueryBuilder.d.ts +25 -0
- package/dist/firestore/components/QueryBuilder.d.ts.map +1 -0
- package/dist/firestore/components/QueryBuilder.js +78 -0
- package/dist/firestore/components/QueryBuilder.js.map +1 -0
- package/dist/firestore/components/ReferencePicker.d.ts +33 -0
- package/dist/firestore/components/ReferencePicker.d.ts.map +1 -0
- package/dist/firestore/components/ReferencePicker.js +42 -0
- package/dist/firestore/components/ReferencePicker.js.map +1 -0
- package/dist/firestore/components/TreeEntry.d.ts +15 -0
- package/dist/firestore/components/TreeEntry.d.ts.map +1 -0
- package/dist/firestore/components/TreeEntry.js +23 -0
- package/dist/firestore/components/TreeEntry.js.map +1 -0
- package/dist/firestore/components/context.d.ts +18 -0
- package/dist/firestore/components/context.d.ts.map +1 -0
- package/dist/firestore/components/context.js +7 -0
- package/dist/firestore/components/context.js.map +1 -0
- package/dist/firestore/fieldEditors/array.d.ts +3 -0
- package/dist/firestore/fieldEditors/array.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/array.js +16 -0
- package/dist/firestore/fieldEditors/array.js.map +1 -0
- package/dist/firestore/fieldEditors/boolean.d.ts +3 -0
- package/dist/firestore/fieldEditors/boolean.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/boolean.js +13 -0
- package/dist/firestore/fieldEditors/boolean.js.map +1 -0
- package/dist/firestore/fieldEditors/bytes.d.ts +4 -0
- package/dist/firestore/fieldEditors/bytes.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/bytes.js +31 -0
- package/dist/firestore/fieldEditors/bytes.js.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts +4 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.js +32 -0
- package/dist/firestore/fieldEditors/geopoint.js.map +1 -0
- package/dist/firestore/fieldEditors/map.d.ts +3 -0
- package/dist/firestore/fieldEditors/map.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/map.js +19 -0
- package/dist/firestore/fieldEditors/map.js.map +1 -0
- package/dist/firestore/fieldEditors/null.d.ts +3 -0
- package/dist/firestore/fieldEditors/null.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/null.js +17 -0
- package/dist/firestore/fieldEditors/null.js.map +1 -0
- package/dist/firestore/fieldEditors/number.d.ts +3 -0
- package/dist/firestore/fieldEditors/number.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/number.js +24 -0
- package/dist/firestore/fieldEditors/number.js.map +1 -0
- package/dist/firestore/fieldEditors/reference.d.ts +4 -0
- package/dist/firestore/fieldEditors/reference.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/reference.js +49 -0
- package/dist/firestore/fieldEditors/reference.js.map +1 -0
- package/dist/firestore/fieldEditors/registry.d.ts +16 -0
- package/dist/firestore/fieldEditors/registry.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/registry.js +42 -0
- package/dist/firestore/fieldEditors/registry.js.map +1 -0
- package/dist/firestore/fieldEditors/string.d.ts +3 -0
- package/dist/firestore/fieldEditors/string.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/string.js +13 -0
- package/dist/firestore/fieldEditors/string.js.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts +4 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.js +52 -0
- package/dist/firestore/fieldEditors/timestamp.js.map +1 -0
- package/dist/firestore/fieldEditors/types.d.ts +64 -0
- package/dist/firestore/fieldEditors/types.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/types.js +2 -0
- package/dist/firestore/fieldEditors/types.js.map +1 -0
- package/dist/firestore/fieldEditors/vector.d.ts +29 -0
- package/dist/firestore/fieldEditors/vector.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/vector.js +93 -0
- package/dist/firestore/fieldEditors/vector.js.map +1 -0
- package/dist/firestore/firestoreApi.d.ts +35 -0
- package/dist/firestore/firestoreApi.d.ts.map +1 -0
- package/dist/firestore/firestoreApi.js +28 -0
- package/dist/firestore/firestoreApi.js.map +1 -0
- package/dist/firestore/hooks/coerceError.d.ts +17 -0
- package/dist/firestore/hooks/coerceError.d.ts.map +1 -0
- package/dist/firestore/hooks/coerceError.js +41 -0
- package/dist/firestore/hooks/coerceError.js.map +1 -0
- package/dist/firestore/hooks/index.d.ts +10 -0
- package/dist/firestore/hooks/index.d.ts.map +1 -0
- package/dist/firestore/hooks/index.js +10 -0
- package/dist/firestore/hooks/index.js.map +1 -0
- package/dist/firestore/hooks/useCollectionList.d.ts +37 -0
- package/dist/firestore/hooks/useCollectionList.d.ts.map +1 -0
- package/dist/firestore/hooks/useCollectionList.js +51 -0
- package/dist/firestore/hooks/useCollectionList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts +58 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.js +68 -0
- package/dist/firestore/hooks/useDocumentEditor.js.map +1 -0
- package/dist/firestore/hooks/useDocumentList.d.ts +45 -0
- package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentList.js +112 -0
- package/dist/firestore/hooks/useDocumentList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts +29 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js +48 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts +14 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.js +35 -0
- package/dist/firestore/hooks/useFirestoreCollection.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts +17 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.js +34 -0
- package/dist/firestore/hooks/useFirestoreDoc.js.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts +51 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.js +110 -0
- package/dist/firestore/hooks/useQueryBuilder.js.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts +40 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.js +44 -0
- package/dist/firestore/hooks/useRecursiveDelete.js.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts +70 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.js +140 -0
- package/dist/firestore/hooks/useReferencePicker.js.map +1 -0
- package/dist/firestore/import/parseImport.d.ts +55 -0
- package/dist/firestore/import/parseImport.d.ts.map +1 -0
- package/dist/firestore/import/parseImport.js +101 -0
- package/dist/firestore/import/parseImport.js.map +1 -0
- package/dist/firestore/index.d.ts +20 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +28 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/reducers/defaults.d.ts +10 -0
- package/dist/firestore/reducers/defaults.d.ts.map +1 -0
- package/dist/firestore/reducers/defaults.js +37 -0
- package/dist/firestore/reducers/defaults.js.map +1 -0
- package/dist/firestore/reducers/documentEditor.d.ts +23 -0
- package/dist/firestore/reducers/documentEditor.d.ts.map +1 -0
- package/dist/firestore/reducers/documentEditor.js +199 -0
- package/dist/firestore/reducers/documentEditor.js.map +1 -0
- package/dist/firestore/reducers/tree.d.ts +28 -0
- package/dist/firestore/reducers/tree.d.ts.map +1 -0
- package/dist/firestore/reducers/tree.js +129 -0
- package/dist/firestore/reducers/tree.js.map +1 -0
- package/dist/firestore/reducers/types.d.ts +112 -0
- package/dist/firestore/reducers/types.d.ts.map +1 -0
- package/dist/firestore/reducers/types.js +2 -0
- package/dist/firestore/reducers/types.js.map +1 -0
- package/dist/firestore/reducers/validation.d.ts +25 -0
- package/dist/firestore/reducers/validation.d.ts.map +1 -0
- package/dist/firestore/reducers/validation.js +121 -0
- package/dist/firestore/reducers/validation.js.map +1 -0
- package/dist/firestore/types.d.ts +77 -0
- package/dist/firestore/types.d.ts.map +1 -0
- package/dist/firestore/types.js +196 -0
- package/dist/firestore/types.js.map +1 -0
- package/dist/firestore/validation/ids.d.ts +23 -0
- package/dist/firestore/validation/ids.d.ts.map +1 -0
- package/dist/firestore/validation/ids.js +46 -0
- package/dist/firestore/validation/ids.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/Badge.d.ts +28 -0
- package/dist/primitives/Badge.d.ts.map +1 -0
- package/dist/primitives/Badge.js +11 -0
- package/dist/primitives/Badge.js.map +1 -0
- package/dist/primitives/ConfirmDialog.d.ts +42 -0
- package/dist/primitives/ConfirmDialog.d.ts.map +1 -0
- package/dist/primitives/ConfirmDialog.js +61 -0
- package/dist/primitives/ConfirmDialog.js.map +1 -0
- package/dist/primitives/CopyButton.d.ts +28 -0
- package/dist/primitives/CopyButton.d.ts.map +1 -0
- package/dist/primitives/CopyButton.js +27 -0
- package/dist/primitives/CopyButton.js.map +1 -0
- package/dist/primitives/JsonView.d.ts +29 -0
- package/dist/primitives/JsonView.d.ts.map +1 -0
- package/dist/primitives/JsonView.js +56 -0
- package/dist/primitives/JsonView.js.map +1 -0
- package/dist/primitives/SegmentedControl.d.ts +37 -0
- package/dist/primitives/SegmentedControl.d.ts.map +1 -0
- package/dist/primitives/SegmentedControl.js +18 -0
- package/dist/primitives/SegmentedControl.js.map +1 -0
- package/dist/primitives/Toast.d.ts +48 -0
- package/dist/primitives/Toast.d.ts.map +1 -0
- package/dist/primitives/Toast.js +60 -0
- package/dist/primitives/Toast.js.map +1 -0
- package/dist/primitives/VirtualList.d.ts +37 -0
- package/dist/primitives/VirtualList.d.ts.map +1 -0
- package/dist/primitives/VirtualList.js +47 -0
- package/dist/primitives/VirtualList.js.map +1 -0
- package/dist/primitives/hooks/useContainerSize.d.ts +29 -0
- package/dist/primitives/hooks/useContainerSize.d.ts.map +1 -0
- package/dist/primitives/hooks/useContainerSize.js +45 -0
- package/dist/primitives/hooks/useContainerSize.js.map +1 -0
- package/dist/primitives/index.d.ts +10 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +10 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/useConfirm.d.ts +34 -0
- package/dist/primitives/useConfirm.d.ts.map +1 -0
- package/dist/primitives/useConfirm.js +63 -0
- package/dist/primitives/useConfirm.js.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts +31 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.js +47 -0
- package/dist/rtdb/components/RtdbPathBar.js.map +1 -0
- package/dist/rtdb/components/RtdbTree.d.ts +38 -0
- package/dist/rtdb/components/RtdbTree.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbTree.js +103 -0
- package/dist/rtdb/components/RtdbTree.js.map +1 -0
- package/dist/rtdb/editor.d.ts +25 -0
- package/dist/rtdb/editor.d.ts.map +1 -0
- package/dist/rtdb/editor.js +79 -0
- package/dist/rtdb/editor.js.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts +31 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.js +49 -0
- package/dist/rtdb/hooks/useRtdbTree.js.map +1 -0
- package/dist/rtdb/index.d.ts +17 -0
- package/dist/rtdb/index.d.ts.map +1 -0
- package/dist/rtdb/index.js +21 -0
- package/dist/rtdb/index.js.map +1 -0
- package/dist/rtdb/pathInput.d.ts +28 -0
- package/dist/rtdb/pathInput.d.ts.map +1 -0
- package/dist/rtdb/pathInput.js +40 -0
- package/dist/rtdb/pathInput.js.map +1 -0
- package/dist/rtdb/reducers/tree.d.ts +86 -0
- package/dist/rtdb/reducers/tree.d.ts.map +1 -0
- package/dist/rtdb/reducers/tree.js +131 -0
- package/dist/rtdb/reducers/tree.js.map +1 -0
- package/dist/rtdb/rtdbApi.d.ts +20 -0
- package/dist/rtdb/rtdbApi.d.ts.map +1 -0
- package/dist/rtdb/rtdbApi.js +2 -0
- package/dist/rtdb/rtdbApi.js.map +1 -0
- package/dist/rtdb/values.d.ts +44 -0
- package/dist/rtdb/values.d.ts.map +1 -0
- package/dist/rtdb/values.js +143 -0
- package/dist/rtdb/values.js.map +1 -0
- package/dist/rules/components/DenialInspector.d.ts +18 -0
- package/dist/rules/components/DenialInspector.d.ts.map +1 -0
- package/dist/rules/components/DenialInspector.js +58 -0
- package/dist/rules/components/DenialInspector.js.map +1 -0
- package/dist/rules/components/format.d.ts +56 -0
- package/dist/rules/components/format.d.ts.map +1 -0
- package/dist/rules/components/format.js +137 -0
- package/dist/rules/components/format.js.map +1 -0
- package/dist/rules/components/index.d.ts +4 -0
- package/dist/rules/components/index.d.ts.map +1 -0
- package/dist/rules/components/index.js +4 -0
- package/dist/rules/components/index.js.map +1 -0
- package/dist/rules/components/scope.d.ts +10 -0
- package/dist/rules/components/scope.d.ts.map +1 -0
- package/dist/rules/components/scope.js +72 -0
- package/dist/rules/components/scope.js.map +1 -0
- package/dist/rules/hooks/index.d.ts +2 -0
- package/dist/rules/hooks/index.d.ts.map +1 -0
- package/dist/rules/hooks/index.js +2 -0
- package/dist/rules/hooks/index.js.map +1 -0
- package/dist/rules/hooks/useDenialTrace.d.ts +51 -0
- package/dist/rules/hooks/useDenialTrace.d.ts.map +1 -0
- package/dist/rules/hooks/useDenialTrace.js +58 -0
- package/dist/rules/hooks/useDenialTrace.js.map +1 -0
- package/dist/rules/index.d.ts +14 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +13 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/types.d.ts +75 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/storage/collisionRename.d.ts +73 -0
- package/dist/storage/collisionRename.d.ts.map +1 -0
- package/dist/storage/collisionRename.js +113 -0
- package/dist/storage/collisionRename.js.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts +68 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js +82 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js.map +1 -0
- package/dist/storage/components/ObjectBrowser.d.ts +75 -0
- package/dist/storage/components/ObjectBrowser.d.ts.map +1 -0
- package/dist/storage/components/ObjectBrowser.js +59 -0
- package/dist/storage/components/ObjectBrowser.js.map +1 -0
- package/dist/storage/components/ObjectInspector.d.ts +43 -0
- package/dist/storage/components/ObjectInspector.d.ts.map +1 -0
- package/dist/storage/components/ObjectInspector.js +92 -0
- package/dist/storage/components/ObjectInspector.js.map +1 -0
- package/dist/storage/components/PathBreadcrumb.d.ts +30 -0
- package/dist/storage/components/PathBreadcrumb.d.ts.map +1 -0
- package/dist/storage/components/PathBreadcrumb.js +26 -0
- package/dist/storage/components/PathBreadcrumb.js.map +1 -0
- package/dist/storage/components/UploadDropzone.d.ts +50 -0
- package/dist/storage/components/UploadDropzone.d.ts.map +1 -0
- package/dist/storage/components/UploadDropzone.js +109 -0
- package/dist/storage/components/UploadDropzone.js.map +1 -0
- package/dist/storage/folderPlaceholder.d.ts +14 -0
- package/dist/storage/folderPlaceholder.d.ts.map +1 -0
- package/dist/storage/folderPlaceholder.js +27 -0
- package/dist/storage/folderPlaceholder.js.map +1 -0
- package/dist/storage/hooks/index.d.ts +9 -0
- package/dist/storage/hooks/index.d.ts.map +1 -0
- package/dist/storage/hooks/index.js +9 -0
- package/dist/storage/hooks/index.js.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts +114 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.js +193 -0
- package/dist/storage/hooks/useMetadataEditor.js.map +1 -0
- package/dist/storage/hooks/useObjectUpload.d.ts +109 -0
- package/dist/storage/hooks/useObjectUpload.d.ts.map +1 -0
- package/dist/storage/hooks/useObjectUpload.js +134 -0
- package/dist/storage/hooks/useObjectUpload.js.map +1 -0
- package/dist/storage/hooks/usePathState.d.ts +43 -0
- package/dist/storage/hooks/usePathState.d.ts.map +1 -0
- package/dist/storage/hooks/usePathState.js +42 -0
- package/dist/storage/hooks/usePathState.js.map +1 -0
- package/dist/storage/hooks/useStorageDelete.d.ts +73 -0
- package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageDelete.js +114 -0
- package/dist/storage/hooks/useStorageDelete.js.map +1 -0
- package/dist/storage/hooks/useStorageList.d.ts +74 -0
- package/dist/storage/hooks/useStorageList.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageList.js +167 -0
- package/dist/storage/hooks/useStorageList.js.map +1 -0
- package/dist/storage/hooks/useStorageObject.d.ts +34 -0
- package/dist/storage/hooks/useStorageObject.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageObject.js +114 -0
- package/dist/storage/hooks/useStorageObject.js.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts +128 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.js +158 -0
- package/dist/storage/hooks/useStorageRulesGate.js.map +1 -0
- package/dist/storage/hooks/useStorageSelection.d.ts +32 -0
- package/dist/storage/hooks/useStorageSelection.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageSelection.js +55 -0
- package/dist/storage/hooks/useStorageSelection.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/pendingPrefixes.d.ts +73 -0
- package/dist/storage/pendingPrefixes.d.ts.map +1 -0
- package/dist/storage/pendingPrefixes.js +98 -0
- package/dist/storage/pendingPrefixes.js.map +1 -0
- package/dist/storage/previews.d.ts +51 -0
- package/dist/storage/previews.d.ts.map +1 -0
- package/dist/storage/previews.js +73 -0
- package/dist/storage/previews.js.map +1 -0
- package/dist/storage/storageApi.d.ts +30 -0
- package/dist/storage/storageApi.d.ts.map +1 -0
- package/dist/storage/storageApi.js +13 -0
- package/dist/storage/storageApi.js.map +1 -0
- package/dist/traffic/components/RuleHeatmap.d.ts +34 -0
- package/dist/traffic/components/RuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/components/RuleHeatmap.js +40 -0
- package/dist/traffic/components/RuleHeatmap.js.map +1 -0
- package/dist/traffic/components/TrafficDetail.d.ts +33 -0
- package/dist/traffic/components/TrafficDetail.d.ts.map +1 -0
- package/dist/traffic/components/TrafficDetail.js +28 -0
- package/dist/traffic/components/TrafficDetail.js.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts +28 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.js +18 -0
- package/dist/traffic/components/TrafficGroupRow.js.map +1 -0
- package/dist/traffic/components/TrafficLineChart.d.ts +34 -0
- package/dist/traffic/components/TrafficLineChart.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLineChart.js +49 -0
- package/dist/traffic/components/TrafficLineChart.js.map +1 -0
- package/dist/traffic/components/TrafficLog.d.ts +52 -0
- package/dist/traffic/components/TrafficLog.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLog.js +34 -0
- package/dist/traffic/components/TrafficLog.js.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts +26 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.js +24 -0
- package/dist/traffic/components/TrafficMetricCards.js.map +1 -0
- package/dist/traffic/components/TrafficRow.d.ts +40 -0
- package/dist/traffic/components/TrafficRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficRow.js +27 -0
- package/dist/traffic/components/TrafficRow.js.map +1 -0
- package/dist/traffic/components/TrafficStats.d.ts +18 -0
- package/dist/traffic/components/TrafficStats.d.ts.map +1 -0
- package/dist/traffic/components/TrafficStats.js +19 -0
- package/dist/traffic/components/TrafficStats.js.map +1 -0
- package/dist/traffic/components/TrafficTimeline.d.ts +81 -0
- package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -0
- package/dist/traffic/components/TrafficTimeline.js +72 -0
- package/dist/traffic/components/TrafficTimeline.js.map +1 -0
- package/dist/traffic/components/format.d.ts +13 -0
- package/dist/traffic/components/format.d.ts.map +1 -0
- package/dist/traffic/components/format.js +24 -0
- package/dist/traffic/components/format.js.map +1 -0
- package/dist/traffic/components/index.d.ts +11 -0
- package/dist/traffic/components/index.d.ts.map +1 -0
- package/dist/traffic/components/index.js +11 -0
- package/dist/traffic/components/index.js.map +1 -0
- package/dist/traffic/hooks/index.d.ts +8 -0
- package/dist/traffic/hooks/index.d.ts.map +1 -0
- package/dist/traffic/hooks/index.js +8 -0
- package/dist/traffic/hooks/index.js.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts +33 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.js +54 -0
- package/dist/traffic/hooks/useRuleHeatmap.js.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts +71 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.js +74 -0
- package/dist/traffic/hooks/useTrafficBuckets.js.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts +40 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.js +33 -0
- package/dist/traffic/hooks/useTrafficFilter.js.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts +47 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.js +73 -0
- package/dist/traffic/hooks/useTrafficGroups.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts +66 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.js +156 -0
- package/dist/traffic/hooks/useTrafficMetrics.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts +56 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.js +58 -0
- package/dist/traffic/hooks/useTrafficMonitor.js.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts +32 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.js +45 -0
- package/dist/traffic/hooks/useTrafficStats.js.map +1 -0
- package/dist/traffic/index.d.ts +4 -0
- package/dist/traffic/index.d.ts.map +1 -0
- package/dist/traffic/index.js +3 -0
- package/dist/traffic/index.js.map +1 -0
- package/dist/traffic/types.d.ts +72 -0
- package/dist/traffic/types.d.ts.map +1 -0
- package/dist/traffic/types.js +10 -0
- package/dist/traffic/types.js.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
/**
|
|
5
|
+
* Headless confirmation dialog. Hand-rolled (we evaluated Radix
|
|
6
|
+
* Dialog at M4 but Radix's Presence + Portal stack doesn't render
|
|
7
|
+
* under our bun:test + JSDOM env — see plan section 7 risk #1).
|
|
8
|
+
*
|
|
9
|
+
* Provides:
|
|
10
|
+
* - Portal to `document.body` (so the dialog can escape parent
|
|
11
|
+
* stacking contexts)
|
|
12
|
+
* - Escape-to-close
|
|
13
|
+
* - Overlay click to close
|
|
14
|
+
* - ARIA `role="dialog" aria-modal="true"` wiring
|
|
15
|
+
* - Focus restoration to the previously-focused element on close
|
|
16
|
+
* - Initial focus on the confirm button when opening
|
|
17
|
+
*
|
|
18
|
+
* Ships no visual CSS. Consumers style via the structural
|
|
19
|
+
* `data-pyric-*` attributes.
|
|
20
|
+
*/
|
|
21
|
+
export function ConfirmDialog({ open, onOpenChange, title, body, destructive, confirmLabel = 'Confirm', cancelLabel = 'Cancel', onConfirm, className, }) {
|
|
22
|
+
const confirmButtonRef = useRef(null);
|
|
23
|
+
const previouslyFocused = useRef(null);
|
|
24
|
+
// Escape-to-close.
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!open)
|
|
27
|
+
return;
|
|
28
|
+
const handler = (e) => {
|
|
29
|
+
if (e.key === 'Escape') {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
onOpenChange(false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener('keydown', handler);
|
|
35
|
+
return () => window.removeEventListener('keydown', handler);
|
|
36
|
+
}, [open, onOpenChange]);
|
|
37
|
+
// Focus management: capture the previously-focused element on
|
|
38
|
+
// open, restore it on close. Initial focus goes to the confirm
|
|
39
|
+
// button so destructive actions don't dispatch by accident
|
|
40
|
+
// (consumers wanting "Cancel" as the default can refocus in an
|
|
41
|
+
// effect).
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!open)
|
|
44
|
+
return;
|
|
45
|
+
previouslyFocused.current = document.activeElement;
|
|
46
|
+
confirmButtonRef.current?.focus();
|
|
47
|
+
return () => {
|
|
48
|
+
const prev = previouslyFocused.current;
|
|
49
|
+
prev?.focus?.();
|
|
50
|
+
};
|
|
51
|
+
}, [open]);
|
|
52
|
+
if (!open)
|
|
53
|
+
return null;
|
|
54
|
+
if (typeof document === 'undefined')
|
|
55
|
+
return null;
|
|
56
|
+
return createPortal(_jsxs("div", { role: "presentation", "data-pyric-ui": "confirm-portal", onClick: (e) => {
|
|
57
|
+
if (e.target === e.currentTarget)
|
|
58
|
+
onOpenChange(false);
|
|
59
|
+
}, children: [_jsx("div", { "data-pyric-ui": "confirm-overlay", "aria-hidden": "true" }), _jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": "pyric-confirm-title", "aria-describedby": body ? 'pyric-confirm-body' : undefined, className: className, "data-pyric-ui": "confirm-dialog", "data-pyric-destructive": destructive ? '' : undefined, children: [_jsx("div", { id: "pyric-confirm-title", "data-pyric-confirm-title": true, children: title }), body ? (_jsx("div", { id: "pyric-confirm-body", "data-pyric-confirm-body": true, children: body })) : null, _jsxs("div", { "data-pyric-confirm-actions": true, children: [_jsx("button", { type: "button", "data-pyric-confirm-cancel": true, onClick: () => onOpenChange(false), children: cancelLabel }), _jsx("button", { ref: confirmButtonRef, type: "button", "data-pyric-confirm-confirm": true, "data-pyric-destructive": destructive ? '' : undefined, onClick: onConfirm, children: confirmLabel })] })] })] }), document.body);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../src/primitives/ConfirmDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,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
|
3
|
+
/** Text to copy to the clipboard on click. */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Optional content to render inside the button. Defaults to a
|
|
6
|
+
* short text label that toggles between "Copy" and "Copied". */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Milliseconds before the `data-copied` state attribute clears.
|
|
9
|
+
* Defaults to 2000. */
|
|
10
|
+
resetMs?: number;
|
|
11
|
+
/** Forwarded to the underlying `<button>`. Consumers compose
|
|
12
|
+
* Tailwind classes, CSS-module classes, or whatever they want. */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Forwarded as the button's accessible label when in the idle
|
|
15
|
+
* state. Defaults to "Copy to clipboard". The copied state uses
|
|
16
|
+
* a hard-coded "Copied" label so screen readers announce the
|
|
17
|
+
* state change consistently. */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Headless copy-to-clipboard button. Exposes its `copied` state via
|
|
22
|
+
* the `data-copied` attribute on the underlying `<button>` so
|
|
23
|
+
* consumers can style the success state with `[data-copied]` (or
|
|
24
|
+
* `data-[copied]:bg-green-500` in Tailwind's arbitrary-variant
|
|
25
|
+
* syntax). Ships no visual styling of its own.
|
|
26
|
+
*/
|
|
27
|
+
export declare function CopyButton({ text, children, resetMs, className, ariaLabel, }: CopyButtonProps): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/primitives/CopyButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb;qEACiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;4BACwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;uEACmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;qCAGiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,OAAc,EACd,SAAS,EACT,SAA+B,GAChC,EAAE,eAAe,+BA2BjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Headless copy-to-clipboard button. Exposes its `copied` state via
|
|
5
|
+
* the `data-copied` attribute on the underlying `<button>` so
|
|
6
|
+
* consumers can style the success state with `[data-copied]` (or
|
|
7
|
+
* `data-[copied]:bg-green-500` in Tailwind's arbitrary-variant
|
|
8
|
+
* syntax). Ships no visual styling of its own.
|
|
9
|
+
*/
|
|
10
|
+
export function CopyButton({ text, children, resetMs = 2000, className, ariaLabel = 'Copy to clipboard', }) {
|
|
11
|
+
const [copied, setCopied] = useState(false);
|
|
12
|
+
async function handleClick() {
|
|
13
|
+
try {
|
|
14
|
+
await navigator.clipboard.writeText(text);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Clipboard write can fail (insecure context, denied permission).
|
|
18
|
+
// The library doesn't surface this here — callers wrap in a
|
|
19
|
+
// toast / callout if they want feedback.
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
setCopied(true);
|
|
23
|
+
window.setTimeout(() => setCopied(false), resetMs);
|
|
24
|
+
}
|
|
25
|
+
return (_jsx("button", { type: "button", onClick: handleClick, className: className, "data-copied": copied ? '' : undefined, "aria-label": copied ? 'Copied' : ariaLabel, children: children ?? (copied ? 'Copied' : 'Copy') }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/primitives/CopyButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAqBjD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,SAAS,EACT,SAAS,GAAG,mBAAmB,GACf;IAChB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,KAAK,UAAU,WAAW;QACxB,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;YAClE,4DAA4D;YAC5D,yCAAyC;YACzC,OAAO;QACT,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,iBACP,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,gBACxB,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAExC,QAAQ,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAClC,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface JsonViewProps {
|
|
2
|
+
/** Any JSON-serializable value. */
|
|
3
|
+
value: unknown;
|
|
4
|
+
/**
|
|
5
|
+
* Depth at and below which object/array nodes start collapsed.
|
|
6
|
+
* `0` collapses the root, `1` collapses everything under the root,
|
|
7
|
+
* `Infinity` (default) leaves everything expanded.
|
|
8
|
+
*/
|
|
9
|
+
defaultCollapsedDepth?: number;
|
|
10
|
+
/** Forwarded to the root container. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Headless collapsible JSON tree. One structural step above a
|
|
15
|
+
* `<pre>` dump: object/array nodes are independently expandable, but
|
|
16
|
+
* there's no editing and no syntax-color theme — just `data-pyric-*`
|
|
17
|
+
* hooks for the consumer to style.
|
|
18
|
+
*
|
|
19
|
+
* Styling hooks:
|
|
20
|
+
* - `[data-pyric-ui="json-view"]` — root
|
|
21
|
+
* - `[data-pyric-json-node]` — every node, with `data-pyric-json-type`
|
|
22
|
+
* - `[data-pyric-json-toggle]` — the expand/collapse button (containers only)
|
|
23
|
+
* - `[data-pyric-json-node][data-pyric-collapsed]` — a collapsed container
|
|
24
|
+
* - `[data-pyric-json-key]` — the key/index label
|
|
25
|
+
* - `[data-pyric-json-value]` — a primitive value
|
|
26
|
+
* - `[data-pyric-json-summary]` — the `{…}` / `[…]` placeholder when collapsed
|
|
27
|
+
*/
|
|
28
|
+
export declare function JsonView({ value, defaultCollapsedDepth, className, }: JsonViewProps): import("react").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=JsonView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonView.d.ts","sourceRoot":"","sources":["../../src/primitives/JsonView.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,qBAAgC,EAChC,SAAS,GACV,EAAE,aAAa,+BAUf"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
function kindOf(value) {
|
|
4
|
+
if (value === null || value === undefined)
|
|
5
|
+
return 'null';
|
|
6
|
+
if (Array.isArray(value))
|
|
7
|
+
return 'array';
|
|
8
|
+
const t = typeof value;
|
|
9
|
+
if (t === 'object')
|
|
10
|
+
return 'object';
|
|
11
|
+
if (t === 'number')
|
|
12
|
+
return 'number';
|
|
13
|
+
if (t === 'boolean')
|
|
14
|
+
return 'boolean';
|
|
15
|
+
return 'string';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Headless collapsible JSON tree. One structural step above a
|
|
19
|
+
* `<pre>` dump: object/array nodes are independently expandable, but
|
|
20
|
+
* there's no editing and no syntax-color theme — just `data-pyric-*`
|
|
21
|
+
* hooks for the consumer to style.
|
|
22
|
+
*
|
|
23
|
+
* Styling hooks:
|
|
24
|
+
* - `[data-pyric-ui="json-view"]` — root
|
|
25
|
+
* - `[data-pyric-json-node]` — every node, with `data-pyric-json-type`
|
|
26
|
+
* - `[data-pyric-json-toggle]` — the expand/collapse button (containers only)
|
|
27
|
+
* - `[data-pyric-json-node][data-pyric-collapsed]` — a collapsed container
|
|
28
|
+
* - `[data-pyric-json-key]` — the key/index label
|
|
29
|
+
* - `[data-pyric-json-value]` — a primitive value
|
|
30
|
+
* - `[data-pyric-json-summary]` — the `{…}` / `[…]` placeholder when collapsed
|
|
31
|
+
*/
|
|
32
|
+
export function JsonView({ value, defaultCollapsedDepth = Infinity, className, }) {
|
|
33
|
+
return (_jsx("div", { "data-pyric-ui": "json-view", className: className, children: _jsx(JsonNode, { value: value, depth: 0, defaultCollapsedDepth: defaultCollapsedDepth }) }));
|
|
34
|
+
}
|
|
35
|
+
function JsonNode({ value, nodeKey, depth, defaultCollapsedDepth, }) {
|
|
36
|
+
const kind = kindOf(value);
|
|
37
|
+
const isContainer = kind === 'object' || kind === 'array';
|
|
38
|
+
const [collapsed, setCollapsed] = useState(isContainer && depth >= defaultCollapsedDepth);
|
|
39
|
+
if (!isContainer) {
|
|
40
|
+
return (_jsxs("div", { "data-pyric-json-node": "", "data-pyric-json-type": kind, children: [nodeKey !== undefined ? (_jsx("span", { "data-pyric-json-key": "", children: nodeKey })) : null, _jsx("span", { "data-pyric-json-value": "", children: formatPrimitive(value, kind) })] }));
|
|
41
|
+
}
|
|
42
|
+
const entries = Array.isArray(value)
|
|
43
|
+
? value.map((v, i) => [String(i), v])
|
|
44
|
+
: Object.entries(value);
|
|
45
|
+
const open = kind === 'array' ? '[' : '{';
|
|
46
|
+
const close = kind === 'array' ? ']' : '}';
|
|
47
|
+
return (_jsxs("div", { "data-pyric-json-node": "", "data-pyric-json-type": kind, "data-pyric-collapsed": collapsed ? '' : undefined, children: [_jsxs("button", { type: "button", "data-pyric-json-toggle": "", "aria-expanded": !collapsed, onClick: () => setCollapsed((c) => !c), children: [nodeKey !== undefined ? (_jsx("span", { "data-pyric-json-key": "", children: nodeKey })) : null, collapsed ? (_jsxs("span", { "data-pyric-json-summary": "", children: [open, entries.length, close] })) : (_jsx("span", { "data-pyric-json-bracket": "", children: open }))] }), collapsed ? null : (_jsxs(_Fragment, { children: [_jsx("div", { "data-pyric-json-children": "", children: entries.map(([k, v]) => (_jsx(JsonNode, { value: v, nodeKey: k, depth: depth + 1, defaultCollapsedDepth: defaultCollapsedDepth }, k))) }), _jsx("span", { "data-pyric-json-bracket": "", children: close })] }))] }));
|
|
48
|
+
}
|
|
49
|
+
function formatPrimitive(value, kind) {
|
|
50
|
+
if (kind === 'null')
|
|
51
|
+
return 'null';
|
|
52
|
+
if (kind === 'string')
|
|
53
|
+
return JSON.stringify(value);
|
|
54
|
+
return String(value);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=JsonView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonView.js","sourceRoot":"","sources":["../../src/primitives/JsonView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,O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CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CACvB,KAAC,QAAQ,IAEP,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,KAAK,GAAG,CAAC,EAChB,qBAAqB,EAAE,qBAAqB,IAJvC,CAAC,CAKN,CACH,CAAC,GACE,EACN,0CAA8B,EAAE,YAAE,KAAK,GAAQ,IAC9C,CACJ,IACG,CACP,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAc,EAAE,IAAc;IACrD,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface SegmentedOption<T extends string> {
|
|
3
|
+
/** The value committed via `onChange` when this segment is picked. */
|
|
4
|
+
value: T;
|
|
5
|
+
/** Visible label. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Freeform tone surfaced as `data-pyric-segment-tone` — e.g. `ok`
|
|
9
|
+
* / `error` so the consumer can tint the active label. The library
|
|
10
|
+
* doesn't enumerate tones.
|
|
11
|
+
*/
|
|
12
|
+
tone?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SegmentedControlProps<T extends string> {
|
|
15
|
+
/** The selectable segments, rendered left-to-right. */
|
|
16
|
+
options: ReadonlyArray<SegmentedOption<T>>;
|
|
17
|
+
/** The currently-selected value. */
|
|
18
|
+
value: T;
|
|
19
|
+
/** Fired with the new value when a segment is clicked. */
|
|
20
|
+
onChange: (value: T) => void;
|
|
21
|
+
/** Forwarded to the container. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Accessible label for the radiogroup. */
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Headless segmented control — a single-select group of pill
|
|
28
|
+
* buttons that reads as one widget. Wired as an ARIA radiogroup.
|
|
29
|
+
*
|
|
30
|
+
* Ships no visual styling. Consumers style via:
|
|
31
|
+
* - `[data-pyric-ui="segmented-control"]` — the container
|
|
32
|
+
* - `[data-pyric-segment]` — each option button
|
|
33
|
+
* - `[data-pyric-segment][data-pyric-active]` — the selected one
|
|
34
|
+
* - `[data-pyric-segment-tone="…"]` — tone-tinted options
|
|
35
|
+
*/
|
|
36
|
+
export declare function SegmentedControl<T extends string>({ options, value, onChange, className, ariaLabel, }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/primitives/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM;IAC/C,sEAAsE;IACtE,KAAK,EAAE,CAAC,CAAC;IACT,qBAAqB;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM;IACrD,uDAAuD;IACvD,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,oCAAoC;IACpC,KAAK,EAAE,CAAC,CAAC;IACT,0DAA0D;IAC1D,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,EACjD,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,CAAC,CAAC,CAAC,+BA2B1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Headless segmented control — a single-select group of pill
|
|
4
|
+
* buttons that reads as one widget. Wired as an ARIA radiogroup.
|
|
5
|
+
*
|
|
6
|
+
* Ships no visual styling. Consumers style via:
|
|
7
|
+
* - `[data-pyric-ui="segmented-control"]` — the container
|
|
8
|
+
* - `[data-pyric-segment]` — each option button
|
|
9
|
+
* - `[data-pyric-segment][data-pyric-active]` — the selected one
|
|
10
|
+
* - `[data-pyric-segment-tone="…"]` — tone-tinted options
|
|
11
|
+
*/
|
|
12
|
+
export function SegmentedControl({ options, value, onChange, className, ariaLabel, }) {
|
|
13
|
+
return (_jsx("div", { "data-pyric-ui": "segmented-control", className: className, role: "radiogroup", "aria-label": ariaLabel, children: options.map((opt) => {
|
|
14
|
+
const active = opt.value === value;
|
|
15
|
+
return (_jsx("button", { type: "button", role: "radio", "aria-checked": active, onClick: () => onChange(opt.value), "data-pyric-segment": "", "data-pyric-active": active ? '' : undefined, "data-pyric-segment-tone": opt.tone, children: opt.label }, opt.value));
|
|
16
|
+
}) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../../src/primitives/SegmentedControl.tsx"],"names":[],"mappings":";AA4BA;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAmB,EACjD,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,GACgB;IACzB,OAAO,CACL,+BACgB,mBAAmB,EACjC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAC,YAAY,gBACL,SAAS,YAEpB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;YACnC,OAAO,CACL,iBAEE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,OAAO,kBACE,MAAM,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,wBACf,EAAE,uBACF,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,6BACjB,GAAG,CAAC,IAAI,YAEhC,GAAG,CAAC,KAAK,IATL,GAAG,CAAC,KAAK,CAUP,CACV,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type ToastKind = 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
export interface ToastInput {
|
|
4
|
+
title: string;
|
|
5
|
+
body?: ReactNode;
|
|
6
|
+
kind?: ToastKind;
|
|
7
|
+
/** Auto-dismiss after this many ms. `0` makes the toast sticky;
|
|
8
|
+
* default is 5000. */
|
|
9
|
+
duration?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ToastRecord extends ToastInput {
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
14
|
+
interface ToastContextValue {
|
|
15
|
+
toast: (input: ToastInput) => string;
|
|
16
|
+
dismiss: (id: string) => void;
|
|
17
|
+
toasts: ReadonlyArray<ToastRecord>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Imperative toast hook. Returns `{ toast, dismiss, toasts }`.
|
|
21
|
+
*
|
|
22
|
+
* const { toast } = useToast();
|
|
23
|
+
* toast({ title: 'Saved.', kind: 'success' });
|
|
24
|
+
*
|
|
25
|
+
* Requires a `<ToastProvider>` ancestor.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useToast(): ToastContextValue;
|
|
28
|
+
export interface ToastProviderProps {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/** Default auto-dismiss in ms. Per-toast `duration` overrides.
|
|
31
|
+
* Default 5000; pass `0` to make sticky-by-default. */
|
|
32
|
+
defaultDuration?: number;
|
|
33
|
+
/** Forwarded to the rendered container. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Region label for assistive tech. Defaults to "Notifications". */
|
|
36
|
+
regionLabel?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Toast queue host. Mounts a single live region into `document.body`
|
|
40
|
+
* via portal and exposes the imperative API via context. Scoped —
|
|
41
|
+
* a subtree can host its own provider for isolated queues if needed.
|
|
42
|
+
*
|
|
43
|
+
* Headless: every node carries structural `data-*` attributes, no
|
|
44
|
+
* shipped CSS. Auto-dismiss timers are kept per-toast.
|
|
45
|
+
*/
|
|
46
|
+
export declare function ToastProvider({ children, defaultDuration, className, regionLabel, }: ToastProviderProps): import("react").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/primitives/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;2BACuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACpC;AAID;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB;4DACwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,eAAsB,EACtB,SAAS,EACT,WAA6B,GAC9B,EAAE,kBAAkB,+BAwCpB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
const Ctx = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Imperative toast hook. Returns `{ toast, dismiss, toasts }`.
|
|
7
|
+
*
|
|
8
|
+
* const { toast } = useToast();
|
|
9
|
+
* toast({ title: 'Saved.', kind: 'success' });
|
|
10
|
+
*
|
|
11
|
+
* Requires a `<ToastProvider>` ancestor.
|
|
12
|
+
*/
|
|
13
|
+
export function useToast() {
|
|
14
|
+
const ctx = useContext(Ctx);
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
throw new Error('useToast: missing <ToastProvider> ancestor');
|
|
17
|
+
}
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Toast queue host. Mounts a single live region into `document.body`
|
|
22
|
+
* via portal and exposes the imperative API via context. Scoped —
|
|
23
|
+
* a subtree can host its own provider for isolated queues if needed.
|
|
24
|
+
*
|
|
25
|
+
* Headless: every node carries structural `data-*` attributes, no
|
|
26
|
+
* shipped CSS. Auto-dismiss timers are kept per-toast.
|
|
27
|
+
*/
|
|
28
|
+
export function ToastProvider({ children, defaultDuration = 5000, className, regionLabel = 'Notifications', }) {
|
|
29
|
+
const [toasts, setToasts] = useState([]);
|
|
30
|
+
const dismiss = useCallback((id) => {
|
|
31
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
32
|
+
}, []);
|
|
33
|
+
const toast = useCallback((input) => {
|
|
34
|
+
const id = crypto.randomUUID();
|
|
35
|
+
const duration = input.duration ?? defaultDuration;
|
|
36
|
+
setToasts((prev) => [...prev, { id, ...input }]);
|
|
37
|
+
if (duration > 0) {
|
|
38
|
+
// Schedule auto-dismiss. The timer fires `dismiss(id)`
|
|
39
|
+
// which is idempotent (filter on a missing id is a no-op).
|
|
40
|
+
window.setTimeout(() => {
|
|
41
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
42
|
+
}, duration);
|
|
43
|
+
}
|
|
44
|
+
return id;
|
|
45
|
+
}, [defaultDuration]);
|
|
46
|
+
const value = useMemo(() => ({ toast, dismiss, toasts }), [toast, dismiss, toasts]);
|
|
47
|
+
return (_jsxs(Ctx.Provider, { value: value, children: [children, _jsx(ToastRegion, { toasts: toasts, dismiss: dismiss, className: className, regionLabel: regionLabel })] }));
|
|
48
|
+
}
|
|
49
|
+
function ToastRegion({ toasts, dismiss, className, regionLabel }) {
|
|
50
|
+
// SSR guard. Astro `client:only` consumers won't see this branch
|
|
51
|
+
// hit, but it keeps the import safe in mixed environments.
|
|
52
|
+
const [mounted, setMounted] = useState(false);
|
|
53
|
+
useEffect(() => setMounted(true), []);
|
|
54
|
+
if (!mounted)
|
|
55
|
+
return null;
|
|
56
|
+
if (typeof document === 'undefined')
|
|
57
|
+
return null;
|
|
58
|
+
return createPortal(_jsx("ol", { "aria-label": regionLabel, "aria-live": "polite", "data-pyric-ui": "toast-region", className: className, children: toasts.map((t) => (_jsxs("li", { "data-pyric-toast": true, "data-pyric-toast-kind": t.kind ?? 'info', role: t.kind === 'error' ? 'alert' : 'status', children: [_jsx("div", { "data-pyric-toast-title": true, children: t.title }), t.body ? _jsx("div", { "data-pyric-toast-body": true, children: t.body }) : null, _jsx("button", { type: "button", "data-pyric-toast-dismiss": true, "aria-label": "Dismiss", onClick: () => dismiss(t.id), children: "\u00D7" })] }, t.id))) }), document.body);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/primitives/Toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuBzC,MAAM,GAAG,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAaD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,eAAe,GAAG,IAAI,EACtB,SAAS,EACT,WAAW,GAAG,eAAe,GACV;IACnB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,EAAE,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QACzC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,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AAE,SAAS,EAAE,WAAW,EAAoB;IAChF,iEAAiE;IACjE,2DAA2D;IAC3D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACtC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAEjD,OAAO,YAAY,CACjB,2BACc,WAAW,eACb,QAAQ,mBACJ,cAAc,EAC5B,SAAS,EAAE,SAAS,YAEnB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACjB,iEAGyB,CAAC,CAAC,IAAI,IAAI,MAAM,EACvC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,aAE7C,wDAA6B,CAAC,CAAC,KAAK,GAAO,EAC1C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,uDAA4B,CAAC,CAAC,IAAI,GAAO,CAAC,CAAC,CAAC,IAAI,EAC1D,iBACE,IAAI,EAAC,QAAQ,kDAEF,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,uBAGrB,KAdJ,CAAC,CAAC,EAAE,CAeN,CACN,CAAC,GACC,EACL,QAAQ,CAAC,IAAI,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface VirtualListProps<T> {
|
|
3
|
+
items: ReadonlyArray<T>;
|
|
4
|
+
/** Estimated row height in px. `useVirtualizer` measures actual
|
|
5
|
+
* rendered heights via ResizeObserver — this is just the guess
|
|
6
|
+
* used before measurement. Pass a function for variable sizing. */
|
|
7
|
+
estimateSize: number | ((index: number) => number);
|
|
8
|
+
/** Render one row. The library handles positioning + key-by-index. */
|
|
9
|
+
renderItem: (item: T, index: number) => ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Number of off-screen rows to render on each side. TanStack
|
|
12
|
+
* default is 5; bump for smoother fast scrolling.
|
|
13
|
+
*/
|
|
14
|
+
overscan?: number;
|
|
15
|
+
/** Forwarded to the scroll container. */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Height the scroll container fills. Default `100%` — the
|
|
18
|
+
* consumer's parent typically constrains height. */
|
|
19
|
+
height?: number | string;
|
|
20
|
+
/** Optional `key` resolver. Defaults to the index. Use when rows
|
|
21
|
+
* reorder so React can preserve component state across moves. */
|
|
22
|
+
getItemKey?: (item: T, index: number) => string | number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Thin wrapper around `@tanstack/react-virtual`. Renders a
|
|
26
|
+
* scrollable container with absolutely-positioned rows, drawing
|
|
27
|
+
* only the rows currently in view (plus `overscan` neighbors).
|
|
28
|
+
*
|
|
29
|
+
* Headless — no shipped CSS beyond what's structurally required
|
|
30
|
+
* to position rows (the inner spacer's `height` + each row's
|
|
31
|
+
* `position: absolute; top: …px`). Consumers style via the
|
|
32
|
+
* `className` prop and standard CSS targeting `[data-pyric-ui=
|
|
33
|
+
* "virtual-list"]` on the scroll container and
|
|
34
|
+
* `[data-pyric-virtual-row]` on each row.
|
|
35
|
+
*/
|
|
36
|
+
export declare function VirtualList<T>({ items, estimateSize, renderItem, overscan, className, height, getItemKey, }: VirtualListProps<T>): import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=VirtualList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../src/primitives/VirtualList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxB;;wEAEoE;IACpE,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACnD,sEAAsE;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;yDACqD;IACrD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;sEACkE;IAClE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC;CAC1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC7B,KAAK,EACL,YAAY,EACZ,UAAU,EACV,QAAY,EACZ,SAAS,EACT,MAAe,EACf,UAAU,GACX,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BAyDrB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
4
|
+
/**
|
|
5
|
+
* Thin wrapper around `@tanstack/react-virtual`. Renders a
|
|
6
|
+
* scrollable container with absolutely-positioned rows, drawing
|
|
7
|
+
* only the rows currently in view (plus `overscan` neighbors).
|
|
8
|
+
*
|
|
9
|
+
* Headless — no shipped CSS beyond what's structurally required
|
|
10
|
+
* to position rows (the inner spacer's `height` + each row's
|
|
11
|
+
* `position: absolute; top: …px`). Consumers style via the
|
|
12
|
+
* `className` prop and standard CSS targeting `[data-pyric-ui=
|
|
13
|
+
* "virtual-list"]` on the scroll container and
|
|
14
|
+
* `[data-pyric-virtual-row]` on each row.
|
|
15
|
+
*/
|
|
16
|
+
export function VirtualList({ items, estimateSize, renderItem, overscan = 5, className, height = '100%', getItemKey, }) {
|
|
17
|
+
const parentRef = useRef(null);
|
|
18
|
+
const estimator = typeof estimateSize === 'function' ? estimateSize : () => estimateSize;
|
|
19
|
+
const virtualizer = useVirtualizer({
|
|
20
|
+
count: items.length,
|
|
21
|
+
getScrollElement: () => parentRef.current,
|
|
22
|
+
estimateSize: estimator,
|
|
23
|
+
overscan,
|
|
24
|
+
});
|
|
25
|
+
return (_jsx("div", { ref: parentRef, className: className, "data-pyric-ui": "virtual-list", style: {
|
|
26
|
+
height,
|
|
27
|
+
overflowY: 'auto',
|
|
28
|
+
// `contain` keeps the browser from spending paint cost on
|
|
29
|
+
// off-screen rows even before the virtualizer culls them.
|
|
30
|
+
contain: 'strict',
|
|
31
|
+
}, children: _jsx("div", { "data-pyric-virtual-inner": true, style: {
|
|
32
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
33
|
+
width: '100%',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
}, children: virtualizer.getVirtualItems().map((vi) => {
|
|
36
|
+
const item = items[vi.index];
|
|
37
|
+
const key = getItemKey ? getItemKey(item, vi.index) : vi.key;
|
|
38
|
+
return (_jsx("div", { "data-pyric-virtual-row": true, "data-index": vi.index, ref: virtualizer.measureElement, style: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
width: '100%',
|
|
43
|
+
transform: `translateY(${vi.start}px)`,
|
|
44
|
+
}, children: renderItem(item, vi.index) }, key));
|
|
45
|
+
}) }) }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=VirtualList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualList.js","sourceRoot":"","sources":["../../src/primitives/VirtualList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC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,GAAG,EAAE,WAAW,CAAC,cAAc,EAC/B,KAAK,EAAE;wBACL,QAAQ,EAAE,UAAU;wBACpB,GAAG,EAAE,CAAC;wBACN,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,MAAM;wBACb,SAAS,EAAE,cAAc,EAAE,CAAC,KAAK,KAAK;qBACvC,YAEA,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAZtB,GAAG,CAaJ,CACP,CAAC;YACJ,CAAC,CAAC,GACE,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export type ContainerSize = 'narrow' | 'medium' | 'wide';
|
|
3
|
+
export interface UseContainerSizeOptions {
|
|
4
|
+
/** Width (px) below which the bucket is `'narrow'`. Default 480. */
|
|
5
|
+
narrowBreakpoint?: number;
|
|
6
|
+
/** Width (px) below which the bucket is `'medium'` (and above
|
|
7
|
+
* which it is `'wide'`). Default 768. */
|
|
8
|
+
mediumBreakpoint?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Container-query helper. Returns the current size bucket
|
|
12
|
+
* (`'narrow' | 'medium' | 'wide'`) of the element pointed at by
|
|
13
|
+
* the returned ref. Re-fires on resize via `ResizeObserver`.
|
|
14
|
+
*
|
|
15
|
+
* const { ref, size } = useContainerSize();
|
|
16
|
+
* return <div ref={ref} data-size={size}>…</div>;
|
|
17
|
+
*
|
|
18
|
+
* Headless: the consumer styles via `[data-size='narrow']`
|
|
19
|
+
* selectors. The library's feature components use this hook to
|
|
20
|
+
* stamp their roots with `data-size`, which is the policy the
|
|
21
|
+
* survey's modern-CSS subsection landed on (no viewport media
|
|
22
|
+
* queries, no library-side breakpoints — push the threshold
|
|
23
|
+
* decision to the consumer via data attributes).
|
|
24
|
+
*/
|
|
25
|
+
export declare function useContainerSize<T extends HTMLElement = HTMLDivElement>(options?: UseContainerSizeOptions): {
|
|
26
|
+
ref: RefObject<T | null>;
|
|
27
|
+
size: ContainerSize;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useContainerSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContainerSize.d.ts","sourceRoot":"","sources":["../../../src/primitives/hooks/useContainerSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;8CAC0C;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,EACrE,OAAO,GAAE,uBAA4B,GACpC;IAAE,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAuBnD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Container-query helper. Returns the current size bucket
|
|
4
|
+
* (`'narrow' | 'medium' | 'wide'`) of the element pointed at by
|
|
5
|
+
* the returned ref. Re-fires on resize via `ResizeObserver`.
|
|
6
|
+
*
|
|
7
|
+
* const { ref, size } = useContainerSize();
|
|
8
|
+
* return <div ref={ref} data-size={size}>…</div>;
|
|
9
|
+
*
|
|
10
|
+
* Headless: the consumer styles via `[data-size='narrow']`
|
|
11
|
+
* selectors. The library's feature components use this hook to
|
|
12
|
+
* stamp their roots with `data-size`, which is the policy the
|
|
13
|
+
* survey's modern-CSS subsection landed on (no viewport media
|
|
14
|
+
* queries, no library-side breakpoints — push the threshold
|
|
15
|
+
* decision to the consumer via data attributes).
|
|
16
|
+
*/
|
|
17
|
+
export function useContainerSize(options = {}) {
|
|
18
|
+
const ref = useRef(null);
|
|
19
|
+
const narrow = options.narrowBreakpoint ?? 480;
|
|
20
|
+
const medium = options.mediumBreakpoint ?? 768;
|
|
21
|
+
const [size, setSize] = useState('wide');
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const el = ref.current;
|
|
24
|
+
if (!el)
|
|
25
|
+
return;
|
|
26
|
+
if (typeof ResizeObserver === 'undefined')
|
|
27
|
+
return;
|
|
28
|
+
const obs = new ResizeObserver((entries) => {
|
|
29
|
+
const entry = entries[0];
|
|
30
|
+
if (!entry)
|
|
31
|
+
return;
|
|
32
|
+
const w = entry.contentRect.width;
|
|
33
|
+
if (w < narrow)
|
|
34
|
+
setSize('narrow');
|
|
35
|
+
else if (w < medium)
|
|
36
|
+
setSize('medium');
|
|
37
|
+
else
|
|
38
|
+
setSize('wide');
|
|
39
|
+
});
|
|
40
|
+
obs.observe(el);
|
|
41
|
+
return () => obs.disconnect();
|
|
42
|
+
}, [narrow, medium]);
|
|
43
|
+
return { ref, size };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=useContainerSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContainerSize.js","sourceRoot":"","sources":["../../../src/primitives/hooks/useContainerSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAYpE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAmC,EAAE;IAErC,MAAM,GAAG,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,IAAI,GAAG,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,IAAI,GAAG,CAAC;IAC/C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAgB,MAAM,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,IAAI,OAAO,cAAc,KAAK,WAAW;YAAE,OAAO;QAClD,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACzC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;YAClC,IAAI,CAAC,GAAG,MAAM;gBAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;iBAC7B,IAAI,CAAC,GAAG,MAAM;gBAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;;gBAClC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAErB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { CopyButton, type CopyButtonProps } from './CopyButton.js';
|
|
2
|
+
export { Badge, type BadgeProps } from './Badge.js';
|
|
3
|
+
export { JsonView, type JsonViewProps, } from './JsonView.js';
|
|
4
|
+
export { SegmentedControl, type SegmentedControlProps, type SegmentedOption, } from './SegmentedControl.js';
|
|
5
|
+
export { ConfirmDialog, type ConfirmDialogProps } from './ConfirmDialog.js';
|
|
6
|
+
export { ConfirmProvider, useConfirm, type ConfirmOptions, type ConfirmFn, type ConfirmProviderProps, } from './useConfirm.js';
|
|
7
|
+
export { ToastProvider, useToast, type ToastInput, type ToastRecord, type ToastKind, type ToastProviderProps, } from './Toast.js';
|
|
8
|
+
export { VirtualList, type VirtualListProps } from './VirtualList.js';
|
|
9
|
+
export { useContainerSize, type ContainerSize, type UseContainerSizeOptions, } from './hooks/useContainerSize.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC"}
|